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


PHP Html::checkAllAsCheckbox方法代码示例

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


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

示例1: displayList

 function displayList($tasks_id)
 {
     global $CFG_GLPI;
     $rand = mt_rand();
     echo "<script type=\"text/javascript\">\nfunction edit_subtype(id,el) {\n\n   //remove all border to previous selected item (remove classes)\n//   Ext.select('#table_taskjob_'+ _rand +' tr').removeClass('selected');\n\n\n   var row = null;\n   if (el) {\n      // get parent row of the selected element\n      row = jQuery(el).parents('tr:first')\n   }\n\n   if (row) {\n      //add border to selected index (add class)\n      row.addClass('selected');\n//      params['index'] = row.index();\n      // change mode to edit\n//      params['mode'] = 'edit';\n      arg = 'taskjobs_id=' + id;\n   } else {\n      arg = 'tasks_id=' + id;\n   }\n\n   //scroll to edit form\n//   document.getElementById('th_title_taskjob_' + _rand).scrollIntoView();\n\n   //show and load form\n//   \$('taskjobs_block' + _rand).setDisplayed('block');\n   \$('#taskjobs_block').load('../ajax/taskjob_form.php?' + arg);\n}\n\n/*\n * Create a new subtype element.\n * This method just override *edit_subtype* with a null element.\n */\nfunction new_subtype(id) {\n   edit_subtype(id, null);\n}\n</script>";
     echo "<table class='tab_cadre_fixe' id='package_order_" . $tasks_id . "'>";
     echo "<tr>";
     echo "<th id='th_title_taskjob_{$rand}'>";
     //echo "<img src='".$CFG_GLPI["root_doc"]."/plugins/fusioninventory/pics/$subtype.png' />";
     echo "&nbsp;" . $this->getTypeName();
     echo "&nbsp;";
     echo "<img id='plus_taskjobs_block{$rand}'";
     echo " onclick=\"new_subtype({$tasks_id})\" ";
     echo " title='" . __('Add') . "' alt='" . __('Add') . "' ";
     echo " class='pointer' src='" . $CFG_GLPI["root_doc"] . "/pics/add_dropdown.png' /> ";
     echo "</th>";
     echo "</tr>";
     echo "<tr>";
     echo "<td style='vertical-align:top'>";
     /**
      * Display subtype form
      **/
     echo "<form name='additiontaskjob' method='post' " . " action='taskjob.form.php'>";
     echo "<input type='hidden' name='orders_id' value='{$tasks_id}' />";
     echo "<input type='hidden' name='itemtype' value='PluginFusioninventoryDeploy" . ucfirst('taskjob') . "' />";
     echo "<div id='taskjobs_block'></div>";
     Html::closeForm();
     $a_taskjobs = getAllDatasFromTable($this->getTable(), "`plugin_fusioninventory_tasks_id`='" . $tasks_id . "'", FALSE, '`ranking`');
     echo "<div id='drag_taskjob_taskjobs'>";
     echo "<table class='tab_cadrehov package_item_list' id='table_taskjob_{$rand}' style='width: 950px'>";
     $i = 0;
     foreach ($a_taskjobs as $data) {
         echo Search::showNewLine(Search::HTML_OUTPUT, $i % 2);
         echo "<td class='control'>";
         Html::showCheckbox(array('name' => 'taskjob_entries[]', 'value' => $i));
         echo "</td>";
         echo "<td>";
         echo "<a class='edit' " . "onclick=\"edit_subtype({$data['id']}, this)\">";
         echo $data['name'];
         echo "</a><br />";
         echo "<b>";
         echo __('Definition', 'fusioninventory');
         echo "</b>";
         echo "<ul class='retChecks'>";
         $a_definitions = importArrayFromDB($data['definition']);
         foreach ($a_definitions as $a_definition) {
             foreach ($a_definition as $itemtype => $items_id) {
                 echo "<li>";
                 $item = new $itemtype();
                 $item->getFromDB($items_id);
                 echo $item->getTypeName() . " > ";
                 echo $item->getLink();
                 echo "</li>";
             }
         }
         echo "</ul>";
         echo "<b>";
         echo __('Action', 'fusioninventory');
         echo "</b>";
         echo "<ul class='retChecks'>";
         $a_actions = importArrayFromDB($data['action']);
         foreach ($a_actions as $a_action) {
             foreach ($a_action as $itemtype => $items_id) {
                 echo "<li>";
                 $item = new $itemtype();
                 $item->getFromDB($items_id);
                 echo $item->getTypeName() . " > ";
                 echo $item->getLink();
                 echo "</li>";
             }
         }
         echo "</ul>";
         echo "</td>";
         echo "</td>";
         echo "<td class='rowhandler control' title='" . __('drag', 'fusioninventory') . "'><div class='drag row'></div></td>";
         echo "</tr>";
         $i++;
     }
     echo "<tr><th>";
     Html::checkAllAsCheckbox("taskjobsList{$rand}", mt_rand());
     echo "</th><th colspan='3' class='mark'></th></tr>";
     echo "</table>";
     echo "</div>";
     echo "&nbsp;&nbsp;<img src='" . $CFG_GLPI["root_doc"] . "/pics/arrow-left.png' alt=''>";
     echo "<input type='submit' name='delete' value=\"" . __('Delete', 'fusioninventory') . "\" class='submit'>";
     /**
      * Initialize drag and drop on subtype lists
      **/
     echo "<script type=\"text/javascript\">\n      redipsInit('taskjob', 'taskjob', {$tasks_id});\n</script>";
     echo "</table>";
 }
开发者ID:korial29,项目名称:fusioninventory-for-glpi,代码行数:91,代码来源:taskjob.class.php

示例2: showForCartridgeItem

 /**
  * Show the printer types that are compatible with a cartridge type
  *
  * @param $item   CartridgeItem object
  *
  * @return nothing (display)
  **/
 static function showForCartridgeItem(CartridgeItem $item)
 {
     global $DB, $CFG_GLPI;
     $instID = $item->getField('id');
     if (!$item->can($instID, 'r')) {
         return false;
     }
     $canedit = $item->can($instID, 'w');
     $rand = mt_rand();
     $query = "SELECT `" . static::getTable() . "`.`id`,\n                       `glpi_printermodels`.`name` AS `type`,\n                       `glpi_printermodels`.`id` AS `pmid`\n                FROM `" . static::getTable() . "`,\n                     `glpi_printermodels`\n                WHERE `" . static::getTable() . "`.`printermodels_id` = `glpi_printermodels`.`id`\n                      AND `" . static::getTable() . "`.`cartridgeitems_id` = '{$instID}'\n                ORDER BY `glpi_printermodels`.`name`";
     $result = $DB->query($query);
     $i = 0;
     function getForbiddenStandardMassiveAction()
     {
         $forbidden = parent::getForbiddenStandardMassiveAction();
         $forbidden[] = 'update';
         return $forbidden;
     }
     $used = array();
     $datas = array();
     if ($number = $DB->numrows($result)) {
         while ($data = $DB->fetch_assoc($result)) {
             $used[$data["pmid"]] = $data["pmid"];
             $datas[$data["id"]] = $data;
         }
     }
     if ($canedit) {
         echo "<div class='firstbloc'>";
         echo "<form name='printermodel_form{$rand}' id='printermodel_form{$rand}' method='post'";
         echo " action='" . static::getFormURL() . "'>";
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr class='tab_bg_1'>";
         echo "<th colspan='6'>" . __('Add a compatible printer model') . "</th></tr>";
         echo "<tr><td class='tab_bg_2 center'>";
         echo "<input type='hidden' name='cartridgeitems_id' value='{$instID}'>";
         PrinterModel::dropdown(array('used' => $used));
         echo "</td><td class='tab_bg_2 center'>";
         echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
         echo "</td></tr>";
         echo "</table>";
         Html::closeForm();
         echo "</div>";
     }
     if ($number) {
         echo "<div class='spaced'>";
         if ($canedit) {
             $rand = mt_rand();
             Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
             $paramsma = array('num_displayed' => count($used));
             Html::showMassiveActions(__CLASS__, $paramsma);
         }
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr>";
         if ($canedit) {
             echo "<th width='10'>";
             Html::checkAllAsCheckbox('mass' . __CLASS__ . $rand);
             echo "</th>";
         }
         echo "<th>" . __('Model') . "</th></tr>";
         foreach ($datas as $data) {
             echo "<tr class='tab_bg_1'>";
             if ($canedit) {
                 echo "<td width='10'>";
                 Html::showMassiveActionCheckBox(__CLASS__, $data["id"]);
                 echo "</td>";
             }
             echo "<td class='center'>" . $data['type'] . "</td>";
             echo "</tr>";
         }
         echo "</table>";
         if ($canedit) {
             $paramsma['ontop'] = false;
             Html::showMassiveActions(__CLASS__, $paramsma);
             Html::closeForm();
         }
         echo "</div>";
     } else {
         echo "<p class='center b'>" . __('No item found') . "</p>";
     }
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:87,代码来源:cartridgeitem_printermodel.class.php

示例3: displayList

 static function displayList(PluginFusioninventoryDeployOrder $order, $datas, $rand)
 {
     global $CFG_GLPI;
     $pfDeployPackage = new PluginFusioninventoryDeployPackage();
     $pfDeployPackage->getFromDB($order->fields['plugin_fusioninventory_deploypackages_id']);
     $checks_types = self::getTypes();
     echo "<table class='tab_cadrehov package_item_list' id='table_check_{$rand}'>";
     $i = 0;
     foreach ($datas['jobs']['checks'] as $check) {
         //specific case for filesystem size
         if (is_numeric($check['value'])) {
             if ($check['type'] == "freespaceGreater") {
                 $check['value'] = $check['value'] * 1024 * 1024;
             }
             $check['value'] = PluginFusioninventoryDeployFile::processFilesize($check['value']);
         }
         echo Search::showNewLine(Search::HTML_OUTPUT, $i % 2);
         if ($pfDeployPackage->can($pfDeployPackage->getID(), UPDATE)) {
             echo "<td class='control'>";
             echo "<input type='checkbox' name='check_entries[]' value='{$i}' />";
             echo "</td>";
         }
         echo "<td>";
         echo "<a class='edit'" . "onclick=\"edit_subtype('check', {$order->fields['id']}, {$rand} ,this)\">" . $checks_types[$check['type']] . "</a><br />";
         echo $check['path'];
         if (!empty($check['value'])) {
             echo "&nbsp;&nbsp;&nbsp;<b>";
             if (strpos($check['type'], "Greater") !== FALSE) {
                 echo "&gt;";
             } else {
                 if (strpos($check['type'], "Lower") !== FALSE) {
                     echo "&lt;";
                 } else {
                     echo "=";
                 }
             }
             echo "</b>&nbsp;&nbsp;&nbsp;";
             echo $check['value'];
         }
         echo "</td>";
         if ($pfDeployPackage->can($pfDeployPackage->getID(), UPDATE)) {
             echo "<td class='rowhandler control' title='" . __('drag', 'fusioninventory') . "'><div class='drag row'></div></td>";
         }
         echo "</tr>";
         $i++;
     }
     if ($pfDeployPackage->can($pfDeployPackage->getID(), UPDATE)) {
         echo "<tr><th>";
         Html::checkAllAsCheckbox("checksList{$rand}", mt_rand());
         echo "</th><th colspan='3' class='mark'></th></tr>";
     }
     echo "</table>";
     if ($pfDeployPackage->can($pfDeployPackage->getID(), UPDATE)) {
         echo "&nbsp;&nbsp;<img src='" . $CFG_GLPI["root_doc"] . "/pics/arrow-left.png' alt='' />";
         echo "<input type='submit' name='delete' value=\"" . __('Delete', 'fusioninventory') . "\" class='submit' />";
     }
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:57,代码来源:deploycheck.class.php

示例4: displayCategoryHeader

 /**
  * Display category header for Computer_SoftwareVersion::showForComputer function
  *
  * @param $computers_ID             ID of the computer
  * @param $data                     data used to display
  * @param $rand                     random for unicity
  * @param $canedit         boolean
  *
  * @return new category ID
  **/
 private static function displayCategoryHeader($computers_ID, $data, $rand, $canedit)
 {
     global $CFG_GLPI;
     $display = "none";
     if (isset($data["softwarecategories_id"])) {
         $cat = $data["softwarecategories_id"];
         if ($cat) {
             // Categorized
             $catname = Dropdown::getDropdownName('glpi_softwarecategories', $cat);
             $display = $_SESSION["glpiis_categorized_soft_expanded"];
         } else {
             // Not categorized
             $catname = __('Uncategorized software');
             $display = $_SESSION["glpiis_not_categorized_soft_expanded"];
         }
     } else {
         // Not installed
         $cat = '';
         $catname = __('Affected licenses of not installed software');
         $display = true;
     }
     echo "<tr class='tab_bg_2'><td class='center' colspan='5'>";
     echo "<a href=\"javascript:showHideDiv('softcat{$cat}{$rand}','imgcat{$cat}','" . $CFG_GLPI['root_doc'] . "/pics/folder.png','" . $CFG_GLPI['root_doc'] . "/pics/folder-open.png');\">";
     echo "<img alt='' name='imgcat{$cat}' src='" . $CFG_GLPI['root_doc'] . "/pics/folder" . (!$display ? '' : "-open") . ".png'>&nbsp;<span class='b'>" . $catname . "</span>";
     echo "</a></td></tr>";
     echo "<tr class='tab_bg_2'><td colspan='5'>";
     echo "<div class='center' id='softcat{$cat}{$rand}' " . (!$display ? "style=\"display:none;\"" : '') . ">";
     echo "<table class='tab_cadre_fixe'><tr>";
     if ($canedit) {
         echo "<th width='10'>";
         Html::checkAllAsCheckbox("softcat{$cat}{$rand}");
         echo "</th>";
     }
     echo "<th>" . __('Name') . "</th><th>" . __('Status') . "</th>";
     echo "<th>" . __('Version') . "</th><th>" . __('License') . "</th>";
     if (isset($data['is_dynamic'])) {
         echo "<th>" . __('Automatic inventory') . "</th>";
     }
     echo "</tr>\n";
     return $cat;
 }
开发者ID:gaforeror,项目名称:glpi,代码行数:51,代码来源:computer_softwareversion.class.php

示例5: showAndAddRuleForm

 /**
  * @param $item
  **/
 function showAndAddRuleForm($item)
 {
     $rand = mt_rand();
     $canedit = Session::haveRight(static::$right, "w");
     if ($canedit && $item->getType() == 'Entity') {
         $this->showNewRuleForm($item->getField('id'));
     }
     //Get all rules and actions
     $crit = array('field' => getForeignKeyFieldForTable($item->getTable()), 'value' => $item->getField('id'));
     $rules = $this->getRulesForCriteria($crit);
     $nb = count($rules);
     echo "<div class='spaced'>";
     if (!$nb) {
         echo "<table class='tab_cadre_fixehov'>";
         echo "<tr><th>" . __('No item found') . "</th>";
         echo "</tr>\n";
         echo "</table>\n";
     } else {
         if ($canedit) {
             Html::openMassiveActionsForm('mass' . get_called_class() . $rand);
             $paramsma = array('num_displayed' => $nb, 'specific_actions' => array('update' => _x('button', 'Update'), 'purge' => _x('button', 'Delete permanently')));
             Html::showMassiveActions(get_called_class(), $paramsma);
         }
         echo "<table class='tab_cadre_fixehov'><tr>";
         if ($canedit) {
             echo "<th width='10'>";
             Html::checkAllAsCheckbox('mass' . get_called_class() . $rand);
             echo "</th>";
         }
         echo "<th>" . $this->getTitle() . "</th>";
         echo "<th>" . __('Description') . "</th>";
         echo "<th>" . __('Active') . "</th>";
         echo "</tr>\n";
         Session::initNavigateListItems(get_class($this), sprintf(__('%1$s = %2$s'), $item->getTypeName(1), $item->getName()));
         foreach ($rules as $rule) {
             Session::addToNavigateListItems(get_class($this), $rule->fields["id"]);
             echo "<tr class='tab_bg_1'>";
             if ($canedit) {
                 echo "<td width='10'>";
                 Html::showMassiveActionCheckBox(__CLASS__, $rule->fields["id"]);
                 echo "</td>";
                 echo "<td><a href='" . Toolbox::getItemTypeFormURL(get_class($this)) . "?id=" . $rule->fields["id"] . "&amp;onglet=1'>" . $rule->fields["name"] . "</a></td>";
             } else {
                 echo "<td>" . $rule->fields["name"] . "</td>";
             }
             echo "<td>" . $rule->fields["description"] . "</td>";
             echo "<td>" . Dropdown::getYesNo($rule->fields["is_active"]) . "</td>";
             echo "</tr>\n";
         }
         echo "</table>\n";
         if ($canedit) {
             $paramsma['ontop'] = false;
             Html::showMassiveActions(get_called_class(), $paramsma);
             Html::closeForm();
         }
     }
     echo "</div>";
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:61,代码来源:rule.class.php

示例6: showForUser

 /**
  * show defined display preferences for a user
  *
  * @param $users_id integer user ID
  **/
 static function showForUser($users_id)
 {
     global $DB;
     $url = Toolbox::getItemTypeFormURL(__CLASS__);
     $query = "SELECT `itemtype`,\n                       COUNT(*) AS nb\n                FROM `glpi_displaypreferences`\n                WHERE `users_id` = '{$users_id}'\n                GROUP BY `itemtype`";
     $req = $DB->request($query);
     if ($req->numrows() > 0) {
         $rand = mt_rand();
         echo "<div class='spaced'>";
         Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
         $massiveactionparams = array('width' => 400, 'height' => 200, 'container' => 'mass' . __CLASS__ . $rand, 'specific_actions' => array(__CLASS__ . MassiveAction::CLASS_ACTION_SEPARATOR . 'delete_for_user' => _x('button', 'Delete permanently')), 'extraparams' => array('massive_action_fields' => array('users_id')));
         Html::showMassiveActions($massiveactionparams);
         echo Html::hidden('users_id', array('value' => $users_id, 'data-glpicore-ma-tags' => 'common'));
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr>";
         echo "<th width='10'>";
         Html::checkAllAsCheckbox('mass' . __CLASS__ . $rand);
         echo "</th>";
         echo "<th colspan='2'>" . __('Type') . "</th></tr>";
         foreach ($req as $data) {
             echo "<tr class='tab_bg_1'><td width='10'>";
             Html::showMassiveActionCheckBox(__CLASS__, $data["itemtype"]);
             echo "</td>";
             if ($item = getItemForItemtype($data["itemtype"])) {
                 $name = $item->getTypeName(1);
             } else {
                 $name = $data["itemtype"];
             }
             echo "<td>{$name}</td><td class='numeric'>" . $data['nb'] . "</td>";
             echo "</tr>";
         }
         echo "</table>";
         $massiveactionparams['ontop'] = false;
         Html::showMassiveActions($massiveactionparams);
         Html::closeForm();
         echo "</div>";
     } else {
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr class='tab_bg_2'><td class='b center'>" . __('No item found') . "</td></tr>";
         echo "</table>";
     }
 }
开发者ID:stweil,项目名称:glpi,代码行数:47,代码来源:displaypreference.class.php

示例7: showForProfile

 /**
  * Show the User having a profile, in allowed Entity
  *
  * @param $prof Profile object
  **/
 static function showForProfile(Profile $prof)
 {
     global $DB, $CFG_GLPI;
     $ID = $prof->fields['id'];
     $canedit = Session::haveRightsOr("user", array(CREATE, UPDATE, DELETE, PURGE));
     $rand = mt_rand();
     if (!$prof->can($ID, READ)) {
         return false;
     }
     $query = "SELECT `glpi_users`.*,\n                       `glpi_profiles_users`.`entities_id` AS entity,\n                       `glpi_profiles_users`.`id` AS linkID,\n                       `glpi_profiles_users`.`is_dynamic`,\n                       `glpi_profiles_users`.`is_recursive`\n                FROM `glpi_profiles_users`\n                LEFT JOIN `glpi_entities`\n                     ON (`glpi_entities`.`id`=`glpi_profiles_users`.`entities_id`)\n                LEFT JOIN `glpi_users`\n                     ON (`glpi_users`.`id` = `glpi_profiles_users`.`users_id`)\n                WHERE `glpi_profiles_users`.`profiles_id` = '{$ID}'\n                      AND `glpi_users`.`is_deleted` = '0' " . getEntitiesRestrictRequest("AND", "glpi_profiles_users", 'entities_id', $_SESSION['glpiactiveentities'], true) . "\n                ORDER BY `glpi_entities`.`completename`";
     $result = $DB->query($query);
     $nb = $DB->numrows($result);
     echo "<div class='spaced'>";
     if ($canedit && $nb) {
         Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
         $massiveactionparams = array('num_displayed' => $nb, 'container' => 'mass' . __CLASS__ . $rand);
         Html::showMassiveActions($massiveactionparams);
     }
     echo "<table class='tab_cadre_fixe'><tr>";
     echo "<th>" . sprintf(__('%1$s: %2$s'), __('Profile'), $prof->fields["name"]) . "</th></tr>\n";
     echo "<tr><th colspan='2'>" . sprintf(__('%1$s (%2$s)'), _n('User', 'Users', Session::getPluralNumber()), __('D=Dynamic, R=Recursive')) . "</th></tr>";
     echo "</table>\n";
     echo "<table class='tab_cadre_fixe'>";
     $i = 0;
     $nb_per_line = 3;
     $rand = mt_rand();
     // Just to avoid IDE warning
     $canedit_entity = false;
     if ($nb) {
         $temp = -1;
         while ($data = $DB->fetch_assoc($result)) {
             if ($data["entity"] != $temp) {
                 while ($i % $nb_per_line != 0) {
                     if ($canedit_entity) {
                         echo "<td width='10'>&nbsp;</td>";
                     }
                     echo "<td class='tab_bg_1'>&nbsp;</td>\n";
                     $i++;
                 }
                 if ($i != 0) {
                     echo "</table>";
                     echo "</div>";
                     echo "</td></tr>\n";
                 }
                 // New entity
                 $i = 0;
                 $temp = $data["entity"];
                 $canedit_entity = $canedit && in_array($temp, $_SESSION['glpiactiveentities']);
                 $rand = mt_rand();
                 echo "<tr class='tab_bg_2'>";
                 echo "<td>";
                 echo "<a href=\"javascript:showHideDiv('entity{$temp}{$rand}','imgcat{$temp}', '" . $CFG_GLPI['root_doc'] . "/pics/folder.png','" . $CFG_GLPI['root_doc'] . "/pics/folder-open.png');\">";
                 echo "<img alt='' name='imgcat{$temp}' src=\"" . $CFG_GLPI['root_doc'] . "/pics/folder.png\">&nbsp;";
                 echo "<span class='b'>" . Dropdown::getDropdownName('glpi_entities', $data["entity"]) . "</span>";
                 echo "</a>";
                 echo "</td></tr>\n";
                 echo "<tr class='tab_bg_2'><td>";
                 echo "<div class='center' id='entity{$temp}{$rand}' style='display:none;'>\n";
                 echo Html::checkAllAsCheckbox("entity{$temp}{$rand}") . __('All');
                 echo "<table class='tab_cadre_fixe'>\n";
             }
             if ($i % $nb_per_line == 0) {
                 if ($i != 0) {
                     echo "</tr>\n";
                 }
                 echo "<tr class='tab_bg_1'>\n";
                 $i = 0;
             }
             if ($canedit_entity) {
                 echo "<td width='10'>";
                 Html::showMassiveActionCheckBox(__CLASS__, $data["linkID"]);
                 echo "</td>";
             }
             $username = formatUserName($data["id"], $data["name"], $data["realname"], $data["firstname"], 1);
             if ($data["is_dynamic"] || $data["is_recursive"]) {
                 $username = sprintf(__('%1$s %2$s'), $username, "<span class='b'>(");
                 if ($data["is_dynamic"]) {
                     $username = sprintf(__('%1$s%2$s'), $username, __('D'));
                 }
                 if ($data["is_dynamic"] && $data["is_recursive"]) {
                     $username = sprintf(__('%1$s%2$s'), $username, ", ");
                 }
                 if ($data["is_recursive"]) {
                     $username = sprintf(__('%1$s%2$s'), $username, __('R'));
                 }
                 $username = sprintf(__('%1$s%2$s'), $username, ")</span>");
             }
             echo "<td class='tab_bg_1'>" . $username . "</td>\n";
             $i++;
         }
         if ($i % $nb_per_line != 0) {
             while ($i % $nb_per_line != 0) {
                 if ($canedit_entity) {
                     echo "<td width='10'>&nbsp;</td>";
                 }
//.........这里部分代码省略.........
开发者ID:Ixertec,项目名称:glpi,代码行数:101,代码来源:profile_user.class.php

示例8: showSummary

 /**
  * @param $template        NotificationTemplate object
  * @param $options   array
  **/
 function showSummary(NotificationTemplate $template, $options = array())
 {
     global $DB, $CFG_GLPI;
     $nID = $template->getField('id');
     $canedit = Config::canUpdate();
     if ($canedit) {
         echo "<div class='center'>" . "<a class='vsubmit' href='" . Toolbox::getItemTypeFormURL('NotificationTemplateTranslation') . "?notificationtemplates_id=" . $nID . "'>" . __('Add a new translation') . "</a></div><br>";
     }
     echo "<div class='center' id='tabsbody'>";
     Session::initNavigateListItems('NotificationTemplateTranslation', sprintf(__('%1$s = %2$s'), NotificationTemplate::getTypeName(1), $template->getName()));
     if ($canedit) {
         $rand = mt_rand();
         Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
         $massiveactionparams = array('container' => 'mass' . __CLASS__ . $rand);
         Html::showMassiveActions($massiveactionparams);
     }
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr class='tab_bg_1'>";
     if ($canedit) {
         echo "<th width='10'>";
         Html::checkAllAsCheckbox('mass' . __CLASS__ . $rand);
         echo "</th>";
     }
     echo "<th>" . __('Language') . "</th></tr>";
     foreach ($DB->request('glpi_notificationtemplatetranslations', array('notificationtemplates_id' => $nID)) as $data) {
         if ($this->getFromDB($data['id'])) {
             Session::addToNavigateListItems('NotificationTemplateTranslation', $data['id']);
             echo "<tr class='tab_bg_1'>";
             if ($canedit) {
                 echo "<td class='center'>";
                 Html::showMassiveActionCheckBox(__CLASS__, $data["id"]);
                 echo "</td>";
             }
             echo "<td class='center'>";
             echo "<a href='" . Toolbox::getItemTypeFormURL('NotificationTemplateTranslation') . "?id=" . $data['id'] . "&amp;notificationtemplates_id=" . $nID . "'>";
             if ($data['language'] != '') {
                 echo $CFG_GLPI['languages'][$data['language']][0];
             } else {
                 _e('Default translation');
             }
             echo "</a></td></tr>";
         }
     }
     echo "</table>";
     if ($canedit) {
         $massiveactionparams['ontop'] = false;
         Html::showMassiveActions($massiveactionparams);
         Html::closeForm();
     }
     echo "</div>";
 }
开发者ID:stweil,项目名称:glpi,代码行数:55,代码来源:notificationtemplatetranslation.class.php

示例9: showForLocation

 /**
  * Print the HTML array of the Netpoint associated to a Location
  *
  * @param $item Location
  *
  * @return Nothing (display)
  **/
 static function showForLocation($item)
 {
     global $DB, $CFG_GLPI;
     $ID = $item->getField('id');
     $netpoint = new self();
     $item->check($ID, READ);
     $canedit = $item->canEdit($ID);
     if (isset($_GET["start"])) {
         $start = intval($_GET["start"]);
     } else {
         $start = 0;
     }
     $number = countElementsInTable('glpi_netpoints', "`locations_id`='{$ID}'");
     if ($canedit) {
         echo "<div class='first-bloc'>";
         // Minimal form for quick input.
         echo "<form action='" . $netpoint->getFormURL() . "' method='post'>";
         echo "<br><table class='tab_cadre_fixe'>";
         echo "<tr class='tab_bg_2 center'>";
         echo "<td class='b'>" . _n('Network outlet', 'Network outlets', 1) . "</td>";
         echo "<td>" . __('Name') . "</td><td>";
         Html::autocompletionTextField($item, "name", array('value' => ''));
         echo "<input type='hidden' name='entities_id' value='" . $_SESSION['glpiactive_entity'] . "'>";
         echo "<input type='hidden' name='locations_id' value='{$ID}'></td>";
         echo "<td><input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
         echo "</td></tr>\n";
         echo "</table>\n";
         Html::closeForm();
         // Minimal form for massive input.
         echo "<form action='" . $netpoint->getFormURL() . "' method='post'>";
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr class='tab_bg_2 center'>";
         echo "<td class='b'>" . _n('Network outlet', 'Network outlets', Session::getPluralNumber()) . "</td>";
         echo "<td>" . __('Name') . "</td><td>";
         echo "<input type='text' maxlength='100' size='10' name='_before'>&nbsp;";
         Dropdown::showNumber('_from', array('value' => 0, 'min' => 0, 'max' => 400));
         echo "&nbsp;-->&nbsp;";
         Dropdown::showNumber('_to', array('value' => 0, 'min' => 0, 'max' => 400));
         echo "&nbsp;<input type='text' maxlength='100' size='10' name='_after'><br>";
         echo "<input type='hidden' name='entities_id' value='" . $_SESSION['glpiactive_entity'] . "'>";
         echo "<input type='hidden' name='locations_id' value='{$ID}'>";
         echo "<input type='hidden' name='_method' value='AddMulti'></td>";
         echo "<td><input type='submit' name='execute' value=\"" . _sx('button', 'Add') . "\"\n                    class='submit'>";
         echo "</td></tr>\n";
         echo "</table>\n";
         Html::closeForm();
         echo "</div>";
     }
     echo "<div class='spaced'>";
     if ($number < 1) {
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr><th>" . self::getTypeName(1) . "</th>";
         echo "<th>" . __('No item found') . "</th></tr>";
         echo "</table>\n";
     } else {
         Html::printAjaxPager(sprintf(__('Network outlets for %s'), $item->getTreeLink()), $start, $number);
         if ($canedit) {
             $rand = mt_rand();
             Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
             $massiveactionparams = array('num_displayed' => $_SESSION['glpilist_limit'], 'container' => 'mass' . __CLASS__ . $rand, 'specific_actions' => array('purge' => _x('button', 'Delete permanently')));
             Html::showMassiveActions($massiveactionparams);
         }
         echo "<table class='tab_cadre_fixe'><tr>";
         if ($canedit) {
             echo "<th width='10'>";
             Html::checkAllAsCheckbox('mass' . __CLASS__ . $rand);
             echo "</th>";
         }
         echo "<th>" . __('Name') . "</th>";
         // Name
         echo "<th>" . __('Comments') . "</th>";
         // Comment
         echo "</tr>\n";
         $crit = array('locations_id' => $ID, 'ORDER' => 'name', 'START' => $start, 'LIMIT' => $_SESSION['glpilist_limit']);
         Session::initNavigateListItems('Netpoint', sprintf(__('%1$s = %2$s'), $item->getTypeName(1), $item->getName()));
         foreach ($DB->request('glpi_netpoints', $crit) as $data) {
             Session::addToNavigateListItems('Netpoint', $data["id"]);
             echo "<tr class='tab_bg_1'>";
             if ($canedit) {
                 echo "<td>" . Html::getMassiveActionCheckBox(__CLASS__, $data["id"]) . "</td>";
             }
             echo "<td><a href='" . $netpoint->getFormURL();
             echo '?id=' . $data['id'] . "'>" . $data['name'] . "</a></td>";
             echo "<td>" . $data['comment'] . "</td>";
             echo "</tr>\n";
         }
         echo "</table>\n";
         if ($canedit) {
             $massiveactionparams['ontop'] = false;
             Html::showMassiveActions($massiveactionparams);
             Html::closeForm();
         }
         Html::printAjaxPager(sprintf(__('Network outlets for %s'), $item->getTreeLink()), $start, $number);
//.........这里部分代码省略.........
开发者ID:jose-martins,项目名称:glpi,代码行数:101,代码来源:netpoint.class.php

示例10: showForConsumableItem

 /**
  * Print out the consumables of a defined type
  *
  * @param $consitem           ConsumableItem object
  * @param $show_old  boolean  show old consumables or not. (default 0)
  *
  * @return Nothing (displays)
  **/
 static function showForConsumableItem(ConsumableItem $consitem, $show_old = 0)
 {
     global $DB, $CFG_GLPI;
     $tID = $consitem->getField('id');
     if (!$consitem->can($tID, 'r')) {
         return false;
     }
     $canedit = $consitem->can($tID, 'w');
     $rand = mt_rand();
     $where = "";
     if (!$show_old) {
         // NEW
         $where = " AND `date_out` IS NULL\n                  ORDER BY `date_in`, `id`";
     } else {
         //OLD
         $where = " AND `date_out` IS NOT NULL\n                  ORDER BY `date_out` DESC,\n                           `date_in`,\n                           `id`";
     }
     $query = "SELECT `glpi_consumables`.*\n                FROM `glpi_consumables`\n                WHERE `consumableitems_id` = '{$tID}'\n                      {$where}";
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     if ($canedit && $number) {
         Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
         $actions = array('delete' => _x('button', 'Delete permanently'), 'activate_infocoms' => __('Enable the financial and administrative information'));
         if ($show_old) {
             $actions['restore'] = __('Back to stock');
         } else {
             $actions['give'] = _x('button', 'Give');
         }
         $paramsma = array('num_displayed' => $number, 'specific_actions' => $actions, 'extraparams' => array('entities_id' => $consitem->getEntityID()));
         Html::showMassiveActions(__CLASS__, $paramsma);
         echo "<input type='hidden' name='consumableitems_id' value='{$tID}'>\n";
     }
     echo "<div class='spaced'><table class='tab_cadre_fixe'>";
     if (!$show_old) {
         echo "<tr><th colspan=" . ($canedit ? '5' : '4') . ">";
         echo self::getCount($tID, -1);
         echo "</th></tr>";
     } else {
         // Old
         echo "<tr><th colspan='" . ($canedit ? '7' : '6') . "'>" . __('Used consumables') . "</th></tr>";
     }
     if ($number) {
         $i = 0;
         echo "<tr>";
         if ($canedit) {
             echo "<th width='10'>";
             Html::checkAllAsCheckbox('mass' . __CLASS__ . $rand);
             echo "</th>";
         }
         echo "<th>" . __('ID') . "</th>";
         echo "<th>" . _x('item', 'State') . "</th>";
         echo "<th>" . __('Add date') . "</th>";
         if ($show_old) {
             echo "<th>" . __('Use date') . "</th>";
             echo "<th>" . __('Given to') . "</th>";
         }
         echo "<th width='200px'>" . __('Financial and administrative information') . "</th>";
         echo "</tr>";
     }
     if ($result = $DB->query($query)) {
         $number = $DB->numrows($result);
         while ($data = $DB->fetch_assoc($result)) {
             $date_in = Html::convDate($data["date_in"]);
             $date_out = Html::convDate($data["date_out"]);
             echo "<tr class='tab_bg_1'>";
             if ($canedit) {
                 echo "<td width='10'>";
                 Html::showMassiveActionCheckBox(__CLASS__, $data["id"]);
                 echo "</td>";
             }
             echo "<td class='center'>" . $data["id"] . "</td>";
             echo "<td class='center'>" . self::getStatus($data["id"]) . "</td>";
             echo "<td class='center'>" . $date_in . "</td>";
             if ($show_old) {
                 echo "<td class='center'>" . $date_out . "</td>";
                 echo "<td class='center'>";
                 if ($item = getItemForItemtype($data['itemtype'])) {
                     if ($item->getFromDB($data['items_id'])) {
                         echo $item->getLink();
                     }
                 }
                 echo "</td>";
             }
             echo "<td class='center'>";
             Infocom::showDisplayLink('Consumable', $data["id"], 1);
             echo "</td>";
             echo "</tr>";
         }
     }
     echo "</table>";
     if ($canedit && $number) {
         $paramsma['ontop'] = false;
//.........这里部分代码省略.........
开发者ID:geldarr,项目名称:hack-space,代码行数:101,代码来源:consumable.class.php

示例11: showForSoftware

 /**
  * Show Licenses of a software
  *
  * @param $software Software object
  *
  * @return nothing
  **/
 static function showForSoftware(Software $software)
 {
     global $DB, $CFG_GLPI;
     $softwares_id = $software->getField('id');
     $license = new self();
     $computer = new Computer();
     if (!$software->can($softwares_id, "r")) {
         return false;
     }
     if (isset($_POST["start"])) {
         $start = $_POST["start"];
     } else {
         $start = 0;
     }
     if (isset($_POST["order"]) && $_POST["order"] == "DESC") {
         $order = "DESC";
     } else {
         $order = "ASC";
     }
     if (isset($_POST["sort"]) && !empty($_POST["sort"])) {
         $sort = "`" . $_POST["sort"] . "`";
     } else {
         $sort = "`entity` {$order}, `name`";
     }
     // Righ type is enough. Can add a License on a software we have Read access
     $canedit = Session::haveRight("software", "w");
     $showmassiveactions = $canedit;
     // Total Number of events
     $number = countElementsInTable("glpi_softwarelicenses", "glpi_softwarelicenses.softwares_id = {$softwares_id} " . getEntitiesRestrictRequest('AND', 'glpi_softwarelicenses', '', '', true));
     echo "<div class='spaced'>";
     Session::initNavigateListItems('SoftwareLicense', sprintf(__('%1$s = %2$s'), Software::getTypeName(1), $software->getName()));
     if ($number < 1) {
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr><th>" . __('No item found') . "</th></tr>\n";
         if ($canedit) {
             echo "<tr class='tab_bg_2'><td class='center'>";
             echo "<a class='vsubmit' href='softwarelicense.form.php?softwares_id={$softwares_id}'>" . _sx('button', 'Add a license') . "</a>";
             echo "</td></tr>\n";
         }
         echo "</table></div>\n";
         return;
     }
     // Display the pager
     Html::printAjaxPager(self::getTypeName(2), $start, $number);
     $rand = mt_rand();
     $query = "SELECT `glpi_softwarelicenses`.*,\n                       `buyvers`.`name` AS buyname,\n                       `usevers`.`name` AS usename,\n                       `glpi_entities`.`completename` AS entity,\n                       `glpi_softwarelicensetypes`.`name` AS typename\n                FROM `glpi_softwarelicenses`\n                LEFT JOIN `glpi_softwareversions` AS buyvers\n                     ON (`buyvers`.`id` = `glpi_softwarelicenses`.`softwareversions_id_buy`)\n                LEFT JOIN `glpi_softwareversions` AS usevers\n                     ON (`usevers`.`id` = `glpi_softwarelicenses`.`softwareversions_id_use`)\n                LEFT JOIN `glpi_entities`\n                     ON (`glpi_entities`.`id` = `glpi_softwarelicenses`.`entities_id`)\n                LEFT JOIN `glpi_softwarelicensetypes`\n                     ON (`glpi_softwarelicensetypes`.`id`\n                          = `glpi_softwarelicenses`.`softwarelicensetypes_id`)\n                WHERE (`glpi_softwarelicenses`.`softwares_id` = '{$softwares_id}') " . getEntitiesRestrictRequest('AND', 'glpi_softwarelicenses', '', '', true) . "\n                ORDER BY {$sort} {$order}\n                LIMIT " . intval($start) . "," . intval($_SESSION['glpilist_limit']);
     if ($result = $DB->query($query)) {
         if ($num_displayed = $DB->numrows($result)) {
             if ($showmassiveactions) {
                 Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
                 $massiveactionparams = array('num_displayed' => $num_displayed, 'extraparams' => array('options' => array('condition' => "`glpi_softwareversions`.`softwares_id` = {$softwares_id}")));
                 Html::showMassiveActions(__CLASS__, $massiveactionparams);
             }
             $sort_img = "<img src=\"" . $CFG_GLPI["root_doc"] . "/pics/" . ($order == "DESC" ? "puce-down.png" : "puce-up.png") . "\" alt='' title=''>";
             echo "<table class='tab_cadre_fixehov'><tr>";
             echo "<th>";
             Html::checkAllAsCheckbox('mass' . __CLASS__ . $rand);
             echo "</th>";
             echo "<th>" . ($sort == "`name`" ? $sort_img : "") . "<a href='javascript:reloadTab(\"sort=name&amp;order=" . ($order == "ASC" ? "DESC" : "ASC") . "&amp;start=0\");'>" . __('Name') . "</a></th>";
             if ($software->isRecursive()) {
                 // Ereg to search entity in string for match default order
                 echo "<th>" . (strstr($sort, "entity") ? $sort_img : "") . "<a href='javascript:reloadTab(\"sort=entity&amp;order=" . ($order == "ASC" ? "DESC" : "ASC") . "&amp;start=0\");'>" . __('Entity') . "</a></th>";
             }
             echo "<th>" . ($sort == "`serial`" ? $sort_img : "") . "<a href='javascript:reloadTab(\"sort=serial&amp;order=" . ($order == "ASC" ? "DESC" : "ASC") . "&amp;start=0\");'>" . __('Serial number') . "</a></th>";
             echo "<th>" . ($sort == "`number`" ? $sort_img : "") . "<a href='javascript:reloadTab(\"sort=number&amp;order=" . ($order == "ASC" ? "DESC" : "ASC") . "&amp;start=0\");'>" . _x('quantity', 'Number') . "</a></th>";
             echo "<th>" . __('Affected computers') . "</th>";
             echo "<th>" . ($sort == "`typename`" ? $sort_img : "") . "<a href='javascript:reloadTab(\"sort=typename&amp;order=" . ($order == "ASC" ? "DESC" : "ASC") . "&amp;start=0\");'>" . __('Type') . "</a></th>";
             echo "<th>" . ($sort == "`buyname`" ? $sort_img : "") . "<a href='javascript:reloadTab(\"sort=buyname&amp;order=" . ($order == "ASC" ? "DESC" : "ASC") . "&amp;start=0\");'>" . __('Purchase version') . "</a></th>";
             echo "<th>" . ($sort == "`usename`" ? $sort_img : "") . "<a href='javascript:reloadTab(\"sort=usename&amp;order=" . ($order == "ASC" ? "DESC" : "ASC") . "&amp;start=0\");'>" . __('Version in use') . "</a></th>";
             echo "<th>" . ($sort == "`expire`" ? $sort_img : "") . "<a href='javascript:reloadTab(\"sort=expire&amp;order=" . ($order == "ASC" ? "DESC" : "ASC") . "&amp;start=0\");'>" . __('Expiration') . "</a></th>";
             echo "</tr>\n";
             $tot_assoc = 0;
             for ($tot = 0; $data = $DB->fetch_assoc($result);) {
                 Session::addToNavigateListItems('SoftwareLicense', $data['id']);
                 $expired = true;
                 if (is_null($data['expire']) || $data['expire'] > date('Y-m-d')) {
                     $expired = false;
                 }
                 echo "<tr class='tab_bg_2" . ($expired ? '_2' : '') . "'>";
                 if ($license->can($data['id'], "w")) {
                     echo "<td>" . Html::getMassiveActionCheckBox(__CLASS__, $data["id"]) . "</td>";
                 } else {
                     echo "<td>&nbsp;</td>";
                 }
                 echo "<td><a href='softwarelicense.form.php?id=" . $data['id'] . "'>" . $data['name'] . (empty($data['name']) ? "(" . $data['id'] . ")" : "") . "</a></td>";
                 if ($software->isRecursive()) {
                     echo "<td>" . $data['entity'] . "</td>";
                 }
                 echo "<td>" . $data['serial'] . "</td>";
                 echo "<td class='numeric'>" . ($data['number'] > 0 ? $data['number'] : __('Unlimited')) . "</td>";
                 $nb_assoc = Computer_SoftwareLicense::countForLicense($data['id']);
                 $tot_assoc += $nb_assoc;
                 echo "<td class='numeric'>" . $nb_assoc . "</td>";
//.........这里部分代码省略.........
开发者ID:gaforeror,项目名称:glpi,代码行数:101,代码来源:softwarelicense.class.php

示例12: showMergeCandidates

 /**
  * Show softwares candidates to be merged with the current
  *
  * @return nothing
  **/
 function showMergeCandidates()
 {
     global $DB, $CFG_GLPI;
     $ID = $this->getField('id');
     $this->check($ID, "w");
     $rand = mt_rand();
     echo "<div class='center'>";
     $sql = "SELECT `glpi_softwares`.`id`,\n                     `glpi_softwares`.`name`,\n                     `glpi_entities`.`completename` AS entity\n              FROM `glpi_softwares`\n              LEFT JOIN `glpi_entities` ON (`glpi_softwares`.`entities_id` = `glpi_entities`.`id`)\n              WHERE (`glpi_softwares`.`id` != '{$ID}'\n                     AND `glpi_softwares`.`name` = '" . addslashes($this->fields["name"]) . "'\n                     AND `glpi_softwares`.`is_deleted` = '0'\n                     AND `glpi_softwares`.`is_template` = '0' " . getEntitiesRestrictRequest('AND', 'glpi_softwares', 'entities_id', getSonsOf("glpi_entities", $this->fields["entities_id"]), false) . ")\n              ORDER BY `entity`";
     $req = $DB->request($sql);
     if ($nb = $req->numrows()) {
         $link = Toolbox::getItemTypeFormURL('Software');
         Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
         $paramsma = array('num_displayed' => $nb, 'specific_actions' => array('mergesoftware' => __('Merge')));
         Html::showMassiveActions(__CLASS__, $paramsma);
         echo "<table class='tab_cadre_fixehov'>";
         echo "<tr><th width='10'>";
         echo Html::checkAllAsCheckbox('mass' . __CLASS__ . $rand);
         echo "</th>";
         echo "<th>" . __('Name') . "</th>";
         echo "<th>" . __('Entity') . "</th>";
         echo "<th>" . _n('Installation', 'Installations', 2) . "</th>";
         echo "<th>" . _n('License', 'Licenses', 2) . "</th></tr>";
         foreach ($req as $data) {
             echo "<tr class='tab_bg_2'>";
             echo "<td>" . Html::getMassiveActionCheckBox(__CLASS__, $data["id"]) . "</td>";
             echo "<td><a href='" . $link . "?id=" . $data["id"] . "'>" . $data["name"] . "</a></td>";
             echo "<td>" . $data["entity"] . "</td>";
             echo "<td class='right'>" . Computer_SoftwareVersion::countForSoftware($data["id"]) . "</td>";
             echo "<td class='right'>" . SoftwareLicense::countForSoftware($data["id"]) . "</td></tr>\n";
         }
         echo "</table>\n";
         echo "<input type='hidden' name='id' value='{$ID}'>";
         $paramsma['ontop'] = false;
         Html::showMassiveActions(__CLASS__, $paramsma);
         Html::closeForm();
     } else {
         _e('No item found');
     }
     echo "</div>";
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:45,代码来源:software.class.php

示例13: showForCalendar

 /**
  * Show segments of a calendar
  *
  * @param $calendar Calendar object
  **/
 static function showForCalendar(Calendar $calendar)
 {
     global $DB, $CFG_GLPI;
     $ID = $calendar->getField('id');
     if (!$calendar->can($ID, READ)) {
         return false;
     }
     $canedit = $calendar->can($ID, UPDATE);
     $rand = mt_rand();
     $query = "SELECT *\n                FROM `glpi_calendarsegments`\n                WHERE `calendars_id` = '{$ID}'\n                ORDER BY `day`, `begin`, `end`";
     $result = $DB->query($query);
     $numrows = $DB->numrows($result);
     if ($canedit) {
         echo "<div class='firstbloc'>";
         echo "<form name='calendarsegment_form{$rand}' id='calendarsegment_form{$rand}' method='post'\n                action='";
         echo Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr class='tab_bg_1'><th colspan='7'>" . __('Add a schedule') . "</tr>";
         echo "<tr class='tab_bg_2'><td class='center'>" . __('Day') . "</td><td>";
         echo "<input type='hidden' name='calendars_id' value='{$ID}'>";
         Dropdown::showFromArray('day', Toolbox::getDaysOfWeekArray());
         echo "</td><td class='center'>" . __('Start') . '</td><td>';
         Dropdown::showHours("begin", array('value' => date('H') . ":00"));
         echo "</td><td class='center'>" . __('End') . '</td><td>';
         Dropdown::showHours("end", array('value' => date('H') + 1 . ":00"));
         echo "</td><td class='center'>";
         echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
         echo "</td></tr>";
         echo "</table>";
         Html::closeForm();
         echo "</div>";
     }
     echo "<div class='spaced'>";
     if ($canedit && $numrows) {
         Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
         $massiveactionparams = array('num_displayed' => $numrows, 'container' => 'mass' . __CLASS__ . $rand);
         Html::showMassiveActions($massiveactionparams);
     }
     echo "<table class='tab_cadre_fixehov'>";
     echo "<tr>";
     if ($canedit && $numrows) {
         echo "<th width='10'>";
         Html::checkAllAsCheckbox('mass' . __CLASS__ . $rand);
         echo "</th>";
     }
     echo "<th>" . __('Day') . "</th>";
     echo "<th>" . __('Start') . "</th>";
     echo "<th>" . __('End') . "</th>";
     echo "</tr>";
     $daysofweek = Toolbox::getDaysOfWeekArray();
     if ($numrows) {
         while ($data = $DB->fetch_assoc($result)) {
             echo "<tr class='tab_bg_1'>";
             if ($canedit) {
                 echo "<td>";
                 Html::showMassiveActionCheckBox(__CLASS__, $data["id"]);
                 echo "</td>";
             }
             echo "<td>";
             echo $daysofweek[$data['day']];
             echo "</td>";
             echo "<td>" . $data["begin"] . "</td>";
             echo "<td>" . $data["end"] . "</td>";
         }
         echo "</tr>";
     }
     echo "</table>";
     if ($canedit && $numrows) {
         $massiveactionparams['ontop'] = false;
         Html::showMassiveActions($massiveactionparams);
         Html::closeForm();
     }
     echo "</div>";
 }
开发者ID:kipman,项目名称:glpi,代码行数:79,代码来源:calendarsegment.class.php

示例14: showListRules

 /**
  * Show the list of rules
  *
  * @param $target
  * @param $options   array
  *
  * @return nothing
  **/
 function showListRules($target, $options = array())
 {
     global $CFG_GLPI;
     $p['inherited'] = 1;
     $p['childrens'] = 0;
     $p['active'] = false;
     $p['condition'] = 0;
     $rand = mt_rand();
     foreach (array('inherited', 'childrens', 'condition') as $param) {
         if (isset($options[$param]) && $this->isRuleRecursive()) {
             $p[$param] = $options[$param];
         }
     }
     $rule = $this->getRuleClass();
     $display_entities = $this->isRuleRecursive() && ($p['inherited'] || $p['childrens']);
     // Do not know what it is ?
     $canedit = self::canUpdate() && !$display_entities;
     $use_conditions = false;
     if ($rule->useConditions()) {
         // First get saved option
         $p['condition'] = Session::getSavedOption($this->getType(), 'condition', 0);
         if ($p['condition'] == 0) {
             $p['condition'] = $this->getDefaultRuleConditionForList();
         }
         $use_conditions = true;
         // Mini Search engine
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr class='tab_bg_1'><td class='center' width='50%'>";
         echo __('Rules used for') . "</td><td>";
         $rule->dropdownConditions(array('value' => $p['condition'], 'on_change' => 'reloadTab("start=0&inherited=' . $p['inherited'] . '&childrens=' . $p['childrens'] . '&condition="+this.value)'));
         echo "</td></tr></table>";
     }
     $nb = $this->getCollectionSize($p['inherited'], $p['condition']);
     $p['start'] = isset($options["start"]) ? $options["start"] : 0;
     if ($p['start'] >= $nb) {
         $p['start'] = 0;
     }
     $p['limit'] = $_SESSION['glpilist_limit'];
     $this->getCollectionPart($p);
     Html::printAjaxPager('', $p['start'], $nb);
     Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
     echo "\n<div class='spaced'>";
     if ($canedit && $nb) {
         $massiveactionparams = array('num_displayed' => min($p['limit'], $nb), 'container' => 'mass' . __CLASS__ . $rand, 'extraparams' => array('entity' => $this->entity, 'condition' => $p['condition'], 'rule_class_name' => $this->getRuleClassName()));
         Html::showMassiveActions($massiveactionparams);
     }
     echo "<table class='tab_cadre_fixehov table-striped table-hover'>";
     $colspan = 6;
     if ($display_entities) {
         $colspan++;
     }
     if ($use_conditions) {
         $colspan++;
     }
     echo "<tr><th colspan='{$colspan}'>" . $this->getTitle() . "</th></tr>\n";
     echo "<tr>";
     echo "<th>";
     if ($canedit) {
         Html::checkAllAsCheckbox('mass' . __CLASS__ . $rand);
     }
     echo "</th>";
     echo "<th>" . __('Name') . "</th>";
     echo "<th>" . __('Description') . "</th>";
     if ($use_conditions) {
         echo "<th>" . __('Use rule for') . "</th>";
     }
     echo "<th>" . __('Active') . "</th>";
     if ($display_entities) {
         echo "<th>" . __('Entity') . "</th>\n";
     }
     if (!$display_entities) {
         echo "<th colspan='2'>&nbsp;</th>";
     }
     echo "</tr>\n";
     if (count($this->RuleList->list)) {
         $ruletype = $this->RuleList->list[0]->getType();
         Session::initNavigateListItems($ruletype);
     }
     for ($i = $p['start'], $j = 0; isset($this->RuleList->list[$j]); $i++, $j++) {
         $this->RuleList->list[$j]->showMinimalForm($target, $i == 0, $i == $nb - 1, $display_entities, $p['condition']);
         Session::addToNavigateListItems($ruletype, $this->RuleList->list[$j]->fields['id']);
     }
     if ($nb) {
         echo "<tr>";
         echo "<th>";
         if ($canedit) {
             Html::checkAllAsCheckbox('mass' . __CLASS__ . $rand);
         }
         echo "</th>";
         echo "<th>" . __('Name') . "</th>";
         echo "<th>" . __('Description') . "</th>";
         if ($use_conditions) {
//.........这里部分代码省略.........
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:101,代码来源:rulecollection.class.php

示例15: showTranslations

 /**
  * Display all translations for a label
  *
  * @param CommonDBTM $item Item instance
  *
  * @return void
  **/
 static function showTranslations(CommonDBTM $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__, 'itemtype' => $item::getType(), 'items_id' => $item->fields['id'], 'id' => -1);
         Ajax::updateItemJsCode("viewtranslation" . $item->getID() . "{$rand}", $CFG_GLPI["root_doc"] . "/plugins/fields/ajax/viewtranslations.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("`plugin_fields_itemtype` = '{$item::getType()}' AND\n           `plugin_fields_items_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", "fields") . "</th>";
         echo "<th>" . __("Label", "fields") . "</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__, 'itemtype' => $item::getType(), 'items_id' => $item->getID(), 'id' => $data["id"]);
                 Ajax::updateItemJsCode("viewtranslation" . $item->getID() . "{$rand}", $CFG_GLPI["root_doc"] . "/plugins/fields/ajax/viewtranslations.php", $params);
                 echo "};";
                 echo "</script>\n";
             }
             echo Dropdown::getLanguageName($data['language']);
             echo "</td><td>";
             echo $data['label'];
             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:pluginsGLPI,项目名称:fields,代码行数:73,代码来源:labeltranslation.class.php


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