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


PHP TicketValidation::canCreate方法代码示例

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


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

示例1: getSpecificMassiveActions

 /**
  * @see CommonDBTM::getSpecificMassiveActions()
  **/
 function getSpecificMassiveActions($checkitem = NULL)
 {
     $isadmin = static::canUpdate();
     $actions = parent::getSpecificMassiveActions($checkitem);
     if ($_SESSION['glpiactiveprofile']['interface'] == 'central') {
         if (TicketFollowup::canCreate()) {
             $actions['TicketFollowup' . MassiveAction::CLASS_ACTION_SEPARATOR . 'add_followup'] = __('Add a new followup');
         }
         if (TicketTask::canCreate()) {
             $actions[__CLASS__ . MassiveAction::CLASS_ACTION_SEPARATOR . 'add_task'] = __('Add a new task');
         }
         if (TicketValidation::canCreate()) {
             $actions['TicketValidation' . MassiveAction::CLASS_ACTION_SEPARATOR . 'submit_validation'] = __('Approval request');
         }
         if (Item_Ticket::canCreate()) {
             $actions['Item_Ticket' . MassiveAction::CLASS_ACTION_SEPARATOR . 'add_item'] = _x('button', 'Add an item');
         }
         if (Item_Ticket::canDelete()) {
             $actions['Item_Ticket' . MassiveAction::CLASS_ACTION_SEPARATOR . 'delete_item'] = _x('button', 'Remove an item');
         }
         if (Session::haveRight(self::$rightname, UPDATE)) {
             $actions[__CLASS__ . MassiveAction::CLASS_ACTION_SEPARATOR . 'add_actor'] = __('Add an actor');
             $actions[__CLASS__ . MassiveAction::CLASS_ACTION_SEPARATOR . 'enable_notif'] = __('Set notifications for all actors');
             $actions['Ticket_Ticket' . MassiveAction::CLASS_ACTION_SEPARATOR . 'add'] = _x('button', 'Link tickets');
         }
         if (Session::haveRight(self::$rightname, UPDATE)) {
             MassiveAction::getAddTransferList($actions);
         }
     }
     return $actions;
 }
开发者ID:glpi-project,项目名称:glpi,代码行数:34,代码来源:ticket.class.php

示例2: prepareInputForUpdate

 function prepareInputForUpdate($input)
 {
     global $LANG, $CFG_GLPI;
     // Get ticket : need for comparison
     $this->getFromDB($input['id']);
     if (isset($input["date"]) && empty($input["date"])) {
         unset($input["date"]);
     }
     if (isset($input["closedate"]) && empty($input["closedate"])) {
         unset($input["closedate"]);
     }
     if (isset($input["solvedate"]) && empty($input["solvedate"])) {
         unset($input["solvedate"]);
     }
     // check mandatory fields
     if ($CFG_GLPI["is_ticket_title_mandatory"] && isset($input['name'])) {
         $title = trim($input['name']);
         if (empty($title)) {
             addMessageAfterRedirect($LANG['tracking'][6], false, ERROR);
             unset($input['name']);
         }
     }
     if ($CFG_GLPI["is_ticket_content_mandatory"] && isset($input['content'])) {
         $content = trim($input['content']);
         if (empty($content)) {
             addMessageAfterRedirect($LANG['tracking'][7], false, ERROR);
             unset($input['content']);
         }
     }
     // Security checks
     if (is_numeric(getLoginUserID(false)) && !haveRight("assign_ticket", "1")) {
         if (isset($input["_ticket_assign"]) && isset($input['_ticket_assign']['_type']) && $input['_ticket_assign']['_type'] == 'user') {
             // must own_ticket to grab a non assign ticket
             if ($this->countUsers(self::ASSIGN) == 0) {
                 if (!haveRight("steal_ticket", "1") && !haveRight("own_ticket", "1") || !isset($input["_ticket_assign"]['users_id']) || $input["_ticket_assign"]['users_id'] != getLoginUserID()) {
                     unset($input["_ticket_assign"]);
                 }
             } else {
                 // Can not steal or can steal and not assign to me
                 if (!haveRight("steal_ticket", "1") || !isset($input["_ticket_assign"]['users_id']) || $input["_ticket_assign"]['users_id'] != getLoginUserID()) {
                     unset($input["_ticket_assign"]);
                 }
             }
         }
         // No supplier assign
         if (isset($input["suppliers_id_assign"])) {
             unset($input["suppliers_id_assign"]);
         }
         // No group
         if (isset($input["_ticket_assign"]) && isset($input['_ticket_assign']['_type']) && $input['_ticket_assign']['_type'] == 'group') {
             unset($input["_ticket_assign"]);
         }
     }
     if (is_numeric(getLoginUserID(false)) && !haveRight("update_ticket", "1")) {
         $allowed_fields = array('id');
         if ($this->canApprove() && isset($input["status"])) {
             $allowed_fields[] = 'status';
         }
         // for post-only with validate right
         $ticketval = new TicketValidation();
         if (TicketValidation::canValidate($this->fields['id']) || $ticketval->canCreate()) {
             $allowed_fields[] = 'global_validation';
         }
         // Manage assign and steal right
         if (haveRight('assign_ticket', 1) || haveRight('steal_ticket', 1)) {
             $allowed_fields[] = '_ticket_assign';
         }
         if (haveRight('assign_ticket', 1)) {
             $allowed_fields[] = 'suppliers_id_assign';
         }
         // Can only update initial fields if no followup or task already added
         if ($this->numberOfFollowups() == 0 && $this->numberOfTasks() == 0 && $this->isUser(self::REQUESTER, getLoginUserID())) {
             $allowed_fields[] = 'content';
             $allowed_fields[] = 'urgency';
             $allowed_fields[] = 'ticketcategories_id';
             $allowed_fields[] = 'itemtype';
             $allowed_fields[] = 'items_id';
             $allowed_fields[] = 'name';
         }
         if ($this->canSolve()) {
             $allowed_fields[] = 'ticketsolutiontypes_id';
             $allowed_fields[] = 'solution';
         }
         foreach ($allowed_fields as $field) {
             if (isset($input[$field])) {
                 $ret[$field] = $input[$field];
             }
         }
         $input = $ret;
     }
     // Manage fields from auto update : map rule actions to standard ones
     if (isset($input['_auto_update'])) {
         if (isset($input['_users_id_assign'])) {
             $input['_ticket_assign']['_type'] = 'user';
             $input['_ticket_assign']['users_id'] = $input['_users_id_assign'];
         }
         if (isset($input['_groups_id_assign'])) {
             $input['_ticket_assign']['_type'] = 'group';
             $input['_ticket_assign']['groups_id'] = $input['_groups_id_assign'];
         }
//.........这里部分代码省略.........
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:101,代码来源:ticket.class.php

示例3: getSpecificMassiveActions

 /**
  * @see CommonDBTM::getSpecificMassiveActions()
  **/
 function getSpecificMassiveActions($checkitem = NULL)
 {
     $isadmin = static::canUpdate();
     $actions = parent::getSpecificMassiveActions($checkitem);
     if (TicketFollowup::canCreate() && $_SESSION['glpiactiveprofile']['interface'] == 'central') {
         $actions['add_followup'] = __('Add a new followup');
     }
     if (TicketTask::canCreate()) {
         $actions['add_task'] = __('Add a new task');
     }
     if (TicketValidation::canCreate()) {
         $actions['submit_validation'] = __('Approval request');
     }
     if (Session::haveRight("update_ticket", "1")) {
         $actions['add_actor'] = __('Add an actor');
         $actions['link_ticket'] = _x('button', 'Link tickets');
     }
     if (Session::haveRight('transfer', 'r') && Session::isMultiEntitiesMode() && Session::haveRight("update_ticket", "1")) {
         $actions['add_transfer_list'] = _x('button', 'Add to transfer list');
     }
     return $actions;
 }
开发者ID:gaforeror,项目名称:glpi,代码行数:25,代码来源:ticket.class.php

示例4: showForMassiveAction

 /**
  * Dropdown of actions for massive action
  *
  * @param $itemtype item type
  * @param $is_deleted massive action for deleted items ?
  * @param $extraparams array of extra parameters
  **/
 static function showForMassiveAction($itemtype, $is_deleted = 0, $extraparams = array())
 {
     global $LANG, $CFG_GLPI, $PLUGIN_HOOKS;
     /// TODO include in CommonDBTM defining only getAdditionalMassiveAction in sub classes
     /// for specific actions (return a array of action name and title)
     if (!class_exists($itemtype)) {
         return false;
     }
     if ($itemtype == 'NetworkPort') {
         echo "<select name='massiveaction' id='massiveaction'>";
         echo "<option value='-1' selected>" . DROPDOWN_EMPTY_VALUE . "</option>";
         echo "<option value='delete'>" . $LANG['buttons'][6] . "</option>";
         echo "<option value='assign_vlan'>" . $LANG['networking'][55] . "</option>";
         echo "<option value='unassign_vlan'>" . $LANG['networking'][58] . "</option>";
         // Interest of this massive action ?
         //          echo "<option value='move'>".$LANG['buttons'][20]."</option>";
         echo "</select>";
         $params = array('action' => '__VALUE__', 'itemtype' => $itemtype);
         ajaxUpdateItemOnSelectEvent("massiveaction", "show_massiveaction", $CFG_GLPI["root_doc"] . "/ajax/dropdownMassiveActionPorts.php", $params);
         echo "<span id='show_massiveaction'>&nbsp;</span>\n";
     } else {
         $item = new $itemtype();
         $infocom = new Infocom();
         $isadmin = $item->canUpdate();
         echo "<select name='massiveaction' id='massiveaction'>";
         echo "<option value='-1' selected>" . DROPDOWN_EMPTY_VALUE . "</option>";
         if (!in_array($itemtype, $CFG_GLPI["massiveaction_noupdate_types"]) && ($isadmin && $itemtype != 'Ticket' || in_array($itemtype, $CFG_GLPI["infocom_types"]) && $infocom->canUpdate() || $itemtype == 'Ticket' && haveRight('update_ticket', 1))) {
             echo "<option value='update'>" . $LANG['buttons'][14] . "</option>";
         }
         if (in_array($itemtype, $CFG_GLPI["infocom_types"]) && $infocom->canCreate()) {
             echo "<option value='activate_infocoms'>" . $LANG['financial'][68] . "</option>";
         }
         if ($is_deleted && !in_array($itemtype, $CFG_GLPI["massiveaction_nodelete_types"])) {
             if ($isadmin) {
                 echo "<option value='purge'>" . $LANG['buttons'][22] . "</option>";
                 echo "<option value='restore'>" . $LANG['buttons'][21] . "</option>";
             }
         } else {
             // No delete for entities and tracking of not have right
             if (!in_array($itemtype, $CFG_GLPI["massiveaction_nodelete_types"]) && ($isadmin && $itemtype != 'Ticket' || $itemtype == 'Ticket' && haveRight('delete_ticket', 1))) {
                 if ($item->maybeDeleted()) {
                     echo "<option value='delete'>" . $LANG['buttons'][6] . "</option>";
                 } else {
                     echo "<option value='purge'>" . $LANG['buttons'][22] . "</option>";
                 }
             }
             if ($isadmin && in_array($itemtype, array('Phone', 'Printer', 'Peripheral', 'Monitor'))) {
                 echo "<option value='connect'>" . $LANG['buttons'][9] . "</option>";
                 echo "<option value='disconnect'>" . $LANG['buttons'][10] . "</option>";
             }
             if (in_array($itemtype, $CFG_GLPI["document_types"])) {
                 $doc = new Document();
                 if ($doc->canView()) {
                     echo "<option value='add_document'>" . $LANG['document'][16] . "</option>";
                 }
             }
             if (in_array($itemtype, $CFG_GLPI["contract_types"])) {
                 $contract = new Contract();
                 if ($contract->canUpdate()) {
                     echo "<option value='add_contract'>" . $LANG['financial'][36] . "</option>";
                 }
             }
             if (haveRight('transfer', 'r') && isMultiEntitiesMode() && in_array($itemtype, array('CartridgeItem', 'Computer', 'ConsumableItem', 'Contact', 'Contract', 'Supplier', 'Monitor', 'NetworkEquipment', 'Peripheral', 'Phone', 'Printer', 'Software', 'SoftwareLicense', 'Ticket', 'Document', 'Group', 'Link')) && $isadmin) {
                 echo "<option value='add_transfer_list'>" . $LANG['buttons'][48] . "</option>";
             }
             switch ($itemtype) {
                 case 'Software':
                     if ($isadmin && countElementsInTable("glpi_rules", "sub_type='RuleSoftwareCategory'") > 0) {
                         echo "<option value='compute_software_category'>" . $LANG['rulesengine'][38] . " " . $LANG['rulesengine'][40] . "</option>";
                     }
                     if (haveRight("rule_dictionnary_software", "w") && countElementsInTable("glpi_rules", "sub_type='RuleDictionnarySoftware'") > 0) {
                         echo "<option value='replay_dictionnary'>" . $LANG['rulesengine'][76] . "</option>";
                     }
                     break;
                 case 'Computer':
                     if ($isadmin) {
                         echo "<option value='connect_to_computer'>" . $LANG['buttons'][9] . "</option>";
                         echo "<option value='install'>" . $LANG['buttons'][4] . "</option>";
                         if ($CFG_GLPI['use_ocs_mode']) {
                             if (haveRight("ocsng", "w") || haveRight("sync_ocsng", "w")) {
                                 echo "<option value='force_ocsng_update'>" . $LANG['ocsng'][24] . "</option>";
                             }
                             echo "<option value='unlock_ocsng_field'>" . $LANG['buttons'][38] . " " . $LANG['Menu'][33] . " - " . $LANG['ocsng'][16] . "</option>";
                             echo "<option value='unlock_ocsng_monitor'>" . $LANG['buttons'][38] . " " . $LANG['Menu'][33] . " - " . $LANG['ocsng'][30] . "</option>";
                             echo "<option value='unlock_ocsng_peripheral'>" . $LANG['buttons'][38] . " " . $LANG['Menu'][33] . " - " . $LANG['ocsng'][32] . "</option>";
                             echo "<option value='unlock_ocsng_printer'>" . $LANG['buttons'][38] . " " . $LANG['Menu'][33] . " - " . $LANG['ocsng'][34] . "</option>";
                             echo "<option value='unlock_ocsng_software'>" . $LANG['buttons'][38] . " " . $LANG['Menu'][33] . " - " . $LANG['ocsng'][52] . "</option>";
                             echo "<option value='unlock_ocsng_ip'>" . $LANG['buttons'][38] . " " . $LANG['Menu'][33] . " - " . $LANG['ocsng'][50] . "</option>";
                             echo "<option value='unlock_ocsng_disk'>" . $LANG['buttons'][38] . " " . $LANG['Menu'][33] . " - " . $LANG['ocsng'][55] . "</option>";
                         }
                     }
                     break;
                 case 'Supplier':
//.........这里部分代码省略.........
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:101,代码来源:dropdown.class.php


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