本文整理汇总了PHP中Document_Item::countForItem方法的典型用法代码示例。如果您正苦于以下问题:PHP Document_Item::countForItem方法的具体用法?PHP Document_Item::countForItem怎么用?PHP Document_Item::countForItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Document_Item
的用法示例。
在下文中一共展示了Document_Item::countForItem方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCentral
//.........这里部分代码省略.........
echo "</script>\n";
echo "<div id='desc{$rand}' class='tracking' onClick='showDesc{$rand}()'>\n";
if (!empty($ticket->fields["content"])) {
echo nl2br($ticket->fields["content"]);
} else {
_e('Empty description');
}
echo "</div>\n";
echo "<div id='viewdesc{$rand}'></div>\n";
if (!$ID) {
echo "<script type='text/javascript' >\n\n showDesc{$rand}();\n </script>";
}
echo $tt->getEndHiddenFieldValue('content', $ticket);
} else {
echo nl2br($ticket->fields["content"]);
}
// * Added by plugin surveyticket
}
// End of adding by plugin
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
// Permit to add doc when creating a ticket
if (!$ID) {
echo "<th width='{$colsize1}%'>" . sprintf(__('File (%s)'), Document::getMaxUploadSize());
echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/aide.png' class='pointer' alt=\"" . __s('Help') . "\" onclick=\"window.open('" . $CFG_GLPI["root_doc"] . "/front/documenttype.list.php','Help','scrollbars=1,resizable=1,width=1000," . "height=800')\">";
echo " ";
Ticket::showDocumentAddButton();
echo "</th>";
echo "<td width='{$colsize2}%'>";
echo "<div id='uploadfiles'><input type='file' name='filename[]' size='20'></div></td>";
} else {
echo "<th colspan='2'>";
$docnb = Document_Item::countForItem($ticket);
echo "<a href=\"" . $ticket->getLinkURL() . "&forcetab=Document_Item\$1\">";
//TRANS: %d is the document number
echo sprintf(_n('%d associated document', '%d associated documents', $docnb), $docnb);
echo "</a></th>";
}
if ($view_linked_tickets) {
echo "<th width='{$colsize3}%'>" . _n('Linked ticket', 'Linked tickets', 2);
$rand_linked_ticket = mt_rand();
if ($canupdate) {
echo " ";
echo "<img onClick=\"Ext.get('linkedticket{$rand_linked_ticket}').setDisplayed('block')\"\n title=\"" . __s('Add') . "\" alt=\"" . __s('Add') . "\"\n class='pointer' src='" . $CFG_GLPI["root_doc"] . "/pics/add_dropdown.png'>";
}
echo '</th>';
echo "<td width='{$colsize4}%'>";
if ($canupdate) {
echo "<div style='display:none' id='linkedticket{$rand_linked_ticket}'>";
Ticket_Ticket::dropdownLinks('_link[link]', isset($values["_link"]) ? $values["_link"]['link'] : '');
printf(__('%1$s: %2$s'), __('Ticket'), __('ID'));
echo "<input type='hidden' name='_link[tickets_id_1]' value='{$ID}'>\n";
echo "<input type='text' name='_link[tickets_id_2]'\n value='" . (isset($values["_link"]) ? $values["_link"]['tickets_id_2'] : '') . "'\n size='10'>\n";
echo " ";
echo "</div>";
if (isset($values["_link"]) && !empty($values["_link"]['tickets_id_2'])) {
echo "<script language='javascript'>Ext.get('linkedticket{$rand_linked_ticket}').\n setDisplayed('block');</script>";
}
}
Ticket_Ticket::displayLinkedTicketsTo($ID);
echo "</td>";
} else {
echo "<td></td>";
}
echo "</tr>";
示例2: showForm
//.........这里部分代码省略.........
}
echo "</table>";
echo "<table class='tab_cadre_fixe' id='mainformtable2'>";
echo "<tr class='tab_bg_1'>";
echo "<th width='{$colsize1}%'>" . __('Status') . "</th>";
echo "<td width='{$colsize2}%'>";
self::dropdownStatus(array('value' => $this->fields["status"], 'showtype' => 'allowed'));
echo "</td>";
echo "<th width='{$colsize1}%'>" . __('Urgency') . "</th>";
echo "<td width='{$colsize2}%'>";
// Only change during creation OR when allowed to change priority OR when user is the creator
$idurgency = self::dropdownUrgency(array('value' => $this->fields["urgency"]));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<th>" . __('Category') . "</th>";
echo "<td >";
$opt = array('value' => $this->fields["itilcategories_id"], 'entity' => $this->fields["entities_id"], 'condition' => "`is_problem`='1'");
ITILCategory::dropdown($opt);
echo "</td>";
echo "<th>" . __('Impact') . "</th>";
echo "<td>";
$idimpact = self::dropdownImpact(array('value' => $this->fields["impact"]));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<th>" . __('Total duration') . "</th>";
echo "<td>" . parent::getActionTime($this->fields["actiontime"]) . "</td>";
echo "<th class='left'>" . __('Priority') . "</th>";
echo "<td>";
$idpriority = parent::dropdownPriority(array('value' => $this->fields["priority"], 'withmajor' => true));
$idajax = 'change_priority_' . mt_rand();
echo " <span id='{$idajax}' style='display:none'></span>";
$params = array('urgency' => '__VALUE0__', 'impact' => '__VALUE1__', 'priority' => $idpriority);
Ajax::updateItemOnSelectEvent(array($idurgency, $idimpact), $idajax, $CFG_GLPI["root_doc"] . "/ajax/priority.php", $params);
echo "</td>";
echo "</tr>";
echo "</table>";
$this->showActorsPartForm($ID, $options);
echo "<table class='tab_cadre_fixe' id='mainformtable3'>";
echo "<tr class='tab_bg_1'>";
echo "<th width='{$colsize1}%'>" . __('Title') . "</th>";
echo "<td colspan='3'>";
$rand = mt_rand();
echo "<script type='text/javascript' >\n";
echo "function showName{$rand}() {\n";
echo "Ext.get('name{$rand}').setDisplayed('none');";
$params = array('maxlength' => 250, 'size' => 110, 'name' => 'name', 'data' => rawurlencode($this->fields["name"]));
Ajax::updateItemJsCode("viewname{$rand}", $CFG_GLPI["root_doc"] . "/ajax/inputtext.php", $params);
echo "}";
echo "</script>\n";
echo "<div id='name{$rand}' class='tracking left' onClick='showName{$rand}()'>\n";
if (empty($this->fields["name"])) {
_e('Without title');
} else {
echo $this->fields["name"];
}
echo "</div>\n";
echo "<div id='viewname{$rand}'></div>\n";
if (!$ID) {
echo "<script type='text/javascript' >\n\n showName{$rand}();\n </script>";
}
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<th>" . __('Description') . "</th>";
echo "<td colspan='3'>";
$rand = mt_rand();
echo "<script type='text/javascript' >\n";
echo "function showDesc{$rand}() {\n";
echo "Ext.get('desc{$rand}').setDisplayed('none');";
$params = array('rows' => 6, 'cols' => 110, 'name' => 'content', 'data' => rawurlencode($this->fields["content"]));
Ajax::updateItemJsCode("viewdesc{$rand}", $CFG_GLPI["root_doc"] . "/ajax/textarea.php", $params);
echo "}";
echo "</script>\n";
echo "<div id='desc{$rand}' class='tracking' onClick='showDesc{$rand}()'>\n";
if (!empty($this->fields["content"])) {
echo nl2br($this->fields["content"]);
} else {
_e('Empty description');
}
echo "</div>\n";
echo "<div id='viewdesc{$rand}'></div>\n";
if (!$ID) {
echo "<script type='text/javascript' >\n\n showDesc{$rand}();\n </script>";
}
echo "</td></tr>";
if ($ID) {
echo "<tr class='tab_bg_1'>";
echo "<th colspan='2' width='" . ($colsize1 + $colsize2) . "%'>";
$docnb = Document_Item::countForItem($this);
echo "<a href=\"" . $this->getLinkURL() . "&forcetab=Document_Item\$1\">";
//TRANS: %d is the document number
echo sprintf(_n('%d associated document', '%d associated documents', $docnb), $docnb);
echo "</a></th>";
echo "<td colspan='2'></td>";
echo "</tr>";
}
$options['colspan'] = 2;
$this->showFormButtons($options);
$this->addDivForTabs();
return true;
}
示例3: showForm
//.........这里部分代码省略.........
$params = array('maxlength' => 250, 'size' => 60, 'name' => 'name', 'data' => rawurlencode($this->fields["name"]));
ajaxUpdateItemJsCode("viewname{$rand}", $CFG_GLPI["root_doc"] . "/ajax/inputtext.php", $params, false);
echo "}";
echo "</script>\n";
echo "<div id='name{$rand}' class='tracking left' onClick='showName{$rand}()'>\n";
if (empty($this->fields["name"])) {
echo $LANG['reminder'][15];
} else {
echo $this->fields["name"];
}
echo "</div>\n";
echo "<div id='viewname{$rand}'>\n";
echo "</div>\n";
if (!$ID) {
echo "<script type='text/javascript' >\n\n showName{$rand}();\n </script>";
}
} else {
if (empty($this->fields["name"])) {
echo $LANG['reminder'][15];
} else {
echo $this->fields["name"];
}
}
echo "</td>";
// Permit to add doc when creating a ticket
if (!$ID) {
echo "<th>" . $LANG['document'][2] . " (" . Document::getMaxUploadSize() . ") :";
echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/aide.png' class='pointer' alt=\"" . $LANG['central'][7] . "\" onclick=\"window.open('" . $CFG_GLPI["root_doc"] . "/front/documenttype.list.php','Help','scrollbars=1,resizable=1,width=1000,height=800')\">";
echo "</th>";
echo "<td>";
echo "<input type='file' name='filename' value=\"\" size='25'></td>";
} else {
echo "<th colspan='2'>";
echo $LANG['document'][20] . ' : ' . Document_Item::countForItem($this);
echo "</th>";
}
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<th width='10%'>" . $LANG['joblist'][6] . " : </th>";
echo "<td width='50%'>";
if (!$ID || $canupdate_descr) {
// Admin =oui on autorise la modification de la description
$rand = mt_rand();
echo "<script type='text/javascript' >\n";
echo "function showDesc{$rand}() {\n";
echo "Ext.get('desc{$rand}').setDisplayed('none');";
$params = array('rows' => 6, 'cols' => 60, 'name' => 'content', 'data' => rawurlencode($this->fields["content"]));
ajaxUpdateItemJsCode("viewdesc{$rand}", $CFG_GLPI["root_doc"] . "/ajax/textarea.php", $params, false);
echo "}";
echo "</script>\n";
echo "<div id='desc{$rand}' class='tracking' onClick='showDesc{$rand}()'>\n";
if (!empty($this->fields["content"])) {
echo nl2br($this->fields["content"]);
} else {
echo $LANG['job'][33];
}
echo "</div>\n";
echo "<div id='viewdesc{$rand}'></div>\n";
if (!$ID) {
echo "<script type='text/javascript' >\n\n showDesc{$rand}();\n </script>";
}
} else {
echo nl2br($this->fields["content"]);
}
echo "</td>";
if ($view_linked_tickets) {
示例4: getTabNameForItem
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
{
if (!$withtemplate) {
if ($item->getType() == __CLASS__) {
return __('See the map', 'positions');
} else {
if ($item->getType() == "Location") {
if ($_SESSION['glpishow_count_on_tabs']) {
return self::createTabEntry(Document::getTypeName(Session::getPluralNumber()), Document_Item::countForItem($item));
}
return Document::getTypeName(Session::getPluralNumber());
} else {
if (in_array($item->getType(), self::getTypes(true)) && Session::haveRight('plugin_positions', READ)) {
if ($_SESSION['glpishow_count_on_tabs']) {
return self::createTabEntry(self::getTypeName(Session::getPluralNumber()), self::countForItem($item));
}
return self::getTypeName(Session::getPluralNumber());
}
}
}
}
return '';
}