<?php global $itemId; if (!$itemId) return __ ('You need save form before use this field!'); $field->initiate (); ob_start (); ?> <div id="idList" style="margin: 0px; background-color: #FFF;"> <table id="_TERM_VIEW_<?= $fieldId ?>"> <tr> <td class="cTableHeader"><?= __ ('Name') ?></td> <td class="cTableHeader"><?= __ ('Version') ?></td> <td class="cTableHeader"><?= __ ('Author') ?></td> <td class="cTableHeader"><?= __ ('Date') ?></td> <td class="cTableHeader"></td> </tr> <tr height="5px"><td colspan="5"></td></tr> <?php $db = Database::singleton (); $sql = "SELECT u._name AS author, r.*, to_char(r._create, 'DD-MM-YYYY HH24:MI:SS') AS created FROM ". $field->getRelation () ." r LEFT JOIN ". $db->getSchema () ."._user u ON u._id = r._user WHERE r._relation = '". $itemId ."' ORDER BY r._version DESC"; $sth = $db->prepare ($sql); $sth->execute (); $control = array (); while ($obj = $sth->fetch (PDO::FETCH_OBJ)) { if (in_array ($obj->_id, $control) || !$field->docExists ($obj->_id)) continue; $control [] = $obj->_id; ?> <tr class="cTableItem" id="_TERM_ROW_<?= $fieldId ?>_<?= $obj->_id ?>_<?= $obj->_version ?>" style="cursor: pointer;" onclick="JavaScript: global.Document.openDocument ('<?= Document::register ($field->getRelation (), $obj->_id, $obj->_relation, $obj->_version, $field->getDocument ($obj->_id)->getPath () . $field->getDocument ($obj->_id)->getTemplate (), $field->getDocument ($obj->_id)->getLabel ()) ?>');"> <td id="_TERM_COLUMN_<?= $fieldId ?>_<?= $obj->_id ?>_<?= $obj->_version ?>"><?= $field->getDocument ($obj->_id)->getLabel () ?></td> <td><?= $obj->_version ?></td> <td><?= is_null ($obj->author) ? __ ('Generated by the system') : $obj->author ?></td> <td><?= $obj->created ?></td> <td style="text-align: right; display:;" nowrap="nowrap"> <img id="_TERM_IMG_<?= $fieldId ?>_<?= $obj->_id ?>_<?= $obj->_version ?>" src="titan.php?target=loadFile&file=interface/icon/pdf.gif" border="0" title="<?= __ ('Generate PDF') ?>" /> </td> </tr> <tr class="cSeparator"><td colspan="5"></td></tr> <?php } ?> </table> </div> <?php return ob_get_clean (); ?>