本文整理汇总了PHP中Ticket::find_by_id方法的典型用法代码示例。如果您正苦于以下问题:PHP Ticket::find_by_id方法的具体用法?PHP Ticket::find_by_id怎么用?PHP Ticket::find_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ticket
的用法示例。
在下文中一共展示了Ticket::find_by_id方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send_ticket_notification
function send_ticket_notification($email, $subject, $text, $ticket_id)
{
$instance =& get_instance();
$instance->load->helper('file');
$instance->load->library('parser');
$data["core_settings"] = Setting::first();
$ticket = Ticket::find_by_id($ticket_id);
$ticket_link = base_url() . 'tickets/view/' . $ticket->id;
$instance->email->from($data["core_settings"]->email, $data["core_settings"]->company);
$instance->email->reply_to($data["core_settings"]->ticket_email);
$instance->email->to($email);
$instance->email->subject($subject);
//Set parse values
$parse_data = array('company' => $data["core_settings"]->company, 'link' => base_url(), 'ticket_link' => $ticket_link, 'ticket_number' => $ticket->reference, 'ticket_created_date' => date($data["core_settings"]->date_format . ' ' . $data["core_settings"]->date_time_format, $ticket->created), 'ticket_status' => $instance->lang->line('application_ticket_status_' . $ticket->status), 'logo' => '<img src="' . base_url() . '' . $data["core_settings"]->logo . '" alt="' . $data["core_settings"]->company . '"/>', 'invoice_logo' => '<img src="' . base_url() . '' . $data["core_settings"]->invoice_logo . '" alt="' . $data["core_settings"]->company . '"/>', 'message' => $text);
$email_invoice = read_file('./application/views/' . $data["core_settings"]->template . '/templates/email_ticket_notification.html');
$message = $instance->parser->parse_string($email_invoice, $parse_data);
$instance->email->message($message);
$instance->email->send();
}
示例2: article
function article($id = FALSE, $condition = FALSE, $article_id = FALSE)
{
$this->view_data['submenu'] = array($this->lang->line('application_back') => 'ctickets', $this->lang->line('application_overview') => 'ctickets/view/' . $id);
switch ($condition) {
case 'add':
$this->content_view = 'tickets/client_views/_note';
if ($_POST) {
$config['upload_path'] = './files/media/';
$config['encrypt_name'] = TRUE;
$config['allowed_types'] = '*';
$this->load->library('upload', $config);
$this->load->helper('notification');
unset($_POST['userfile']);
unset($_POST['file-name']);
unset($_POST['send']);
unset($_POST['_wysihtml5_mode']);
$ticket = Ticket::find_by_id($id);
$ticket->updated = "1";
$ticket->save();
if ($ticket->company_id != $this->client->company->id || $ticket->client_id != $this->client->id) {
redirect('ctickets');
}
send_ticket_notification($ticket->user->email, '[Ticket#' . $ticket->reference . '] - ' . $_POST['subject'], $_POST['message'], $ticket->id);
$_POST['internal'] = "0";
unset($_POST['notify']);
$_POST['subject'] = htmlspecialchars($_POST['subject']);
$_POST['datetime'] = time();
$_POST['ticket_id'] = $id;
$_POST['from'] = $this->client->firstname . " " . $this->client->lastname . ' - ' . $this->client->email;
$_POST['reply_to'] = $this->client->email;
$article = TicketHasArticle::create($_POST);
if (!$this->upload->do_upload()) {
$error = $this->upload->display_errors('', ' ');
$this->session->set_flashdata('message', 'error:' . $error);
} else {
$data = array('upload_data' => $this->upload->data());
$attributes = array('article_id' => $article->id, 'filename' => $data['upload_data']['orig_name'], 'savename' => $data['upload_data']['file_name']);
$attachment = ArticleHasAttachment::create($attributes);
}
if (!$article) {
$this->session->set_flashdata('message', 'error:' . $this->lang->line('messages_save_article_error'));
} else {
$this->session->set_flashdata('message', 'success:' . $this->lang->line('messages_save_article_success'));
}
redirect('ctickets/view/' . $id);
} else {
$this->theme_view = 'modal';
$this->view_data['ticket'] = Ticket::find($id);
$this->view_data['title'] = $this->lang->line('application_add_note');
$this->view_data['form_action'] = 'ctickets/article/' . $id . '/add';
$this->content_view = 'tickets/client_views/_note';
}
break;
default:
redirect('ctickets');
break;
}
}
示例3: closeTicket
/**
* method to close a ticket
*
*/
public function closeTicket()
{
if (isset($_POST['id']) && !empty($_POST["id"])) {
$partTicket = Ticket::find_by_id($_POST["id"]);
$partTicket->status = "Closed";
$theUser = Employee::find_by_id($_SESSION['emp_ident']);
$cemail = !empty($_POST['cemail']) ? explode(",", $_POST['cemail']) : "";
// print_r($partTicket);
array_push($cemail, $partTicket->contact_email, $theUser->emp_email);
$client = Client::find_by_id($partTicket->client_id);
array_push($cemail, $client->email);
$partTicket->datemodified = date("Y-m-d H:i:s");
$msg = "Your Complaint ticket status has been closed<br />";
$subject = "Robert Johnson Holdings(Technical Support) Ticket #'" . $partTicket->id . "' Close";
//print_r($cemail);
//mail("amedora09@gmail.com","Robert Johnson Holdings, Technical Support" , "all good");
if ($partTicket->update()) {
// $this->sendMail("Customer",$subject ,$msg,$cemail);
return true;
} else {
return false;
}
}
}
示例4: view
function view($id = FALSE)
{
$this->view_data['submenu'] = array();
$this->content_view = 'tickets/view';
$this->view_data['ticket'] = Ticket::find_by_id($id);
if ($this->view_data['ticket']->status == "new") {
$this->view_data['ticket']->status = "open";
$this->view_data['ticket']->save();
}
if (isset($this->view_data['ticket']->user->id)) {
$ticket_id = $this->view_data['ticket']->user->id;
} else {
$ticket_id = "0";
}
if ($this->view_data['ticket']->updated == "1" and $ticket_id == $this->user->id) {
$this->view_data['ticket']->updated = "0";
$this->view_data['ticket']->save();
}
$this->view_data['form_action'] = 'tickets/article/' . $id . '/add';
if (!$this->view_data['ticket']) {
redirect('tickets');
}
}
示例5: sendMailCloseTicket
public function sendMailCloseTicket($id)
{
$ticket = Ticket::find_by_id($id);
$ccemails = Ccemail::find_by_ticket($id);
$client = Client::find_by_id($_SESSION['client_ident']);
$to = 'support@robertjohnsonholdings.com';
$subject = 'RE: Ticket Number: #' . str_pad($ticket->id, 8, "0", STR_PAD_LEFT) . " " . $ticket->subject;
$headers = "From: " . $client->name . "<" . $client->email . ">\r\n";
$headers .= "Reply-To: " . $ticket->contact_email . "\r\n";
if ($ccemails) {
$copyaddy = array();
$cc = "";
foreach ($ccemails as $ccemail) {
array_push($copyaddy, $ccemail->email);
}
for ($i = 0; $i < count($copyaddy); $i++) {
if ($i == count($copyaddy) - 1) {
$cc .= $copyaddy[$i];
} else {
$cc .= $copyaddy[$i] . ", ";
}
}
$to .= ", " . $cc;
}
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message = '
<html><body>
<h1>Robert Johnson Holdings Limited</h1>
<h2>Ticket Number #' . str_pad($ticket->id, 8, "0", STR_PAD_LEFT) . '</h2>
<table width="100%" border="0">
<tr>
<th scope="row" width="30%">Client</th>
<td width="70%">' . $client->name . '</td>
</tr>
<tr>
<th scope="row">Contact Person</th>
<td>' . $ticket->contact_name . '</td>
</tr>
<tr>
<th scope="row">Contact Phone Number</th>
<td>' . $ticket->contact_phone . '</td>
</tr>
<tr>
<th scope="row">Contact Email</th>
<td>' . $ticket->contact_email . '</td>
</tr>';
if ($ccemails) {
$message .= '<tr>
<th scope="row">Copied Emails</th>
<td>' . $cc . '</td>
</tr>
<tr>';
}
$message .= '<th scope="row">Department</th>
<td>' . $ticket->department . '</td>
</tr>
<tr>
<th scope="row">Ticket Status</th>
<td>' . $ticket->status . '</td>
</tr>
<tr>
<th scope="row">Priority Level</th>
<td>' . $ticket->priority . '</td>
</tr>
<tr>
<th scope="row">Related Product/Service</th>
<td>' . $ticket->prod_name . ' at ' . $ticket->location . '</td>
</tr>
<tr>
<th scope="row">Subject</th>
<td>' . $ticket->subject . '</td>
</tr>
<tr>
<th scope="row">Issue/Complaint/Suggestion</th>
<td>Ticket has been closed.</td>
</tr>
</table>
</body></html>';
if (mail($to, $subject, $message, $headers)) {
return true;
} else {
return false;
}
}
示例6: bulk
function bulk($action)
{
$this->load->helper('notification');
if ($_POST) {
if (empty($_POST['list'])) {
redirect('tickets');
}
$list = explode(",", $_POST['list']);
switch ($action) {
case 'close':
$attr = array('status' => "closed");
$email_message = $this->lang->line('messages_bulk_ticket_closed');
$success_message = $this->lang->line('messages_bulk_ticket_closed_success');
break;
default:
redirect('tickets');
break;
}
foreach ($list as $value) {
$ticket = Ticket::find_by_id($value);
$ticket->update_attributes($attr);
send_ticket_notification($ticket->user->email, '[Ticket#' . $ticket->reference . '] - ' . $ticket->subject, $email_message, $ticket->id);
if (!$ticket) {
$this->session->set_flashdata('message', 'error:' . $this->lang->line('messages_save_ticket_error'));
} else {
$this->session->set_flashdata('message', 'success:' . $success_message);
}
}
redirect('tickets');
/*
if(isset($ticket->client->email)){ $email = $ticket->client->email; } else {$emailex = explode(' - ', $ticket->from); $email = $emailex[1]; }
if(isset($_POST['notify'])){
send_ticket_notification($email, '[Ticket#'.$ticket->reference.'] - '.$ticket->subject, $_POST['message'], $ticket->id);
}
send_ticket_notification($ticket->user->email, '[Ticket#'.$ticket->reference.'] - '.$ticket->subject, $_POST['message'], $ticket->id);
$_POST['internal'] = "0";
unset($_POST['notify']);
$_POST['subject'] = htmlspecialchars($_POST['subject']);
$_POST['datetime'] = time();
$_POST['from'] = $this->user->firstname." ".$this->user->lastname.' - '.$this->user->email;
$_POST['reply_to'] = $this->user->email;
$_POST['ticket_id'] = $id;
$_POST['to'] = $email;
unset($_POST['client_id']);
$article = TicketHasArticle::create($_POST);
if(!$ticket){$this->session->set_flashdata('message', 'error:'.$this->lang->line('messages_save_ticket_error'));}
else{$this->session->set_flashdata('message', 'success:'.$this->lang->line('messages_ticket_close_success'));}
redirect('tickets');
*/
} else {
$this->view_data['ticket'] = Ticket::find($id);
$this->theme_view = 'modal';
$this->view_data['title'] = $this->lang->line('application_close');
$this->view_data['form_action'] = 'tickets/close';
$this->content_view = 'tickets/_close';
}
}
示例7: createSchedule
public function createSchedule($id = "")
{
if (!empty($_POST['cid']) && !empty($_POST['empid'])) {
$thisclientproduct = Cproduct::find_by_id((int) preg_replace('#[^0-9]#i', '', $_POST['cid']));
$empdata = explode("_", $_POST['empid']);
$thisemployee = Employee::find_by_staff_id($empdata[0]);
//print_r($thisemployee);
$thisSchedule = new Schedule();
$clientTicket = Ticket::find_by_id((int) preg_replace('#[^0-9]#i', '', $id));
$thisclientproduct = Cproduct::find_by_id((int) preg_replace('#[^0-9]#i', '', $clientTicket->prod_id));
if ($_POST['mtype'] != "Activation" && ($_POST['Corrective'] || $_POST['Preventive'])) {
$clientTicket->status = "Admin Reply";
$clientTicket->datemodified = date("Y-m-d H:i:s");
$thisSchedule->status = "In Progress";
} else {
$clientTicket = Activation::find_by_id((int) preg_replace('#[^0-9]#i', '', $id));
if ($clientTicket) {
$thisclientproduct = Cproduct::find_by_id((int) preg_replace('#[^0-9]#i', '', $clientTicket->prod_id));
$clientTicket->status = "In Progress";
$clientTicket->updated_at = date("Y-m-d H:i:s");
}
}
$thisSchedule->status = "In Progress";
$thisSchedule->emp_id = $thisemployee->id;
$thisSchedule->emp_name = $thisemployee->emp_fname . " " . $thisemployee->emp_lname;
$thisSchedule->client_id = $thisclientproduct->client_id;
$thisClient = Client::find_by_id($thisclientproduct->client_id);
$thisSchedule->prod_id = $thisclientproduct->id;
$thisSchedule->ticket_id = $id;
$thisSchedule->prod_name = $thisclientproduct->prod_name;
// exit;
/**
* this is to check if ticket
* is in existence
*/
//print_r($theUser);
global $session;
//$partTicket = ($id!="") ? Ticket::find_by_id($id) : ""; // get the ticket to get details needed for sending mail
$theUser = Employee::find_by_id($_SESSION["emp_ident"]);
// get cse detail to retrieve email
$thisSchedule->s_date = !empty($_POST['taskdate']) ? $_POST['taskdate'] : date("Y-m-d");
$cemail = array();
$cemail = !empty($_POST['cemail']) && isset($_POST['cemail']) ? explode(",", $_POST['cemail']) : array('iarowolo@gmail.com');
array_push($cemail, $thisemployee->emp_email, is_array($clientTicket) ? $clientTicket->contact_email : "", $theUser->emp_email, $thisClient->email);
array_push($cemail, $clientTicket->contact);
array_push($cemail, $thisClient->contact_email);
array_push($cemail, $thisClient->email);
//print_r($cemail);
$thisSchedule->issue = $_POST["tissue"];
$thisSchedule->datecreated = date("Y-m-d H:i:s");
$thisSchedule->maint_type = $_POST['mtype'];
$subject = "Maintenance Alert";
$smsmsg = "Maintenance alert for" . $thisclientproduct->terminal_id . " " . $thisclientproduct->prod_name . "at";
$smsmsg .= $thisclientproduct->install_location . "," . $thisclientproduct->branch;
$smsmsg .= "\r\n issue:" . $_POST["tissue"] . "\r\n";
$msg = "<h3>Maintenance Detail</h3> <hr />";
$msg .= "<p><strong>Terminal ID: </strong>{$thisclientproduct->terminal_id} </p>";
$msg .= "<p><strong>Machine: </strong>{$thisclientproduct->prod_name} </p>";
$msg .= "<p><strong>Client: </strong> {$thisClient->name}</p>";
$msg .= "<p><strong>Location: </strong>{$thisclientproduct->install_location} {$thisclientproduct->branch} {$thisclientproduct->install_city} </p>";
$msg .= "<p><strong>Complaint: </strong>" . (!empty($_POST['tissue']) ? $_POST['tissue'] : $clientTicket->issue) . "</p>";
$msg .= "<br /><br /> <h4>Technician Details</h4> <hr />";
$msg .= "<p><strong>Name: </strong>" . $thisemployee->emp_fname . " " . $thisemployee->emp_lname . "</p>";
$msg .= "<p><strong>Email: </strong>" . $thisemployee->emp_email . "</p>";
$msg .= "<p><strong>Telephone: </strong>" . $thisemployee->emp_phone . "</p>";
$msg .= "<br /><br /><h4>Scheduled Date</h4> <hr />";
$msg .= "<p><strong>{$thisSchedule->s_date}</strong></p><br /><br /><br /><br />";
$newReply = new Ticketreply();
$newReply->sender_id = $_SESSION["emp_ident"];
$newReply->ticket_id = $id;
$newReply->sender_name = $theUser->emp_fname . " " . $theUser->emp_lname;
$newReply->sender_type = "Admin";
$newReply->message = $msg;
$newReply->datecreated = date("Y-m-d H:i:s");
$newReply->datemodified = date("Y-m-d H:i:s");
//$newReply->create();
/**
* the transaction log is created
* to ensure that the product already
* has history and cannot be deleted
*/
$Tlog2 = new Transaction();
$Tlog2->com_id = $thisclientproduct->main_id;
$Tlog2->trans_type = "TASK ASSIGNMENT";
$Tlog2->trans_description = "Corrective Maintenance task assigned to " . $thisemployee->emp_fname . " " . $thisemployee->emp_lname . "";
$Tlog2->datecreated = date("Y-m-d H:i:s");
$Tlog2->datemodified = date("Y-m-d H:i:s");
$Tlog2->user_id = $_SESSION['emp_ident'];
// print_r($msg);
if ($newReply->create()) {
$thisSchedule->create();
$clientTicket->datemodified = date("Y-m-d H:i:s");
$clientTicket->update();
$Tlog2->create();
//$thisemployee->emp_phone
sendSms($thisemployee->emp_phone, $smsmsg);
sendSms($thisClient->contact_phone, $smsmsg);
sendSms($thisClient->phone, $smsmsg);
$this->sendMail($thisSchedule->emp_name, $subject, $msg, $cemail);
return true;
//.........这里部分代码省略.........