本文整理汇总了PHP中Change::getFromDB方法的典型用法代码示例。如果您正苦于以下问题:PHP Change::getFromDB方法的具体用法?PHP Change::getFromDB怎么用?PHP Change::getFromDB使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Change
的用法示例。
在下文中一共展示了Change::getFromDB方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: canCreateItem
/**
* Is the current user have right to create the current task ?
*
* @return boolean
**/
function canCreateItem()
{
if (!parent::canReadITILItem()) {
return false;
}
$change = new Change();
if ($change->getFromDB($this->fields['changes_id'])) {
return Session::haveRight('change', UPDATE) || Session::haveRight('change', Change::READMY) && ($change->isUser(CommonITILActor::ASSIGN, Session::getLoginUserID()) || isset($_SESSION["glpigroups"]) && $change->haveAGroup(CommonITILActor::ASSIGN, $_SESSION['glpigroups']));
}
return false;
}
示例2: getDatasForObject
/**
* @see NotificationTargetCommonITILObject::getDatasForObject()
**/
function getDatasForObject(CommonDBTM $item, array $options, $simple = false)
{
global $CFG_GLPI;
// Common ITIL datas
$datas = parent::getDatasForObject($item, $options, $simple);
$datas['##ticket.description##'] = Html::clean($datas['##ticket.description##']);
$datas['##ticket.description##'] = $item->convertContentForNotification($datas['##ticket.description##'], $item);
$datas['##ticket.content##'] = $datas['##ticket.description##'];
// Specific datas
$datas['##ticket.urlvalidation##'] = $this->formatURL($options['additionnaloption']['usertype'], "ticket_" . $item->getField("id") . "_TicketValidation\$1");
$datas['##ticket.globalvalidation##'] = TicketValidation::getStatus($item->getField('global_validation'));
$datas['##ticket.type##'] = Ticket::getTicketTypeName($item->getField('type'));
$datas['##ticket.requesttype##'] = Dropdown::getDropdownName('glpi_requesttypes', $item->getField('requesttypes_id'));
$autoclose_value = Entity::getUsedConfig('autoclose_delay', $this->getEntity(), '', Entity::CONFIG_NEVER);
$datas['##ticket.autoclose##'] = __('Never');
$datas['##lang.ticket.autoclosewarning##'] = "";
if ($autoclose_value > 0) {
$datas['##ticket.autoclose##'] = $autoclose_value;
$datas['##lang.ticket.autoclosewarning##'] = sprintf(_n('Without a reply, the ticket will be automatically closed after %s day', 'Without a reply, the ticket will be automatically closed after %s days', $autoclose_value), $autoclose_value);
}
$datas['##ticket.sla##'] = '';
if ($item->getField('slas_id')) {
$datas['##ticket.sla##'] = Dropdown::getDropdownName('glpi_slas', $item->getField('slas_id'));
}
$datas['##ticket.location##'] = '';
if ($item->getField('locations_id')) {
$datas['##ticket.location##'] = Dropdown::getDropdownName('glpi_locations', $item->getField('locations_id'));
}
// is ticket deleted
$datas['##ticket.isdeleted##'] = Dropdown::getYesNo($item->getField('is_deleted'));
//Tags associated with the object linked to the ticket
$datas['##ticket.itemtype##'] = '';
$datas['##ticket.item.name##'] = '';
$datas['##ticket.item.serial##'] = '';
$datas['##ticket.item.otherserial##'] = '';
$datas['##ticket.item.location##'] = '';
$datas['##ticket.item.contact##'] = '';
$datas['##ticket.item.contactnumber##'] = '';
$datas['##ticket.item.user##'] = '';
$datas['##ticket.item.group##'] = '';
$datas['##ticket.item.model##'] = '';
$item_ticket = new Item_Ticket();
$items = $item_ticket->find("`tickets_id` = '" . $item->getField('id') . "'");
$datas['items'] = array();
if (count($items)) {
foreach ($items as $val) {
if (isset($val['itemtype']) && ($hardware = getItemForItemtype($val['itemtype'])) && isset($val["items_id"]) && $hardware->getFromDB($val["items_id"])) {
$tmp = array();
//Object type
$tmp['##ticket.itemtype##'] = $hardware->getTypeName();
//Object name
$tmp['##ticket.item.name##'] = $hardware->getField('name');
//Object serial
if ($hardware->isField('serial')) {
$tmp['##ticket.item.serial##'] = $hardware->getField('serial');
}
//Object contact
if ($hardware->isField('contact')) {
$tmp['##ticket.item.contact##'] = $hardware->getField('contact');
}
//Object contact num
if ($hardware->isField('contact_num')) {
$tmp['##ticket.item.contactnumber##'] = $hardware->getField('contact_num');
}
//Object otherserial
if ($hardware->isField('otherserial')) {
$tmp['##ticket.item.otherserial##'] = $hardware->getField('otherserial');
}
//Object location
if ($hardware->isField('locations_id')) {
$tmp['##ticket.item.location##'] = Dropdown::getDropdownName('glpi_locations', $hardware->getField('locations_id'));
}
//Object user
if ($hardware->getField('users_id')) {
$user_tmp = new User();
if ($user_tmp->getFromDB($hardware->getField('users_id'))) {
$tmp['##ticket.item.user##'] = $user_tmp->getName();
}
}
//Object group
if ($hardware->getField('groups_id')) {
$tmp['##ticket.item.group##'] = Dropdown::getDropdownName('glpi_groups', $hardware->getField('groups_id'));
}
$modeltable = getSingular($hardware->getTable()) . "models";
$modelfield = getForeignKeyFieldForTable($modeltable);
if ($hardware->isField($modelfield)) {
$tmp['##ticket.item.model##'] = Dropdown::getDropdownName($modeltable, $hardware->getField($modelfield));
}
$datas['items'][] = $tmp;
}
}
}
$datas['##ticket.numberofitems##'] = count($datas['items']);
// Get followups, log, validation, satisfaction, linked tickets
if (!$simple) {
// Linked tickets
$linked_tickets = Ticket_Ticket::getLinkedTicketsTo($item->getField('id'));
//.........这里部分代码省略.........
示例3: showMassiveActionsSubForm
/**
* @since version 0.85
*
* @see CommonDBTM::showMassiveActionsSubForm()
**/
static function showMassiveActionsSubForm(MassiveAction $ma)
{
global $CFG_GLPI;
switch ($ma->getAction()) {
case "solveticket":
$change = new Change();
$input = $ma->getInput();
if (isset($input['changes_id']) && $change->getFromDB($input['changes_id'])) {
Ticket::showMassiveSolutionForm($change->getEntityID());
echo "<br><br>";
echo Html::submit(_x('button', 'Post'), array('name' => 'massiveaction'));
return true;
}
return false;
}
return parent::showMassiveActionsSubForm($ma);
}
示例4: getDatasForTemplate
/**
* @see NotificationTarget::getDatasForTemplate()
**/
function getDatasForTemplate($event, $options = array())
{
global $CFG_GLPI, $DB;
//----------- Reservation infos -------------- //
$events = $this->getAllEvents();
$item = $this->obj;
$this->datas['##project.action##'] = $events[$event];
$this->datas['##project.url##'] = $this->formatURL($options['additionnaloption']['usertype'], "Project_" . $item->getField("id"));
$this->datas["##project.name##"] = $item->getField('name');
$this->datas["##project.code##"] = $item->getField('code');
$this->datas["##project.description##"] = $item->getField('content');
$this->datas["##project.comments##"] = $item->getField('comment');
$this->datas["##project.creationdate##"] = Html::convDateTime($item->getField('date'));
$this->datas["##project.lastupdatedate##"] = Html::convDateTime($item->getField('date_mod'));
$this->datas["##project.priority##"] = CommonITILObject::getPriorityName($item->getField('priority'));
$this->datas["##project.percent##"] = Dropdown::getValueWithUnit($item->getField('percent_done'), "%");
$this->datas["##project.planstartdate##"] = Html::convDateTime($item->getField('plan_start_date'));
$this->datas["##project.planenddate##"] = Html::convDateTime($item->getField('plan_end_date'));
$this->datas["##project.realstartdate##"] = Html::convDateTime($item->getField('real_start_date'));
$this->datas["##project.realenddate##"] = Html::convDateTime($item->getField('real_end_date'));
$this->datas["##project.plannedduration##"] = Html::timestampToString(ProjectTask::getTotalPlannedDurationForProject($item->getID()), false);
$this->datas["##project.effectiveduration##"] = Html::timestampToString(ProjectTask::getTotalEffectiveDurationForProject($item->getID()), false);
$entity = new Entity();
$this->datas["##project.entity##"] = '';
$this->datas["##project.shortentity##"] = '';
if ($entity->getFromDB($this->getEntity())) {
$this->datas["##project.entity##"] = $entity->getField('completename');
$this->datas["##project.shortentity##"] = $entity->getField('name');
}
$this->datas["##project.father##"] = '';
if ($item->getField('projects_id')) {
$this->datas["##project.father##"] = Dropdown::getDropdownName('glpi_projects', $item->getField('projects_id'));
}
$this->datas["##project.state##"] = '';
if ($item->getField('projectstates_id')) {
$this->datas["##project.state##"] = Dropdown::getDropdownName('glpi_projectstates', $item->getField('projectstates_id'));
}
$this->datas["##project.type##"] = '';
if ($item->getField('projecttypes_id')) {
$this->datas["##project.type##"] = Dropdown::getDropdownName('glpi_projecttypes', $item->getField('projecttypes_id'));
}
$this->datas["##project.manager##"] = '';
if ($item->getField('users_id')) {
$user_tmp = new User();
$user_tmp->getFromDB($item->getField('users_id'));
$this->datas["##project.manager##"] = $user_tmp->getName();
}
$this->datas["##project.managergroup##"] = '';
if ($item->getField('groups_id')) {
$this->datas["##project.managergroup##"] = Dropdown::getDropdownName('glpi_groups', $item->getField('groups_id'));
}
// Team infos
$restrict = "`projects_id` = '" . $item->getField('id') . "'";
$items = getAllDatasFromTable('glpi_projectteams', $restrict);
$this->datas['teammembers'] = array();
if (count($items)) {
foreach ($items as $data) {
if ($item2 = getItemForItemtype($data['itemtype'])) {
if ($item2->getFromDB($data['items_id'])) {
$tmp = array();
$tmp['##teammember.itemtype##'] = $item2->getTypeName();
$tmp['##teammember.name##'] = $item2->getName();
$this->datas['teammembers'][] = $tmp;
}
}
}
}
$this->datas['##project.numberofteammembers##'] = count($this->datas['teammembers']);
// Task infos
$restrict = "`projects_id`='" . $item->getField('id') . "'";
$restrict .= " ORDER BY `date` DESC, `id` ASC";
$tasks = getAllDatasFromTable('glpi_projecttasks', $restrict);
$this->datas['tasks'] = array();
foreach ($tasks as $task) {
$tmp = array();
$tmp['##task.creationdate##'] = Html::convDateTime($task['date']);
$tmp['##task.lastupdatedate##'] = Html::convDateTime($task['date_mod']);
$tmp['##task.name##'] = $task['name'];
$tmp['##task.description##'] = $task['content'];
$tmp['##task.comments##'] = $task['comment'];
$tmp['##task.state##'] = Dropdown::getDropdownName('glpi_projectstates', $task['projectstates_id']);
$tmp['##task.type##'] = Dropdown::getDropdownName('glpi_projecttasktypes', $task['projecttasktypes_id']);
$tmp['##task.percent##'] = Dropdown::getValueWithUnit($task['percent_done'], "%");
$this->datas["##task.planstartdate##"] = '';
$this->datas["##task.planenddate##"] = '';
$this->datas["##task.realstartdate##"] = '';
$this->datas["##task.realenddate##"] = '';
if (!is_null($task['plan_start_date'])) {
$tmp['##task.planstartdate##'] = Html::convDateTime($task['plan_start_date']);
}
if (!is_null($task['plan_end_date'])) {
$tmp['##task.planenddate##'] = Html::convDateTime($task['plan_end_date']);
}
if (!is_null($task['real_start_date'])) {
$tmp['##task.realstartdate##'] = Html::convDateTime($task['real_start_date']);
}
if (!is_null($task['real_end_date'])) {
//.........这里部分代码省略.........
示例5: getDatasForObject
/**
* @see NotificationTargetCommonITILObject::getDatasForObject()
**/
function getDatasForObject(CommonDBTM $item, array $options, $simple = false)
{
global $CFG_GLPI;
// Common ITIL datas
$datas = parent::getDatasForObject($item, $options, $simple);
$datas["##problem.impacts##"] = $item->getField('impactcontent');
$datas["##problem.causes##"] = $item->getField('causecontent');
$datas["##problem.symptoms##"] = $item->getField('symptomcontent');
// Complex mode
if (!$simple) {
$restrict = "`problems_id`='" . $item->getField('id') . "'";
$tickets = getAllDatasFromTable('glpi_problems_tickets', $restrict);
$datas['tickets'] = array();
if (count($tickets)) {
$ticket = new Ticket();
foreach ($tickets as $data) {
if ($ticket->getFromDB($data['tickets_id'])) {
$tmp = array();
$tmp['##ticket.id##'] = $data['tickets_id'];
$tmp['##ticket.date##'] = $ticket->getField('date');
$tmp['##ticket.title##'] = $ticket->getField('name');
$tmp['##ticket.url##'] = $this->formatURL($options['additionnaloption']['usertype'], "Ticket_" . $data['tickets_id']);
$tmp['##ticket.content##'] = $ticket->getField('content');
$datas['tickets'][] = $tmp;
}
}
}
$datas['##problem.numberoftickets##'] = count($datas['tickets']);
$restrict = "`problems_id`='" . $item->getField('id') . "'";
$changes = getAllDatasFromTable('glpi_changes_problems', $restrict);
$datas['changes'] = array();
if (count($changes)) {
$change = new Change();
foreach ($changes as $data) {
if ($change->getFromDB($data['changes_id'])) {
$tmp = array();
$tmp['##change.id##'] = $data['changes_id'];
$tmp['##change.date##'] = $change->getField('date');
$tmp['##change.title##'] = $change->getField('name');
$tmp['##change.url##'] = $this->formatURL($options['additionnaloption']['usertype'], "Change_" . $data['changes_id']);
$tmp['##change.content##'] = $change->getField('content');
$datas['changes'][] = $tmp;
}
}
}
$datas['##problem.numberofchanges##'] = count($datas['changes']);
$restrict = "`problems_id` = '" . $item->getField('id') . "'";
$items = getAllDatasFromTable('glpi_items_problems', $restrict);
$datas['items'] = array();
if (count($items)) {
foreach ($items as $data) {
if ($item2 = getItemForItemtype($data['itemtype'])) {
if ($item2->getFromDB($data['items_id'])) {
$tmp = array();
$tmp['##item.itemtype##'] = $item2->getTypeName();
$tmp['##item.name##'] = $item2->getField('name');
$tmp['##item.serial##'] = $item2->getField('serial');
$tmp['##item.otherserial##'] = $item2->getField('otherserial');
$tmp['##item.contact##'] = $item2->getField('contact');
$tmp['##item.contactnum##'] = $item2->getField('contactnum');
$tmp['##item.location##'] = '';
$tmp['##item.user##'] = '';
$tmp['##item.group##'] = '';
$tmp['##item.model##'] = '';
//Object location
if ($item2->getField('locations_id') != NOT_AVAILABLE) {
$tmp['##item.location##'] = Dropdown::getDropdownName('glpi_locations', $item2->getField('locations_id'));
}
//Object user
if ($item2->getField('users_id')) {
$user_tmp = new User();
if ($user_tmp->getFromDB($item2->getField('users_id'))) {
$tmp['##item.user##'] = $user_tmp->getName();
}
}
//Object group
if ($item2->getField('groups_id')) {
$tmp['##item.group##'] = Dropdown::getDropdownName('glpi_groups', $item2->getField('groups_id'));
}
$modeltable = getSingular($item2->getTable()) . "models";
$modelfield = getForeignKeyFieldForTable($modeltable);
if ($item2->isField($modelfield)) {
$tmp['##item.model##'] = $item2->getField($modelfield);
}
$datas['items'][] = $tmp;
}
}
}
}
$datas['##problem.numberofitems##'] = count($datas['items']);
}
return $datas;
}