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


PHP Ajax::updateItemJsCode方法代码示例

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


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

示例1: showAddTitle

 function showAddTitle($form)
 {
     global $LANG, $CFG_GLPI;
     echo "<div id='viewaddtitle'></div>\n";
     echo "<script type='text/javascript' >\n";
     echo "function viewAddTitle () {\n";
     $params = array('type' => __CLASS__, 'parenttype' => 'PluginFormcreatorForm', 'plugin_formcreator_forms_id' => $form->fields['id'], 'id' => -1);
     Ajax::updateItemJsCode("viewaddtitle", $CFG_GLPI["root_doc"] . "/plugins/formcreator/ajax/viewaddobject.php", $params);
     echo "};";
     echo "</script>\n";
     echo "<div class='center'>" . "<a href='javascript:viewAddTitle();'>";
     echo $LANG['plugin_formcreator']["title"][0] . "</a></div><br/>\n";
     self::getListTitle($form->fields['id']);
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:14,代码来源:title.class.php

示例2: showAddSection

 function showAddSection($form)
 {
     global $LANG, $CFG_GLPI;
     $target = new PluginFormcreatorTarget();
     $listTarget = $target->find("plugin_formcreator_forms_id = '" . $form->fields['id'] . "'");
     if (!empty($listTarget)) {
         echo "<div id='viewaddsection'></div>\n";
         echo "<script type='text/javascript' >\n";
         echo "function viewAddSection () {\n";
         $params = array('type' => __CLASS__, 'parenttype' => 'PluginFormcreatorForm', 'plugin_formcreator_forms_id' => $form->fields['id'], 'id' => -1);
         Ajax::updateItemJsCode("viewaddsection", $CFG_GLPI["root_doc"] . "/plugins/formcreator/ajax/viewaddobject.php", $params);
         echo "};";
         echo "</script>\n";
         echo "<div class='center'>" . "<a href='javascript:viewAddSection();'>";
         echo $LANG['plugin_formcreator']["section"][0] . "</a></div><br/>\n";
         self::getListSection($form->fields['id']);
     } else {
         echo "<div class='center'>";
         echo $LANG['plugin_formcreator']['section'][2];
         echo "</div>";
     }
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:22,代码来源:section.class.php

示例3: showTranslations

 /**
  * Display all translated field for an KnowbaseItem
  *
  * @param $item a KnowbaseItem item
  *
  * @return true;
  **/
 static function showTranslations(KnowbaseItem $item)
 {
     global $DB, $CFG_GLPI;
     $canedit = $item->can($item->getID(), UPDATE);
     $rand = mt_rand();
     if ($canedit) {
         echo "<div id='viewtranslation" . $item->getID() . "{$rand}'></div>\n";
         echo "<script type='text/javascript' >\n";
         echo "function addTranslation" . $item->getID() . "{$rand}() {\n";
         $params = array('type' => __CLASS__, 'parenttype' => get_class($item), 'knowbaseitems_id' => $item->fields['id'], 'id' => -1);
         Ajax::updateItemJsCode("viewtranslation" . $item->getID() . "{$rand}", $CFG_GLPI["root_doc"] . "/ajax/viewsubitem.php", $params);
         echo "};";
         echo "</script>\n";
         echo "<div class='center'>" . "<a class='vsubmit' href='javascript:addTranslation" . $item->getID() . "{$rand}();'>" . __('Add a new translation') . "</a></div><br>";
     }
     $obj = new self();
     $found = $obj->find("`knowbaseitems_id`='" . $item->getID() . "'", "`language` ASC");
     if (count($found) > 0) {
         if ($canedit) {
             Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
             $massiveactionparams = array('container' => 'mass' . __CLASS__ . $rand);
             Html::showMassiveActions($massiveactionparams);
         }
         echo "<div class='center'>";
         echo "<table class='tab_cadre_fixehov'><tr class='tab_bg_2'>";
         echo "<th colspan='4'>" . __("List of translations") . "</th></tr>";
         if ($canedit) {
             echo "<th width='10'>";
             Html::checkAllAsCheckbox('mass' . __CLASS__ . $rand);
             echo "</th>";
         }
         echo "<th>" . __("Language") . "</th>";
         echo "<th>" . __("Subject") . "</th>";
         foreach ($found as $data) {
             echo "<tr class='tab_bg_1' " . ($canedit ? "style='cursor:pointer'\n                     onClick=\"viewEditTranslation" . $data['id'] . "{$rand}();\"" : '') . ">";
             if ($canedit) {
                 echo "<td class='center'>";
                 Html::showMassiveActionCheckBox(__CLASS__, $data["id"]);
                 echo "</td>";
             }
             echo "<td>";
             if ($canedit) {
                 echo "\n<script type='text/javascript' >\n";
                 echo "function viewEditTranslation" . $data["id"] . "{$rand}() {\n";
                 $params = array('type' => __CLASS__, 'parenttype' => get_class($item), 'knowbaseitems_id' => $item->getID(), 'id' => $data["id"]);
                 Ajax::updateItemJsCode("viewtranslation" . $item->getID() . "{$rand}", $CFG_GLPI["root_doc"] . "/ajax/viewsubitem.php", $params);
                 echo "};";
                 echo "</script>\n";
             }
             echo Dropdown::getLanguageName($data['language']);
             echo "</td><td>";
             echo $data["name"];
             if (isset($data['answer']) && !empty($data['answer'])) {
                 echo "&nbsp;";
                 Html::showToolTip(Toolbox::unclean_html_cross_side_scripting_deep($data['answer']));
             }
             echo "</td></tr>";
         }
         echo "</table>";
         if ($canedit) {
             $massiveactionparams['ontop'] = false;
             Html::showMassiveActions($massiveactionparams);
             Html::closeForm();
         }
     } else {
         echo "<table class='tab_cadre_fixe'><tr class='tab_bg_2'>";
         echo "<th class='b'>" . __("No translation found") . "</th></tr></table>";
     }
     return true;
 }
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:77,代码来源:knowbaseitemtranslation.class.php

示例4: showForContract

 /**
  * Print the contract costs
  *
  * @param $contract               Contract object
  * @param $withtemplate  boolean  Template or basic item (default '')
  *
  * @return Nothing (call to classes members)
  **/
 static function showForContract(Contract $contract, $withtemplate = '')
 {
     global $DB, $CFG_GLPI;
     $ID = $contract->fields['id'];
     if (!$contract->getFromDB($ID) || !$contract->can($ID, READ)) {
         return false;
     }
     $canedit = $contract->can($ID, UPDATE);
     echo "<div class='center'>";
     $query = "SELECT *\n                FROM `glpi_contractcosts`\n                WHERE `contracts_id` = '{$ID}'\n                ORDER BY `begin_date`";
     $rand = mt_rand();
     if ($canedit) {
         echo "<div id='viewcost" . $ID . "_{$rand}'></div>\n";
         echo "<script type='text/javascript' >\n";
         echo "function viewAddCost" . $ID . "_{$rand}() {\n";
         $params = array('type' => __CLASS__, 'parenttype' => 'Contract', 'contracts_id' => $ID, 'id' => -1);
         Ajax::updateItemJsCode("viewcost" . $ID . "_{$rand}", $CFG_GLPI["root_doc"] . "/ajax/viewsubitem.php", $params);
         echo "};";
         echo "</script>\n";
         echo "<div class='center firstbloc'>" . "<a class='vsubmit' href='javascript:viewAddCost" . $ID . "_{$rand}();'>";
         echo __('Add a new cost') . "</a></div>\n";
     }
     if ($result = $DB->query($query)) {
         echo "<table class='tab_cadre_fixehov'>";
         echo "<tr><th colspan='5'>" . self::getTypeName($DB->numrows($result)) . "</th></tr>";
         if ($DB->numrows($result)) {
             echo "<tr><th>" . __('Name') . "</th>";
             echo "<th>" . __('Begin date') . "</th>";
             echo "<th>" . __('End date') . "</th>";
             echo "<th>" . __('Budget') . "</th>";
             echo "<th>" . __('Cost') . "</th>";
             echo "</tr>";
             Session::initNavigateListItems(__CLASS__, sprintf(__('%1$s = %2$s'), Contract::getTypeName(1), $contract->getName()));
             $total = 0;
             while ($data = $DB->fetch_assoc($result)) {
                 echo "<tr class='tab_bg_2' " . ($canedit ? "style='cursor:pointer' onClick=\"viewEditCost" . $data['contracts_id'] . "_" . $data['id'] . "_{$rand}();\"" : '') . ">";
                 $name = empty($data['name']) ? sprintf(__('%1$s (%2$s)'), $data['name'], $data['id']) : $data['name'];
                 echo "<td>";
                 printf(__('%1$s %2$s'), $name, Html::showToolTip($data['comment'], array('display' => false)));
                 if ($canedit) {
                     echo "\n<script type='text/javascript' >\n";
                     echo "function viewEditCost" . $data['contracts_id'] . "_" . $data["id"] . "_{$rand}() {\n";
                     $params = array('type' => __CLASS__, 'parenttype' => 'Contract', 'contracts_id' => $data["contracts_id"], 'id' => $data["id"]);
                     Ajax::updateItemJsCode("viewcost" . $ID . "_{$rand}", $CFG_GLPI["root_doc"] . "/ajax/viewsubitem.php", $params);
                     echo "};";
                     echo "</script>\n";
                 }
                 echo "</td>";
                 echo "<td>" . Html::convDate($data['begin_date']) . "</td>";
                 echo "<td>" . Html::convDate($data['end_date']) . "</td>";
                 echo "<td>" . Dropdown::getDropdownName('glpi_budgets', $data['budgets_id']) . "</td>";
                 echo "<td class='numeric'>" . Html::formatNumber($data['cost']) . "</td>";
                 $total += $data['cost'];
                 echo "</tr>";
                 Session::addToNavigateListItems(__CLASS__, $data['id']);
             }
             echo "<tr class='b noHover'><td colspan='3'>&nbsp;</td>";
             echo "<td class='right'>" . __('Total cost') . '</td>';
             echo "<td class='numeric'>" . Html::formatNumber($total) . '</td></tr>';
         } else {
             echo "<tr><th colspan='5'>" . __('No item found') . "</th></tr>";
         }
         echo "</table>";
     }
     echo "</div><br>";
 }
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:74,代码来源:contractcost.class.php

示例5: showActorsPartForm


//.........这里部分代码省略.........
             // predefined value
             if (isset($options["_groups_id_observer"]) && $options["_groups_id_observer"]) {
                 echo self::getActorIcon('group', CommonITILActor::OBSERVER) . "&nbsp;";
                 echo Dropdown::getDropdownName("glpi_groups", $options["_groups_id_observer"]);
                 echo "<input type='hidden' name='_groups_id_observer' value=\"" . $options["_groups_id_observer"] . "\">";
                 echo '<br>';
             }
         }
     } else {
         if (!$is_hidden['_groups_id_observer']) {
             $this->showGroupsAssociated(CommonITILActor::OBSERVER, $candeleteobserver, $options);
         }
     }
     echo "</td>";
     echo "<td>";
     if ($rand_assign >= 0) {
         $this->showActorAddForm(CommonITILActor::ASSIGN, $rand_assign, $this->fields['entities_id'], $is_hidden, $this->canAssign(), $this->canAssign());
     }
     // Assign User
     if (!$ID) {
         if ($can_assign && !$is_hidden['_users_id_assign'] && $this->isAllowedStatus($this->fields['status'], CommonITILObject::ASSIGNED)) {
             $this->showActorAddFormOnCreate(CommonITILActor::ASSIGN, $options);
             echo '<hr>';
         } else {
             if ($can_assigntome && !$is_hidden['_users_id_assign'] && $this->isAllowedStatus($this->fields['status'], CommonITILObject::ASSIGNED)) {
                 echo self::getActorIcon('user', CommonITILActor::ASSIGN) . "&nbsp;";
                 User::dropdown(array('name' => '_users_id_assign', 'value' => $options["_users_id_assign"], 'entity' => $this->fields["entities_id"], 'ldap_import' => true));
                 echo '<hr>';
             } else {
                 // predefined value
                 if (isset($options["_users_id_assign"]) && $options["_users_id_assign"] && $this->isAllowedStatus($this->fields['status'], CommonITILObject::ASSIGNED)) {
                     echo self::getActorIcon('user', CommonITILActor::ASSIGN) . "&nbsp;";
                     echo Dropdown::getDropdownName("glpi_users", $options["_users_id_assign"]);
                     echo "<input type='hidden' name='_users_id_assign' value=\"" . $options["_users_id_assign"] . "\">";
                     echo '<hr>';
                 }
             }
         }
     } else {
         if (!$is_hidden['_users_id_assign']) {
             $this->showUsersAssociated(CommonITILActor::ASSIGN, $candeleteassign, $options);
         }
     }
     // Assign Groups
     if (!$ID) {
         if ($can_assign && !$is_hidden['_groups_id_assign'] && $this->isAllowedStatus($this->fields['status'], CommonITILObject::ASSIGNED)) {
             echo self::getActorIcon('group', CommonITILActor::ASSIGN);
             /// For ticket templates : mandatories
             if (isset($options['_tickettemplate'])) {
                 echo $options['_tickettemplate']->getMandatoryMark('_groups_id_assign');
             }
             echo "&nbsp;";
             $rand = mt_rand();
             $params = array('name' => '_groups_id_assign', 'value' => $options["_groups_id_assign"], 'entity' => $this->fields["entities_id"], 'condition' => '`is_assign`', 'rand' => $rand);
             if ($this->getType() == 'Ticket') {
                 $params['toupdate'] = array('value_fieldname' => 'value', 'to_update' => "countgroupassign_{$rand}", 'url' => $CFG_GLPI["root_doc"] . "/ajax/ticketassigninformation.php", 'moreparams' => array('groups_id_assign' => '__VALUE__'));
             }
             Group::dropdown($params);
             echo "<span id='countgroupassign_{$rand}'>";
             echo "</span>";
             echo "<script type='text/javascript'>";
             Ajax::updateItemJsCode("countgroupassign_{$rand}", $CFG_GLPI["root_doc"] . "/ajax/ticketassigninformation.php", array('groups_id_assign' => '__VALUE__'), "dropdown__groups_id_assign{$rand}");
             echo "</script>";
             echo '<hr>';
         } else {
             // predefined value
             if (isset($options["_groups_id_assign"]) && $options["_groups_id_assign"] && $this->isAllowedStatus($this->fields['status'], CommonITILObject::ASSIGNED)) {
                 echo self::getActorIcon('group', CommonITILActor::ASSIGN) . "&nbsp;";
                 echo Dropdown::getDropdownName("glpi_groups", $options["_groups_id_assign"]);
                 echo "<input type='hidden' name='_groups_id_assign' value=\"" . $options["_groups_id_assign"] . "\">";
                 echo '<hr>';
             }
         }
     } else {
         if (!$is_hidden['_groups_id_assign']) {
             $this->showGroupsAssociated(CommonITILActor::ASSIGN, $candeleteassign, $options);
         }
     }
     // Assign Suppliers
     if (!$ID) {
         if ($can_assign && !$is_hidden['_suppliers_id_assign'] && $this->isAllowedStatus($this->fields['status'], CommonITILObject::ASSIGNED)) {
             $this->showSupplierAddFormOnCreate($options);
         } else {
             // predefined value
             if (isset($options["_suppliers_id_assign"]) && $options["_suppliers_id_assign"] && $this->isAllowedStatus($this->fields['status'], CommonITILObject::ASSIGNED)) {
                 echo self::getActorIcon('supplier', CommonITILActor::ASSIGN) . "&nbsp;";
                 echo Dropdown::getDropdownName("glpi_suppliers", $options["_suppliers_id_assign"]);
                 echo "<input type='hidden' name='_suppliers_id_assign' value=\"" . $options["_suppliers_id_assign"] . "\">";
                 echo '<hr>';
             }
         }
     } else {
         if (!$is_hidden['_suppliers_id_assign']) {
             $this->showSuppliersAssociated(CommonITILActor::ASSIGN, $candeleteassign, $options);
         }
     }
     echo "</td>";
     echo "</tr>";
     echo "</table>";
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:101,代码来源:commonitilobject.class.php

示例6: showTimelineForm

 /**
  * @since version 0.90
  *
  * @param $rand
  **/
 function showTimelineForm($rand)
 {
     global $CFG_GLPI;
     //check global rights
     if (!Session::haveRight("ticket", Ticket::READMY) && !Session::haveRightsOr("followup", array(TicketFollowup::SEEPUBLIC, TicketFollowup::SEEPRIVATE))) {
         return false;
     }
     // javascript function for add and edit items
     echo "<script type='text/javascript' >\n";
     echo "function viewAddSubitem" . $this->fields['id'] . "{$rand}(itemtype) {\n";
     $params = array('action' => 'viewsubitem', 'type' => 'itemtype', 'parenttype' => 'Ticket', 'tickets_id' => $this->fields['id'], 'id' => -1);
     if (isset($_GET['load_kb_sol'])) {
         $params['load_kb_sol'] = $_GET['load_kb_sol'];
     }
     $out = Ajax::updateItemJsCode("viewitem" . $this->fields['id'] . "{$rand}", $CFG_GLPI["root_doc"] . "/ajax/timeline.php", $params, "", false);
     echo str_replace("\"itemtype\"", "itemtype", $out);
     echo "\$('#approbation_form{$rand}').remove()";
     echo "};";
     echo "\n\n      function change_task_state(tasks_id, target) {\n         \$.post('" . $CFG_GLPI["root_doc"] . "/ajax/timeline.php',\n                {'action':     'change_task_state',\n                  'tasks_id':   tasks_id,\n                  'tickets_id': " . $this->fields['id'] . "\n                })\n                .done(function(new_state) {\n                  \$(target).removeClass('state_1 state_2')\n                           .addClass('state_'+new_state);\n                });\n      }\n\n      function viewEditSubitem" . $this->fields['id'] . "{$rand}(e, itemtype, items_id, o, domid) {\n               domid = (typeof domid === 'undefined')\n                         ? 'viewitem" . $this->fields['id'] . $rand . "'\n                         : domid;\n               var target = e.target || window.event.srcElement;\n               if (target.nodeName == 'a') return;\n               if (target.className == 'read_more_button') return;\n               \$('#'+domid).addClass('edited');\n               \$('#'+domid+' .displayed_content').hide();\n               \$('#'+domid+' .cancel_edit_item_content').show()\n                                                        .click(function() {\n                                                            \$(this).hide();\n                                                            \$('#'+domid).removeClass('edited');\n                                                            \$('#'+domid+' .edit_item_content').empty().hide();\n                                                            \$('#'+domid+' .displayed_content').show();\n                                                        });\n               \$('#'+domid+' .edit_item_content').show()\n                                                 .load('" . $CFG_GLPI["root_doc"] . "/ajax/timeline.php',\n                                                       {'action'    : 'viewsubitem',\n                                                        'type'      : itemtype,\n                                                        'parenttype': 'Ticket',\n                                                        'tickets_id': " . $this->fields['id'] . ",\n                                                        'id'        : items_id\n                                                       });\n\n\n      };";
     if (isset($_GET['load_kb_sol'])) {
         echo "viewAddSubitem" . $this->fields['id'] . "{$rand}('Solution');";
     }
     echo "</script>\n";
     //check sub-items rights
     $tmp = array('tickets_id' => $this->getID());
     $fup = new TicketFollowup();
     $ttask = new TicketTask();
     $doc = new Document();
     $canadd_fup = $fup->can(-1, CREATE, $tmp);
     $canadd_task = $ttask->can(-1, CREATE, $tmp);
     $canadd_document = $doc->can(-1, CREATE, $tmp) && $this->canAddItem('Document');
     $canadd_solution = Ticket::canUpdate() && $this->canSolve();
     if (!$canadd_fup && !$canadd_task && !$canadd_document && !$canadd_solution) {
         return false;
     }
     //show choices
     echo "<h2>" . _sx('button', 'Add') . " : </h2>";
     echo "<div class='timeline_form'>";
     echo "<ul class='timeline_choices'>";
     if ($canadd_fup) {
         echo "<li class='followup' onclick='" . "javascript:viewAddSubitem" . $this->fields['id'] . "{$rand}(\"TicketFollowup\");'>" . __("Followup") . "</li>";
     }
     if ($canadd_task) {
         echo "<li class='task' onclick='" . "javascript:viewAddSubitem" . $this->fields['id'] . "{$rand}(\"TicketTask\");'>" . __("Task") . "</li>";
     }
     if ($canadd_document) {
         echo "<li class='document' onclick='" . "javascript:viewAddSubitem" . $this->fields['id'] . "{$rand}(\"Document_Item\");'>" . __("Document") . "</li>";
     }
     if ($canadd_solution) {
         echo "<li class='solution' onclick='" . "javascript:viewAddSubitem" . $this->fields['id'] . "{$rand}(\"Solution\");'>" . __("Solution") . "</li>";
     }
     echo "</ul>";
     // timeline_choices
     echo "<div class='clear'>&nbsp;</div>";
     echo "</div>";
     //end timeline_form
     echo "<div class='ajax_box' id='viewitem" . $this->fields['id'] . "{$rand}'></div>\n";
 }
开发者ID:glpi-project,项目名称:glpi,代码行数:63,代码来源:ticket.class.php

示例7: showForm

 /**
  * Print the reminder form
  *
  * @param $ID        integer  Id of the item to print
  * @param $options   array of possible options:
  *     - target filename : where to go when done.
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI;
     $this->initForm($ID, $options);
     // Show Reminder or blank form
     $onfocus = "";
     if (!$ID > 0) {
         // Create item : do getempty before check right to set default values
         $onfocus = "onfocus=\"if (this.value=='" . $this->fields['name'] . "') this.value='';\"";
     }
     $canedit = $this->can($ID, 'w');
     if ($canedit) {
         Html::initEditorSystem('text');
     }
     $this->showTabs($options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_2'><td>" . __('Title') . "</td>";
     echo "<td>";
     if ($canedit) {
         Html::autocompletionTextField($this, "name", array('size' => 80, 'entity' => -1, 'user' => $this->fields["users_id"], 'option' => $onfocus));
     } else {
         echo $this->fields['name'];
     }
     echo "</td>\n";
     echo "<td>" . __('By') . "</td>";
     echo "<td>";
     echo getUserName($this->fields["users_id"]);
     if (!$ID) {
         echo "<input type='hidden' name='users_id' value='" . $this->fields['users_id'] . "'>\n";
     }
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . _x('reminder', 'Visibility') . "</td>";
     echo "<td>";
     echo '<table><tr><td>';
     echo __('Begin') . '</td><td>';
     Html::showDateTimeFormItem("begin_view_date", $this->fields["begin_view_date"], 1, true, $canedit);
     echo '</td><td>' . __('End') . '</td><td>';
     Html::showDateTimeFormItem("end_view_date", $this->fields["end_view_date"], 1, true, $canedit);
     echo '</td></tr></table>';
     echo "</td>";
     echo "<td>" . __('Status') . "</td>";
     echo "<td>";
     if ($canedit) {
         Planning::dropdownState("state", $this->fields["state"]);
     } else {
         echo Planning::getState($this->fields["state"]);
     }
     echo "</td>\n";
     echo "</tr>\n";
     echo "<tr class='tab_bg_2'><td >" . __('Calendar') . "</td>";
     echo "<td class='center'>";
     if ($canedit) {
         echo "<script type='text/javascript' >\n";
         echo "function showPlan() {\n";
         echo "Ext.get('plan').setDisplayed('none');";
         $params = array('form' => 'remind', 'users_id' => $this->fields["users_id"], 'itemtype' => $this->getType(), 'items_id' => $this->getID());
         if ($ID && $this->fields["is_planned"]) {
             $params['begin'] = $this->fields["begin"];
             $params['end'] = $this->fields["end"];
         }
         Ajax::updateItemJsCode('viewplan', $CFG_GLPI["root_doc"] . "/ajax/planning.php", $params);
         echo "}";
         echo "</script>\n";
     }
     if (!$ID || !$this->fields["is_planned"]) {
         if (Session::haveRight("show_planning", "1") || Session::haveRight("show_group_planning", "1") || Session::haveRight("show_all_planning", "1")) {
             echo "<div id='plan' onClick='showPlan()'>\n";
             echo "<a href='#' class='vsubmit'>" . __('Add to schedule') . "</a>";
         }
     } else {
         if ($canedit) {
             echo "<div id='plan' onClick='showPlan()'>\n";
             echo "<span class='showplan'>";
         }
         //TRANS: %1$s is the begin date, %2$s is the end date
         printf(__('From %1$s to %2$s'), Html::convDateTime($this->fields["begin"]), Html::convDateTime($this->fields["end"]));
         if ($canedit) {
             echo "</span>";
         }
     }
     if ($canedit) {
         echo "</div>\n";
         echo "<div id='viewplan'>\n</div>\n";
     }
     echo "</td>";
     if ($ID && $this->fields["is_planned"] && PlanningRecall::isAvailable()) {
         echo "<td>" . _x('Planning', 'Reminder') . "</td>";
         echo "<td>";
         if ($canedit) {
             PlanningRecall::dropdown(array('itemtype' => 'Reminder', 'items_id' => $ID));
         } else {
             // No edit right : use specific Planning Recall Form
//.........这里部分代码省略.........
开发者ID:gaforeror,项目名称:glpi,代码行数:101,代码来源:reminder.class.php

示例8: showForm


//.........这里部分代码省略.........
         echo "<th></th><td></td>";
     }
     echo "<th>" . $tt->getBeginHiddenFieldText('locations_id');
     printf(__('%1$s%2$s'), __('Location'), $tt->getMandatoryMark('locations_id'));
     echo $tt->getEndHiddenFieldText('locations_id') . "</th>";
     echo "<td>";
     echo $tt->getBeginHiddenFieldValue('locations_id');
     if ($canupdate) {
         Location::dropdown(array('value' => $this->fields['locations_id'], 'entity' => $this->fields['entities_id']));
     } else {
         echo Dropdown::getDropdownName('glpi_locations', $this->fields["locations_id"]);
     }
     echo $tt->getEndHiddenFieldValue('locations_id', $this);
     echo "</td></tr>";
     echo "</table>";
     if ($ID) {
         $values['canupdate'] = $canupdate;
         $this->showActorsPartForm($ID, $values);
     }
     $view_linked_tickets = $ID || $canupdate;
     echo "<table class='tab_cadre_fixe' id='mainformtable4'>";
     echo "<tr class='tab_bg_1'>";
     echo "<th width='{$colsize1}%'>" . $tt->getBeginHiddenFieldText('name');
     printf(__('%1$s%2$s'), __('Title'), $tt->getMandatoryMark('name'));
     echo $tt->getEndHiddenFieldText('name') . "</th>";
     echo "<td width='" . (100 - $colsize1) . "%' colspan='3'>";
     if (!$ID || $canupdate_descr) {
         echo $tt->getBeginHiddenFieldValue('name');
         $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' => 90, '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}'>\n";
         echo "</div>\n";
         if (!$ID) {
             echo "<script type='text/javascript' >\n\n            showName{$rand}();\n            </script>";
         }
         echo $tt->getEndHiddenFieldValue('name', $this);
     } else {
         if (empty($this->fields["name"])) {
             _e('Without title');
         } else {
             echo $this->fields["name"];
         }
     }
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<th width='{$colsize1}%'>" . $tt->getBeginHiddenFieldText('content');
     printf(__('%1$s%2$s'), __('Description'), $tt->getMandatoryMark('content'));
     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');
开发者ID:gaforeror,项目名称:glpi,代码行数:67,代码来源:ticket.class.php

示例9: showTimelineForm

 /**
  * @since version 0.90
  *
  * @param $rand
  **/
 function showTimelineForm($rand)
 {
     global $CFG_GLPI;
     //check global rights
     if (!Session::haveRight("ticket", Ticket::READMY) && !Session::haveRightsOr("followup", array(TicketFollowup::SEEPUBLIC, TicketFollowup::SEEPRIVATE))) {
         return false;
     }
     // javascript function for add and edit items
     echo "<script type='text/javascript' >\n";
     echo "function viewAddSubitem" . $this->fields['id'] . "{$rand}(itemtype) {\n";
     $params = array('type' => 'itemtype', 'parenttype' => 'Ticket', 'tickets_id' => $this->fields['id'], 'id' => -1);
     if (isset($_GET['load_kb_sol'])) {
         $params['load_kb_sol'] = $_GET['load_kb_sol'];
     }
     $out = Ajax::updateItemJsCode("viewitem" . $this->fields['id'] . "{$rand}", $CFG_GLPI["root_doc"] . "/ajax/timeline_viewsubitem.php", $params, "", false);
     echo str_replace("\"itemtype\"", "itemtype", $out);
     echo "\$('#approbation_form{$rand}').remove()";
     echo "};";
     $out = "function viewEditSubitem" . $this->fields['id'] . "{$rand}(e, itemtype, items_id, o) {\n\n               var target = e.target || window.event.srcElement;\n               if (target.nodeName == 'a') return;\n               if (target.className == 'read_more_button') return;";
     $params = array('type' => 'itemtype', 'parenttype' => 'Ticket', 'tickets_id' => $this->fields['id'], 'id' => 'items_id');
     $out .= Ajax::updateItemJsCode("viewitem" . $this->fields['id'] . "{$rand}", $CFG_GLPI["root_doc"] . "/ajax/timeline_viewsubitem.php", $params, "", false);
     $out = str_replace("\"itemtype\"", "itemtype", $out);
     $out = str_replace("\"items_id\"", "items_id", $out);
     echo $out;
     //scroll to edit form
     echo "\$('body').scrollTop(0);";
     echo "\$('.ui-tabs-panel').scrollTop(0);";
     // add a mark to currently edited element
     echo "var found_active = \$('.talk_active');\n            i = found_active.length;\n            while(i--) {\n               var classes = found_active[i].className.replace( /(?:^|\\s)talk_active(?!\\S)/ , '' );\n               found_active[i].className = classes;\n            }\n            o.className = o.className + ' talk_active';\n\n            \$('#approbation_form{$rand}').remove();\n      };";
     if (isset($_GET['load_kb_sol'])) {
         echo "viewAddSubitem" . $this->fields['id'] . "{$rand}('Solution');";
     }
     echo "</script>\n";
     //check sub-items rights
     $tmp = array('tickets_id' => $this->getID());
     $fup = new TicketFollowup();
     $ttask = new TicketTask();
     $doc = new Document();
     $canadd_fup = $fup->can(-1, CREATE, $tmp);
     $canadd_task = $ttask->can(-1, CREATE, $tmp);
     $canadd_document = $doc->can(-1, CREATE, $tmp) && $this->canAddItem('Document');
     $canadd_solution = Ticket::canUpdate() && $this->canSolve();
     if (!$canadd_fup && !$canadd_task && !$canadd_document && !$canadd_solution) {
         return false;
     }
     //show choices
     echo "<h2>" . _sx('button', 'Add') . " : </h2>";
     echo "<div class='timeline_form'>";
     echo "<ul class='timeline_choices'>";
     if ($canadd_fup) {
         echo "<li class='followup' onclick='" . "javascript:viewAddSubitem" . $this->fields['id'] . "{$rand}(\"TicketFollowup\");'>" . __("Followup") . "</li>";
     }
     if ($canadd_task) {
         echo "<li class='task' onclick='" . "javascript:viewAddSubitem" . $this->fields['id'] . "{$rand}(\"TicketTask\");'>" . __("Task") . "</li>";
     }
     if ($canadd_document) {
         echo "<li class='document' onclick='" . "javascript:viewAddSubitem" . $this->fields['id'] . "{$rand}(\"Document_Item\");'>" . __("Document") . "</li>";
     }
     if ($canadd_solution) {
         echo "<li class='solution' onclick='" . "javascript:viewAddSubitem" . $this->fields['id'] . "{$rand}(\"Solution\");'>" . __("Solution") . "</li>";
     }
     echo "</ul>";
     // timeline_choices
     echo "<div class='clear'>&nbsp;</div>";
     echo "</div>";
     //end timeline_form
     echo "<div class='ajax_box' id='viewitem" . $this->fields['id'] . "{$rand}'></div>\n";
 }
开发者ID:jose-martins,项目名称:glpi,代码行数:73,代码来源:ticket.class.php

示例10: showForObject

 /**
  * Print the item costs
  *
  * @param $item                  CommonITILObject object or Project
  * @param $withtemplate boolean  Template or basic item (default '')
  *
  * @return total cost
  **/
 static function showForObject($item, $withtemplate = '')
 {
     global $DB, $CFG_GLPI;
     $forproject = false;
     if (Toolbox::is_a($item, 'Project')) {
         $forproject = true;
     }
     $ID = $item->fields['id'];
     if (!$item->getFromDB($ID) || !$item->canViewItem() || !static::canView()) {
         return false;
     }
     $canedit = false;
     if (!$forproject) {
         $canedit = $item->canUpdateItem();
     }
     echo "<div class='center'>";
     $condition = "= '{$ID}'";
     if ($forproject) {
         $condition = " IN ('" . implode("','", ProjectTask::getAllTicketsForProject($ID)) . "')";
     }
     $query = "SELECT *\n                FROM `" . static::getTable() . "`\n                WHERE `" . static::$items_id . "` {$condition}\n                ORDER BY `begin_date`";
     $rand = mt_rand();
     if ($canedit) {
         echo "<div id='viewcost" . $ID . "_{$rand}'></div>\n";
         echo "<script type='text/javascript' >\n";
         echo "function viewAddCost" . $ID . "_{$rand}() {\n";
         $params = array('type' => static::getType(), 'parenttype' => static::$itemtype, static::$items_id => $ID, 'id' => -1);
         Ajax::updateItemJsCode("viewcost" . $ID . "_{$rand}", $CFG_GLPI["root_doc"] . "/ajax/viewsubitem.php", $params);
         echo "};";
         echo "</script>\n";
         if (static::canCreate()) {
             echo "<div class='center firstbloc'>" . "<a class='vsubmit' href='javascript:viewAddCost" . $ID . "_{$rand}();'>";
             echo __('Add a new cost') . "</a></div>\n";
         }
     }
     $total = 0;
     $total_time = 0;
     $total_costtime = 0;
     $total_fixed = 0;
     $total_material = 0;
     if ($result = $DB->query($query)) {
         echo "<table class='tab_cadre_fixehov'>";
         echo "<tr class='noHover'>";
         if ($forproject) {
             echo "<th colspan='10'>" . _n('Ticket cost', 'Ticket costs', $DB->numrows($result)) . "</th>";
         } else {
             echo "<th colspan='7'>" . self::getTypeName($DB->numrows($result)) . "</th>";
             echo "<th>" . __('Item duration') . "</th>";
             echo "<th>" . CommonITILObject::getActionTime($item->fields['actiontime']) . "</th>";
         }
         echo "</tr>";
         if ($DB->numrows($result)) {
             echo "<tr>";
             if ($forproject) {
                 echo "<th>" . __('Ticket') . "</th>";
                 $ticket = new Ticket();
             }
             echo "<th>" . __('Name') . "</th>";
             echo "<th>" . __('Begin date') . "</th>";
             echo "<th>" . __('End date') . "</th>";
             echo "<th>" . __('Budget') . "</th>";
             echo "<th>" . __('Duration') . "</th>";
             echo "<th>" . __('Time cost') . "</th>";
             echo "<th>" . __('Fixed cost') . "</th>";
             echo "<th>" . __('Material cost') . "</th>";
             echo "<th>" . __('Total cost') . "</th>";
             echo "</tr>";
             Session::initNavigateListItems(static::getType(), sprintf(__('%1$s = %2$s'), $item->getTypeName(1), $item->getName()));
             while ($data = $DB->fetch_assoc($result)) {
                 echo "<tr class='tab_bg_2' " . ($canedit ? "style='cursor:pointer' onClick=\"viewEditCost" . $data[static::$items_id] . "_" . $data['id'] . "_{$rand}();\"" : '') . ">";
                 $name = empty($data['name']) ? sprintf(__('%1$s (%2$s)'), $data['name'], $data['id']) : $data['name'];
                 if ($forproject) {
                     $ticket->getFromDB($data['tickets_id']);
                     echo "<td>" . $ticket->getLink() . "</td>";
                 }
                 echo "<td>";
                 printf(__('%1$s %2$s'), $name, Html::showToolTip($data['comment'], array('display' => false)));
                 if ($canedit) {
                     echo "\n<script type='text/javascript' >\n";
                     echo "function viewEditCost" . $data[static::$items_id] . "_" . $data["id"] . "_{$rand}() {\n";
                     $params = array('type' => static::getType(), 'parenttype' => static::$itemtype, static::$items_id => $data[static::$items_id], 'id' => $data["id"]);
                     Ajax::updateItemJsCode("viewcost" . $ID . "_{$rand}", $CFG_GLPI["root_doc"] . "/ajax/viewsubitem.php", $params);
                     echo "};";
                     echo "</script>\n";
                 }
                 echo "</td>";
                 echo "<td>" . Html::convDate($data['begin_date']) . "</td>";
                 echo "<td>" . Html::convDate($data['end_date']) . "</td>";
                 echo "<td>" . Dropdown::getDropdownName('glpi_budgets', $data['budgets_id']) . "</td>";
                 echo "<td>" . CommonITILObject::getActionTime($data['actiontime']) . "</td>";
                 $total_time += $data['actiontime'];
                 echo "<td class='numeric'>" . Html::formatNumber($data['cost_time']) . "</td>";
//.........这里部分代码省略.........
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:101,代码来源:commonitilcost.class.php

示例11: showSummary

 function showSummary($container)
 {
     global $DB, $CFG_GLPI;
     $cID = $container->fields['id'];
     // Display existing Fields
     $tmp = array('plugin_fields_containers_id' => $cID);
     $canadd = $this->can(-1, CREATE, $tmp);
     $query = "SELECT `id`, `label`\n                FROM `" . $this->getTable() . "`\n                WHERE `plugin_fields_containers_id` = '{$cID}'\n                ORDER BY `ranking` ASC";
     $result = $DB->query($query);
     $rand = mt_rand();
     echo "<div id='viewField" . $cID . "{$rand}'></div>\n";
     echo "<script type='text/javascript' >\n";
     echo "function viewAddField" . $cID . "{$rand}() {\n";
     $params = array('type' => __CLASS__, 'parenttype' => 'PluginFieldsContainer', 'plugin_fields_containers_id' => $cID, 'id' => -1);
     Ajax::updateItemJsCode("viewField" . $cID . "{$rand}", $CFG_GLPI["root_doc"] . "/ajax/viewsubitem.php", $params);
     echo "};";
     echo "</script>\n";
     echo "<div class='center'>" . "<a href='javascript:viewAddField" . $container->fields['id'] . "{$rand}();'>";
     echo __("Add a new field", "fields") . "</a></div><br>\n";
     if ($DB->numrows($result) == 0) {
         echo "<table class='tab_cadre_fixe'><tr class='tab_bg_2'>";
         echo "<th class='b'>" . __("No field for this bloc", "fields") . "</th></tr></table>";
     } else {
         echo '<div id="drag">';
         echo '<input type="hidden" name="_plugin_fields_containers_id"
               id="plugin_fields_containers_id" value="' . $cID . '" />';
         echo "<table class='tab_cadre_fixehov'>";
         echo "<tr>";
         echo "<th>" . __("Label") . "</th>";
         echo "<th>" . __("Type") . "</th>";
         echo "<th>" . __("Default values") . "</th>";
         echo "<th>" . __("Mandatory field") . "</th>";
         echo "<th>" . __("Active") . "</th>";
         echo "<th>" . __("Read only", "fields") . "</th>";
         echo "<th width='16'>&nbsp;</th>";
         echo "</tr>\n";
         $fields_type = self::getTypes();
         while ($data = $DB->fetch_array($result)) {
             if ($this->getFromDB($data['id'])) {
                 echo "<tr class='tab_bg_2' style='cursor:pointer' onClick=\"viewEditField{$cID}" . $this->fields['id'] . "{$rand}();\">";
                 echo "<td>";
                 echo "\n<script type='text/javascript' >\n";
                 echo "function viewEditField" . $cID . $this->fields["id"] . "{$rand}() {\n";
                 $params = array('type' => __CLASS__, 'parenttype' => 'PluginFieldsContainer', 'plugin_fields_containers_id' => $cID, 'id' => $this->fields["id"]);
                 Ajax::updateItemJsCode("viewField" . $cID . "{$rand}", $CFG_GLPI["root_doc"] . "/ajax/viewsubitem.php", $params);
                 echo "};";
                 echo "</script>\n";
                 echo $this->fields['label'] . "</td>";
                 echo "<td>" . $fields_type[$this->fields['type']] . "</td>";
                 echo "<td>" . $this->fields['default_value'] . "</td>";
                 echo "<td align='center'>" . Dropdown::getYesNo($this->fields["mandatory"]) . "</td>";
                 echo "<td align='center'>";
                 echo $this->fields['is_active'] == 1 ? __('Yes') : '<b class="red">' . __('No') . '</b>';
                 echo "</td>";
                 echo "<td>";
                 echo Dropdown::getYesNo($this->fields["is_readonly"]);
                 echo "</td>";
                 echo '<td class="rowhandler control center">';
                 echo '<div class="drag row" style="cursor:move;border:none !important;">';
                 echo '<img src="../pics/drag.png" alt="#" title="Déplacer" width="16" height="16" />';
                 echo '</div>';
                 echo '</td>';
                 echo "</tr>\n";
             }
         }
     }
     echo '</table>';
     echo '</div>';
     echo Html::scriptBlock('redipsInit()');
 }
开发者ID:publik1974,项目名称:fields,代码行数:70,代码来源:field.class.php

示例12: showFormDetail

 public function showFormDetail($plugin_order_orders_id)
 {
     global $CFG_GLPI, $DB;
     $order = new PluginOrderOrder();
     $reference = new PluginOrderReference();
     $reception = new PluginOrderReception();
     $result_ref = $this->queryDetail($plugin_order_orders_id);
     $numref = $DB->numrows($result_ref);
     $rand = mt_rand();
     $canedit = $order->can($plugin_order_orders_id, UPDATE) && $order->canUpdateOrder();
     Session::initNavigateListItems($this->getType(), __("Order", "order") . " = " . $order->getName());
     while ($data_ref = $DB->fetch_array($result_ref)) {
         $global_rand = mt_rand();
         echo "<div class='center'>";
         echo "<form method='post' name='order_updatedetail_form{$rand}' " . "id='order_updatedetail_form{$rand}'  " . "action='" . Toolbox::getItemTypeFormURL('PluginOrderOrder') . "'>";
         echo "<input type='hidden' name='plugin_order_orders_id'\n                  value='" . $plugin_order_orders_id . "'>";
         echo "<input type='hidden' name='plugin_order_order_items_id'\n                  value='" . $data_ref['IDD'] . "'>";
         echo "<table class='tab_cadre_fixe'>";
         if (!$numref) {
             echo "<tr><th>" . __("No item to take delivery of", "order") . "</th></tr></table></div>";
         } else {
             $refID = $data_ref["id"];
             $price_taxfree = $data_ref["price_taxfree"];
             $discount = $data_ref["discount"];
             $rand = mt_rand();
             echo "<tr><th><ul><li>";
             echo "<a href=\"javascript:showHideDiv('detail{$rand}','detail_img{$rand}', '" . $CFG_GLPI['root_doc'] . "/pics/plus.png','" . $CFG_GLPI['root_doc'] . "/pics/moins.png');\">";
             echo "<img alt='' name='detail_img{$rand}' src=\"" . $CFG_GLPI['root_doc'] . "/pics/plus.png\">";
             echo "</a>";
             echo "</li></ul></th>";
             echo "<th>" . __("Quantity", "order") . "</th>";
             echo "<th>" . __("Equipment", "order") . "</th>";
             echo "<th>" . __("Manufacturer") . "</th>";
             echo "<th>" . __("Reference") . "</th>";
             echo "<th>" . __("Type") . "</th>";
             echo "<th>" . __("Model") . "</th>";
             echo "<th>" . __("Unit price tax free", "order") . "</th>";
             echo "<th>" . __("Discount (%)", "order") . "</th>";
             echo "</tr>";
             echo "<tr class='tab_bg_1 center'>";
             echo "<td><div id='viewaccept{$rand}' style='display:none;'>";
             echo "<p><input type='submit' onclick=\"return confirm('" . __("Do you really want to update this item ?", "order") . "');\" name='update_item' value=\"" . _sx("button", "Update") . "\" class='submit'></p>";
             echo "<br /><p><input type='button' onclick=\"hideForm{$rand}();\" value=\"" . _sx("button", "Cancel") . "\" class='submit'></p>";
             echo "</div></td>";
             if ($canedit) {
                 echo "<script type='text/javascript' >\n";
                 echo "function hideForm{$rand}() {\n";
                 echo "\$('#quantity{$rand}').show();";
                 echo "\$('#pricetaxfree{$rand}').show();";
                 echo "\$('#discount{$rand}').show();";
                 echo "\$('#viewquantity{$rand} input').remove();";
                 echo "\$('#viewpricetaxfree{$rand} input').remove();";
                 echo "\$('#viewdiscount{$rand} input').remove();";
                 echo "\$('#viewaccept{$rand}').hide();";
                 echo "}\n";
                 echo "</script>\n";
             }
             /* quantity */
             $quantity = $this->getTotalQuantityByRefAndDiscount($plugin_order_orders_id, $refID, $price_taxfree, $discount);
             if ($canedit) {
                 echo "<td align='center'>";
                 echo "<script type='text/javascript' >\n";
                 echo "function showQuantity{$rand}() {\n";
                 echo "\$('#quantity{$rand}').hide();";
                 echo "\$('#viewaccept{$rand}').show();";
                 $params = array('maxlength' => 15, 'size' => 8, 'name' => 'quantity', 'class' => 'quantity', 'force_integer' => true, 'data' => rawurlencode($quantity));
                 Ajax::updateItemJsCode("viewquantity{$rand}", $CFG_GLPI["root_doc"] . "/plugins/order/ajax/inputnumber.php", $params, false);
                 echo "}";
                 echo "</script>\n";
                 echo "<div id='quantity{$rand}' class='center' onClick='showQuantity{$rand}()'>\n";
                 echo $quantity;
                 echo "</div>\n";
                 echo "<div id='viewquantity{$rand}'>\n";
                 echo "</div>\n";
                 echo "</td>";
             } else {
                 echo "<td align='center'>" . $quantity . "</td>";
             }
             /* type */
             $item = new $data_ref["itemtype"]();
             echo "<td align='center'>" . $item->getTypeName() . "</td>";
             /* manufacturer */
             echo "<td align='center'>" . Dropdown::getDropdownName("glpi_manufacturers", $data_ref["manufacturers_id"]) . "</td>";
             /* reference */
             echo "<td align='center'>";
             echo "<input type='hidden' name='old_plugin_order_references_id'\n                     value='" . $refID . "'>";
             echo $reference->getReceptionReferenceLink($data_ref);
             echo "</td>";
             /* type */
             echo "<td align='center'>";
             if (file_exists(GLPI_ROOT . "/inc/" . strtolower($data_ref["itemtype"]) . "type.class.php")) {
                 echo Dropdown::getDropdownName(getTableForItemType($data_ref["itemtype"] . "Type"), $data_ref["types_id"]);
             }
             echo "</td>";
             /* modele */
             echo "<td align='center'>";
             if (file_exists(GLPI_ROOT . "/inc/" . strtolower($data_ref["itemtype"]) . "model.class.php")) {
                 echo Dropdown::getDropdownName(getTableForItemType($data_ref["itemtype"] . "Model"), $data_ref["models_id"]);
             }
             echo "</td>";
//.........这里部分代码省略.........
开发者ID:equinoxefr,项目名称:order,代码行数:101,代码来源:order_item.class.php

示例13: showAdvanceDateRestrictionSwitch

 /**
  * Toggle view in LDAP user import/synchro between no restriction and date restriction
  *
  * @param $enabled (default 0)
  **/
 static function showAdvanceDateRestrictionSwitch($enabled = 0)
 {
     global $CFG_GLPI;
     $rand = mt_rand();
     $url = $CFG_GLPI["root_doc"] . "/ajax/ldapdaterestriction.php";
     echo "<script type='text/javascript' >\n";
     echo "function activateRestriction() {\n";
     $params = array('enabled' => 1);
     Ajax::updateItemJsCode('date_restriction', $url, $params);
     echo "};";
     echo "function deactivateRestriction() {\n";
     $params = array('enabled' => 0);
     Ajax::updateItemJsCode('date_restriction', $url, $params);
     echo "};";
     echo "</script>";
     echo "</table>";
     echo "<span id='date_restriction'>";
     $_POST['enabled'] = $enabled;
     include GLPI_ROOT . "/ajax/ldapdaterestriction.php";
     echo "</span>\n";
     return $rand;
 }
开发者ID:glpi-project,项目名称:glpi,代码行数:27,代码来源:dropdown.class.php

示例14: dropdownAllDevices

 /**
  * Make a select box for Tracking All Devices
  *
  * @param $myname             select name
  * @param $itemtype           preselected value.for item type
  * @param $items_id           preselected value for item ID (default 0)
  * @param $admin              is an admin access ? (default 0)
  * @param $users_id           user ID used to display my devices (default 0
  * @param $entity_restrict    Restrict to a defined entity (default -1)
  * @param $options   array of possible options:
  *    - tickets_id : ID of the ticket
  *    - used       : ID of the requester user
  *    - multiple   : allow multiple choice
  *    - rand       : random number
  *
  * @return nothing (print out an HTML select box)
  **/
 static function dropdownAllDevices($myname, $itemtype, $items_id = 0, $admin = 0, $users_id = 0, $entity_restrict = -1, $options = array())
 {
     global $CFG_GLPI, $DB;
     $params = array('tickets_id' => 0, 'used' => array(), 'multiple' => 0, 'rand' => mt_rand());
     foreach ($options as $key => $val) {
         $params[$key] = $val;
     }
     $rand = $params['rand'];
     if ($_SESSION["glpiactiveprofile"]["helpdesk_hardware"] == 0) {
         echo "<input type='hidden' name='{$myname}' value=''>";
         echo "<input type='hidden' name='items_id' value='0'>";
     } else {
         echo "<div id='tracking_all_devices{$rand}'>";
         if ($_SESSION["glpiactiveprofile"]["helpdesk_hardware"] & pow(2, Ticket::HELPDESK_ALL_HARDWARE)) {
             // Display a message if view my hardware
             if ($users_id && $_SESSION["glpiactiveprofile"]["helpdesk_hardware"] & pow(2, Ticket::HELPDESK_MY_HARDWARE)) {
                 echo __('Or complete search') . "&nbsp;";
             }
             $types = Ticket::getAllTypesForHelpdesk();
             $emptylabel = __('General');
             if ($params['tickets_id'] > 0) {
                 $emptylabel = Dropdown::EMPTY_VALUE;
             }
             Dropdown::showItemTypes($myname, array_keys($types), array('emptylabel' => $emptylabel, 'value' => $itemtype, 'rand' => $rand, 'display_emptychoice' => true));
             $found_type = isset($types[$itemtype]);
             $p = array('itemtype' => '__VALUE__', 'entity_restrict' => $entity_restrict, 'admin' => $admin, 'used' => $params['used'], 'multiple' => $params['multiple'], 'rand' => $rand, 'myname' => "add_items_id");
             Ajax::updateItemOnSelectEvent("dropdown_{$myname}{$rand}", "results_{$myname}{$rand}", $CFG_GLPI["root_doc"] . "/ajax/dropdownTrackingDeviceType.php", $p);
             echo "<span id='results_{$myname}{$rand}'>\n";
             // Display default value if itemtype is displayed
             if ($found_type && $itemtype) {
                 if (($item = getItemForItemtype($itemtype)) && $items_id) {
                     if ($item->getFromDB($items_id)) {
                         Dropdown::showFromArray('items_id', array($items_id => $item->getName()), array('value' => $items_id));
                     }
                 } else {
                     $p['itemtype'] = $itemtype;
                     echo "<script type='text/javascript' >\n";
                     Ajax::updateItemJsCode("results_{$myname}{$rand}", $CFG_GLPI["root_doc"] . "/ajax/dropdownTrackingDeviceType.php", $p);
                     echo '</script>';
                 }
             }
             echo "</span>\n";
         }
         echo "</div>";
     }
     return $rand;
 }
开发者ID:korial29,项目名称:glpi,代码行数:64,代码来源:item_ticket.class.php

示例15: showForm

 /**
  * Print the reminder form
  *
  * @param $ID        integer  Id of the item to print
  * @param $options   array of possible options:
  *     - target filename : where to go when done.
  *     - from_planning_ajax : set to disable planning form part
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI;
     $this->initForm($ID, $options);
     $rand = mt_rand();
     // Show Reminder or blank form
     $onfocus = "";
     if (!$ID > 0) {
         // Create item : do getempty before check right to set default values
         $onfocus = "onfocus=\"if (this.value=='" . $this->fields['name'] . "') this.value='';\"";
     }
     $canedit = $this->can($ID, UPDATE);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_2'><td>" . __('Title') . "</td>";
     echo "<td>";
     if (!$ID) {
         echo "<input type='hidden' name='users_id' value='" . $this->fields['users_id'] . "'>\n";
     }
     if ($canedit) {
         Html::autocompletionTextField($this, "name", array('size' => '80', 'entity' => -1, 'user' => $this->fields["users_id"], 'option' => $onfocus));
     } else {
         echo $this->fields['name'];
     }
     if (isset($options['from_planning_edit_ajax']) && $options['from_planning_edit_ajax']) {
         echo Html::hidden('from_planning_edit_ajax');
     }
     echo "</td>";
     echo "</tr>";
     if (!isset($options['from_planning_ajax'])) {
         echo "<tr class='tab_bg_2'>";
         echo "<td>" . __('Visibility') . "</td>";
         echo "<td>";
         echo '<table><tr><td>';
         echo __('Begin') . '</td><td>';
         Html::showDateTimeField("begin_view_date", array('value' => $this->fields["begin_view_date"], 'timestep' => 1, 'maybeempty' => true, 'canedit' => $canedit));
         echo '</td><td>' . __('End') . '</td><td>';
         Html::showDateTimeField("end_view_date", array('value' => $this->fields["end_view_date"], 'timestep' => 1, 'maybeempty' => true, 'canedit' => $canedit));
         echo '</td></tr></table>';
         echo "</td>";
         echo "</tr>";
     }
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . __('Status') . "</td>";
     echo "<td>";
     if ($canedit) {
         Planning::dropdownState("state", $this->fields["state"]);
     } else {
         echo Planning::getState($this->fields["state"]);
     }
     echo "</td>\n";
     echo "</tr>\n";
     echo "<tr class='tab_bg_2'><td >" . __('Calendar') . "</td>";
     echo "<td>";
     if (isset($options['from_planning_ajax']) && $options['from_planning_ajax']) {
         echo Html::hidden('plan[begin]', array('value' => $options['begin']));
         echo Html::hidden('plan[end]', array('value' => $options['end']));
         printf(__('From %1$s to %2$s'), Html::convDateTime($options["begin"]), Html::convDateTime($options["end"]));
         echo "</td>";
     } else {
         if ($canedit) {
             echo "<script type='text/javascript' >\n";
             echo "function showPlan{$rand}() {\n";
             echo Html::jsHide("plan{$rand}");
             $params = array('action' => 'add_event_classic_form', 'form' => 'remind', 'users_id' => $this->fields["users_id"], 'itemtype' => $this->getType(), 'items_id' => $this->getID());
             if ($ID && $this->fields["is_planned"]) {
                 $params['begin'] = $this->fields["begin"];
                 $params['end'] = $this->fields["end"];
             }
             Ajax::updateItemJsCode("viewplan{$rand}", $CFG_GLPI["root_doc"] . "/ajax/planning.php", $params);
             echo "}";
             echo "</script>\n";
         }
         if (!$ID || !$this->fields["is_planned"]) {
             if (Session::haveRightsOr("planning", array(Planning::READMY, Planning::READGROUP, Planning::READALL))) {
                 echo "<div id='plan{$rand}' onClick='showPlan{$rand}()'>\n";
                 echo "<a href='#' class='vsubmit'>" . __('Add to schedule') . "</a>";
             }
         } else {
             if ($canedit) {
                 echo "<div id='plan{$rand}' onClick='showPlan{$rand}()'>\n";
                 echo "<span class='showplan'>";
             }
             //TRANS: %1$s is the begin date, %2$s is the end date
             printf(__('From %1$s to %2$s'), Html::convDateTime($this->fields["begin"]), Html::convDateTime($this->fields["end"]));
             if ($canedit) {
                 echo "</span>";
             }
         }
         if ($canedit) {
             echo "</div>\n";
             echo "<div id='viewplan{$rand}'>\n</div>\n";
         }
//.........这里部分代码省略.........
开发者ID:stweil,项目名称:glpi,代码行数:101,代码来源:reminder.class.php


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