<style type="text/css"> .ticket_portlet { background: none repeat scroll 0 0 #fff9f3; border: 1px solid #ddd; border-radius: 5px; margin: 10px 0; padding: 10px; } .ticket_icon { margin-top: 25px; text-align: center; color:<?php echo TicketStatus::model()->getTicketColorName($model->ticket_status); ?> ; } .tt li{ margin-bottom: 5px; } th{ width: 200px; } @media (min-width:320px) and (min-width:360px) { .view { padding: 0 !important;
<?php echo CHtml::error($search, 'keywords'); ?> </p> </fieldset> <fieldset id="ticket-form"> <legend><?php echo Yii::t('tickets', 'Ticket Properties'); ?> </legend> <p id="ticket-status" class='inline-input'> <?php echo CHtml::activeLabel($search, 'status'); ?> <?php echo CHtml::activeListBox($search, 'status', CHtml::listData(TicketStatus::model()->findAll(), 'id', 'title'), array('multiple' => 'multiple')); ?> </p> <p id="ticket-priority" class='inline-input'> <?php echo CHtml::activeLabel($search, 'priority'); ?> <?php echo CHtml::activeListBox($search, 'priority', CHtml::listData(TicketPriority::model()->findAll(), 'id', 'title'), array('multiple' => 'multiple')); ?> </p> <p id="ticket-type" class='inline-input'> <?php echo CHtml::activeLabel($search, 'type'); ?> <?php
/** * table data rules * * @return array */ public function rules() { return array(array('status', 'in', 'range' => CHtml::listData(TicketStatus::model()->findAll(), 'id', 'id')), array('type', 'in', 'range' => CHtml::listData(TicketType::model()->findAll(), 'id', 'id')), array('category', 'in', 'range' => CHtml::listData(TicketCategory::model()->findAll(), 'id', 'id')), array('priority', 'in', 'range' => CHtml::listData(TicketPriority::model()->findAll(), 'id', 'id')), array('version', 'in', 'range' => CHtml::listData(TicketVersion::model()->findAll(), 'id', 'id')), array('fixedin', 'in', 'range' => CHtml::listData(TicketVersion::model()->findAll(), 'id', 'id')), array('assignedtoid', 'safe'), array('keywords', 'safe'), array('title', 'required'), array('title', 'length', 'min' => 3, 'max' => 100)); }
public function getStatusbyfilter() { if (in_array(Yii::app()->session['user_data']['user_role_type'], array(0, 1))) { $result = TicketStatus::model()->findAll("status_id !=6"); } else { if (in_array(Yii::app()->session['user_data']['user_role_type'], array(2, 3))) { $result = TicketStatus::model()->findAllByAttributes(array(), array('condition' => 'status_id >:s_id and status_id !=6', 'params' => array('s_id' => 1))); } else { $result = TicketStatus::model()->findAllByAttributes(array(), array('condition' => 'status_id >:s_id and status_id !=6', 'params' => array('s_id' => 2))); } } return $result; }
/** * View single ticket * * @param int $id * @param string $alias */ public function actionViewTicket($id, $alias) { if ($id && ($ticket = Tickets::model()->with(array('reporter', 'assigned', 'status', 'type', 'category', 'ticketpriority', 'version', 'fixed', 'ticketmilestone', 'comments', 'comments.commentreporter', 'comments.changes', 'lastcomment'))->byCommentDate()->findByPk($id))) { // Initiate the ticket comment model $comment = new TicketComments(); $props = new TicketProps(); $ticketChanges = array(); $commentPassed = false; $propsPassed = false; $propertiesPassed = false; // Make sure if we submit the form that we enter a comment if (isset($_POST['TicketComments'])) { $comment->setAttributes($_POST['TicketComments']); $comment->ticketid = $ticket->id; if ($comment->validate()) { $commentPassed = true; } } // Make suer we submitted the form if (isset($_POST['TicketProps'])) { $props->setAttributes($_POST['TicketProps']); if ($props->validate()) { $propsPassed = true; // did we change the title if ($props->title != $ticket->title) { $ticketChanges[] = Yii::t('tickets', '<strong>Title</strong> Changed from <em>{old}</em> To <em>{new}</em>', array('{old}' => $ticket->title, '{new}' => $props->title)); } // did we change the keywords if ($props->keywords != $ticket->keywords) { $ticketChanges[] = Yii::t('tickets', '<strong>Keywords</strong> Changed from <em>{old}</em> To <em>{new}</em>', array('{old}' => $ticket->keywords, '{new}' => $props->keywords)); } // did we change the assigned to if ($props->assignedtoid && $props->assignedtoid != $ticket->assignedtoid) { // Load the users $oldUser = Users::model()->findByPk($ticket->assignedtoid); $newUser = Users::model()->find('username=:username', array(':username' => $props->assignedtoid)); $ticketChanges[] = Yii::t('tickets', '<strong>Assigned</strong> Changed from <em>{old}</em> To <em>{new}</em>', array('{old}' => $oldUser ? $oldUser->getLink() : "''", '{new}' => $newUser ? $newUser->getLink() : "''")); } // Did we change the status if ($props->status && $props->status != $ticket->ticketstatus) { $oldStatus = TicketStatus::model()->findByPk($ticket->ticketstatus); $newStatus = TicketStatus::model()->findByPk($props->status); $ticketChanges[] = Yii::t('tickets', '<strong>Status</strong> Changed from <em>{old}</em> To <em>{new}</em>', array('{old}' => $oldStatus ? $oldStatus->getLink() : "''", '{new}' => $newStatus ? $newStatus->getLink() : "''")); $ticket->ticketstatus = $props->status; } // Did we change the type if ($props->type && $props->type != $ticket->tickettype) { $oldType = TicketType::model()->findByPk($ticket->tickettype); $newType = TicketType::model()->findByPk($props->type); $ticketChanges[] = Yii::t('tickets', '<strong>Type</strong> Changed from <em>{old}</em> To <em>{new}</em>', array('{old}' => $oldType ? $oldType->getLink() : "''", '{new}' => $newType ? $newType->getLink() : "''")); $ticket->tickettype = $props->type; } // Did we change the category if ($props->category && $props->category != $ticket->ticketcategory) { $oldCategory = TicketCategory::model()->findByPk($ticket->ticketcategory); $newCategory = TicketCategory::model()->findByPk($props->category); $ticketChanges[] = Yii::t('tickets', '<strong>Category</strong> Changed from <em>{old}</em> To <em>{new}</em>', array('{old}' => $oldCategory ? $oldCategory->getLink() : "''", '{new}' => $newCategory ? $newCategory->getLink() : "''")); $ticket->ticketcategory = $props->category; } // Did we change the version if ($props->version && $props->version != $ticket->ticketversion) { $oldVersion = TicketVersion::model()->findByPk($ticket->ticketversion); $newVersion = TicketVersion::model()->findByPk($props->version); $ticketChanges[] = Yii::t('tickets', '<strong>Version</strong> Changed from <em>{old}</em> To <em>{new}</em>', array('{old}' => $oldVersion ? $oldVersion->getVersionLink() : "''", '{new}' => $newVersion ? $newVersion->getVersionLink() : "''")); $ticket->ticketversion = $props->version; } // Did we change the fixedin if ($props->fixedin && $props->fixedin != $ticket->fixedin) { $oldFixed = TicketVersion::model()->findByPk($ticket->fixedin); $newFixed = TicketVersion::model()->findByPk($props->fixedin); $ticketChanges[] = Yii::t('tickets', '<strong>Fixed In Version</strong> Changed from <em>{old}</em> To <em>{new}</em>', array('{old}' => $oldFixed ? $oldFixed->getFixedinLink() : "''", '{new}' => $newFixed ? $newFixed->getFixedinLink() : "''")); $ticket->fixedin = $props->fixedin; } // Did we change the priority if ($props->priority && $props->priority != $ticket->priority) { $oldPriority = TicketPriority::model()->findByPk($ticket->priority); $newPriority = TicketPriority::model()->findByPk($props->priority); $ticketChanges[] = Yii::t('tickets', '<strong>Priority</strong> Changed from <em>{old}</em> To <em>{new}</em>', array('{old}' => $oldPriority ? $oldPriority->getLink() : "''", '{new}' => $newPriority ? $newPriority->getLink() : "''")); $ticket->priority = $props->priority; } // Assign props data to ticket $ticket->title = $props->title; $ticket->keywords = $props->keywords; // Reset the ticket assigned to if ($props->assignedtoid) { $ticket->assignedtoid = $props->assignedtoid; } else { $ticket->assignedtoid = (int) $ticket->assignedtoid; } // Make sure we have some changes or at least entered comment if (!$comment->content && !count($ticketChanges)) { $commentPassed = false; Functions::setFlash(Yii::t('tickets', 'You must enter a comment or make some changes to the ticket.')); } // validate ticket if ($ticket->validate()) { $propertiesPassed = true; } } } // Only if all flags were ok then save and update if (isset($_POST['submit']) && $commentPassed && $propsPassed && $propertiesPassed) { // Save both and redirect $comment->save(); // Did we change something? if (count($ticketChanges)) { foreach ($ticketChanges as $change) { $changes = new TicketChanges(); $changes->ticketid = $ticket->id; $changes->commentid = $comment->id; $changes->content = $change; $changes->save(); } } // Save ticket $ticket->lastcommentid = $comment->id; $ticket->update(); // Set flash Functions::setFlash(Yii::t('tickets', 'Tickets: Ticket Updated')); $this->redirect($ticket->getLink('', array(), true)); } // Reset the ticket assigned to if ($props->assignedtoid) { if (is_int($props->assignedtoid)) { $username = Users::model()->findByPk($props->assignedtoid); } else { $username = Users::model()->find('username=:username', array(':username' => $props->assignedtoid)); } $props->assignedtoid = $username ? $username->username : ''; } else { $props->assignedtoid = ''; } // Assign keywords if (!$props->keywords && $ticket->keywords) { $props->keywords = $ticket->keywords; } // Assign Title if (!$props->title && $ticket->title) { $props->title = $ticket->title; } // Show the view screen $this->pageTitle[] = Yii::t('tickets', 'Viewing Ticket - {title}', array('{title}' => CHtml::encode($ticket->title))); $this->render('showticket', array('props' => $props, 'ticket' => $ticket, 'comment' => $comment)); } else { $this->redirect(array('/tickets')); } }
public function actionTicketStatusName() { $ts = $_POST['ticket_status']; $statusName = 'All Tickets'; if ($ts) { $statusName = TicketStatus::model()->getStatusName($ts); } echo $statusName; }
?> </div> <div class='clearboth'></div> <div class='ticket-moreoptions' id='ticketsMoreOptionsHidden'> <div> <fieldset id="ticket-form"> <legend><?php echo Yii::t('tickets', 'Ticket Properties'); ?> </legend> <p id="ticket-status" class='inline-input'> <?php echo CHtml::activeLabel($moderation, 'status'); ?> <?php echo CHtml::activeDropDownList($moderation, 'status', CHtml::listData(TicketStatus::model()->findAll(), 'id', 'title'), array('prompt' => Yii::t('tickets', '-- Select Status --'))); ?> </p> <p id="ticket-priority" class='inline-input'> <?php echo CHtml::activeLabel($moderation, 'priority'); ?> <?php echo CHtml::activeDropDownList($moderation, 'priority', CHtml::listData(TicketPriority::model()->findAll(), 'id', 'title'), array('prompt' => Yii::t('tickets', '-- Select Priority --'))); ?> </p> <p id="ticket-type" class='inline-input'> <?php echo CHtml::activeLabel($moderation, 'type'); ?> <?php
<?php $ts = 0; $statusName = 'All Tickets'; if (isset($_GET['ts'])) { if (isset($_GET['Ticket']['ticket_status'])) { $_GET['ts'] = $_GET['Ticket']['ticket_status']; } $ts = $_GET['ts']; $statusName = TicketStatus::model()->getStatusName($ts); } $this->pageTitle = Yii::app()->name . ' | Manage Ticket'; ?> <div id="hole"> <!-- begin PAGE TITLE AREA --> <div class="row"> <div class="col-lg-12"> <div class="page-title"> <h1> <?php echo "Manage Ticket"; if (isset($_GET['user_id'])) { echo "<small class='text-blue'> Listing For " . Users::model()->getUserName(base64_decode($_GET['user_id'])) . "</small>"; } if (isset($_GET['client'])) { echo "<small class='text-blue'> Listing For " . Users::model()->getUserName(base64_decode($_GET['client'])) . "</small>"; } ?> </h1>
/** * table data rules * * @return array */ public function rules() { return array(array('title, content', 'required'), array('title', 'length', 'min' => 3, 'max' => 100), array('keywords', 'length', 'max' => 100), array('content', 'length', 'min' => 3), array('projectid', 'in', 'range' => array_keys(Projects::model()->getUserProjects(true)), 'allowEmpty' => false, 'on' => 'ticketupdate'), array('ticketstatus', 'in', 'range' => CHtml::listData(TicketStatus::model()->findAll(), 'id', 'id')), array('tickettype', 'in', 'range' => CHtml::listData(TicketType::model()->findAll(), 'id', 'id')), array('ticketcategory', 'in', 'range' => CHtml::listData(TicketCategory::model()->findAll(), 'id', 'id')), array('priority', 'in', 'range' => CHtml::listData(TicketPriority::model()->findAll(), 'id', 'id')), array('ticketversion', 'in', 'range' => CHtml::listData(TicketVersion::model()->findAll(), 'id', 'id')), array('fixedin', 'in', 'range' => CHtml::listData(TicketVersion::model()->findAll(), 'id', 'id')), array('assignedtoid', 'checkAssignedTo')); }
function actionEmailChangeTicketStatus() { $template = Template::getTemplate('ticket_status_changed_mail_template_'); $subject = $template->template_subject; $message = $template->template_content; $results = TicketChangeLog::model()->findAllByAttributes(array(), array('condition' => 'send_mail = :send_mail', 'params' => array('send_mail' => 0))); foreach ($results as $users) { $userdata['user_by'] = Users::model()->getUserName($users->user_id); $userInfo = Users::model()->findByPk($user->fwd_to); $ticket_id = $users->ticket_id; $remark = $users->remark; $userdata['user_by'] = Users::model()->getUserName($users->user_id); $userdata['remark'] = $remark; $userdata['ticket_status_name'] = TicketStatus::model()->getStatusName($users->status_id); $userdata['ticket_id'] = $ticket_id; $userdata['ticket_link'] = Utils::getBaseUrl() . "/ticket/view/" . base64_encode($ticket_id); $assignee = TicketAssign::model()->findAllByAttributes(array(), array('condition' => 'ticket_id = :ticket_id AND fwd_to !=:user_id AND status=1 ', 'params' => array('ticket_id' => $ticket_id, user_id => $users->user_id))); $assigneeby = TicketAssign::model()->findAllByAttributes(array(), array('condition' => 'ticket_id = :ticket_id AND fwd_by !=:user_id AND status=1 ', 'params' => array('ticket_id' => $ticket_id, user_id => $users->user_id), 'group' => "fwd_by")); // For Assignee mail foreach ($assignee as $user) { $userInfo = Users::model()->findByPk($user->fwd_to); $userdata['user_name'] = $userInfo->user_name; $subject = $this->replace($userdata, $subject); $message = $this->replace($userdata, $message); $this->SendMail($userInfo->user_email, $userInfo->user_name, $subject, $message); } // this is fowwarded by foreach ($assigneeby as $user) { $userInfo = Users::model()->findByPk($user->fwd_by); $userdata['user_name'] = $userInfo->user_name; $subject = $this->replace($userdata, $subject); $message = $this->replace($userdata, $message); $this->SendMail($userInfo->user_email, $userInfo->user_name, $subject, $message); } $model = TicketChangeLog::model()->findByPk($users->id); $model->send_mail = 1; $model->update(); } }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return TicketStatus the loaded model * @throws CHttpException */ public function loadModel($id) { $model = TicketStatus::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
/** * table data rules * * @return array */ public function rules() { return array(array('status', 'in', 'range' => CHtml::listData(TicketStatus::model()->findAll(), 'id', 'id')), array('type', 'in', 'range' => CHtml::listData(TicketType::model()->findAll(), 'id', 'id')), array('category', 'in', 'range' => CHtml::listData(TicketCategory::model()->findAll(), 'id', 'id')), array('priority', 'in', 'range' => CHtml::listData(TicketPriority::model()->findAll(), 'id', 'id')), array('version', 'in', 'range' => CHtml::listData(TicketVersion::model()->findAll(), 'id', 'id')), array('fixedin', 'in', 'range' => CHtml::listData(TicketVersion::model()->findAll(), 'id', 'id')), array('assignedtoid', 'checkAssignedTo')); }
echo CHtml::submitButton(Yii::t('global', 'Search'), array('id' => 'searchsubmit')); ?> </div> <div id="suggestions"></div> <?php echo CHtml::endForm(); ?> </li> <li class="widget-container"> <h3><?php echo Yii::t('global', 'Statuses'); ?> </h3> <ul> <?php foreach (TicketStatus::model()->with(array('ticketsCount'))->findAll() as $status) { ?> <li> <?php echo $status->getRssLink(CHtml::image(Yii::app()->themeManager->baseUrl . '/images/atom.gif', 'ATOM'), array('class' => 'atom'), 'atom'); ?> <?php echo $status->getRssLink(CHtml::image(Yii::app()->themeManager->baseUrl . '/images/rss.gif', 'RSS'), array('class' => 'rss')); ?> <?php echo $status->getLink(CHtml::encode($status->title) . ' <small>(' . Yii::app()->format->number($status->ticketsCount) . ')</small>'); ?> </li> <?php } ?>
<div class="row"> <div class="col-md-12"> <div id="statusChangeMsg"></div> </div> <div class="col-md-4" style="border-right: 1px solid rgb(67, 129, 185);"> <div class="row"> <div class="col-md-12"> <h4 class="text-blue">Change Ticket Status</h4> <hr style="margin: 5px 0px;"> <div class="form-group"> <label class="required" style="margin: 8px 0px;">Ticket Status</label> <?php echo CHtml::dropDownlist('status_id', "", CHtml::listData(TicketStatus::model()->getStatusbyfilter(), 'status_id', 'status_name'), array('class' => 'form-control', 'empty' => 'Please Select Status')); ?> <div id="status_error" class="text-red" style="display: none">Please select ticket status.</div> </div> <div class="form-group"> <label class="required" style="margin: 8px 0px;">Remark <span class="required">*</span></label> <?php echo CHtml::textArea('remark_message', '', array('class' => 'form-control', 'placeholder' => 'Remark (if any)', 'style' => 'resize:none;', 'rows' => 5)); ?> <div id="remark_error" class="text-red" style="display: none">Remark cannot be blank.</div> </div> <div class="form-group"> <?php echo CHtml::submitButton('Save Status', array('class' => 'btn btn-green btn-square', 'id' => 'changebtn')); ?> </div> </div> </div>