本文整理汇总了PHP中Ticket::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Ticket::model方法的具体用法?PHP Ticket::model怎么用?PHP Ticket::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ticket
的用法示例。
在下文中一共展示了Ticket::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadModel
public function loadModel($id)
{
$model = Ticket::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}
示例2: actionadminHome
public function actionadminHome()
{
/** @var User $username */
$username = Yii::app()->user->name;
$user = User::model()->find("username=:username", array(':username' => $username));
/* Get all tickets on the mentoring subsystem */
//$TicketsO = Ticket::model()->findAll("status=:pending" or "status=:reject",array(':pending'=>'pending', ':reject'=>'reject'));
$TicketsO = Ticket::model()->findAllBySql("SELECT * FROM ticket WHERE (status=:pending or status=:reject)", array(':pending' => 'pending', ':reject' => 'reject'));
$TicketsC = Ticket::model()->findAll("status=:status", array(':status' => 'close'));
//$TicketsR = Ticket::model()->findAll("status=:status",array(':status'=>'reject'));
$this->render('adminHome', array('TicketsO' => $TicketsO, 'TicketsC' => $TicketsC, 'user' => $user));
}
示例3: actionReply
public function actionReply()
{
$model = new TicketMessage();
if (isset($_POST['TicketMessage'])) {
$model->attributes = $_POST['TicketMessage'];
if ($model->save()) {
//更新T状态is_answered:1
$t = Ticket::model()->findByPk($model->ticket_id);
$t->is_answered = 1;
$t->status = 'Staff-Reply';
$t->lastreply_time = date('Y-m-d H:i:s');
$t->save();
Yii::app()->user->setFlash('view-ticket', 'Your notes has been posted successfully.');
$this->redirect(array('ticket/view', 'id' => $model->ticket_id));
}
}
}
示例4: actionView
public function actionView($id)
{
$ticket = Ticket::model()->with('messages')->findByPk($id);
if (!$ticket) {
throw new CHttpException(404);
}
if ($ticket->client_id != Yii::app()->params['client_id']) {
throw new CHttpException(401);
}
$this->pageName = Yii::t('SupportModule.default', 'MODULE_NAME');
$modelForm = new TicketMessage();
if (Yii::app()->request->isPostRequest && $ticket->status != 0) {
$modelForm->attributes = $_POST['TicketMessage'];
$modelForm->ticket_id = $ticket->id;
$modelForm->user_id = Yii::app()->params['client_id'];
if ($modelForm->validate()) {
$modelForm->save(false);
Yii::app()->user->setFlash('success', Yii::t('app', 'SUCCESS_MSG_SAND'));
$this->refresh();
}
}
$this->render('view', array('model' => $ticket, 'modelForm' => $modelForm));
}
示例5: array
?>
</a>
<!-- <div style="margin-top = 0px; height: 300px; width: 1000px; overflow-y: scroll; border-radius: 5px;"> -->
<div id = "fullcontent"t>
<?php
$model1 = Ticket::model();
$MyTabs = array('tab1' => array('title' => "Open", 'content' => $this->widget('zii.widgets.grid.CGridView', array('id' => 'My_questions', 'dataProvider' => $model1->searchMyQuestions(User::getCurrentUserId()), 'columns' => array(array('name' => 'subject', 'value' => '$data->subject', 'htmlOptions' => array('width' => '120px')), array('name' => 'Last Activity', 'value' => '$data->getLatestActivityDate()', 'htmlOptions' => array('width' => '40px')), array('class' => 'CButtonColumn', 'template' => '{view}', 'buttons' => array('view' => array('url' => 'Yii::app()->createUrl("ticket/view", array("id"=>$data->id))'))))), true)), 'tab2' => array('title' => "Closed", 'content' => $this->widget('zii.widgets.grid.CGridView', array('id' => 'My_Closed_questions', 'dataProvider' => $model1->searchMyClosedQuestions(User::getCurrentUserId()), 'columns' => array(array('name' => 'subject', 'value' => '$data->subject', 'htmlOptions' => array('width' => '120px')), array('name' => 'Last Activity', 'value' => '$data->getLatestActivityDate()', 'htmlOptions' => array('width' => '40px')), array('class' => 'CButtonColumn', 'template' => '{view}', 'buttons' => array('view' => array('url' => 'Yii::app()->createUrl("ticket/view", array("id"=>$data->id))'))))), true)));
$this->widget('CTabView', array('tabs' => $MyTabs));
?>
<br/>
<?php
if (User::isCurrentUserDomMentor()) {
?>
<h3>Assigned Questions</h3> <br/>
<?php
$model3 = Ticket::model();
$AssignedTabs = array('tab4' => array('title' => "Open", 'content' => $this->widget('zii.widgets.grid.CGridView', array('id' => 'Assigned_tickets', 'dataProvider' => $model3->searchAssigned(User::getCurrentUserId()), 'columns' => array(array('name' => 'created_date', 'value' => '$data->getCreatedDateToString()'), 'subject', array('name' => 'Last Activity', 'value' => '$data->getLatestActivityDate()'), array('name' => 'Priority', 'value' => '$data->getPriorityString()'), array('class' => 'CButtonColumn', 'template' => '{view}', 'buttons' => array('view' => array('url' => 'Yii::app()->createUrl("ticket/view", array("id"=>$data->id))'))))), true)), 'tab3' => array('title' => "Closed", 'content' => $this->widget('zii.widgets.grid.CGridView', array('id' => 'Assigned_Closed_tickets', 'dataProvider' => $model3->searchAssignedClosed(User::getCurrentUserId()), 'columns' => array(array('name' => 'created_date', 'value' => '$data->getCreatedDateToString()'), 'subject', array('name' => 'Last Activity', 'value' => '$data->getLatestActivityDate()'), array('name' => 'Priority', 'value' => '$data->getPriorityString()'), array('class' => 'CButtonColumn', 'template' => '{view}', 'buttons' => array('view' => array('url' => 'Yii::app()->createUrl("ticket/view", array("id"=>$data->id))'))))), true)));
$this->widget('CTabView', array('tabs' => $AssignedTabs));
}
?>
<br/>
<h3>Upcoming Meetings</h3>
<?php
$model2 = VideoConference::model();
$this->widget('zii.widgets.grid.CGridView', array('id' => 'upcomingVc', 'dataProvider' => $model2->searchUpcoming(User::getCurrentUserId()), 'columns' => array('subject', array('name' => 'scheduled_for', 'value' => '$data->getDateToString()'), array('class' => 'CButtonColumn', 'template' => '{view}', 'buttons' => array('view' => array('url' => 'Yii::app()->createAbsoluteUrl("videoConference/join/".$data->id, array(), "https")'))))));
?>
<div class="span2" style="margin-left: 30px">
<!-- Cancel Button -->
<table>
<tr>
示例6: getCurrentTicketCount
/**
* Get the number of tickets that are currently assigned to this queue.
*
* @return array
*/
public function getCurrentTicketCount()
{
$criteria = new \CDbCriteria();
$criteria->addCondition('queue_assignments.id = (select id from ' . TicketQueueAssignment::model()->tableName() . ' cass where cass.ticket_id = t.id order by cass.assignment_date desc limit 1) and queue_assignments.queue_id = :qid');
$criteria->params = array(':qid' => $this->id);
return Ticket::model()->with('queue_assignments')->count($criteria);
}
示例7: foreach
<tbody>
<tr>Your order information</tr>
<tr><h4>Event: <?php echo $event->title; ?></h4></tr>
<tr>
<table border="1" cellpadding="2" cellspacing="0" style="border-collapse:collapse" width="700">
<tbody>
<tr>
<td width="100">Ticket name</td>
<td width="100">Quantity</td>
<td width="100">Ticket type</td>
<td width="200">E-Ticket No. </td>
<td width="100">Price</td>
<td width="100">SubTotal</td>
</tr>
<?php foreach($orderItem as $item):?>
<?php $ticket = Ticket::model()->findByPk($item->ticket_id); ?>
<tr>
<td><?php echo $ticket->name; ?></td>
<td><?php echo $item->quantity; ?></td>
<td><?php if($ticket->eticket == 0)echo 'Paper ticket';else echo 'E-ticket';?></td>
<td><?php echo $item->enum?></td>
<td><?php echo $ticket->price; ?></td>
<td>£ <?php echo $ticket->price;?></td>
</tr>
<?php endforeach; ?>
<tr>
<td colspan="5" align="right">Delivery method: </td>
<td><?php
switch ($order->ship) {
case '1':
示例8: actiondomainMentorViewMeetings
public function actiondomainMentorViewMeetings()
{
/** @var User $user */
$username = Yii::app()->user->name;
$user = User::model()->find("username=:username", array(':username' => $username));
$tickets = Ticket::model()->findAllBySql("select * from ticket where assign_user_id = {$user->id}");
$this->render('domainMentorViewMeetings', array('user' => $user, 'tickets' => $tickets));
}
示例9: checkStatus
public function checkStatus($id)
{
$data = Ticket::model()->count('ticket_status=' . $id);
return $data;
}
示例10: escalateTicket
public static function escalateTicket($domain_id, $sub)
{
if ($sub) {
$userDomain = UserDomain::model()->findAllBySql("SELECT * FROM user_domain WHERE subdomain_id =:id", array(":id" => $domain_id));
$subdomain = Subdomain::model()->findByPk($domain_id);
$validator = $subdomain->validator;
} else {
$userDomain = UserDomain::model()->findAllBySql("SELECT * FROM user_domain WHERE domain_id =:id", array(":id" => $domain_id));
$domain = Domain::model()->findByPk($domain_id);
$validator = $domain->validator;
}
if ($userDomain != null && is_array($userDomain)) {
foreach ($userDomain as $auserDomain) {
/** @var UserDomain $auserDomain */
if ($auserDomain->tier_team == 2) {
if ($auserDomain->rate >= $validator) {
/*Query to the domain mentor to see how many tickets is allowed to be assigned */
$domainMentor = DomainMentor::model()->findAllBySql("SELECT * FROM domain_mentor WHERE user_id =:id", array(":id" => $auserDomain->user_id));
/** @var Ticket $count */
if (is_array($domainMentor)) {
foreach ($domainMentor as $adomainMentor) {
/** @var DomainMentor $adomainMentor */
$count = Ticket::model()->findBySql("SELECT COUNT(id) as `id` FROM ticket WHERE assign_user_id =:id", array(":id" => $adomainMentor->user_id));
if ($count->id < $adomainMentor->max_tickets) {
/*return the first available domain mentor on queue */
return $auserDomain->user_id;
}
}
}
}
}
}
}
return self::$admin;
/* Assign the ticket to the admin for reassign */
}
示例11: IN
?>
/ticket?ts=5">
<div class="col-sm-3 link_to_Click">
<div class="circle-tile">
<div class="circle-tile-heading">
<i class="fa fa-ticket fa-fw fa-3x"></i>
</div>
<div class="circle-tile-content">
<div class="circle-tile-number">
<?php
if (!in_array(Yii::app()->session['user_data']['user_role_type'], array(0, 1, 2))) {
echo Ticket::model()->count('ticket_status==5 AND ticket_id IN (' . $tickList . ')');
} else {
echo Ticket::model()->count('ticket_status==5');
}
?>
</div>
<div class="circle-tile-description">
Closed Tickets
</div>
<!--<span class="circle-tile-footer">More Info <i class="fa fa-chevron-circle-right"></i></span>-->
</div>
</div>
</div>
</a>
<?php
}
?>
示例12: actionGetOrderlList
public function actionGetOrderlList()
{
$data = $_REQUEST;
$result = array();
$newResult = array();
if (!empty($data)) {
$limit = 20;
$page = $data['page'];
$offset = ($page - 1) * $limit;
$user_id = $data['Client'];
$category = $data['category'];
$status = $data['order_status'];
$start_date = $data['start_date'];
$end_date = $data['end_date'];
$condition = "";
if (!empty($start_date)) {
$condition = "created_date >= '{$start_date}' AND created_date <= '{$end_date} 23:59:59'";
}
if (!empty($category)) {
if (!empty($condition)) {
$condition .= " AND ";
}
$condition .= " ticket_title = '" . $category . "'";
}
if (!in_array(Yii::app()->session['user_data']['user_role_type'], array(0, 1, 2))) {
$ticketList = TicketAssign::model()->getTicketbyUser(Yii::app()->session['user_data']['user_id']);
$ticket_ids = array();
foreach ($ticketList as $ticket) {
$ticket_ids[] = $ticket['ticket_id'];
}
if (!empty($ticket_ids)) {
if (!empty($condition)) {
$condition .= " AND ";
}
$ticket_ids = implode($ticket_ids, ",");
$condition .= 'ticket_id in (' . $ticket_ids . ')';
} else {
if (!empty($condition)) {
$condition .= " AND ";
}
$condition .= 'ticket_id i=0';
}
if (!empty($condition)) {
$condition .= " AND ";
}
$condition .= "ticket_status != 1 ";
}
// echo $condition;die;
$orderTotal = count(Ticket::model()->findAllByAttributes(array(), array("condition" => $condition)));
$orderList = Ticket::model()->findAllByAttributes(array(), array("condition" => $condition, 'limit' => $limit, "offset" => $offset));
$count = 0;
foreach ($orderList as $val) {
if (!empty($user_id)) {
$orderDetails = Orders::model()->findByAttributes(array("order_id" => $val['order_id'], "client_id" => $user_id));
} else {
$orderDetails = Orders::model()->findByAttributes(array("order_id" => $val['order_id']));
}
$paymentD = json_decode($orderDetails['order_payment']);
if (!empty($orderDetails)) {
if (!empty($status)) {
if ($paymentD->payment_status == $status) {
$result[] = array("order_id" => $orderDetails['order_id'], "url" => Yii::app()->createUrl("ticket/view", array("id" => base64_encode($val['ticket_id']))), "client" => Users::model()->getUserName($orderDetails['client_id']), "amount" => $orderDetails['order_total'], "category" => $val['ticket_title'], "status" => $paymentD->payment_status, 'date' => date('d M Y @ g:i A', strtotime($val['created_date'])));
} else {
$count++;
}
} else {
$result[] = array("order_id" => $orderDetails['order_id'], "url" => Yii::app()->createUrl("ticket/view", array("id" => base64_encode($val['ticket_id']))), "client" => Users::model()->getUserName($orderDetails['client_id']), "amount" => $orderDetails['order_total'], "category" => $val['ticket_title'], "status" => $paymentD->payment_status, 'date' => date('d M Y @ g:i A', strtotime($val['created_date'])));
}
} else {
$count++;
}
}
if (!empty($orderList) && !empty($result)) {
$newResult['pagination'] = $this->actionCreatePager($orderTotal - $count, $limit, $page);
$newResult['records'] = $result;
}
}
echo json_encode($newResult);
}
示例13: actionGetOrderlList
public function actionGetOrderlList()
{
$data = $_REQUEST['Coupons'];
$result = array();
$newResult = array();
if (!empty($data['coupon_code'])) {
$limit = 20;
$page = $data['page'];
$offset = ($page - 1) * $limit;
$result = array();
$coupon_code = trim($data['coupon_code']);
// $coupon_type = $data['coupon_type'];
$validate_from = $data['validate_from'];
$validate_to = $data['validate_to'];
$Couponid = Coupons::model()->findByAttributes(array("coupon_code" => $coupon_code, "status" => 1));
if (!empty($Couponid['id'])) {
if (!empty($validate_from)) {
$orderTotal = count(Orders::model()->findAllByAttributes(array("coupon_id" => $Couponid['id']), array("condition" => "order_date >= '{$validate_from}' AND order_date <= '{$validate_to} 23:59:59'")));
$orderList = Orders::model()->findAllByAttributes(array("coupon_id" => $Couponid['id']), array("condition" => "order_date >= '{$validate_from}' AND order_date <= '{$validate_to} 23:59:59'", 'limit' => $limit, "offset" => $offset));
} else {
$orderTotal = count(Orders::model()->findAllByAttributes(array("coupon_id" => $Couponid['id'])));
$orderList = Orders::model()->findAllByAttributes(array("coupon_id" => $Couponid['id']), array('limit' => $limit, "offset" => $offset));
}
}
foreach ($orderList as $val) {
$ticketid = Ticket::model()->findByAttributes(array("order_id" => $val['order_id']));
$result[] = array("order_id" => $val['order_id'], "url" => Yii::app()->createUrl("ticket/view", array("id" => base64_encode($ticketid['ticket_id']))), "client" => Users::model()->getUserName($val['client_id']), "amount" => $val['order_total'], "product_name" => $ticketid['ticket_title'], 'date' => date('d M Y @ g:i A', strtotime($val['order_date'])));
}
if (!empty($orderList)) {
$newResult['pagination'] = $this->actionCreatePager($orderTotal, $limit, $page);
$newResult['records'] = $result;
}
}
echo json_encode($newResult);
}
示例14: actionView
/**
* Displays a particular model.
* @param integer $id the ID of the model to be displayed
*/
public function actionView($id)
{
echo "<script>console.log('actionView!');</script>";
$model = $this->loadModel($id);
$promentor = ProjectMentor::model()->getProMentor($id);
$permentor = PersonalMentor::model()->getPerMentor($id);
$dommentor = DomainMentor::model()->getDomMentor($id);
$def = User::model()->findBySql("select * from user where username = 'DEFAULT'");
//$isactive = $model->activated;
if (isset($_POST['updateRoles'])) {
if ($model->isProMentor == 1) {
Project::model()->updateAll(array('project_mentor_user_id' => $def->id), 'project_mentor_user_id = ' . $model->id);
$promentor->max_hours = $_POST['pjmhours'];
$all = Project::model()->findAll();
$count = 0;
foreach ($all as $each) {
if (isset($_POST[$each->id . 'pjm'])) {
$p = Project::model()->findByPk($each->id);
$p->project_mentor_user_id = $model->id;
$p->save(false);
$count++;
}
}
$promentor->max_projects = $count;
$promentor->save();
}
if ($model->isDomMentor) {
UserDomain::model()->deleteAll("user_id = " . $model->id);
$dommentor->max_tickets = $_POST['dmmaxtickets'];
$dommentor->save();
$all = Domain::model()->findAll();
foreach ($all as $each) {
if (isset($_POST[$each->id])) {
$user_domain = new UserDomain();
$user_domain->user_id = $dommentor->user_id;
$user_domain->domain_id = $each->id;
$user_domain->active = 1;
$user_domain->save(false);
$allsubs = Subdomain::model()->findAllBySql("select * from subdomain where domain_id = {$each->id}");
if ($allsubs != null) {
foreach ($allsubs as $onesub) {
$temp = $onesub->id . 'ddmsub';
if (isset($_POST[$temp])) {
$user_domain = new UserDomain();
$user_domain->user_id = $dommentor->user_id;
$user_domain->domain_id = $each->id;
$user_domain->active = 1;
$rate = $each->id . '-' . $onesub->id . 'dmrate';
$tier = $each->id . '-' . $onesub->id . 'dmtier';
$user_domain->rate = $_POST[$rate];
$user_domain->tier_team = $_POST[$tier];
$user_domain->subdomain_id = $onesub->id;
$user_domain->save(false);
}
}
} else {
$user_domain = new UserDomain();
$user_domain->user_id = $dommentor->user_id;
$user_domain->domain_id = $each->id;
$user_domain->active = 1;
$user_domain->save(false);
}
}
}
}
if ($model->isPerMentor) {
Mentee::model()->updateAll(array('personal_mentor_user_id' => $def->id), 'personal_mentor_user_id = ' . $model->id);
$all = Mentee::model()->findAll();
$count = 0;
foreach ($all as $each) {
if (isset($_POST[$each->user_id . 'pm'])) {
//$p = Mentee::model()->findByPk($each->user_id);
$each->personal_mentor_user_id = $model->id;
$each->save(false);
$count++;
}
}
$permentor->max_hours = $_POST['pmhours'];
$permentor->max_mentees = $count;
$permentor->save();
}
/** @var User $username */
$projects = Project::model()->findAllBySql("SELECT title FROM project WHERE project_mentor_user_id={$id}");
$userdoms = UserDomain::model()->findAllBySql("SELECT distinct domain_id FROM user_domain WHERE user_id={$id}");
$Mentees = Mentee::model()->findAllBySql("SELECT user_id FROM mentee WHERE personal_mentor_user_id={$id}");
$Tickets = Ticket::model()->findAllBySql("SELECT * FROM ticket WHERE assign_user_id=:id", array(":id" => $id));
$this->render('view', array('Tickets' => $Tickets, 'model' => $model, 'userdoms' => $userdoms, 'Mentees' => $Mentees, 'projects' => $projects));
/*$this->render('view',array(
'model'=>$this->loadModel($id),
));*/
} else {
$projects = Project::model()->findAllBySql("SELECT title FROM project WHERE project_mentor_user_id={$id}");
$userdoms = UserDomain::model()->findAllBySql("SELECT distinct domain_id FROM user_domain WHERE user_id={$id}");
$Mentees = Mentee::model()->findAllBySql("SELECT user_id FROM mentee WHERE personal_mentor_user_id={$id}");
$Tickets = Ticket::model()->findAllBySql("SELECT * FROM ticket WHERE assign_user_id=:id", array(":id" => $id));
$this->render('view', array('Tickets' => $Tickets, 'model' => $model, 'userdoms' => $userdoms, 'Mentees' => $Mentees, 'projects' => $projects, 'model' => $this->loadModel($id)));
//.........这里部分代码省略.........
示例15: actioneditProfile
public function actioneditProfile()
{
/** @var User $username */
$username = Yii::app()->user->name;
$user = User::model()->find("username=:username", array(':username' => $username));
$projects = Project::model()->findAllBySql("SELECT title FROM project WHERE project_mentor_user_id IS NULL");
$userdoms = UserDomain::model()->findAllBySql("SELECT domain_id FROM user_domain WHERE user_id={$user->id}");
$Mentees = Mentee::model()->findAllBySql("SELECT user_id FROM mentee WHERE personal_mentor_user_id IS NULL");
$Tickets = Ticket::model()->findAllBySql("SELECT * FROM ticket WHERE assign_user_id=:id", array(":id" => $user->id));
$this->render('editProfile', array('Tickets' => $Tickets, 'user' => $user, 'userdoms' => $userdoms, 'Mentees' => $Mentees, 'projects' => $projects));
}