• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP getItemForItemtype函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中getItemForItemtype函数的典型用法代码示例。如果您正苦于以下问题:PHP getItemForItemtype函数的具体用法?PHP getItemForItemtype怎么用?PHP getItemForItemtype使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: canUpdateItem

 function canUpdateItem()
 {
     if (isset($this->fields['itemtype']) && ($item = getItemForItemtype($this->fields['itemtype']))) {
         return Session::haveRight($item::$rightname, UPDATENOTE);
     }
     return false;
 }
开发者ID:stweil,项目名称:glpi,代码行数:7,代码来源:notepad.class.php


示例2: beforeAdd

 static function beforeAdd(Ticket $ticket)
 {
     global $DB;
     if (!is_array($ticket->input) || !count($ticket->input)) {
         // Already cancel by another plugin
         return false;
     }
     //Toolbox::logDebug("PluginBehaviorsTicket::beforeAdd(), Ticket=", $ticket);
     $config = PluginBehaviorsConfig::getInstance();
     if ($config->getField('tickets_id_format')) {
         $max = 0;
         $sql = 'SELECT MAX( id ) AS max
              FROM `glpi_tickets`';
         foreach ($DB->request($sql) as $data) {
             $max = $data['max'];
         }
         $want = date($config->getField('tickets_id_format'));
         if ($max < $want) {
             $DB->query("ALTER TABLE `glpi_tickets` AUTO_INCREMENT={$want}");
         }
     }
     if (!isset($ticket->input['_auto_import']) && isset($_SESSION['glpiactiveprofile']['interface']) && $_SESSION['glpiactiveprofile']['interface'] == 'central') {
         if ($config->getField('is_requester_mandatory') && !$ticket->input['_users_id_requester'] && (!isset($ticket->input['_users_id_requester_notif']['alternative_email']) || empty($ticket->input['_users_id_requester_notif']['alternative_email']))) {
             Session::addMessageAfterRedirect(__('Requester is mandatory', 'behaviors'), true, ERROR);
             $ticket->input = array();
             return true;
         }
     }
     if ($config->getField('use_requester_item_group') && isset($ticket->input['itemtype']) && isset($ticket->input['items_id']) && $ticket->input['items_id'] > 0 && ($item = getItemForItemtype($ticket->input['itemtype'])) && (!isset($ticket->input['_groups_id_requester']) || $ticket->input['_groups_id_requester'] <= 0)) {
         if ($item->isField('groups_id') && $item->getFromDB($ticket->input['items_id'])) {
             $ticket->input['_groups_id_requester'] = $item->getField('groups_id');
         }
     }
     // No Auto set Import for external source -> Duplicate from Ticket->prepareInputForAdd()
     if (!isset($ticket->input['_auto_import'])) {
         if (!isset($ticket->input['_users_id_requester'])) {
             if ($uid = Session::getLoginUserID()) {
                 $ticket->input['_users_id_requester'] = $uid;
             }
         }
     }
     if ($config->getField('use_requester_user_group') && isset($ticket->input['_users_id_requester']) && $ticket->input['_users_id_requester'] > 0 && (!isset($ticket->input['_groups_id_requester']) || $ticket->input['_groups_id_requester'] <= 0)) {
         if ($config->getField('use_requester_user_group') == 1) {
             // First group
             $ticket->input['_groups_id_requester'] = PluginBehaviorsUser::getRequesterGroup($ticket->input['entities_id'], $ticket->input['_users_id_requester'], true);
         } else {
             // All groups
             $g = PluginBehaviorsUser::getRequesterGroup($ticket->input['entities_id'], $ticket->input['_users_id_requester'], false);
             if (count($g)) {
                 $ticket->input['_groups_id_requester'] = array_shift($g);
             }
             if (count($g)) {
                 $ticket->input['_additional_groups_requesters'] = $g;
             }
         }
     }
     // Toolbox::logDebug("PluginBehaviorsTicket::beforeAdd(), Updated input=", $ticket->input);
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:58,代码来源:ticket.class.php


示例3: replayRulesOnExistingDB

 /**
  * @see RuleCollection::replayRulesOnExistingDB()
  **/
 function replayRulesOnExistingDB($offset = 0, $maxtime = 0, $items = array(), $params = array())
 {
     global $DB;
     // Model check : need to check using manufacturer extra data so specific function
     if (strpos($this->item_table, 'models')) {
         return $this->replayRulesOnExistingDBForModel($offset, $maxtime);
     }
     if (isCommandLine()) {
         printf(__('Replay rules on existing database started on %s') . "\n", date("r"));
     }
     // Get All items
     $Sql = "SELECT *\n              FROM `" . $this->item_table . "`";
     if ($offset) {
         $Sql .= " LIMIT " . intval($offset) . ",999999999";
     }
     $result = $DB->query($Sql);
     $nb = $DB->numrows($result) + $offset;
     $i = $offset;
     if ($result && $nb > $offset) {
         // Step to refresh progressbar
         $step = $nb > 20 ? floor($nb / 20) : 1;
         $send = array();
         $send["tablename"] = $this->item_table;
         while ($data = $DB->fetch_assoc($result)) {
             if (!($i % $step)) {
                 if (isCommandLine()) {
                     //TRANS: %1$s is a row, %2$s is total rows
                     printf(__('Replay rules on existing database: %1$s/%2$s') . "\r", $i, $nb);
                 } else {
                     Html::changeProgressBarPosition($i, $nb, "{$i} / {$nb}");
                 }
             }
             //Replay Type dictionnary
             $ID = Dropdown::importExternal(getItemTypeForTable($this->item_table), addslashes($data["name"]), -1, array(), addslashes($data["comment"]));
             if ($data['id'] != $ID) {
                 $tomove[$data['id']] = $ID;
                 $type = GetItemTypeForTable($this->item_table);
                 if ($dropdown = getItemForItemtype($type)) {
                     $dropdown->delete(array('id' => $data['id'], '_replace_by' => $ID));
                 }
             }
             $i++;
             if ($maxtime) {
                 $crt = explode(" ", microtime());
                 if ($crt[0] + $crt[1] > $maxtime) {
                     break;
                 }
             }
         }
         // end while
     }
     if (isCommandLine()) {
         printf(__('Replay rules on existing database started on %s') . "\n", date("r"));
     } else {
         Html::changeProgressBarPosition($i, $nb, "{$i} / {$nb}");
     }
     return $i == $nb ? -1 : $i;
 }
开发者ID:gaforeror,项目名称:glpi,代码行数:61,代码来源:ruledictionnarydropdowncollection.class.php


示例4: getSubName

 function getSubName()
 {
     $itemtype = $this->getParameterValue();
     if ($itemtype && ($item = getItemForItemtype($itemtype))) {
         $name = $item->getTypeName();
     } else {
         // All
         return '';
     }
     return " " . $this->getCriteriaLabel() . " : " . $name;
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:11,代码来源:itemtypecriteria.class.php


示例5: __construct

 function __construct($name, $title, $itemtype, $options = array())
 {
     parent::__construct($name, $title, $options);
     $this->obj = getItemForItemtype($itemtype);
     if (isset($options['with_comment'])) {
         $this->with_comment = $options['with_comment'];
     }
     if (isset($options['with_navigate'])) {
         $this->with_navigate = $options['with_navigate'];
         Session::initNavigateListItems($this->obj->getType(), _n('Report', 'Reports', 2));
     }
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:12,代码来源:columnlink.class.php


示例6: surveilleResa

 static function surveilleResa($task)
 {
     global $DB, $CFG_GLPI;
     $valreturn = 0;
     $temps = time();
     $temps -= $temps % MINUTE_TIMESTAMP;
     $begin = date("Y-m-d H:i:s", $temps);
     $end = date("Y-m-d H:i:s", $temps + 5 * MINUTE_TIMESTAMP);
     $left = "";
     $where = "";
     $listResaTraitee = array();
     foreach ($CFG_GLPI["reservation_types"] as $itemtype) {
         if (!($item = getItemForItemtype($itemtype))) {
             continue;
         }
         $itemtable = getTableForItemType($itemtype);
         $otherserial = "'' AS otherserial";
         if ($item->isField('otherserial')) {
             $otherserial = "`{$itemtable}`.`otherserial`";
         }
         if (isset($begin) && isset($end)) {
             $left = "LEFT JOIN `glpi_reservations`\n      ON (`glpi_reservationitems`.`id` = `glpi_reservations`.`reservationitems_id`\n       AND '" . $begin . "' <= `glpi_reservations`.`end`\n       AND '" . $end . "' >= `glpi_reservations`.`end`)";
             $where = " AND `glpi_reservations`.`id` IS NOT NULL ";
         }
         $query = "SELECT `glpi_reservationitems`.`id`,\n`glpi_reservationitems`.`comment`,\n`{$itemtable}`.`name` AS name,\n`{$itemtable}`.`entities_id` AS entities_id,\n{$otherserial},\n`glpi_reservations`.`id` AS resaid,\n`glpi_reservations`.`comment`,\n`glpi_reservations`.`begin`,\n`glpi_reservations`.`end`,\n`glpi_users`.`name` AS username,\n`glpi_reservationitems`.`items_id` AS items_id\nFROM `glpi_reservationitems`\n{$left}\nINNER JOIN `{$itemtable}`\nON (`glpi_reservationitems`.`itemtype` = '{$itemtype}'\n  AND `glpi_reservationitems`.`items_id` = `{$itemtable}`.`id`)\nLEFT JOIN `glpi_users` \nON (`glpi_reservations`.`users_id` = `glpi_users`.`id`)\nWHERE `glpi_reservationitems`.`is_active` = '1'\nAND `glpi_reservationitems`.`is_deleted` = '0'\nAND `{$itemtable}`.`is_deleted` = '0'\n{$where} " . "ORDER BY username,\n`{$itemtable}`.`entities_id`,\n`{$itemtable}`.`name`";
         if ($result = $DB->query($query)) {
             while ($row = $DB->fetch_assoc($result)) {
                 $query = "SELECT * FROM `glpi_plugin_reservation_manageresa` WHERE `resaid` = " . $row["resaid"];
                 //on insere la reservation seulement si elle n'est pas deja presente dans la table
                 if ($res = $DB->query($query)) {
                     if (!$DB->numrows($res)) {
                         $query = "INSERT INTO  `glpi_plugin_reservation_manageresa` (`resaid`, `matid`, `date_theorique`, `itemtype`) VALUES ('" . $row["resaid"] . "','" . $row["items_id"] . "','" . $row['end'] . "','" . $itemtype . "');";
                         $DB->query($query) or die("error on 'insert' into glpi_plugin_reservation_manageresa  lors du cron/ hash: " . $DB->error());
                     }
                 }
             }
         }
     }
     //on va prolonger toutes les resa managées qui n'ont pas de date de retour
     $query = "SELECT * FROM `glpi_plugin_reservation_manageresa` WHERE date_return is NULL;";
     if ($result = $DB->query($query)) {
         while ($row = $DB->fetch_assoc($result)) {
             $newEnd = $temps + 5 * MINUTE_TIMESTAMP;
             $task->log("prolongation de la reservation numero " . $row['resaid']);
             // prolongation de la vrai resa
             self::verifDisponibiliteAndMailIGS($task, $row['itemtype'], $row['matid'], $row['resaid'], $begin, date("Y-m-d H:i:s", $newEnd));
             $query = "UPDATE `glpi_reservations` SET `end`='" . date("Y-m-d H:i:s", $newEnd) . "' WHERE `id`='" . $row["resaid"] . "';";
             $DB->query($query) or die("error on 'update' into glpi_reservations lors du cron : " . $DB->error());
             $valreturn++;
         }
     }
     return $valreturn;
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:53,代码来源:task.class.php


示例7: displayValue

 function displayValue($output_type, $row)
 {
     if (!isset($row[$this->name]) || !$row[$this->name]) {
         return '';
     }
     if (!($value = getItemForItemtype($row[$this->name]))) {
         return $value;
     }
     if (is_null($this->obj) || get_class($this->obj) != $row[$this->name]) {
         $this->obj = new $row[$this->name]();
     }
     return $this->obj->getTypeName();
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:13,代码来源:columntype.class.php


示例8: showPreferences

 static function showPreferences()
 {
     global $DB, $CFG_GLPI, $PLUGIN_HOOKS;
     $target = Toolbox::getItemTypeFormURL(__CLASS__);
     $pref = new self();
     echo "<div class='center' id='pdf_type'>";
     foreach ($PLUGIN_HOOKS['plugin_pdf'] as $type => $plug) {
         if (!($item = getItemForItemtype($type))) {
             continue;
         }
         if ($item->canView()) {
             $pref->menu($item, $target);
         }
     }
     echo "</div>";
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:16,代码来源:preference.class.php


示例9: displayValue

 function displayValue($output_type, $row)
 {
     if (!isset($row[$this->name]) || !$row[$this->name]) {
         return '';
     }
     if (isset($row[$this->nametype]) && $row[$this->nametype] && (is_null($this->obj) || $this->obj->getType() != $row[$this->nametype])) {
         if (!($this->obj = getItemForItemtype($row[$this->nametype]))) {
             $this->obj = NULL;
         }
     }
     if (!$this->obj || !$this->obj->getFromDB($row[$this->name])) {
         return 'ID #' . $row[$this->name];
     }
     if ($output_type == Search::HTML_OUTPUT) {
         return $this->obj->getLink($this->with_comment);
     }
     return $this->obj->getNameID();
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:18,代码来源:columntypelink.class.php


示例10: getDatasForTemplate

 /**
  * Get all data needed for template processing
  *
  * @param $event
  * @param $options   array
  **/
 function getDatasForTemplate($event, $options = array())
 {
     $events = $this->getAllEvents();
     $this->datas['##infocom.entity##'] = Dropdown::getDropdownName('glpi_entities', $options['entities_id']);
     $this->datas['##infocom.action##'] = $events[$event];
     foreach ($options['items'] as $id => $item) {
         $tmp = array();
         if ($obj = getItemForItemtype($item['itemtype'])) {
             $tmp['##infocom.itemtype##'] = $obj->getTypeName(1);
             $tmp['##infocom.item##'] = $item['item_name'];
             $tmp['##infocom.expirationdate##'] = $item['warrantyexpiration'];
             $tmp['##infocom.url##'] = $this->formatURL($options['additionnaloption']['usertype'], $item['itemtype'] . "_" . $item['items_id'] . "_Infocom");
         }
         $this->datas['infocoms'][] = $tmp;
     }
     $this->getTags();
     foreach ($this->tag_descriptions[NotificationTarget::TAG_LANGUAGE] as $tag => $values) {
         if (!isset($this->datas[$tag])) {
             $this->datas[$tag] = $values['label'];
         }
     }
 }
开发者ID:btry,项目名称:glpi,代码行数:28,代码来源:notificationtargetinfocom.class.php


示例11: getDatasForTemplate

 /**
  * Get all data needed for template processing
  *
  * @param $event
  * @param $options   array
  **/
 function getDatasForTemplate($event, $options = array())
 {
     global $CFG_GLPI;
     $events = $this->getAllEvents();
     $this->datas['##infocom.entity##'] = Dropdown::getDropdownName('glpi_entities', $options['entities_id']);
     $this->datas['##infocom.action##'] = $events[$event];
     foreach ($options['items'] as $id => $item) {
         $tmp = array();
         if ($obj = getItemForItemtype($item['itemtype'])) {
             $tmp['##infocom.itemtype##'] = $obj->getTypeName(1);
             $tmp['##infocom.item##'] = $item['item_name'];
             $tmp['##infocom.expirationdate##'] = $item['warrantyexpiration'];
             $tmp['##infocom.url##'] = urldecode($CFG_GLPI["url_base"] . "/index.php?redirect=" . strtolower($item['itemtype']) . "_" . $item['items_id'] . "_Infocom");
         }
         $this->datas['infocoms'][] = $tmp;
     }
     $this->getTags();
     foreach ($this->tag_descriptions[NotificationTarget::TAG_LANGUAGE] as $tag => $values) {
         if (!isset($this->datas[$tag])) {
             $this->datas[$tag] = $values['label'];
         }
     }
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:29,代码来源:notificationtargetinfocom.class.php


示例12: getDatasForTemplate

 /**
  * Get all data needed for template processing
  *
  * @param $event
  * @param $options   array
  **/
 function getDatasForTemplate($event, $options = array())
 {
     //User who tries to add or update an item in DB
     $action = $options['action_user'] ? __('Add the item') : __('Update the item');
     $this->datas['##unicity.action_type##'] = $action;
     $this->datas['##unicity.action_user##'] = $options['action_user'];
     $this->datas['##unicity.date##'] = Html::convDateTime($options['date']);
     if ($item = getItemForItemtype($options['itemtype'])) {
         $this->datas['##unicity.itemtype##'] = $item->getTypeName(1);
         $this->datas['##unicity.message##'] = Html::clean($item->getUnicityErrorMessage($options['label'], $options['field'], $options['double']));
     }
     $this->datas['##unicity.entity##'] = Dropdown::getDropdownName('glpi_entities', $options['entities_id']);
     if ($options['refuse']) {
         $this->datas['##unicity.action##'] = __('Record into the database denied');
     } else {
         $this->datas['##unicity.action##'] = __('Item successfully added but duplicate record on');
     }
     $this->getTags();
     foreach ($this->tag_descriptions[NotificationTarget::TAG_LANGUAGE] as $tag => $values) {
         if (!isset($this->datas[$tag])) {
             $this->datas[$tag] = $values['label'];
         }
     }
 }
开发者ID:jose-martins,项目名称:glpi,代码行数:30,代码来源:notificationtargetfieldunicity.class.php


示例13: getHelpdeskItemtypes

 /**
  * @since version 0.85
  **/
 static function getHelpdeskItemtypes()
 {
     global $CFG_GLPI;
     $values = array();
     foreach ($CFG_GLPI["ticket_types"] as $key => $itemtype) {
         if ($item = getItemForItemtype($itemtype)) {
             $values[$itemtype] = $item->getTypeName();
         } else {
             unset($CFG_GLPI["ticket_types"][$key]);
         }
     }
     return $values;
 }
开发者ID:glpi-project,项目名称:glpi,代码行数:16,代码来源:profile.class.php


示例14: key

if (isset($_POST["sub_type"]) && class_exists($_POST["sub_type"])) {
    if (!isset($_POST["field"])) {
        $_POST["field"] = key(Rule::getActionsByType($_POST["sub_type"]));
    }
    if (!($item = getItemForItemtype($_POST["sub_type"]))) {
        exit;
    }
    if (!isset($_POST[$item->getRuleIdField()])) {
        exit;
    }
    // Existing action
    if ($_POST['ruleactions_id'] > 0) {
        $already_used = false;
    } else {
        // New action
        $ra = getItemForItemtype($item->getRuleActionClass());
        $used = $ra->getAlreadyUsedForRuleID($_POST[$item->getRuleIdField()], $item->getType());
        $already_used = in_array($_POST["field"], $used);
    }
    echo "<table width='100%'><tr><td width='30%'>";
    $action_type = '';
    if (isset($_POST["action_type"])) {
        $action_type = $_POST["action_type"];
    }
    $randaction = RuleAction::dropdownActions(array('subtype' => $_POST["sub_type"], 'name' => "action_type", 'field' => $_POST["field"], 'value' => $action_type, 'alreadyused' => $already_used));
    echo "</td><td>";
    echo "<span id='action_type_span{$randaction}'>\n";
    echo "</span>\n";
    $paramsaction = array('action_type' => '__VALUE__', 'field' => $_POST["field"], 'sub_type' => $_POST["sub_type"], $item->getForeignKeyField() => $_POST[$item->getForeignKeyField()]);
    Ajax::updateItemOnSelectEvent("dropdown_action_type{$randaction}", "action_type_span{$randaction}", $CFG_GLPI["root_doc"] . "/ajax/ruleactionvalue.php", $paramsaction);
    if (isset($_POST['value'])) {
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:31,代码来源:ruleaction.php


示例15: getInstantiation

 /**
  * \brief get the instantiation of the current NetworkPort
  * The instantiation rely on the instantiation_type field and the id of the NetworkPort. If the
  * network port exists, but not its instantiation, then, the instantiation will be empty.
  *
  * @since version 0.84
  *
  * @return the instantiation object or false if the type of instantiation is not known
  **/
 function getInstantiation()
 {
     if (isset($this->fields['instantiation_type']) && in_array($this->fields['instantiation_type'], self::getNetworkPortInstantiations())) {
         if ($instantiation = getItemForItemtype($this->fields['instantiation_type'])) {
             if (!$instantiation->getFromDB($this->getID())) {
                 if (!$instantiation->getEmpty()) {
                     unset($instantiation);
                     return false;
                 }
             }
             return $instantiation;
         }
     }
     return false;
 }
开发者ID:gaforeror,项目名称:glpi,代码行数:24,代码来源:networkport.class.php


示例16: sprintf

            case Log::HISTORY_DELETE_DEVICE:
                $field = NOT_AVAILABLE;
                if ($item = getItemForItemtype($data["itemtype_link"])) {
                    $field = $item->getTypeName();
                }
                $change = sprintf(__('%1$s: %1$s'), __('Delete the component'), $data["old_value"]);
                break;
            case Log::HISTORY_DISCONNECT_DEVICE:
                if (!($item = getItemForItemtype($data["itemtype_link"]))) {
                    continue;
                }
                $field = $item->getTypeName();
                $change = sprintf(__('%1$s: %2$s'), __('Logout'), $data["old_value"]);
                break;
            case Log::HISTORY_CONNECT_DEVICE:
                if (!($item = getItemForItemtype($data["itemtype_link"]))) {
                    continue;
                }
                $field = $item->getTypeName();
                $change = sprintf(__('%1$s: %2$s'), __('Logout'), $data["new_value"]);
                break;
        }
        //fin du switch
    }
    echo $field . "<td>" . $change;
}
if (!empty($prev)) {
    echo "</td></tr>\n";
}
echo "</table><p>" . __('The list is limited to 100 items and 21 days', 'reports') . "</p></div>\n";
Html::footer();
开发者ID:geldarr,项目名称:hack-space,代码行数:31,代码来源:histohard.php


示例17: header

*/
/** @file
* @brief
*/
// Direct access to file
if (strpos($_SERVER['PHP_SELF'], "rulecriteria.php")) {
    include '../inc/includes.php';
    header("Content-Type: text/html; charset=UTF-8");
    Html::header_nocache();
} else {
    if (!defined('GLPI_ROOT')) {
        die("Sorry. You can't access this file directly");
    }
}
Session::checkLoginUser();
if (isset($_POST["sub_type"]) && ($rule = getItemForItemtype($_POST["sub_type"]))) {
    $criterias = $rule->getAllCriteria();
    if (count($criterias)) {
        // First include -> first of the predefined array
        if (!isset($_POST["criteria"])) {
            $_POST["criteria"] = key($criterias);
        }
        if (isset($criterias[$_POST["criteria"]]['allow_condition'])) {
            $allow_condition = $criterias[$_POST["criteria"]]['allow_condition'];
        } else {
            $allow_condition = array();
        }
        $condparam = array('criterion' => $_POST["criteria"], 'allow_conditions' => $allow_condition);
        if (isset($_POST['condition'])) {
            $condparam['value'] = $_POST['condition'];
        }
开发者ID:stweil,项目名称:glpi,代码行数:31,代码来源:rulecriteria.php


示例18: showShort


//.........这里部分代码省略.........
             $fourth_col .= "<br>";
         }
         foreach ($item->getGroups(CommonITILActor::REQUESTER) as $d) {
             $fourth_col .= Dropdown::getDropdownName("glpi_groups", $d["groups_id"]);
             $fourth_col .= "<br>";
         }
         echo Search::showItem($p['output_type'], $fourth_col, $item_num, $p['row_num'], $align);
         // Fifth column
         $fifth_col = "";
         foreach ($item->getUsers(CommonITILActor::ASSIGN) as $d) {
             $userdata = getUserName($d["users_id"], 2);
             $fifth_col .= sprintf(__('%1$s %2$s'), "<span class='b'>" . $userdata['name'] . "</span>", Html::showToolTip($userdata["comment"], array('link' => $userdata["link"], 'display' => false)));
             $fifth_col .= "<br>";
         }
         foreach ($item->getGroups(CommonITILActor::ASSIGN) as $d) {
             $fifth_col .= Dropdown::getDropdownName("glpi_groups", $d["groups_id"]);
             $fifth_col .= "<br>";
         }
         foreach ($item->getSuppliers(CommonITILActor::ASSIGN) as $d) {
             $fifth_col .= Dropdown::getDropdownName("glpi_suppliers", $d["suppliers_id"]);
             $fifth_col .= "<br>";
         }
         echo Search::showItem($p['output_type'], $fifth_col, $item_num, $p['row_num'], $align);
         // Sixth Colum
         // Ticket : simple link to item
         $sixth_col = "";
         $is_deleted = false;
         $item_ticket = new Item_Ticket();
         $data = $item_ticket->find("`tickets_id` = " . $item->fields['id']);
         if ($item->getType() == 'Ticket') {
             if (!empty($data)) {
                 foreach ($data as $val) {
                     if (!empty($val["itemtype"]) && $val["items_id"] > 0) {
                         if ($object = getItemForItemtype($val["itemtype"])) {
                             if ($object->getFromDB($val["items_id"])) {
                                 $is_deleted = $object->isDeleted();
                                 $sixth_col .= $object->getTypeName();
                                 $sixth_col .= " - <span class='b'>";
                                 if ($item->canView()) {
                                     $sixth_col .= $object->getLink();
                                 } else {
                                     $sixth_col .= $object->getNameID();
                                 }
                                 $sixth_col .= "</span><br>";
                             }
                         }
                     }
                 }
             } else {
                 $sixth_col = __('General');
             }
             echo Search::showItem($p['output_type'], $sixth_col, $item_num, $p['row_num'], $is_deleted ? " class='center deleted' " : $align);
         }
         // Seventh column
         echo Search::showItem($p['output_type'], "<span class='b'>" . Dropdown::getDropdownName('glpi_itilcategories', $item->fields["itilcategories_id"]) . "</span>", $item_num, $p['row_num'], $align);
         // Eigth column
         $eigth_column = "<span class='b'>" . $item->getName() . "</span>&nbsp;";
         // Add link
         if ($item->canViewItem()) {
             $eigth_column = "<a id='" . $item->getType() . $item->fields["id"] . "{$rand}' href=\"" . $item->getLinkURL() . "\">{$eigth_column}</a>";
             if ($p['followups'] && $p['output_type'] == Search::HTML_OUTPUT) {
                 $eigth_column .= TicketFollowup::showShortForTicket($item->fields["id"]);
             } else {
                 if (method_exists($item, 'numberOfFollowups')) {
                     $eigth_column = sprintf(__('%1$s (%2$s)'), $eigth_column, sprintf(__('%1$s - %2$s'), $item->numberOfFollowups($showprivate), $item->numberOfTasks($showprivate)));
                 } else {
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:67,代码来源:commonitilobject.class.php


示例19: 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'" : "'");
//.........这里部分代码省略.........
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:101,代码来源:item_problem.class.php


示例20: die

    Html::header_nocache();
}
if (!defined('GLPI_ROOT')) {
    die("Can not acces directly to this file");
}
Session::checkLoginUser();
if (isset($_POST['searchtype'])) {
    $searchopt = $_POST['searchopt'];
    $_POST['value'] = rawurldecode($_POST['value']);
    $fieldname = 'criteria';
    if (isset($_POST['meta']) && $_POST['meta']) {
        $fieldname = 'metacriteria';
    }
    $inputname = $fieldname . '[' . $_POST['num'] . '][value]';
    $display = false;
    $item = getItemForItemtype($_POST['itemtype']);
    $options2 = array();
    $options2['value'] = $_POST['value'];
    $options2['width'] = '100%';
    // For tree dropdpowns
    $options2['permit_select_parent'] = true;
    switch ($_POST['searchtype']) {
        case "equals":
        case "notequals":
        case "morethan":
        case "lessthan":
        case "under":
        case "notunder":
            if (!$display && isset($searchopt['field'])) {
                // Specific cases
                switch ($searchopt['table'] . "." . $searchopt['field']) {
开发者ID:jose-martins,项目名称:glpi,代码行数:31,代码来源:searchoptionvalue.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP getItemTemplateContents函数代码示例发布时间:2022-05-15
下一篇:
PHP getItemByID函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap