/** * returns the a list of log files for the data grid */ public function emailLogsAction() { if (!$this->getUser()->isAllowed("emails")) { throw new \Exception("Permission denied, user needs 'emails' permission."); } $list = new Tool\Email\Log\Listing(); 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("%" . mb_strtolower($this->getParam("filter")) . "%"); $condition = "(`from` LIKE " . $filterTerm . " OR\n `to` LIKE " . $filterTerm . " OR\n `cc` LIKE " . $filterTerm . " OR\n `bcc` LIKE " . $filterTerm . " OR\n `subject` LIKE " . $filterTerm . " OR\n `params` LIKE " . $filterTerm . ")"; if ($this->getParam('documentId')) { $condition .= "AND documentId = " . (int) $this->getParam('documentId'); } $list->setCondition($condition); } } $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())); }