本文整理汇总了PHP中TicketValidation类的典型用法代码示例。如果您正苦于以下问题:PHP TicketValidation类的具体用法?PHP TicketValidation怎么用?PHP TicketValidation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TicketValidation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pdfForTicket
static function pdfForTicket(PluginPdfSimplePDF $pdf, Ticket $ticket)
{
global $CFG_GLPI, $DB;
$pdf->setColumnsSize(100);
$pdf->displayTitle("<b>" . __('Approvals for the ticket') . "</b>");
if (!Session::haveRight('validate_request', 1) && !Session::haveRight('validate_incident', 1) && !Session::haveRight('create_incident_validation', 1) && !Session::haveRight('create_request_validation', 1)) {
return false;
}
$ID = $ticket->getField('id');
$query = "SELECT *\n FROM `glpi_ticketvalidations`\n WHERE `tickets_id` = '" . $ticket->getField('id') . "'\n ORDER BY submission_date DESC";
$result = $DB->query($query);
$number = $DB->numrows($result);
if ($number) {
$pdf->setColumnsSize(20, 19, 21, 19, 21);
$pdf->displayTitle(_x('item', 'State'), __('Request date'), __('Approval requester'), __('Approval date'), __('Approver'));
while ($row = $DB->fetch_assoc($result)) {
$pdf->setColumnsSize(20, 19, 21, 19, 21);
$pdf->displayLine(TicketValidation::getStatus($row['status']), Html::convDateTime($row["submission_date"]), getUserName($row["users_id"]), Html::convDateTime($row["validation_date"]), getUserName($row["users_id_validate"]));
$tmp = trim($row["comment_submission"]);
$pdf->displayText("<b><i>" . sprintf(__('%1$s: %2$s'), __('Request comments') . "</i></b>", empty($tmp) ? __('None') : $tmp, 1));
if ($row["validation_date"]) {
$tmp = trim($row["comment_validation"]);
$pdf->displayText("<b><i>" . sprintf(__('%1$s: %2$s'), __('Approval comments') . "</i></b>", empty($tmp) ? __('None') : $tmp, 1));
}
}
} else {
$pdf->displayLine(__('No item found'));
}
$pdf->displaySpace();
}
示例2: show
public static function show($ID, $from_helpdesk)
{
global $LANG, $CFG_GLPI, $DB;
//$logged = $_SESSION['glpiID'];
if (!isset($_REQUEST['session'])) {
$IDO = Session::getLoginUserID();
} else {
$IDO = $_REQUEST['session'];
}
$logged = $ID;
/*
echo $logged."logged2 ";
echo Session::getLoginUserID()."session ";
*/
if (isset($_REQUEST['id'])) {
$ID = $_REQUEST['id'];
$_SESSION["glpiID"] = $_REQUEST['id'];
$query = "SELECT `profiles_id` AS id\nFROM `glpi_profiles_users`\nWHERE `users_id` = " . $IDO . "\nORDER BY `glpi_profiles_users`.`profiles_id` DESC";
$result = $DB->query($query);
$cont = $DB->numrows($result);
$profile = $DB->fetch_assoc($result);
} else {
$ID = $_SESSION['glpiID'];
$_SESSION['glpiID'] = $_SESSION['glpiID'];
$query = "SELECT `profiles_id` AS id\nFROM `glpi_profiles_users`\nWHERE `users_id` = " . $IDO . "\nORDER BY `glpi_profiles_users`.`profiles_id` DESC";
$result = $DB->query($query);
$cont = $DB->numrows($result);
$profile = $DB->fetch_assoc($result);
}
/*
echo $ID."id ";
echo $_SESSION['glpiID']."glpiid ";
echo $_SESSION['logged']."logged ";
echo $logged."logged2 ";
*/
if (!Session::haveRight("ticket", CREATE)) {
return false;
}
if (Session::haveRight('validate_ticket', 1)) {
// if (Session::haveRightsOr('ticketvalidation', array(TicketValidation::VALIDATEREQUEST, TicketValidation::VALIDATEINCIDENT))) {
$opt = array();
$opt['reset'] = 'reset';
$opt['field'][0] = 55;
// validation status
$opt['searchtype'][0] = 'equals';
$opt['contains'][0] = 'waiting';
$opt['link'][0] = 'AND';
$opt['field'][1] = 59;
// validation aprobator
$opt['searchtype'][1] = 'equals';
$opt['contains'][1] = Session::getLoginUserID();
//$opt['contains'][1] = $ID;
$opt['link'][1] = 'AND';
$url_validate = $CFG_GLPI["root_doc"] . "/front/ticket.php?" . Toolbox::append_params($opt, '&');
if (TicketValidation::getNumberTicketsToValidate(Session::getLoginUserID()) > 0) {
//if (TicketValidation::getNumberTicketsToValidate( $ID >0) {
echo "<a href='{$url_validate}' title=\"" . $LANG['validation'][15] . "\"\n alt=\"" . $LANG['validation'][15] . "\">" . $LANG['validation'][33] . "</a><br><br>";
}
}
// Stevenes Donato
//email user
$query = "SELECT gu.id, ge.email, gu.`firstname`, gu.`realname`, gu.`name`\n FROM `glpi_users` gu, glpi_useremails ge\n WHERE gu.`id` = '{$ID}'\n\t\t\t\t\t AND ge.users_id = gu.id ";
$result = $DB->query($query);
$email = $DB->result($result, 0, "email");
$user_name = $DB->result($result, 0, "firstname") . " ";
$user_sname = $DB->result($result, 0, "realname");
//categories
$query_cat = "SELECT id, completename\n\t\t\t\t\t\t\tFROM `glpi_itilcategories` \n\t\t\t\t\t\t\tWHERE `is_helpdeskvisible` = 1";
$result_cat = $DB->query($query_cat);
$itilcategories_id = $DB->fetch_assoc($result_cat);
$sql_user = "\n\t\tSELECT DISTINCT glpi_users.`id` AS id , glpi_users.`firstname` AS name, glpi_users.`realname` AS sname\n\t\tFROM `glpi_users`\n\t\tWHERE glpi_users.is_deleted = 0\n\t\tORDER BY `glpi_users`.`firstname` ASC ";
$result_user = $DB->query($sql_user);
$user = $DB->fetch_assoc($result_user);
// Get saved data from a back system
$use_email_notification = 1;
if ($email == "") {
$use_email_notification = 0;
}
$itemtype = 0;
$items_id = "";
$content = "";
$title = "";
//$itilcategories_id = 0;
$urgency = 3;
if (isset($_SESSION["helpdeskSaved"]["use_email_notification"])) {
$use_email_notification = stripslashes($_SESSION["helpdeskSaved"]["use_email_notification"]);
}
if (isset($_SESSION["helpdeskSaved"]["email"])) {
$email = stripslashes($_SESSION["helpdeskSaved"]["user_email"]);
}
if (isset($_SESSION["helpdeskSaved"]["itemtype"])) {
$itemtype = stripslashes($_SESSION["helpdeskSaved"]["itemtype"]);
}
if (isset($_SESSION["helpdeskSaved"]["items_id"])) {
$items_id = stripslashes($_SESSION["helpdeskSaved"]["items_id"]);
}
if (isset($_SESSION["helpdeskSaved"]["content"])) {
$content = cleanPostForTextArea($_SESSION["helpdeskSaved"]["content"]);
}
if (isset($_SESSION["helpdeskSaved"]["name"])) {
//.........这里部分代码省略.........
示例3: giveItem
//.........这里部分代码省略.........
return implode("<br>", $itemtypes);
}
}
return ' ';
case 'glpi_tickets.name':
case 'glpi_problems.name':
case 'glpi_changes.name':
if (isset($data[$num][0]['content']) && isset($data[$num][0]['id']) && isset($data[$num][0]['status'])) {
$link = Toolbox::getItemTypeFormURL($itemtype);
$out = "<a id='{$itemtype}" . $data[$num][0]['id'] . "' href=\"" . $link;
$out .= strstr($link, '?') ? '&' : '?';
$out .= 'id=' . $data[$num][0]['id'];
// Force solution tab if solved
if ($item = getItemForItemtype($itemtype)) {
if (in_array($data[$num][0]['status'], $item->getSolvedStatusArray())) {
$out .= "&forcetab={$itemtype}\$2";
}
}
$out .= "\">";
$name = $data[$num][0]['name'];
if ($_SESSION["glpiis_ids_visible"] || empty($data[$num][0]['name'])) {
$name = sprintf(__('%1$s (%2$s)'), $name, $data[$num][0]['id']);
}
$out .= $name . "</a>";
$hdecode = Html::entity_decode_deep($data[$num][0]['content']);
$content = Toolbox::unclean_cross_side_scripting_deep($hdecode);
$out = sprintf(__('%1$s %2$s'), $out, Html::showToolTip(nl2br(Html::Clean($content)), array('applyto' => $itemtype . $data[$num][0]['id'], 'display' => false)));
return $out;
}
case 'glpi_ticketvalidations.status':
$out = '';
for ($k = 0; $k < $data[$num]['count']; $k++) {
if ($data[$num][$k]['name']) {
$status = TicketValidation::getStatus($data[$num][$k]['name']);
$bgcolor = TicketValidation::getStatusColor($data[$num][$k]['name']);
$out .= (empty($out) ? '' : self::LBBR) . "<div style=\"background-color:" . $bgcolor . ";\">" . $status . '</div>';
}
}
return $out;
case 'glpi_ticketsatisfactions.satisfaction':
if (self::$output_type == self::HTML_OUTPUT) {
return TicketSatisfaction::displaySatisfaction($data[$num][0]['name']);
}
break;
case 'glpi_projects._virtual_planned_duration':
return Html::timestampToString(ProjectTask::getTotalPlannedDurationForProject($data["id"]), false);
case 'glpi_projects._virtual_effective_duration':
return Html::timestampToString(ProjectTask::getTotalEffectiveDurationForProject($data["id"]), false);
case 'glpi_cartridgeitems._virtual':
return Cartridge::getCount($data["id"], $data[$num][0]['alarm_threshold'], self::$output_type != self::HTML_OUTPUT);
case 'glpi_printers._virtual':
return Cartridge::getCountForPrinter($data["id"], self::$output_type != self::HTML_OUTPUT);
case 'glpi_consumableitems._virtual':
return Consumable::getCount($data["id"], $data[$num][0]['alarm_threshold'], self::$output_type != self::HTML_OUTPUT);
case 'glpi_links._virtual':
$out = '';
$link = new Link();
if (($item = getItemForItemtype($itemtype)) && $item->getFromDB($data['id']) && $link->getfromDB($data[$num][0]['id']) && $item->fields['entities_id'] == $link->fields['entities_id']) {
if (count($data[$num])) {
$count_display = 0;
foreach ($data[$num] as $val) {
if (is_array($val)) {
$links = Link::getAllLinksFor($item, $val);
foreach ($links as $link) {
if ($count_display) {
$out .= self::LBBR;
示例4: pdfMain
static function pdfMain(PluginPdfSimplePDF $pdf, Ticket $job)
{
global $CFG_GLPI, $DB;
$ID = $job->getField('id');
if (!$job->can($ID, 'r')) {
return false;
}
$pdf->setColumnsSize(100);
$pdf->displayTitle('<b>' . (empty($job->fields["name"]) ? __('Without title') : ($name = $job->fields["name"])) . '</b>');
if (count($_SESSION['glpiactiveentities']) > 1) {
$entity = " (" . Dropdown::getDropdownName("glpi_entities", $job->fields["entities_id"]) . ")";
} else {
$entity = '';
}
$pdf->setColumnsSize(50, 50);
$recipient_name = '';
if ($job->fields["users_id_recipient"]) {
$recipient = new User();
$recipient->getFromDB($job->fields["users_id_recipient"]);
$recipient_name = $recipient->getName();
}
$sla = $due = $commentsla = '';
if ($job->fields['due_date']) {
$due = "<b><i>" . sprintf(__('%1$s: %2$s'), __('Due date') . "</b></i>", Html::convDateTime($job->fields['due_date']));
}
$pdf->displayLine("<b><i>" . sprintf(__('%1$s: %2$s'), __('Opening date') . "</i></b>", Html::convDateTime($job->fields["date"])), $due);
$pdf->setColumnsSize(100);
if ($job->fields["slas_id"] > 0) {
$sla = "<b><i>" . sprintf(__('%1$s: %2$s'), __('SLA') . "</b></i>", Html::clean(Dropdown::getDropdownName("glpi_slas", $job->fields["slas_id"])));
$slalevel = new SlaLevel();
if ($slalevel->getFromDB($job->fields['slalevels_id'])) {
$commentsla = "<b><i>" . sprintf(__('%1$s: %2$s'), __('Escalation level') . "</b></i>", $slalevel->getName());
}
$nextaction = new SlaLevel_Ticket();
if ($nextaction->getFromDBForTicket($job->fields["id"])) {
$commentsla .= " <b><i>" . sprintf(__('Next escalation: %s') . "</b></i>", Html::convDateTime($nextaction->fields['date']));
if ($slalevel->getFromDB($nextaction->fields['slalevels_id'])) {
$commentsla .= " <b><i>" . sprintf(__('%1$s: %2$s'), __('Escalation level'), $slalevel->getName());
}
}
$pdf->displayText($sla, $commentsla, 1);
}
$pdf->setColumnsSize(50, 50);
$lastupdate = Html::convDateTime($job->fields["date_mod"]);
if ($job->fields['users_id_lastupdater'] > 0) {
$lastupdate = sprintf(__('%1$s by %2$s'), $lastupdate, getUserName($job->fields["users_id_lastupdater"]));
}
$pdf->displayLine('<b><i>' . sprintf(__('%1$s: %2$s'), __('By') . "</i></b>", $recipient_name), '<b><i>' . sprintf(__('%1$s: %2$s'), __('Last update') . '</i></b>', $lastupdate));
$pdf->displayLine("<b><i>" . sprintf(__('%1$s: %2$s'), __('Type') . "</i></b>", Html::clean(Ticket::getTicketTypeName($job->fields["type"]))), "<b><i>" . sprintf(__('%1$s: %2$s'), __('Category') . "</i></b>", Html::clean(Dropdown::getDropdownName("glpi_itilcategories", $job->fields["itilcategories_id"]))));
$status = '';
if (in_array($job->fields["status"], $job->getSolvedStatusArray()) || in_array($job->fields["status"], $job->getClosedStatusArray())) {
$status = sprintf(__('%1$s %2$s'), '-', Html::convDateTime($job->fields["solvedate"]));
}
if (in_array($job->fields["status"], $job->getClosedStatusArray())) {
$status = sprintf(__('%1$s %2$s'), '-', Html::convDateTime($job->fields["closedate"]));
}
if ($job->fields["status"] == Ticket::WAITING) {
$status = sprintf(__('%1$s %2$s'), '-', Html::convDateTime($job->fields['begin_waiting_date']));
}
$pdf->displayLine("<b><i>" . sprintf(__('%1$s: %2$s'), __('Status') . "</i></b>", Html::clean($job->getStatus($job->fields["status"])) . $status), "<b><i>" . sprintf(__('%1$s: %2$s'), __('Request source') . "</i></b>", Html::clean(Dropdown::getDropdownName('glpi_requesttypes', $job->fields['requesttypes_id']))));
$pdf->displayLine("<b><i>" . sprintf(__('%1$s: %2$s'), __('Urgency') . "</i></b>", Html::clean($job->getUrgencyName($job->fields["urgency"]))), "<b><i>" . sprintf(__('%1$s: %2$s'), __('Approval') . "</i></b>", TicketValidation::getStatus($job->fields['global_validation'])));
$pdf->displayLine("<b><i>" . sprintf(__('%1$s: %2$s'), __('Impact') . "</i></b>", Html::clean($job->getImpactName($job->fields["impact"]))));
$pdf->displayLine("<b><i>" . sprintf(__('%1$s: %2$s'), __('Priority') . "</i></b>", Html::clean($job->getPriorityName($job->fields["priority"]))), "<b><i>" . sprintf(__('%1$s: %2$s'), __('Location') . "</i></b>", Html::clean(Dropdown::getDropdownName("glpi_locations", $job->fields["locations_id"]))));
// Item
$name = "<b><i>" . sprintf(__('%1$s: %2$s'), __('Associated element') . "</i></b>", '');
$commentitem = '';
$pdf->setColumnsSize(100);
if ($job->fields['itemtype'] && ($item = getItemForItemtype($job->fields['itemtype']))) {
if ($item->getFromDB($job->fields["items_id"])) {
$name = "<b><i>" . sprintf(__('%1$s: %2$s'), __('Associated element') . "</i></b>", $item->getNameID());
if (isset($item->fields["serial"])) {
$commentitem = ", <b><i>" . sprintf(__('%1$s: %2$s'), __('Serial number') . "</i></b>", Html::clean($item->fields["serial"]));
Html::clean($item->fields["serial"]);
}
if (isset($item->fields["otherserial"])) {
$commentitem .= ", <b><i>" . sprintf(__('%1$s: %2$s'), __('Inventory number') . "</i></b>", Html::clean($item->fields["otherserial"]));
}
if (isset($item->fields["locations_id"])) {
$commentitem .= ", <b><i>" . sprintf(__('%1$s: %2$s'), __('Location') . "</i></b>", Html::clean(Dropdown::getDropdownName("glpi_locations", $item->fields["locations_id"])));
}
}
}
$pdf->displayText($name, $commentitem, 1);
$pdf->setColumnsSize(50, 50);
// Requester
$users = array();
$listusers = '';
$requester = '<b><i>' . sprintf(__('%1$s: %2$s') . "</i></b>", __('Requester'), $listusers);
foreach ($job->getUsers(CommonITILActor::REQUESTER) as $d) {
if ($d['users_id']) {
$tmp = Html::clean(getUserName($d['users_id']));
if ($d['alternative_email']) {
$tmp .= ' (' . $d['alternative_email'] . ')';
}
} else {
$tmp = $d['alternative_email'];
}
$users[] = $tmp;
}
if (count($users)) {
//.........这里部分代码省略.........
示例5: showForm
//.........这里部分代码省略.........
echo "</td>";
// 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('create_incident_validation', 1)) {
$validation_right = 'validate_incident';
}
if ($values['type'] == self::DEMAND_TYPE && Session::haveRight('create_request_validation', 1)) {
$validation_right = 'validate_request';
}
if (!empty($validation_right)) {
User::dropdown(array('name' => "_add_validation", 'entity' => $this->fields['entities_id'], 'right' => $validation_right, 'value' => $values['_add_validation']));
}
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 ($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 rowspan='2'>" . $tt->getBeginHiddenFieldText('itemtype');
printf(__('%1$s%2$s'), __('Associated element'), $tt->getMandatoryMark('itemtype'));
if ($ID && $canupdate) {
echo " <img title='" . __s('Update') . "' alt='" . __s('Update') . "'\n onClick=\"Ext.get('tickethardwareselection{$ID}').setDisplayed('block')\"\n class='pointer' src='" . $CFG_GLPI["root_doc"] . "/pics/showselect.png'>";
}
echo $tt->getEndHiddenFieldText('itemtype');
echo "</th>";
echo "<td rowspan='2'>";
echo $tt->getBeginHiddenFieldValue('itemtype');
// Select hardware on creation or if have update right
if ($canupdate || !$ID || $canupdate_descr) {
示例6: getTags
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);
}
示例7: unset
$param['groups_id'] = '__VALUE__';
Ajax::updateItemOnSelectEvent("dropdown_{$name}{$rand}", "show_list_users", $CFG_GLPI["root_doc"] . "/ajax/dropdownValidator.php", $param);
if ($value) {
$param['validatortype'] = 'list_users';
$param['groups_id'] = $value;
unset($param['users_id_validate']['groups_id']);
Ajax::updateItem('show_list_users', $CFG_GLPI["root_doc"] . "/ajax/dropdownValidator.php", $param);
}
echo "<br><span id='show_list_users'> </span>\n";
break;
case 'list_users':
if (isset($_POST['users_id_validate']['groups_id'])) {
$_POST['users_id_validate'] = array();
}
$opt = array('groups_id' => $_POST["groups_id"], 'right' => $_POST['right'], 'entity' => $_POST["entity"]);
$data_users = TicketValidation::getGroupUserHaveRights($opt);
$users = array();
$param['values'] = array();
$values = array();
if (isset($_POST['users_id_validate']) && is_array($_POST['users_id_validate'])) {
$values = $_POST['users_id_validate'];
}
foreach ($data_users as $data) {
$users[$data['id']] = formatUserName($data['id'], $data['name'], $data['realname'], $data['firstname']);
if (in_array($data['id'], $values)) {
$param['values'][] = $data['id'];
}
}
// Display all users
if (isset($_POST['all_users']) && $_POST['all_users']) {
$param['values'] = array_keys($users);
示例8: define
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GLPI; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
--------------------------------------------------------------------------
*/
// ----------------------------------------------------------------------
// Original Author of file: Julien Dombre
// Purpose of file:
// ----------------------------------------------------------------------
define('GLPI_ROOT', '..');
include GLPI_ROOT . "/inc/includes.php";
header("Content-Type: text/html; charset=UTF-8");
header_nocache();
if (!isset($_POST["id"])) {
exit;
}
if (!isset($_REQUEST['glpi_tab'])) {
exit;
}
$validation = new TicketValidation();
if ($_POST["id"] > 0 && $validation->getFromDB($_POST["id"])) {
switch ($_REQUEST['glpi_tab']) {
default:
Plugin::displayAction($validation, $_REQUEST['glpi_tab']);
}
}
ajaxFooter();
示例9: define
// ----------------------------------------------------------------------
// Original Author of file: Julien Dombre
// Purpose of file:
// ----------------------------------------------------------------------
$AJAX_INCLUDE = 1;
define('GLPI_ROOT', '..');
include GLPI_ROOT . "/inc/includes.php";
header("Content-Type: text/html; charset=UTF-8");
header_nocache();
checkLoginUser();
if (!isset($_POST['type'])) {
exit;
}
if ($_POST['type'] == 'TicketTask') {
$item = new TicketTask();
} else {
if ($_POST['type'] == 'TicketFollowup') {
$item = new TicketFollowup();
} else {
if ($_POST['type'] == 'TicketValidation') {
$item = new TicketValidation();
}
}
}
$ticket = new Ticket();
if (isset($_POST["tickets_id"]) && isset($_POST["id"]) && $ticket->getFromDB($_POST["tickets_id"])) {
$item->showForm($_POST["id"], array('ticket' => $ticket));
} else {
echo $LANG['login'][5];
}
ajaxFooter();
示例10: array
$display = true;
break;
case "glpi_tickets.urgency":
Ticket::dropdownUrgency($inputname, $_REQUEST['value'], true);
$display = true;
break;
case "glpi_tickets.global_validation":
TicketValidation::dropdownStatus($inputname, array('value' => $_REQUEST['value'], 'all' => 1));
$display = true;
break;
case "glpi_users.name":
User::dropdown(array('name' => $inputname, 'value' => $_REQUEST['value'], 'comments' => false, 'all' => -1, 'right' => 'all'));
$display = true;
break;
case "glpi_ticketvalidations.status":
TicketValidation::dropdownStatus($inputname, array('value' => $_REQUEST['value'], 'all' => 1));
$display = true;
break;
}
// Standard datatype usage
if (!$display && isset($searchopt['datatype'])) {
switch ($searchopt['datatype']) {
case "bool":
Dropdown::showYesNo($inputname, $_REQUEST['value']);
$display = true;
break;
case "right":
// No access not displayed because empty not take into account for search
Profile::dropdownNoneReadWrite($inputname, $_REQUEST['value'], 1, 1, 1);
$display = true;
break;
示例11: constructHistory
/**
* Construct history for an item
*
* @param $item CommonDBTM object
* @param $oldvalues array of old values updated
* @param $values array of all values of the item
*
* @return boolean for success (at least 1 log entry added)
**/
static function constructHistory(CommonDBTM $item, &$oldvalues, &$values)
{
global $LANG;
if (!count($oldvalues)) {
return false;
}
// needed to have $SEARCHOPTION
if ($item->getType() == 'TicketSatisfaction') {
$real_type = 'Ticket';
$real_id = $item->fields['tickets_id'];
} else {
if ($item->getType() == 'Infocom') {
$real_type = $item->fields['itemtype'];
$real_id = $item->fields['items_id'];
} else {
$real_type = $item->getType();
$real_id = $item->fields['id'];
}
}
$searchopt = Search::getOptions($real_type);
if (!is_array($searchopt)) {
return false;
}
$result = 0;
foreach ($oldvalues as $key => $oldval) {
$changes = array();
if ($real_type == 'Infocom') {
// Parsing $SEARCHOPTION to find infocom
foreach ($searchopt as $key2 => $val2) {
if ($val2["field"] == $key && strpos($val2['table'], 'infocoms') || $key == 'budgets_id' && $val2['table'] == 'glpi_budgets' || $key == 'suppliers_id' && $val2['table'] == 'glpi_suppliers') {
$id_search_option = $key2;
// Give ID of the $SEARCHOPTION
if ($val2["table"] == "glpi_infocoms") {
// 1st case : text field -> keep datas
$changes = array($id_search_option, addslashes($oldval), $values[$key]);
} else {
if ($val2["table"] == "glpi_suppliers") {
// 2nd case ; link field -> get data from glpi_suppliers
$changes = array($id_search_option, addslashes(Dropdown::getDropdownName("glpi_suppliers", $oldval)), addslashes(Dropdown::getDropdownName("glpi_suppliers", $values[$key])));
} else {
// 3rd case ; link field -> get data from dropdown (budget)
$changes = array($id_search_option, addslashes(Dropdown::getDropdownName($val2["table"], $oldval)), addslashes(Dropdown::getDropdownName($val2["table"], $values[$key])));
}
}
break;
// foreach exit
}
}
} else {
// Not an Infocom
// Parsing $SEARCHOPTION to find changed field
foreach ($searchopt as $key2 => $val2) {
// Linkfield or standard field not massive action enable
if ($val2["linkfield"] == $key || $key == $val2["field"] && $val2["table"] == $item->getTable()) {
$id_search_option = $key2;
// Give ID of the $SEARCHOPTION
// 1st case : Ticket specific dropdown case (without table)
if ($real_type == 'Ticket' && in_array($key, array('status', 'urgency', 'impact', 'priority', 'global_validation'))) {
switch ($key) {
case 'global_validation':
$changes = array($id_search_option, addslashes(TicketValidation::getStatus($oldval)), addslashes(TicketValidation::getStatus($values[$key])));
break;
case 'status':
$changes = array($id_search_option, addslashes(Ticket::getStatus($oldval)), addslashes(Ticket::getStatus($values[$key])));
break;
case 'urgency':
$changes = array($id_search_option, addslashes(Ticket::getUrgencyName($oldval)), addslashes(Ticket::getUrgencyName($values[$key])));
break;
case 'impact':
$changes = array($id_search_option, addslashes(Ticket::getImpactName($oldval)), addslashes(Ticket::getImpactName($values[$key])));
break;
case 'priority':
$changes = array($id_search_option, addslashes(Ticket::getPriorityName($oldval)), addslashes(Ticket::getPriorityName($values[$key])));
break;
}
} else {
if ($val2["table"] == $item->getTable()) {
// 2nd case : text field -> keep datas
$changes = array($id_search_option, addslashes($oldval), $values[$key]);
} else {
// if ($val2['table'] == 'glpi_users_validation') {
// $val2['table'] = 'glpi_users';
// }
// other cases ; link field -> get data from dropdown
if ($val2["table"] != 'glpi_complete_entities') {
$changes = array($id_search_option, addslashes(Dropdown::getDropdownName($val2["table"], $oldval)), addslashes(Dropdown::getDropdownName($val2["table"], $values[$key])));
}
}
}
break;
}
//.........这里部分代码省略.........
示例12: giveItem
//.........这里部分代码省略.........
return "<img src=\"" . $CFG_GLPI["root_doc"] . "/pics/" . $data[$NAME . $num] . ".png\"\n alt='{$status}' title='{$status}'> {$status}";
case 'glpi_tickets.priority':
return Ticket::getPriorityName($data[$NAME . $num]);
case 'glpi_tickets.urgency':
return Ticket::getUrgencyName($data[$NAME . $num]);
case 'glpi_tickets.impact':
return Ticket::getImpactName($data[$NAME . $num]);
case 'glpi_tickets.items_id':
if (!empty($data[$NAME . $num . "_2"]) && class_exists($data[$NAME . $num . "_2"])) {
$item = new $data[$NAME . $num . "_2"]();
if ($item->getFromDB($data[$NAME . $num])) {
return $item->getLink(true);
}
}
return ' ';
case 'glpi_tickets.id':
$link = getItemTypeFormURLMobile('Ticket');
$out = "<a id='ticket" . $data[$NAME . $num . "_2"] . "' href=\"" . $link;
$out .= strstr($link, '?') ? '&' : '?';
$out .= 'id=' . $data[$NAME . $num];
//$out .= 'id='.$data[$NAME.$num."_2"];
$out .= "\" data-back='false'>" . $data[$NAME . $num];
if ($_SESSION["glpiis_ids_visible"] || empty($data[$NAME . $num])) {
//$out .= " (".$data[$NAME.$num."_2"].")";
$out .= $data[$NAME . $num . "_2"];
}
$out .= "</a>";
return $out;
case 'glpi_ticketvalidations.status':
case "glpi_tickets.global_validation":
$split = explode("\$\$\$\$", $data[$NAME . $num]);
$out = '';
foreach ($split as $val) {
$status = TicketValidation::getStatus($val);
$bgcolor = TicketValidation::getStatusColor($val);
$out .= (empty($out) ? '' : '<br>') . "<div style=\"background-color:" . $bgcolor . ";\">" . $status . '</div>';
}
return $out;
case 'glpi_notimportedemails.reason':
return NotImportedEmail::getReason($data[$NAME . $num]);
case 'glpi_notimportedemails.messageid':
$clean = array('<' => '', '>' => '');
return strtr($data[$NAME . $num], $clean);
}
//// Default case
// Link with plugin tables : need to know left join structure
if (preg_match("/^glpi_plugin_([a-z0-9]+)/", $table . '.' . $field, $matches)) {
if (count($matches) == 2) {
$plug = $matches[1];
$function = 'plugin_' . $plug . '_giveItem';
if (function_exists($function)) {
$out = $function($itemtype, $ID, $data, $num);
if (!empty($out)) {
return $out;
}
}
}
}
$unit = '';
if (isset($searchopt[$ID]['unit'])) {
$unit = $searchopt[$ID]['unit'];
}
// Preformat items
if (isset($searchopt[$ID]["datatype"])) {
switch ($searchopt[$ID]["datatype"]) {
case "itemlink":
示例13: showForMassiveAction
//.........这里部分代码省略.........
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':
if ($isadmin) {
echo "<option value='add_contact'>" . $LANG['financial'][24] . "</option>";
}
break;
case 'Calendar':
echo "<option value='duplicate'>" . $LANG['buttons'][54] . "</option>";
break;
case 'Contact':
if ($isadmin) {
echo "<option value='add_enterprise'>" . $LANG['financial'][25] . "</option>";
}
break;
case 'User':
if ($isadmin) {
echo "<option value='add_group'>" . $LANG['setup'][604] . "</option>";
echo "<option value='add_userprofile'>" . $LANG['setup'][607] . "</option>";
}
if (haveRight("user_authtype", "w")) {
echo "<option value='change_authtype'>" . $LANG['login'][30] . "</option>";
echo "<option value='force_user_ldap_update'>" . $LANG['ocsng'][24] . "</option>";
}
break;
case 'Ticket':
$tmp = new TicketFollowup();
if ($tmp->canCreate()) {
echo "<option value='add_followup'>" . $LANG['job'][29] . "</option>";
}
$tmp = new TicketTask();
if ($tmp->canCreate()) {
echo "<option value='add_task'>" . $LANG['job'][30] . "</option>";
}
$tmp = new TicketValidation();
if ($tmp->canCreate()) {
echo "<option value='submit_validation'>" . $LANG['validation'][26] . "</option>";
}
if (haveRight("update_ticket", "1")) {
echo "<option value='add_actor'>" . $LANG['job'][27] . "</option>";
echo "<option value='link_ticket'>" . $LANG['job'][56] . "</option>";
}
break;
case 'CronTask':
echo "<option value='reset'>" . $LANG['buttons'][16] . " (" . $LANG['crontask'][40] . ")";
echo "</option>";
break;
case 'NotImportedEmail':
echo "<option value='delete_email'>" . $LANG['mailing'][133] . "</option>";
echo "<option value='import_email'>" . $LANG['buttons'][37] . "</option>";
break;
}
if ($item instanceof CommonTreeDropdown) {
if ($isadmin) {
echo "<option value='move_under'>" . $LANG['buttons'][20] . "</option>";
}
}
if ($itemtype != 'Entity' && $itemtype != 'Calendar' && $item instanceof CommonDropdown && $item->maybeRecursive()) {
if ($isadmin) {
echo "<option value='merge'>" . $LANG['buttons'][48] . " - " . $LANG['software'][48];
echo "</option>";
}
}
// Plugin Specific actions
if (isset($PLUGIN_HOOKS['use_massive_action'])) {
foreach ($PLUGIN_HOOKS['use_massive_action'] as $plugin => $val) {
$actions = doOneHook($plugin, 'MassiveActions', $itemtype);
if (count($actions)) {
foreach ($actions as $key => $val) {
echo "<option value = '{$key}'>{$val}</option>";
}
}
}
}
}
echo "</select>";
$params = array('action' => '__VALUE__', 'is_deleted' => $is_deleted, 'itemtype' => $itemtype);
if (count($extraparams)) {
foreach ($extraparams as $key => $val) {
$params['extra_' . $key] = $val;
}
}
ajaxUpdateItemOnSelectEvent("massiveaction", "show_massiveaction", $CFG_GLPI["root_doc"] . "/ajax/dropdownMassiveAction.php", $params);
echo "<span id='show_massiveaction'> </span>\n";
}
}
示例14: getDatasForTemplate
/**
* Get all data needed for template processing
*
* @param $event
* @param $options array
**/
function getDatasForTemplate($event, $options = array())
{
global $CFG_GLPI;
$events = $this->getAllEvents();
$objettype = strtolower($this->obj->getType());
// Get datas from ITIL objects
if ($event != 'alertnotclosed') {
$this->datas = $this->getDatasForObject($this->obj, $options);
} else {
if (isset($options['entities_id']) && isset($options['items'])) {
$entity = new Entity();
if ($entity->getFromDB($options['entities_id'])) {
$this->datas["##{$objettype}.entity##"] = $entity->getField('completename');
$this->datas["##{$objettype}.shortentity##"] = $entity->getField('name');
}
if ($item = getItemForItemtype($objettype)) {
$objettypes = Toolbox::strtolower(getPlural($objettype));
$items = array();
foreach ($options['items'] as $object) {
$item->getFromDB($object['id']);
$tmp = $this->getDatasForObject($item, $options, true);
$this->datas[$objettypes][] = $tmp;
}
}
}
}
if ($event == 'validation' && isset($options['validation_status'])) {
$this->datas["##{$objettype}.action##"] = sprintf(__('%1$s - %2$s'), __('Approval'), TicketValidation::getStatus($options['validation_status']));
} else {
$this->datas["##{$objettype}.action##"] = $events[$event];
}
$this->getTags();
foreach ($this->tag_descriptions[parent::TAG_LANGUAGE] as $tag => $values) {
if (!isset($this->datas[$tag])) {
$this->datas[$tag] = $values['label'];
}
}
}
示例15: TicketFollowup
}
$REDIRECT = $CFG_GLPI['root_doc'] . '/front/transfer.action.php';
break;
case "add_followup":
$fup = new TicketFollowup();
foreach ($_POST["item"] as $key => $val) {
if ($val == 1) {
$input = array('tickets_id' => $key, 'is_private' => $_POST['is_private'], 'requesttypes_id' => $_POST['requesttypes_id'], 'content' => $_POST['content']);
if ($fup->can(-1, 'w', $input)) {
$fup->add($input);
}
}
}
break;
case "submit_validation":
$valid = new TicketValidation();
foreach ($_POST["item"] as $key => $val) {
if ($val == 1) {
$input = array('tickets_id' => $key, 'users_id_validate' => $_POST['users_id_validate'], 'comment_submission' => $_POST['comment_submission']);
if ($valid->can(-1, 'w', $input)) {
$valid->add($input);
}
}
}
break;
case "add_task":
$task = new TicketTask();
foreach ($_POST["item"] as $key => $val) {
if ($val == 1) {
$input = array('tickets_id' => $key, 'taskcategories_id' => $_POST['taskcategories_id'], 'content' => $_POST['content']);
if ($task->can(-1, 'w', $input)) {