本文整理汇总了PHP中Document::getDownloadLink方法的典型用法代码示例。如果您正苦于以下问题:PHP Document::getDownloadLink方法的具体用法?PHP Document::getDownloadLink怎么用?PHP Document::getDownloadLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Document
的用法示例。
在下文中一共展示了Document::getDownloadLink方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayField
public function displayField($canEdit = true)
{
if ($canEdit) {
$required = $this->isRequired() ? ' required' : '';
echo '<input type="hidden" class="form-control"
name="formcreator_field_' . $this->fields['id'] . '" value="" />' . PHP_EOL;
echo '<input type="file" class="form-control"
name="formcreator_field_' . $this->fields['id'] . '"
id="formcreator_field_' . $this->fields['id'] . '" />';
} else {
$doc = new Document();
$answer = $this->getAnswer();
if ($doc->getFromDB($answer)) {
echo $doc->getDownloadLink();
}
}
}
示例2: giveItem
//.........这里部分代码省略.........
if ($data[$num][$k]['is_recursive']) {
$comp = __('R');
if ($data[$num][$k]['is_dynamic']) {
$comp = sprintf(__('%1$s%2$s'), $comp, ", ");
}
}
if ($data[$num][$k]['is_dynamic']) {
$comp = sprintf(__('%1$s%2$s'), $comp, __('D'));
}
if (!empty($comp)) {
$text = sprintf(__('%1$s %2$s'), $text, "(" . $comp . ")");
}
if (!in_array($text, $added)) {
if ($count_display) {
$out .= self::LBBR;
}
$count_display++;
$out .= $text;
$added[] = $text;
}
}
}
return $out;
}
break;
case "glpi_documenttypes.icon":
if (!empty($data[$num][0]['name'])) {
return "<img class='middle' alt='' src='" . $CFG_GLPI["typedoc_icon_dir"] . "/" . $data[$num][0]['name'] . "'>";
}
return " ";
case "glpi_documents.filename":
$doc = new Document();
if ($doc->getFromDB($data['id'])) {
return $doc->getDownloadLink();
}
return NOT_AVAILABLE;
case "glpi_tickets_tickets.tickets_id_1":
$out = "";
$displayed = array();
for ($k = 0; $k < $data[$num]['count']; $k++) {
$linkid = $data[$num][$k]['tickets_id_2'] == $data['id'] ? $data[$num][$k]['name'] : $data[$num][$k]['tickets_id_2'];
if ($linkid > 0 && !isset($displayed[$linkid])) {
$text = "<a ";
$text .= "href=\"" . $CFG_GLPI["root_doc"] . "/front/ticket.form.php?id={$linkid}\">";
$text .= Dropdown::getDropdownName('glpi_tickets', $linkid) . "</a>";
if (count($displayed)) {
$out .= self::LBBR;
}
$displayed[$linkid] = $linkid;
$out .= $text;
}
}
return $out;
case "glpi_problems.id":
if ($searchopt[$ID]["datatype"] == 'count') {
if ($data[$num][0]['name'] > 0 && Session::haveRight("problem", Problem::READALL)) {
if ($itemtype == 'ITILCategory') {
$options['criteria'][0]['field'] = 7;
$options['criteria'][0]['searchtype'] = 'equals';
$options['criteria'][0]['value'] = $data['id'];
$options['criteria'][0]['link'] = 'AND';
} else {
$options['criteria'][0]['field'] = 12;
$options['criteria'][0]['searchtype'] = 'equals';
$options['criteria'][0]['value'] = 'all';
$options['criteria'][0]['link'] = 'AND';
示例3: 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}&order=" . ($order == "ASC" ? "DESC" : "ASC") . "&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 " ";
}
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>";
}
示例4: giveItem
//.........这里部分代码省略.........
if ($split3[$k]) {
$comp = __(READ);
if ($split4[$k]) {
$comp = sprintf(__('%1$s%2$s'), $comp, ", ");
}
}
if ($split4[$k]) {
$comp = sprintf(__('%1$s%2$s'), $comp, __('D'));
}
if (!empty($comp)) {
$text = sprintf(__('%1$s %2$s'), $text, "(" . $comp . ")");
}
if (!in_array($text, $added)) {
if ($count_display) {
$out .= "<br>";
}
$count_display++;
$out .= $text;
$added[] = $text;
}
}
}
return $out;
}
break;
case "glpi_documenttypes.icon":
if (!empty($data[$NAME . $num])) {
return "<img class='middle' alt='' src='" . $CFG_GLPI["typedoc_icon_dir"] . "/" . $data[$NAME . $num] . "'>";
}
return " ";
case "glpi_documents.filename":
$doc = new Document();
if ($doc->getFromDB($data['id'])) {
return $doc->getDownloadLink();
}
return NOT_AVAILABLE;
case "glpi_deviceharddrives.specificity":
case "glpi_devicememories.specificity":
case "glpi_deviceprocessors.specificity":
return $data[$NAME . $num];
case "glpi_networkports.mac":
$out = "";
if ($itemtype == 'Computer') {
$displayed = array();
if (!empty($data[$NAME . $num . "_2"])) {
$split = explode("\$\$\$\$", $data[$NAME . $num . "_2"]);
$count_display = 0;
for ($k = 0; $k < count($split); $k++) {
$lowstr = Toolbox::strtolower($split[$k]);
if (strlen(trim($split[$k])) > 0 && !in_array($lowstr, $displayed)) {
if ($count_display) {
$out .= "<br>";
}
$count_display++;
$out .= $split[$k];
$displayed[] = $lowstr;
}
}
if (!empty($data[$NAME . $num])) {
$out .= "<br>";
}
}
if (!empty($data[$NAME . $num])) {
$split = explode("\$\$\$\$", $data[$NAME . $num]);
$count_display = 0;
for ($k = 0; $k < count($split); $k++) {
示例5: 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 = "&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> </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>";
//.........这里部分代码省略.........
示例6: 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 " ";
}
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>";
}
示例7: giveItem
//.........这里部分代码省略.........
$count_display = 0;
for ($k = 0; $k < count($split); $k++) {
if (strlen(trim($split[$k])) > 0) {
$text = $split[$k] . " - " . $split2[$k];
if ($split3[$k]) {
$text .= " (R)";
}
if (!in_array($text, $added)) {
if ($count_display) {
$out .= "<br>";
}
$count_display++;
$out .= $text;
$added[] = $text;
}
}
}
return $out;
} else {
if ($data[$NAME . $num . "_2"] == 0) {
// Set name for Root entity
$data[$NAME . $num] = $LANG['entity'][2];
}
}
break;
case "glpi_documenttypes.icon":
if (!empty($data[$NAME . $num])) {
return "<img class='middle' alt='' src='" . $CFG_GLPI["typedoc_icon_dir"] . "/" . $data[$NAME . $num] . "'>";
}
return " ";
case "glpi_documents.filename":
$doc = new Document();
if ($doc->getFromDB($data['id'])) {
return $doc->getDownloadLink();
}
return NOT_AVAILABLE;
case "glpi_deviceharddrives.specificity":
case "glpi_devicememories.specificity":
case "glpi_deviceprocessors.specificity":
return $data[$NAME . $num];
case "glpi_networkports.mac":
$out = "";
if ($itemtype == 'Computer') {
$displayed = array();
if (!empty($data[$NAME . $num . "_2"])) {
$split = explode("\$\$\$\$", $data[$NAME . $num . "_2"]);
$count_display = 0;
for ($k = 0; $k < count($split); $k++) {
$lowstr = utf8_strtolower($split[$k]);
if (strlen(trim($split[$k])) > 0 && !in_array($lowstr, $displayed)) {
if ($count_display) {
$out .= "<br>";
}
$count_display++;
$out .= $split[$k];
$displayed[] = $lowstr;
}
}
if (!empty($data[$NAME . $num])) {
$out .= "<br>";
}
}
if (!empty($data[$NAME . $num])) {
$split = explode("\$\$\$\$", $data[$NAME . $num]);
$count_display = 0;
for ($k = 0; $k < count($split); $k++) {
示例8: giveItem
//.........这里部分代码省略.........
for ($k = 0; $k < count($split); $k++) {
if (strlen(trim($split[$k])) > 0) {
$text = $split[$k] . " - " . Dropdown::getDropdownName('glpi_profiles', $split2[$k]);
if ($split3[$k]) {
$text .= " (R)";
}
if (!in_array($text, $added)) {
if ($count_display) {
$out .= "<br>";
}
$count_display++;
$out .= $text;
$added[] = $text;
}
}
}
return $out;
}
break;
case "glpi_entities.completename":
if ($data[$NAME . $num . "_2"] == 0) {
// Set name for Root entity
$data[$NAME . $num] = $LANG['entity'][2];
}
break;
case "glpi_documenttypes.icon":
if (!empty($data[$NAME . $num])) {
return "<img class='middle' alt='' src='" . $CFG_GLPI["typedoc_icon_dir"] . "/" . $data[$NAME . $num] . "'>";
}
return " ";
case "glpi_documents.filename":
$doc = new Document();
if ($doc->getFromDB($data['id'])) {
return $doc->getDownloadLink();
}
return NOT_AVAILABLE;
case "glpi_deviceharddrives.specificity":
case "glpi_devicememories.specificity":
case "glpi_deviceprocessors.specificity":
return $data[$NAME . $num];
case "glpi_networkports.mac":
$out = "";
if ($itemtype == 'Computer') {
$displayed = array();
if (!empty($data[$NAME . $num . "_2"])) {
$split = explode("\$\$\$\$", $data[$NAME . $num . "_2"]);
$count_display = 0;
for ($k = 0; $k < count($split); $k++) {
$lowstr = utf8_strtolower($split[$k]);
if (strlen(trim($split[$k])) > 0 && !in_array($lowstr, $displayed)) {
if ($count_display) {
$out .= "<br>";
}
$count_display++;
$out .= $split[$k];
$displayed[] = $lowstr;
}
}
if (!empty($data[$NAME . $num])) {
$out .= "<br>";
}
}
if (!empty($data[$NAME . $num])) {
$split = explode("\$\$\$\$", $data[$NAME . $num]);
$count_display = 0;
for ($k = 0; $k < count($split); $k++) {
示例9: 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}&order=" . ($order == "ASC" ? "DESC" : "ASC") . "&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 " ";
}
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>";
}
示例10: 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') . " :" . "</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 {
//.........这里部分代码省略.........