NotificationTargetCommonITILObject::getTags PHP Method

getTags() public method

public getTags ( )
    function getTags()
    {
        $itemtype = $this->obj->getType();
        $objettype = strtolower($itemtype);
        //Locales
        $tags = array($objettype . '.id' => __('ID'), $objettype . '.title' => __('Title'), $objettype . '.url' => __('URL'), $objettype . '.category' => __('Category'), $objettype . '.content' => __('Description'), $objettype . '.description' => sprintf(__('%1$s: %2$s'), __('Ticket'), __('Description')), $objettype . '.status' => __('Status'), $objettype . '.urgency' => __('Urgency'), $objettype . '.impact' => __('Impact'), $objettype . '.priority' => __('Priority'), $objettype . '.time' => __('Total duration'), $objettype . '.creationdate' => __('Opening date'), $objettype . '.closedate' => __('Closing date'), $objettype . '.solvedate' => __('Date of solving'), $objettype . '.duedate' => __('Time to resolve'), $objettype . '.authors' => _n('Requester', 'Requesters', Session::getPluralNumber()), 'author.id' => __('Requester ID'), 'author.name' => __('Requester'), 'author.location' => __('Requester location'), 'author.mobile' => __('Mobile phone'), 'author.phone' => __('Phone'), 'author.phone2' => __('Phone 2'), 'author.email' => _n('Email', 'Emails', 1), 'author.title' => _x('person', 'Title'), 'author.category' => __('Category'), $objettype . '.openbyuser' => __('Writer'), $objettype . '.lastupdater' => __('Last updater'), $objettype . '.assigntousers' => __('Assigned to technicians'), $objettype . '.assigntosupplier' => __('Assigned to a supplier'), $objettype . '.groups' => _n('Requester group', 'Requester groups', Session::getPluralNumber()), $objettype . '.observergroups' => _n('Watcher group', 'Watcher groups', Session::getPluralNumber()), $objettype . '.assigntogroups' => __('Assigned to groups'), $objettype . '.solution.type' => __('Solution type'), $objettype . '.solution.description' => _n('Solution', 'Solutions', 1), $objettype . '.observerusers' => _n('Watcher', 'Watchers', Session::getPluralNumber()), $objettype . '.action' => _n('Event', 'Events', 1), $objettype . '.numberofunresolved' => __('Number of unresolved items'), $objettype . '.numberofdocuments' => _x('quantity', 'Number of documents'), $objettype . '.costtime' => __('Time cost'), $objettype . '.costfixed' => __('Fixed cost'), $objettype . '.costmaterial' => __('Material cost'), $objettype . '.totalcost' => __('Total cost'), $objettype . '.numberofcosts' => __('Number of costs'), 'cost.name' => sprintf(__('%1$s: %2$s'), __('Cost'), __('Name')), 'cost.comment' => sprintf(__('%1$s: %2$s'), __('Cost'), __('Comments')), 'cost.datebegin' => sprintf(__('%1$s: %2$s'), __('Cost'), __('Begin date')), 'cost.dateend' => sprintf(__('%1$s: %2$s'), __('Cost'), __('End date')), 'cost.time' => sprintf(__('%1$s: %2$s'), __('Cost'), __('Duration')), 'cost.costtime' => sprintf(__('%1$s: %2$s'), __('Cost'), __('Time cost')), 'cost.costfixed' => sprintf(__('%1$s: %2$s'), __('Cost'), __('Fixed cost')), 'cost.costmaterial' => sprintf(__('%1$s: %2$s'), __('Cost'), __('Material cost')), 'cost.totalcost' => sprintf(__('%1$s: %2$s'), __('Cost'), __('Total cost')), 'cost.budget' => sprintf(__('%1$s: %2$s'), __('Cost'), __('Budget')), 'task.author' => __('Writer'), 'task.isprivate' => __('Private'), 'task.date' => __('Opening date'), 'task.description' => __('Description'), 'task.categoryid' => __('Category id'), 'task.category' => __('Category'), 'task.categorycomment' => __('Category comment'), 'task.time' => __('Total duration'), 'task.user' => __('User assigned to task'), 'task.group' => __('Group assigned to task'), 'task.begin' => __('Start date'), 'task.end' => __('End date'), 'task.status' => __('Status'), $objettype . '.numberoftasks' => _x('quantity', 'Number of tasks'));
        foreach ($tags as $tag => $label) {
            $this->addTagToList(array('tag' => $tag, 'label' => $label, 'value' => true, 'events' => parent::TAG_FOR_ALL_EVENTS));
        }
        //Foreach global tags
        $tags = array('log' => __('Historical'), 'tasks' => _n('Task', 'Tasks', Session::getPluralNumber()), 'costs' => _n('Cost', 'Costs', Session::getPluralNumber()), 'authors' => _n('Requester', 'Requesters', Session::getPluralNumber()));
        foreach ($tags as $tag => $label) {
            $this->addTagToList(array('tag' => $tag, 'label' => $label, 'value' => false, 'foreach' => true));
        }
        //Tags with just lang
        $tags = array($objettype . '.days' => _n('Day', 'Days', Session::getPluralNumber()), $objettype . '.attribution' => __('Assigned to'), $objettype . '.entity' => __('Entity'), $objettype . '.nocategoryassigned' => __('No defined category'), $objettype . '.log' => __('Historical'), $objettype . '.tasks' => _n('Task', 'Tasks', Session::getPluralNumber()), $objettype . '.costs' => _n('Cost', 'Costs', Session::getPluralNumber()));
        foreach ($tags as $tag => $label) {
            $this->addTagToList(array('tag' => $tag, 'label' => $label, 'value' => false, 'lang' => true));
        }
        //Tags without lang
        $tags = array($objettype . '.urlapprove' => __('Web link to approval the solution'), $objettype . '.entity' => sprintf(__('%1$s (%2$s)'), __('Entity'), __('Complete name')), $objettype . '.shortentity' => sprintf(__('%1$s (%2$s)'), __('Entity'), __('Name')), $objettype . '.numberoflogs' => sprintf(__('%1$s: %2$s'), __('Historical'), _x('quantity', 'Number of items')), $objettype . '.log.date' => sprintf(__('%1$s: %2$s'), __('Historical'), __('Date')), $objettype . '.log.user' => sprintf(__('%1$s: %2$s'), __('Historical'), __('User')), $objettype . '.log.field' => sprintf(__('%1$s: %2$s'), __('Historical'), __('Field')), $objettype . '.log.content' => sprintf(__('%1$s: %2$s'), __('Historical'), _x('name', 'Update')), 'document.url' => sprintf(__('%1$s: %2$s'), __('Document'), __('URL')), 'document.downloadurl' => sprintf(__('%1$s: %2$s'), __('Document'), __('Download URL')), 'document.heading' => sprintf(__('%1$s: %2$s'), __('Document'), __('Heading')), 'document.id' => sprintf(__('%1$s: %2$s'), __('Document'), __('ID')), 'document.filename' => sprintf(__('%1$s: %2$s'), __('Document'), __('File')), 'document.weblink' => sprintf(__('%1$s: %2$s'), __('Document'), __('Web Link')), 'document.name' => sprintf(__('%1$s: %2$s'), __('Document'), __('Name')), $objettype . '.urldocument' => sprintf(__('%1$s: %2$s'), _n('Document', 'Documents', Session::getPluralNumber()), __('URL')));
        foreach ($tags as $tag => $label) {
            $this->addTagToList(array('tag' => $tag, 'label' => $label, 'value' => true, 'lang' => false));
        }
        //Tickets with a fixed set of values
        $status = $this->obj->getAllStatusArray(false);
        $allowed_ticket = array();
        foreach ($status as $key => $value) {
            $allowed_ticket[] = $key;
        }
        $tags = array($objettype . '.storestatus' => array('text' => __('Status value in database'), 'allowed_values' => $allowed_ticket));
        foreach ($tags as $tag => $label) {
            $this->addTagToList(array('tag' => $tag, 'label' => $label['text'], 'value' => true, 'lang' => false, 'allowed_values' => $label['allowed_values']));
        }
    }

Usage Example

コード例 #1
0
 function getTags()
 {
     parent::getTags();
     //Locales
     $tags = array('ticket.type' => __('Type'), 'ticket.sla' => __('SLA'), 'ticket.requesttype' => __('Request source'), 'ticket.itemtype' => __('Item type'), 'ticket.item.name' => __('Associated item'), 'ticket.item.serial' => __('Serial number'), 'ticket.item.otherserial' => __('Inventory number'), 'ticket.item.location' => sprintf(__('%1$s: %2$s'), _n('Associated element', 'Associated elements', 2), __('Location')), 'ticket.item.model' => __('Model'), 'ticket.item.contact' => __('Alternate username'), 'ticket.item.contactnumber' => __('Alternate username number'), 'ticket.item.user' => __('User'), 'ticket.item.group' => __('Group'), 'ticket.isdeleted' => __('Deleted'), 'followup.date' => __('Opening date'), 'followup.isprivate' => __('Private'), 'followup.author' => __('Writer'), 'followup.description' => __('Description'), 'followup.requesttype' => __('Request source'), 'ticket.numberoffollowups' => _x('quantity', 'Number of followups'), 'ticket.numberoflinkedtickets' => _x('quantity', 'Number of linked tickets'), 'ticket.numberofproblems' => _x('quantity', 'Number of problems'), 'ticket.numberofchanges' => _x('quantity', 'Number of changes'), 'ticket.numberofitems' => _x('quantity', 'Number of items'), 'ticket.autoclose' => __('Automatic closing of solved tickets after'), 'ticket.location' => __('Location'), 'ticket.globalvalidation' => __('Global approval status'), 'ticket.solution.approval.description' => __('Solution rejection comment'), 'ticket.solution.approval.date' => __('Solution rejection date'), 'ticket.solution.approval.author' => __('Approver'));
     foreach ($tags as $tag => $label) {
         $this->addTagToList(array('tag' => $tag, 'label' => $label, 'value' => true, 'events' => NotificationTarget::TAG_FOR_ALL_EVENTS));
     }
     //Events specific for validation
     $tags = array('validation.author' => __('Requester'), 'validation.status' => __('Status of the approval request'), 'validation.submissiondate' => sprintf(__('%1$s: %2$s'), __('Request'), __('Date')), 'validation.commentsubmission' => sprintf(__('%1$s: %2$s'), __('Request'), __('Comments')), 'validation.validationdate' => sprintf(__('%1$s: %2$s'), __('Validation'), __('Date')), 'validation.validator' => __('Decision-maker'), 'validation.commentvalidation' => sprintf(__('%1$s: %2$s'), __('Validation'), __('Comments')));
     foreach ($tags as $tag => $label) {
         $this->addTagToList(array('tag' => $tag, 'label' => $label, 'value' => true, 'events' => array('validation', 'validation_answer')));
     }
     //Tags without lang for validation
     $tags = array('validation.submission.title' => __('A validation request has been submitted'), 'validation.answer.title' => __('An answer to a validation request was produced'));
     foreach ($tags as $tag => $label) {
         $this->addTagToList(array('tag' => $tag, 'label' => $label, 'value' => true, 'lang' => false, 'events' => array('validation', 'validation_answer')));
     }
     // Events for ticket satisfaction
     $tags = array('satisfaction.datebegin' => __('Creation date of the satisfaction survey'), 'satisfaction.dateanswered' => __('Response date to the satisfaction survey'), 'satisfaction.satisfaction' => __('Satisfaction'), 'satisfaction.description' => __('Comments to the satisfaction survey'));
     foreach ($tags as $tag => $label) {
         $this->addTagToList(array('tag' => $tag, 'label' => $label, 'value' => true, 'events' => array('satisfaction')));
     }
     $tags = array('satisfaction.type' => __('Survey type'));
     foreach ($tags as $tag => $label) {
         $this->addTagToList(array('tag' => $tag, 'label' => $label, 'value' => true, 'lang' => false, 'events' => array('satisfaction')));
     }
     $tags = array('satisfaction.text' => __('Invitation to fill out the survey'));
     foreach ($tags as $tag => $label) {
         $this->addTagToList(array('tag' => $tag, 'label' => $label, 'value' => false, 'lang' => true, 'events' => array('satisfaction')));
     }
     //Foreach global tags
     $tags = array('followups' => _n('Followup', 'Followups', Session::getPluralNumber()), 'validations' => _n('Validation', 'Validations', Session::getPluralNumber()), 'linkedtickets' => _n('Linked ticket', 'Linked tickets', Session::getPluralNumber()), 'problems' => _n('Problem', 'Problems', Session::getPluralNumber()), 'changes' => _n('Change', 'Changes', Session::getPluralNumber()), 'items' => _n('Associated item', 'Associated items', Session::getPluralNumber()), 'documents' => _n('Document', 'Documents', Session::getPluralNumber()));
     foreach ($tags as $tag => $label) {
         $this->addTagToList(array('tag' => $tag, 'label' => $label, 'value' => false, 'foreach' => true));
     }
     //Tags with just lang
     $tags = array('ticket.linkedtickets' => _n('Linked ticket', 'Linked tickets', Session::getPluralNumber()), 'ticket.problems' => _n('Problem', 'Problems', Session::getPluralNumber()), 'ticket.changes' => _n('Change', 'Changes', Session::getPluralNumber()), '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', 2), '?'));
     foreach ($tags as $tag => $label) {
         $this->addTagToList(array('tag' => $tag, 'label' => $label, 'value' => false, 'lang' => true));
     }
     //Foreach tag for alertnotclosed
     $this->addTagToList(array('tag' => 'tickets', 'label' => __('Not solved tickets'), 'value' => false, 'foreach' => true, 'events' => array('alertnotclosed')));
     //Tags without lang
     $tags = array('ticket.urlvalidation' => sprintf(__('%1$s: %2$s'), __('Validation request'), __('URL')), 'ticket.urlsatisfaction' => sprintf(__('%1$s: %2$s'), __('Satisfaction'), __('URL')), 'linkedticket.id' => sprintf(__('%1$s: %2$s'), _n('Linked ticket', 'Linked tickets', 1), __('ID')), 'linkedticket.link' => sprintf(__('%1$s: %2$s'), _n('Linked ticket', 'Linked tickets', 1), __('Link')), 'linkedticket.url' => sprintf(__('%1$s: %2$s'), _n('Linked ticket', 'Linked tickets', 1), __('URL')), 'linkedticket.title' => sprintf(__('%1$s: %2$s'), _n('Linked ticket', 'Linked tickets', 1), __('Title')), 'linkedticket.content' => sprintf(__('%1$s: %2$s'), _n('Linked ticket', 'Linked tickets', 1), __('Description')), 'problem.id' => sprintf(__('%1$s: %2$s'), __('Problem'), __('ID')), 'problem.date' => sprintf(__('%1$s: %2$s'), __('Problem'), __('Date')), 'problem.url' => sprintf(__('%1$s: %2$s'), __('Problem'), 'URL'), 'problem.title' => sprintf(__('%1$s: %2$s'), __('Problem'), __('Title')), 'problem.content' => sprintf(__('%1$s: %2$s'), __('Problem'), __('Description')), 'change.id' => sprintf(__('%1$s: %2$s'), __('Change'), __('ID')), 'change.date' => sprintf(__('%1$s: %2$s'), __('Change'), __('Date')), 'change.url' => sprintf(__('%1$s: %2$s'), __('Change'), 'URL'), 'change.title' => sprintf(__('%1$s: %2$s'), __('Change'), __('Title')), 'change.content' => sprintf(__('%1$s: %2$s'), __('Change'), __('Description')));
     foreach ($tags as $tag => $label) {
         $this->addTagToList(array('tag' => $tag, 'label' => $label, 'value' => true, 'lang' => false));
     }
     //Tickets with a fixed set of values
     $allowed_validation = array();
     $status = TicketValidation::getAllStatusArray(false, true);
     foreach ($status as $key => $value) {
         $allowed_validation[] = $key;
     }
     $tags = array('validation.validationstatus' => array('text' => __('Status value in database'), 'allowed_values' => $allowed_validation));
     foreach ($tags as $tag => $label) {
         $this->addTagToList(array('tag' => $tag, 'label' => $label['text'], 'value' => true, 'lang' => false, 'allowed_values' => $label['allowed_values']));
     }
     asort($this->tag_descriptions);
 }
All Usage Examples Of NotificationTargetCommonITILObject::getTags