/** * @param AW_Helpdesk3_Model_Ticket $ticket * * @return false */ public function isEventHappened($ticket) { if (!$ticket->isObjectNew() && $ticket->getOrigData('status') != $ticket->getStatus()) { $this->setEventData(array('from' => $ticket->getOrigData('status'), 'to' => $ticket->getStatus())); return true; } return false; }
/** * @param AW_Helpdesk3_Model_Ticket $ticket * * @return string */ public function getStyleForTicketStatus(AW_Helpdesk3_Model_Ticket $ticket) { if ($this->_statusCacheData === null) { /** @var AW_Helpdesk3_Model_Resource_Ticket_Status_Collection $collection */ $collection = Mage::getModel('aw_hdu3/ticket_status')->getCollection()->addNotDeletedFilter(); foreach ($collection->getData() as $value) { $this->_statusCacheData[$value['id']] = $value; } } $statusId = (int) $ticket->getStatus(); if (!array_key_exists($statusId, $this->_statusCacheData)) { return ''; } $style = ''; if (!empty($this->_statusCacheData[$statusId]['background_color'])) { $bgColor = $this->_statusCacheData[$statusId]['background_color']; $bgColor = strpos($bgColor, '#') === FALSE ? '#' . $bgColor : $bgColor; $style .= "background-color:{$bgColor};"; } if (!empty($this->_statusCacheData[$statusId]['font_color'])) { $textColor = $this->_statusCacheData[$statusId]['font_color']; $textColor = strpos($textColor, '#') === FALSE ? '#' . $textColor : $textColor; $style .= "color:{$textColor};"; } return $style; }