本文整理汇总了PHP中Session::isMultiEntitiesMode方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::isMultiEntitiesMode方法的具体用法?PHP Session::isMultiEntitiesMode怎么用?PHP Session::isMultiEntitiesMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Session
的用法示例。
在下文中一共展示了Session::isMultiEntitiesMode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pdfMain
static function pdfMain(PluginPdfSimplePDF $pdf, SoftwareLicense $license, $main = true, $cpt = true)
{
global $DB;
$ID = $license->getField('id');
$pdf->setColumnsSize(100);
$entity = '';
if (Session::isMultiEntitiesMode() && !$main) {
$entity = ' (' . Html::clean(Dropdown::getDropdownName('glpi_entities', $license->fields['entities_id'])) . ')';
}
$pdf->displayTitle('<b><i>' . sprintf(__('%1$s: %2$s'), __('ID') . "</i>", $ID . "</b>" . $entity));
$pdf->setColumnsSize(50, 50);
$pdf->displayLine('<b><i>' . sprintf(__('%1$s: %2$s'), Software::getTypeName(1) . '</i></b>', Html::clean(Dropdown::getDropdownName('glpi_softwares', $license->fields['softwares_id']))), '<b><i>' . sprintf(__('%1$s: %2$s'), __('Type') . '</i></b>', Html::clean(Dropdown::getDropdownName('glpi_softwarelicensetypes', $license->fields['softwarelicensetypes_id']))));
$pdf->displayLine('<b><i>' . sprintf(__('%1$s: %2$s'), __('Name') . '</i></b>', $license->fields['name']), '<b><i>' . sprintf(__('%1$s: %2$s'), __('Serial number') . '</i></b>', $license->fields['serial']));
$pdf->displayLine('<b><i>' . sprintf(__('%1$s: %2$s'), __('Purchase version') . '</i></b>', Html::clean(Dropdown::getDropdownName('glpi_softwareversions', $license->fields['softwareversions_id_buy']))), '<b><i>' . sprintf(__('%1$s: %2$s'), __('Inventory number') . '</i></b>', $license->fields['otherserial']));
$pdf->displayLine('<b><i>' . sprintf(__('%1$s: %2$s'), __('Version in use') . '</i></b>', Html::clean(Dropdown::getDropdownName('glpi_softwareversions', $license->fields['softwareversions_id_use']))), '<b><i>' . sprintf(__('%1$s: %2$s'), __('Expiration') . '</i></b>', Html::convDate($license->fields['expire'])));
$col2 = '';
if ($cpt) {
$col2 = '<b><i>' . sprintf(__('%1$s: %2$s'), __('Affected computers') . '</i></b>', Computer_SoftwareLicense::countForLicense($ID));
}
$pdf->displayLine('<b><i>' . sprintf(__('%1$s: %2$s'), _x('quantity', 'Number') . '</i></b>', $license->fields['number'] > 0 ? $license->fields['number'] : __('Unlimited')), $col2);
$pdf->setColumnsSize(100);
PluginPdfCommon::mainLine($pdf, $license, 'comment');
if ($main) {
$pdf->displaySpace();
}
}
示例2: showRecentPopular
/**
* Print out list recent or popular kb/faq
*
* @param $type type : recent / popular / not published
*
* @return nothing (display table)
**/
static function showRecentPopular($type)
{
global $DB, $CFG_GLPI;
$faq = !Session::haveRight("knowbase", "r");
if ($type == "recent") {
$orderby = "ORDER BY `date` DESC";
$title = __('Recent entries');
} else {
if ($type == 'lastupdate') {
$orderby = "ORDER BY `date_mod` DESC";
$title = __('Last updated entries');
} else {
$orderby = "ORDER BY `view` DESC";
$title = __('Most popular questions');
}
}
$faq_limit = "";
// Force all joins for not published to verify no visibility set
$join = self::addVisibilityJoins(true);
if (Session::getLoginUserID()) {
$faq_limit .= "WHERE " . self::addVisibilityRestrict();
} else {
// Anonymous access
if (Session::isMultiEntitiesMode()) {
$faq_limit .= " WHERE (`glpi_entities_knowbaseitems`.`entities_id` = '0'\n AND `glpi_entities_knowbaseitems`.`is_recursive` = '1')";
} else {
$faq_limit .= " WHERE 1";
}
}
// Only published
$faq_limit .= " AND (`glpi_entities_knowbaseitems`.`entities_id` IS NOT NULL\n OR `glpi_knowbaseitems_profiles`.`profiles_id` IS NOT NULL\n OR `glpi_groups_knowbaseitems`.`groups_id` IS NOT NULL\n OR `glpi_knowbaseitems_users`.`users_id` IS NOT NULL)";
if ($faq) {
// FAQ
$faq_limit .= " AND (`glpi_knowbaseitems`.`is_faq` = '1')";
}
$query = "SELECT DISTINCT `glpi_knowbaseitems`.*\n FROM `glpi_knowbaseitems`\n {$join}\n {$faq_limit}\n {$orderby}\n LIMIT 10";
$result = $DB->query($query);
$number = $DB->numrows($result);
if ($number > 0) {
echo "<table class='tab_cadrehov'>";
echo "<tr><th>" . $title . "</th></tr>";
while ($data = $DB->fetch_assoc($result)) {
echo "<tr class='tab_bg_2'><td class='left'>";
echo "<a " . ($data['is_faq'] ? " class='pubfaq' " : " class='knowbase' ") . " href=\"" . $CFG_GLPI["root_doc"] . "/front/knowbaseitem.form.php?id=" . $data["id"] . "\">" . Html::resume_text($data["name"], 80) . "</a></td></tr>";
}
echo "</table>";
}
}
示例3: showFormGlobal
/**
* Print the search config form
*
* @param $target form target
* @param $itemtype item type
*
* @return nothing
**/
function showFormGlobal($target, $itemtype)
{
global $CFG_GLPI, $DB;
$searchopt = Search::getOptions($itemtype);
if (!is_array($searchopt)) {
return false;
}
$IDuser = 0;
$item = NULL;
if ($itemtype != 'AllAssets') {
$item = getItemForItemtype($itemtype);
}
$global_write = Session::haveRight(self::$rightname, self::GENERAL);
echo "<div class='center' id='tabsbody' >";
// Defined items
$query = "SELECT *\n FROM `" . $this->getTable() . "`\n WHERE `itemtype` = '{$itemtype}'\n AND `users_id` = '{$IDuser}'\n ORDER BY `rank`";
$result = $DB->query($query);
$numrows = $DB->numrows($result);
echo "<table class='tab_cadre_fixehov'><tr><th colspan='4'>";
echo __('Select default items to show') . "</th></tr>\n";
if ($global_write) {
$already_added = self::getForTypeUser($itemtype, $IDuser);
echo "<tr class='tab_bg_1'><td colspan='4' class='center'>";
echo "<form method='post' action='{$target}'>";
echo "<input type='hidden' name='itemtype' value='{$itemtype}'>";
echo "<input type='hidden' name='users_id' value='{$IDuser}'>";
$group = '';
$values = array();
$searchopt = Search::getCleanedOptions($itemtype);
foreach ($searchopt as $key => $val) {
if (!is_array($val)) {
$group = $val;
} else {
if ($key != 1 && !in_array($key, $already_added) && (!isset($val['nodisplay']) || !$val['nodisplay'])) {
$values[$group][$key] = $val["name"];
}
}
}
if ($values) {
Dropdown::showFromArray('num', $values);
echo "<span class='small_space'>";
echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
echo "</span>";
}
Html::closeForm();
echo "</td></tr>";
}
// print first element
echo "<tr class='tab_bg_2'>";
echo "<td class='center' width='50%'>" . $searchopt[1]["name"];
if ($global_write) {
echo "</td><td colspan='3'> ";
}
echo "</td></tr>";
// print entity
if (Session::isMultiEntitiesMode() && (isset($CFG_GLPI["union_search_type"][$itemtype]) || $item && $item->maybeRecursive() || count($_SESSION["glpiactiveentities"]) > 1) && isset($searchopt[80])) {
echo "<tr class='tab_bg_2'>";
echo "<td class='center' width='50%'>" . $searchopt[80]["name"] . "</td>";
echo "<td colspan='3'> </td>";
echo "</tr>";
}
$i = 0;
if ($numrows) {
while ($data = $DB->fetch_assoc($result)) {
if ($data["num"] != 1 && isset($searchopt[$data["num"]])) {
echo "<tr class='tab_bg_2'><td class='center' width='50%'>";
echo $searchopt[$data["num"]]["name"];
echo "</td>";
if ($global_write) {
if ($i != 0) {
echo "<td class='center middle'>";
echo "<form method='post' action='{$target}'>";
echo "<input type='hidden' name='id' value='" . $data["id"] . "'>";
echo "<input type='hidden' name='users_id' value='{$IDuser}'>";
echo "<input type='hidden' name='itemtype' value='{$itemtype}'>";
echo "<input type='image' name='up' value=\"" . __s('Bring up') . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/puce-up.png' alt=\"" . __s('Bring up') . "\" title=\"" . __s('Bring up') . "\" class='pointer'>";
Html::closeForm();
echo "</td>";
} else {
echo "<td> </td>\n";
}
if ($i != $numrows - 1) {
echo "<td class='center middle'>";
echo "<form method='post' action='{$target}'>";
echo "<input type='hidden' name='id' value='" . $data["id"] . "'>";
echo "<input type='hidden' name='users_id' value='{$IDuser}'>";
echo "<input type='hidden' name='itemtype' value='{$itemtype}'>";
echo "<input type='image' name='down' value=\"" . __s('Bring down') . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/puce-down.png' alt=\"" . __s('Bring down') . "\" title=\"" . __s('Bring down') . "\" class='pointer'>";
Html::closeForm();
echo "</td>";
} else {
echo "<td> </td>\n";
//.........这里部分代码省略.........
示例4: showForm
//.........这里部分代码省略.........
//TRANS: %s is the date of last sync
echo '<br>' . sprintf(__('Last synchronization on %s'), HTML::convDateTime($this->fields["date_sync"]));
}
if (!empty($this->fields["user_dn"])) {
//TRANS: %s is the user dn
echo '<br>' . sprintf(__('%1$s: %2$s'), __('User DN'), $this->fields["user_dn"]);
}
echo "</td>";
} else {
echo "<td colspan='2'> </td>";
}
} else {
echo "<td colspan='2'><input type='hidden' name='authtype' value='1'></td>";
}
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Phone') . "</td><td>";
Html::autocompletionTextField($this, "phone");
echo "</td>";
echo "<td>" . __('Active') . "</td><td>";
Dropdown::showYesNo('is_active', $this->fields['is_active']);
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Mobile phone') . "</td><td>";
Html::autocompletionTextField($this, "mobile");
echo "</td>";
echo "<td>" . __('Category') . "</td><td>";
UserCategory::dropdown(array('value' => $this->fields["usercategories_id"]));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Phone 2') . "</td><td>";
Html::autocompletionTextField($this, "phone2");
echo "</td>";
echo "<td rowspan='4' class='middle'>" . __('Comments') . "</td>";
echo "<td class='center middle' rowspan='4'>";
echo "<textarea cols='45' rows='6' name='comment' >" . $this->fields["comment"] . "</textarea>";
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . __('Administrative number') . "</td><td>";
Html::autocompletionTextField($this, "registration_number");
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . _x('person', 'Title') . " :</td><td>";
UserTitle::dropdown(array('value' => $this->fields["usertitles_id"]));
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . __('Location') . "</td><td>";
if (!empty($ID)) {
$entities = Profile_User::getUserEntities($ID, true);
if (count($entities) > 0) {
Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $entities));
} else {
echo " ";
}
} else {
if (!Session::isMultiEntitiesMode()) {
// Display all locations : only one entity
Location::dropdown(array('value' => $this->fields["locations_id"]));
} else {
echo " ";
}
}
echo "</td></tr>";
if (empty($ID)) {
echo "<tr class='tab_bg_1'>";
echo "<th colspan='2'>" . _n('Authorization', 'Authorizations', 1) . "</th>";
echo "<td>" . __('Recursive') . "</td><td>";
Dropdown::showYesNo("_is_recursive", 0);
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Profile') . "</td><td>";
Profile::dropdownUnder(array('name' => '_profiles_id', 'value' => Profile::getDefault()));
echo "</td><td>" . __('Entity') . "</td><td>";
Entity::dropdown(array('name' => '_entities_id', 'display_emptychoice' => false, 'entity' => $_SESSION['glpiactiveentities']));
echo "</td></tr>";
} else {
if ($caneditpassword) {
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Default profile') . "</td><td>";
$options[0] = Dropdown::EMPTY_VALUE;
$options += Dropdown::getDropdownArrayNames('glpi_profiles', Profile_User::getUserProfiles($this->fields['id']));
Dropdown::showFromArray("profiles_id", $options, array('value' => $this->fields["profiles_id"]));
echo "</td><td>" . __('Default entity') . "</td><td>";
$entities = Profile_User::getUserEntities($this->fields['id'], 1);
Entity::dropdown(array('value' => $this->fields["entities_id"], 'entity' => $entities));
echo "</td></tr>";
}
echo "<tr class='tab_bg_1'>";
echo "<td colspan='2' class='center'>";
//TRANS: %s is the date
printf(__('Last update on %s'), HTML::convDateTime($this->fields["date_mod"]));
echo "<br>";
printf(__('Last login on %s'), HTML::convDateTime($this->fields["last_login"]));
echo "</td><td colspan='2'class='center'>";
if ($ID > 0) {
echo "<a target='_blank' href='" . $CFG_GLPI["root_doc"] . "/front/user.form.php?getvcard=1&id={$ID}'>" . __('Vcard') . "</a>";
}
echo "</td></tr>";
}
$this->showFormButtons($options);
$this->addDivForTabs();
return true;
}
示例5: showListSimple
static function showListSimple()
{
global $DB, $CFG_GLPI;
if (!Session::haveRight("reservation_helpdesk", "1")) {
return false;
}
$ri = new self();
$ok = false;
$showentity = Session::isMultiEntitiesMode();
// GET method passed to form creation
echo "<div class='center'><form name='form' method='GET' action='reservation.form.php'>";
echo "<table class='tab_cadre'>";
echo "<tr><th colspan='" . ($showentity ? "5" : "4") . "'>" . self::getTypeName(1) . "</th></tr>\n";
foreach ($CFG_GLPI["reservation_types"] as $itemtype) {
if (!($item = getItemForItemtype($itemtype))) {
continue;
}
$itemtable = getTableForItemType($itemtype);
$query = "SELECT `glpi_reservationitems`.`id`,\n `glpi_reservationitems`.`comment`,\n `{$itemtable}`.`name` AS name,\n `{$itemtable}`.`entities_id` AS entities_id,\n `glpi_locations`.`completename` AS location,\n `glpi_reservationitems`.`items_id` AS items_id\n FROM `glpi_reservationitems`\n INNER JOIN `{$itemtable}`\n ON (`glpi_reservationitems`.`itemtype` = '{$itemtype}'\n AND `glpi_reservationitems`.`items_id` = `{$itemtable}`.`id`)\n LEFT JOIN `glpi_locations`\n ON (`{$itemtable}`.`locations_id` = `glpi_locations`.`id`)\n WHERE `glpi_reservationitems`.`is_active` = '1'\n AND `glpi_reservationitems`.`is_deleted` = '0'\n AND `{$itemtable}`.`is_deleted` = '0'" . getEntitiesRestrictRequest(" AND", $itemtable, '', $_SESSION['glpiactiveentities'], $item->maybeRecursive()) . "\n ORDER BY `{$itemtable}`.`entities_id`,\n `{$itemtable}`.`name`";
if ($result = $DB->query($query)) {
while ($row = $DB->fetch_assoc($result)) {
echo "<tr class='tab_bg_2'><td>";
echo "<input type='checkbox' name='item[" . $row["id"] . "]' value='" . $row["id"] . "'>" . "</td>";
$typename = $item->getTypeName();
if ($itemtype == 'Peripheral') {
$item->getFromDB($row['items_id']);
if (isset($item->fields["peripheraltypes_id"]) && $item->fields["peripheraltypes_id"] != 0) {
$typename = Dropdown::getDropdownName("glpi_peripheraltypes", $item->fields["peripheraltypes_id"]);
}
}
echo "<td><a href='reservation.php?reservationitems_id=" . $row['id'] . "'>" . sprintf(__('%1$s - %2$s'), $typename, $row["name"]) . "</a></td>";
echo "<td>" . $row["location"] . "</td>";
echo "<td>" . nl2br($row["comment"]) . "</td>";
if ($showentity) {
echo "<td>" . Dropdown::getDropdownName("glpi_entities", $row["entities_id"]) . "</td>";
}
echo "</tr>\n";
$ok = true;
}
}
}
if ($ok) {
echo "<tr class='tab_bg_1 center'><td colspan='" . ($showentity ? "5" : "4") . "'>";
echo "<input type='submit' value=\"" . _sx('button', 'Add') . "\" class='submit'></td></tr>\n";
}
echo "</table>\n";
echo "<input type='hidden' name='id' value=''>";
echo "</form>";
// No CSRF token needed
echo "</div>\n";
}
示例6: getSpecificMassiveActions
/**
* @see CommonDBTM::getSpecificMassiveActions()
**/
function getSpecificMassiveActions($checkitem = NULL)
{
$isadmin = static::canUpdate();
$actions = parent::getSpecificMassiveActions($checkitem);
if ($isadmin) {
$actions['add_contact_supplier'] = _x('button', 'Add a contact');
}
if (Session::haveRight('transfer', 'r') && Session::isMultiEntitiesMode() && $isadmin) {
$actions['add_transfer_list'] = _x('button', 'Add to transfer list');
}
return $actions;
}
示例7: getSpecificMassiveActions
function getSpecificMassiveActions($checkitem = NULL)
{
$isadmin = static::canUpdate();
$actions = parent::getSpecificMassiveActions($checkitem);
if ($_SESSION['glpiactiveprofile']['interface'] == 'central') {
if ($isadmin) {
if (Session::haveRight('transfer', READ) && Session::isMultiEntitiesMode()) {
$actions['PluginTasklistsTask' . MassiveAction::CLASS_ACTION_SEPARATOR . 'transfer'] = __('Transfer');
}
}
}
return $actions;
}
示例8: showForm
//.........这里部分代码省略.........
$canstatus = $canupdate;
if ($ID && in_array($this->fields['status'], $this->getClosedStatusArray())) {
$canupdate = false;
// No update for actors
$values['_noupdate'] = true;
}
$showuserlink = 0;
if (Session::haveRight('user', READ)) {
$showuserlink = 1;
}
if ($options['template_preview']) {
// Add all values to fields of tickets for template preview
foreach ($values as $key => $val) {
if (!isset($this->fields[$key])) {
$this->fields[$key] = $val;
}
}
}
// In percent
$colsize1 = '13';
$colsize2 = '29';
$colsize3 = '13';
$colsize4 = '45';
$canupdate_descr = $canupdate || $this->fields['status'] == self::INCOMING && $this->isUser(CommonITILActor::REQUESTER, Session::getLoginUserID()) && $this->numberOfFollowups() == 0 && $this->numberOfTasks() == 0;
if (!$options['template_preview']) {
echo "<form method='post' name='form_ticket' enctype='multipart/form-data' action='" . $CFG_GLPI["root_doc"] . "/front/ticket.form.php'>";
if (isset($options['_projecttasks_id'])) {
echo "<input type='hidden' name='_projecttasks_id' value='" . $options['_projecttasks_id'] . "'>";
}
}
echo "<div class='spaced' id='tabsbody'>";
echo "<table class='tab_cadre_fixe' id='mainformtable'>";
// Optional line
$ismultientities = Session::isMultiEntitiesMode();
echo "<tr class='headerRow responsive_hidden'>";
echo "<th colspan='4'>";
if ($ID) {
$text = sprintf(__('%1$s - %2$s'), $this->getTypeName(1), sprintf(__('%1$s: %2$s'), __('ID'), $ID));
if ($ismultientities) {
$text = sprintf(__('%1$s (%2$s)'), $text, Dropdown::getDropdownName('glpi_entities', $this->fields['entities_id']));
}
echo $text;
} else {
if ($ismultientities) {
printf(__('The ticket will be added in the entity %s'), Dropdown::getDropdownName("glpi_entities", $this->fields['entities_id']));
} else {
_e('New ticket');
}
}
echo "</th></tr>";
echo "<tr class='tab_bg_1'>";
echo "<th width='{$colsize1}%'>";
echo $tt->getBeginHiddenFieldText('date');
if (!$ID) {
printf(__('%1$s%2$s'), __('Opening date'), $tt->getMandatoryMark('date'));
} else {
_e('Opening date');
}
echo $tt->getEndHiddenFieldText('date');
echo "</th>";
echo "<td width='{$colsize2}%'>";
echo $tt->getBeginHiddenFieldValue('date');
$date = $this->fields["date"];
if ($canupdate) {
Html::showDateTimeField("date", array('value' => $date, 'timestep' => 1, 'maybeempty' => false));
} else {
示例9: getSpecificMassiveActions
function getSpecificMassiveActions($checkitem = NULL)
{
$isadmin = static::canUpdate();
$actions = parent::getSpecificMassiveActions($checkitem);
if ($isadmin) {
if (Session::haveRight('transfer', READ) && Session::isMultiEntitiesMode()) {
$actions['PluginOrderOrder:transfert'] = __('Transfer');
}
}
return $actions;
}
示例10: getCriterias
/**
* @see Rule::getCriterias()
**/
function getCriterias()
{
static $criterias = array();
if (count($criterias)) {
return $criterias;
}
$criterias['mailcollector']['field'] = 'name';
$criterias['mailcollector']['name'] = __('Mails receiver');
$criterias['mailcollector']['table'] = 'glpi_mailcollectors';
$criterias['mailcollector']['type'] = 'dropdown';
$criterias['_users_id_requester']['field'] = 'name';
$criterias['_users_id_requester']['name'] = __('Requester');
$criterias['_users_id_requester']['table'] = 'glpi_users';
$criterias['_users_id_requester']['type'] = 'dropdown';
$criterias['subject']['name'] = __('Subject email header');
$criterias['subject']['field'] = 'subject';
$criterias['subject']['table'] = '';
$criterias['subject']['type'] = 'text';
$criterias['content']['name'] = __('Email body');
$criterias['content']['table'] = '';
$criterias['content']['type'] = 'text';
$criterias['from']['name'] = __('From email header');
$criterias['from']['table'] = '';
$criterias['from']['type'] = 'text';
$criterias['to']['name'] = __('To email header');
$criterias['to']['table'] = '';
$criterias['to']['type'] = 'text';
$criterias['in_reply_to']['name'] = __('In-Reply-To email header');
$criterias['in_reply_to']['table'] = '';
$criterias['in_reply_to']['type'] = 'text';
$criterias['x-priority']['name'] = __('X-Priority email header');
$criterias['x-priority']['table'] = '';
$criterias['x-priority']['type'] = 'text';
$criterias['x-auto-response-suppress']['name'] = __('X-Auto-Response-Suppress email header');
$criterias['x-auto-response-suppress']['table'] = '';
$criterias['x-auto-response-suppress']['type'] = 'text';
$criterias['auto-submitted']['name'] = __('Auto-Submitted email header');
$criterias['auto-submitted']['table'] = '';
$criterias['auto-submitted']['type'] = 'text';
/// Renater spam matching : X-UCE-Status = Yes
$criterias['x-uce-status']['name'] = __('X-UCE-Status email header');
$criterias['x-uce-status']['table'] = '';
$criterias['x-uce-status']['type'] = 'text';
$criterias['received']['name'] = __('Received email header');
$criterias['received']['table'] = '';
$criterias['received']['type'] = 'text';
$criterias['GROUPS']['table'] = 'glpi_groups';
$criterias['GROUPS']['field'] = 'completename';
$criterias['GROUPS']['name'] = sprintf(__('%1$s: %2$s'), __('User'), __('Group'));
$criterias['GROUPS']['linkfield'] = '';
$criterias['GROUPS']['type'] = 'dropdown';
$criterias['GROUPS']['virtual'] = true;
$criterias['GROUPS']['id'] = 'groups';
$criterias['KNOWN_DOMAIN']['field'] = 'name';
$criterias['KNOWN_DOMAIN']['name'] = __('Known mail domain');
$criterias['KNOWN_DOMAIN']['table'] = 'glpi_entities';
$criterias['KNOWN_DOMAIN']['type'] = 'yesno';
$criterias['KNOWN_DOMAIN']['virtual'] = true;
$criterias['KNOWN_DOMAIN']['id'] = 'entitydatas';
$criterias['KNOWN_DOMAIN']['allow_condition'] = array(Rule::PATTERN_IS);
$criterias['PROFILES']['field'] = 'name';
$criterias['PROFILES']['name'] = __('User featuring the profile');
$criterias['PROFILES']['table'] = 'glpi_profiles';
$criterias['PROFILES']['type'] = 'dropdown';
$criterias['PROFILES']['virtual'] = true;
$criterias['PROFILES']['id'] = 'profiles';
$criterias['PROFILES']['allow_condition'] = array(Rule::PATTERN_IS);
if (Session::isMultiEntitiesMode()) {
$criterias['UNIQUE_PROFILE']['field'] = 'name';
$criterias['UNIQUE_PROFILE']['name'] = __('User featuring a single profile');
$criterias['UNIQUE_PROFILE']['table'] = 'glpi_profiles';
$criterias['UNIQUE_PROFILE']['type'] = 'dropdown';
$criterias['UNIQUE_PROFILE']['virtual'] = true;
$criterias['UNIQUE_PROFILE']['id'] = 'profiles';
$criterias['UNIQUE_PROFILE']['allow_condition'] = array(Rule::PATTERN_IS);
}
$criterias['ONE_PROFILE']['field'] = 'name';
$criterias['ONE_PROFILE']['name'] = __('User with a single profile');
$criterias['ONE_PROFILE']['table'] = '';
$criterias['ONE_PROFILE']['type'] = 'yesonly';
$criterias['ONE_PROFILE']['virtual'] = true;
$criterias['ONE_PROFILE']['id'] = 'profiles';
$criterias['ONE_PROFILE']['allow_condition'] = array(Rule::PATTERN_IS);
return $criterias;
}
示例11: showFormInventory
/**
* Print the config form for restrictions
*
* @return Nothing (display)
**/
function showFormInventory()
{
global $DB, $CFG_GLPI;
if (!self::canView()) {
return false;
}
$canedit = Config::canUpdate();
if ($canedit) {
echo "<form name='form' action=\"" . Toolbox::getItemTypeFormURL(__CLASS__) . "\" method='post'>";
}
echo "<div class='center' id='tabsbody'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th colspan='4'>" . __('Assets') . "</th></tr>";
echo "<tr class='tab_bg_2'>";
echo "<td width='30%'>" . __('Enable the financial and administrative information by default') . "</td>";
echo "<td width='20%'>";
Dropdown::ShowYesNo('auto_create_infocoms', $CFG_GLPI["auto_create_infocoms"]);
echo "</td><td width='20%'> " . __('Restrict monitor management') . "</td>";
echo "<td width='30%'>";
$this->dropdownGlobalManagement("monitors_management_restrict", $CFG_GLPI["monitors_management_restrict"]);
echo "</td></tr>";
echo "<tr class='tab_bg_2'><td>" . __('Software category deleted by the dictionary rules') . "</td><td>";
SoftwareCategory::dropdown(array('value' => $CFG_GLPI["softwarecategories_id_ondelete"], 'name' => "softwarecategories_id_ondelete"));
echo "</td><td> " . __('Restrict device management') . "</td><td>";
$this->dropdownGlobalManagement("peripherals_management_restrict", $CFG_GLPI["peripherals_management_restrict"]);
echo "</td></tr>";
echo "<tr class='tab_bg_2'>";
echo "<td>" . __('Beginning of fiscal year') . "</td><td>";
Html::showDateField("date_tax", array('value' => $CFG_GLPI["date_tax"], 'maybeempty' => false, 'canedit' => true, 'min' => '', 'max' => '', 'showyear' => false));
echo "</td><td> " . __('Restrict phone management') . "</td><td>";
$this->dropdownGlobalManagement("phones_management_restrict", $CFG_GLPI["phones_management_restrict"]);
echo "</td></tr>";
echo "<tr class='tab_bg_2'>";
echo "<td>" . __('Automatic fields (marked by *)') . "</td><td>";
$tab = array(0 => __('Global'), 1 => __('By entity'));
Dropdown::showFromArray('use_autoname_by_entity', $tab, array('value' => $CFG_GLPI["use_autoname_by_entity"]));
echo "</td><td> " . __('Restrict printer management') . "</td><td>";
$this->dropdownGlobalManagement("printers_management_restrict", $CFG_GLPI["printers_management_restrict"]);
echo "</td></tr>";
echo "</table>";
if (Session::haveRightsOr("transfer", array(CREATE, UPDATE)) && Session::isMultiEntitiesMode()) {
echo "<br><table class='tab_cadre_fixe'>";
echo "<tr><th colspan='2'>" . __('Automatic transfer of computers') . "</th></tr>";
echo "<tr class='tab_bg_2'>";
echo "<td>" . __('Template for the automatic transfer of computers in another entity') . "</td><td>";
Transfer::dropdown(array('value' => $CFG_GLPI["transfers_id_auto"], 'name' => "transfers_id_auto", 'emptylabel' => __('No automatic transfer')));
echo "</td></tr>";
echo "</table>";
}
echo "<br><table class='tab_cadre_fixe'>";
echo "<tr>";
echo "<th colspan='4'>" . __('Automatically update of the elements related to the computers');
echo "</th><th colspan='2'>" . __('Unit management') . "</th></tr>";
echo "<tr><th> </th>";
echo "<th>" . __('Alternate username') . "</th>";
echo "<th>" . __('User') . "</th>";
echo "<th>" . __('Group') . "</th>";
echo "<th>" . __('Location') . "</th>";
echo "<th>" . __('Status') . "</th>";
echo "</tr>";
$fields = array("contact", "user", "group", "location");
echo "<tr class='tab_bg_2'>";
echo "<td> " . __('When connecting or updating') . "</td>";
$values[0] = __('Do not copy');
$values[1] = __('Copy');
foreach ($fields as $field) {
echo "<td>";
$fieldname = "is_" . $field . "_autoupdate";
Dropdown::showFromArray($fieldname, $values, array('value' => $CFG_GLPI[$fieldname]));
echo "</td>";
}
echo "<td>";
State::dropdownBehaviour("state_autoupdate_mode", __('Copy computer status'), $CFG_GLPI["state_autoupdate_mode"]);
echo "</td></tr>";
echo "<tr class='tab_bg_2'>";
echo "<td> " . __('When disconnecting') . "</td>";
$values[0] = __('Do not delete');
$values[1] = __('Clear');
foreach ($fields as $field) {
echo "<td>";
$fieldname = "is_" . $field . "_autoclean";
Dropdown::showFromArray($fieldname, $values, array('value' => $CFG_GLPI[$fieldname]));
echo "</td>";
}
echo "<td>";
State::dropdownBehaviour("state_autoclean_mode", __('Clear status'), $CFG_GLPI["state_autoclean_mode"]);
echo "</td></tr>";
if ($canedit) {
echo "<tr class='tab_bg_2'>";
echo "<td colspan='6' class='center'>";
echo "<input type='submit' name='update' class='submit' value=\"" . _sx('button', 'Save') . "\">";
echo "</td></tr>";
}
echo "</table></div>";
Html::closeForm();
//.........这里部分代码省略.........
示例12: displayBody
static function displayBody($data)
{
global $CFG_GLPI;
$computer = new computer();
$computer->getFromDB($data["id"]);
$body = "<tr class='tab_bg_2'><td><a href=\"" . $CFG_GLPI["root_doc"] . "/front/computer.form.php?id=" . $computer->fields["id"] . "\">" . $computer->fields["name"];
if ($_SESSION["glpiis_ids_visible"] == 1 || empty($computer->fields["name"])) {
$body .= " (";
$body .= $computer->fields["id"] . ")";
}
$body .= "</a></td>";
if (Session::isMultiEntitiesMode()) {
$body .= "<td class='center'>" . Dropdown::getDropdownName("glpi_entities", $data["entities_id"]) . "</td>";
}
$body .= "<td>" . Dropdown::getDropdownName("glpi_operatingsystems", $computer->fields["operatingsystems_id"]) . "</td>";
$body .= "<td>" . Dropdown::getDropdownName("glpi_states", $computer->fields["states_id"]) . "</td>";
$body .= "<td>" . Dropdown::getDropdownName("glpi_locations", $computer->fields["locations_id"]) . "</td>";
$body .= "<td>";
if (!empty($computer->fields["users_id"])) {
$body .= "<a href=\"" . $CFG_GLPI["root_doc"] . "/front/user.form.php?id=" . $computer->fields["users_id"] . "\">" . getUserName($computer->fields["users_id"]) . "</a>";
}
if (!empty($computer->fields["groups_id"])) {
$body .= " - <a href=\"" . $CFG_GLPI["root_doc"] . "/front/group.form.php?id=" . $computer->fields["groups_id"] . "\">";
}
$body .= Dropdown::getDropdownName("glpi_groups", $computer->fields["groups_id"]);
if ($_SESSION["glpiis_ids_visible"] == 1) {
$body .= " (";
$body .= $computer->fields["groups_id"] . ")";
}
$body .= "</a>";
if (!empty($computer->fields["contact"])) {
$body .= " - " . $computer->fields["contact"];
}
$body .= " - </td>";
$body .= "<td>" . Html::convdatetime($data["last_ocs_update"]) . "</td>";
$body .= "<td>" . Html::convdatetime($data["last_update"]) . "</td>";
$body .= "<td>" . Dropdown::getDropdownName("glpi_plugin_ocsinventoryng_ocsservers", $data["plugin_ocsinventoryng_ocsservers_id"]) . "</td>";
$body .= "</tr>";
return $body;
}
示例13: getSpecificMassiveActions
/**
* @see CommonDBTM::getSpecificMassiveActions()
**/
function getSpecificMassiveActions($checkitem = NULL)
{
$isadmin = static::canUpdate();
$actions = parent::getSpecificMassiveActions($checkitem);
if (ProblemTask::canCreate()) {
$actions['add_task'] = __('Add a new task');
}
if (Session::haveRight("edit_all_problem", "1")) {
$actions['add_actor'] = __('Add an actor');
}
if (Session::haveRight('transfer', 'r') && Session::isMultiEntitiesMode() && $isadmin) {
$actions['add_transfer_list'] = _x('button', 'Add to transfer list');
}
return $actions;
}
示例14: showRecentPopular
/**
* Print out list recent or popular kb/faq
*
* @param $type type : recent / popular / not published
*
* @return nothing (display table)
**/
static function showRecentPopular($type)
{
global $DB, $CFG_GLPI;
$faq = !Session::haveRight(self::$rightname, READ);
if ($type == "recent") {
$orderby = "ORDER BY `date` DESC";
$title = __('Recent entries');
} else {
if ($type == 'lastupdate') {
$orderby = "ORDER BY `date_mod` DESC";
$title = __('Last updated entries');
} else {
$orderby = "ORDER BY `view` DESC";
$title = __('Most popular questions');
}
}
$faq_limit = "";
$addselect = "";
// Force all joins for not published to verify no visibility set
$join = self::addVisibilityJoins(true);
if (Session::getLoginUserID()) {
$faq_limit .= "WHERE " . self::addVisibilityRestrict();
} else {
// Anonymous access
if (Session::isMultiEntitiesMode()) {
$faq_limit .= " WHERE (`glpi_entities_knowbaseitems`.`entities_id` = '0'\n AND `glpi_entities_knowbaseitems`.`is_recursive` = '1')";
} else {
$faq_limit .= " WHERE 1";
}
}
// Only published
$faq_limit .= " AND (`glpi_entities_knowbaseitems`.`entities_id` IS NOT NULL\n OR `glpi_knowbaseitems_profiles`.`profiles_id` IS NOT NULL\n OR `glpi_groups_knowbaseitems`.`groups_id` IS NOT NULL\n OR `glpi_knowbaseitems_users`.`users_id` IS NOT NULL)";
// Add visibility date
$faq_limit .= " AND (`glpi_knowbaseitems`.`begin_date` IS NULL\n OR `glpi_knowbaseitems`.`begin_date` < NOW())\n AND (`glpi_knowbaseitems`.`end_date` IS NULL\n OR `glpi_knowbaseitems`.`end_date` > NOW()) ";
if ($faq) {
// FAQ
$faq_limit .= " AND (`glpi_knowbaseitems`.`is_faq` = '1')";
}
if (KnowbaseItemTranslation::isKbTranslationActive()) {
$join .= "LEFT JOIN `glpi_knowbaseitemtranslations`\n ON (`glpi_knowbaseitems`.`id` = `glpi_knowbaseitemtranslations`.`knowbaseitems_id`\n AND `glpi_knowbaseitemtranslations`.`language` = '" . $_SESSION['glpilanguage'] . "')";
$addselect .= ", `glpi_knowbaseitemtranslations`.`name` AS transname,\n `glpi_knowbaseitemtranslations`.`answer` AS transanswer ";
}
$query = "SELECT DISTINCT `glpi_knowbaseitems`.* {$addselect}\n FROM `glpi_knowbaseitems`\n {$join}\n {$faq_limit}\n {$orderby}\n LIMIT 10";
$result = $DB->query($query);
$number = $DB->numrows($result);
if ($number > 0) {
echo "<table class='tab_cadrehov'>";
echo "<tr class='noHover'><th>" . $title . "</th></tr>";
while ($data = $DB->fetch_assoc($result)) {
$name = $data['name'];
if (isset($data['transname']) && !empty($data['transname'])) {
$name = $data['transname'];
}
echo "<tr class='tab_bg_2'><td class='left'>";
echo "<a " . ($data['is_faq'] ? " class='pubfaq' title='" . __("This item is part of the FAQ") . "' " : " class='knowbase' ") . " href=\"" . $CFG_GLPI["root_doc"] . "/front/knowbaseitem.form.php?id=" . $data["id"] . "\">" . Html::resume_text($name, 80) . "</a></td></tr>";
}
echo "</table>";
}
}
示例15: getSpecificMassiveActions
/**
* @see CommonDBTM::getSpecificMassiveActions()
**/
function getSpecificMassiveActions($checkitem = NULL)
{
$isadmin = static::canUpdate();
$actions = parent::getSpecificMassiveActions($checkitem);
if ($isadmin && countElementsInTable("glpi_rules", "sub_type='RuleSoftwareCategory'") > 0) {
$actions['compute_software_category'] = __('Recalculate the category');
}
if (Session::haveRight("rule_dictionnary_software", "w") && countElementsInTable("glpi_rules", "sub_type='RuleDictionnarySoftware'") > 0) {
$actions['replay_dictionnary'] = __('Replay the dictionary rules');
}
if (Session::haveRight('transfer', 'r') && Session::isMultiEntitiesMode() && $isadmin) {
$actions['add_transfer_list'] = _x('button', 'Add to transfer list');
}
return $actions;
}