本文整理汇总了PHP中Html::showMassiveActionCheckBox方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::showMassiveActionCheckBox方法的具体用法?PHP Html::showMassiveActionCheckBox怎么用?PHP Html::showMassiveActionCheckBox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Html
的用法示例。
在下文中一共展示了Html::showMassiveActionCheckBox方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showForItem
//.........这里部分代码省略.........
echo "</table>";
Html::closeForm();
}
echo "</div>";
}
echo "<div class='spaced'>";
if ($canedit && $number && ($withtemplate < 2)) {
Html::openMassiveActionsForm('mass'.__CLASS__.$rand);
$massiveactionparams = array('num_displayed' => $number);
Html::showMassiveActions($massiveactionparams);
}
echo "<table class='tab_cadre_fixe'>";
echo "<tr>";
if ($canedit && $number && ($withtemplate < 2)) {
echo "<th width='10'>".Html::getCheckAllAsCheckbox('mass'.__CLASS__.$rand)."</th>";
}
echo "<th>".__('Name')."</th>";
if (Session::isMultiEntitiesMode()) {
echo "<th>".__('Entity')."</th>";
}
echo "<th>".__('Type')."</th>";
echo "<th>".__('DNS name', 'certificates')."</th>";
echo "<th>".__('DNS suffix', 'certificates')."</th>";
echo "<th>".__('Creation date')."</th>";
echo "<th>".__('Expiration date')."</th>";
echo "<th>".__('Status')."</th>";
echo "</tr>";
$used = array();
if ($number) {
Session::initNavigateListItems('PluginCertificatesCertificate',
//TRANS : %1$s is the itemtype name,
// %2$s is the name of the item (used for headings of a list)
sprintf(__('%1$s = %2$s'),
$item->getTypeName(1), $item->getName()));
foreach ($certificates as $data) {
$certificateID = $data["id"];
$link = NOT_AVAILABLE;
if ($certificate->getFromDB($certificateID)) {
$link = $certificate->getLink();
}
Session::addToNavigateListItems('PluginCertificatesCertificate', $certificateID);
$used[$certificateID] = $certificateID;
$assocID = $data["assocID"];
echo "<tr class='tab_bg_1".($data["is_deleted"]?"_2":"")."'>";
if ($canedit && ($withtemplate < 2)) {
echo "<td width='10'>";
Html::showMassiveActionCheckBox(__CLASS__, $data["assocID"]);
echo "</td>";
}
echo "<td class='center'>$link</td>";
if (Session::isMultiEntitiesMode()) {
echo "<td class='center'>".Dropdown::getDropdownName("glpi_entities", $data['entities_id']).
"</td>";
}
echo "<td class='center'>";
echo Dropdown::getDropdownName("glpi_plugin_certificates_certificatetypes",
$data["plugin_certificates_certificatetypes_id"]);
echo "</td>";
echo "<td class='center'>".$data["dns_name"]."</td>";
echo "<td class='center'>".$data["dns_suffix"]."</td>";
echo "<td class='center'>".Html::convdate($data["date_query"])."</td>";
if ($data["date_expiration"] <= date('Y-m-d')
&& !empty($data["date_expiration"])) {
echo "<td class='center'>";
echo "<div class='deleted'>".Html::convdate($data["date_expiration"])."</div>";
echo "</td>";
} else if (empty($data["date_expiration"])) {
echo "<td class='center'>".__('Does not expire', 'certificates')."</td>";
} else {
echo "<td class='center'>".Html::convdate($data["date_expiration"])."</td>";
}
echo "<td class='center'>";
echo Dropdown::getDropdownName("glpi_plugin_certificates_certificatestates",
$data["plugin_certificates_certificatestates_id"]);
echo "</td>";
echo "</tr>";
$i++;
}
}
echo "</table>";
if ($canedit && $number && ($withtemplate < 2)) {
$massiveactionparams['ontop'] = false;
Html::showMassiveActions($massiveactionparams);
Html::closeForm();
}
echo "</div>";
}
示例2: showForContract
/**
* Print the HTML array of suppliers for this contract
*
* @since version 0.84
*
* @param $contract Contract object
*
* @return Nothing (HTML display)
**/
static function showForContract(Contract $contract)
{
global $DB, $CFG_GLPI;
$instID = $contract->fields['id'];
if (!$contract->can($instID, 'r') || !Session::haveRight("contact_enterprise", "r")) {
return false;
}
$canedit = $contract->can($instID, 'w');
$rand = mt_rand();
$query = "SELECT `glpi_contracts_suppliers`.`id`,\n `glpi_suppliers`.`id` AS entID,\n `glpi_suppliers`.`name` AS name,\n `glpi_suppliers`.`website` AS website,\n `glpi_suppliers`.`phonenumber` AS phone,\n `glpi_suppliers`.`suppliertypes_id` AS type,\n `glpi_entities`.`id` AS entity\n FROM `glpi_contracts_suppliers`,\n `glpi_suppliers`\n LEFT JOIN `glpi_entities` ON (`glpi_entities`.`id`=`glpi_suppliers`.`entities_id`)\n WHERE `glpi_contracts_suppliers`.`contracts_id` = '{$instID}'\n AND `glpi_contracts_suppliers`.`suppliers_id`=`glpi_suppliers`.`id`" . getEntitiesRestrictRequest(" AND", "glpi_suppliers", '', '', true) . "\n ORDER BY `glpi_entities`.`completename`, `name`";
$result = $DB->query($query);
$suppliers = array();
$used = array();
if ($number = $DB->numrows($result)) {
while ($data = $DB->fetch_assoc($result)) {
$suppliers[$data['id']] = $data;
$used[$data['entID']] = $data['entID'];
}
}
if ($canedit) {
echo "<div class='firstbloc'>";
echo "<form name='contractsupplier_form{$rand}' id='contractsupplier_form{$rand}' method='post'\n action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
echo "<input type='hidden' name='contracts_id' value='{$instID}'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_2'><th colspan='2'>" . __('Add a supplier') . "</th></tr>";
echo "<tr class='tab_bg_1'><td class='right'>";
Supplier::dropdown(array('used' => $used, 'entity' => $contract->fields["entities_id"], 'entity_sons' => $contract->fields["is_recursive"]));
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 && $number) {
Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
$massiveactionparams = array('num_displayed' => $number);
Html::showMassiveActions(__CLASS__, $massiveactionparams);
}
echo "<table class='tab_cadre_fixe'>";
echo "<tr>";
if ($canedit && $number) {
echo "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand) . "</th>";
}
echo "<th>" . __('Supplier') . "</th>";
echo "<th>" . __('Entity') . "</th>";
echo "<th>" . __('Third party type') . "</th>";
echo "<th>" . __('Phone') . "</th>";
echo "<th>" . __('Website') . "</th>";
echo "</tr>";
$used = array();
foreach ($suppliers as $data) {
$ID = $data['id'];
$website = $data['website'];
if (!empty($website)) {
if (!preg_match("?https*://?", $website)) {
$website = "http://" . $website;
}
$website = "<a target=_blank href='{$website}'>" . $data['website'] . "</a>";
}
$entID = $data['entID'];
$entity = $data['entity'];
$used[$entID] = $entID;
$entname = Dropdown::getDropdownName("glpi_suppliers", $entID);
echo "<tr class='tab_bg_1'>";
if ($canedit) {
echo "<td>";
Html::showMassiveActionCheckBox(__CLASS__, $data["id"]);
echo "</td>";
}
echo "<td class='center'>";
if ($_SESSION["glpiis_ids_visible"] || empty($entname)) {
$entname = sprintf(__('%1$s (%2$s)'), $entname, $entID);
}
echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/supplier.form.php?id={$entID}'>" . $entname;
echo "</a></td>";
echo "<td class='center'>" . Dropdown::getDropdownName("glpi_entities", $entity) . "</td>";
echo "<td class='center'>";
echo Dropdown::getDropdownName("glpi_suppliertypes", $data['type']) . "</td>";
echo "<td class='center'>" . $data['phone'] . "</td>";
echo "<td class='center'>" . $website . "</td>";
echo "</tr>";
}
echo "</table>";
if ($canedit && $number) {
$paramsma['ontop'] = false;
Html::showMassiveActions(__CLASS__, $paramsma);
Html::closeForm();
}
echo "</div>";
//.........这里部分代码省略.........
示例3: showForProblem
/**
* Print the HTML array for Items linked to a problem
*
* @param $problem Problem object
*
* @return Nothing (display)
**/
static function showForProblem(Problem $problem)
{
global $DB, $CFG_GLPI;
$instID = $problem->fields['id'];
if (!$problem->can($instID, READ)) {
return false;
}
$canedit = $problem->canEdit($instID);
$rand = mt_rand();
$query = "SELECT DISTINCT `itemtype`\n FROM `glpi_items_problems`\n WHERE `glpi_items_problems`.`problems_id` = '{$instID}'\n ORDER BY `itemtype`";
$result = $DB->query($query);
$number = $DB->numrows($result);
if ($canedit) {
echo "<div class='firstbloc'>";
echo "<form name='problemitem_form{$rand}' id='problemitem_form{$rand}' method='post'\n action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_2'><th colspan='2'>" . __('Add an item') . "</th></tr>";
echo "<tr class='tab_bg_1'><td>";
$types = array();
foreach ($problem->getAllTypesForHelpdesk() as $key => $val) {
$types[] = $key;
}
Dropdown::showSelectItemFromItemtypes(array('itemtypes' => $types, 'entity_restrict' => $problem->fields['is_recursive'] ? getSonsOf('glpi_entities', $problem->fields['entities_id']) : $problem->fields['entities_id']));
echo "</td><td class='center' width='30%'>";
echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
echo "<input type='hidden' name='problems_id' value='{$instID}'>";
echo "</td></tr>";
echo "</table>";
Html::closeForm();
echo "</div>";
}
echo "<div class='spaced'>";
if ($canedit && $number) {
Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
$massiveactionparams = array('container' => 'mass' . __CLASS__ . $rand);
Html::showMassiveActions($massiveactionparams);
}
echo "<table class='tab_cadre_fixehov'>";
$header_begin = "<tr>";
$header_top = '';
$header_bottom = '';
$header_end = '';
if ($canedit && $number) {
$header_top .= "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
$header_top .= "</th>";
$header_bottom .= "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
$header_bottom .= "</th>";
}
$header_end .= "<th>" . __('Type') . "</th>";
$header_end .= "<th>" . __('Entity') . "</th>";
$header_end .= "<th>" . __('Name') . "</th>";
$header_end .= "<th>" . __('Serial number') . "</th>";
$header_end .= "<th>" . __('Inventory number') . "</th></tr>";
echo $header_begin . $header_top . $header_end;
$totalnb = 0;
for ($i = 0; $i < $number; $i++) {
$itemtype = $DB->result($result, $i, "itemtype");
if (!($item = getItemForItemtype($itemtype))) {
continue;
}
if ($item->canView()) {
$itemtable = getTableForItemType($itemtype);
$query = "SELECT `{$itemtable}`.*,\n `glpi_items_problems`.`id` AS IDD,\n `glpi_entities`.`id` AS entity\n FROM `glpi_items_problems`,\n `{$itemtable}`";
if ($itemtype != 'Entity') {
$query .= " LEFT JOIN `glpi_entities`\n ON (`{$itemtable}`.`entities_id`=`glpi_entities`.`id`) ";
}
$query .= " WHERE `{$itemtable}`.`id` = `glpi_items_problems`.`items_id`\n AND `glpi_items_problems`.`itemtype` = '{$itemtype}'\n AND `glpi_items_problems`.`problems_id` = '{$instID}'";
if ($item->maybeTemplate()) {
$query .= " AND `{$itemtable}`.`is_template` = '0'";
}
$query .= getEntitiesRestrictRequest(" AND", $itemtable, '', '', $item->maybeRecursive()) . "\n ORDER BY `glpi_entities`.`completename`, `{$itemtable}`.`name`";
$result_linked = $DB->query($query);
$nb = $DB->numrows($result_linked);
for ($prem = true; $data = $DB->fetch_assoc($result_linked); $prem = false) {
$name = $data["name"];
if ($_SESSION["glpiis_ids_visible"] || empty($data["name"])) {
$name = sprintf(__('%1$s (%2$s)'), $name, $data["id"]);
}
$link = $itemtype::getFormURLWithID($data['id']);
$namelink = "<a href=\"" . $link . "\">" . $name . "</a>";
echo "<tr class='tab_bg_1'>";
if ($canedit) {
echo "<td width='10'>";
Html::showMassiveActionCheckBox(__CLASS__, $data["IDD"]);
echo "</td>";
}
if ($prem) {
$typename = $item->getTypeName($nb);
echo "<td class='center top' rowspan='{$nb}'>" . ($nb > 1 ? sprintf(__('%1$s: %2$s'), $typename, $nb) : $typename) . "</td>";
}
echo "<td class='center'>";
echo Dropdown::getDropdownName("glpi_entities", $data['entity']) . "</td>";
echo "<td class='center" . (isset($data['is_deleted']) && $data['is_deleted'] ? " tab_bg_2_2'" : "'");
//.........这里部分代码省略.........
示例4: showLdapGroups
/** Show LDAP groups to add or synchronise in an entity
*
* @param $target target page for the form
* @param $start where to start the list
* @param $sync synchronise or add ? (default 0)
* @param $filter ldap filter to use (default '')
* @param $filter2 second ldap filter to use (which case ?) (default '')
* @param $entity working entity
* @param $order display order (default DESC)
*
* @return nothing
**/
static function showLdapGroups($target, $start, $sync = 0, $filter = '', $filter2 = '', $entity, $order = 'DESC')
{
echo "<br>";
$limitexceeded = false;
$ldap_groups = self::getAllGroups($_SESSION["ldap_server"], $filter, $filter2, $entity, $limitexceeded, $order);
if (is_array($ldap_groups)) {
$numrows = count($ldap_groups);
$rand = mt_rand();
$colspan = Session::isMultiEntitiesMode() ? 5 : 4;
if ($numrows > 0) {
self::displaySizeLimitWarning($limitexceeded);
$parameters = '';
Html::printPager($start, $numrows, $target, $parameters);
// delete end
array_splice($ldap_groups, $start + $_SESSION['glpilist_limit']);
// delete begin
if ($start > 0) {
array_splice($ldap_groups, 0, $start);
}
echo "<div class='center'>";
Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
$massiveactionparams = array('num_displayed' => min($_SESSION['glpilist_limit'], count($ldap_groups)), 'container' => 'mass' . __CLASS__ . $rand, 'specific_actions' => array(__CLASS__ . MassiveAction::CLASS_ACTION_SEPARATOR . 'import_group' => _sx('button', 'Import')), 'extraparams' => array('massive_action_fields' => array('dn', 'ldap_import_type', 'ldap_import_entities', 'ldap_import_recursive')));
Html::showMassiveActions($massiveactionparams);
echo "<table class='tab_cadre_fixe'>";
echo "<tr>";
echo "<th width='10'>";
Html::showCheckbox(array('criterion' => array('tag_for_massive' => 'select_item')));
echo "</th>";
$header_num = 0;
echo Search::showHeaderItem(Search::HTML_OUTPUT, __('Group'), $header_num, $target . "?order=" . ($order == "DESC" ? "ASC" : "DESC"), 1, $order);
echo "<th>" . __('Group DN') . "</th>";
echo "<th>" . __('Destination entity') . "</th>";
if (Session::isMultiEntitiesMode()) {
echo "<th>" . __('Child entities') . "</th>";
}
echo "</tr>";
$dn_index = 0;
foreach ($ldap_groups as $groupinfos) {
$group = $groupinfos["cn"];
$group_dn = $groupinfos["dn"];
$search_type = $groupinfos["search_type"];
echo "<tr class='tab_bg_2 center'>";
echo "<td>";
echo Html::hidden("dn[{$dn_index}]", array('value' => $group_dn, 'data-glpicore-ma-tags' => 'common'));
echo Html::hidden("ldap_import_type[{$dn_index}]", array('value' => $search_type, 'data-glpicore-ma-tags' => 'common'));
Html::showMassiveActionCheckBox(__CLASS__, $dn_index, array('massive_tags' => 'select_item'));
echo "</td>";
echo "<td>" . $group . "</td>";
echo "<td>" . $group_dn . "</td>";
echo "<td>";
Entity::dropdown(array('value' => $entity, 'name' => "ldap_import_entities[{$dn_index}]", 'specific_tags' => array('data-glpicore-ma-tags' => 'common')));
echo "</td>";
if (Session::isMultiEntitiesMode()) {
echo "<td>";
Html::showCheckbox(array('name' => "ldap_import_recursive[{$dn_index}]", 'specific_tags' => array('data-glpicore-ma-tags' => 'common')));
echo "</td>";
} else {
echo Html::hidden("ldap_import_recursive[{$dn_index}]", array('value' => 0, 'data-glpicore-ma-tags' => 'common'));
}
echo "</tr>\n";
$dn_index++;
}
$massiveactionparams['ontop'] = false;
Html::showMassiveActions($massiveactionparams);
Html::closeForm();
echo "</div>";
Html::printPager($start, $numrows, $target, $parameters);
} else {
echo "<div class='center b'>" . __('No group to be imported') . "</div>";
}
} else {
echo "<div class='center b'>" . __('No group to be imported') . "</div>";
}
}
示例5: 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>";
}
示例6: listPackagesToImport
/**
* Display list of packages to import
*/
function listPackagesToImport()
{
$rand = mt_rand();
echo "<div class='spaced'>";
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'>";
echo "<th colspan='5'>";
echo __('Packages to import', 'fusioninventory');
echo "</th>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand) . "</th>";
echo "<th>";
echo __('Name');
echo "</th>";
echo "<th>";
echo __('uuid');
echo "</th>";
echo "<th>";
echo __('Package to update');
echo "</th>";
echo "</tr>";
foreach (glob(GLPI_PLUGIN_DOC_DIR . "/fusioninventory/files/import/*.zip") as $file) {
echo "<tr class='tab_bg_1'>";
$file = str_replace(GLPI_PLUGIN_DOC_DIR . "/fusioninventory/files/import/", "", $file);
$split = explode('.', $file);
echo "<td>";
Html::showMassiveActionCheckBox(__CLASS__, $file);
echo "</td>";
echo "<td>";
echo $split[2];
echo "</td>";
echo "<td>";
echo $split[0] . "." . $split[1];
echo "</td>";
echo "<td>";
$a_packages = current($this->find("`uuid`='" . $split[0] . "." . $split[1] . "'", '', 1));
if (count($a_packages) > 1) {
$this->getFromDB($a_packages['id']);
echo $this->getLink();
}
echo "</td>";
echo "</tr>";
}
echo "</table>";
$massiveactionparams['ontop'] = false;
Html::showMassiveActions($massiveactionparams);
echo "</div>";
}
示例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'> </td>";
}
echo "<td class='tab_bg_1'> </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\"> ";
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'> </td>";
}
//.........这里部分代码省略.........
示例8: showForChange
/**
* Show problems for a change
*
* @param $change Change object
**/
static function showForChange(Change $change)
{
global $DB, $CFG_GLPI;
$ID = $change->getField('id');
if (!$change->can($ID, 'r')) {
return false;
}
$canedit = $change->can($ID, 'w');
$rand = mt_rand();
$showentities = Session::isMultiEntitiesMode();
$query = "SELECT DISTINCT `glpi_changes_problems`.`id` AS linkID,\n `glpi_problems`.*\n FROM `glpi_changes_problems`\n LEFT JOIN `glpi_problems`\n ON (`glpi_changes_problems`.`problems_id` = `glpi_problems`.`id`)\n WHERE `glpi_changes_problems`.`changes_id` = '{$ID}'\n ORDER BY `glpi_problems`.`name`";
$result = $DB->query($query);
$problems = array();
$used = array();
if ($numrows = $DB->numrows($result)) {
while ($data = $DB->fetch_assoc($result)) {
$problems[$data['id']] = $data;
$used[$data['id']] = $data['id'];
}
}
if ($canedit) {
echo "<div class='firstbloc'>";
echo "<form name='changeproblem_form{$rand}' id='changeproblem_form{$rand}' method='post'\n action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_2'><th colspan='2'>" . __('Add a problem') . "</th></tr>";
echo "<tr class='tab_bg_2'><td>";
echo "<input type='hidden' name='changes_id' value='{$ID}'>";
Problem::dropdown(array('used' => $used, 'entity' => $change->getEntityID()));
echo "</td><td class='center'>";
echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
echo "</td></tr></table>";
Html::closeForm();
echo "</div>";
}
echo "<div class='spaced'>";
if ($canedit && $numrows) {
Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
$massiveactionparams = array('num_displayed' => $numrows);
Html::showMassiveActions(__CLASS__, $massiveactionparams);
}
echo "<table class='tab_cadre_fixehov'>";
echo "<tr>";
if ($canedit && $numrows) {
echo "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand) . "</th>";
}
echo "<th>" . _n('Problem', 'Problems', 2) . "</th>";
if ($showentities) {
echo "<th>" . __('Entity') . "</th>";
}
echo "</tr>";
$used = array();
if ($numrows) {
Session::initNavigateListItems('Problem', sprintf(__('%1$s = %2$s'), Change::getTypeName(1), $change->fields["name"]));
foreach ($problems as $data) {
Session::addToNavigateListItems('Problem', $data["id"]);
echo "<tr class='tab_bg_1'>";
if ($canedit) {
echo "<td width='10'>";
Html::showMassiveActionCheckBox(__CLASS__, $data["linkID"]);
echo "</td>";
}
echo "<td><a href='" . Toolbox::getItemTypeFormURL('Problem') . "?id=" . $data['id'] . "'>" . $data["name"] . "</a></td>";
if ($showentities) {
echo "<td>" . Dropdown::getDropdownName('glpi_entities', $data["entities_id"]) . "</td>";
}
echo "</tr>";
}
}
echo "</table>";
if ($canedit && $numrows) {
$massiveactionparams['ontop'] = false;
Html::showMassiveActions(__CLASS__, $massiveactionparams);
Html::closeForm();
}
echo "</div>";
}
示例9: showPluginFromItems
public function showPluginFromItems($itemtype, $ID, $withtemplate = '')
{
global $DB, $CFG_GLPI;
$item = new $itemtype();
$canread = $item->can($ID, READ);
$canedit = $item->can($ID, UPDATE);
$table = $this->getTable();
$rand = mt_rand();
$PluginConnectionsConnection = new PluginConnectionsConnection();
$entitiesRestrict = getEntitiesRestrictRequest(" AND ", "glpi_plugin_connections_connections", '', '', $PluginConnectionsConnection->maybeRecursive());
if ($canedit) {
echo "<div class='firstbloc'>";
echo "<form name='connection_form{$rand}' id='connection_form{$rand}' method='post'\n action='" . $CFG_GLPI["root_doc"] . "/plugins/connections/front/connection.form.php'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_2'><th colspan='2'>" . __('Add an item') . "</th></tr>";
echo "<tr class='tab_bg_1'><td class='right'>";
Dropdown::showSelectItemFromItemtypes(array('itemtypes' => array('PluginConnectionsConnection'), 'entity_restrict' => $item->fields['is_recursive'] ? getSonsOf('glpi_entities', $item->fields['entities_id']) : $item->fields['entities_id'], 'checkright' => true, 'items_id_name' => 'plugin_connections_connections_id'));
echo "</td><td class='center'>";
echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
echo "<input type='hidden' name='items_id' value='{$ID}'>";
echo "<input type='hidden' name='additem' value='true'>";
echo "<input type='hidden' name='itemtype' value='NetworkEquipment'>";
echo "</td></tr>";
echo "</table>";
Html::closeForm();
echo "</div>";
}
$query = "SELECT t.`id` AS IDD, `glpi_plugin_connections_connections`.*\n FROM `{$table}` t, `glpi_plugin_connections_connections`\n LEFT JOIN `glpi_entities` ON (`glpi_entities`.`id` = `glpi_plugin_connections_connections`.`entities_id`)\n WHERE t.`items_id` = '{$ID}'\n AND t.`itemtype` = '{$itemtype}'\n AND t.`plugin_connections_connections_id` = `glpi_plugin_connections_connections`.`id`\n {$entitiesRestrict}\n ORDER BY `glpi_plugin_connections_connections`.`name` ";
$result = $DB->query($query);
$number = $DB->numrows($result);
echo "<div class='spaced'>";
if ($canedit && $number) {
Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
$massiveactionparams = array('container' => 'mass' . __CLASS__ . $rand);
Html::showMassiveActions($massiveactionparams);
}
echo "<table class='tab_cadre_fixehov'>";
$header_begin = "<tr>";
$header_top = '';
$header_bottom = '';
$header_end = '';
if ($canedit && $number) {
$header_top .= "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
$header_top .= "</th>";
$header_bottom .= "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
$header_bottom .= "</th>";
}
$header_end .= "<th>" . __('Entity') . "</th>";
$header_end .= "<th>" . __('Name') . "</th>";
$header_end .= "<th>" . __('Type of Connections', 'connections') . "</th>";
$header_end .= "<th>" . __('Rates', 'connections') . "</th>";
$header_end .= "<th>" . __('Guaranteed Rates', 'connections') . "</th>";
if ($number) {
echo $header_begin . $header_top . $header_end;
}
while ($data = $DB->fetch_array($result)) {
$name = $data["name"];
if ($_SESSION["glpiis_ids_visible"] || empty($data["name"])) {
$name = sprintf(__('%1$s (%2$s)'), $name, $data["id"]);
}
if ($_SESSION['glpiactiveprofile']['interface'] != 'helpdesk') {
$link = PluginConnectionsConnection::getFormURLWithID($data['id']);
$namelink = "<a href=\"" . $link . "\">" . $name . "</a>";
} else {
$namelink = $name;
}
echo "<tr class='tab_bg_1'>";
if ($canedit) {
echo "<td width='10'>";
Html::showMassiveActionCheckBox(__CLASS__, $data["IDD"]);
echo "</td>";
}
echo "<td class='center'>";
echo Dropdown::getDropdownName("glpi_entities", $data['entities_id']) . "</td>";
echo "<td class='center" . (isset($data['is_deleted']) && $data['is_deleted'] ? " tab_bg_2_2'" : "'");
echo ">" . $namelink . "</td>";
echo "<td class='center'>";
echo Dropdown::getDropdownName(getTableForItemType('PluginConnectionsConnectionType'), $data['plugin_connections_connectiontypes_id']) . "</td>";
echo "<td class='center'>";
echo Dropdown::getDropdownName(getTableForItemType('PluginConnectionsConnectionRate'), $data['plugin_connections_connectionrates_id']) . "</td>";
echo "<td class='center'>";
echo Dropdown::getDropdownName(getTableForItemType('PluginConnectionsGuaranteedConnectionRate'), $data['plugin_connections_guaranteedconnectionrates_id']) . "</td>";
echo "</tr>";
}
if ($number) {
echo $header_begin . $header_bottom . $header_end;
}
echo "</table>";
if ($canedit && $number) {
$massiveactionparams['ontop'] = false;
Html::showMassiveActions($massiveactionparams);
Html::closeForm();
}
echo "</div>";
}
示例10: showForItem
//.........这里部分代码省略.........
PluginResourcesResource::dropdown(array('entity' => $entities, 'used' => $used));
echo "</td><td class='center' width='20%'>";
echo "<input type='submit' name='additem' value=\"" . __s('Associate a resource', 'resources') . "\" class='submit'>";
echo "</td>";
echo "</tr>";
echo "</table>";
Html::closeForm();
}
echo "</div>";
}
echo "<div class='spaced'>";
if ($canedit && $number && $withtemplate < 2) {
Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
$massiveactionparams = array('num_displayed' => $number);
Html::showMassiveActions(__CLASS__, $massiveactionparams);
}
echo "<table class='tab_cadre_fixe'>";
if (Session::isMultiEntitiesMode()) {
$colsup = 1;
} else {
$colsup = 0;
}
echo "<tr>";
if ($canedit && $number && $withtemplate < 2) {
echo "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand) . "</th>";
}
echo "<th>" . __('Name') . "</th>";
echo "<th>" . __('First name') . "</th>";
if (Session::isMultiEntitiesMode()) {
echo "<th>" . __('Entity') . "</th>";
}
echo "<th>" . __('Location') . "</th>";
echo "<th>" . PluginResourcesContractType::getTypeName(1) . "</th>";
echo "<th>" . PluginResourcesDepartment::getTypeName(1) . "</th>";
echo "<th>" . __('Arrival date', 'resources') . "</th>";
echo "<th>" . __('Departure date', 'resources') . "</th>";
echo "</tr>";
$used = array();
$resourceID = 0;
if ($number) {
Session::initNavigateListItems('PluginResourcesResource', sprintf(__('%1$s = %2$s'), $item->getTypeName(1), $item->getName()));
foreach ($resources as $data) {
$resourceID = $data["id"];
$link = NOT_AVAILABLE;
if ($resource->getFromDB($resourceID)) {
$link = $resource->getLink();
}
Session::addToNavigateListItems('PluginResourcesResource', $resourceID);
$used[$resourceID] = $resourceID;
$assocID = $data["assocID"];
echo "<tr class='tab_bg_1" . ($data["is_deleted"] ? "_2" : "") . "'>";
if ($canedit && $withtemplate < 2) {
echo "<td width='10'>";
Html::showMassiveActionCheckBox(__CLASS__, $data["assocID"]);
echo "</td>";
}
echo "<td class='center'>{$link}</td>";
echo "<td class='center'>" . $data['firstname'] . "</td>";
if (Session::isMultiEntitiesMode()) {
echo "<td class='center'>" . Dropdown::getDropdownName("glpi_entities", $data['entities_id']) . "</td>";
}
echo "<td class='center'>";
echo Dropdown::getDropdownName("glpi_locations", $data["locations_id"]);
echo "</td>";
echo "<td class='center'>";
echo Dropdown::getDropdownName("glpi_plugin_resources_contracttypes", $data["plugin_resources_contracttypes_id"]);
echo "</td>";
echo "<td class='center'>";
echo Dropdown::getDropdownName("glpi_plugin_resources_departments", $data["plugin_resources_departments_id"]);
echo "</td>";
echo "<td class='center'>" . Html::convDate($data["date_begin"]) . "</td>";
if ($data["date_end"] <= date('Y-m-d') && !empty($data["date_end"])) {
echo "<td class='center'>";
echo "<span class='plugin_resources_date_color'>";
echo Html::convDate($data["date_end"]);
echo "</span>";
echo "</td>";
} else {
if (empty($data["date_end"])) {
echo "<td class='center'>" . __('Not defined', 'resources') . "</td>";
} else {
echo "<td class='center'>" . Html::convDate($data["date_end"]) . "</td>";
}
}
echo "</tr>";
$i++;
}
}
echo "</table>";
if ($canedit && $number && $withtemplate < 2) {
$massiveactionparams['ontop'] = false;
Html::showMassiveActions(__CLASS__, $massiveactionparams);
Html::closeForm();
}
echo "</div>";
if ($item->getType() == "User") {
$PluginResourcesEmployee = new PluginResourcesEmployee();
$PluginResourcesEmployee->showForm($resourceID, $ID, 0);
}
}
示例11: showTeam
/**
* Show team for a project task
*
* @param $task ProjectTask object
*
* @return boolean
**/
function showTeam(ProjectTask $task)
{
global $DB, $CFG_GLPI;
/// TODO : permit to simple add member of project team ?
$ID = $task->fields['id'];
$canedit = $task->canEdit($ID);
$rand = mt_rand();
$nb = 0;
$nb = $task->getTeamCount();
if ($canedit) {
echo "<div class='firstbloc'>";
echo "<form name='projecttaskteam_form{$rand}' id='projecttaskteam_form{$rand}' ";
echo " method='post' action='" . Toolbox::getItemTypeFormURL('ProjectTaskTeam') . "'>";
echo "<input type='hidden' name='projecttasks_id' value='{$ID}'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_1'><th colspan='2'>" . __('Add a team member') . "</tr>";
echo "<tr class='tab_bg_2'><td>";
$params = array('itemtypes' => ProjectTeam::$available_types, 'entity_restrict' => $task->fields['is_recursive'] ? getSonsOf('glpi_entities', $task->fields['entities_id']) : $task->fields['entities_id']);
$addrand = Dropdown::showSelectItemFromItemtypes($params);
echo "</td>";
echo "<td width='20%'>";
echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
echo "</td>";
echo "</tr>";
echo "</table>";
Html::closeForm();
echo "</div>";
}
echo "<div class='spaced'>";
if ($canedit && $nb) {
Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
$massiveactionparams = array('num_displayed' => $nb, 'container' => 'mass' . __CLASS__ . $rand);
// 'specific_actions'
// => array('delete' => _x('button', 'Delete permanently')) );
//
// if ($this->fields['users_id'] != Session::getLoginUserID()) {
// $massiveactionparams['confirm']
// = __('Caution! You are not the author of this element. Delete targets can result in loss of access to that element.');
// }
Html::showMassiveActions($massiveactionparams);
}
echo "<table class='tab_cadre_fixehov'>";
$header_begin = "<tr>";
$header_top = '';
$header_bottom = '';
$header_end = '';
if ($canedit && $nb) {
$header_top .= "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
$header_top .= "</th>";
$header_bottom .= "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
$header_bottom .= "</th>";
}
$header_end .= "<th>" . __('Type') . "</th>";
$header_end .= "<th>" . _n('Member', 'Members', Session::getPluralNumber()) . "</th>";
$header_end .= "</tr>";
echo $header_begin . $header_top . $header_end;
foreach (ProjectTaskTeam::$available_types as $type) {
if (isset($task->team[$type]) && count($task->team[$type])) {
if ($item = getItemForItemtype($type)) {
foreach ($task->team[$type] as $data) {
$item->getFromDB($data['items_id']);
echo "<tr class='tab_bg_2'>";
if ($canedit) {
echo "<td>";
Html::showMassiveActionCheckBox('ProjectTaskTeam', $data["id"]);
echo "</td>";
}
echo "<td>" . $item->getTypeName(1) . "</td>";
echo "<td>" . $item->getLink() . "</td>";
echo "</tr>";
}
}
}
}
if ($nb) {
echo $header_begin . $header_bottom . $header_end;
}
echo "</table>";
if ($canedit && $nb) {
$massiveactionparams['ontop'] = false;
Html::showMassiveActions($massiveactionparams);
Html::closeForm();
}
echo "</div>";
// Add items
return true;
}
示例12: showForPrinter
//.........这里部分代码省略.........
$header_bottom = '';
$header_end = '';
if ($canedit) {
$header_begin .= "<th width='10'>";
$header_top .= Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
$header_bottom .= Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
$header_end .= "</th>";
}
$header_end .= "<th>" . __('ID') . "</th><th>" . _n('Cartridge model', 'Cartridge models', 1) . "</th>";
$header_end .= "<th>" . _n('Cartridge type', 'Cartridge types', 1) . "</th>";
$header_end .= "<th>" . __('Add date') . "</th>";
$header_end .= "<th>" . __('Use date') . "</th>";
if ($old != 0) {
$header_end .= "<th>" . __('End date') . "</th>";
$header_end .= "<th>" . __('Printer counter') . "</th>";
$header_end .= "<th>" . __('Printed pages') . "</th>";
}
$header_end .= "</tr>";
echo $header_begin . $header_top . $header_end;
$stock_time = 0;
$use_time = 0;
$pages_printed = 0;
$nb_pages_printed = 0;
while ($data = $DB->fetch_assoc($result)) {
$cart_id = $data["id"];
$typename = $data["typename"];
$date_in = Html::convDate($data["date_in"]);
$date_use = Html::convDate($data["date_use"]);
$date_out = Html::convDate($data["date_out"]);
$viewitemjs = $canedit ? "style='cursor:pointer' onClick=\"viewEditCartridge" . $data['id'] . "{$rand}();\"" : '';
echo "<tr class='tab_bg_1" . ($data["is_deleted"] ? "_2" : "") . "'>";
if ($canedit) {
echo "<td width='10'>";
Html::showMassiveActionCheckBox(__CLASS__, $data["id"]);
echo "</td>";
}
echo "<td class='center' {$viewitemjs}>";
if ($canedit) {
echo "\n<script type='text/javascript' >\n";
echo "function viewEditCartridge" . $data["id"] . "{$rand}() {\n";
$params = array('type' => __CLASS__, 'parenttype' => 'Printer', 'printers_id' => $printer->fields["id"], 'id' => $data["id"]);
Ajax::updateItemJsCode("viewcartridge{$rand}", $CFG_GLPI["root_doc"] . "/ajax/viewsubitem.php", $params);
echo "};";
echo "</script>\n";
}
echo $data["id"] . "</td>";
echo "<td class='center' {$viewitemjs}>";
echo "<a href=\"" . $CFG_GLPI["root_doc"] . "/front/cartridgeitem.form.php?id=" . $data["tID"] . "\">";
printf(__('%1$s - %2$s'), $data["type"], $data["ref"]);
echo "</a></td>";
echo "<td class='center' {$viewitemjs}>" . $typename . "</td>";
echo "<td class='center' {$viewitemjs}>" . $date_in . "</td>";
echo "<td class='center' {$viewitemjs}>" . $date_use . "</td>";
$tmp_dbeg = explode("-", $data["date_in"]);
$tmp_dend = explode("-", $data["date_use"]);
$stock_time_tmp = mktime(0, 0, 0, $tmp_dend[1], $tmp_dend[2], $tmp_dend[0]) - mktime(0, 0, 0, $tmp_dbeg[1], $tmp_dbeg[2], $tmp_dbeg[0]);
$stock_time += $stock_time_tmp;
if ($old != 0) {
echo "<td class='center' {$viewitemjs}>" . $date_out;
$tmp_dbeg = explode("-", $data["date_use"]);
$tmp_dend = explode("-", $data["date_out"]);
$use_time_tmp = mktime(0, 0, 0, $tmp_dend[1], $tmp_dend[2], $tmp_dend[0]) - mktime(0, 0, 0, $tmp_dbeg[1], $tmp_dbeg[2], $tmp_dbeg[0]);
$use_time += $use_time_tmp;
echo "</td><td class='numeric' {$viewitemjs}>" . $data['pages'] . "</td>";
echo "<td class='numeric' {$viewitemjs}>";
if ($pages < $data['pages']) {
示例13: showForm
function showForm(CommonDBTM $item, $options = array())
{
$ID = $item->getField('id');
if ($item->isNewID($ID)) {
return false;
}
if (!$item->can($item->fields['id'], READ)) {
return false;
}
$rand = mt_rand();
$a_data = getAllDatasFromTable('glpi_plugin_fusioninventory_ipranges_configsecurities', "`plugin_fusioninventory_ipranges_id`='" . $item->getID() . "'", false, '`rank`');
$a_used = array();
foreach ($a_data as $data) {
$a_used[] = $data['plugin_fusioninventory_configsecurities_id'];
}
echo "<div class='firstbloc'>";
echo "<form name='iprange_configsecurity_form{$rand}' id='iprange_configsecurity_form{$rand}' method='post'\n action='" . Toolbox::getItemTypeFormURL('PluginFusioninventoryIPRange_ConfigSecurity') . "' >";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_2'>";
echo "<th colspan='2'>" . __('Add a SNMP authentication') . "</th>";
echo "</tr>";
echo "<tr class='tab_bg_2'>";
echo "<td>";
Dropdown::show('PluginFusioninventoryConfigSecurity', array('used' => $a_used));
echo "</td>";
echo "<td>";
echo Html::hidden('plugin_fusioninventory_ipranges_id', array('value' => $item->getID()));
echo "<input type='submit' name='add' value=\"" . _sx('button', 'Associate') . "\" class='submit'>";
echo "</td>";
echo "</tr>";
echo "</table>";
Html::closeForm();
echo "</div>";
// Display list of auth associated with IP range
$rand = mt_rand();
echo "<div class='spaced'>";
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_2'>";
echo "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand) . "</th>";
echo "<th>";
echo __('SNMP Authentication', 'fusioninventory');
echo "</th>";
echo "<th>";
echo __('Version', 'fusioninventory');
echo "</th>";
echo "<th>";
echo __('Rank');
echo "</th>";
echo "</tr>";
$pfConfigSecurity = new PluginFusioninventoryConfigSecurity();
foreach ($a_data as $data) {
echo "<tr class='tab_bg_2'>";
echo "<td>";
Html::showMassiveActionCheckBox(__CLASS__, $data["id"]);
echo "</td>";
echo "<td>";
$pfConfigSecurity->getFromDB($data['plugin_fusioninventory_configsecurities_id']);
echo $pfConfigSecurity->getLink();
echo "</td>";
echo "<td>";
echo $pfConfigSecurity->getSNMPVersion($pfConfigSecurity->fields['snmpversion']);
echo "</td>";
echo "<td>";
echo $data['rank'];
echo "</td>";
echo "</tr>";
}
echo "</table>";
$massiveactionparams['ontop'] = false;
Html::showMassiveActions($massiveactionparams);
echo "</div>";
}
示例14: showBookmarkList
//.........这里部分代码省略.........
}
$rand = mt_rand();
$numrows = $DB->numrows($result);
Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
echo "<div class='center' id='tabsbody' >";
$maactions = array('purge' => _x('button', 'Delete permanently'));
if ($is_private) {
$maactions[__CLASS__ . MassiveAction::CLASS_ACTION_SEPARATOR . 'move_bookmark'] = __('Move');
}
$massiveactionparams = array('num_displayed' => $numrows, 'container' => 'mass' . __CLASS__ . $rand, 'width' => 600, 'extraparams' => array('is_private' => $is_private), 'height' => 200, 'specific_actions' => $maactions);
// No massive action on bottom
echo "<table class='tab_cadre_fixehov'>";
echo "<tr>";
echo "<th>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand) . "</th>";
echo "<th class='center' colspan='2'>" . _n('Bookmark', 'Bookmarks', Session::getPluralNumber()) . "</th>";
echo "<th width='20px'> </th>";
echo "<th>" . __('Default view') . "</th>";
$colspan = 5;
if ($is_private) {
$colspan += 2;
echo "<th colspan='2'> </th>";
}
echo "</tr>";
if ($totalcount = count($ordered_bookmarks)) {
$current_type = -1;
$number = 0;
$current_type_name = NOT_AVAILABLE;
foreach ($ordered_bookmarks as $key => $this->fields) {
$number++;
if ($current_type != $this->fields['itemtype']) {
$current_type = $this->fields['itemtype'];
$current_type_name = NOT_AVAILABLE;
if ($current_type == "AllAssets") {
$current_type_name = __('Global');
} else {
if ($item = getItemForItemtype($current_type)) {
$current_type_name = $item->getTypeName(1);
}
}
}
$canedit = $this->canEdit($this->fields["id"]);
echo "<tr class='tab_bg_1'>";
echo "<td width='10px'>";
if ($canedit) {
Html::showMassiveActionCheckBox(__CLASS__, $this->fields["id"]);
} else {
echo " ";
}
echo "</td>";
echo "<td>{$current_type_name}</td>";
echo "<td>";
if ($canedit) {
echo "<a href=\"" . $CFG_GLPI['root_doc'] . "/front/bookmark.php?action=edit&id=" . $this->fields["id"] . "\" alt='" . _sx('button', 'Update') . "'>" . $this->fields["name"] . "</a>";
} else {
echo $this->fields["name"];
}
echo "</td>";
echo "<td><a href=\"" . $CFG_GLPI['root_doc'] . "/front/bookmark.php?action=load&id=" . $this->fields["id"] . "\" class='vsubmit'>" . __('Load') . "</a>";
echo "</td>";
echo "<td class='center'>";
if ($this->fields['type'] == self::SEARCH) {
if (is_null($this->fields['IS_DEFAULT'])) {
echo "<a href=\"" . $CFG_GLPI['root_doc'] . "/front/bookmark.php?action=edit&" . "mark_default=1&id=" . $this->fields["id"] . "\" alt=\"" . __s('Not default search') . "\" itle=\"" . __s('Not default search') . "\">" . "<img src=\"" . $CFG_GLPI['root_doc'] . "/pics/bookmark_record.png\" class='pointer'></a>";
} else {
echo "<a href=\"" . $CFG_GLPI['root_doc'] . "/front/bookmark.php?action=edit&" . "mark_default=0&id=" . $this->fields["id"] . "\" alt=\"" . __s('Default search') . "\" title=\"" . __s('Default search') . "\">" . "<img src=\"" . $CFG_GLPI['root_doc'] . "/pics/bookmark_default.png\" class='pointer'></a>";
}
}
echo "</td>";
if ($is_private) {
if ($number != 1) {
echo "<td>";
Html::showSimpleForm($this->getSearchURL(), array('action' => 'up'), '', array('id' => $this->fields["id"]), $CFG_GLPI["root_doc"] . "/pics/deplier_up.png");
echo "</td>";
} else {
echo "<td> </td>";
}
if ($number != $totalcount) {
echo "<td>";
Html::showSimpleForm($this->getSearchURL(), array('action' => 'down'), '', array('id' => $this->fields["id"]), $CFG_GLPI["root_doc"] . "/pics/deplier_down.png");
echo "</td>";
} else {
echo "<td> </td>";
}
}
echo "</tr>";
$first = false;
}
echo "</table></div>";
if ($is_private || Session::haveRight('bookmark_public', PURGE)) {
$massiveactionparams['ontop'] = false;
$massiveactionparams['forcecreate'] = true;
Html::showMassiveActions($massiveactionparams);
}
} else {
echo "<tr class='tab_bg_1'><td colspan='{$colspan}'>";
_e('You have not recorded any bookmarks yet');
echo "</td></tr></table>";
}
Html::closeForm();
}
示例15: showForNetworkPort
/**
* @param $port NetworkPort object
**/
static function showForNetworkPort(NetworkPort $port)
{
global $DB, $CFG_GLPI;
$ID = $port->getID();
if (!$port->can($ID, READ)) {
return false;
}
$canedit = $port->canEdit($ID);
$rand = mt_rand();
$query = "SELECT `glpi_networkports_vlans`.id as assocID,\n `glpi_networkports_vlans`.tagged ,\n `glpi_vlans`.*\n FROM `glpi_networkports_vlans`\n LEFT JOIN `glpi_vlans`\n ON (`glpi_networkports_vlans`.`vlans_id` = `glpi_vlans`.`id`)\n WHERE `networkports_id` = '{$ID}'";
$result = $DB->query($query);
$vlans = array();
$used = array();
if ($number = $DB->numrows($result)) {
while ($line = $DB->fetch_assoc($result)) {
$used[$line["id"]] = $line["id"];
$vlans[$line["assocID"]] = $line;
}
}
if ($canedit) {
echo "<div class='firstbloc'>\n";
echo "<form method='post' action='" . static::getFormURL() . "'>\n";
echo "<table class='tab_cadre_fixe'>\n";
echo "<tr><th colspan='4'>" . __('Associate a VLAN') . "</th></tr>";
echo "<tr class='tab_bg_1'><td class='right'>";
echo "<input type='hidden' name='networkports_id' value='{$ID}'>";
Vlan::dropdown(array('used' => $used));
echo "</td>";
echo "<td class='right'>" . __('Tagged') . "</td>";
echo "<td class='left'><input type='checkbox' name='tagged' value='1'></td>";
echo "<td><input type='submit' name='add' value='" . _sx('button', 'Associate') . "' class='submit'>";
echo "</td></tr>\n";
echo "</table>\n";
Html::closeForm();
echo "</div>\n";
}
echo "<div class='spaced'>";
if ($canedit && $number) {
Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
$massiveactionparams = array('num_displayed' => $number, 'container' => 'mass' . __CLASS__ . $rand);
Html::showMassiveActions($massiveactionparams);
}
echo "<table class='tab_cadre_fixehov'>";
$header_begin = "<tr>";
$header_top = '';
$header_bottom = '';
$header_end = '';
if ($canedit && $number) {
$header_top .= "<th width='10'>";
$header_top .= Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand) . "</th>";
$header_bottom .= "<th width='10'>";
$header_bottom .= Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand) . "</th>";
}
$header_end .= "<th>" . __('Name') . "</th>";
$header_end .= "<th>" . __('Entity') . "</th>";
$header_end .= "<th>" . __('Tagged') . "</th>";
$header_end .= "<th>" . __('ID TAG') . "</th>";
$header_end .= "</tr>";
echo $header_begin . $header_top . $header_end;
$used = array();
foreach ($vlans as $data) {
echo "<tr class='tab_bg_1'>";
if ($canedit) {
echo "<td>";
Html::showMassiveActionCheckBox(__CLASS__, $data["assocID"]);
echo "</td>";
}
$name = $data["name"];
if ($_SESSION["glpiis_ids_visible"] || empty($data["name"])) {
$name = sprintf(__('%1$s (%2$s)'), $name, $data["id"]);
}
echo "<td class='center b'>\n <a href='" . $CFG_GLPI["root_doc"] . "/front/vlan.form.php?id=" . $data["id"] . "'>" . $name . "</a>";
echo "</td>";
echo "<td class='center'>" . Dropdown::getDropdownName("glpi_entities", $data["entities_id"]);
echo "</td><td class='center'>" . Dropdown::getYesNo($data["tagged"]) . "</td>";
echo "<td class='numeric'>" . $data["tag"] . "</td>";
echo "</tr>";
}
if ($number) {
echo $header_begin . $header_top . $header_end;
}
echo "</table>";
if ($canedit && $number) {
$massiveactionparams['ontop'] = false;
Html::showMassiveActions($massiveactionparams);
Html::closeForm();
}
echo "</div>";
}