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


PHP TicketValidation::getCreateRights方法代码示例

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


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

示例1: getSearchOptions


//.........这里部分代码省略.........
     $tab[27]['joinparams'] = array('jointype' => 'child', 'condition' => $followup_condition);
     $tab[29]['table'] = 'glpi_requesttypes';
     $tab[29]['field'] = 'name';
     $tab[29]['name'] = __('Request source');
     $tab[29]['datatype'] = 'dropdown';
     $tab[29]['forcegroupby'] = true;
     $tab[29]['massiveaction'] = false;
     $tab[29]['joinparams'] = array('beforejoin' => array('table' => 'glpi_ticketfollowups', 'joinparams' => array('jointype' => 'child', 'condition' => $followup_condition)));
     $tab[91]['table'] = 'glpi_ticketfollowups';
     $tab[91]['field'] = 'is_private';
     $tab[91]['name'] = __('Private followup');
     $tab[91]['datatype'] = 'bool';
     $tab[91]['forcegroupby'] = true;
     $tab[91]['splititems'] = true;
     $tab[91]['massiveaction'] = false;
     $tab[91]['joinparams'] = array('jointype' => 'child', 'condition' => $followup_condition);
     $tab[93]['table'] = 'glpi_users';
     $tab[93]['field'] = 'name';
     $tab[93]['name'] = __('Writer');
     $tab[93]['datatype'] = 'itemlink';
     $tab[93]['right'] = 'all';
     $tab[93]['forcegroupby'] = true;
     $tab[93]['massiveaction'] = false;
     $tab[93]['joinparams'] = array('beforejoin' => array('table' => 'glpi_ticketfollowups', 'joinparams' => array('jointype' => 'child', 'condition' => $followup_condition)));
     $tab += $this->getSearchOptionsStats();
     $tab[150]['table'] = $this->getTable();
     $tab[150]['field'] = 'takeintoaccount_delay_stat';
     $tab[150]['name'] = __('Take into account time');
     $tab[150]['datatype'] = 'timestamp';
     $tab[150]['forcegroupby'] = true;
     $tab[150]['massiveaction'] = false;
     if (Session::haveRightsOr(self::$rightname, array(self::READALL, self::READASSIGN, self::OWN))) {
         $tab['linktickets'] = _n('Linked ticket', 'Linked tickets', Session::getPluralNumber());
         $tab[40]['table'] = 'glpi_tickets_tickets';
         $tab[40]['field'] = 'tickets_id_1';
         $tab[40]['name'] = __('All linked tickets');
         $tab[40]['massiveaction'] = false;
         $tab[40]['forcegroupby'] = true;
         $tab[40]['searchtype'] = 'equals';
         $tab[40]['joinparams'] = array('jointype' => 'item_item');
         $tab[40]['additionalfields'] = array('tickets_id_2');
         $tab[47]['table'] = 'glpi_tickets_tickets';
         $tab[47]['field'] = 'tickets_id_1';
         $tab[47]['name'] = __('Duplicated tickets');
         $tab[47]['massiveaction'] = false;
         $tab[47]['searchtype'] = 'equals';
         $tab[47]['joinparams'] = array('jointype' => 'item_item', 'condition' => "AND NEWTABLE.`link` = " . Ticket_Ticket::DUPLICATE_WITH);
         $tab[47]['datatype'] = 'dropdown';
         $tab[47]['forcegroupby'] = true;
         $tab[41]['table'] = 'glpi_tickets_tickets';
         $tab[41]['field'] = 'id';
         $tab[41]['name'] = __('Number of all linked tickets');
         $tab[41]['massiveaction'] = false;
         $tab[41]['datatype'] = 'count';
         $tab[41]['usehaving'] = true;
         $tab[41]['joinparams'] = array('jointype' => 'item_item');
         $tab[46]['table'] = 'glpi_tickets_tickets';
         $tab[46]['field'] = 'id';
         $tab[46]['name'] = __('Number of duplicated tickets');
         $tab[46]['massiveaction'] = false;
         $tab[46]['datatype'] = 'count';
         $tab[46]['usehaving'] = true;
         $tab[46]['joinparams'] = array('jointype' => 'item_item', 'condition' => "AND NEWTABLE.`link` = " . Ticket_Ticket::DUPLICATE_WITH);
         $tab += TicketTask::getSearchOptionsToAdd();
         $tab += $this->getSearchOptionsSolution();
         if (Session::haveRight('ticketcost', READ)) {
             $tab += TicketCost::getSearchOptionsToAdd();
         }
         $tab['problem'] = Problem::getTypeName(Session::getPluralNumber());
         $tab[141]['table'] = 'glpi_problems_tickets';
         $tab[141]['field'] = 'id';
         $tab[141]['name'] = _x('quantity', 'Number of problems');
         $tab[141]['forcegroupby'] = true;
         $tab[141]['usehaving'] = true;
         $tab[141]['datatype'] = 'count';
         $tab[141]['massiveaction'] = false;
         $tab[141]['joinparams'] = array('jointype' => 'child');
     }
     // Filter search fields for helpdesk
     if (!Session::isCron() && (!isset($_SESSION['glpiactiveprofile']['interface']) || $_SESSION['glpiactiveprofile']['interface'] == 'helpdesk')) {
         $tokeep = array('common', 'requester', 'satisfaction');
         if (Session::haveRightsOr('ticketvalidation', array_merge(TicketValidation::getValidateRights(), TicketValidation::getCreateRights()))) {
             $tokeep[] = 'validation';
         }
         $keep = false;
         foreach ($tab as $key => $val) {
             if (!is_array($val)) {
                 $keep = in_array($key, $tokeep);
             }
             if (!$keep) {
                 if (is_array($val)) {
                     $tab[$key]['nosearch'] = true;
                 }
             }
         }
         // last updater no search
         $tab[64]['nosearch'] = true;
     }
     return $tab;
 }
开发者ID:xsgoodbox,项目名称:glpi,代码行数:101,代码来源:ticket.class.php

示例2: showForm


//.........这里部分代码省略.........
     // Display validation state
     echo "<th>";
     if (!$ID) {
         echo $tt->getBeginHiddenFieldText('_add_validation');
         printf(__('%1$s%2$s'), __('Approval request'), $tt->getMandatoryMark('_add_validation'));
         echo $tt->getEndHiddenFieldText('_add_validation');
     } else {
         echo $tt->getBeginHiddenFieldText('global_validation');
         _e('Approval');
         echo $tt->getEndHiddenFieldText('global_validation');
     }
     echo "</th>";
     echo "<td>";
     if (!$ID) {
         echo $tt->getBeginHiddenFieldValue('_add_validation');
         $validation_right = '';
         if ($values['type'] == self::INCIDENT_TYPE && Session::haveRight('ticketvalidation', TicketValidation::CREATEINCIDENT)) {
             $validation_right = 'validate_incident';
         }
         if ($values['type'] == self::DEMAND_TYPE && Session::haveRight('ticketvalidation', TicketValidation::CREATEREQUEST)) {
             $validation_right = 'validate_request';
         }
         if (!empty($validation_right)) {
             echo "<input type='hidden' name='_add_validation' value='" . $values['_add_validation'] . "'>";
             $params = array('name' => "users_id_validate", 'entity' => $this->fields['entities_id'], 'right' => $validation_right, 'users_id_validate' => $values['users_id_validate']);
             TicketValidation::dropdownValidator($params);
         }
         echo $tt->getEndHiddenFieldValue('_add_validation', $this);
         if ($tt->isPredefinedField('global_validation')) {
             echo "<input type='hidden' name='global_validation' value='" . $tt->predefined['global_validation'] . "'>";
         }
     } else {
         echo $tt->getBeginHiddenFieldValue('global_validation');
         if (Session::haveRightsOr('ticketvalidation', TicketValidation::getCreateRights()) && $canupdate) {
             TicketValidation::dropdownStatus('global_validation', array('global' => true, 'value' => $this->fields['global_validation']));
         } else {
             echo TicketValidation::getStatus($this->fields['global_validation']);
         }
         echo $tt->getEndHiddenFieldValue('global_validation', $this);
     }
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<th>" . $tt->getBeginHiddenFieldText('impact');
     printf(__('%1$s%2$s'), __('Impact'), $tt->getMandatoryMark('impact'));
     echo $tt->getEndHiddenFieldText('impact') . "</th>";
     echo "<td>";
     echo $tt->getBeginHiddenFieldValue('impact');
     if ($canupdate) {
         $idimpact = self::dropdownImpact(array('value' => $this->fields["impact"]));
     } else {
         $idimpact = "value_impact" . mt_rand();
         echo "<input id='{$idimpact}' type='hidden' name='impact' value='" . $this->fields["impact"] . "'>";
         echo parent::getImpactName($this->fields["impact"]);
     }
     echo $tt->getEndHiddenFieldValue('impact', $this);
     echo "</td>";
     echo "<th>" . $tt->getBeginHiddenFieldText('locations_id');
     printf(__('%1$s%2$s'), __('Location'), $tt->getMandatoryMark('locations_id'));
     echo $tt->getEndHiddenFieldText('locations_id') . "</th>";
     echo "<td>";
     echo $tt->getBeginHiddenFieldValue('locations_id');
     if ($canupdate || !$ID) {
         Location::dropdown(array('value' => $this->fields['locations_id'], 'entity' => $this->fields['entities_id']));
     } else {
         echo Dropdown::getDropdownName('glpi_locations', $this->fields["locations_id"]);
     }
开发者ID:glpi-project,项目名称:glpi,代码行数:67,代码来源:ticket.class.php

示例3: showSummary

 /**
  * Print the validation list into item
  *
  * @param $item class
  **/
 function showSummary($item)
 {
     global $DB, $CFG_GLPI;
     if (!Session::haveRightsOr(static::$rightname, array_merge(static::getCreateRights(), static::getValidateRights(), static::getPurgeRights()))) {
         return false;
     }
     $tID = $item->fields['id'];
     $tmp = array(static::$items_id => $tID);
     $canadd = $this->can(-1, CREATE, $tmp);
     $rand = mt_rand();
     if ($canadd) {
         echo "<form method='post' name=form action='" . Toolbox::getItemTypeFormURL(static::$itemtype) . "'>";
     }
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr>";
     echo "<th colspan='3'>" . self::getTypeName(Session::getPluralNumber()) . "</th>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Global approval status') . "</td>";
     echo "<td colspan='2'>";
     if (Session::haveRightsOr(static::$rightname, TicketValidation::getCreateRights())) {
         self::dropdownStatus("global_validation", array('value' => $item->fields["global_validation"]));
     } else {
         echo TicketValidation::getStatus($item->fields["global_validation"]);
     }
     echo "</td></tr>";
     echo "<tr>";
     echo "<th colspan='2'>" . _x('item', 'State') . "</th>";
     echo "<th colspan='2'>";
     echo self::getValidationStats($tID);
     echo "</th>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Minimum validation required') . "</td>";
     if ($canadd) {
         echo "<td>";
         echo $item->getValueToSelect('validation_percent', 'validation_percent', $item->fields["validation_percent"]);
         echo "</td>";
         echo "<td><input type='submit' name='update' class='submit' value='" . _sx('button', 'Save') . "'>";
         if (!empty($tID)) {
             echo "<input type='hidden' name='id' value='{$tID}'>";
         }
         echo "</td>";
     } else {
         echo "<td colspan='2'>";
         echo Dropdown::getValueWithUnit($item->fields["validation_percent"], "%");
         echo "</td>";
     }
     echo "</tr>";
     echo "</table>";
     if ($canadd) {
         Html::closeForm();
     }
     echo "<div id='viewvalidation" . $tID . "{$rand}'></div>\n";
     if ($canadd) {
         echo "<script type='text/javascript' >\n";
         echo "function viewAddValidation" . $tID . "{$rand}() {\n";
         $params = array('type' => $this->getType(), 'parenttype' => static::$itemtype, static::$items_id => $tID, 'id' => -1);
         Ajax::updateItemJsCode("viewvalidation" . $tID . "{$rand}", $CFG_GLPI["root_doc"] . "/ajax/viewsubitem.php", $params);
         echo "};";
         echo "</script>\n";
         if (!in_array($item->fields['status'], array_merge($item->getSolvedStatusArray(), $item->getClosedStatusArray()))) {
             echo "<div class='center'>";
             echo "<a class='vsubmit' href='javascript:viewAddValidation" . $tID . "{$rand}();'>";
             echo __('Send an approval request') . "</a></div><br>\n";
         }
     }
     $query = "SELECT *\n                FROM `" . $this->getTable() . "`\n                WHERE `" . static::$items_id . "` = '" . $item->getField('id') . "'";
     if (!$canadd) {
         $query .= " AND `users_id_validate` = '" . Session::getLoginUserID() . "'";
     }
     $query .= " ORDER BY submission_date DESC";
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     if ($number) {
         $colonnes = array(_x('item', 'State'), __('Request date'), __('Approval requester'), __('Request comments'), __('Approval status'), __('Approver'), __('Approval comments'));
         $nb_colonnes = count($colonnes);
         echo "<table class='tab_cadre_fixehov'>";
         echo "<tr class='noHover'><th colspan='" . $nb_colonnes . "'>" . __('Approvals for the ticket') . "</th></tr>";
         $header = "<tr>";
         foreach ($colonnes as $colonne) {
             $header .= "<th>" . $colonne . "</th>";
         }
         $header .= "</tr>";
         echo $header;
         Session::initNavigateListItems($this->getType(), sprintf(__('%1$s = %2$s'), $item->getTypeName(1), $item->fields["name"]));
         while ($row = $DB->fetch_assoc($result)) {
             $canedit = $this->canEdit($row["id"]);
             Session::addToNavigateListItems($this->getType(), $row["id"]);
             $bgcolor = self::getStatusColor($row['status']);
             $status = self::getStatus($row['status']);
             echo "<tr class='tab_bg_1' " . ($canedit ? "style='cursor:pointer' onClick=\"viewEditValidation" . $item->fields['id'] . $row["id"] . "{$rand}();\"" : '') . " id='viewvalidation" . $this->fields[static::$items_id] . $row["id"] . "{$rand}'>";
             echo "<td>";
             if ($canedit) {
                 echo "\n<script type='text/javascript' >\n";
//.........这里部分代码省略.........
开发者ID:pvasener,项目名称:glpi,代码行数:101,代码来源:commonitilvalidation.class.php


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