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


PHP formatOutputWebLink函数代码示例

本文整理汇总了PHP中formatOutputWebLink函数的典型用法代码示例。如果您正苦于以下问题:PHP formatOutputWebLink函数的具体用法?PHP formatOutputWebLink怎么用?PHP formatOutputWebLink使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: getLinks

 /**
  * Get links for an enterprise (website / edit)
  *
  * @param $withname boolean : also display name ? (false by default)
  **/
 function getLinks($withname = false)
 {
     global $CFG_GLPI;
     $ret = '    ';
     if ($withname) {
         $ret .= $this->fields["name"];
         $ret .= "  ";
     }
     if (!empty($this->fields['website'])) {
         $ret .= "<a href='" . formatOutputWebLink($this->fields['website']) . "' target='_blank'>\n                  <img src='" . $CFG_GLPI["root_doc"] . "/pics/web.png' class='middle' alt=\"" . __s('Web') . "\" title=\"" . __s('Web') . "\"></a>&nbsp;&nbsp;";
     }
     if ($this->can($this->fields['id'], 'r')) {
         $ret .= "<a href='" . $CFG_GLPI["root_doc"] . "/front/supplier.form.php?id=" . $this->fields['id'] . "'>\n                  <img src='" . $CFG_GLPI["root_doc"] . "/pics/edit.png' class='middle' alt=\"" . __s('Update') . "\" title=\"" . __s('Update') . "\"></a>";
     }
     return $ret;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:21,代码来源:supplier.class.php

示例2: listPlugins

 /**
  * List availabled plugins
  **/
 function listPlugins()
 {
     global $CFG_GLPI, $PLUGIN_HOOKS;
     $this->checkStates();
     echo "<div class='center'><table class='tab_cadrehov'>";
     $pluglist = $this->find("", "name, directory");
     $i = 0;
     $PLUGIN_HOOKS_SAVE = $PLUGIN_HOOKS;
     echo "<tr><th colspan='9'>" . __('Plugins list') . "</th></tr>\n";
     if (!empty($pluglist)) {
         echo "<tr><th>" . __('Name') . "</th><th>" . _n('Version', 'Versions', 1) . "</th>";
         echo "<th>" . __('License') . "</th>";
         echo "<th>" . __('Status') . "</th><th>" . _n('Author', 'Authors', Session::getPluralNumber()) . "</th>";
         echo "<th>" . __('Website') . "</th>";
         echo "<th>" . __('CSRF compliant') . "</th>";
         echo "<th colspan='2'>&nbsp;</th></tr>\n";
         foreach ($pluglist as $ID => $plug) {
             if (function_exists("plugin_" . $plug['directory'] . "_check_config")) {
                 // init must not be called for incompatible plugins
                 self::load($plug['directory'], true);
             }
             $i++;
             $class = 'tab_bg_1';
             if ($i % 2 == 0) {
                 $class = 'tab_bg_2';
             }
             echo "<tr class='{$class}'>";
             echo "<td>";
             $name = trim($plug['name']);
             if (empty($name)) {
                 $plug['name'] = $plug['directory'];
             }
             // Only config for install plugins
             if (in_array($plug['state'], array(self::ACTIVATED, self::TOBECONFIGURED, self::NOTACTIVATED)) && isset($PLUGIN_HOOKS['config_page'][$plug['directory']])) {
                 echo "<a href='" . $CFG_GLPI["root_doc"] . "/plugins/" . $plug['directory'] . "/" . $PLUGIN_HOOKS['config_page'][$plug['directory']] . "'>\n                      <span class='b'>" . $plug['name'] . "</span></a>";
             } else {
                 echo $plug['name'];
             }
             echo "</td>";
             echo "<td>" . $plug['version'] . "</td><td>";
             if ($plug['license']) {
                 $link = '';
                 if (file_exists(GLPI_ROOT . '/plugins/' . $plug['directory'] . '/LICENSE')) {
                     $link = $CFG_GLPI['root_doc'] . '/plugins/' . $plug['directory'] . '/LICENSE';
                 } else {
                     if (file_exists(GLPI_ROOT . '/plugins/' . $plug['directory'] . '/COPYING.txt')) {
                         $link = $CFG_GLPI['root_doc'] . '/plugins/' . $plug['directory'] . '/COPYING.txt';
                     }
                 }
                 if ($link) {
                     echo "<a href='{$link}'>" . $plug['license'] . "</a>";
                 } else {
                     echo $plug['license'];
                 }
             } else {
                 echo "&nbsp;";
             }
             echo "</td><td>";
             switch ($plug['state']) {
                 case self::ANEW:
                     echo _x('status', 'New');
                     break;
                 case self::ACTIVATED:
                     echo _x('plugin', 'Enabled');
                     break;
                 case self::NOTINSTALLED:
                     echo _x('plugin', 'Not installed');
                     break;
                 case self::NOTUPDATED:
                     _e('To update');
                     break;
                 case self::TOBECONFIGURED:
                     echo _x('plugin', 'Installed / not configured');
                     break;
                 case self::NOTACTIVATED:
                     echo _x('plugin', 'Installed / not activated');
                     break;
                 case self::TOBECLEANED:
                 default:
                     _e('Error / to clean');
                     break;
             }
             echo "</td>";
             echo "<td>" . $plug['author'] . "</td>";
             $weblink = trim($plug['homepage']);
             echo "<td>";
             if (!empty($weblink)) {
                 echo "<a href='" . formatOutputWebLink($weblink) . "' target='_blank'>";
                 echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/web.png' class='middle' alt=\"" . __s('Web') . "\" title=\"" . __s('Web') . "\" ></a>";
             } else {
                 echo "&nbsp;";
             }
             echo "</td>";
             // CSRF
             echo "<td>";
             if (isset($PLUGIN_HOOKS['csrf_compliant'][$plug['directory']]) && $PLUGIN_HOOKS['csrf_compliant'][$plug['directory']]) {
                 _e('Yes');
//.........这里部分代码省略.........
开发者ID:pvasener,项目名称:glpi,代码行数:101,代码来源:plugin.class.php

示例3: giveItem


//.........这里部分代码省略.........
                 $withdays = true;
                 if (isset($searchopt[$ID]['withdays'])) {
                     $withdays = $searchopt[$ID]['withdays'];
                 }
                 $out = '';
                 for ($k = 0; $k < $data[$num]['count']; $k++) {
                     $out .= (empty($out) ? '' : '<br>') . Html::timestampToString($data[$num][$k]['name'], $withseconds, $withdays);
                 }
                 return $out;
             case "email":
                 $out = '';
                 $count_display = 0;
                 for ($k = 0; $k < $data[$num]['count']; $k++) {
                     if ($count_display) {
                         $out .= self::LBBR;
                     }
                     $count_display++;
                     if (!empty($data[$num][$k]['name'])) {
                         $out .= empty($out) ? '' : self::LBBR;
                         $out .= "<a href='mailto:" . $data[$num][$k]['name'] . "'>" . $data[$num][$k]['name'];
                         $out .= "</a>";
                     }
                 }
                 return empty($out) ? "&nbsp;" : $out;
             case "weblink":
                 $orig_link = trim($data[$num][0]['name']);
                 if (!empty($orig_link)) {
                     // strip begin of link
                     $link = preg_replace('/https?:\\/\\/(www[^\\.]*\\.)?/', '', $orig_link);
                     $link = preg_replace('/\\/$/', '', $link);
                     if (Toolbox::strlen($link) > $CFG_GLPI["url_maxlength"]) {
                         $link = Toolbox::substr($link, 0, $CFG_GLPI["url_maxlength"]) . "...";
                     }
                     return "<a href=\"" . formatOutputWebLink($orig_link) . "\" target='_blank'>{$link}</a>";
                 }
                 return "&nbsp;";
             case "count":
             case "number":
                 $out = "";
                 $count_display = 0;
                 for ($k = 0; $k < $data[$num]['count']; $k++) {
                     if (strlen(trim($data[$num][$k]['name'])) > 0) {
                         if ($count_display) {
                             $out .= self::LBBR;
                         }
                         $count_display++;
                         if (isset($searchopt[$ID]['toadd']) && isset($searchopt[$ID]['toadd'][$data[$num][$k]['name']])) {
                             $out .= $searchopt[$ID]['toadd'][$data[$num][$k]['name']];
                         } else {
                             $number = str_replace(' ', '&nbsp;', Html::formatNumber($data[$num][$k]['name'], false, 0));
                             $out .= Dropdown::getValueWithUnit($number, $unit);
                         }
                     }
                 }
                 return $out;
             case "decimal":
                 $out = "";
                 $count_display = 0;
                 for ($k = 0; $k < $data[$num]['count']; $k++) {
                     if (strlen(trim($data[$num][$k]['name'])) > 0) {
                         if ($count_display) {
                             $out .= self::LBBR;
                         }
                         $count_display++;
                         if (isset($searchopt[$ID]['toadd']) && isset($searchopt[$ID]['toadd'][$data[$num][$k]['name']])) {
                             $out .= $searchopt[$ID]['toadd'][$data[$num][$k]['name']];
开发者ID:jose-martins,项目名称:glpi,代码行数:67,代码来源:search.class.php

示例4: 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

示例5: testFormatOutputWebLink

 /**
  * @covers ::formatOutputWebLink
  **/
 public function testFormatOutputWebLink()
 {
     $this->assertEquals('http://www.glpi-project.org/', formatOutputWebLink('www.glpi-project.org/'));
     $this->assertEquals('http://www.glpi-project.org/', formatOutputWebLink('http://www.glpi-project.org/'));
 }
开发者ID:glpi-project,项目名称:glpi,代码行数:8,代码来源:DbFunctionTest.php

示例6: getValueToDisplay


//.........这里部分代码省略.........
                     if ($options['html']) {
                         $text = nl2br($value);
                     } else {
                         $text = $value;
                     }
                     if (isset($searchoptions['htmltext']) && $searchoptions['htmltext']) {
                         $text = Html::clean(Toolbox::unclean_cross_side_scripting_deep($text));
                     }
                     return $text;
                 case "bool":
                     return Dropdown::getYesNo($value);
                 case "date":
                 case "date_delay":
                     if (isset($options['relative_dates']) && $options['relative_dates']) {
                         $dates = Html::getGenericDateTimeSearchItems(array('with_time' => true, 'with_future' => true));
                         return $dates[$value];
                     }
                     return Html::convDate(Html::computeGenericDateTimeSearch($value, true));
                 case "datetime":
                     if (isset($options['relative_dates']) && $options['relative_dates']) {
                         $dates = Html::getGenericDateTimeSearchItems(array('with_time' => true, 'with_future' => true));
                         return $dates[$value];
                     }
                     return Html::convDateTime(Html::computeGenericDateTimeSearch($value, false));
                 case "timestamp":
                     if ($value == 0 && isset($searchoptions['emptylabel'])) {
                         return $searchoptions['emptylabel'];
                     }
                     $withseconds = false;
                     if (isset($searchoptions['withseconds'])) {
                         $withseconds = $searchoptions['withseconds'];
                     }
                     return Html::timestampToString($value, $withseconds);
                 case "email":
                     if ($options['html']) {
                         return "<a href='mailto:{$value}'>{$value}</a>";
                     }
                     return $value;
                 case "weblink":
                     $orig_link = trim($value);
                     if (!empty($orig_link)) {
                         // strip begin of link
                         $link = preg_replace('/https?:\\/\\/(www[^\\.]*\\.)?/', '', $orig_link);
                         $link = preg_replace('/\\/$/', '', $link);
                         if (Toolbox::strlen($link) > $CFG_GLPI["url_maxlength"]) {
                             $link = Toolbox::substr($link, 0, $CFG_GLPI["url_maxlength"]) . "...";
                         }
                         return "<a href=\"" . formatOutputWebLink($orig_link) . "\" target='_blank'>{$link}" . "</a>";
                     }
                     return "&nbsp;";
                 case "itemlink":
                     if ($searchoptions['table'] == $this->getTable()) {
                         break;
                     }
                 case "dropdown":
                     if (isset($searchoptions['toadd']) && isset($searchoptions['toadd'][$value])) {
                         return $searchoptions['toadd'][$value];
                     }
                     if (!is_numeric($value)) {
                         return $value;
                     }
                     if ($value == 0 && isset($searchoptions['emptylabel'])) {
                         return $searchoptions['emptylabel'];
                     }
                     if ($searchoptions['table'] == 'glpi_users') {
                         if ($param['comments']) {
                             $tmp = getUserName($value, 2);
                             return $tmp['name'] . '&nbsp;' . Html::showToolTip($tmp['comment'], array('display' => false));
                         }
                         return getUserName($value);
                     }
                     if ($param['comments']) {
                         $tmp = Dropdown::getDropdownName($searchoptions['table'], $value, 1);
                         return $tmp['name'] . '&nbsp;' . Html::showToolTip($tmp['comment'], array('display' => false));
                     }
                     return Dropdown::getDropdownName($searchoptions['table'], $value);
                 case "itemtypename":
                     if ($obj = getItemForItemtype($value)) {
                         return $obj->getTypeName(1);
                     }
                     break;
                 case "language":
                     if (isset($CFG_GLPI['languages'][$value])) {
                         return $CFG_GLPI['languages'][$value][0];
                     }
                     return __('Default value');
             }
         }
         // Get specific display if available
         $itemtype = getItemTypeForTable($searchoptions['table']);
         if ($item = getItemForItemtype($itemtype)) {
             $options['searchopt'] = $searchoptions;
             $specific = $item->getSpecificValueToDisplay($field, $values, $options);
             if (!empty($specific)) {
                 return $specific;
             }
         }
     }
     return $value;
 }
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:101,代码来源:commondbtm.class.php

示例7: giveItem


//.........这里部分代码省略.........
                     $withdays = $searchopt[$ID]['withdays'];
                 }
                 $split = explode("\$\$\$\$", $data[$NAME . $num]);
                 $out = '';
                 foreach ($split as $val) {
                     $out .= (empty($out) ? '' : '<br>') . Html::timestampToString($val, $withseconds, $withdays);
                 }
                 return $out;
             case "email":
                 $split = explode('$$$$', $data[$NAME . $num]);
                 $out = '';
                 $count_display = 0;
                 foreach ($split as $val) {
                     $split2 = self::explodeWithID("\$\$", $val);
                     if ($count_display) {
                         $out .= "<br>";
                     }
                     $count_display++;
                     if (!empty($val)) {
                         $out .= empty($out) ? '' : '<br>';
                         $out .= "<a href='mailto:{$split2['0']}'>{$split2['0']}</a>";
                     }
                 }
                 return empty($out) ? "&nbsp;" : $out;
             case "weblink":
                 $orig_link = trim($data[$NAME . $num]);
                 if (!empty($orig_link)) {
                     // strip begin of link
                     $link = preg_replace('/https?:\\/\\/(www[^\\.]*\\.)?/', '', $orig_link);
                     $link = preg_replace('/\\/$/', '', $link);
                     if (Toolbox::strlen($link) > $CFG_GLPI["url_maxlength"]) {
                         $link = Toolbox::substr($link, 0, $CFG_GLPI["url_maxlength"]) . "...";
                     }
                     return "<a href=\"" . formatOutputWebLink($orig_link) . "\" target='_blank'>{$link}</a>";
                 }
                 return "&nbsp;";
             case "number":
                 if (isset($searchopt[$ID]['forcegroupby']) && $searchopt[$ID]['forcegroupby']) {
                     $out = "";
                     $split = explode("\$\$\$\$", $data[$NAME . $num]);
                     $count_display = 0;
                     for ($k = 0; $k < count($split); $k++) {
                         if (strlen(trim($split[$k])) > 0) {
                             $split2 = self::explodeWithID("\$\$", $split[$k]);
                             if ($count_display) {
                                 $out .= "<br>";
                             }
                             $count_display++;
                             if (isset($searchopt[$ID]['toadd']) && isset($searchopt[$ID]['toadd'][$split2[0]])) {
                                 $out .= $searchopt[$ID]['toadd'][$split2[0]];
                             } else {
                                 $number = str_replace(' ', '&nbsp;', Html::formatNumber($split2[0], false, 0));
                                 $out .= Dropdown::getValueWithUnit($number, $unit);
                             }
                         }
                     }
                     return $out;
                 }
                 if (isset($searchopt[$ID]['toadd']) && isset($searchopt[$ID]['toadd'][$data[$NAME . $num]])) {
                     return $searchopt[$ID]['toadd'][$data[$NAME . $num]];
                 } else {
                     $number = str_replace(' ', '&nbsp;', Html::formatNumber($data[$NAME . $num], false, 0));
                     return Dropdown::getValueWithUnit($number, $unit);
                 }
             case "decimal":
                 if (isset($searchopt[$ID]['forcegroupby']) && $searchopt[$ID]['forcegroupby']) {
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:67,代码来源:searcha.class.php

示例8: showAssociated


//.........这里部分代码省略.........
     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>";
             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 ($withtemplate < 2) {
                 echo "<td class='tab_bg_2 center b'>";
                 if ($canedit && $_SESSION["glpiactiveprofile"]["interface"] != 'helpdesk') {
                     echo "<a href='" . $CFG_GLPI["root_doc"];
                     echo "/front/document.form.php?deletedocumentitem=1&amp;id={$assocID}";
                     echo "&amp;itemtype=" . $item->getType() . "&amp;items_id={$ID}&amp;documents_id={$docID}'>";
                     echo $LANG['buttons'][6] . "</a>";
                 } else {
                     echo "&nbsp;";
                 }
                 echo "</td>";
             }
             echo "</tr>";
             $i++;
         }
     }
     if ($canedit) {
         // hack for ticket  || get_class($item)=='Ticket') {
         // Restrict entity for knowbase
         $entities = "";
         $entity = $_SESSION["glpiactive_entity"];
         if ($item->isEntityAssign()) {
             $entity = $item->getEntityID();
             if ($item->isRecursive()) {
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:67,代码来源:document.class.php

示例9: 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

示例10: giveItem


//.........这里部分代码省略.........
             case "timestamp":
                 $withseconds = false;
                 if (isset($searchopt[$ID]['withseconds'])) {
                     $withseconds = $searchopt[$ID]['withseconds'];
                 }
                 return timestampToString($data[$NAME . $num], $withseconds);
             case "date_delay":
                 $split = explode('$$$$', $data[$NAME . $num]);
                 $out = '';
                 foreach ($split as $val) {
                     if (strpos($val, ',')) {
                         list($dat, $dur) = explode(',', $val);
                         if (!empty($dat)) {
                             $out .= (empty($out) ? '' : '<br>') . getWarrantyExpir($dat, $dur);
                         }
                     }
                 }
                 return empty($out) ? "&nbsp;" : $out;
             case "email":
                 $email = trim($data[$NAME . $num]);
                 if (!empty($email)) {
                     return "<a href='mailto:{$email}'>{$email}</a>";
                 }
                 return "&nbsp;";
             case "weblink":
                 $orig_link = trim($data[$NAME . $num]);
                 if (!empty($orig_link)) {
                     // strip begin of link
                     $link = preg_replace('/https?:\\/\\/(www[^\\.]*\\.)?/', '', $orig_link);
                     $link = preg_replace('/\\/$/', '', $link);
                     if (utf8_strlen($link) > $CFG_GLPI["url_maxlength"]) {
                         $link = utf8_substr($link, 0, $CFG_GLPI["url_maxlength"]) . "...";
                     }
                     return "<a href=\"" . formatOutputWebLink($orig_link) . "\" target='_blank'>{$link}</a>";
                 }
                 return "&nbsp;";
             case "number":
                 if (isset($searchopt[$ID]['forcegroupby']) && $searchopt[$ID]['forcegroupby']) {
                     $out = "";
                     $split = explode("\$\$\$\$", $data[$NAME . $num]);
                     $count_display = 0;
                     for ($k = 0; $k < count($split); $k++) {
                         if (strlen(trim($split[$k])) > 0) {
                             if ($count_display) {
                                 $out .= "<br>";
                             }
                             $count_display++;
                             $out .= str_replace(' ', '&nbsp;', formatNumber($split[$k], false, 0)) . $unit;
                         }
                     }
                     return $out;
                 }
                 return str_replace(' ', '&nbsp;', formatNumber($data[$NAME . $num], false, 0)) . $unit;
             case "decimal":
                 if (isset($searchopt[$ID]['forcegroupby']) && $searchopt[$ID]['forcegroupby']) {
                     $out = "";
                     $split = explode("\$\$\$\$", $data[$NAME . $num]);
                     $count_display = 0;
                     for ($k = 0; $k < count($split); $k++) {
                         if (strlen(trim($split[$k])) > 0) {
                             if ($count_display) {
                                 $out .= "<br>";
                             }
                             $count_display++;
                             $out .= str_replace(' ', '&nbsp;', formatNumber($split[$k])) . $unit;
                         }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:67,代码来源:search.class.php

示例11: 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

示例12: showInstrucciontecnica

 static function showInstrucciontecnica($item, $instID, $itemtype)
 {
     global $DB, $CFG_GLPI;
     $objeto = $item->getType();
     $appli = new $objeto();
     $appli->getFromDB($item->fields['id']);
     //$canedit = $appli->can($appli->fields['id'],'w');
     $canedit = $appli->canCreate();
     //$canedit = Session::haveRight('update_ticket', 1);
     echo "<div class='center'>";
     echo "<form name='form_pedido' id='form_pedido' method='post' action='../plugins/formcreator/front/instruccion.form.php'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<th colspan=2>" . __('Informacion del pedido', 'Informacion del pedido') . "</th>";
     echo "<tr>";
     echo "<th>" . __('Pedido de catalogo', 'Pedido de catalogo') . "&nbsp;:" . "</th>";
     echo "<td>";
     if ($canedit) {
         //Dropdown::show('PluginFormcreatorForm', array('name'  => 'peticion_id',
         //							  'value'  => $instID));
         $table = getTableForItemtype('PluginFormcreatorForm');
         $sections = array();
         $sql = "SELECT `id`, `name`\n\t\t\t\t\t\t\tFROM {$table}\n\t\t\t\t\t\t\tORDER BY `name`";
         $result = $GLOBALS['DB']->query($sql);
         while ($section = $GLOBALS['DB']->fetch_array($result)) {
             $sections[$section['id']] = $section['name'];
         }
         $sections = array("0" => "----") + $sections;
         Dropdown::showFromArray('peticion_id', $sections, array('value' => $instID));
     } else {
         echo Dropdown::getDropdownName("glpi_plugin_formcreator_forms", $instID);
     }
     echo "</td>";
     //-----------------------------
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan='2' align = 'center'>";
     echo "<input type='submit' name='actualizarPedido' value='Actualizar' class='submit'>";
     echo "</td></tr>";
     echo "</table>";
     echo "<input type='hidden' name='itemtype' value='" . $item->getType() . "'>";
     echo "<input type='hidden' name='tickets_id' value='" . $item->fields['id'] . "'>";
     //echo "</form>";
     Html::closeForm();
     echo "</div>";
     echo "<div class='center'>";
     echo "<table class='tab_cadre_fixehov'>";
     $query = "SELECT DISTINCT `itemtype`\n\t\t\t\t\tFROM `glpi_documents_items`\n\t\t\t\t\tWHERE `items_id` = '{$instID}' AND `itemtype` = '{$itemtype}'\n\t\t\t\t\tORDER BY `itemtype`";
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     $i = 0;
     if (Session::isMultiEntitiesMode()) {
         $colsup = 1;
     } else {
         $colsup = 0;
     }
     if ($number > 0) {
         echo "<tr><th>" . __('Heading') . "</th>";
         echo "<th>" . __('Name') . "</th>";
         echo "<th>" . __('Web link') . "</th>";
         echo "<th>" . __('File') . "</th>";
         echo "<th>" . __('Entity') . "</th>";
         echo "</tr>";
     }
     for ($i = 0; $i < $number; $i++) {
         $type = $DB->result($result, $i, "itemtype");
         if (!class_exists($type)) {
             continue;
         }
         $item = new $type();
         if ($canedit) {
             //if ($item->canView()) {
             $column = "name";
             $query1 = "SELECT glpi_documents.*, glpi_documents_items.id AS IDD, glpi_entities.id AS entity\n\t\t\t\tFROM glpi_documents_items, glpi_documents LEFT JOIN glpi_entities ON (glpi_entities.id = glpi_documents.entities_id)\n\t\t\t\tWHERE glpi_documents.id = glpi_documents_items.documents_id\n\t\t\t\t\tAND glpi_documents_items.itemtype = '" . $itemtype . "'\n\t\t\t\t\tAND glpi_documents_items.items_id = " . $instID . "\n\t\t\t\t\tAND glpi_documents.is_deleted = 0\n\t\t\t\tORDER BY glpi_entities.completename, glpi_documents.name";
             if ($result_linked1 = $DB->query($query1)) {
                 if ($DB->numrows($result_linked1)) {
                     $document = new Document();
                     while ($data = $DB->fetch_assoc($result_linked1)) {
                         $item->getFromDB($data["id"]);
                         Session::addToNavigateListItems($type, $data["id"]);
                         $ID = "";
                         $downloadlink = NOT_AVAILABLE;
                         if ($document->getFromDB($data["id"])) {
                             $downloadlink = $document->getDownloadLink();
                         }
                         if ($_SESSION["glpiis_ids_visible"] || empty($data["name"])) {
                             $ID = " (" . $data["id"] . ")";
                         }
                         $name = __('Informacion de pedido', 'Informacion de pedido');
                         //item->getLink();
                         echo "<tr class='tab_bg_1'>";
                         // echo "<td class='center'>".$name."</td>";
                         echo "<td class='center'>" . Dropdown::getDropdownName("glpi_documentcategories", $data["documentcategories_id"]);
                         echo "</td>";
                         $nombre = $data['name'];
                         echo "<td class='center' " . (isset($data['deleted']) && $data['deleted'] ? "class='tab_bg_2_2'" : "") . ">" . $nombre . "</td>";
                         echo "<td class='center'>";
                         if (!empty($data["link"])) {
                             echo "<a target=_blank href='" . formatOutputWebLink($data["link"]) . "'>" . $data["link"];
                             echo "</a>";
                         } else {
//.........这里部分代码省略.........
开发者ID:OscarLoayzaB,项目名称:formcreator,代码行数:101,代码来源:instruccion.class.php


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