本文整理汇总了PHP中Ticket::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Ticket::find方法的具体用法?PHP Ticket::find怎么用?PHP Ticket::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ticket
的用法示例。
在下文中一共展示了Ticket::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
public function create($request)
{
$req = $request->getParameters();
$response = new ViewResponse('assist/ticket');
if (trim($req['bug']) != '') {
if (Session::isActive()) {
$user_id = Session::get()->id;
} else {
if (trim($req['email']) != '') {
$user_id = $req['email'];
} else {
$user_id = 0;
}
}
if (!empty(Ticket::find('all', ['conditions' => ['ip = ? AND timestamp < ' . (Utils::tps() + 60), $_SERVER['REMOTE_ADDR']]]))) {
$r = $this->index($request);
$r->addMessage(ViewMessage::error('Trop d\'envois avec la même IP en une minute, réssayez plus tard.'));
return $r;
}
$ticket = Ticket::create(array('user_id' => $user_id, 'description' => $req['bug'], 'timestamp' => time(), 'ip' => $_SERVER['REMOTE_ADDR']));
StaffNotification::createNotif('ticket', $user_id, null, $ticket->id);
$ticket_id = $ticket->id;
$response->addMessage(ViewMessage::success('Envoyé ! Vous serez notifié de l\'avancement par E-Mail ou Message Privé (Ticket #' . $ticket_id . ')'));
/*$username = (Session::isActive()) ? Session::get()->username : '[Anonyme]';
$notif = new PushoverNotification();
$notif->setMessage('Nouveau ticket de '.$username);
$notif->setReceiver('all');
$notif->setExtraParameter('url', 'http://dreamvids.fr'.WEBROOT.'admin/tickets');
$notif->send();*/
} else {
$response->addMessage(ViewMessage::error('Merci de nous décrire votre problème.'));
}
return $response;
}
示例2: validateAdd
public static function validateAdd($data, $id)
{
if (Ticket::find($id)->replies()->count() == 0 && Ticket::find($id)->user_id == Auth::user()->id) {
return View::make('msg.error')->with('error', 'You cannot double post, please wait for a staff member to reply');
}
$reply = Ticket::find($id)->replies()->order_by('created_at', 'desc')->first();
if ($reply != NULL) {
if ($reply->user_id == Auth::user()->id && !Auth::user()->isStaff()) {
return View::make('msg.error')->with('error', 'You cannot double post, please wait for a staff member to reply');
}
}
$rules = array('message' => 'required|min:30|max:1000');
$messages = array('message_min' => 'Please form your reply to at least 30 characters.', 'message_max' => 'Please shorten your reply to less than 1000 characters.');
$validator = Validator::make($data, $rules, $messages);
if ($validator->fails()) {
$errors = $validator->errors->all();
$error_str = '';
foreach ($errors as $e) {
$error_str .= $e . '<br />';
}
return View::make('msg.error')->with('error', $error_str);
}
$data['user_id'] = Auth::user()->id;
$data['ticket_id'] = $id;
$data['ip'] = $_SERVER['REMOTE_ADDR'];
self::create($data);
$ticket = Ticket::find($id);
$ticket->touch();
return Redirect::to('/support/ticket/' . $id);
}
示例3: array
function reset_user_password($key = null)
{
if (!empty($this->data)) {
$user = $this->Ticket->findUser($this->data['Ticket']['email']);
$hasTicket = $this->Ticket->find('first', array('conditions' => array('Ticket.email' => $user['User']['email'])));
//pr($hasTicket);
//die;
if (!empty($user) && empty($hasTicket)) {
App::import('Helper', 'Time');
$time = new TimeHelper();
$key = Security::hash(String::uuid(), 'sha1', true);
$this->data['Ticket']['key'] = $key;
$this->data['Ticket']['creation_date'] = $time->format('Y-m-d H:i:s', time());
$url = Router::url(array('controller' => 'tickets', 'action' => 'reset_user_password'), true) . '/' . $key;
//pr($url);
//die;
//ko se ticket shrani v bazo se poslje email (email element: lost_password_notification.ctp) useru, ki je ticket odprl
if ($this->Ticket->save($this->data)) {
$this->set('url', $url);
$this->MyEmail->sendResetPasswordEmail($user['User']['email']);
$this->Session->setFlash('notification email has been sent to you with reset data');
}
} elseif (!empty($hasTicket)) {
if ($this->Ticket->checkTicketDateValidity($hasTicket)) {
$this->Session->setFlash('We had already sent you a link to your email address! Go get it, lazy ass!');
} else {
$this->Session->setFlash('Your ticket regarding lost password has been deleted due to expiration! Try submitting again');
}
}
//se prozi kadar user klikne link, ki vsebuje generiran key, v svojem mailu in ga redirecta sem
} elseif (isset($key) && !empty($key)) {
$result = $this->Ticket->find('first', array('conditions' => array('Ticket.key' => $key)));
$this->Ticket->checkTicketDateValidity($result);
if (!empty($result)) {
$user = $this->Ticket->findUser($result['Ticket']['email']);
$this->set('userId', $user['User']['id']);
$this->set('key', $key);
$this->Ticket->delete($result['Ticket']['id']);
//$this->redirect(array('controller' => 'users', 'action' => 'changeUserPassword/uid:'.$user['User']['id']));
}
} else {
$this->Session->setFlash('Please provide your email!');
}
}
示例4: get_open
public function get_open($id)
{
$ticket = Ticket::find($id);
if (empty($ticket)) {
return View::make('msg.error')->with('error', 'This ticket doesn\'t exist.');
}
if (!Auth::user()->isStaff()) {
return View::make('msg.error')->with('error', 'You have no access to this ticket.');
}
$ticket->solved = 0;
$ticket->save();
return Redirect::to('/support/ticket/' . $id);
}
示例5: updateParent
public function updateParent()
{
if ($this->object_type == "ticket") {
$ticket = Ticket::find($this->object_id);
$ticket->status_id = $this->status_id;
$ticket->save();
} else {
if ($this->object_type == "incident") {
$ticket = Incident::find($this->object_id);
$ticket->status_id = $this->status_id;
$ticket->save();
}
}
}
示例6: update
public function update($id, $request)
{
$param = $request->getParameters();
$ticket = Ticket::find($id);
if (isset($param['new']) && $param['new']) {
$level = TicketLevels::create(['label' => $param['label']]);
$ticket->ticket_levels_id = $level->id;
} else {
$ticket->ticket_levels_id = $param['level_id'];
}
$ticket->save();
$r = $this->index($request);
$r->addMessage(ViewMessage::success("Modification effectuée"));
return $r;
}
示例7: deleteTicketAssignation
/**
* Delete all tickets for an itemtype
* @param the itemtype
* @return nothing
*/
public static function deleteTicketAssignation($itemtype)
{
global $DB;
$ticket = new Ticket();
foreach ($ticket->find("`itemtype`='{$itemtype}'") as $data) {
$data['itemtype'] = '';
$data['items_id'] = 0;
$ticket->update($data);
}
}
示例8: getAssignedTickets
public function getAssignedTickets()
{
$tickets = Ticket::find('all', ['ticket_levels_id' => $this->getAssignedLevelsIds()]);
if (is_null($tickets)) {
return [];
}
return is_array($tickets) ? $tickets : [$tickets];
}
示例9: testPushReceiverWithoutIdObjectWithoutId
/**
* Test pushing object without id
*
* @return null
*/
public function testPushReceiverWithoutIdObjectWithoutId()
{
$user = TORM\Factory::build("user");
$ticket = TORM\Factory::build("ticket");
$user->push($ticket);
$this->assertTrue($user->save());
$ticket = Ticket::find($ticket->id);
$this->assertEquals($user->id, $ticket->user->id);
$this->assertTrue($user->destroy());
$this->assertTrue($ticket->destroy());
}
示例10: post_replyticket
public function post_replyticket()
{
$postStr = Input::get('data');
parse_str($postStr, $post);
$validator = Validator::make(array('Reply' => $post['inputReplyTicket'], 'tid' => $post['tid']), array('Reply' => 'required', 'tid' => 'required|integer'), array('Reply.required' => 'Please enter a reply.', 'tid.required' => 'The system cannot find a ticket to reply to.', 'tid.integer' => 'The system has been sent an invalid ticket id to reply to.'));
//Verify some smart ass didn't try to change the hidden input field (tid) or reply to a closed ticket.
$count = Ticket::where('id', '=', $post['tid'])->where('vid', '=', Auth::user()->get()->cid)->where('status', '=', '1')->count();
if ($count == 0) {
//Damn them.
echo '<div class="alert alert-error"><li>Seriously? Nice try.</li></div>';
}
if ($validator->fails()) {
$messages = $validator->messages();
$errorStr = '';
foreach ($messages->all('<li>:message</li>') as $message) {
$errorStr .= '<div class="alert alert-error">' . $message . '</div>';
}
echo $errorStr;
} else {
$reply = new Reply();
$reply->tid = $post['tid'];
$reply->author = Auth::user()->get()->cid;
$reply->content = $post['inputReplyTicket'];
//Save our ticket update
$reply->save();
//Find or reply id
$reply = Reply::orderBy('updated_at', 'DESC')->first();
//Finally we need to update the updated_at field of our master ticket table
$ticket = Ticket::find($post['tid']);
$ticket->updated_at = $reply->updated_at;
//Save our ticket update
$ticket->save();
//Check to see if there is an assigned auditor. If so send them an email notification
if (!empty($ticket->assigned)) {
$data = array();
$auditor = ConsoleUser::find($ticket->assigned);
if (!empty($auditor)) {
$data['auditor'] = $auditor;
$data['subject'] = "VATSIM VA New Ticket Update";
if (!empty($auditor->email)) {
$body = "Hello " . ConsoleUser::getName($ticket->assigned) . ",<br /><br />There has been an update to your assigned ticket " . $ticket->subject . " by VA Administrator " . User::getFullName($ticket->vid) . ". <br /><br />" . $reply->content . "<br /><br /><br /> <strong>Do not reply to this email. If you wish to reply to this ticket, please do so through the auditor console.</strong>";
Mail::send('email.default', array("content" => $body), function ($message) use($data) {
$message->to($data['auditor']->email, $data['auditor']->name)->subject($data['subject']);
});
}
}
}
//Return 1 to inform the client this was successful.
echo '1';
}
}
示例11: updateTicketFromForm
static function updateTicketFromForm($idform, $idticket)
{
global $DB;
$datas = array();
$templates_id = PluginFormcreatorForm::getTemplateTicketFromForm($idform);
$ttp = new TicketTemplatePredefinedField();
$predefined_fields = $ttp->getPredefinedFields($templates_id, true);
$Ticket = new Ticket();
$listaObjetos = $Ticket->find("id = '{$idticket}'");
//$listaobjetos es un array que contiene, por cada ticket que comple la condición del find, un array con los campos del ticket
$clave = array_keys($listaObjetos);
if (isset($clave[0])) {
if (isset($listaObjetos[$clave[0]])) {
$datas = $listaObjetos[$clave[0]];
unset($datas['urgency']);
//
unset($datas['priority']);
//
unset($datas['type']);
//
unset($datas['itilcategories_id']);
//
unset($datas['slas_id']);
//
$datas = array_merge($datas, $predefined_fields);
$Ticket->update($datas);
}
}
}
示例12: postDelete
public function postDelete($ticket)
{
$rules = array('id' => 'required|integer');
$validator = Validator::make(Input::all(), $rules);
if ($validator->passes()) {
$id = $ticket->id;
$ticket->delete();
$ticket = Ticket::find($id);
if (empty($ticket)) {
return Redirect::to('admin/tickets')->with('success', Lang::get('admin/blogs/messages.delete.success'));
}
}
return Redirect::to('admin/tickets')->with('error', Lang::get('admin/blogs/messages.delete.error'));
}
示例13: 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';
}
}
示例14: postDelete
/**
* Remove the specified resource from storage.
*
* @param $post
* @return Response
*/
public function postDelete($ticket)
{
// Declare the rules for the form validation
$rules = array('id' => 'required|integer');
// Validate the inputs
$validator = Validator::make(Input::all(), $rules);
// Check if the form validates with success
if ($validator->passes()) {
$id = $ticket->id;
$ticket->delete();
// Was the blog post deleted?
$ticket = Ticket::find($id);
if (empty($ticket)) {
// Redirect to the blog posts management page
return Redirect::to('admin/tickets')->with('success', Lang::get('admin/tickets/messages.delete.success'));
}
}
// There was a problem deleting the blog post
return Redirect::to('admin/tickets')->with('error', Lang::get('admin/tickets/messages.delete.error'));
}
示例15: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
$this->ticket->find($id)->delete();
return Redirect::route('tickets.index');
}