本文整理汇总了PHP中Ticket::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Ticket::save方法的具体用法?PHP Ticket::save怎么用?PHP Ticket::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ticket
的用法示例。
在下文中一共展示了Ticket::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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!');
}
}
示例2: store
/**
* Store a newly created resource in storage.
*
* @param TicketFormRequest $request
* @return \Illuminate\Http\Response
*/
public function store(TicketFormRequest $request)
{
// return $request->all();
$slug = uniqid();
$ticket = new Ticket(array('title' => $request->get('title'), 'content' => $request->get('content'), 'slug' => $slug));
$ticket->save();
$data = array('ticket' => $slug);
Mail::send('emails.ticket', $data, function ($message) {
$message->from('h.youssef@holidaypirates.com', 'Ticket System');
$message->to('hossam.bio@gmail.com')->subject('There is a new ticket!');
});
return redirect('/contact')->with('status', 'Your ticket has been created! Inserts unique id is: ' . $slug);
}
示例3: set
function set($info = null)
{
$this->garbage();
if ($info) {
$ticketObj = new Ticket();
$data['Ticket']['hash'] = md5(time());
$data['Ticket']['data'] = $info;
if ($ticketObj->save($data)) {
return $data['Ticket']['hash'];
}
}
return false;
}
示例4: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Ticket();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Ticket'])) {
$model->attributes = $_POST['Ticket'];
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->ticket_id));
}
}
$this->redirect(array('view', 'id' => 1));
$this->render('create', array('model' => $model));
}
示例5: actionCreate
public function actionCreate()
{
$ticket = new Ticket();
$this->pageName = Yii::t('SupportModule.default', 'MODULE_NAME');
if (Yii::app()->request->isPostRequest) {
$ticket->attributes = $_POST['Ticket'];
$ticket->client_id = Yii::app()->params['client_id'];
if ($ticket->validate()) {
// print_r($ticket);
if ($ticket->save()) {
$this->sendEmail($ticket);
Yii::app()->user->setFlash('success', 'Спасибо за обращение, в ближайшие время оператор вам ответить');
//$this->redirect(array('view','id'=>$ticket->id));
}
}
}
$this->render('create', array('model' => $ticket));
}
示例6: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$rules = ['priority' => 'AlphaNum', 'title' => 'Required', 'text' => 'Required', 'status' => 'Required', 'category' => 'Required|Exists:ticket_categories,id'];
$v = Validator::make(Input::all(), $rules);
if ($v->passes()) {
$ticket = new Ticket();
$ticket->fill(Input::all());
$ticket->issuer()->associate(Auth::getUser());
if (Input::get('category')) {
$cat = TicketCategory::findOrFail(Input::get('category'));
$ticket->category()->associate($cat);
}
$ticket->save();
return Redirect::action('TicketController@index');
} else {
return Redirect::action('TicketController@create')->withErrors($v->getMessageBag());
}
}
示例7: actionCreate
public function actionCreate()
{
$model = new OpenTicketForm();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['OpenTicketForm'])) {
$model->attributes = $_POST['OpenTicketForm'];
if ($model->validate()) {
//开票操作一
$ticket = new Ticket();
$ticket->user_email = $model->user_email;
$ticket->user_name = $model->user_name;
$ticket->subject = $model->subject;
$ticket->create_time = date('Y-m-d H:i:s');
$ticket->update_time = date('Y-m-d H:i:s');
$ticket->dept_id = 0;
$ticket->topic_id = $model->help_topic;
$ticket->user_id = Yii::app()->user->getState('user_id');
$ticket->status = 'open';
$ticket->is_answered = 0;
if (!$ticket->save()) {
var_dump($ticket->errors);
die;
}
//print_r($ticket->errors);exit;
//开票操作二
$message = new TicketMessage();
$message->ticket_id = $ticket->ticket_id;
$message->staff_id = 0;
$message->msg_content = $model->msg_content;
$message->create_time = date('Y-m-d H:i:s');
$message->update_time = date('Y-m-d H:i:s');
$message->ip_address = '127.0.0.1';
$message->save();
//页面跳转
Yii::app()->user->setFlash('contact', 'Thank you for contacting us. We will respond to you as soon as possible.');
$this->refresh();
}
}
//$this->redirect(array('view','id'=>1));
$this->render('create', array('model' => $model));
}
示例8: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Ticket();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Ticket'])) {
$model->attributes = $_POST['Ticket'];
$model->total_money = $model->weight * $model->price + $model->insurance + $model->packages + $model->pay_before;
if ($model->size > 0) {
$model->density = round($model->weight / $model->size, 2);
} else {
$model->density = 0;
}
$model->create_time = time();
$model->update_time = time();
$model->valid = 1;
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->id));
}
}
$this->render('create', array('model' => $model));
}
示例9: testBelongsDoubleAttribution
/**
* Test whether a second BelongsTO assignment does change the attribute
* (Check if BelongsTo cache is properly updated)
*
* @return null
*/
public function testBelongsDoubleAttribution()
{
$user1 = new User();
$user1->name = "Belongs first attribution from where and other class";
$user1->email = "belongswhere@torm.com";
$user1->code = "01011";
$user1->level = 1;
$this->assertTrue($user1->save());
$user2 = new User();
$user2->name = "Belongs second attribution from where and other class";
$user2->email = "belongswhere2@torm.com";
$user2->code = "01012";
$user2->level = 1;
$this->assertTrue($user2->save());
$uid1 = $user1->id;
$uname1 = $user1->name;
$uid2 = $user2->id;
$uname2 = $user2->name;
$users = [$user1->code, $user2->code];
$ticket = new Ticket();
$ticket->description = "Test";
$ticket->user = $user1;
$this->assertEquals($uname1, $ticket->user->name);
$ticket->user = $user2;
$this->assertEquals($uname2, $ticket->user->name);
$this->assertTrue($ticket->save());
$this->assertNotEquals(self::$user->id, $uid1);
$this->assertNotEquals(self::$user->id, $uid2);
$this->assertNotNull($uid1);
$this->assertNotNull($uid2);
$this->assertEquals($ticket->user->id, $uid2);
$this->assertTrue($user1->destroy());
$this->assertTrue($user2->destroy());
$this->assertTrue($ticket->destroy());
}
示例10: post_newguestticket
public function post_newguestticket()
{
$postStr = Input::get('data');
parse_str($postStr, $post);
$post['supportInputHuman'] = strtolower($post['supportInputHuman']);
//Create our validator
$validator = Validator::make(array('name' => $post['supportInputName'], 'email' => $post['supportInputEmail'], 'subject' => $post['supportInputSubject'], 'description' => $post['supportInputDescription'], 'human' => $post['supportInputHuman']), array('name' => 'required|max:50', 'email' => 'required|email|max:100', 'subject' => 'required|max:100', 'description' => 'required|max:4000', 'human' => 'required|in:vatsim'), array('human.required' => 'Please fill in the anti-spam question. (Hint It ends with SIM and starts with VAT.).', 'human.in' => 'The antispam answer is not correct. (Hint: It ends with SIM and starts with VAT.)'));
//Let's make sure that our user is not logged in
if ($validator->fails() || Auth::user()->check()) {
$messages = $validator->messages();
$errorStr = '';
//If we are logged in let's append an error to that message.
if (Auth::user()->check()) {
$errorStr .= '<div class="alert alert-error">Please use the built in ticket help desk in your VA console. You can log in at the top right of this page.</div>';
}
foreach ($messages->all('<li>:message</li>') as $message) {
$errorStr .= '<div class="alert alert-error">' . $message . '</div>';
}
echo $errorStr;
} else {
//All clear.
$ticket = new Ticket();
//We set this value to -1 since it is not associated with a specific VID
$ticket->vid = -1;
$ticket->subject = $post['supportInputSubject'];
$ticket->description = $post['supportInputDescription'];
//The status is open by default
$ticket->status = 1;
$ticket->name = $post['supportInputName'];
$ticket->email = $post['supportInputEmail'];
$ticket->hash = sha1($post['supportInputName'] . time());
//Save our ticket
$ticket->save();
//Create a URL for the user to access their ticket at
$url = URL::to('/') . '/ticket/hash/' . $ticket->hash;
//Now email the user the ticket # and a direct link to access updates (using the hash)
$body = "Hello " . $post['supportInputName'] . ",<br /><br />The VATSIM VASOPs department has received your ticket. Please use the following link to view and update your ticket.<br /><br /> <a href='" . $url . "'>" . $url . "</a><br /><br />You may also view your ticket at <a href='" . Url::to('/') . "/#moduleSupport'>" . Url::to('/') . "/#moduleSupport</a> by entering the following details.<br /><br /><strong>Ticket ID: " . $ticket->id . "</strong><br /><strong>Email: " . $post['supportInputEmail'] . "</strong><br /><br /><br /> <strong>Do not reply to this email. If you wish to reply to this ticket, please do so through your account online.</strong>";
$data = array('subject' => 'VASOPS Ticket #' . $ticket->id . ": " . $post['supportInputSubject'], 'email' => $post['supportInputEmail'], 'name' => $post['supportInputName']);
Mail::send('email.default', array("content" => $body), function ($message) use($data) {
$message->to($data['email'], $data['name'])->subject($data['subject']);
});
//Get a list of auditors who have subscribed to ticket email notifications and send them an email
$auditors = ConsoleUser::where('ticketnotifications', '=', '1')->where('access', '>', -1)->get();
foreach ($auditors as $auditor) {
$email = $auditor->email;
if (empty($email)) {
continue;
}
$body = "Hello " . $auditor->name . ",<br /><br />A new ticket was created by " . $post['supportInputName'] . "<br /><br />" . $post['supportInputDescription'] . "<br /><br /><br /> <strong>Do not reply to this email. If you wish to reply to this ticket, please do so through your account online.</strong>";
$data = array('subject' => 'VASOPS New Ticket: ' . $post['supportInputSubject'], 'name' => $auditor->name, 'email' => $auditor->email);
Mail::send('email.default', array("content" => $body), function ($message) use($data) {
$message->to($data['email'], $data['name'])->subject($data['subject']);
});
}
//That will be all. Let's send 1 to our client to let me know that everything went well.
echo 1;
}
}
示例11: Person
$person = new Person($row2['username']);
$history->setEnteredByPerson($person);
$history->setActionPerson($person);
$ticket->updateHistory($history);
}
//
// responses go in issueHistory
//
$sql = "select r.date as date,r.notes as notes,\n u.username as username, c.name as contactMethod\n\t\tfrom responses r\n left join referrals rf on r.referral_id = rf.id\n left join users u on r.user_id = u.id\n left join contactMethods c on r.contactMethod_id = c.id\n\t\twhere rf.request_id=" . $row['id'];
$result2 = $pdo->query($sql);
while ($result2 && ($row2 = $result2->fetch(PDO::FETCH_ASSOC))) {
$history = new History();
$history->setAction('response');
$history->setEnteredDate($row2['date']);
$history->setActionDate($row2['date']);
$history->setNotes($row2['notes']);
$person = new Person($row2['username']);
$history->setEnteredByPerson($person);
$history->setActionPerson($person);
$ticket->updateHistory($history);
}
try {
$ticket->save();
echo $ticket->getId() . " {$cnt}\n";
$cnt++;
} catch (Exception $e) {
echo $e->getMessage() . "\n";
print_r($e);
exit;
}
}
示例12: actionEscalate
public function actionEscalate($id)
{
$model = $this->loadModel($id);
$modelNew = new Ticket();
$modelNew->creator_user_id = User::getCurrentUserId();
$modelNew->status = 'Pending';
$modelNew->created_date = new CDbExpression('NOW()');
$modelNew->subject = $model->subject;
$modelNew->description = $model->description;
$modelNew->domain_id = $model->domain_id;
$modelNew->subdomain_id = $model->subdomain_id;
$modelNew->file = $model->file;
$modelNew->priority_id = $model->priority_id;
$modelNew->isEscalated = 1;
$modelNew->assigned_date = new CDbExpression('NOW()');
/* Get the current date and time */
/*Assign the ticket to the most appropiate Domain mentor in tier2*/
$sub = true;
if ($model->subdomain_id == null) {
$sub = false;
}
if (!$sub) {
$modelNew->assign_user_id = User::escalateTicket($model->domain_id, $sub);
} else {
$modelNew->assign_user_id = User::escalateTicket($model->subdomain_id, $sub);
}
$saved = true;
$trans = Yii::app()->db->beginTransaction();
try {
$saved = $modelNew->save();
$sql = 'INSERT INTO comment(description, added_date, ticket_id, user_added) SELECT description, added_date,' . $modelNew->id . ', user_added FROM comment WHERE ticket_id =' . $model->id;
$command = Yii::app()->db->createCommand($sql);
$command->execute();
//generate the escalated events
TicketEvents::recordEvent(EventType::Event_Escalated_To, $model->id, NULL, $modelNew->id, NULL);
//generate the new event
TicketEvents::recordEvent(EventType::Event_New, $modelNew->id, NULL, NULL, NULL);
//generate the escalated events
TicketEvents::recordEvent(EventType::Event_Escalated_From, $modelNew->id, $model->id, NULL, NULL);
$trans->commit();
} catch (Exception $e) {
$trans->rollback();
Yii::log("Error occurred while saving the ticket or its events. Rolling back... . Failure reason as reported in exception: " . $e->getMessage(), CLogger::LEVEL_ERROR, __METHOD__);
$saved = false;
}
//$send = $modelNew->isNewRecord;
if ($saved) {
/*If save if true send Notification the the Domain Mentor who was assigned the ticket */
// if($send)
User::sendTicketAssignedEmailNotification($modelNew->creator_user_id, $modelNew->assign_user_id, $modelNew->domain_id, $modelNew->id);
// $this->redirect(array('view', 'id' => $modelNew->id));
//copy all the comments from the old ticket to the new ticket
//this has been substituted here for a change of status
/* $sql2 = 'INSERT INTO comment(description, added_date, ticket_id, user_added) VALUES ("Ticket ' . $model->id . ' was escalated to ticket '. $modelNew->id . '" , ' . $modelNew->created_date. ',' . $model->id . ', "System")';
$command2 = Yii::app()->db->createCommand($sql2);
$command2->execute();
$sql3 = 'INSERT INTO comment(description, added_date, ticket_id, user_added) VALUES ("Ticket ' . $model->id . ' was escalated to ticket '. $modelNew->id . '" , ' . $modelNew->created_date. ',' . $modelNew->id . ', "System")';
$command3 = Yii::app()->db->createCommand($sql3);
$command3->execute();*/
$response = array();
$response['url'] = "/coplat/index.php/home/userHome";
echo json_encode($response);
exit;
}
}
示例13: editarSeguro
function editarSeguro()
{
try {
$this->getById($_REQUEST['id']);
$this->voucher = $_REQUEST['voucher'];
$this->save();
$user = new Usuario();
$user->id = $_SESSION['ag_idUsuario'];
//grava os tickets
$oVoo = new Voo();
$rsVoo = $oVoo->getRows(0, 999, array("id" => "asc"), array("grupo" => " = " . $this->grupo->id));
foreach ($rsVoo as $key => $voo) {
$oTicket = new Ticket();
$oTicket->getRow(array("voo" => " = " . $voo->id, "participante" => " = " . $this->id));
$oTicket->voo = $voo;
$oTicket->participante = $this;
$oTicket->ticket = $_REQUEST['ticket' . $voo->id];
$oTicket->reserva = $_REQUEST['reserva' . $voo->id];
$oTicket->save();
}
//grava log de usuario
$oLog = new LogUsuario();
$data = date("Y-m-d H:i:s");
$movimento = "ALTERAR SEGURO DO PARTICIPANTE<BR> CLIENTE: " . $this->cliente->nomeCompleto . "<BR> GRUPO: " . $this->grupo->nomePacote;
$oLog->usuario = $user;
$oLog->data = $data;
$oLog->movimento = $movimento;
$oLog->save();
//fim da log
$_SESSION['tupi.mensagem'] = 48;
} catch (Exception $e) {
$_SESSION['tupi.mensagem'] = 49;
}
}
示例14: convertToTicket
function convertToTicket(&$logged_user, &$error)
{
db_begin_work();
$ticket = new Ticket();
$ticket->setProjectId($this->getProjectId());
$ticket->setName($this->getName());
$ticket->setBody($this->getBody());
$ticket->setState($this->getState());
$ticket->setVisibility($this->getVisibility());
$ticket->setPriority($this->getPriority());
$ticket->setCommentsCount($this->getCommentsCount());
$ticket->setIsLocked($this->getIsLocked());
$ticket->setCreatedById($logged_user->getId());
$ticket->setCreatedByName($logged_user->getName());
$ticket->setCreatedByEmail($logged_user->getEmail());
if ($this->getType() == 'Page') {
$ticket->setMilestoneId($this->setMilestoneId());
}
$save = $ticket->save();
if ($save && !is_error($save)) {
db_commit();
$ticket->ready();
$link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
mysql_select_db(DB_NAME);
$query = "update healingcrystals_project_objects set parent_id='" . $ticket->getId() . "', parent_type='Ticket' where parent_id='" . $this->getId() . "' and project_id='" . $this->getProjectId() . "' and type in ('Comment', 'Task')";
mysql_query($query);
$query = "update healingcrystals_project_objects set parent_id=null, parent_type=null where parent_id='" . $this->getId() . "' and project_id='" . $this->getProjectId() . "' and type not in ('Comment', 'Task')";
mysql_query($query);
if ($this->getType() == 'Milestone') {
$query = "update healingcrystals_project_objects set milestone_id=null where milestone_id='" . $this->getId() . "' and project_id='" . $this->getProjectId() . "'";
mysql_query($query);
}
$query = "select * from healingcrystals_assignments where object_id='" . $this->getId() . "'";
$result = mysql_query($query);
while ($entry = mysql_fetch_assoc($result)) {
$query = "insert into healingcrystals_assignments (user_id, object_id, is_owner) values ('" . $entry['user_id'] . "', '" . $ticket->getId() . "', '" . $entry['is_owner'] . "')";
mysql_query($query);
}
$query = "select * from healingcrystals_project_object_categories where object_id='" . $this->getId() . "'";
$result = mysql_query($query);
while ($entry = mysql_fetch_assoc($result)) {
$query = "insert ignore into healingcrystals_project_object_categories (object_id, category_id) values ('" . $ticket->getId() . "', '" . $entry['category_id'] . "')";
mysql_query($query);
}
mysql_close($link);
$this->moveToTrash();
return $ticket->getIntegerField1();
} else {
db_rollback();
$error = $save;
return '';
}
}
示例15: testPKMethod
/**
* Test primary key method
*
* @return null
*/
public function testPKMethod()
{
$user = User::first();
$ticket = new Ticket();
$ticket->user_id = $user->id;
$ticket->description = "pk value test";
$this->assertTrue($ticket->save());
$ticket = Ticket::last();
$this->assertTrue($ticket->id >= time() - 1000);
$this->assertTrue($ticket->destroy());
}