本文整理汇总了PHP中Ticket::getClosedStatusArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Ticket::getClosedStatusArray方法的具体用法?PHP Ticket::getClosedStatusArray怎么用?PHP Ticket::getClosedStatusArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ticket
的用法示例。
在下文中一共展示了Ticket::getClosedStatusArray方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSqlCriteriasRestriction
/**
* Get SQL code associated with the criteria
*
* @see plugins/reports/inc/PluginReportsArrayCriteria::getSqlCriteriasRestriction()
**/
public function getSqlCriteriasRestriction($link = 'AND')
{
$status = $this->getParameterValue();
switch ($status) {
case "notold":
$list = implode("','", Ticket::getNewStatusArray());
$list .= implode("','", Ticket::getProcessStatusArray());
$list .= "','" . Ticket::WAITING;
break;
case "old":
$list = implode("','", Ticket::getClosedStatusArray());
break;
case "process":
$list = implode("','", Ticket::getProcessStatusArray());
break;
case Ticket::INCOMING:
case Ticket::ASSIGNED:
case Ticket::PLANNED:
case Ticket::WAITING:
case Ticket::SOLVED:
case Ticket::CLOSED:
$list = $status;
break;
case "all":
default:
return '';
}
return $link . " " . $this->getSqlField() . " IN ('" . $list . "') ";
}
示例2: canCreateItem
/**
* @since version 0.85.5
* @see CommonDBRelation::canCreateItem()
**/
function canCreateItem()
{
$ticket = new Ticket();
// Not item linked for closed tickets
if ($ticket->getFromDB($this->fields['tickets_id']) && in_array($ticket->fields['status'], $ticket->getClosedStatusArray())) {
return false;
}
return parent::canCreateItem();
}
示例3: canCreateItem
/**
* @since version 0.85
**/
function canCreateItem()
{
if ($this->canChildItem('canViewItem', 'canView')) {
$ticket = new Ticket();
if ($ticket->getFromDB($this->fields['tickets_id'])) {
// No validation for closed tickets
if (in_array($ticket->fields['status'], $ticket->getClosedStatusArray())) {
return false;
}
if ($ticket->fields['type'] == Ticket::INCIDENT_TYPE) {
return Session::haveRight(self::$rightname, self::CREATEINCIDENT);
}
if ($ticket->fields['type'] == Ticket::DEMAND_TYPE) {
return Session::haveRight(self::$rightname, self::CREATEREQUEST);
}
}
}
}
示例4: showForProjectTask
/**
* Show tickets for a projecttask
*
* @param $projecttask ProjectTask object
**/
static function showForProjectTask(ProjectTask $projecttask)
{
global $DB, $CFG_GLPI;
$ID = $projecttask->getField('id');
if (!$projecttask->can($ID, READ)) {
return false;
}
$canedit = $projecttask->canEdit($ID);
$rand = mt_rand();
$query = "SELECT DISTINCT `glpi_projecttasks_tickets`.`id` AS linkID,\n `glpi_tickets`.*\n FROM `glpi_projecttasks_tickets`\n LEFT JOIN `glpi_tickets`\n ON (`glpi_projecttasks_tickets`.`tickets_id` = `glpi_tickets`.`id`)\n WHERE `glpi_projecttasks_tickets`.`projecttasks_id` = '{$ID}'\n ORDER BY `glpi_tickets`.`name`";
$result = $DB->query($query);
$tickets = array();
$used = array();
if ($numrows = $DB->numrows($result)) {
while ($data = $DB->fetch_assoc($result)) {
$tickets[$data['id']] = $data;
$used[$data['id']] = $data['id'];
}
}
if ($canedit) {
echo "<div class='firstbloc'>";
echo "<form name='projecttaskticket_form{$rand}' id='projecttaskticket_form{$rand}'\n method='post' action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_2'><th colspan='3'>" . __('Add a ticket') . "</th></tr>";
echo "<tr class='tab_bg_2'><td class='right'>";
echo "<input type='hidden' name='projecttasks_id' value='{$ID}'>";
$condition = "`glpi_tickets`.`status`\n NOT IN ('" . implode("', '", array_merge(Ticket::getSolvedStatusArray(), Ticket::getClosedStatusArray())) . "')";
Ticket::dropdown(array('used' => $used, 'entity' => $projecttask->getEntityID(), 'entity_sons' => $projecttask->isRecursive(), 'condition' => $condition, 'displaywith' => array('id')));
echo "</td><td width='20%'>";
echo "<a href='" . Toolbox::getItemTypeFormURL('Ticket') . "?_projecttasks_id={$ID}'>";
_e('Create a ticket from this task');
echo "</a>";
echo "</td><td class='center'>";
echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
echo "</td></tr>";
echo "</table>";
Html::closeForm();
echo "</div>";
}
echo "<div class='spaced'>";
if ($canedit && $numrows) {
Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
$massiveactionparams = array('num_displayed' => $numrows, 'container' => 'mass' . __CLASS__ . $rand);
Html::showMassiveActions($massiveactionparams);
}
echo "<table class='tab_cadre_fixehov'>";
echo "<tr><th colspan='12'>" . Ticket::getTypeName($numrows) . "</th>";
echo "</tr>";
if ($numrows) {
Ticket::commonListHeader(Search::HTML_OUTPUT, 'mass' . __CLASS__ . $rand);
Session::initNavigateListItems('Ticket', sprintf(__('%1$s = %2$s'), ProjectTask::getTypeName(1), $projecttask->fields["name"]));
$i = 0;
foreach ($tickets as $data) {
Session::addToNavigateListItems('Ticket', $data["id"]);
Ticket::showShort($data['id'], array('followups' => false, 'row_num' => $i, 'type_for_massiveaction' => __CLASS__, 'id_for_massiveaction' => $data['linkID']));
$i++;
}
}
echo "</table>";
if ($canedit && $numrows) {
$massiveactionparams['ontop'] = false;
Html::showMassiveActions($massiveactionparams);
Html::closeForm();
}
echo "</div>";
}
示例5: pdfStat
static function pdfStat(PluginPdfSimplePDF $pdf, Ticket $job)
{
$pdf->setColumnsSize(100);
$pdf->displayTitle("<b>" . _n('Date', 'Dates', 2) . "</b>");
$pdf->setColumnsSize(50, 50);
$pdf->displayLine(sprintf(__('%1$s: %2$s'), __('Opening date'), Html::convDateTime($job->fields['date'])));
$pdf->displayLine(sprintf(__('%1$s: %2$s'), __('Due date'), Html::convDateTime($job->fields['due_date'])));
if (in_array($job->fields["status"], $job->getSolvedStatusArray()) || in_array($job->fields["status"], $job->getClosedStatusArray())) {
$pdf->displayLine(sprintf(__('%1$s: %2$s'), __('Solution date'), Html::convDateTime($job->fields['solvedate'])));
}
if (in_array($job->fields["status"], $job->getClosedStatusArray())) {
$pdf->displayLine(sprintf(__('%1$s: %2$s'), __('Closing date'), Html::convDateTime($job->fields['closedate'])));
}
$pdf->setColumnsSize(100);
$pdf->displayTitle("<b>" . _n('Time', 'Times', 2) . "</b>");
$pdf->setColumnsSize(50, 50);
if ($job->fields['takeintoaccount_delay_stat'] > 0) {
$pdf->displayLine(sprintf(__('%1$s: %2$s'), __('Take into account'), Html::clean(Html::timestampToString($job->fields['takeintoaccount_delay_stat'], 0))));
}
if (in_array($job->fields["status"], $job->getSolvedStatusArray()) || in_array($job->fields["status"], $job->getClosedStatusArray())) {
if ($job->fields['solve_delay_stat'] > 0) {
$pdf->displayLine(sprintf(__('%1$s: %2$s'), __('Solution'), Html::clean(Html::timestampToString($job->fields['solve_delay_stat'], 0))));
}
}
if (in_array($job->fields["status"], $job->getClosedStatusArray())) {
if ($job->fields['close_delay_stat'] > 0) {
$pdf->displayLine(sprintf(__('%1$s: %2$s'), __('Closing'), Html::clean(Html::timestampToString($job->fields['close_delay_stat'], 0))));
}
}
if ($job->fields['waiting_duration'] > 0) {
$pdf->displayLine(sprintf(__('%1$s: %2$s'), __('Pending'), Html::clean(Html::timestampToString($job->fields['waiting_duration'], 0))));
}
$pdf->displaySpace();
}
示例6: getCentral
//.........这里部分代码省略.........
// Only manage predefined values on ticket creation
$predefined_fields = array();
if (!$ID) {
if (isset($tt->predefined) && count($tt->predefined)) {
foreach ($tt->predefined as $predeffield => $predefvalue) {
if (isset($default_values[$predeffield])) {
// Is always default value : not set
// Set if already predefined field
// Set if ticket template change
if ($values[$predeffield] == $default_values[$predeffield] || isset($values['_predefined_fields'][$predeffield]) && $values[$predeffield] == $values['_predefined_fields'][$predeffield] || isset($values['_tickettemplates_id']) && $values['_tickettemplates_id'] != $tt->getID()) {
// Load template data
$values[$predeffield] = $predefvalue;
$ticket->fields[$predeffield] = $predefvalue;
$predefined_fields[$predeffield] = $predefvalue;
}
}
}
} else {
// No template load : reset predefined values
if (count($values['_predefined_fields'])) {
foreach ($values['_predefined_fields'] as $predeffield => $predefvalue) {
if ($values[$predeffield] == $predefvalue) {
$values[$predeffield] = $default_values[$predeffield];
}
}
}
}
}
// Put ticket template on $values for actors
$values['_tickettemplate'] = $tt;
$canupdate = Session::haveRight('update_ticket', '1');
$canpriority = Session::haveRight('update_priority', '1');
$canstatus = $canupdate;
if (in_array($ticket->fields['status'], $ticket->getClosedStatusArray())) {
$canupdate = false;
}
$showuserlink = 0;
if (Session::haveRight('user', 'r')) {
$showuserlink = 1;
}
if (!$options['template_preview']) {
$ticket->showTabs($options);
} else {
// Add all values to fields of tickets for template preview
foreach ($values as $key => $val) {
if (!isset($ticket->fields[$key])) {
$ticket->fields[$key] = $val;
}
}
}
// In percent
$colsize1 = '13';
$colsize2 = '29';
$colsize3 = '13';
$colsize4 = '45';
$canupdate_descr = $canupdate || $ticket->fields['status'] == Ticket::INCOMING && $ticket->isUser(CommonITILActor::REQUESTER, Session::getLoginUserID()) && $ticket->numberOfFollowups() == 0 && $ticket->numberOfTasks() == 0;
if (!$options['template_preview']) {
echo "<form method='post' name='form_ticket' enctype='multipart/form-data' action='" . $CFG_GLPI["root_doc"] . "/front/ticket.form.php'>";
}
echo "<div class='spaced' id='tabsbody'>";
echo "<table class='tab_cadre_fixe' id='mainformtable'>";
// Optional line
$ismultientities = Session::isMultiEntitiesMode();
echo "<tr class='headerRow'>";
echo "<th colspan='4'>";
if ($ID) {
示例7: methodListTickets
//.........这里部分代码省略.........
$join .= "INNER JOIN `glpi_ticketsatisfactions`\n ON (`glpi_tickets`.`id` = `glpi_ticketsatisfactions`.`tickets_id` ) ";
switch ($params['satisfaction']) {
case 1:
$where .= " AND `glpi_ticketsatisfactions`.`date_answered` IS NULL";
break;
case 2:
$where .= " AND `glpi_ticketsatisfactions`.`date_answered` IS NOT NULL";
break;
default:
// survey exists (by Inner Join)
}
$params['status'] = Ticket::CLOSED;
}
// Status
if (isset($params['status'])) {
if (!in_array($params['status'], Ticket::getAllowedStatusArray(true))) {
return self::Error($protocol, WEBSERVICES_ERROR_BADPARAMETER, '', 'status');
}
switch ($params['status']) {
case 'all':
// No restriction
break;
case 'notclosed':
$status = Ticket::getAllStatusArray();
unset($status[CLOSED]);
$where .= " AND `glpi_tickets`.`status` IN ('" . implode("','", $status) . "') ";
break;
case 'notold':
$status = Ticket::getAllStatusArray();
unset($status[SOLVED], $status[CLOSED]);
$where .= " AND `glpi_tickets`.`status` IN ('" . implode("','", $status) . "') ";
break;
case 'old':
$status = array_merge(Ticket::getSolvedStatusArray(), Ticket::getClosedStatusArray());
$where .= " AND `glpi_tickets`.`status` IN ('" . implode("','", $status) . "') ";
break;
case 'process':
$status = Ticket::getProcessStatusArray();
$where .= " AND `glpi_tickets`.`status` IN ('" . implode("','", $status) . "') ";
break;
default:
$where .= " AND `glpi_tickets`.`status` = '" . $params['status'] . "' ";
}
}
// Dates
if (isset($params["startdate"])) {
if (preg_match(WEBSERVICES_REGEX_DATETIME, $params["startdate"]) || preg_match(WEBSERVICES_REGEX_DATE, $params["startdate"])) {
$where .= " AND `glpi_tickets`.`date` >= '" . $params['startdate'] . "' ";
} else {
return self::Error($protocol, WEBSERVICES_ERROR_BADPARAMETER, '', 'date');
}
}
if (isset($params["enddate"])) {
if (preg_match(WEBSERVICES_REGEX_DATETIME, $params["enddate"]) || preg_match(WEBSERVICES_REGEX_DATE, $params["enddate"])) {
$where .= " AND `glpi_tickets`.`date` <= '" . $params['enddate'] . "' ";
} else {
return self::Error($protocol, WEBSERVICES_ERROR_BADPARAMETER, '', 'date');
}
}
if (isset($params['itemtype'])) {
if (!empty($params['itemtype']) && !class_exists($params['itemtype'])) {
return self::Error($protocol, WEBSERVICES_ERROR_BADPARAMETER, '', 'itemtype');
}
$where .= " AND `glpi_tickets`.`itemtype`='" . $params['itemtype'] . "'";
}
if (isset($params['item'])) {
示例8: canCreateItem
/**
* Is the current user have right to create the current followup ?
*
* @return boolean
**/
function canCreateItem()
{
$ticket = new Ticket();
if (!$ticket->can($this->getField('tickets_id'), READ) || in_array($ticket->fields['status'], $ticket->getClosedStatusArray())) {
return false;
}
return $ticket->canAddFollowups();
}
示例9: canCreateItem
/**
* Is the current user have right to create the current task ?
*
* @return boolean
**/
function canCreateItem()
{
if (!parent::canReadITILItem()) {
return false;
}
$ticket = new Ticket();
if ($ticket->getFromDB($this->fields['tickets_id']) && !in_array($ticket->fields['status'], $ticket->getClosedStatusArray())) {
return Session::haveRight(self::$rightname, parent::ADDALLITEM) || $ticket->isUser(CommonITILActor::ASSIGN, Session::getLoginUserID()) || isset($_SESSION["glpigroups"]) && $ticket->haveAGroup(CommonITILActor::ASSIGN, $_SESSION['glpigroups']);
}
return false;
}