public function getNotProcessedCount() { $db = RM_Entity::getDb(); /* @var Zend_Db_Select $select */ $select = Application_Model_Feedback::_getSelect(); $select->where('isProcessed = 0'); $select->columns(array('COUNT(*) as notProcessedCount')); if ($result = $db->fetchRow($select)) { return (int) $result->notProcessedCount; } else { return 0; } }
protected function __setData(stdClass $data) { $this->__setContentFields(); $this->_entity->setVisitorName($data->visitor_name); $this->_entity->setVisitorPhone($data->visitor_phone); $this->_entity->setContent($data->feedback_content); try { $this->_entity->setDatePosted(RM_Date_Datetime::fromString($data->date_posted)); } catch (Exception $e) { throw new Exception('Неверная дата'); } $this->_entity->setShownOnMain((bool) $data->show_on_main); }
public function postFeedbackAction() { $this->_setResponseJSON(); $this->_result->status = 0; if ($this->getRequest()->isPost() && isset($this->_data)) { $data = $this->_data; $feedback = Application_Model_Feedback::create(); try { $feedback->setVisitorName($data->visitor_name); $feedback->setVisitorPhone($data->visitor_phone); $feedback->setContent($data->visitor_feedback); $feedback->setDatePosted(RM_Date_Datetime::now()); $feedback->setProcessed(false); $feedback->save(); $this->_result->status = 1; } catch (Exception $e) { } } }