/** * returns the a list of log files for the data grid */ public function emailLogsAction() { $list = new Document_Email_Log_List(); if ($this->_getParam('documentId')) { $list->setCondition('documentId = ' . (int) $this->_getParam('documentId')); } $list->setLimit($this->_getParam("limit")); $list->setOffset($this->_getParam("start")); $list->setOrderKey("sentDate"); if ($this->_getParam('filter')) { if ($this->_getParam("filter")) { $filterTerm = $list->quote("%" . strtolower($this->_getParam("filter")) . "%"); $list->setCondition(" `from` LIKE " . $filterTerm . " OR\r\n `to` LIKE " . $filterTerm . " OR\r\n `cc` LIKE " . $filterTerm . " OR\r\n `bcc` LIKE " . $filterTerm . " OR\r\n `subject` LIKE " . $filterTerm . " OR\r\n `params` LIKE " . $filterTerm . "\r\n "); } } $list->setOrder("DESC"); $data = $list->load(); $jsonData = array(); if (is_array($data)) { foreach ($data as $entry) { $tmp = (array) get_object_vars($entry); unset($tmp['bodyHtml']); unset($tmp['bodyText']); $jsonData[] = $tmp; } } $this->_helper->json(array("data" => $jsonData, "success" => true, "total" => $list->getTotalCount())); }
/** * Deletes the object (and data) from database * * @return void */ public function delete() { try { $this->deleteAllProperties(); $this->db->delete("documents_page", $this->db->quoteInto("id = ?", $this->model->getId())); $this->db->delete("documents_email", $this->db->quoteInto("id = ?", $this->model->getId())); //deleting log files $mailLogs = new Document_Email_Log_List(); $mailLogs->setCondition(" documentId= " . $this->model->getId()); foreach ($mailLogs->load() as $logEntry) { $logEntry->delete(); } parent::delete(); } catch (Exception $e) { throw $e; } }
/** * returns the a list of log files for the data grid */ public function emailLogsAction() { $list = new Document_Email_Log_List(); if ($this->_getParam('documentId')) { $list->setCondition('documentId = ' . (int) $this->_getParam('documentId')); } $list->setLimit($this->_getParam("limit")); $list->setOffset($this->_getParam("start")); $list->setOrderKey("sentDate"); $list->setOrder("DESC"); $data = $list->load(); $jsonData = array(); if (is_array($data)) { foreach ($data as $entry) { $tmp = (array) get_object_vars($entry); unset($tmp['bodyHtml']); unset($tmp['bodyText']); $jsonData[] = $tmp; } } $this->_helper->json(array("data" => $jsonData, "success" => true, "total" => $list->getTotalCount())); }