/**
  * 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());
     }
 }
 /**
  * Transfer ticket infos
  *
  * @param $data ticket data fields
  **/
 function transferTicketAdditionalInformations($data)
 {
     $input = array();
     $suppliers_id_assign = 0;
     if ($data['suppliers_id_assign'] > 0) {
         $suppliers_id_assign = $this->transferSingleSupplier($data['suppliers_id_assign']);
     }
     // Transfer ticket category
     $catid = 0;
     if ($data['ticketcategories_id'] > 0) {
         $categ = new TicketCategory();
         if ($categ->getFromDB($data['ticketcategories_id'])) {
             $inputcat['entities_id'] = $this->to;
             $inputcat['completename'] = $categ->fields['completename'];
             $catid = $categ->findID($inputcat);
             if ($catid < 0) {
                 $catid = $categ->import($inputcat);
             }
         }
     }
     $input['ticketcategories_id'] = $catid;
     return $input;
 }
Example #3
0
 function prepareInputForAdd($input)
 {
     global $CFG_GLPI, $LANG;
     // Check mandatory
     $mandatory_ok = true;
     // Do not check mandatory on auto import (mailgates)
     if (!isset($input['_auto_import'])) {
         $_SESSION["helpdeskSaved"] = $input;
         if (!isset($input["urgency"])) {
             addMessageAfterRedirect($LANG['tracking'][4], false, ERROR);
             $mandatory_ok = false;
         }
         if ($CFG_GLPI["is_ticket_content_mandatory"] && (!isset($input['content']) || empty($input['content']))) {
             addMessageAfterRedirect($LANG['tracking'][8], false, ERROR);
             $mandatory_ok = false;
         }
         if ($CFG_GLPI["is_ticket_title_mandatory"] && (!isset($input['name']) || empty($input['name']))) {
             addMessageAfterRedirect($LANG['help'][40], false, ERROR);
             $mandatory_ok = false;
         }
         if ($CFG_GLPI["is_ticket_category_mandatory"] && (!isset($input['ticketcategories_id']) || empty($input['ticketcategories_id']))) {
             addMessageAfterRedirect($LANG['help'][41], false, ERROR);
             $mandatory_ok = false;
         }
         //          if (isset($input['use_email_notification']) && $input['use_email_notification']
         //              && (!isset($input['user_email']) || empty($input['user_email']))) {
         //
         //             addMessageAfterRedirect($LANG['help'][16], false, ERROR);
         //             $mandatory_ok = false;
         //          }
         if (!$mandatory_ok) {
             return false;
         }
     }
     if (!isset($input["urgency"]) || !($CFG_GLPI['urgency_mask'] & 1 << $input["urgency"])) {
         $input["urgency"] = 3;
     }
     if (!isset($input["impact"]) || !($CFG_GLPI['impact_mask'] & 1 << $input["impact"])) {
         $input["impact"] = 3;
     }
     if (!isset($input["priority"])) {
         $input["priority"] = $this->computePriority($input["urgency"], $input["impact"]);
     }
     unset($_SESSION["helpdeskSaved"]);
     // No Auto set Import for external source
     if (!isset($input['_auto_import'])) {
         if (!isset($input["_users_id_requester"])) {
             if ($uid = getLoginUserID()) {
                 $input["_users_id_requester"] = $uid;
             }
         }
     }
     // set last updater
     if ($lastupdater = getLoginUserID(true)) {
         $input['users_id_lastupdater'] = $lastupdater;
     }
     // No Auto set Import for external source
     if (($uid = getLoginUserID()) && !isset($input['_auto_import'])) {
         $input["users_id_recipient"] = $uid;
     } else {
         if (isset($input["_users_id_requester"]) && $input["_users_id_requester"]) {
             $input["users_id_recipient"] = $input["_users_id_requester"];
         }
     }
     if (!isset($input["requesttypes_id"])) {
         $input["requesttypes_id"] = RequestType::getDefault('helpdesk');
     }
     if (!isset($input["status"])) {
         $input["status"] = "new";
     }
     if (!isset($input['global_validation'])) {
         $input['global_validation'] = 'none';
     }
     if (!isset($input["date"]) || empty($input["date"])) {
         $input["date"] = $_SESSION["glpi_currenttime"];
     }
     if (!isset($input["_users_id_assign"])) {
         $input["_users_id_assign"] = 0;
     }
     if (!isset($input["_groups_id_assign"])) {
         $input["_groups_id_assign"] = 0;
     }
     // Set default dropdown
     $dropdown_fields = array('entities_id', 'items_id', 'suppliers_id_assign', 'ticketcategories_id');
     foreach ($dropdown_fields as $field) {
         if (!isset($input[$field])) {
             $input[$field] = 0;
         }
     }
     if (!isset($input['itemtype']) || !($input['items_id'] > 0)) {
         $input['itemtype'] = '';
     }
     $item = NULL;
     if ($input["items_id"] > 0 && !empty($input["itemtype"])) {
         if (class_exists($input["itemtype"])) {
             $item = new $input["itemtype"]();
             if (!$item->getFromDB($input["items_id"])) {
                 $item = NULL;
             }
         }
     }
     // Auto group define from item
     //       if ($item != NULL) {
     //          if ($item->isField('groups_id')
     //              && (!isset($input["_groups_id_requester"]) || $input["_groups_id_requester"]==0)) {
     //             $input["_groups_id_requester"] = $item->getField('groups_id');
     //          }
     //       }
     // Manage auto assign
     $entitydata = new EntityData();
     $auto_assign_mode = $CFG_GLPI['auto_assign_mode'];
     if ($entitydata->getFromDB($input['entities_id'])) {
         $auto_assign_mode = $entitydata->getField('auto_assign_mode');
         // Set global config value
         if ($auto_assign_mode == -1) {
             $auto_assign_mode = $CFG_GLPI['auto_assign_mode'];
         }
     }
     switch ($auto_assign_mode) {
         case NO_AUTO_ASSIGN:
             break;
         case AUTO_ASSIGN_HARDWARE_CATEGORY:
             // Auto assign tech from item
             if ($input["_users_id_assign"] == 0 && $item != NULL) {
                 if ($item->isField('users_id_tech')) {
                     $input["_users_id_assign"] = $item->getField('users_id_tech');
                     if ($input["_users_id_assign"] > 0) {
                         $input["status"] = "assign";
                     }
                 }
             }
             // Auto assign tech/group from Category
             if ($input['ticketcategories_id'] > 0 && (!$input['_users_id_assign'] || !$input['_groups_id_assign'])) {
                 $cat = new TicketCategory();
                 $cat->getFromDB($input['ticketcategories_id']);
                 if (!$input['_users_id_assign'] && $cat->isField('users_id')) {
                     $input['_users_id_assign'] = $cat->getField('users_id');
                 }
                 if (!$input['_groups_id_assign'] && $cat->isField('groups_id')) {
                     $input['_groups_id_assign'] = $cat->getField('groups_id');
                 }
             }
             break;
         case AUTO_ASSIGN_CATEGORY_HARDWARE:
             // Auto assign tech/group from Category
             if ($input['ticketcategories_id'] > 0 && (!$input['_users_id_assign'] || !$input['_groups_id_assign'])) {
                 $cat = new TicketCategory();
                 $cat->getFromDB($input['ticketcategories_id']);
                 if (!$input['_users_id_assign'] && $cat->isField('users_id')) {
                     $input['_users_id_assign'] = $cat->getField('users_id');
                 }
                 if (!$input['_groups_id_assign'] && $cat->isField('groups_id')) {
                     $input['_groups_id_assign'] = $cat->getField('groups_id');
                 }
             }
             // Auto assign tech from item
             if ($input["_users_id_assign"] == 0 && $item != NULL) {
                 if ($item->isField('users_id_tech')) {
                     $input["_users_id_assign"] = $item->getField('users_id_tech');
                     if ($input["_users_id_assign"] > 0) {
                         $input["status"] = "assign";
                     }
                 }
             }
             break;
     }
     // Process Business Rules
     $rules = new RuleTicketCollection($input['entities_id']);
     // Set unset variables with are needed
     $user = new User();
     if (isset($input["_users_id_requester"]) && $user->getFromDB($input["_users_id_requester"])) {
         $input['users_locations'] = $user->fields['locations_id'];
     }
     $input = $rules->processAllRules($input, $input, array('recursive' => true));
     //       if (isset($input["use_email_notification"])
     //           && $input["use_email_notification"]
     //           && empty($input["user_email"])) {
     //
     //          if ($user->getFromDB($input["users_id"])) {
     //             $input["user_email"] = $user->fields["email"];
     //          }
     //       }
     if ((isset($input["_users_id_assign"]) && $input["_users_id_assign"] > 0 || isset($input["_groups_id_assign"]) && $input["_groups_id_assign"] > 0 || isset($input["suppliers_id_assign"]) && $input["suppliers_id_assign"] > 0) && $input["status"] == "new") {
         $input["status"] = "assign";
     }
     if (isset($input["hour"]) && isset($input["minute"])) {
         $input["actiontime"] = $input["hour"] * HOUR_TIMESTAMP + $input["minute"] * MINUTE_TIMESTAMP;
         $input["_hour"] = $input["hour"];
         $input["_minute"] = $input["minute"];
         unset($input["hour"]);
         unset($input["minute"]);
     }
     if (isset($input["status"]) && $input["status"] == "solved") {
         if (isset($input["date"])) {
             $input["solvedate"] = $input["date"];
         } else {
             $input["solvedate"] = $_SESSION["glpi_currenttime"];
         }
     }
     if (isset($input["status"]) && $input["status"] == "closed") {
         if (isset($input["date"])) {
             $input["closedate"] = $input["date"];
         } else {
             $input["closedate"] = $_SESSION["glpi_currenttime"];
         }
         $input['solvedate'] = $input["closedate"];
     }
     // Set begin waiting time if status is waiting
     if (isset($input["status"]) && $input["status"] == "waiting") {
         $input['begin_waiting_date'] = $input['date'];
     }
     // No name set name
     if (empty($input["name"])) {
         $input["name"] = preg_replace('/\\r\\n/', ' ', $input['content']);
         $input["name"] = preg_replace('/\\n/', ' ', $input['name']);
         $input["name"] = utf8_substr($input['name'], 0, 70);
     }
     //// Manage SLA assignment
     // due date defined : no SLA
     if (isset($input["due_date"]) && $input['due_date'] != 'NULL') {
         // Valid due date
         if ($input['due_date'] > $input['date']) {
             if (isset($input["slas_id"])) {
                 unset($input["slas_id"]);
             }
         } else {
             // Unset due date
             unset($input["due_date"]);
         }
     }
     if (isset($input["slas_id"]) && $input["slas_id"] > 0) {
         $sla = new SLA();
         if ($sla->getFromDB($input["slas_id"])) {
             // Get first SLA Level
             $input["slalevels_id"] = SlaLevel::getFirstSlaLevel($input["slas_id"]);
             // Compute due_date
             $input['due_date'] = $sla->computeDueDate($input['date']);
             $input['sla_waiting_duration'] = 0;
         } else {
             $input["slalevels_id"] = 0;
             $input["slas_id"] = 0;
             $input['sla_waiting_duration'] = 0;
         }
     }
     // auto set type if not set
     if (!isset($input["type"])) {
         $input['type'] = EntityData::getUsedConfig('tickettype', $input['entities_id']);
     }
     return $input;
 }
Example #4
0
 /**
  * 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));
 }
Example #5
0
?>
                    </p>
                    <p id="ticket-type" class='inline-input'>
                    	<?php 
echo CHtml::activeLabel($search, 'type');
?>
                    	<?php 
echo CHtml::activeListBox($search, 'type', CHtml::listData(TicketType::model()->findAll(), 'id', 'title'), array('multiple' => 'multiple'));
?>
                    </p>
                    <p id="ticket-category" class='inline-input'>
                    	<?php 
echo CHtml::activeLabel($search, 'category');
?>
                    	<?php 
echo CHtml::activeListBox($search, 'category', CHtml::listData(TicketCategory::model()->findAll(), 'id', 'title'), array('multiple' => 'multiple'));
?>
                    </p>
                    <p id="ticket-version" class='inline-input'>
                    	<?php 
echo CHtml::activeLabel($search, 'version');
?>
                    	<?php 
echo CHtml::activeListBox($search, 'version', CHtml::listData(TicketVersion::model()->findAll(), 'id', 'title'), array('multiple' => 'multiple'));
?>
                    </p>
                    <p id="ticket-fixedin" class='inline-input'>
                    	<?php 
echo CHtml::activeLabel($search, 'fixedin');
?>
                    	<?php 
Example #6
0
 /**
  * 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'));
     }
 }
Example #7
0
?>
                        </p>
                        <p id="ticket-type" class='inline-input'>
                        	<?php 
echo CHtml::activeLabel($moderation, 'type');
?>
                        	<?php 
echo CHtml::activeDropDownList($moderation, 'type', CHtml::listData(TicketType::model()->findAll(), 'id', 'title'), array('prompt' => Yii::t('tickets', '-- Select Type --')));
?>
                        </p>
                        <p id="ticket-category" class='inline-input'>
                        	<?php 
echo CHtml::activeLabel($moderation, 'category');
?>
                        	<?php 
echo CHtml::activeDropDownList($moderation, 'category', CHtml::listData(TicketCategory::model()->findAll(), 'id', 'title'), array('prompt' => Yii::t('tickets', '-- Select Category --')));
?>
                        </p>
                        <p id="ticket-version" class='inline-input'>
                        	<?php 
echo CHtml::activeLabel($moderation, 'version');
?>
                        	<?php 
echo CHtml::activeDropDownList($moderation, 'version', CHtml::listData(TicketVersion::model()->findAll(), 'id', 'title'), array('prompt' => Yii::t('tickets', '-- Select Version --')));
?>
                        </p>
                        <p id="ticket-fixedin" class='inline-input'>
                        	<?php 
echo CHtml::activeLabel($moderation, 'fixedin');
?>
                        	<?php 
Example #8
0
 /**
  * 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'));
 }
 /**
  * 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'));
 }
Example #10
0
        echo $milestone->getLink(CHtml::encode($milestone->title) . ' <small>(' . Yii::app()->format->number($milestone->ticketsCount) . ')</small>');
        ?>
                                </li>
                                <?php 
    }
    ?>
							</ul> 
		              </li>
		              <li class="widget-container">
		                  <h3><?php 
    echo Yii::t('global', 'Categories');
    ?>
</h3>
		                      <ul>
								<?php 
    foreach (TicketCategory::model()->with(array('ticketsCount'))->findAll() as $category) {
        ?>
    							<li>
                                    <?php 
        echo $category->getRssLink(CHtml::image(Yii::app()->themeManager->baseUrl . '/images/atom.gif', 'ATOM'), array('class' => 'atom'), 'atom');
        ?>
                                    <?php 
        echo $category->getRssLink(CHtml::image(Yii::app()->themeManager->baseUrl . '/images/rss.gif', 'RSS'), array('class' => 'rss'));
        ?>
                                    <?php 
        echo $category->getLink(CHtml::encode($category->title) . ' <small>(' . Yii::app()->format->number($category->ticketsCount) . ')</small>');
        ?>
                                </li>
                                <?php 
    }
    ?>