Пример #1
0
 public function getStatusText()
 {
     $states = AW_Helpdeskultimate_Model_Status::getOptionArray();
     return @$states[$this->getStatus()];
 }
Пример #2
0
 protected function _prepareColumns()
 {
     $this->addColumn('uid', array('header' => $this->__('ID'), 'align' => 'right', 'width' => '50px', 'index' => 'uid', 'column_css_class' => 'aw-hduat-ticket_uid'));
     $this->addColumn('created_time', array('header' => $this->__('Created'), 'align' => 'left', 'width' => '140px', 'index' => 'created_time', 'type' => 'datetime', 'column_css_class' => 'aw-hduat-ticket_created_time'));
     $this->addColumn('last_reply', array('header' => $this->__('Last reply'), 'align' => 'left', 'width' => '140px', 'index' => 'last_reply', 'type' => 'datetime', 'column_css_class' => 'aw-hduat-ticket_last_reply'));
     if (Mage::getStoreConfig(self::XML_PATH_LAST_CUSTOMER_REPLY_ENABLED)) {
         $this->addColumn('last_customer_reply', array('header' => $this->__('Last customer reply'), 'align' => 'left', 'width' => '140px', 'index' => 'last_customer_reply', 'type' => 'datetime', 'column_css_class' => 'aw-hduat-ticket_last_customer_reply'));
     }
     if (Mage::getStoreConfig(self::XML_PATH_LAST_DEPARTMENT_REPLY_ENABLED)) {
         $this->addColumn('last_department_reply', array('header' => $this->__('Last department reply'), 'align' => 'left', 'width' => '140px', 'index' => 'last_department_reply', 'type' => 'datetime', 'column_css_class' => 'aw-hduat-ticket_last_department_reply'));
     }
     $options = Mage::getModel('helpdeskultimate/source_departments')->getFlatOptions();
     $role = Mage::getSingleton('admin/session')->getUser()->getRole();
     $departmentPermissions = Mage::getModel('helpdeskultimate/department_permissions')->loadByRoleId($role->getId());
     if (!is_null($departmentPermissions->getId())) {
         foreach ($options as $key => $item) {
             if (!in_array($key, $departmentPermissions->getValue())) {
                 unset($options[$key]);
             }
         }
     }
     $this->addColumn('department_id', array('header' => $this->__('Department'), 'index' => 'department_id', 'type' => 'options', 'options' => $options, 'column_css_class' => 'aw-hduat-ticket_department_id'));
     $this->addColumn('title', array('renderer' => 'helpdeskultimate/adminhtml_widget_grid_column_renderer_title', 'header' => $this->__('Title'), 'align' => 'left', 'width' => '300px', 'truncate' => 100, 'index' => 'title', 'column_css_class' => 'aw-hduat-ticket_title'));
     if (!$this->_userMode) {
         $this->addColumn('customer_name', array('header' => $this->__('Customer'), 'align' => 'left', 'index' => 'customer_name', 'column_css_class' => 'aw-hduat-ticket_customer_name'));
     }
     $_filterIndex = 'CONCAT("by ", u.firstname," ",u.lastname," at ", locked_at)';
     $this->addColumn('locked_name', array('renderer' => 'helpdeskultimate/adminhtml_widget_grid_column_renderer_lock', 'header' => $this->__('Lock'), 'align' => 'left', 'index' => 'locked_name', 'filter_index' => $_filterIndex, 'type' => 'options', 'options' => Mage::getModel('helpdeskultimate/source_lock')->toOptionArray(), 'column_css_class' => 'aw-hduat-ticket_locked_name', 'filter_condition_callback' => array($this, '_filterLock')));
     $this->addColumn('total_replies', array('header' => $this->__('Replies'), 'align' => 'left', 'index' => 'total_replies', 'column_css_class' => 'aw-hduat-ticket_total_replies'));
     $this->addColumn('status', array('header' => $this->__('Status'), 'align' => 'left', 'width' => '80px', 'index' => 'status', 'type' => 'options', 'options' => AW_Helpdeskultimate_Model_Status::getOptionArray(), 'column_css_class' => 'aw-hduat-ticket_status'));
     $this->getColumnRenderers();
     $this->addColumn('priority', array('header' => $this->__('Priority'), 'align' => 'left', 'width' => '80px', 'index' => 'priority', 'renderer' => 'helpdeskultimate/adminhtml_widget_grid_column_renderer_priority', 'type' => 'options', 'options' => Mage::getModel('helpdeskultimate/source_ticket_priority')->getOptionArray(), 'column_css_class' => 'aw-hduat-priority'));
     if (!$this->_userMode) {
         $this->addColumn('action', array('header' => $this->__('Actions'), 'width' => '40', 'type' => 'action', 'getter' => 'getId', 'actions' => array(array('caption' => $this->__('Reply'), 'url' => array('base' => '*/ticket/edit', 'params' => $this->_getParams()), 'field' => 'id')), 'filter' => false, 'sortable' => false, 'index' => 'stores', 'is_system' => true));
         $actions = array();
         $stores = Mage::getModel('core/store')->getCollection()->getAllIds();
         foreach ($stores as $storeId) {
             $actions[$storeId] = Mage::getSingleton('helpdeskultimate/status')->getOptionsArrayFor($storeId);
         }
         $this->addColumn('staction', array('header' => $this->__('New Status'), 'width' => '100', 'type' => 'action', 'renderer' => 'helpdeskultimate/adminhtml_widget_grid_column_renderer_statusaction', 'getter' => 'getId', 'actions' => $actions, 'props' => array('url' => array('base' => '*/index/customStatus', 'params' => $this->_getParams()), 'field' => 'id'), 'filter' => false, 'sortable' => false, 'index' => 'stores', 'is_system' => true));
     }
     return parent::_prepareColumns();
 }