本文整理汇总了PHP中Ticket::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Ticket::getName方法的具体用法?PHP Ticket::getName怎么用?PHP Ticket::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ticket
的用法示例。
在下文中一共展示了Ticket::getName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view
/**
* View the ticket
*
*/
function view()
{
if ($this->active_ticket->isNew()) {
$this->httpError(HTTP_ERR_NOT_FOUND);
}
// if
if (!$this->active_ticket->canView($this->logged_user)) {
$this->httpError(HTTP_ERR_FORBIDDEN);
}
// if
ProjectObjectViews::log($this->active_ticket, $this->logged_user);
$this->smarty->assign(array('page_back_url' => assemble_url('mobile_access_view_tickets', array('project_id' => $this->active_project->getId()))));
$this->addBreadcrumb(str_excerpt(clean($this->active_ticket->getName()), 10), mobile_access_module_get_view_url($this->active_ticket));
$this->addBreadcrumb(lang('View'));
}
示例2: showForTicket
/**
* Show projecttasks for a ticket
*
* @param $ticket Ticket object
**/
static function showForTicket(Ticket $ticket)
{
global $DB, $CFG_GLPI;
$ID = $ticket->getField('id');
if (!$ticket->can($ID, READ)) {
return false;
}
$canedit = $ticket->canEdit($ID);
$rand = mt_rand();
$query = "SELECT DISTINCT `glpi_projecttasks_tickets`.`id` AS linkID,\n `glpi_projecttasks`.*\n FROM `glpi_projecttasks`\n LEFT JOIN `glpi_projecttasks_tickets`\n ON (`glpi_projecttasks_tickets`.`projecttasks_id` = `glpi_projecttasks`.`id`)\n WHERE `glpi_projecttasks_tickets`.`tickets_id` = '{$ID}'\n ORDER BY `glpi_projecttasks`.`name`";
$result = $DB->query($query);
$pjtasks = array();
$used = array();
if ($numrows = $DB->numrows($result)) {
while ($data = $DB->fetch_assoc($result)) {
$pjtasks[$data['id']] = $data;
$used[$data['id']] = $data['id'];
}
}
// if ($canedit) {
// echo "<div class='firstbloc'>";
// echo "<form name='projecttaskticket_form$rand' id='projecttaskticket_form$rand'
// method='post' action='".Toolbox::getItemTypeFormURL(__CLASS__)."'>";
//
// echo "<table class='tab_cadre_fixe'>";
// echo "<tr class='tab_bg_2'><th colspan='3'>".__('Add a project task')."</th></tr>";
//
// echo "<tr class='tab_bg_2'><td class='right'>";
// echo "<input type='hidden' name='tickets_id' value='$ID'>";
// $condition = "`glpi_projecttasks`.`projectstates_id` <> 3";
// ProjectTask::dropdown(array('used' => $used,
// 'entity' => $ticket->getEntityID(),
// 'entity_sons' => $ticket->isRecursive(),
// 'condition' => $condition,
// 'displaywith' => array('id')));
// echo "</td><td width='20%'>";
// // echo "<a href='".Toolbox::getItemTypeFormURL('ProjectTask')."?tickets_id=$ID'>";
// // _e('Create a project task from this ticket');
// // 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 ($numrows) {
$columns = array('projectname' => Project::getTypeName(Session::getPluralNumber()), 'name' => ProjectTask::getTypeName(Session::getPluralNumber()), 'tname' => __('Type'), 'sname' => __('Status'), 'percent_done' => __('Percent done'), 'plan_start_date' => __('Planned start date'), 'plan_end_date' => __('Planned end date'), 'planned_duration' => __('Planned duration'), '_effect_duration' => __('Effective duration'), 'fname' => __('Father'));
if (isset($_GET["order"]) && $_GET["order"] == "DESC") {
$order = "DESC";
} else {
$order = "ASC";
}
if (!isset($_GET["sort"]) || empty($_GET["sort"])) {
$_GET["sort"] = "plan_start_date";
}
if (isset($_GET["sort"]) && !empty($_GET["sort"]) && isset($columns[$_GET["sort"]])) {
$sort = "`" . $_GET["sort"] . "`";
} else {
$sort = "`plan_start_date` {$order}, `name`";
}
$query = "SELECT `glpi_projecttasks`.*,\n `glpi_projecttasktypes`.`name` AS tname,\n `glpi_projectstates`.`name` AS sname,\n `glpi_projectstates`.`color`,\n `father`.`name` AS fname,\n `father`.`id` AS fID,\n `glpi_projects`.`name` AS projectname,\n `glpi_projects`.`content` AS projectcontent\n FROM `glpi_projecttasks`\n LEFT JOIN `glpi_projecttasktypes`\n ON (`glpi_projecttasktypes`.`id` = `glpi_projecttasks`.`projecttasktypes_id`)\n LEFT JOIN `glpi_projectstates`\n ON (`glpi_projectstates`.`id` = `glpi_projecttasks`.`projectstates_id`)\n LEFT JOIN `glpi_projecttasks` as father\n ON (`father`.`id` = `glpi_projecttasks`.`projecttasks_id`)\n LEFT JOIN `glpi_projecttasks_tickets`\n ON (`glpi_projecttasks_tickets`.`projecttasks_id` = `glpi_projecttasks`.`id`)\n LEFT JOIN `glpi_projects`\n ON (`glpi_projecttasks`.`projects_id` = `glpi_projects`.`id`)\n WHERE `glpi_projecttasks_tickets`.`tickets_id` = '{$ID}'\n ORDER BY {$sort} {$order}";
Session::initNavigateListItems('ProjectTask', sprintf(__('%1$s = %2$s'), $ticket::getTypeName(1), $ticket->getName()));
if ($result = $DB->query($query)) {
if ($DB->numrows($result)) {
echo "<table class='tab_cadre_fixehov'>";
echo "<tr><th colspan='10'>" . ProjectTask::getTypeName($numrows) . "</th>";
echo "</tr>";
$sort_img = "<img src=\"" . $CFG_GLPI["root_doc"] . "/pics/" . ($order == "DESC" ? "puce-down.png" : "puce-up.png") . "\" alt='' title=''>";
$header = '<tr>';
foreach ($columns as $key => $val) {
// Non order column
if ($key[0] == '_') {
$header .= "<th>{$val}</th>";
} else {
$header .= "<th>" . ($sort == "`{$key}`" ? $sort_img : "") . "<a href='javascript:reloadTab(\"sort={$key}&order=" . ($order == "ASC" ? "DESC" : "ASC") . "&start=0\");'>{$val}</a></th>";
}
}
$header .= "</tr>\n";
echo $header;
while ($data = $DB->fetch_assoc($result)) {
Session::addToNavigateListItems('ProjectTask', $data['id']);
$rand = mt_rand();
echo "<tr class='tab_bg_2'>";
echo "<td>";
$link = "<a id='Project" . $data["projects_id"] . $rand . "' href='project.form.php?id=" . $data['projects_id'] . "'>" . $data['projectname'] . (empty($data['projectname']) ? "(" . $data['projects_id'] . ")" : "") . "</a>";
echo sprintf(__('%1$s %2$s'), $link, Html::showToolTip($data['projectcontent'], array('display' => false, 'applyto' => "Project" . $data["projects_id"] . $rand)));
echo "</td>";
echo "<td>";
$link = "<a id='ProjectTask" . $data["id"] . $rand . "' href='projecttask.form.php?id=" . $data['id'] . "'>" . $data['name'] . (empty($data['name']) ? "(" . $data['id'] . ")" : "") . "</a>";
echo sprintf(__('%1$s %2$s'), $link, Html::showToolTip($data['content'], array('display' => false, 'applyto' => "ProjectTask" . $data["id"] . $rand)));
echo "</td>";
echo "<td>" . $data['tname'] . "</td>";
//.........这里部分代码省略.........
示例3: 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)) {
//.........这里部分代码省略.........
示例4: getHomeTabContent
//.........这里部分代码省略.........
<th align="left">Type</th>
<th align="left">Name</th>
<th align="left">Priority</th>
<th align="left">' . ($tickets_due_flag == 'due' ? 'Due on / Reminder' : 'Due on') . '</th>
</tr>';
$tickets_due_table_end = '
</table>';
$tickets_due_content = '';
if ($tickets_due_info && is_array($tickets_due_info)) {
foreach ($tickets_due_info as $entry) {
$type = $entry['type'];
$obj = new $type($entry['id']);
$due_date_val = $obj->getDueOn();
if (!empty($due_date_val)) {
$due_date = date('F d, Y', strtotime($obj->getDueOn()));
} else {
$due_date = '--';
}
if (!empty($entry['reminder']) && $entry['reminder'] != '0000-00-00') {
$reminder_date = date('F d, Y', strtotime($entry['reminder']));
} else {
$reminder_date = '--';
}
if ($tickets_due_flag == 'due') {
$date_string = $due_date . ' / ' . $reminder_date;
} else {
$date_string = $due_date;
}
$tickets_due_content .= '
<tr>
<td>' . $type . '</td>
<td>
<a target="_blank" href="' . $obj->getViewUrl() . '">
<span class="homepageobject">' . strip_tags($obj->getName()) . '</span>
</a>
</td>
<td>' . $obj->getFormattedPriority() . '</td>
<td> ' . $date_string . '</td>
</tr>';
unset($obj);
}
} else {
$tickets_due_content .= '
<tr>
<td colspan="4">No Records to Display</td>
</tr>';
}
$fyi_comments_unvisited = 0;
$content = '';
if ($info && is_array($info)) {
if ($layout_type == 'summary') {
foreach ($info as $ticket_id => $comments) {
//BOF:mod 20111019 #448
if (!empty($comments[0])) {
//EOF:mod 20111019 #448
$temp_obj = new Comment($comments[0]);
$parenttype = $temp_obj->getParentType();
//BOF:mod 20111019 #448
} else {
$temp_obj = new ProjectObject($ticket_id);
$parenttype = $temp_obj->getType();
}
//EOF:mod 20111019 #448
$parentobj = new $parenttype($ticket_id);
$comment_links = '';
//$comment_info = '';
示例5: showForTicket
/**
* Print the ticket costs
*
* @param $ticket Ticket object
* @param $withtemplate boolean Template or basic item (default '')
*
* @return Nothing (call to classes members)
**/
static function showForTicket(Ticket $ticket, $withtemplate = '')
{
global $DB, $CFG_GLPI;
$ID = $ticket->fields['id'];
if (!$ticket->getFromDB($ID) || !$ticket->can($ID, "r") || !Session::haveRight('ticketcost', 'r')) {
return false;
}
$canedit = Session::haveRight('ticketcost', 'w');
echo "<div class='center'>";
$query = "SELECT *\n FROM `glpi_ticketcosts`\n WHERE `tickets_id` = '{$ID}'\n ORDER BY `begin_date`";
$rand = mt_rand();
if ($canedit) {
echo "<div id='viewcost" . $ID . "_{$rand}'></div>\n";
echo "<script type='text/javascript' >\n";
echo "function viewAddCost" . $ID . "_{$rand}() {\n";
$params = array('type' => __CLASS__, 'parenttype' => 'Ticket', 'tickets_id' => $ID, 'id' => -1);
Ajax::updateItemJsCode("viewcost" . $ID . "_{$rand}", $CFG_GLPI["root_doc"] . "/ajax/viewsubitem.php", $params);
echo "};";
echo "</script>\n";
echo "<div class='center firstbloc'>" . "<a class='vsubmit' href='javascript:viewAddCost" . $ID . "_{$rand}();'>";
echo __('Add a new cost') . "</a></div>\n";
}
if ($result = $DB->query($query)) {
echo "<table class='tab_cadre_fixehov'>";
echo "<tr><th colspan='7'>" . self::getTypeName($DB->numrows($result)) . "</th>";
echo "<th>" . __('Ticket duration') . "</th>";
echo "<th>" . CommonITILObject::getActionTime($ticket->fields['actiontime']) . "</th>";
echo "</tr>";
if ($DB->numrows($result)) {
echo "<tr><th>" . __('Name') . "</th>";
echo "<th>" . __('Begin date') . "</th>";
echo "<th>" . __('End date') . "</th>";
echo "<th>" . __('Budget') . "</th>";
echo "<th>" . __('Duration') . "</th>";
echo "<th>" . __('Time cost') . "</th>";
echo "<th>" . __('Fixed cost') . "</th>";
echo "<th>" . __('Material cost') . "</th>";
echo "<th>" . __('Total cost') . "</th>";
echo "</tr>";
Session::initNavigateListItems(__CLASS__, sprintf(__('%1$s = %2$s'), Ticket::getTypeName(1), $ticket->getName()));
$total = 0;
$total_time = 0;
$total_costtime = 0;
$total_fixed = 0;
$total_material = 0;
while ($data = $DB->fetch_assoc($result)) {
echo "<tr class='tab_bg_2' " . ($canedit ? "style='cursor:pointer' onClick=\"viewEditCost" . $data['tickets_id'] . "_" . $data['id'] . "_{$rand}();\"" : '') . ">";
$name = empty($data['name']) ? sprintf(__('%1$s (%2$s)'), $data['name'], $data['id']) : $data['name'];
echo "<td>";
printf(__('%1$s %2$s'), $name, Html::showToolTip($data['comment'], array('display' => false)));
if ($canedit) {
echo "\n<script type='text/javascript' >\n";
echo "function viewEditCost" . $data['tickets_id'] . "_" . $data["id"] . "_{$rand}() {\n";
$params = array('type' => __CLASS__, 'parenttype' => 'Ticket', 'tickets_id' => $data["tickets_id"], 'id' => $data["id"]);
Ajax::updateItemJsCode("viewcost" . $ID . "_{$rand}", $CFG_GLPI["root_doc"] . "/ajax/viewsubitem.php", $params);
echo "};";
echo "</script>\n";
}
echo "</td>";
echo "<td>" . Html::convDate($data['begin_date']) . "</td>";
echo "<td>" . Html::convDate($data['end_date']) . "</td>";
echo "<td>" . Dropdown::getDropdownName('glpi_budgets', $data['budgets_id']) . "</td>";
echo "<td>" . CommonITILObject::getActionTime($data['actiontime']) . "</td>";
$total_time += $data['actiontime'];
echo "<td class='numeric'>" . Html::formatNumber($data['cost_time']) . "</td>";
$total_costtime += $data['actiontime'] * $data['cost_time'] / HOUR_TIMESTAMP;
echo "<td class='numeric'>" . Html::formatNumber($data['cost_fixed']) . "</td>";
$total_fixed += $data['cost_fixed'];
echo "<td class='numeric'>" . Html::formatNumber($data['cost_material']) . "</td>";
$total_material += $data['cost_material'];
$cost = self::computeTotalCost($data['actiontime'], $data['cost_time'], $data['cost_fixed'], $data['cost_material']);
echo "<td class='numeric'>" . Html::formatNumber($cost) . "</td>";
$total += $cost;
echo "</tr>";
Session::addToNavigateListItems(__CLASS__, $data['id']);
}
echo "<tr class='b'><td colspan='4' class='right'>" . __('Total') . '</td>';
echo "<td>" . CommonITILObject::getActionTime($total_time) . "</td>";
echo "<td class='numeric'>" . Html::formatNumber($total_costtime) . "</td>";
echo "<td class='numeric'>" . Html::formatNumber($total_fixed) . '</td>';
echo "<td class='numeric'>" . Html::formatNumber($total_material) . '</td>';
echo "<td class='numeric'>" . Html::formatNumber($total) . '</td></tr>';
} else {
echo "<tr><th colspan='9'>" . __('No item found') . "</th></tr>";
}
echo "</table>";
}
echo "</div><br>";
}
示例6: create
//.........这里部分代码省略.........
$sql = 'INSERT INTO ' . TICKET_TABLE . ' SET created=NOW() ' . ',ticketID=' . db_input($extId) . ',dept_id=' . db_input($deptId) . ',priority_id=' . db_input($priorityId) . ',email=' . db_input($var['email']) . ',name=' . db_input(Format::striptags($var['name'])) . ',subject=' . db_input(Format::striptags($var['subject'])) . ',phone=' . db_input($var['phone']) . ',ip_address=' . db_input($ipaddress) . ',source=' . db_input($source);
//echo $sql;
$ticket = null;
//return $ticket;
if (db_query($sql) && ($id = db_insert_id())) {
if (!$cfg->useRandomIds()) {
//Sequential ticketIDs support really..really suck arse.
$extId = $id;
//To make things really easy we are going to use autoincrement ticket_id.
db_query('UPDATE ' . TICKET_TABLE . ' SET ticketID=' . db_input($extId) . ' WHERE ticket_id=' . $id);
//TODO: RETHING what happens if this fails?? [At the moment on failure random ID is used...making stuff usable]
}
//Load newly created ticket.
$ticket = new Ticket($id);
//post the message.
$msgid = $ticket->postMessage($var['message'], $var['header'], $source, true);
//TODO: recover from postMessage error??
//Upload attachments...web based.
if ($_FILES['attachment']['name'] && $cfg->allowOnlineAttachments() && $msgid) {
if (!$cfg->allowAttachmentsOnlogin() || $cfg->allowAttachmentsOnlogin() && ($thisclient && $thisclient->isValid())) {
$ticket->uploadAttachment($_FILES['attachment'], $msgid, 'M');
//TODO: recover from upload issues?
}
}
$dept = $ticket->getDept();
//SEND OUT NEW TICKET AUTORESP && ALERTS.
//New Ticket AutoResponse..
if ($autorespond && $cfg->autoRespONNewTicket() && $dept->autoRespONNewTicket()) {
$sql = 'SELECT ticket_autoresp_subj,ticket_autoresp_body FROM ' . EMAIL_TEMPLATE_TABLE . ' WHERE cfg_id=' . db_input($cfg->getId()) . ' AND tpl_id=' . db_input($cfg->getDefaultTemplateId());
$resp = db_query($sql);
if ($resp && (list($subj, $body) = db_fetch_row($resp))) {
$subj = str_replace("%ticket", $ticket->getExtId(), $subj);
$body = str_replace("%ticket", $ticket->getExtId(), $body);
$body = str_replace("%name", $ticket->getName(), $body);
$body = str_replace("%email", $ticket->getEmail(), $body);
$body = str_replace("%url", $cfg->getBaseUrl(), $body);
$body = str_replace("%signature", $dept ? $dept->getSignature() : '', $body);
$email = $from = $fromName = null;
if (!$dept->noreplyAutoResp() && ($email = $dept->getEmail())) {
$from = $email->getEmail();
$fromName = $email->getName();
//Reply separator tag.
if ($cfg->stripQuotedReply() && ($tag = $cfg->getReplySeparator())) {
$body = "\n{$tag}\n\n" . $body;
}
} else {
$from = $cfg->getNoReplyEmail();
}
Misc::sendmail($ticket->getEmail(), $subj, $body, $from, $fromName);
}
}
//If enabled...send alert to staff (New Ticket Alert)
if ($alertstaff && $cfg->alertONNewTicket() && is_object($ticket)) {
$sql = 'SELECT ticket_alert_subj,ticket_alert_body FROM ' . EMAIL_TEMPLATE_TABLE . ' WHERE cfg_id=' . db_input($cfg->getId()) . ' AND tpl_id=' . db_input($cfg->getDefaultTemplateId());
$resp = db_query($sql);
if ($resp && (list($subj, $body) = db_fetch_row($resp))) {
$body = str_replace("%ticket", $ticket->getExtId(), $body);
$body = str_replace("%name", $ticket->getName(), $body);
$body = str_replace("%email", $ticket->getEmail(), $body);
$body = str_replace("%subject", $ticket->getSubject(), $body);
$body = str_replace("%dept", $dept ? $dept->getName() : '', $body);
$body = str_replace("%message", $var['message'], $body);
$body = str_replace("%url", $cfg->getBaseUrl(), $body);
$sentlist = array();
//Admin Alert.
if ($cfg->alertAdminONNewTicket()) {
示例7: generateSubject
public static function generateSubject(Ticket $ticket)
{
return 'Re: [F1LAB-HLPDSK-' . $ticket->getId() . '] ' . $ticket->getName();
}
示例8: edit
/**
* Update existing ticket
*
* @param void
* @return null
*/
function edit()
{
$mode = $_GET['mode'];
if (!empty($mode) and $mode == 'reminder_only_update_mode') {
$this->register_reminder_info($this->active_ticket->getId(), array('date' => dateval($_POST['reminder']), 'period' => $_POST['recurring_period'], 'type' => $_POST['recurring_period_type']));
$this->redirectToUrl($this->active_ticket->getViewUrl());
} else {
$this->wireframe->print_button = false;
if ($this->request->isApiCall() && !$this->request->isSubmitted()) {
$this->httpError(HTTP_ERR_BAD_REQUEST);
}
// ifs
if ($this->active_ticket->isNew()) {
$this->httpError(HTTP_ERR_NOT_FOUND);
}
// if
if (!$this->active_ticket->canEdit($this->logged_user)) {
$this->httpError(HTTP_ERR_FORBIDDEN);
}
// if
$ticket_data = $this->request->post('ticket');
if (!is_array($ticket_data)) {
$ticket_data = array('name' => $this->active_ticket->getName(), 'body' => $this->active_ticket->getBody(), 'visibility' => $this->active_ticket->getVisibility(), 'parent_id' => $this->active_ticket->getParentId(), 'milestone_id' => $this->active_ticket->getMilestoneId(), 'priority' => $this->active_ticket->getPriority(), 'assignees' => Assignments::findAssignmentDataByObject($this->active_ticket), 'tags' => $this->active_ticket->getTags(), 'due_on' => $this->active_ticket->getDueOn());
}
// if
//BOF:mod 20121116
$options = array();
$options[] = array('url' => 'javascript:convert_object_to_milestone(\'' . $this->active_ticket->getProjectId() . '\', \'' . $this->active_ticket->getId() . '\', \'' . $this->active_ticket->getType() . '\');', 'text' => 'Milestone');
$options[] = array('url' => 'javascript:convert_object_to_page(\'' . $this->active_ticket->getProjectId() . '\', \'' . $this->active_ticket->getId() . '\', \'' . $this->active_ticket->getType() . '\');', 'text' => 'Page');
$this->wireframe->addPageAction(lang('Convert To'), 'javascript://', $options);
//EOF:mod 20121116
$this->smarty->assign('ticket_data', $ticket_data);
$this->smarty->assign('reminder', $this->get_reminder_info($this->active_ticket->getId()));
//BOF:mod 13052011
$this->smarty->assign('ticket_id', $this->active_ticket->getId());
//EOF:mod 13052011
if ($this->request->isSubmitted()) {
if (!isset($ticket_data['assignees'])) {
$ticket_data['assignees'] = array(array(), 0);
}
// if
db_begin_work();
$this->active_ticket->setAttributes($ticket_data);
$save = $this->active_ticket->save();
if ($save && !is_error($save)) {
db_commit();
//BOF: mod
$this->active_ticket->register_departments(!empty($ticket_data['departments']) ? $ticket_data['departments'] : array());
$this->register_reminder_info($this->active_ticket->getId(), array('date' => dateval($ticket_data['reminder']), 'period' => $ticket_data['recurring_period'], 'type' => $ticket_data['recurring_period_type']));
//EOF: mod
$assignees_flag_data = $this->request->post('assignee');
$this->active_ticket->register_assignees_flag($assignees_flag_data);
//BOF:mod 13052011
//if ($ticket_data['flag_fyi'] || $ticket_data['flag_actionrequest']){
// $this->register_flag_fyi_actionrequest($ticket_data['flag_fyi'], $ticket_data['flag_actionrequest']);
//}
//EOF:mod 13052011
if ($ticket_data['new_team_id'] != $this->active_project->getId()) {
$link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
mysql_select_db(DB_NAME);
$query = "select max(integer_field_1) as count from healingcrystals_project_objects where project_id='" . $ticket_data['new_team_id'] . "' and type='Ticket'";
$result = mysql_query($query, $link);
$cur_ticket_id = '1';
if (mysql_num_rows($result)) {
$info = mysql_fetch_assoc($result);
if ($info['count']) {
$cur_ticket_id = (int) $info['count'] + 1;
}
}
$query = "update healingcrystals_project_objects set project_id='" . $ticket_data['new_team_id'] . "', milestone_id=null, integer_field_1='" . $cur_ticket_id . "', updated_on=now(), updated_by_id='" . $this->logged_user->getId() . "' where id='" . $this->active_ticket->getId() . "' and project_id='" . $this->active_project->getId() . "'";
mysql_query($query);
$query = "update healingcrystals_project_objects set project_id='" . $ticket_data['new_team_id'] . "', milestone_id=null, updated_on=now(), updated_by_id='" . $this->logged_user->getId() . "' where parent_id='" . $this->active_ticket->getId() . "' and project_id='" . $this->active_project->getId() . "'";
mysql_query($query);
mysql_close($link);
$this->redirectToUrl(assemble_url('project_ticket', array('project_id' => $ticket_data['new_team_id'], 'ticket_id' => $cur_ticket_id)));
}
if ($this->request->getFormat() == FORMAT_HTML) {
flash_success('Ticket #:ticket_id has been updated', array('ticket_id' => $this->active_ticket->getTicketId()));
$this->redirectToUrl($this->active_ticket->getViewUrl());
} else {
$this->serveData($this->active_ticket, 'ticket');
}
// if
} else {
db_rollback();
if ($this->request->getFormat() == FORMAT_HTML) {
$this->smarty->assign('errors', $save);
} else {
$this->serveData($save);
}
// if
}
// if
}
//.........这里部分代码省略.........