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


PHP Ticket::getActionTime方法代码示例

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


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

示例1: getHistoryData


//.........这里部分代码省略.........
                     $tmp['change'] = $data["new_value"];
                     break;
                 case HISTORY_ADD_RELATION:
                     $tmp['field'] = NOT_AVAILABLE;
                     if (class_exists($data["itemtype_link"])) {
                         $item = new $data["itemtype_link"]();
                         $tmp['field'] = $item->getTypeName();
                     }
                     $tmp['change'] = $LANG['log'][32] . " : " . "\"" . $data["new_value"] . "\"";
                     break;
                 case HISTORY_DEL_RELATION:
                     $tmp['field'] = NOT_AVAILABLE;
                     if (class_exists($data["itemtype_link"])) {
                         $item = new $data["itemtype_link"]();
                         $tmp['field'] = $item->getTypeName();
                     }
                     $tmp['change'] = $LANG['log'][33] . " : " . "\"" . $data["old_value"] . "\"";
                     break;
                 case HISTORY_ADD_SUBITEM:
                     $tmp['field'] = '';
                     if (class_exists($data["itemtype_link"])) {
                         $item = new $data["itemtype_link"]();
                         $tmp['field'] = $item->getTypeName();
                     }
                     $tmp['change'] = $LANG['log'][98] . " : " . $tmp['field'] . " (" . $data["new_value"] . ")";
                     break;
                 case HISTORY_UPDATE_SUBITEM:
                     $tmp['field'] = '';
                     if (class_exists($data["itemtype_link"])) {
                         $item = new $data["itemtype_link"]();
                         $tmp['field'] = $item->getTypeName();
                     }
                     $tmp['change'] = $LANG['log'][99] . " : " . $tmp['field'] . " (" . $data["new_value"] . ")";
                     break;
                 case HISTORY_DELETE_SUBITEM:
                     $tmp['field'] = '';
                     if (class_exists($data["itemtype_link"])) {
                         $item = new $data["itemtype_link"]();
                         $tmp['field'] = $item->getTypeName();
                     }
                     $tmp['change'] = $LANG['log'][100] . " : " . $tmp['field'] . " (" . $data["old_value"] . ")";
                     break;
             }
         } else {
             $fieldname = "";
             // It's not an internal device
             foreach ($SEARCHOPTION as $key2 => $val2) {
                 if ($key2 == $data["id_search_option"]) {
                     $tmp['field'] = $val2["name"];
                     $fieldname = $val2["field"];
                     if (isset($val2['datatype'])) {
                         $tmp['datatype'] = $val2["datatype"];
                     }
                 }
             }
             switch ($tmp['datatype']) {
                 case "bool":
                     $data["old_value"] = Dropdown::getYesNo($data["old_value"]);
                     $data["new_value"] = Dropdown::getYesNo($data["new_value"]);
                     break;
                 case "datetime":
                     $data["old_value"] = convDateTime($data["old_value"]);
                     $data["new_value"] = convDateTime($data["new_value"]);
                     break;
                 case "date":
                     $data["old_value"] = convDate($data["old_value"]);
                     $data["new_value"] = convDate($data["new_value"]);
                     break;
                 case "timestamp":
                     $data["old_value"] = timestampToString($data["old_value"]);
                     $data["new_value"] = timestampToString($data["new_value"]);
                     break;
                 case "actiontime":
                     $data["old_value"] = Ticket::getActionTime($data["old_value"]);
                     $data["new_value"] = Ticket::getActionTime($data["new_value"]);
                     break;
                 case "number":
                     $data["old_value"] = formatNumber($data["old_value"], false, 0);
                     $data["new_value"] = formatNumber($data["new_value"], false, 0);
                     break;
                 case "decimal":
                     $data["old_value"] = formatNumber($data["old_value"]);
                     $data["new_value"] = formatNumber($data["new_value"]);
                     break;
                 case "right":
                     $data["old_value"] = Profile::getRightValue($data["old_value"]);
                     $data["new_value"] = Profile::getRightValue($data["new_value"]);
                     break;
                 case "text":
                     $tmp['change'] = $LANG['log'][64];
                     break;
             }
             if (empty($tmp['change'])) {
                 $tmp['change'] = "\"" . $data["old_value"] . "\" --> \"" . $data["new_value"] . "\"";
             }
         }
         $changes[] = $tmp;
     }
     return $changes;
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:101,代码来源:log.class.php

示例2: getProjectForecast

 /**
  * Compute forecast duration
  *
  *@param $ID ID of the project
  *@return text duration of project
  */
 static function getProjectForecast($ID)
 {
     global $DB;
     $query = "SELECT SUM(`actiontime`) \n            FROM `glpi_plugin_projet_tasks` \n            WHERE `plugin_projet_projets_id` = '{$ID}' ";
     if ($result = $DB->query($query)) {
         $sum = $DB->result($result, 0, 0);
         if (is_null($sum)) {
             return '--';
         }
         return Ticket::getActionTime($sum);
     } else {
         return '--';
     }
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:20,代码来源:projet.class.php

示例3: getDatasForObject

 /**
  * @param $item            CommonDBTM object
  * @param $options   array
  * @param $simple          (false by default)
  **/
 function getDatasForObject(CommonDBTM $item, array $options, $simple = false)
 {
     global $CFG_GLPI, $DB;
     $objettype = strtolower($item->getType());
     $datas["##{$objettype}.title##"] = $item->getField('name');
     $datas["##{$objettype}.content##"] = $item->getField('content');
     $datas["##{$objettype}.description##"] = $item->getField('content');
     $datas["##{$objettype}.id##"] = sprintf("%07d", $item->getField("id"));
     if ($_SESSION['glpiticket_timeline'] == 1) {
         $datas["##{$objettype}.url##"] = $this->formatURL($options['additionnaloption']['usertype'], $objettype . "_" . $item->getField("id") . "_" . $item->getType() . '$1');
     } else {
         $datas["##{$objettype}.url##"] = $this->formatURL($options['additionnaloption']['usertype'], $objettype . "_" . $item->getField("id"));
     }
     $tab = '$2';
     if ($_SESSION['glpiticket_timeline'] == 1) {
         $tab = '$1';
     }
     $datas["##{$objettype}.urlapprove##"] = $this->formatURL($options['additionnaloption']['usertype'], $objettype . "_" . $item->getField("id") . "_" . $item->getType() . $tab);
     $entity = new Entity();
     if ($entity->getFromDB($this->getEntity())) {
         $datas["##{$objettype}.entity##"] = $entity->getField('completename');
         $datas["##{$objettype}.shortentity##"] = $entity->getField('name');
     }
     $datas["##{$objettype}.storestatus##"] = $item->getField('status');
     $datas["##{$objettype}.status##"] = $item->getStatus($item->getField('status'));
     $datas["##{$objettype}.urgency##"] = $item->getUrgencyName($item->getField('urgency'));
     $datas["##{$objettype}.impact##"] = $item->getImpactName($item->getField('impact'));
     $datas["##{$objettype}.priority##"] = $item->getPriorityName($item->getField('priority'));
     $datas["##{$objettype}.time##"] = $item->getActionTime($item->getField('actiontime'));
     $datas["##{$objettype}.creationdate##"] = Html::convDateTime($item->getField('date'));
     $datas["##{$objettype}.closedate##"] = Html::convDateTime($item->getField('closedate'));
     $datas["##{$objettype}.solvedate##"] = Html::convDateTime($item->getField('solvedate'));
     $datas["##{$objettype}.duedate##"] = Html::convDateTime($item->getField('due_date'));
     $datas["##{$objettype}.category##"] = '';
     if ($item->getField('itilcategories_id')) {
         $datas["##{$objettype}.category##"] = Dropdown::getDropdownName('glpi_itilcategories', $item->getField('itilcategories_id'));
     }
     $datas["##{$objettype}.authors##"] = '';
     $datas['authors'] = array();
     if ($item->countUsers(CommonITILActor::REQUESTER)) {
         $users = array();
         foreach ($item->getUsers(CommonITILActor::REQUESTER) as $tmpusr) {
             $uid = $tmpusr['users_id'];
             $user_tmp = new User();
             if ($uid && $user_tmp->getFromDB($uid)) {
                 $users[] = $user_tmp->getName();
                 $tmp = array();
                 $tmp['##author.id##'] = $uid;
                 $tmp['##author.name##'] = $user_tmp->getName();
                 if ($user_tmp->getField('locations_id')) {
                     $tmp['##author.location##'] = Dropdown::getDropdownName('glpi_locations', $user_tmp->getField('locations_id'));
                 } else {
                     $tmp['##author.location##'] = '';
                 }
                 if ($user_tmp->getField('usertitles_id')) {
                     $tmp['##author.title##'] = Dropdown::getDropdownName('glpi_usertitles', $user_tmp->getField('usertitles_id'));
                 } else {
                     $tmp['##author.title##'] = '';
                 }
                 if ($user_tmp->getField('usercategories_id')) {
                     $tmp['##author.category##'] = Dropdown::getDropdownName('glpi_usercategories', $user_tmp->getField('usercategories_id'));
                 } else {
                     $tmp['##author.category##'] = '';
                 }
                 $tmp['##author.email##'] = $user_tmp->getDefaultEmail();
                 $tmp['##author.mobile##'] = $user_tmp->getField('mobile');
                 $tmp['##author.phone##'] = $user_tmp->getField('phone');
                 $tmp['##author.phone2##'] = $user_tmp->getField('phone2');
                 $datas['authors'][] = $tmp;
             } else {
                 // Anonymous users only in xxx.authors, not in authors
                 $users[] = $tmpusr['alternative_email'];
             }
         }
         $datas["##{$objettype}.authors##"] = implode(', ', $users);
     }
     $datas["##{$objettype}.openbyuser##"] = '';
     if ($item->getField('users_id_recipient')) {
         $user_tmp = new User();
         $user_tmp->getFromDB($item->getField('users_id_recipient'));
         $datas["##{$objettype}.openbyuser##"] = $user_tmp->getName();
     }
     $datas["##{$objettype}.lastupdater##"] = '';
     if ($item->getField('users_id_lastupdater')) {
         $user_tmp = new User();
         $user_tmp->getFromDB($item->getField('users_id_lastupdater'));
         $datas["##{$objettype}.lastupdater##"] = $user_tmp->getName();
     }
     $datas["##{$objettype}.assigntousers##"] = '';
     if ($item->countUsers(CommonITILActor::ASSIGN)) {
         $users = array();
         foreach ($item->getUsers(CommonITILActor::ASSIGN) as $tmp) {
             $uid = $tmp['users_id'];
             $user_tmp = new User();
             if ($user_tmp->getFromDB($uid)) {
//.........这里部分代码省略.........
开发者ID:glpi-project,项目名称:glpi,代码行数:101,代码来源:notificationtargetcommonitilobject.class.php

示例4: getDatasForTemplate

 function getDatasForTemplate($event, $options = array())
 {
     global $CFG_GLPI, $DB;
     if ($event == 'AlertExpiredTasks') {
         $this->datas['##projet.entity##'] = Dropdown::getDropdownName('glpi_entities', $options['entities_id']);
         $this->datas['##lang.projet.entity##'] = __('Entity');
         $this->datas['##projet.action##'] = __('Outdated tasks', 'projet');
         $this->datas['##lang.task.name##'] = __('Name');
         $this->datas['##lang.task.type##'] = __('Type');
         $this->datas['##lang.task.users##'] = __('User');
         $this->datas['##lang.task.groups##'] = __('Group');
         $this->datas['##lang.task.datebegin##'] = __('Start date');
         $this->datas['##lang.task.dateend##'] = __('End date');
         $this->datas['##lang.task.planned##'] = __('Used for planning', 'projet');
         $this->datas['##lang.task.realtime##'] = __('Effective duration', 'projet');
         $this->datas['##lang.task.comment##'] = __('Comments');
         $this->datas['##lang.task.projet##'] = PluginProjetProjet::getTypeName(1);
         foreach ($options['tasks'] as $id => $task) {
             $tmp = array();
             $tmp['##task.name##'] = $task['name'];
             $tmp['##task.type##'] = Dropdown::getDropdownName('glpi_plugin_projet_tasktypes', $task['plugin_projet_tasktypes_id']);
             $tmp['##task.users##'] = Html::clean(getUserName($task['users_id']));
             $tmp['##task.groups##'] = Dropdown::getDropdownName('glpi_groups', $task['groups_id']);
             $restrict = " `plugin_projet_tasks_id` = '" . $task['id'] . "' ";
             $plans = getAllDatasFromTable("glpi_plugin_projet_taskplannings", $restrict);
             if (!empty($plans)) {
                 foreach ($plans as $plan) {
                     $tmp['##task.datebegin##'] = Html::convDateTime($plan["begin"]);
                     $tmp['##task.dateend##'] = Html::convDateTime($plan["end"]);
                 }
             } else {
                 $tmp['##task.datebegin##'] = '';
                 $tmp['##task.dateend##'] = '';
             }
             $tmp['##task.planned##'] = '';
             $tmp['##task.realtime##'] = Ticket::getActionTime($task["actiontime"]);
             $comment = stripslashes(str_replace(array('\\r\\n', '\\n', '\\r'), "<br/>", $task['comment']));
             $tmp['##task.comment##'] = Html::clean($comment);
             $tmp['##task.projet##'] = Dropdown::getDropdownName('glpi_plugin_projet_projets', $task['plugin_projet_projets_id']);
             $this->datas['tasks'][] = $tmp;
         }
     } else {
         $events = $this->getAllEvents();
         $this->datas['##lang.projet.title##'] = $events[$event];
         $this->datas['##lang.projet.entity##'] = __('Entity');
         $this->datas['##projet.entity##'] = Dropdown::getDropdownName('glpi_entities', $this->obj->getField('entities_id'));
         $this->datas['##projet.id##'] = $this->obj->getField("id");
         $this->datas['##lang.projet.name##'] = __('Name');
         $this->datas['##projet.name##'] = $this->obj->getField("name");
         $this->datas['##lang.projet.datebegin##'] = __('Start date');
         $this->datas['##projet.datebegin##'] = Html::convDate($this->obj->getField('date_begin'));
         $this->datas['##lang.projet.dateend##'] = __('End date');
         $this->datas['##projet.dateend##'] = Html::convDate($this->obj->getField('date_end'));
         $this->datas['##lang.projet.users##'] = __('User');
         $this->datas['##projet.users##'] = Html::clean(getUserName($this->obj->getField("users_id")));
         $this->datas['##lang.projet.groups##'] = __('Group');
         $this->datas['##projet.groups##'] = Dropdown::getDropdownName('glpi_groups', $this->obj->getField('groups_id'));
         $this->datas['##lang.projet.status##'] = __('State');
         $this->datas['##projet.status##'] = Dropdown::getDropdownName('glpi_plugin_projet_projetstates', $this->obj->getField('plugin_projet_projetstates_id'));
         $this->datas['##lang.projet.parent##'] = __('Parent project', 'projet');
         $this->datas['##projet.parent##'] = PluginProjetProjet_Projet::displayLinkedProjetsTo($this->obj->getField('id'), true);
         $this->datas['##lang.projet.advance##'] = __('Progress');
         $this->datas['##projet.advance##'] = PluginProjetProjet::displayProgressBar('100', $this->obj->getField('advance'), array('simple' => true));
         $this->datas['##lang.projet.gantt##'] = __('Display on the global Gantt', 'projet');
         $this->datas['##projet.gantt##'] = Dropdown::getYesNo($this->obj->getField('show_gantt'));
         $this->datas['##lang.projet.comment##'] = __('Comments');
         $comment = stripslashes(str_replace(array('\\r\\n', '\\n', '\\r'), "<br/>", $this->obj->getField("comment")));
         $this->datas['##projet.comment##'] = Html::clean($comment);
         $this->datas['##lang.projet.description##'] = __('Description');
         $description = stripslashes(str_replace(array('\\r\\n', '\\n', '\\r'), "<br/>", $this->obj->getField("description")));
         $this->datas['##projet.description##'] = Html::clean($description);
         $this->datas['##lang.projet.helpdesk##'] = __('Associable to a ticket');
         $this->datas['##projet.helpdesk##'] = Dropdown::getYesNo($this->obj->getField('is_helpdesk_visible'));
         $this->datas['##lang.projet.url##'] = __('URL');
         $this->datas['##projet.url##'] = urldecode($CFG_GLPI["url_base"] . "/index.php?redirect=plugin_projet_" . $this->obj->getField("id"));
         //old values infos
         if (isset($this->target_object->oldvalues) && !empty($this->target_object->oldvalues) && $event == 'update') {
             $this->datas['##lang.update.title##'] = __('Modifications', 'projet');
             $tmp = array();
             if (isset($this->target_object->oldvalues['name'])) {
                 if (empty($this->target_object->oldvalues['name'])) {
                     $tmp['##update.name##'] = "---";
                 } else {
                     $tmp['##update.name##'] = $this->target_object->oldvalues['name'];
                 }
             }
             if (isset($this->target_object->oldvalues['date_begin'])) {
                 if (empty($this->target_object->oldvalues['date_begin'])) {
                     $tmp['##update.datebegin##'] = "---";
                 } else {
                     $tmp['##update.datebegin##'] = Html::convDate($this->target_object->oldvalues['date_begin']);
                 }
             }
             if (isset($this->target_object->oldvalues['date_end'])) {
                 if (empty($this->target_object->oldvalues['date_end'])) {
                     $tmp['##update.dateend##'] = "---";
                 } else {
                     $tmp['##update.dateend##'] = Html::convDate($this->target_object->oldvalues['date_end']);
                 }
             }
//.........这里部分代码省略.........
开发者ID:geldarr,项目名称:hack-space,代码行数:101,代码来源:notificationtargetprojet.class.php

示例5: getDatasForTemplate

 /**
  * Get all data needed for template processing
  **/
 function getDatasForTemplate($event, $options = array())
 {
     global $LANG, $CFG_GLPI;
     //----------- Ticket infos -------------- //
     if ($event != 'alertnotclosed') {
         $fields = array('ticket.title' => 'name', 'ticket.content' => 'content', 'ticket.description' => 'content', 'ticket.costfixed' => 'cost_fixed', 'ticket.costmaterial' => 'cost_material');
         foreach ($fields as $tag => $table_field) {
             $this->datas['##' . $tag . '##'] = $this->obj->getField($table_field);
         }
         $this->datas['##ticket.id##'] = sprintf("%07d", $this->obj->getField("id"));
         $this->datas['##ticket.url##'] = urldecode($CFG_GLPI["url_base"] . "/index.php?redirect=ticket_" . $this->obj->getField("id"));
         $this->datas['##ticket.urlapprove##'] = urldecode($CFG_GLPI["url_base"] . "/index.php?redirect=ticket_" . $this->obj->getField("id") . "_4");
         $this->datas['##ticket.urlvalidation##'] = urldecode($CFG_GLPI["url_base"] . "/index.php?redirect=ticket_" . $this->obj->getField("id") . "_7");
         $this->datas['##ticket.entity##'] = Dropdown::getDropdownName('glpi_entities', $this->getEntity());
         $events = $this->getAllEvents();
         if ($event == 'validation' && isset($options['validation_status'])) {
             $this->datas['##ticket.action##'] = $LANG['validation'][0] . ' - ' . TicketValidation::getStatus($options['validation_status']);
         } else {
             $this->datas['##ticket.action##'] = $events[$event];
         }
         $this->datas['##ticket.storestatus##'] = $this->obj->getField('status');
         $this->datas['##ticket.status##'] = Ticket::getStatus($this->obj->getField('status'));
         $this->datas['##ticket.globalvalidation##'] = TicketValidation::getStatus($this->obj->getField('global_validation'));
         $this->datas['##ticket.type##'] = Ticket::getTicketTypeName($this->obj->getField('type'));
         $this->datas['##ticket.requesttype##'] = Dropdown::getDropdownName('glpi_requesttypes', $this->obj->getField('requesttypes_id'));
         $this->datas['##ticket.urgency##'] = Ticket::getUrgencyName($this->obj->getField('urgency'));
         $this->datas['##ticket.impact##'] = Ticket::getImpactName($this->obj->getField('impact'));
         $this->datas['##ticket.priority##'] = Ticket::getPriorityName($this->obj->getField('priority'));
         $this->datas['##ticket.time##'] = Ticket::getActionTime($this->obj->getField('actiontime'));
         $this->datas['##ticket.costtime##'] = $this->obj->getField('cost_time');
         $this->datas['##ticket.creationdate##'] = convDateTime($this->obj->getField('date'));
         $this->datas['##ticket.closedate##'] = convDateTime($this->obj->getField('closedate'));
         $this->datas['##ticket.solvedate##'] = convDateTime($this->obj->getField('solvedate'));
         $this->datas['##ticket.duedate##'] = convDateTime($this->obj->getField('due_date'));
         $entitydata = new EntityData();
         $autoclose_value = $CFG_GLPI['autoclose_delay'];
         if ($entitydata->getFromDB($this->getEntity())) {
             $autoclose_value = $entitydata->getField('autoclose_delay');
             // Set global config value
             if ($autoclose_value == -1) {
                 $autoclose_value = $CFG_GLPI['autoclose_delay'];
             }
         }
         if ($autoclose_value > 0) {
             $this->datas['##ticket.autoclose##'] = $autoclose_value;
             $this->datas['##lang.ticket.autoclosewarning##'] = $LANG['job'][54] . " " . $autoclose_value . " " . $LANG['stats'][31];
         } else {
             $this->datas['##ticket.autoclose##'] = $LANG['setup'][307];
             $this->datas['##lang.ticket.autoclosewarning##'] = "";
         }
         if ($this->obj->getField('ticketcategories_id')) {
             $this->datas['##ticket.category##'] = Dropdown::getDropdownName('glpi_ticketcategories', $this->obj->getField('ticketcategories_id'));
         } else {
             $this->datas['##ticket.category##'] = '';
         }
         if ($this->obj->getField('slas_id')) {
             $this->datas['##ticket.sla##'] = Dropdown::getDropdownName('glpi_slas', $this->obj->getField('slas_id'));
         } else {
             $this->datas['##ticket.sla##'] = '';
         }
         if ($this->obj->countUsers(Ticket::REQUESTER)) {
             $users = array();
             foreach ($this->obj->getUsers(Ticket::REQUESTER) as $uid => $tmp) {
                 $user_tmp = new User();
                 $user_tmp->getFromDB($uid);
                 $users[$uid] = $user_tmp->getName();
                 $tmp = array();
                 $tmp['##author.id##'] = $uid;
                 $tmp['##author.name##'] = $user_tmp->getName();
                 if ($user_tmp->getField('locations_id')) {
                     $tmp['##author.location##'] = Dropdown::getDropdownName('glpi_locations', $user_tmp->getField('locations_id'));
                 } else {
                     $tmp['##author.location##'] = '';
                 }
                 $tmp['##author.phone##'] = $user_tmp->getField('phone');
                 $tmp['##author.phone2##'] = $user_tmp->getField('phone2');
                 $this->datas['authors'][] = $tmp;
             }
             $this->datas['##ticket.authors##'] = implode(', ', $users);
         } else {
             $this->datas['##ticket.authors##'] = '';
         }
         if ($this->obj->getField('users_id_recipient')) {
             $user_tmp = new User();
             $user_tmp->getFromDB($this->obj->getField('users_id_recipient'));
             $this->datas['##ticket.openbyuser##'] = $user_tmp->getName();
         } else {
             $this->datas['##ticket.openbyuser##'] = '';
         }
         if ($this->obj->countUsers(Ticket::ASSIGN)) {
             $users = array();
             foreach ($this->obj->getUsers(Ticket::ASSIGN) as $uid => $tmp) {
                 $user_tmp = new User();
                 $user_tmp->getFromDB($uid);
                 $users[$uid] = $user_tmp->getName();
             }
             $this->datas['##ticket.assigntousers##'] = implode(', ', $users);
//.........这里部分代码省略.........
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:101,代码来源:notificationtargetticket.class.php

示例6: getDatasForObject


//.........这里部分代码省略.........
         $restrict = "`tickets_id`='" . $item->getField('id') . "'";
         $problems = getAllDatasFromTable('glpi_problems_tickets', $restrict);
         $datas['problems'] = array();
         if (count($problems)) {
             $problem = new Problem();
             foreach ($problems as $data) {
                 if ($problem->getFromDB($data['problems_id'])) {
                     $tmp = array();
                     $tmp['##problem.id##'] = $data['problems_id'];
                     $tmp['##problem.date##'] = $problem->getField('date');
                     $tmp['##problem.title##'] = $problem->getField('name');
                     $tmp['##problem.url##'] = $this->formatURL($options['additionnaloption']['usertype'], "problem_" . $data['problems_id']);
                     $tmp['##problem.content##'] = $problem->getField('content');
                     $datas['problems'][] = $tmp;
                 }
             }
         }
         $datas['##ticket.numberofproblems##'] = count($datas['problems']);
         $restrict = "`tickets_id`='" . $item->getField('id') . "'";
         if (!isset($options['additionnaloption']['show_private']) || !$options['additionnaloption']['show_private']) {
             $restrict .= " AND `is_private` = '0'";
         }
         $restrict .= " ORDER BY `date` DESC, `id` ASC";
         //Task infos
         $tasks = getAllDatasFromTable('glpi_tickettasks', $restrict);
         $datas['tasks'] = array();
         foreach ($tasks as $task) {
             $tmp = array();
             $tmp['##task.isprivate##'] = Dropdown::getYesNo($task['is_private']);
             $tmp['##task.author##'] = Html::clean(getUserName($task['users_id']));
             $tmp['##task.category##'] = Dropdown::getDropdownName('glpi_taskcategories', $task['taskcategories_id']);
             $tmp['##task.date##'] = Html::convDateTime($task['date']);
             $tmp['##task.description##'] = $task['content'];
             $tmp['##task.time##'] = Ticket::getActionTime($task['actiontime']);
             $tmp['##task.status##'] = Planning::getState($task['state']);
             $tmp['##task.user##'] = "";
             $tmp['##task.begin##'] = "";
             $tmp['##task.end##'] = "";
             if (!is_null($task['begin'])) {
                 $tmp['##task.user##'] = Html::clean(getUserName($task['users_id_tech']));
                 $tmp['##task.begin##'] = Html::convDateTime($task['begin']);
                 $tmp['##task.end##'] = Html::convDateTime($task['end']);
             }
             $datas['tasks'][] = $tmp;
         }
         $datas['##ticket.numberoftasks##'] = count($datas['tasks']);
         //Followup infos
         $followups = getAllDatasFromTable('glpi_ticketfollowups', $restrict);
         $datas['followups'] = array();
         foreach ($followups as $followup) {
             $tmp = array();
             $tmp['##followup.isprivate##'] = Dropdown::getYesNo($followup['is_private']);
             $tmp['##followup.author##'] = Html::clean(getUserName($followup['users_id']));
             $tmp['##followup.requesttype##'] = Dropdown::getDropdownName('glpi_requesttypes', $followup['requesttypes_id']);
             $tmp['##followup.date##'] = Html::convDateTime($followup['date']);
             $tmp['##followup.description##'] = $followup['content'];
             $datas['followups'][] = $tmp;
         }
         $datas['##ticket.numberoffollowups##'] = count($datas['followups']);
         //Validation infos
         $restrict = "`tickets_id`='" . $item->getField('id') . "'";
         if (isset($options['validation_id']) && $options['validation_id']) {
             $restrict .= " AND `glpi_ticketvalidations`.`id` = '" . $options['validation_id'] . "'";
         }
         $restrict .= " ORDER BY `submission_date` DESC, `id` ASC";
         $validations = getAllDatasFromTable('glpi_ticketvalidations', $restrict);
开发者ID:geldarr,项目名称:hack-space,代码行数:67,代码来源:notificationtargetticket.class.php

示例7: getDatasForTemplate

 function getDatasForTemplate($event, $options = array())
 {
     global $CFG_GLPI, $DB;
     if ($event == 'AlertExpiredTasks') {
         $this->datas['##resource.entity##'] = Dropdown::getDropdownName('glpi_entities', $options['entities_id']);
         $this->datas['##lang.resource.entity##'] = __('Entity');
         $this->datas['##resource.action##'] = __('List of not finished tasks', 'resources');
         $this->datas['##lang.task.name##'] = __('Name');
         $this->datas['##lang.task.type##'] = __('Type');
         $this->datas['##lang.task.users##'] = __('Technician');
         $this->datas['##lang.task.groups##'] = __('Group');
         $this->datas['##lang.task.datebegin##'] = __('Begin date');
         $this->datas['##lang.task.dateend##'] = __('End date');
         $this->datas['##lang.task.planned##'] = __('Used for planning', 'resources');
         $this->datas['##lang.task.realtime##'] = __('Effective duration', 'resources');
         $this->datas['##lang.task.finished##'] = __('Carried out task', 'resources');
         $this->datas['##lang.task.comment##'] = __('Comments');
         $this->datas['##lang.task.resource##'] = PluginResourcesResource::getTypeName(1);
         foreach ($options['tasks'] as $id => $task) {
             $tmp = array();
             $tmp['##task.name##'] = $task['name'];
             $tmp['##task.type##'] = Dropdown::getDropdownName('glpi_plugin_resources_tasktypes', $task['plugin_resources_tasktypes_id']);
             $tmp['##task.users##'] = Html::clean(getUserName($task['users_id']));
             $tmp['##task.groups##'] = Dropdown::getDropdownName('glpi_groups', $task['groups_id']);
             $restrict = " `plugin_resources_tasks_id` = '" . $task['id'] . "' ";
             $plans = getAllDatasFromTable("glpi_plugin_resources_taskplannings", $restrict);
             if (!empty($plans)) {
                 foreach ($plans as $plan) {
                     $tmp['##task.datebegin##'] = Html::convDateTime($plan["begin"]);
                     $tmp['##task.dateend##'] = Html::convDateTime($plan["end"]);
                 }
             } else {
                 $tmp['##task.datebegin##'] = '';
                 $tmp['##task.dateend##'] = '';
             }
             $tmp['##task.planned##'] = '';
             $tmp['##task.finished##'] = Dropdown::getYesNo($task['is_finished']);
             $tmp['##task.realtime##'] = Ticket::getActionTime($task["actiontime"]);
             $comment = stripslashes(str_replace(array('\\r\\n', '\\n', '\\r'), "<br/>", $task['comment']));
             $tmp['##task.comment##'] = Html::clean($comment);
             $tmp['##task.resource##'] = Dropdown::getDropdownName('glpi_plugin_resources_resources', $task['plugin_resources_resources_id']);
             $this->datas['tasks'][] = $tmp;
         }
     } else {
         if ($event == 'AlertLeavingResources') {
             $this->datas['##resource.entity##'] = Dropdown::getDropdownName('glpi_entities', $options['entities_id']);
             $this->datas['##lang.resource.entity##'] = __('Entity');
             $this->datas['##resource.action##'] = __('These resources have normally left the company', 'resources');
             $this->datas['##lang.resource.id##'] = "ID";
             $this->datas['##lang.resource.name##'] = __('Name');
             $this->datas['##lang.resource.firstname##'] = __('First name');
             $this->datas['##lang.resource.type##'] = PluginResourcesContractType::getTypeName(1);
             $this->datas['##lang.resource.users##'] = __('Resource manager', 'resources');
             $this->datas['##lang.resource.usersrecipient##'] = __('Requester');
             $this->datas['##lang.resource.datedeclaration##'] = __('Request date');
             $this->datas['##lang.resource.datebegin##'] = __('Arrival date', 'resources');
             $this->datas['##lang.resource.dateend##'] = __('Departure date', 'resources');
             $this->datas['##lang.resource.department##'] = PluginResourcesDepartment::getTypeName(1);
             $this->datas['##lang.resource.status##'] = PluginResourcesResourceState::getTypeName(1);
             $this->datas['##lang.resource.location##'] = __('Location');
             $this->datas['##lang.resource.comment##'] = __('Description');
             $this->datas['##lang.resource.usersleaving##'] = __('Informant of leaving', 'resources');
             $this->datas['##lang.resource.leaving##'] = __('Declared as leaving', 'resources');
             $this->datas['##lang.resource.leavingreason##'] = PluginResourcesLeavingReason::getTypeName(1);
             $this->datas['##lang.resource.helpdesk##'] = __('Associable to a ticket');
             $this->datas['##lang.resource.url##'] = __('URL');
             foreach ($options['resources'] as $id => $resource) {
                 $tmp = array();
                 $tmp['##resource.name##'] = $resource['name'];
                 $tmp['##resource.firstname##'] = $resource['firstname'];
                 $tmp['##resource.type##'] = Dropdown::getDropdownName('glpi_plugin_resources_contracttypes', $resource['plugin_resources_contracttypes_id']);
                 $tmp['##resource.users##'] = Html::clean(getUserName($resource['users_id']));
                 $tmp['##resource.usersrecipient##'] = Html::clean(getUserName($resource['users_id_recipient']));
                 $tmp['##resource.datedeclaration##'] = Html::convDateTime($resource['date_declaration']);
                 $tmp['##resource.datebegin##'] = Html::convDateTime($resource['date_begin']);
                 $tmp['##resource.dateend##'] = Html::convDateTime($resource['date_end']);
                 $tmp['##resource.department##'] = Dropdown::getDropdownName('glpi_plugin_resources_departments', $resource['plugin_resources_departments_id']);
                 $tmp['##resource.status##'] = Dropdown::getDropdownName('glpi_plugin_resources_resourcestates', $resource['plugin_resources_resourcestates_id']);
                 $tmp['##resource.location##'] = Dropdown::getDropdownName('glpi_locations', $resource['locations_id']);
                 $comment = stripslashes(str_replace(array('\\r\\n', '\\n', '\\r'), "<br/>", $resource['comment']));
                 $tmp['##resource.comment##'] = Html::clean($comment);
                 $tmp['##resource.usersleaving##'] = Html::clean(getUserName($resource['users_id_recipient_leaving']));
                 $tmp['##resource.leaving##'] = Dropdown::getYesNo($resource['is_leaving']);
                 $tmp['##resource.leavingreason##'] = Dropdown::getDropdownName('glpi_plugin_resources_leavingreasons', $resource['plugin_resources_leavingreasons_id']);
                 $tmp['##resource.helpdesk##'] = Dropdown::getYesNo($resource['is_helpdesk_visible']);
                 $tmp['##resource.url##'] = urldecode($CFG_GLPI["url_base"] . "/index.php?redirect=plugin_resources_" . $resource['id']);
                 $this->datas['resources'][] = $tmp;
             }
         } else {
             if ($event == 'AlertArrivalChecklists' || $event == 'AlertLeavingChecklists') {
                 $this->datas['##checklist.entity##'] = Dropdown::getDropdownName('glpi_entities', $options['entities_id']);
                 $this->datas['##lang.checklist.entity##'] = __('Entity');
                 if ($event == 'AlertArrivalChecklists') {
                     $checklist_type = PluginResourcesChecklist::RESOURCES_CHECKLIST_IN;
                     $this->datas['##checklist.action##'] = __('Actions to do on these new resources', 'resources');
                     $this->datas['##lang.checklist.title##'] = __('New resource - checklist needs to verificated', 'resources');
                 } else {
                     $checklist_type = PluginResourcesChecklist::RESOURCES_CHECKLIST_OUT;
                     $this->datas['##checklist.action##'] = __('Actions to do on these leaving resources', 'resources');
                     $this->datas['##lang.checklist.title##'] = __('Leaving resource - checklist needs to verificated', 'resources');
//.........这里部分代码省略.........
开发者ID:geldarr,项目名称:hack-space,代码行数:101,代码来源:notificationtargetresource.class.php


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