本文整理汇总了PHP中Document::getMaxUploadSize方法的典型用法代码示例。如果您正苦于以下问题:PHP Document::getMaxUploadSize方法的具体用法?PHP Document::getMaxUploadSize怎么用?PHP Document::getMaxUploadSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Document
的用法示例。
在下文中一共展示了Document::getMaxUploadSize方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHelpdesk
//.........这里部分代码省略.........
$condition .= " AND `is_incident`='1'";
}
$opt = array('value' => $values['itilcategories_id'], 'condition' => $condition, 'on_change' => 'submit()');
if ($values['itilcategories_id'] && $tt->isMandatoryField("itilcategories_id")) {
$opt['display_emptychoice'] = false;
}
ITILCategory::dropdown($opt);
echo "</td></tr>";
if ($CFG_GLPI['urgency_mask'] != 1 << 3) {
if (!$tt->isHiddenField('urgency')) {
echo "<tr class='tab_bg_1'>";
echo "<td>" . sprintf(__('%1$s%2$s'), __('Urgency'), $tt->getMandatoryMark('urgency')) . "</td>";
echo "<td>";
Ticket::dropdownUrgency(array('value' => $values["urgency"]));
echo "</td></tr>";
}
}
if (empty($delegating) && NotificationTargetTicket::isAuthorMailingActivatedForHelpdesk()) {
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Inform me about the actions taken') . "</td>";
echo "<td>";
if ($values["_users_id_requester"] == 0) {
$values['_users_id_requester'] = Session::getLoginUserID();
}
$_POST['value'] = $values['_users_id_requester'];
$_POST['field'] = '_users_id_requester_notif';
$_POST['use_notification'] = $values['_users_id_requester_notif']['use_notification'];
include GLPI_ROOT . "/ajax/uemailUpdate.php";
echo "</td></tr>";
}
if ($_SESSION["glpiactiveprofile"]["helpdesk_hardware"] != 0) {
if (!$tt->isHiddenField('itemtype')) {
echo "<tr class='tab_bg_1'>";
echo "<td>" . sprintf(__('%1$s%2$s'), __('Hardware type'), $tt->getMandatoryMark('itemtype')) . "</td>";
echo "<td>";
Ticket::dropdownMyDevices($values['_users_id_requester'], $_SESSION["glpiactive_entity"], $values['itemtype'], $values['items_id']);
Ticket::dropdownAllDevices("itemtype", $values['itemtype'], $values['items_id'], 0, $values['_users_id_requester'], $_SESSION["glpiactive_entity"]);
echo "<span id='item_ticket_selection_information'></span>";
echo "</td></tr>";
}
}
if (!$tt->isHiddenField('locations_id')) {
echo "<tr class='tab_bg_1'><td>";
printf(__('%1$s%2$s'), __('Location'), $tt->getMandatoryMark('locations_id'));
echo "</td><td>";
Location::dropdown(array('value' => $values["locations_id"]));
echo "</td></tr>";
}
if (!$tt->isHiddenField('name') || $tt->isPredefinedField('name')) {
echo "<tr class='tab_bg_1'>";
echo "<td>" . sprintf(__('%1$s%2$s'), __('Title'), $tt->getMandatoryMark('name')) . "</td>";
echo "<td><input type='text' maxlength='250' size='80' name='name'\n value=\"" . $values['name'] . "\"></td></tr>";
}
if (!$tt->isHiddenField('content') || $tt->isPredefinedField('content')) {
echo "<tr class='tab_bg_1'>";
echo "<td>" . sprintf(__('%1$s%2$s'), __('Description'), $tt->getMandatoryMark('content')) . "</td>";
// * Changed by plugin surveyticket
// * Added by plugin surveyticket
$psTicketTemplate = new PluginSurveyticketTicketTemplate();
$psSurvey = new PluginSurveyticketSurvey();
$plugin_surveyticket_surveys_id = 0;
$a_tickettemplates = current($psTicketTemplate->find("`tickettemplates_id`='" . $tt->fields['id'] . "'\n AND `type`='" . $values['type'] . "'\n AND `is_helpdesk`='1'"));
if (isset($a_tickettemplates['plugin_surveyticket_surveys_id'])) {
echo "<td>";
$psSurvey = new PluginSurveyticketSurvey();
$psSurvey->getFromDB($a_tickettemplates['plugin_surveyticket_surveys_id']);
if ($psSurvey->fields['is_active'] == 1) {
$plugin_surveyticket_surveys_id = $a_tickettemplates['plugin_surveyticket_surveys_id'];
$psSurvey = new PluginSurveyticketSurvey();
$psSurvey->startSurvey($plugin_surveyticket_surveys_id);
}
} else {
echo "<td><textarea name='content' cols='80' rows='14'>" . $values['content'] . "</textarea>";
}
// * End of change
echo "</td></tr>";
}
echo "<tr class='tab_bg_1'>";
echo "<td>" . sprintf(__('%1$s (%2$s)'), __('File'), 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(60);
echo "</td>";
echo "<td><div id='uploadfiles'><input type='file' name='filename[]' value='' size='60'></div>";
echo "</td></tr>";
if (!$ticket_template) {
echo "<tr class='tab_bg_1'>";
echo "<td colspan='2' class='center'>";
if ($tt->isField('id') && $tt->fields['id'] > 0) {
echo "<input type='hidden' name='_tickettemplates_id' value='" . $tt->fields['id'] . "'>";
echo "<input type='hidden' name='_predefined_fields'\n value=\"" . Toolbox::prepareArrayForInput($predefined_fields) . "\">";
}
echo "<input type='submit' name='add' value=\"" . __s('Submit message') . "\" class='submit'>";
echo "</td></tr>";
}
echo "</table></div>";
if (!$ticket_template) {
Html::closeForm();
}
}
示例2: showForm
//.........这里部分代码省略.........
echo " ";
echo "<img onClick=\"" . Html::jsShow("linkedticket{$rand_linked_ticket}") . "\"\n title=\"" . __s('Add') . "\" alt=\"" . __s('Add') . "\"\n class='pointer' src='" . $CFG_GLPI["root_doc"] . "/pics/add_dropdown.png'>";
}
echo '</th>';
echo "<td colspan='3'>";
if ($canupdate) {
echo "<div style='display:none' id='linkedticket{$rand_linked_ticket}'>";
echo "<table class='tab_format' width='100%'><tr><td width='30%'>";
Ticket_Ticket::dropdownLinks('_link[link]', isset($values["_link"]) ? $values["_link"]['link'] : '');
echo "<input type='hidden' name='_link[tickets_id_1]' value='{$ID}'>\n";
echo "</td><td width='70%'>";
$linkparam = array('name' => '_link[tickets_id_2]', 'displaywith' => array('id'));
if (isset($values["_link"])) {
$linkparam['value'] = $values["_link"]['tickets_id_2'];
}
Ticket::dropdown($linkparam);
echo "</td></tr></table>";
echo "</div>";
if (isset($values["_link"]) && !empty($values["_link"]['tickets_id_2'])) {
echo "<script language='javascript'>";
echo Html::jsShow("linkedticket{$rand_linked_ticket}");
echo "</script>";
}
}
Ticket_Ticket::displayLinkedTicketsTo($ID);
echo "</td>";
}
echo "</tr>";
// View files added
echo "<tr class='tab_bg_1'>";
// Permit to add doc when creating a ticket
echo "<th style='width:{$colsize1}%'>";
echo $tt->getBeginHiddenFieldText('_documents_id');
$doctitle = sprintf(__('File (%s)'), Document::getMaxUploadSize());
printf(__('%1$s%2$s'), $doctitle, $tt->getMandatoryMark('_documents_id'));
// Do not show if hidden.
if (!$tt->isHiddenField('_documents_id')) {
DocumentType::showAvailableTypesLink();
}
echo $tt->getEndHiddenFieldText('_documents_id');
echo "</th>";
echo "<td colspan='3'>";
// Do not set values
echo $tt->getEndHiddenFieldValue('_documents_id');
if ($tt->isPredefinedField('_documents_id')) {
if (isset($values['_documents_id']) && is_array($values['_documents_id']) && count($values['_documents_id'])) {
echo "<span class='b'>" . __('Default documents:') . '</span>';
echo "<br>";
$doc = new Document();
foreach ($values['_documents_id'] as $key => $val) {
if ($doc->getFromDB($val)) {
echo "<input type='hidden' name='_documents_id[{$key}]' value='{$val}'>";
echo "- " . $doc->getNameID() . "<br>";
}
}
}
}
echo "<div id='fileupload_info'></div>";
echo "</td>";
echo "</tr>";
if ((!$ID || $canupdate || $canupdate_descr || Session::haveRightsOr(self::$rightname, array(self::ASSIGN, self::STEAL, DELETE, PURGE))) && !$options['template_preview']) {
echo "<tr class='tab_bg_1'>";
if ($ID) {
if (Session::haveRightsOr(self::$rightname, array(UPDATE, DELETE, PURGE)) || $this->canDeleteItem() || $this->canUpdateItem()) {
echo "<td class='tab_bg_2 center' colspan='4'>";
if ($this->fields["is_deleted"] == 1) {
示例3: showForm
//.........这里部分代码省略.........
echo "<th width='10%'>" . $LANG['common'][57] . " :</th>";
echo "<td width='50%'>";
if (!$ID || $canupdate_descr) {
$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' => 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) {
示例4: showForm
//.........这里部分代码省略.........
echo $tt->getEndHiddenFieldText('content') . "</th>";
echo "<td width='" . (100 - $colsize1) . "%' colspan='3'>";
if (!$ID || $canupdate_descr) {
// Admin =oui on autorise la modification de la description
echo $tt->getBeginHiddenFieldValue('content');
$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' => 90, '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 $tt->getEndHiddenFieldValue('content', $this);
} else {
echo nl2br($this->fields["content"]);
}
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 " ";
self::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($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>";
}
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'])) {
示例5: showAddFormForItem
/**
* @since version 0.90
*
* @param $item
* @param $withtemplate (default '')
* @param $options array
*
* @return boolean
**/
static function showAddFormForItem(CommonDBTM $item, $withtemplate = '', $options = array())
{
global $DB, $CFG_GLPI;
//default options
$params['rand'] = mt_rand();
if (is_array($options) && count($options)) {
foreach ($options as $key => $val) {
$params[$key] = $val;
}
}
if (!$item->can($item->fields['id'], READ)) {
return false;
}
if (empty($withtemplate)) {
$withtemplate = 0;
}
// find documents already associated to the item
$doc_item = new self();
$used_found = $doc_item->find("`items_id` = '" . $item->getID() . "'\n AND `itemtype` = '" . $item->getType() . "'");
$used = array_keys($used_found);
$used = array_combine($used, $used);
if ($item->canAddItem('Document') && $withtemplate < 2) {
// Restrict entity for knowbase
$entities = "";
$entity = $_SESSION["glpiactive_entity"];
if ($item->isEntityAssign()) {
/// Case of personal items : entity = -1 : create on active entity (Reminder case))
if ($item->getEntityID() >= 0) {
$entity = $item->getEntityID();
}
if ($item->isRecursive()) {
$entities = getSonsOf('glpi_entities', $entity);
} else {
$entities = $entity;
}
}
$limit = getEntitiesRestrictRequest(" AND ", "glpi_documents", '', $entities, true);
$q = "SELECT COUNT(*)\n FROM `glpi_documents`\n WHERE `is_deleted` = '0'\n {$limit}";
$result = $DB->query($q);
$nb = $DB->result($result, 0, 0);
if ($item->getType() == 'Document') {
$used[$item->getID()] = $item->getID();
}
echo "<div class='firstbloc'>";
echo "<form name='documentitem_form" . $params['rand'] . "' id='documentitem_form" . $params['rand'] . "' method='post' action='" . Toolbox::getItemTypeFormURL('Document') . "' enctype=\"multipart/form-data\">";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_2'><th colspan='5'>" . __('Add a document') . "</th></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td class='center'>";
_e('Heading');
echo "</td><td width='20%'>";
DocumentCategory::dropdown(array('entity' => $entities));
echo "</td>";
echo "<td class='right'>";
echo "<input type='hidden' name='entities_id' value='{$entity}'>";
echo "<input type='hidden' name='is_recursive' value='" . $item->isRecursive() . "'>";
echo "<input type='hidden' name='itemtype' value='" . $item->getType() . "'>";
echo "<input type='hidden' name='items_id' value='" . $item->getID() . "'>";
if ($item->getType() == 'Ticket') {
echo "<input type='hidden' name='tickets_id' value='" . $item->getID() . "'>";
}
echo Html::file(array('multiple' => true));
echo "</td><td class='left'>(" . Document::getMaxUploadSize() . ") </td>";
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 (Document::canView() && $nb > count($used)) {
echo "<form name='document_form" . $params['rand'] . "' id='document_form" . $params['rand'] . "' method='post' 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='itemtype' value='" . $item->getType() . "'>";
echo "<input type='hidden' name='items_id' value='" . $item->getID() . "'>";
if ($item->getType() == 'Ticket') {
echo "<input type='hidden' name='tickets_id' value='" . $item->getID() . "'>";
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>";
}
}
示例6: printHelpDesk
//.........这里部分代码省略.........
}
$itemtype = 0;
$items_id = "";
$content = "";
$title = "";
$ticketcategories_id = 0;
$urgency = 3;
$type = 0;
if (isset($_SESSION["helpdeskSaved"]['_users_id_requester_notif']) && isset($_SESSION["helpdeskSaved"]['_users_id_requester_notif']['use_notification'])) {
$use_email_notification = stripslashes($_SESSION["helpdeskSaved"]['_users_id_requester_notif']['use_notification']);
}
if (isset($_SESSION["helpdeskSaved"]["email"])) {
$email = stripslashes($_SESSION["helpdeskSaved"]["user_email"]);
}
if (isset($_SESSION["helpdeskSaved"]["itemtype"])) {
$itemtype = stripslashes($_SESSION["helpdeskSaved"]["itemtype"]);
}
if (isset($_SESSION["helpdeskSaved"]["items_id"])) {
$items_id = stripslashes($_SESSION["helpdeskSaved"]["items_id"]);
}
if (isset($_SESSION["helpdeskSaved"]["content"])) {
$content = cleanPostForTextArea($_SESSION["helpdeskSaved"]["content"]);
}
if (isset($_SESSION["helpdeskSaved"]["name"])) {
$title = stripslashes($_SESSION["helpdeskSaved"]["name"]);
}
if (isset($_SESSION["helpdeskSaved"]["ticketcategories_id"])) {
$ticketcategories_id = stripslashes($_SESSION["helpdeskSaved"]["ticketcategories_id"]);
}
if (isset($_SESSION["helpdeskSaved"]["type"])) {
$type = stripslashes($_SESSION["helpdeskSaved"]["type"]);
}
if (isset($_SESSION["helpdeskSaved"]["urgency"])) {
$urgency = stripslashes($_SESSION["helpdeskSaved"]["urgency"]);
}
unset($_SESSION["helpdeskSaved"]);
echo "<form method='post' name='helpdeskform' action='" . $CFG_GLPI["root_doc"] . "/front/tracking.injector.php' enctype='multipart/form-data'>";
echo "<input type='hidden' name='_from_helpdesk' value='{$from_helpdesk}'>";
echo "<input type='hidden' name='requesttypes_id' value='" . RequestType::getDefault('helpdesk') . "'>";
if ($CFG_GLPI['urgency_mask'] == 1 << 3) {
// Dont show dropdown if only 1 value enabled
echo "<input type='hidden' name='urgency' value='3'>";
}
echo "<input type='hidden' name='entities_id' value='" . $_SESSION["glpiactive_entity"] . "'>";
echo "<div class='center'><table class='tab_cadre'>";
echo "<tr><th colspan='2'>" . $LANG['job'][11] . " : ";
if (isMultiEntitiesMode()) {
echo " (" . Dropdown::getDropdownName("glpi_entities", $_SESSION["glpiactive_entity"]) . ")";
}
echo "</th></tr>";
if ($CFG_GLPI['urgency_mask'] != 1 << 3) {
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['joblist'][29] . " : </td>";
echo "<td>";
Ticket::dropdownUrgency("urgency", $urgency);
echo "</td></tr>";
}
if (NotificationTargetTicket::isAuthorMailingActivatedForHelpdesk()) {
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['help'][8] . " : </td>";
echo "<td>";
$_REQUEST['value'] = getLoginUserID();
$_REQUEST['field'] = '_users_id_requester_notif';
$_REQUEST['use_notification'] = $use_email_notification;
include GLPI_ROOT . "/ajax/uemailUpdate.php";
echo "</td></tr>";
}
if ($_SESSION["glpiactiveprofile"]["helpdesk_hardware"] != 0) {
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['help'][24] . " : </td>";
echo "<td>";
Ticket::dropdownMyDevices(getLoginUserID(), $_SESSION["glpiactive_entity"]);
Ticket::dropdownAllDevices("itemtype", $itemtype, $items_id, 0, $_SESSION["glpiactive_entity"]);
echo "</td></tr>";
}
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][17] . " : </td><td>";
Ticket::dropdownType('type', $type);
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][36] . " : </td><td>";
Dropdown::show('TicketCategory', array('value' => $ticketcategories_id, 'condition' => '`is_helpdeskvisible`=1'));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][57] . " : </td>";
echo "<td><input type='text' maxlength='250' size='50' name='name' value='{$title}'></td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td colspan='2'><textarea name='content' cols='78' rows='14'>{$content}</textarea>";
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $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 "</td>";
echo "<td><input type='file' name='filename' value='' size='25'></td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td colspan='2' class='center'>";
echo "<input type='submit' value=\"" . $LANG['help'][14] . "\" class='submit'>";
echo "</td></tr>";
echo "</table></div></form>";
}
示例7: showForItem
//.........这里部分代码省略.........
if ($item->isRecursive()) {
$entities = getSonsOf('glpi_entities', $entity);
} else {
$entities = $entity;
}
}
$limit = getEntitiesRestrictRequest(" AND ", "glpi_documents", '', $entities, true);
$q = "SELECT COUNT(*)\n FROM `glpi_documents`\n WHERE `is_deleted` = '0'\n {$limit}";
$result = $DB->query($q);
$nb = $DB->result($result, 0, 0);
if ($item->getType() == 'Document') {
$used[$ID] = $ID;
}
echo "<div class='firstbloc'>";
echo "<form name='documentitem_form{$rand}' id='documentitem_form{$rand}' method='post'\n action='" . Toolbox::getItemTypeFormURL('Document') . "' enctype=\"multipart/form-data\">";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_2'><th colspan='5'>" . __('Add a document') . "</th></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td class='center'>";
_e('Heading');
echo '</td><td>';
DocumentCategory::dropdown(array('entity' => $entities));
echo "</td>";
echo "<td class='right'>";
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='file' name='filename' size='25'>";
echo "</td><td class='left'>";
echo "(" . Document::getMaxUploadSize() . ") ";
echo "</td>";
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);
示例8: showForTicket
static function showForTicket(Ticket $item)
{
if (!self::canView()) {
return false;
}
$canedit = $item->canUpdate() && self::canUpdate();
echo "<form name='form' method='post' action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
echo "<div align='center'><table class='tab_cadre_fixe'>";
echo "<tr><th colspan='2'>" . __('Close ticket informations', 'moreticket') . "</th></tr>";
// Writer
echo "<tr class='tab_bg_1'>";
echo "<td>";
echo __('Writer');
echo "</td>";
echo "<td>";
echo getUserName(Session::getLoginUserID());
echo "<input name='requesters_id' type='hidden' value='" . Session::getLoginUserID() . "'>";
echo "</td>";
echo "</tr>";
// Date
echo "<tr class='tab_bg_1'>";
echo "<td>";
echo "</td>";
echo "<td>";
Html::showDateTimeField("date", array('value' => date('Y-m-d H:i:s')));
echo "</td>";
echo "</tr>";
// Comments
echo "<tr class='tab_bg_1'>";
echo "<td>";
echo __('Comments');
echo "</td>";
echo "<td>";
echo "<textarea cols='80' rows='8' name='comment'></textarea>";
echo "</td>";
echo "</tr>";
// Documents
echo "<tr class='tab_bg_1'>";
echo "<td colspan='2' style='padding:10px 20px 0px 20px'>";
echo Html::file();
echo "(" . Document::getMaxUploadSize() . ") ";
echo "</td>";
echo "</tr>";
if ($canedit) {
echo "<tr>";
echo "<td class='tab_bg_2 center' colspan='6'>";
echo "<input type='submit' name='add' class='submit' value='" . _sx('button', 'Add') . "' >";
echo "<input type='hidden' name='tickets_id' class='submit' value='" . $item->fields['id'] . "' >";
echo "<input type='hidden' name='items_id' class='submit' value='" . $item->fields['id'] . "' >";
echo "<input type='hidden' name='itemtype' class='submit' value='Ticket' >";
echo "</td>";
echo "</tr>";
}
echo "</table></div>";
Html::closeForm();
// List
self::showList($item, $canedit);
}
示例9: show
public static function show($field, $datas)
{
if ($field['required']) {
$required = ' required';
} else {
$required = '';
}
$hide = $field['show_type'] == 'hide' ? ' style="display: none"' : '';
echo '<div class="form-group' . $required . '" id="form-group-field' . $field['id'] . '"' . $hide . '>';
echo '<label>';
echo $field['name'];
if ($field['required']) {
echo ' <span class="red">*</span>';
}
echo '<br /><small>(' . __('File size:', 'formcreator') . ' ' . Document::getMaxUploadSize() . ')</small>';
echo '</label>';
echo '<input type="hidden" class="form-control"
name="formcreator_field_' . $field['id'] . '" value="" />' . PHP_EOL;
echo '<input type="file" class="form-control"
name="formcreator_field_' . $field['id'] . '"
id="formcreator_field_' . $field['id'] . '" />';
echo '<div class="help-block">' . html_entity_decode($field['description']) . '</div>';
switch ($field['show_condition']) {
case 'notequal':
$condition = '!=';
break;
case 'lower':
$condition = '<';
break;
case 'greater':
$condition = '>';
break;
default:
$condition = '==';
break;
}
if ($field['show_type'] == 'hide') {
$conditionnalField = new PluginFormcreatorQuestion();
$conditionnalField->getFromDB($field['show_field']);
switch ($conditionnalField->fields['fieldtype']) {
case 'checkboxes':
echo '<script type="text/javascript">
var inputElements = document.getElementsByName("formcreator_field_' . $field['show_field'] . '[]");
for(var i=0; inputElements[i]; ++i) {
inputElements[i].addEventListener("change", function(){showFormGroup' . $field['id'] . '()});
}
function showFormGroup' . $field['id'] . '() {
var checkedValue = false;
for(var i=0; inputElements[i]; ++i) {
if (inputElements[i].value ' . $condition . ' "' . $field['show_value'] . '" && inputElements[i].checked) {
checkedValue = true;
}
}
if(checkedValue) {
document.getElementById("form-group-field' . $field['id'] . '").style.display = "block";
} else {
document.getElementById("form-group-field' . $field['id'] . '").style.display = "none";
}
}
showFormGroup' . $field['id'] . '();
</script>';
break;
case 'multiselect':
echo '<script type="text/javascript">
var inputElements = document.getElementsByName("formcreator_field_' . $field['show_field'] . '[]")[1];
inputElements.addEventListener("change", function(){showFormGroup' . $field['id'] . '()});
function showFormGroup' . $field['id'] . '() {
var checkedValue = false;
for(var i=0; inputElements[i]; ++i) {
if (inputElements[i].value ' . $condition . ' "' . $field['show_value'] . '" && inputElements[i].selected) {
checkedValue = true;
}
}
if(checkedValue) {
document.getElementById("form-group-field' . $field['id'] . '").style.display = "block";
} else {
document.getElementById("form-group-field' . $field['id'] . '").style.display = "none";
}
}
showFormGroup' . $field['id'] . '();
</script>';
break;
case 'radios':
echo '<script type="text/javascript">
var inputElements = document.getElementsByName("formcreator_field_' . $field['show_field'] . '");
for(var i=0; inputElements[i]; ++i) {
inputElements[i].addEventListener("change", function(){showFormGroup' . $field['id'] . '()});
}
function showFormGroup' . $field['id'] . '() {
var checkedValue = false;
//.........这里部分代码省略.........
示例10: show
//.........这里部分代码省略.........
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['job'][4] . " : </td></tr>";
echo "<tr class='center tab_bg_1'>";
echo "<td >" . $user_name . $user_sname . "</td></tr>";
echo "<input type='hidden' name='logged' value='" . $logged . "'>";
}
if ($CFG_GLPI['urgency_mask'] != 1 << 3) {
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['joblist'][29] . " : </td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>";
//Ticket::dropdownUrgency("urgency",$urgency);
Ticket::dropdownUrgency(array('value' => $values["urgency"]));
echo "</td></tr>";
}
if (NotificationTargetTicket::isAuthorMailingActivatedForHelpdesk()) {
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['help'][8] . " :</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td >";
Dropdown::showYesNo('use_email_notification', $use_email_notification);
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['plugin_mobile']["email"] . " :</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td ><input type='text' id='user_email' name='user_email' value=\"{$email}\" size='40' onchange=\"use_email_notification.value='1'\">";
echo "</td></tr>";
}
if ($_SESSION["glpiactiveprofile"]["helpdesk_hardware"] != 0) {
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['help'][24] . " : </td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td >";
Item_Ticket::dropdownMyDevices(Session::getLoginUserID(), $_SESSION["glpiactive_entity"]);
//Ticket::dropdownMyDevices($ID,$_SESSION["glpiactive_entity"]);
echo "</td></tr>";
}
//Stevenes Donato
echo "<tr class='tab_bg_1'>";
echo "<td class='force_left'>" . $LANG['common'][36] . " :</td></tr>";
echo "<tr class='tab_bg_1'><td>";
//Dropdown::show('TicketCategory', array('value' => $itilcategories_id,'condition'=>'`is_helpdeskvisible`=1'));
//Dropdown::show('ITILCategory', array('value' => $itilcategories_id,'condition'=>'`is_helpdeskvisible`=1'));
//Dropdown::getDropdownName("glpi_itilcategories", $this->fields["itilcategories_id"]);
//Dropdown::showFromArray("completename", $itilcategories_id);
echo "<script>\n\t\tfunction getCat(sel) {\n\t\t //var x = document.getElementById('sel_cat').value;\n\t\t var cat = sel.options[sel.selectedIndex].value; \n\t\t //document.getElementById('demo').innerHTML = 'Categoria: ' + cat;\n\t\t //document.getElementById('demo').innerHTML = '<input type=\\'text\\' name=\\'itilcategories_id\\' value=\\' +cat+ \\'/>';\n\t\t document.getElementById('categoria').value = cat;\t\t \n\t\t}\n\t\t</script>";
echo "<select id='sel_cat' onchange='getCat(this)'>";
echo '<option value=" "> -- ' . $LANG['dropdown'][35] . '-- </option>';
while ($cat = $DB->fetch_array($result_cat)) {
echo "<option value=" . $cat['id'] . " id= \"" . $cat['completename'] . " \">" . $cat['completename'] . " </option>";
}
echo "</select>" . "\n";
echo "</td></tr>";
echo "<tr><td>";
//echo '<label for="itilcategories_id" id="demo"></label>';
//echo "<span id='demo'></span>";
echo "<input id='categoria' type='hidden' name='itilcategories_id' value='' />";
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][57] . " :</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td ><input type='text' maxlength='250' size='50' name='name' value=\"{$title}\" required ></td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['joblist'][6] . " :</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td colspan='1'><textarea name='content' cols='78' rows='14' required >{$content}</textarea>";
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . $LANG['document'][2] . " (" . Document::getMaxUploadSize() . ") :";
/*
* we hide the picture (aide.png) to prevent the form openning in other window,
* outside the mobile plugin layout.
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 "<input type='hidden' name='ido' value='" . $IDO . "'>";
?>
<script>
function getID() {
var ido = document.getElementById('ido').value;
document.getElementById('session').innerHTML = "$_SESSION['logged']="+ido;
//window.location.assign('".$CFG_GLPI['root_doc']."/plugins/mobile/front/helpdesk.php?id='+id+'&session=".$IDO."');
}
</script>
<div id="session" style="display:none;"></div>
<?php
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td><input type='file' class='ui-input-text ui-body-null ui-corner-all ui-shadow-inset ui-body-c' name='filename' value=\"\" size='25'></td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td colspan='1' class='center'>";
echo "<input type='submit' value=\"" . $LANG['help'][14] . "\" class='submit' >";
echo "</td></tr>";
echo "</table></div>";
//</form>";
Html::closeForm();
}
示例11: showForItem
//.........这里部分代码省略.........
if ($item->isRecursive()) {
$entities = getSonsOf('glpi_entities', $entity);
} else {
$entities = $entity;
}
}
$limit = getEntitiesRestrictRequest(" AND ", "glpi_documents", '', $entities, true);
$q = "SELECT COUNT(*)\n FROM `glpi_documents`\n WHERE `is_deleted` = '0'\n {$limit}";
$result = $DB->query($q);
$nb = $DB->result($result, 0, 0);
if ($item->getType() == 'Document') {
$used[$ID] = $ID;
}
echo "<div class='firstbloc'>";
echo "<form name='documentitem_form{$rand}' id='documentitem_form{$rand}' method='post'\n action='" . Toolbox::getItemTypeFormURL('Document') . "' enctype=\"multipart/form-data\">";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_2'><th colspan='5'>" . __('Add a document') . "</th></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td class='center'>";
_e('Heading');
echo "</td><td width='20%'>";
DocumentCategory::dropdown(array('entity' => $entities));
echo "</td>";
echo "<td class='right'>";
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 Html::file();
echo "</td><td class='left'>";
echo "(" . Document::getMaxUploadSize() . ") ";
echo "</td>";
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 (Document::canView() && $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='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);
示例12: wizardFiveForm
function wizardFiveForm($ID, $options = array())
{
global $CFG_GLPI;
if ($ID > 0) {
$this->check($ID, 'r');
}
echo "<div align='center'>";
echo "<form action='" . $options['target'] . "' enctype='multipart/form-data' method='post'>";
echo "<table class='plugin_resources_wizard' >";
echo "<tr>";
echo "<td class='plugin_resources_wizard_left_area' valign='top'>";
echo "</td>";
echo "<td class='plugin_resources_wizard_right_area' valign='top'>";
echo "<div class='plugin_resources_wizard_title'><p>";
echo "<img class='plugin_resource_wizard_img' src='" . $CFG_GLPI['root_doc'] . "/plugins/resources/pics/newresource.png' alt='newresource'/> ";
_e('Add the photo of the resource', 'resources');
echo "</p></div>";
echo "<div class='center'>";
if (!$this->canView()) {
return false;
}
echo "<table class='plugin_resources_wizard_table'>";
echo "<tr><td colspan='2' align='left'>";
if (isset($this->fields["picture"])) {
$path = GLPI_PLUGIN_DOC_DIR . "/resources/" . $this->fields["picture"];
if (file_exists($path)) {
echo "<object data='" . $CFG_GLPI['root_doc'] . "/plugins/resources/front/picture.send.php?file=" . $this->fields["picture"] . "'>\n <param name='src' value='" . $CFG_GLPI['root_doc'] . "/plugins/resources/front/picture.send.php?file=" . $this->fields["picture"] . "'>\n </object> ";
} else {
echo "<img src='" . $CFG_GLPI['root_doc'] . "/plugins/resources/pics/nobody.png'>";
}
} else {
echo "<img src='" . $CFG_GLPI['root_doc'] . "/plugins/resources/pics/nobody.png'>";
}
echo "</td><td colspan='2' align='left'>" . __('Photo format : JPG', 'resources') . "<br>";
echo "<input type='file' name='picture' value=\"" . $this->fields["picture"] . "\" size='25'> ";
echo "(" . Document::getMaxUploadSize() . ") ";
echo "</td></tr>";
echo "<tr><td colspan='2'> ";
echo "</td><td colspan='2'>";
echo "<input type='submit' name='upload_five_step' value='" . _sx('button', 'Add') . "' class='submit' />";
echo "<input type='hidden' name='plugin_resources_resources_id' value='" . $this->fields["id"] . "'/>";
echo "</td></tr>";
echo "</table>";
echo "</div></td>";
echo "</tr>";
echo "<input type='hidden' name='plugin_resources_resources_id' value=\"" . $ID . "\">";
if ($this->canCreate() && !empty($ID)) {
echo "<tr><td class='plugin_resources_wizard_button' colspan='2'>";
echo "<div class='next'>";
echo "<input type='submit' name='five_step' value='" . _sx('button', 'Next >', 'resources') . "' class='submit' />";
echo "<input type='hidden' name='plugin_resources_resources_id' value='" . $this->fields["id"] . "'/>";
echo "</div>";
echo "</td></tr>";
}
echo "</table>";
Html::closeForm();
echo "</div>";
}
示例13: showSubFormDocument_Item
static function showSubFormDocument_Item($ID, $params)
{
global $DB, $CFG_GLPI;
$item = new Ticket();
$item->getFromDB($ID);
if (empty($withtemplate)) {
$withtemplate = 0;
}
$linkparam = '';
if (get_class($item) == 'Ticket') {
$linkparam = "&tickets_id=" . $item->fields['id'];
}
$canedit = $item->canAddItem('Document') && Document::canView();
$rand = mt_rand();
$is_recursive = $item->isRecursive();
$order = "DESC";
$sort = "`assocdate`";
$query = "SELECT `glpi_documents_items`.`id` AS assocID,\n `glpi_documents_items`.`date_mod` AS assocdate,\n `glpi_entities`.`id` AS entityID,\n `glpi_entities`.`completename` AS entity,\n `glpi_documentcategories`.`completename` AS headings,\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 LEFT JOIN `glpi_documentcategories`\n ON (`glpi_documents`.`documentcategories_id`=`glpi_documentcategories`.`id`)\n WHERE `glpi_documents_items`.`items_id` = '{$ID}'\n AND `glpi_documents_items`.`itemtype` = '" . $item->getType() . "' ";
if (Session::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_documents_items`.`date_mod` AS assocdate,\n `glpi_entities`.`id` AS entityID,\n `glpi_entities`.`completename` AS entity,\n `glpi_documentcategories`.`completename` AS headings,\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 LEFT JOIN `glpi_documentcategories`\n ON (`glpi_documents`.`documentcategories_id`=`glpi_documentcategories`.`id`)\n WHERE `glpi_documents_items`.`documents_id` = '{$ID}'\n AND `glpi_documents_items`.`itemtype` = '" . $item->getType() . "' ";
if (Session::getLoginUserID()) {
$query .= getEntitiesRestrictRequest(" AND", "glpi_documents", '', '', true);
} 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'];
}
}
if ($item->canAddItem('Document') && $withtemplate < 2) {
// Restrict entity for knowbase
$entities = "";
$entity = $_SESSION["glpiactive_entity"];
if ($item->isEntityAssign()) {
/// Case of personal items : entity = -1 : create on active entity (Reminder case))
if ($item->getEntityID() >= 0) {
$entity = $item->getEntityID();
}
if ($item->isRecursive()) {
$entities = getSonsOf('glpi_entities', $entity);
} else {
$entities = $entity;
}
}
$limit = getEntitiesRestrictRequest(" AND ", "glpi_documents", '', $entities, true);
$q = "SELECT COUNT(*)\n FROM `glpi_documents`\n WHERE `is_deleted` = '0'\n {$limit}";
$result = $DB->query($q);
$nb = $DB->result($result, 0, 0);
if ($item->getType() == 'Document') {
$used[$ID] = $ID;
}
if (!isset($params['no_form']) || $params['no_form'] == false) {
echo "<div class='firstbloc'>";
echo "<form name='documentitem_form{$rand}' id='documentitem_form{$rand}' method='post'\n action='" . Toolbox::getItemTypeFormURL('Document') . "' enctype=\"multipart/form-data\">";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_2'><th colspan='5'>" . __('Add a document') . "</th></tr>";
}
echo "<tr class='tab_bg_1'>";
if (!isset($params['no_form']) || $params['no_form'] == false) {
echo "<td class='center'>";
_e('Heading');
echo "</td><td>";
DocumentCategory::dropdown(array('entity' => $entities));
echo "</td>";
echo "<td class='right'>";
} else {
echo "<td class='center'>" . __('Add a document') . "</td>";
echo "<td style='padding-left:50px'>";
}
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 Html::file();
echo "</td><td class='left'>";
echo "(" . Document::getMaxUploadSize() . ") ";
echo "</td>";
if (!isset($params['no_form']) || $params['no_form'] == false) {
echo "<td class='center' width='20%'>";
echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add a new file') . "\"\n class='submit'></td>";
//.........这里部分代码省略.........