当前位置: 首页>>代码示例>>PHP>>正文


PHP Document::getLink方法代码示例

本文整理汇总了PHP中Document::getLink方法的典型用法代码示例。如果您正苦于以下问题:PHP Document::getLink方法的具体用法?PHP Document::getLink怎么用?PHP Document::getLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Document的用法示例。


在下文中一共展示了Document::getLink方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getTableGroup


//.........这里部分代码省略.........
         $specificity_columns[$field] = $spec_column;
     }
     $infocom_column = $table_group->addHeader('infocom', Infocom::getTypeName(Session::getPluralNumber()), $specific_column, $spec_column);
     $document_column = $table_group->addHeader('document', Document::getTypeName(Session::getPluralNumber()), $specific_column, $spec_column);
     if ($item->isDynamic()) {
         $dynamics_column = $table_group->addHeader('one', ' ', $dynamic_column, $spec_column);
         $previous_column = $dynamics_column;
     } else {
         $previous_column = $spec_column;
     }
     if ($options['canedit']) {
         $group_checkbox_tag = empty($peer_type) ? '__' : $peer_type;
         $content = Html::getCheckbox(array('criterion' => array('tag_for_massive' => $group_checkbox_tag)));
         $delete_one = $table_group->addHeader('one', $content, $delete_column, $previous_column);
     }
     if ($is_device) {
         $fk = 'items_id';
         // Entity restrict
         $leftjoin = '';
         $where = "";
         if (!empty($peer_type)) {
             $leftjoin = "LEFT JOIN `" . getTableForItemType($peer_type) . "`\n                        ON (`" . $this->getTable() . "`.`items_id` = `" . getTableForItemType($peer_type) . "`.`id`\n                            AND `" . $this->getTable() . "`.`itemtype` = '{$peer_type}')";
             $where = getEntitiesRestrictRequest(" AND", getTableForItemType($peer_type));
         }
         $query = "SELECT `" . $this->getTable() . "`.*\n                   FROM `" . $this->getTable() . "`\n                   {$leftjoin}\n                   WHERE `" . $this->getDeviceForeignKey() . "` = '" . $item->getID() . "'\n                         AND `" . $this->getTable() . "`.`itemtype` = '{$peer_type}'\n                         AND `" . $this->getTable() . "`.`is_deleted` = '0'\n                         {$where}\n                   ORDER BY `" . $this->getTable() . "`.`itemtype`, `" . $this->getTable() . "`.`{$fk}`";
     } else {
         $fk = $this->getDeviceForeignKey();
         $query = "SELECT *\n                   FROM `" . $this->getTable() . "`\n                   WHERE `itemtype` = '" . $item->getType() . "'\n                         AND `items_id` = '" . $item->getID() . "'\n                         AND `is_deleted` = '0'\n                   ORDER BY {$fk}";
     }
     if (!empty($peer_type)) {
         $peer = new $peer_type();
         $peer->getEmpty();
     } else {
         $peer = NULL;
     }
     foreach ($DB->request($query) as $link) {
         Session::addToNavigateListItems(static::getType(), $link["id"]);
         $this->getFromDB($link['id']);
         if (is_null($peer) || $link[$fk] != $peer->getID()) {
             if ($peer instanceof CommonDBTM) {
                 $peer->getFromDB($link[$fk]);
             }
             $current_row = $table_group->createRow();
             $peer_group = $peer_type . '_' . $link[$fk] . '_' . mt_rand();
             $current_row->setHTMLID($peer_group);
             if ($options['canedit']) {
                 $cell_value = Html::getCheckAllAsCheckbox($peer_group);
                 $current_row->addCell($delete_all_column, $cell_value);
             }
             if ($is_device) {
                 $cell = $current_row->addCell($peer_column, $peer ? $peer->getLink() : __('None'), NULL, $peer);
                 if (is_null($peer)) {
                     $cell->setHTMLClass('center');
                 }
             } else {
                 $peer->getHTMLTableCellForItem($current_row, $item, NULL, $options);
             }
         }
         if (Session::haveRight('device', UPDATE)) {
             $mode = __s('Update');
         } else {
             $mode = __s('View');
         }
         $spec_cell = $current_row->addCell($link_column, "<a href='" . $this->getLinkURL() . "'>{$mode}</a>");
         foreach ($this->getSpecificities() as $field => $attributs) {
             if (!empty($link[$field])) {
                 $content = $link[$field];
             } else {
                 $content = '';
             }
             $spec_cell = $current_row->addCell($specificity_columns[$field], $content, $spec_cell);
         }
         if (countElementsInTable('glpi_infocoms', "`itemtype`='" . $this->getType() . "' AND\n                                                    `items_id`='" . $link['id'] . "'")) {
             $content = array(array('function' => 'Infocom::showDisplayLink', 'parameters' => array($this->getType(), $link['id'])));
         } else {
             $content = '';
         }
         $current_row->addCell($infocom_column, $content, $spec_cell);
         $content = array();
         // The order is to be sure that specific documents appear first
         $query = "SELECT `documents_id`\n                   FROM `glpi_documents_items`\n                   WHERE (`itemtype` = '" . $this->getType() . "' AND `items_id` = '" . $link['id'] . "')\n                          OR (`itemtype` = '" . $this->getDeviceType() . "'\n                              AND `items_id` = '" . $link[$this->getDeviceForeignKey()] . "')\n                   ORDER BY `itemtype` = '" . $this->getDeviceType() . "'";
         $document = new Document();
         foreach ($DB->request($query) as $document_link) {
             if ($document->can($document_link['documents_id'], READ)) {
                 $content[] = $document->getLink();
             }
         }
         $content = implode('<br>', $content);
         $current_row->addCell($document_column, $content, $spec_cell);
         if ($item->isDynamic()) {
             $previous_cell = $current_row->addCell($dynamics_column, Dropdown::getYesNo($link['is_dynamic']), $spec_cell);
         } else {
             $previous_cell = $spec_cell;
         }
         if ($options['canedit']) {
             $cell_value = Html::getMassiveActionCheckBox($this->getType(), $link['id'], array('massive_tags' => $group_checkbox_tag));
             $current_row->addCell($delete_one, $cell_value, $previous_cell);
         }
     }
 }
开发者ID:pvasener,项目名称:glpi,代码行数:101,代码来源:item_devices.class.php

示例2: showListForItem


//.........这里部分代码省略.........
         } else {
             // Anonymous access from FAQ
             $query .= " AND `glpi_documents`.`entities_id`='0' ";
         }
     }
     $query .= " ORDER BY {$sort} {$order}";
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     $i = 0;
     $documents = array();
     $used = array();
     if ($numrows = $DB->numrows($result)) {
         while ($data = $DB->fetch_assoc($result)) {
             $documents[$data['assocID']] = $data;
             $used[$data['id']] = $data['id'];
         }
     }
     echo "<div class='spaced'>";
     if ($canedit && $number && $withtemplate < 2) {
         Html::openMassiveActionsForm('mass' . __CLASS__ . $params['rand']);
         $massiveactionparams = array('num_displayed' => $number, 'container' => 'mass' . __CLASS__ . $params['rand']);
         Html::showMassiveActions($massiveactionparams);
     }
     $sort_img = "<img src=\"" . $CFG_GLPI["root_doc"] . "/pics/" . ($order == "DESC" ? "puce-down.png" : "puce-up.png") . "\" alt='' title=''>";
     echo "<table class='tab_cadre_fixehov'>";
     $header_begin = "<tr>";
     $header_top = '';
     $header_bottom = '';
     $header_end = '';
     if ($canedit && $number && $withtemplate < 2) {
         $header_top .= "<th width='11'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $params['rand']);
         $header_top .= "</th>";
         $header_bottom .= "<th width='11'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $params['rand']);
         $header_bottom .= "</th>";
     }
     foreach ($columns as $key => $val) {
         $header_end .= "<th>" . ($sort == "`{$key}`" ? $sort_img : "") . "<a href='javascript:reloadTab(\"sort={$key}&amp;order=" . ($order == "ASC" ? "DESC" : "ASC") . "&amp;start=0\");'>{$val}</a></th>";
     }
     $header_end .= "</tr>";
     echo $header_begin . $header_top . $header_end;
     $used = array();
     if ($number) {
         // Don't use this for document associated to document
         // To not loose navigation list for current document
         if ($item->getType() != 'Document') {
             Session::initNavigateListItems('Document', sprintf(__('%1$s = %2$s'), $item->getTypeName(1), $item->getName()));
         }
         $document = new Document();
         foreach ($documents as $data) {
             $docID = $data["id"];
             $link = NOT_AVAILABLE;
             $downloadlink = NOT_AVAILABLE;
             if ($document->getFromDB($docID)) {
                 $link = $document->getLink();
                 $downloadlink = $document->getDownloadLink($linkparam);
             }
             if ($item->getType() != 'Document') {
                 Session::addToNavigateListItems('Document', $docID);
             }
             $used[$docID] = $docID;
             $assocID = $data["assocID"];
             echo "<tr class='tab_bg_1" . ($data["is_deleted"] ? "_2" : "") . "'>";
             if ($canedit && $withtemplate < 2) {
                 echo "<td width='10'>";
                 Html::showMassiveActionCheckBox(__CLASS__, $data["assocID"]);
                 echo "</td>";
             }
             echo "<td class='center'>{$link}</td>";
             echo "<td class='center'>" . $data['entity'] . "</td>";
             echo "<td class='center'>{$downloadlink}</td>";
             echo "<td class='center'>";
             if (!empty($data["link"])) {
                 echo "<a target=_blank href='" . formatOutputWebLink($data["link"]) . "'>" . $data["link"];
                 echo "</a>";
             } else {
                 echo "&nbsp;";
             }
             echo "</td>";
             echo "<td class='center'>" . Dropdown::getDropdownName("glpi_documentcategories", $data["documentcategories_id"]);
             echo "</td>";
             echo "<td class='center'>" . $data["mime"] . "</td>";
             if ($CFG_GLPI['use_rich_text']) {
                 echo "<td class='center'>";
                 echo !empty($data["tag"]) ? Document::getImageTag($data["tag"]) : '';
                 echo "</td>";
             }
             echo "<td class='center'>" . Html::convDateTime($data["assocdate"]) . "</td>";
             echo "</tr>";
             $i++;
         }
         echo $header_begin . $header_bottom . $header_end;
     }
     echo "</table>";
     if ($canedit && $number && $withtemplate < 2) {
         $massiveactionparams['ontop'] = false;
         Html::showMassiveActions($massiveactionparams);
         Html::closeForm();
     }
     echo "</div>";
 }
开发者ID:pvasener,项目名称:glpi,代码行数:101,代码来源:document_item.class.php

示例3: showList

 /**
  * Print the wainting ticket form
  *
  * @param $ID integer ID of the item
  * @param $options array
  *     - target filename : where to go when done.
  *     - withtemplate boolean : template or basic item
  *
  * @return Nothing (display)
  * */
 static function showList($item, $canedit)
 {
     global $CFG_GLPI;
     // validation des droits
     if (!self::canView()) {
         return false;
     }
     if (isset($_REQUEST["start"])) {
         $start = $_REQUEST["start"];
     } else {
         $start = 0;
     }
     $rand = mt_rand();
     // Get close informations
     $data = self::getCloseTicketFromDB($item->getField('id'), array('start' => $start, 'limit' => $_SESSION['glpilist_limit']));
     if (!count($data)) {
         echo "<div class='center'>";
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr><th>" . __('No historical') . "</th></tr>";
         echo "</table>";
         echo "</div><br>";
     } else {
         $doc = new Document();
         echo "<div class='center'>";
         // Display the pager
         Html::printAjaxPager(__('Close ticket informations', 'moreticket'), $start, count($data));
         if ($canedit) {
             Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
             $massiveactionparams = array('item' => __CLASS__, 'container' => 'mass' . __CLASS__ . $rand);
             Html::showMassiveActions($massiveactionparams);
         }
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr>";
         echo "<th width='10'>";
         if ($canedit) {
             echo Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
         }
         echo "</th>";
         echo "<th>" . __('Date') . "</th>";
         echo "<th>" . __('Comments') . "</th>";
         echo "<th>" . __('Writer') . "</th>";
         echo "<th>" . __('Document') . "</th>";
         echo "</tr>";
         foreach ($data as $closeTicket) {
             echo "<tr class='tab_bg_2'>";
             echo "<td width='10'>";
             if ($canedit) {
                 Html::showMassiveActionCheckBox(__CLASS__, $closeTicket['id']);
             }
             echo "</td>";
             echo "<td>";
             echo Html::convDateTime($closeTicket['date']);
             echo "</td>";
             echo "<td>";
             echo $closeTicket['comment'];
             echo "</td>";
             echo "<td>";
             echo getUserName($closeTicket['requesters_id']);
             echo "</td>";
             echo "<td>";
             if ($doc->getFromDB($closeTicket['documents_id'])) {
                 echo $doc->getLink();
             }
             echo "</td>";
             echo "</tr>";
         }
         if ($canedit) {
             $massiveactionparams['ontop'] = false;
             Html::showMassiveActions($massiveactionparams);
             Html::closeForm();
         }
         echo "</table>";
         echo "</div>";
         Html::printAjaxPager(__('Close ticket informations', 'moreticket'), $start, count($data));
     }
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:86,代码来源:closeticket.class.php

示例4: showAssociated

 /**
  * Show documents associated to an item
  *
  * @param $item CommonDBTM object for which associated documents must be displayed
  * @param $withtemplate
  **/
 static function showAssociated(CommonDBTM $item, $withtemplate = '')
 {
     global $DB, $CFG_GLPI, $LANG;
     $ID = $item->getField('id');
     if ($item->isNewID($ID)) {
         return false;
     }
     if ($item->getType() != 'Ticket' && $item->getType() != 'KnowbaseItem' && !haveRight('document', 'r')) {
         return false;
     }
     if (!$item->can($item->fields['id'], 'r')) {
         return false;
     }
     if (empty($withtemplate)) {
         $withtemplate = 0;
     }
     $linkparam = '';
     if (get_class($item) == 'Ticket') {
         $linkparam = "&amp;tickets_id=" . $item->fields['id'];
     }
     $canedit = $item->can($ID, 'w');
     $is_recursive = $item->isRecursive();
     $query = "SELECT `glpi_documents_items`.`id` AS assocID,\n                       `glpi_entities`.`id` AS entity,\n                       `glpi_documents`.`name` AS assocName,\n                       `glpi_documents`.*\n                FROM `glpi_documents_items`\n                LEFT JOIN `glpi_documents`\n                          ON (`glpi_documents_items`.`documents_id`=`glpi_documents`.`id`)\n                LEFT JOIN `glpi_entities` ON (`glpi_documents`.`entities_id`=`glpi_entities`.`id`)\n                WHERE `glpi_documents_items`.`items_id` = '{$ID}'\n                      AND `glpi_documents_items`.`itemtype` = '" . $item->getType() . "' ";
     if (getLoginUserID()) {
         $query .= getEntitiesRestrictRequest(" AND", "glpi_documents", '', '', true);
     } else {
         // Anonymous access from FAQ
         $query .= " AND `glpi_documents`.`entities_id`= '0' ";
     }
     // Document : search links in both order using union
     if ($item->getType() == 'Document') {
         $query .= "UNION\n                    SELECT `glpi_documents_items`.`id` AS assocID,\n                           `glpi_entities`.`id` AS entity,\n                           `glpi_documents`.`name` AS assocName,\n                           `glpi_documents`.*\n                    FROM `glpi_documents_items`\n                    LEFT JOIN `glpi_documents`\n                              ON (`glpi_documents_items`.`items_id`=`glpi_documents`.`id`)\n                    LEFT JOIN `glpi_entities`\n                              ON (`glpi_documents`.`entities_id`=`glpi_entities`.`id`)\n                    WHERE `glpi_documents_items`.`documents_id` = '{$ID}'\n                          AND `glpi_documents_items`.`itemtype` = '" . $item->getType() . "' ";
         if (getLoginUserID()) {
             $query .= getEntitiesRestrictRequest(" AND", "glpi_documents", '', '', true);
         } else {
             // Anonymous access from FAQ
             $query .= " AND `glpi_documents`.`entities_id`='0' ";
         }
     }
     $query .= " ORDER BY `assocName`";
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     $i = 0;
     if ($withtemplate != 2) {
         echo "<form method='post' action=\"" . $CFG_GLPI["root_doc"] . "/front/document.form.php\" enctype=\"multipart/form-data\">";
     }
     echo "<div class='spaced'><table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='7'>";
     if ($DB->numrows($result) == 0) {
         echo $LANG['document'][17];
     } else {
         if ($DB->numrows($result) == 1) {
             echo $LANG['document'][21];
         } else {
             echo $LANG['document'][20];
         }
     }
     echo "</th></tr>";
     echo "<tr><th>" . $LANG['common'][16] . "</th>";
     echo "<th>" . $LANG['entity'][0] . "</th>";
     echo "<th>" . $LANG['document'][2] . "</th>";
     echo "<th>" . $LANG['document'][33] . "</th>";
     echo "<th>" . $LANG['document'][3] . "</th>";
     echo "<th>" . $LANG['document'][4] . "</th>";
     if ($withtemplate < 2) {
         echo "<th>&nbsp;</th>";
     }
     echo "</tr>";
     $used = array();
     if ($number) {
         // Don't use this for document associated to document
         // To not loose navigation list for current document
         if ($item->getType() != 'Document') {
             initNavigateListItems('Document', $item->getTypeName() . " = " . $item->getName());
         }
         $document = new Document();
         while ($data = $DB->fetch_assoc($result)) {
             $docID = $data["id"];
             $link = NOT_AVAILABLE;
             $downloadlink = NOT_AVAILABLE;
             if ($document->getFromDB($docID)) {
                 $link = $document->getLink();
                 $downloadlink = $document->getDownloadLink($linkparam);
             }
             if ($item->getType() != 'Document') {
                 addToNavigateListItems('Document', $docID);
             }
             $used[$docID] = $docID;
             $assocID = $data["assocID"];
             echo "<tr class='tab_bg_1" . ($data["is_deleted"] ? "_2" : "") . "'>";
             echo "<td class='center'>{$link}</td>";
             echo "<td class='center'>" . Dropdown::getDropdownName("glpi_entities", $data['entity']);
             echo "</td>";
             echo "<td class='center'>{$downloadlink}</td>";
//.........这里部分代码省略.........
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:101,代码来源:document.class.php

示例5: showForItem


//.........这里部分代码省略.........
         echo "<td class='center' width='20%'>";
         echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add a new file') . "\"\n                class='submit'>";
         echo "</td></tr>";
         echo "</table>";
         Html::closeForm();
         if (Session::haveRight('document', 'r') && $nb > count($used)) {
             echo "<form name='document_form{$rand}' id='document_form{$rand}' method='post'\n                   action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
             echo "<table class='tab_cadre_fixe'>";
             echo "<tr class='tab_bg_1'>";
             echo "<td colspan='4' class='center'>";
             echo "<input type='hidden' name='entities_id' value='{$entity}'>";
             echo "<input type='hidden' name='is_recursive' value='{$is_recursive}'>";
             echo "<input type='hidden' name='itemtype' value='" . $item->getType() . "'>";
             echo "<input type='hidden' name='items_id' value='{$ID}'>";
             if ($item->getType() == 'Ticket') {
                 echo "<input type='hidden' name='tickets_id' value='{$ID}'>";
                 echo "<input type='hidden' name='documentcategories_id' value='" . $CFG_GLPI["documentcategories_id_forticket"] . "'>";
             }
             Document::dropdown(array('entity' => $entities, 'used' => $used));
             echo "</td><td class='center' width='20%'>";
             echo "<input type='submit' name='add' value=\"" . _sx('button', 'Associate an existing document') . "\" class='submit'>";
             echo "</td>";
             echo "</tr>";
             echo "</table>";
             Html::closeForm();
         }
         echo "</div>";
     }
     echo "<div class='spaced'>";
     if ($canedit && $number && $withtemplate < 2) {
         Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
         $massiveactionparams = array('num_displayed' => $number);
         Html::showMassiveActions(__CLASS__, $massiveactionparams);
     }
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr>";
     if ($canedit && $number && $withtemplate < 2) {
         echo "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand) . "</th>";
     }
     echo "<th>" . __('Name') . "</th>";
     echo "<th>" . __('Entity') . "</th>";
     echo "<th>" . __('File') . "</th>";
     echo "<th>" . __('Web link') . "</th>";
     echo "<th>" . __('Heading') . "</th>";
     echo "<th>" . __('MIME type') . "</th>";
     echo "</tr>";
     $used = array();
     if ($number) {
         // Don't use this for document associated to document
         // To not loose navigation list for current document
         if ($item->getType() != 'Document') {
             Session::initNavigateListItems('Document', sprintf(__('%1$s = %2$s'), $item->getTypeName(1), $item->getName()));
         }
         $document = new Document();
         foreach ($documents as $data) {
             $docID = $data["id"];
             $link = NOT_AVAILABLE;
             $downloadlink = NOT_AVAILABLE;
             if ($document->getFromDB($docID)) {
                 $link = $document->getLink();
                 $downloadlink = $document->getDownloadLink($linkparam);
             }
             if ($item->getType() != 'Document') {
                 Session::addToNavigateListItems('Document', $docID);
             }
             $used[$docID] = $docID;
             $assocID = $data["assocID"];
             echo "<tr class='tab_bg_1" . ($data["is_deleted"] ? "_2" : "") . "'>";
             if ($canedit && $withtemplate < 2) {
                 echo "<td width='10'>";
                 Html::showMassiveActionCheckBox(__CLASS__, $data["assocID"]);
                 echo "</td>";
             }
             echo "<td class='center'>{$link}</td>";
             echo "<td class='center'>" . Dropdown::getDropdownName("glpi_entities", $data['entity']);
             echo "</td>";
             echo "<td class='center'>{$downloadlink}</td>";
             echo "<td class='center'>";
             if (!empty($data["link"])) {
                 echo "<a target=_blank href='" . formatOutputWebLink($data["link"]) . "'>" . $data["link"];
                 echo "</a>";
             } else {
                 echo "&nbsp;";
             }
             echo "</td>";
             echo "<td class='center'>" . Dropdown::getDropdownName("glpi_documentcategories", $data["documentcategories_id"]);
             echo "</td>";
             echo "<td class='center'>" . $data["mime"] . "</td>";
             echo "</tr>";
             $i++;
         }
     }
     echo "</table>";
     if ($canedit && $number && $withtemplate < 2) {
         $massiveactionparams['ontop'] = false;
         Html::showMassiveActions(__CLASS__, $massiveactionparams);
         Html::closeForm();
     }
     echo "</div>";
 }
开发者ID:gaforeror,项目名称:glpi,代码行数:101,代码来源:document_item.class.php

示例6: showForItem


//.........这里部分代码省略.........
             echo "<td colspan='4' class='center'>";
             echo "<input type='hidden' name='itemtype' value='" . $item->getType() . "'>";
             echo "<input type='hidden' name='items_id' value='{$ID}'>";
             if ($item->getType() == 'Ticket') {
                 echo "<input type='hidden' name='tickets_id' value='{$ID}'>";
                 echo "<input type='hidden' name='documentcategories_id' value='" . $CFG_GLPI["documentcategories_id_forticket"] . "'>";
             }
             Document::dropdown(array('entity' => $entities, 'used' => $used));
             echo "</td><td class='center' width='20%'>";
             echo "<input type='submit' name='add' value=\"" . _sx('button', 'Associate an existing document') . "\" class='submit'>";
             echo "</td>";
             echo "</tr>";
             echo "</table>";
             Html::closeForm();
         }
         echo "</div>";
     }
     echo "<div class='spaced'>";
     if ($canedit && $number && $withtemplate < 2) {
         Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
         $massiveactionparams = array('num_displayed' => $number, 'container' => 'mass' . __CLASS__ . $rand);
         Html::showMassiveActions($massiveactionparams);
     }
     $sort_img = "<img src=\"" . $CFG_GLPI["root_doc"] . "/pics/" . ($order == "DESC" ? "puce-down.png" : "puce-up.png") . "\" alt='' title=''>";
     echo "<table class='tab_cadre_fixehov table-striped table-hover'>";
     $header_begin = "<tr>";
     $header_top = '';
     $header_bottom = '';
     $header_end = '';
     if ($canedit && $number && $withtemplate < 2) {
         $header_top .= "<th width='11'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
         $header_top .= "</th>";
         $header_bottom .= "<th width='11'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
         $header_bottom .= "</th>";
     }
     foreach ($columns as $key => $val) {
         $header_end .= "<th>" . ($sort == "`{$key}`" ? $sort_img : "") . "<a href='javascript:reloadTab(\"sort={$key}&amp;order=" . ($order == "ASC" ? "DESC" : "ASC") . "&amp;start=0\");'>{$val}</a></th>";
     }
     $header_end .= "</tr>";
     echo $header_begin . $header_top . $header_end;
     $used = array();
     if ($number) {
         // Don't use this for document associated to document
         // To not loose navigation list for current document
         if ($item->getType() != 'Document') {
             Session::initNavigateListItems('Document', sprintf(__('%1$s = %2$s'), $item->getTypeName(1), $item->getName()));
         }
         $document = new Document();
         foreach ($documents as $data) {
             $docID = $data["id"];
             $link = NOT_AVAILABLE;
             $downloadlink = NOT_AVAILABLE;
             if ($document->getFromDB($docID)) {
                 $link = $document->getLink();
                 $downloadlink = $document->getDownloadLink($linkparam);
             }
             if ($item->getType() != 'Document') {
                 Session::addToNavigateListItems('Document', $docID);
             }
             $used[$docID] = $docID;
             $assocID = $data["assocID"];
             echo "<tr class='tab_bg_1" . ($data["is_deleted"] ? "_2" : "") . "'>";
             if ($canedit && $withtemplate < 2) {
                 echo "<td width='10'>";
                 Html::showMassiveActionCheckBox(__CLASS__, $data["assocID"]);
                 echo "</td>";
             }
             echo "<td class='center'>{$link}</td>";
             echo "<td class='center'>" . $data['entity'] . "</td>";
             echo "<td class='center'>{$downloadlink}</td>";
             echo "<td class='center'>";
             if (!empty($data["link"])) {
                 echo "<a target=_blank href='" . formatOutputWebLink($data["link"]) . "'>" . $data["link"];
                 echo "</a>";
             } else {
                 echo "&nbsp;";
             }
             echo "</td>";
             echo "<td class='center'>" . Dropdown::getDropdownName("glpi_documentcategories", $data["documentcategories_id"]);
             echo "</td>";
             echo "<td class='center'>" . $data["mime"] . "</td>";
             if ($CFG_GLPI['use_rich_text']) {
                 echo "<td class='center'>";
                 echo !empty($data["tag"]) ? Document::getImageTag($data["tag"]) : '';
                 echo "</td>";
             }
             echo "<td class='center'>" . Html::convDateTime($data["assocdate"]) . "</td>";
             echo "</tr>";
             $i++;
         }
         echo $header_begin . $header_bottom . $header_end;
     }
     echo "</table>";
     if ($canedit && $number && $withtemplate < 2) {
         $massiveactionparams['ontop'] = false;
         Html::showMassiveActions($massiveactionparams);
         Html::closeForm();
     }
     echo "</div>";
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:101,代码来源:document_item.class.php


注:本文中的Document::getLink方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。