本文整理汇总了PHP中getItemTypeFormURL函数的典型用法代码示例。如果您正苦于以下问题:PHP getItemTypeFormURL函数的具体用法?PHP getItemTypeFormURL怎么用?PHP getItemTypeFormURL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getItemTypeFormURL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showNewRuleForm
function showNewRuleForm($ID)
{
global $LANG;
echo "<form method='post' action='" . getItemTypeFormURL('Entity') . "'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th colspan='2'>" . $LANG['rulesengine'][19] . "</th></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][16] . " : ";
autocompletionTextField($this, "name", array('value' => '', 'size' => 33));
echo " " . $LANG['joblist'][6] . " : ";
autocompletionTextField($this, "description", array('value' => '', 'size' => 33));
echo " " . $LANG['rulesengine'][9] . " : ";
$this->dropdownRulesMatch("match", "AND");
echo "</td><td rowspan='2' class='tab_bg_2 center middle'>";
echo "<input type=hidden name='sub_type' value='" . get_class($this) . "'>";
echo "<input type=hidden name='entities_id' value='-1'>";
echo "<input type=hidden name='affectentity' value='{$ID}'>";
echo "<input type=hidden name='_method' value='addRule'>";
echo "<input type='submit' name='execute' value=\"" . $LANG['buttons'][8] . "\" class='submit'>";
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td class='center'>" . $LANG['profiles'][22] . " : ";
Dropdown::show('Profile');
echo "<span class='small_space'>" . $LANG['profiles'][28] . "</span> : ";
Dropdown::showYesNo("is_recursive", 0);
echo "</td></tr>\n";
echo "</table></form>";
}
示例2: manageContacts
function manageContacts($items_id)
{
global $LANG;
$pmContact = new PluginMonitoringContact();
$user = new User();
$a_list = $this->find("`plugin_monitoring_hosts_id`='" . $items_id . "'");
echo "<form name='contacts_form' id='contacts_form'\n method='post' action=' ";
echo getItemTypeFormURL(__CLASS__) . "'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_1'>";
echo "<th colspan='3'>";
echo $LANG['plugin_monitoring']['contact'][20];
echo "</th>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td class='right'>";
$a_contacts = $pmContact->find();
$a_elements = array();
foreach ($a_contacts as $data) {
$user->getFromDB($data['users_id']);
$a_elements[$data['id']] = $user->getName();
}
asort($a_elements);
Dropdown::showFromArray('plugin_monitoring_contacts_id', $a_elements);
echo "</td>";
echo "<td class='center'>";
echo "<input type='submit' class='submit' name='parent_add' value='" . $LANG['buttons'][8] . " >>'>";
echo "<br><br>";
if ($a_list) {
echo "<input type='submit' class='submit' name='parent_delete' value='<< " . $LANG['buttons'][6] . "'>";
}
echo "</td>";
echo "<td>";
if ($a_list) {
echo "<select name='parent_to_delete[]' multiple size='5'>";
foreach ($a_list as $data) {
$pmContact->getFromDB($data['plugin_monitoring_contacts_id']);
$user->getFromDB($pmContact->fields['users_id']);
echo "<option value='" . $data['plugin_monitoring_contacts_id'] . "'>" . $user->getName() . "</option>";
}
echo "</select>";
} else {
echo " ";
}
echo "</td>";
echo "</tr>";
echo "</table>";
echo "<input type='hidden' name='id' value='" . $items_id . "' />";
echo "</form>";
}
示例3: showMergeCandidates
/**
* Show softwares candidates to be merged with the current
*
* @return nothing
**/
function showMergeCandidates()
{
global $DB, $CFG_GLPI, $LANG;
$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 ($req->numrows()) {
$link = getItemTypeFormURL('Software');
echo "<form method='post' name='mergesoftware_form{$rand}' id='mergesoftware_form{$rand}'\n action='" . $link . "'>";
echo "<table class='tab_cadre_fixehov'><tr><th> </th>";
echo "<th>" . $LANG['common'][16] . "</th>";
echo "<th>" . $LANG['entity'][0] . "</th>";
echo "<th>" . $LANG['software'][19] . "</th>";
echo "<th>" . $LANG['software'][11] . "</th></tr>";
foreach ($req as $data) {
echo "<tr class='tab_bg_2'>";
echo "<td><input type='checkbox' name='item[" . $data["id"] . "]' value='1'></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";
openArrowMassive("mergesoftware_form{$rand}", true);
echo "<input type='hidden' name='id' value='{$ID}'>";
closeArrowMassive('mergesoftware', $LANG['software'][48]);
echo "</form>";
} else {
echo $LANG['search'][15];
}
echo "</div>";
}
示例4: displaySoftsByLicense
/**
* Display a software for a License (not installed)
*
* @param $data data used to display
* @param $computers_id ID of the computer
* @param $withtemplate template case of the view process
* @param $canedit boolean user can edit software ?
*
* @return nothing
*/
private static function displaySoftsByLicense($data, $computers_id, $withtemplate, $canedit)
{
global $LANG, $CFG_GLPI;
if ($data["softwareversions_id_use"] > 0) {
$ID = $data["softwareversions_id_use"];
} else {
$ID = $data["softwareversions_id_buy"];
}
$multiple = false;
$link_item = getItemTypeFormURL('SoftwareLicense');
$link = $link_item . "?id=" . $data['id'];
echo "<tr class='tab_bg_1'>";
if ($canedit) {
echo "<td>";
if ((empty($withtemplate) || $withtemplate != 2) && $ID > 0) {
echo "<input type='checkbox' name='softversion_{$ID}'>";
}
echo "</td>";
}
echo "<td class='center b'>";
echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/software.form.php?id=" . $data['softwares_id'] . "'>";
echo $data["softname"] . ($_SESSION["glpiis_ids_visible"] ? " (" . $data['softwares_id'] . ")" : "");
echo "</a></td>";
echo "<td>" . $data["state"] . "</td>";
echo "<td>" . $data["version"];
if ((empty($withtemplate) || $withtemplate != 2) && $canedit && $ID > 0) {
echo " - <a href='" . $CFG_GLPI["root_doc"] . "/front/computer_softwareversion.form.php" . "?install=install&softwareversions_id={$ID}&computers_id={$computers_id}'>";
echo "<strong>" . $LANG['buttons'][4] . "</strong></a>";
}
echo "</td></td><td><strong>" . $data["name"] . "</strong> - " . $data["serial"] . " ";
if ($data["softwarelicensetypes_id"]) {
echo " (" . Dropdown::getDropdownName("glpi_softwarelicensetypes", $data["softwarelicensetypes_id"]) . ") ";
}
showToolTip($LANG['common'][16] . " : " . $data['name'] . "<br>" . $LANG['common'][19] . " : " . $data['serial'] . "<br>" . $data['comment'], array('link' => $link));
echo "</td></tr>\n";
}
示例5: showLdapUsers
/** Show LDAP users to add or synchronise
*
* @return nothing
**/
static function showLdapUsers()
{
global $CFG_GLPI, $LANG;
$values['order'] = 'DESC';
$values['start'] = 0;
foreach ($_SESSION['ldap_import'] as $option => $value) {
$values[$option] = $value;
}
$results = array();
$limitexceeded = false;
$ldap_users = self::getAllUsers($values, $results, $limitexceeded);
if (is_array($ldap_users)) {
$numrows = count($ldap_users);
$action = "toprocess";
$form_action = "process_ok";
if ($numrows > 0) {
if ($limitexceeded) {
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th class='red'>";
echo "<img class='center' src='" . $CFG_GLPI["root_doc"] . "/pics/warning.png'\n alt='warning'> " . $LANG['ldap'][8];
echo "</th></tr></table><br>";
}
printPager($values['start'], $numrows, $_SERVER['PHP_SELF'], '');
// delete end
array_splice($ldap_users, $values['start'] + $_SESSION['glpilist_limit']);
// delete begin
if ($values['start'] > 0) {
array_splice($ldap_users, 0, $values['start']);
}
echo "<form method='post' id='ldap_form' name='ldap_form' action='" . $_SERVER['PHP_SELF'] . "'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th>" . (!$_SESSION['ldap_import']['mode'] ? $LANG['buttons'][37] : $LANG['ldap'][15]) . "</th>";
$num = 0;
echo Search::showHeaderItem(HTML_OUTPUT, $LANG['Menu'][14], $num, $_SERVER['PHP_SELF'] . "?order=" . ($values['order'] == "DESC" ? "ASC" : "DESC"));
echo "<th>" . $LANG['common'][26] . " " . $LANG['ldap'][13] . "</th>";
if ($_SESSION['ldap_import']['mode']) {
echo "<th>" . $LANG['common'][26] . " " . $LANG['ldap'][14] . "</th>";
}
echo "</tr>";
foreach ($ldap_users as $userinfos) {
$link = $user = $userinfos["user"];
if (isset($userinfos['id']) && haveRight('user', 'r')) {
$link = "<a href='" . getItemTypeFormURL('User') . '?id=' . $userinfos['id'] . "'>{$user}</a>";
}
if (isset($userinfos["timestamp"])) {
$stamp = $userinfos["timestamp"];
} else {
$stamp = '';
}
if (isset($userinfos["date_sync"])) {
$date_sync = $userinfos["date_sync"];
} else {
$date_sync = '';
}
echo "<tr class='tab_bg_2 center'>";
//Need to use " instead of ' because it doesn't work with names with ' inside !
echo "<td><input type='checkbox' name=\"" . $action . "[" . $user . "]\"></td>";
echo "<td>" . $link . "</td>";
if ($stamp != '') {
echo "<td>" . convDateTime(date("Y-m-d H:i:s", $stamp)) . "</td>";
} else {
echo "<td> </td>";
}
if ($_SESSION['ldap_import']['mode']) {
if ($date_sync != '') {
echo "<td>" . convDateTime($date_sync) . "</td>";
} else {
echo "<td> </td>";
}
}
echo "</tr>";
}
if ($_SESSION['ldap_import']['mode']) {
$colspan = 6;
} else {
$colspan = 5;
}
echo "</table>";
openArrowMassive("ldap_form", true);
closeArrowMassive($form_action, $_SESSION['ldap_import']['mode'] ? $LANG['ldap'][15] : $LANG['buttons'][37]);
echo "</form>";
printPager($values['start'], $numrows, $_SERVER['PHP_SELF'], '');
} else {
echo "<div class='center b'>" . ($_SESSION['ldap_import']['mode'] ? $LANG['ldap'][43] : $LANG['ldap'][3]) . "</div>";
}
} else {
echo "<div class='center b'>" . ($_SESSION['ldap_import']['mode'] ? $LANG['ldap'][43] : $LANG['ldap'][3]) . "</div>";
}
}
示例6: showSummary
/**
* Print the validation list into ticket
*
* @param $ticket class
**/
function showSummary($ticket)
{
global $DB, $LANG, $CFG_GLPI;
if (!haveRight('validate_ticket', 1) && !haveRight('create_validation', 1)) {
return false;
}
$tID = $ticket->fields['id'];
//$canadd = haveRight("create_validation", "1");
$tmp = array('tickets_id' => $tID);
$canadd = $this->can(-1, 'w', $tmp);
$rand = mt_rand();
echo "<div id='viewfollowup" . $tID . "{$rand}'></div>\n";
if ($canadd) {
echo "<script type='text/javascript' >\n";
echo "function viewAddValidation" . $tID . "{$rand}() {\n";
$params = array('type' => __CLASS__, 'tickets_id' => $tID, 'id' => -1);
ajaxUpdateItemJsCode("viewfollowup" . $tID . "{$rand}", $CFG_GLPI["root_doc"] . "/ajax/viewfollowup.php", $params, false);
echo "};";
echo "</script>\n";
if ($ticket->fields["status"] != 'solved' && $ticket->fields["status"] != 'closed') {
echo "<div class='center'><a href='javascript:viewAddValidation" . $tID . "{$rand}();'>";
echo $LANG['validation'][1] . "</a></div><br>\n";
}
}
$query = "SELECT *\n FROM `" . $this->getTable() . "`\n WHERE `tickets_id` = '" . $ticket->getField('id') . "'";
if (!$canadd) {
$query .= " AND `users_id_validate` = '" . getLoginUserID() . "' ";
}
$query .= " ORDER BY submission_date DESC";
$result = $DB->query($query);
$number = $DB->numrows($result);
if ($number) {
$colonnes = array($LANG['validation'][2], $LANG['validation'][3], $LANG['validation'][18], $LANG['validation'][5], $LANG['validation'][4], $LANG['validation'][21], $LANG['validation'][6]);
$nb_colonnes = count($colonnes);
echo "<table class='tab_cadre_fixehov'>";
echo "<tr><th colspan='" . $nb_colonnes . "'>" . $LANG['validation'][7] . "</th></tr>";
echo "<tr>";
foreach ($colonnes as $colonne) {
echo "<th>" . $colonne . "</th>";
}
echo "</tr>";
initNavigateListItems('TicketValidation', $LANG['validation'][26] . " = " . $ticket->fields['name']);
while ($row = $DB->fetch_assoc($result)) {
$canedit = $this->can($row["id"], 'w');
addToNavigateListItems('TicketValidation', $row["id"]);
$bgcolor = $this->getStatusColor($row['status']);
$status = $this->getStatus($row['status']);
echo "<tr class='tab_bg_1' " . ($canedit ? "style='cursor:pointer' onClick=\"viewEditValidation" . $ticket->fields['id'] . $row["id"] . "{$rand}();\"" : '') . " id='viewfollowup" . $this->fields['tickets_id'] . $row["id"] . "{$rand}'>";
echo "<td>";
if ($canedit) {
echo "\n<script type='text/javascript' >\n";
echo "function viewEditValidation" . $ticket->fields['id'] . $row["id"] . "{$rand}() {\n";
$params = array('type' => __CLASS__, 'tickets_id' => $this->fields["tickets_id"], 'id' => $row["id"]);
ajaxUpdateItemJsCode("viewfollowup" . $ticket->fields['id'] . "{$rand}", $CFG_GLPI["root_doc"] . "/ajax/viewfollowup.php", $params, false);
echo "};";
echo "</script>\n";
}
echo "<div style='background-color:" . $bgcolor . ";'>" . $status . "</div></td>";
if ($ticket->can($ticket->fields['id'], 'r') && !strstr($ticket->fields["status"], "solved") && !strstr($ticket->fields["status"], "closed")) {
$link_validation = getItemTypeFormURL('TicketValidation');
echo "<td>" . convDateTime($row["submission_date"]) . "</td>";
} else {
echo "<td>" . convDateTime($row["submission_date"]) . "</a></td>";
}
echo "<td>" . getUserName($row["users_id"]) . "</td>";
echo "<td>" . $row["comment_submission"] . "</td>";
echo "<td>" . convDateTime($row["validation_date"]) . "</td>";
echo "<td>" . getUserName($row["users_id_validate"]) . "</td>";
echo "<td>" . $row["comment_validation"] . "</td>";
echo "</tr>";
}
echo "</table>";
} else {
echo "<div class='center b'>" . $LANG['search'][15] . "</div>";
}
}
示例7: showForProfile
/**
* Show the User having a profile, in allowed Entity
*
* @param $prof object
**/
static function showForProfile(Profile $prof)
{
global $DB, $LANG, $CFG_GLPI;
$ID = $prof->fields['id'];
$canedit = haveRight("user", "w");
if (!$prof->can($ID, 'r')) {
return false;
}
echo "<div class='spaced'>";
echo "<table class='tab_cadre_fixe'><tr>";
echo "<th>" . $LANG['profiles'][22] . " :<span class='small_space'>" . $prof->fields["name"] . "</span></th></tr>\n";
echo "<tr><th colspan='2'>" . $LANG['Menu'][14] . " (D=" . $LANG['profiles'][29] . ", R=" . $LANG['profiles'][28] . ")</th></tr>";
echo "</table>\n";
$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`";
echo "<table class='tab_cadre_fixe'>";
$i = 0;
$nb_per_line = 3;
$rand = mt_rand();
// Just to avoid IDE warning
$canedit_entity = false;
if ($result = $DB->query($query)) {
if ($DB->numrows($result) != 0) {
$temp = -1;
while ($data = $DB->fetch_array($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>";
if ($canedit_entity) {
openArrowMassive("profileuser_form" . $rand . "_{$temp}", true);
Dropdown::show('Entity', array('entity' => $_SESSION['glpiactiveentities']));
echo " <input type='submit' name='moveentity' value='" . $LANG['buttons'][20] . "' class='submit'> ";
closeArrowMassive('delete', $LANG['buttons'][6]);
}
echo "</div></form></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 class='left'>";
echo "<a href=\"javascript:showHideDiv('entity{$temp}{$rand}','imgcat{$temp}', '" . GLPI_ROOT . "/pics/folder.png','" . GLPI_ROOT . "/pics/folder-open.png');\">";
echo "<img alt='' name='imgcat{$temp}' src=\"" . GLPI_ROOT . "/pics/folder.png\"> ";
echo "<strong>" . Dropdown::getDropdownName('glpi_entities', $data["entity"]) . "</strong>";
echo "</a></td></tr>\n";
echo "<tr><td>";
echo "<form name='profileuser_form" . $rand . "_{$temp}' id='profileuser_form" . $rand . "_{$temp}' method='post' action='" . getItemTypeFormURL(__CLASS__) . "'>";
echo "<div class='center' id='entity{$temp}{$rand}' style='display:none;'>\n";
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'>";
$sel = "";
if (isset($_GET["select"]) && $_GET["select"] == "all") {
$sel = "checked";
}
echo "<input type='checkbox' name='item[" . $data["linkID"] . "]' value='1' {$sel}>";
echo "</td>";
}
echo "<td class='tab_bg_1'>" . formatUserName($data["id"], $data["name"], $data["realname"], $data["firstname"], 1);
if ($data["is_dynamic"] || $data["is_recursive"]) {
echo "<strong> (";
if ($data["is_dynamic"]) {
echo "D";
}
if ($data["is_dynamic"] && $data["is_recursive"]) {
echo ", ";
}
if ($data["is_recursive"]) {
echo "R";
}
echo ")</strong>";
}
echo "</td>\n";
$i++;
}
if ($i % $nb_per_line != 0) {
while ($i % $nb_per_line != 0) {
if ($canedit_entity) {
echo "<td width='10'> </td>";
//.........这里部分代码省略.........
示例8: TicketFollowup
$fup = new TicketFollowup();
if (isset($_POST["add"])) {
$fup->check(-1, 'w', $_POST);
$fup->add($_POST);
Event::log($fup->getField('tickets_id'), "ticket", 4, "tracking", $_SESSION["glpiname"] . " " . $LANG['log'][21]);
glpi_header($_SERVER['HTTP_REFERER']);
} else {
if (isset($_POST['add_close']) || isset($_POST['add_reopen'])) {
$ticket = new Ticket();
if ($ticket->getFromDB($_POST["tickets_id"]) && $ticket->canApprove()) {
$fup->add($_POST);
Event::log($fup->getField('tickets_id'), "ticket", 4, "tracking", $_SESSION["glpiname"] . " " . $LANG['log'][29]);
glpi_header($_SERVER['HTTP_REFERER']);
}
} else {
if (isset($_POST["update"])) {
$fup->check($_POST['id'], 'w');
$fup->update($_POST);
Event::log($fup->getField('tickets_id'), "ticket", 4, "tracking", $_SESSION["glpiname"] . " " . $LANG['log'][21]);
glpi_header(getItemTypeFormURL('Ticket') . "?id=" . $fup->getField('tickets_id'));
} else {
if (isset($_POST["delete"])) {
$fup->check($_POST['id'], 'w');
$fup->delete($_POST);
Event::log($fup->getField('tickets_id'), "ticket", 4, "tracking", $_SESSION["glpiname"] . " " . $LANG['log'][21]);
glpi_header(getItemTypeFormURL('Ticket') . "?id=" . $fup->getField('tickets_id'));
}
}
}
}
displayErrorAndDie('Lost');
示例9: showForSLA
function showForSLA(SLA $sla)
{
global $DB, $CFG_GLPI, $LANG;
$ID = $sla->getField('id');
if (!$sla->can($ID, 'r')) {
return false;
}
$canedit = $sla->can($ID, 'w');
$rand = mt_rand();
echo "<form name='slalevel_form{$rand}' id='slalevel_form{$rand}' method='post' action='";
echo getItemTypeFormURL(__CLASS__) . "'>";
if ($canedit) {
echo "<div class='center first-bloc'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_1'><th colspan='4'>" . $LANG['sla'][4] . "</tr>";
echo "<tr class='tab_bg_2'><td class='center'>" . $LANG['common'][16] . " : ";
echo "<input type='hidden' name='slas_id' value='{$ID}'>";
echo "<input type='hidden' name='entities_id' value='" . $sla->getEntityID() . "'>";
echo "<input type='hidden' name='is_recursive' value='" . $sla->isRecursive() . "'>";
echo "<input name='name' value=''>";
echo "</td><td class='center'>" . $LANG['sla'][3] . " : ";
self::dropdownExecutionTime('execution_time', array('max_time' => $sla->fields['resolution_time'], 'used' => self::getAlreadyUsedExecutionTime($sla->fields['id'])));
echo "</td><td class='center'>" . $LANG['common'][60] . " : ";
Dropdown::showYesNo("is_active", array('value' => 1));
echo "</td><td class='center'>";
echo "<input type='submit' name='add' value=\"" . $LANG['buttons'][8] . "\" class='submit'>";
echo "</td></tr>";
echo "</table></div>";
$query = "SELECT *\n FROM `glpi_slalevels`\n WHERE `slas_id` = '{$ID}'\n ORDER BY `execution_time`";
$result = $DB->query($query);
if ($DB->numrows($result) > 0) {
echo "<div class='center'><table class='tab_cadre_fixehov'>";
echo "<tr><th colspan='2'>" . $LANG['common'][16] . "</th>";
echo "<th>" . $LANG['sla'][3] . "</th>";
echo "<th>" . $LANG['common'][60] . "</th>";
echo "</tr>";
initNavigateListItems('SlaLevel', $LANG['sla'][1] . " - " . $sla->getName());
while ($data = $DB->fetch_array($result)) {
addToNavigateListItems('SlaLevel', $data["id"]);
echo "<tr class='tab_bg_2'>";
echo "<td width='10'>";
if ($canedit) {
echo "<input type='checkbox' name='item[" . $data["id"] . "]' value='1'>";
} else {
echo " ";
}
echo "</td>";
echo "<td>";
if ($canedit) {
echo "<a href='" . getItemTypeFormURL('SlaLevel') . "?id=" . $data["id"] . "'>";
}
echo $data["name"];
if (empty($data["name"])) {
echo "(" . $data['id'] . ")";
}
if ($canedit) {
echo "</a>";
}
echo "</td>";
echo "<td>" . ($data["execution_time"] != 0 ? timestampToString($data["execution_time"], false) : $LANG['sla'][5]) . "</td>";
echo "<td>" . Dropdown::getYesNo($data["is_active"]) . "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'><td colspan='4'>";
$this->getRuleWithCriteriasAndActions($data['id'], 0, 1);
$this->showActionsList($data["id"], array('readonly' => true));
echo "</td></tr>";
}
openArrowMassive("slalevel_form{$rand}", true);
closeArrowMassive('delete', $LANG['buttons'][6]);
echo "</table></div>";
}
}
echo "</form>";
}
示例10: define
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GLPI; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
--------------------------------------------------------------------------
*/
// ----------------------------------------------------------------------
// Original Author of file:
// Purpose of file:
// ----------------------------------------------------------------------
define('GLPI_ROOT', '..');
include GLPI_ROOT . "/inc/includes.php";
checkRight("config", "w");
$config = new Config();
if (!empty($_POST["update_auth"])) {
$config->update($_POST);
glpi_header($_SERVER['HTTP_REFERER']);
}
if (!empty($_POST["update"])) {
$config->update($_POST);
if (isset($_POST["use_ocs_mode"]) && $_POST["use_ocs_mode"] && !$CFG_GLPI["use_ocs_mode"]) {
glpi_header(getItemTypeSearchURL('OcsServer'));
} else {
glpi_header(getItemTypeFormURL('Config'));
}
}
commonHeader($LANG['common'][12], $_SERVER['PHP_SELF'], "config", "config");
$config->showForm(1);
commonFooter();
示例11: showForCalendar
/**
* Show segments of a calendar
*
* @param $calendar Calendar object
**/
static function showForCalendar(Calendar $calendar)
{
global $DB, $CFG_GLPI, $LANG;
$ID = $calendar->getField('id');
if (!$calendar->can($ID, 'r')) {
return false;
}
$canedit = $calendar->can($ID, 'w');
$rand = mt_rand();
echo "<form name='calendarsegment_form{$rand}' id='calendarsegment_form{$rand}' method='post'\n action='";
echo getItemTypeFormURL(__CLASS__) . "'>";
if ($canedit) {
echo "<div class='spaced'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_1'><th colspan='4'>" . $LANG['calendar'][6] . "</tr>";
echo "<tr class='tab_bg_2'><td class='center'>" . $LANG['calendar'][7] . " : ";
echo "<input type='hidden' name='entities_id' value='" . $calendar->fields['entities_id'] . "'>";
echo "<input type='hidden' name='is_recursive' value='" . $calendar->fields['is_recursive'] . "'>";
echo "<input type='hidden' name='calendars_id' value='{$ID}'>";
Dropdown::showFromArray('day', $LANG['calendarDay']);
echo "</td><td class='center'>" . $LANG['buttons'][33] . " : ";
Dropdown::showHours("begin", date('H') . ":00");
echo "</td><td class='center'>" . $LANG['buttons'][32] . " : ";
Dropdown::showHours("end", date('H') + 1 . ":00");
echo "</td><td class='center'>";
echo "<input type='submit' name='add' value=\"" . $LANG['buttons'][8] . "\" class='submit'>";
echo "</td></tr>";
echo "</table></div>";
}
echo "<div class='center'><table class='tab_cadre_fixehov'>";
echo "<tr><th colspan='2'>" . $LANG['calendar'][7] . "</th>";
echo "<th>" . $LANG['buttons'][33] . "</th>";
echo "<th>" . $LANG['buttons'][32] . "</th>";
echo "</tr>";
$query = "SELECT *\n FROM `glpi_calendarsegments`\n WHERE `calendars_id` = '{$ID}'\n ORDER BY `day`, `begin`, `end`";
$result = $DB->query($query);
if ($DB->numrows($result) > 0) {
while ($data = $DB->fetch_array($result)) {
echo "<tr class='tab_bg_1'>";
echo "<td width='10'>";
if ($canedit) {
echo "<input type='checkbox' name='item[" . $data["id"] . "]' value='1'>";
} else {
echo " ";
}
echo "</td>";
echo "<td>";
echo $LANG['calendarDay'][$data['day']];
echo "</td>";
echo "<td>" . $data["begin"] . "</td>";
echo "<td>" . $data["end"] . "</td>";
}
echo "</tr>";
}
echo "</table></div>";
if ($canedit) {
openArrowMassive("calendarsegment_form{$rand}", true);
closeArrowMassive('delete', $LANG['buttons'][6]);
}
echo "</form>";
}
示例12: showInfocoms
/**
* Print the HTML array for infocoms linked
*
*@return Nothing (display)
*
**/
function showInfocoms()
{
global $DB, $CFG_GLPI, $LANG;
$instID = $this->fields['id'];
if (!$this->can($instID, 'r')) {
return false;
}
$query = "SELECT DISTINCT `itemtype`\n FROM `glpi_infocoms`\n WHERE `suppliers_id` = '{$instID}'\n AND `itemtype` NOT IN ('ConsumableItem', 'CartridgeItem', 'Software')\n ORDER BY `itemtype`";
$result = $DB->query($query);
$number = $DB->numrows($result);
echo "<div class='spaced'><table class='tab_cadre_fixe'>";
echo "<tr><th colspan='2'>";
printPagerForm();
echo "</th><th colspan='3'>";
if ($DB->numrows($result) == 0) {
echo $LANG['document'][13];
} else {
echo $LANG['document'][19];
}
echo "</th></tr>";
echo "<tr><th>" . $LANG['common'][17] . "</th>";
echo "<th>" . $LANG['entity'][0] . "</th>";
echo "<th>" . $LANG['common'][16] . "</th>";
echo "<th>" . $LANG['common'][19] . "</th>";
echo "<th>" . $LANG['common'][20] . "</th>";
echo "</tr>";
$num = 0;
for ($i = 0; $i < $number; $i++) {
$itemtype = $DB->result($result, $i, "itemtype");
if (!class_exists($itemtype)) {
continue;
}
$item = new $itemtype();
if ($item->canView()) {
$linktype = $itemtype;
$linkfield = 'id';
$itemtable = getTableForItemType($itemtype);
$query = "SELECT `glpi_infocoms`.`entities_id`, `name`, `{$itemtable}`.*\n FROM `glpi_infocoms`\n INNER JOIN `{$itemtable}` ON (`{$itemtable}`.`id` = `glpi_infocoms`.`items_id`) ";
// Set $linktype for entity restriction AND link to search engine
if ($itemtype == 'Cartridge') {
$query .= "INNER JOIN `glpi_cartridgeitems`\n ON (`glpi_cartridgeitems`.`id`=`glpi_cartridges`.`cartridgeitems_id`) ";
$linktype = 'CartridgeItem';
$linkfield = 'cartridgeitems_id';
}
if ($itemtype == 'Consumable') {
$query .= "INNER JOIN `glpi_consumableitems`\n ON (`glpi_consumableitems`.`id`=`glpi_consumables`.`consumableitems_id`) ";
$linktype = 'ConsumableItem';
$linkfield = 'consumableitems_id';
}
$linktable = getTableForItemType($linktype);
$query .= "WHERE `glpi_infocoms`.`itemtype` = '{$itemtype}'\n AND `glpi_infocoms`.`suppliers_id` = '{$instID}'" . getEntitiesRestrictRequest(" AND", $linktable) . "\n ORDER BY `glpi_infocoms`.`entities_id`,\n `{$linktable}`.`name`";
$result_linked = $DB->query($query);
$nb = $DB->numrows($result_linked);
// Set $linktype for link to search engine pnly
if ($itemtype == 'SoftwareLicense' && $nb > $_SESSION['glpilist_limit']) {
$linktype = 'Software';
$linkfield = 'softwares_id';
}
if ($nb > $_SESSION['glpilist_limit']) {
echo "<tr class='tab_bg_1'>";
echo "<td class='center'>" . $item->getTypeName($nb) . " : {$nb}</td>";
echo "<td class='center' colspan='2'>";
echo "<a href='" . getItemTypeSearchURL($linktype) . "?" . rawurlencode("contains[0]") . "=" . rawurlencode('$$$$' . $instID) . "&" . rawurlencode("field[0]") . "=53&sort=80&order=ASC&is_deleted=0&start=0" . "'>" . $LANG['reports'][57] . "</a></td>";
echo "<td class='center'>-</td><td class='center'>-</td></tr>";
} else {
if ($nb) {
for ($prem = true; $data = $DB->fetch_assoc($result_linked); $prem = false) {
$ID = "";
if ($_SESSION["glpiis_ids_visible"] || empty($data["name"])) {
$ID = " (" . $data["id"] . ")";
}
$link = getItemTypeFormURL($linktype);
$name = "<a href=\"" . $link . "?id=" . $data[$linkfield] . "\">" . $data["name"] . "{$ID}</a>";
echo "<tr class='tab_bg_1'>";
if ($prem) {
echo "<td class='center top' rowspan='{$nb}'>" . $item->getTypeName($nb) . ($nb > 1 ? " : {$nb}</td>" : "</td>");
}
echo "<td class='center'>" . Dropdown::getDropdownName("glpi_entities", $data["entities_id"]) . "</td>";
echo "<td class='center";
echo (isset($data['is_deleted']) && $data['is_deleted'] ? " tab_bg_2_2'" : "'") . ">";
echo $name . "</td>";
echo "<td class='center'>" . (isset($data["serial"]) ? "" . $data["serial"] . "" : "-") . "</td>";
echo "<td class='center'>" . (isset($data["otherserial"]) ? "" . $data["otherserial"] . "" : "-") . "</td>";
echo "</tr>";
}
}
}
$num += $nb;
}
}
echo "<tr class='tab_bg_2'>";
echo "<td class='center'>" . ($num > 0 ? $LANG['common'][33] . " = {$num}" : " ") . "</td>";
echo "<td colspan='4'> </td></tr> ";
echo "</table></div>";
//.........这里部分代码省略.........
示例13: ComputerDisk
}
$disk = new ComputerDisk();
if (isset($_POST["add"])) {
$disk->check(-1, 'w', $_POST);
if ($newID = $disk->add($_POST)) {
Event::log($_POST['computers_id'], "computers", 4, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][21]);
}
glpi_header($_SERVER['HTTP_REFERER']);
} else {
if (isset($_POST["delete"])) {
$disk->check($_POST["id"], 'w');
if ($disk->delete($_POST)) {
Event::log($disk->fields['computers_id'], "computers", 4, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][21]);
}
$computer = new Computer();
$computer->getFromDB($disk->fields['computers_id']);
glpi_header(getItemTypeFormURL('Computer') . '?id=' . $disk->fields['computers_id'] . ($computer->fields['is_template'] ? "&withtemplate=1" : ""));
} else {
if (isset($_POST["update"])) {
$disk->check($_POST["id"], 'w');
if ($disk->update($_POST)) {
Event::log($disk->fields['computers_id'], "computers", 4, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][21] . " " . $_POST["id"]);
}
glpi_header($_SERVER['HTTP_REFERER']);
} else {
commonHeader($LANG['Menu'][0], $_SERVER['PHP_SELF'], "inventory", "computer");
$disk->showForm($_GET["id"], array('computers_id' => $_GET["computers_id"]));
commonFooter();
}
}
}
示例14: showActivationFormForItem
static function showActivationFormForItem($itemtype, $items_id)
{
global $CFG_GLPI, $LANG;
if (!haveRight("reservation_central", "w")) {
return false;
}
if (class_exists($itemtype)) {
$item = new $itemtype();
if (!$item->getFromDB($items_id)) {
return false;
}
// Recursive type case => need entity right
if ($item->isRecursive()) {
if (!haveAccessToEntity($item->fields["entities_id"])) {
return false;
}
}
} else {
return false;
}
$ri = new ReservationItem();
echo "<div><form method='post' name=form action='" . getItemTypeFormURL('ReservationItem') . "'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th>" . $LANG['reservation'][9] . "</th></tr>";
echo "<tr class='tab_bg_1'>";
if ($ri->getFromDBbyItem($itemtype, $items_id)) {
echo "<td class='center'>";
//Switch reservation state
echo "<input type='hidden' name='id' value='" . $ri->fields['id'] . "'>";
if ($ri->fields["is_active"]) {
echo "<input type='hidden' name='is_active' value='0'>";
echo "<input type='submit' name='update' value=\"" . $LANG['reservation'][3] . "\"\n class='submit'>";
} else {
echo "<input type='hidden' name='is_active' value='1'>";
echo "<input type='submit' name='update' value=\"" . $LANG['reservation'][5] . "\"\n class='submit'>";
}
echo "<span class='small_space'>";
echo "<input type='submit' name='delete' value=\"" . $LANG['reservation'][6] . "\"\n class='submit' " . addConfirmationOnAction(array($LANG['reservation'][38], $LANG['reservation'][39])) . ">";
echo "</span></td>";
} else {
echo "<td class='center'>";
echo "<input type='hidden' name='items_id' value='{$items_id}'>";
echo "<input type='hidden' name='itemtype' value='{$itemtype}'>";
echo "<input type='hidden' name='entities_id' value='" . $item->getEntityID() . "'>";
echo "<input type='hidden' name='is_recursive' value='" . $item->isRecursive() . "'>";
echo "<input type='submit' name='add' value=\"" . $LANG['reservation'][7] . "\" class='submit'>";
echo "</td>";
}
echo "</tr></table></form></div>";
}
示例15: showForUser
/** Show groups of a user
*
* @param $user the user
**/
static function showForUser(User $user)
{
global $CFG_GLPI, $LANG;
$ID = $user->fields['id'];
if (!haveRight("group", "r") || !$user->can($ID, 'r')) {
return false;
}
$canedit = $user->can($ID, 'w');
$rand = mt_rand();
$nb_per_line = 3;
if ($canedit) {
$headerspan = $nb_per_line * 2;
echo "<form name='groupuser_form{$rand}' id='groupuser_form{$rand}' method='post'";
echo " action='" . getItemTypeFormURL('User') . "'>";
} else {
$headerspan = $nb_per_line;
}
$groups = self::getUserGroups($ID);
$used = array();
if (!empty($groups)) {
foreach ($groups as $data) {
$used[$data["id"]] = $data["id"];
}
}
if ($canedit) {
echo "<div class='firstbloc'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_1'><th colspan='2'>" . $LANG['setup'][604] . "</th></tr>";
echo "<tr><td class='tab_bg_2 center'>";
echo "<input type='hidden' name='users_id' value='{$ID}'>";
// All entities "edited user" have access
$strict_entities = Profile_User::getUserEntities($ID, true);
// Keep only entities "connected user" have access
foreach ($strict_entities as $key => $val) {
if (!haveAccessToEntity($val)) {
unset($strict_entities[$key]);
}
}
if (countElementsInTableForEntity("glpi_groups", $strict_entities) > count($used)) {
Dropdown::show('Group', array('entity' => $strict_entities, 'used' => $used));
echo "</td><td class='tab_bg_2 center'>";
echo "<input type='submit' name='addgroup' value=\"" . $LANG['buttons'][8] . "\"\n class='submit'>";
} else {
echo $LANG['common'][49];
}
echo "</td></tr>";
echo "</table></div>";
}
echo "<div class='spaced'>";
echo "<table class='tab_cadre_fixehov'><tr>";
echo "<th colspan='{$headerspan}'>" . $LANG['Menu'][36] . " (D=" . $LANG['profiles'][29] . ")</th>";
echo "</tr>";
if (!empty($groups)) {
initNavigateListItems('Group', $user->getTypeName() . " = " . $user->getName());
$i = 0;
foreach ($groups as $data) {
addToNavigateListItems('Group', $data["id"]);
if ($i % $nb_per_line == 0) {
if ($i != 0) {
echo "</tr>";
}
echo "<tr class='tab_bg_1'>";
}
if ($canedit) {
echo "<td width='10'>";
$sel = "";
if (isset($_GET["select"]) && $_GET["select"] == "all") {
$sel = "checked";
}
echo "<input type='checkbox' name='item[" . $data["linkID"] . "]' value='1' {$sel}>";
echo "</td>";
}
echo "<td><a href='" . $CFG_GLPI["root_doc"] . "/front/group.form.php?id=" . $data["id"] . "'>" . $data["name"] . ($_SESSION["glpiis_ids_visible"] ? " (" . $data["id"] . ")" : "") . "</a>";
echo " ";
if ($data["is_dynamic"]) {
echo "<strong> (D)</strong>";
}
echo "</td>";
$i++;
}
while ($i % $nb_per_line != 0) {
if ($canedit) {
echo "<td> </td>";
}
echo "<td> </td>";
$i++;
}
echo "</tr>";
} else {
echo "<tr class='tab_bg_1'>";
echo "<td colspan='{$headerspan}' class='center'>" . $LANG['common'][49] . "</td></tr>";
}
echo "</table>";
if ($canedit) {
if (count($used)) {
openArrowMassive("groupuser_form{$rand}", true);
//.........这里部分代码省略.........