public function listTemplateAction() { $templates = Axis_Collect_MailTemplate::collect(); $data = array(); $i = 0; foreach ($templates as $templateKey => $template) { $data[$i] = array('name' => $template, 'id' => $templateKey); $i++; } return $this->_helper->json->setData($data)->sendSuccess(); }
/** * Retrieve template info by id * * @param int $id * @return array */ public function getInfo($id) { if (!is_numeric($id) || !($info = $this->find($id)->current())) { Axis::message()->addError(Axis::translate('core')->__('Template not found')); return array(); } $info = $info->toArray(); $templates = Axis_Collect_MailTemplate::collect(); $file = Axis::config()->system->path . '/app/design/mail/' . $templates[$info['template']] . '_' . $info['type'] . '.phtml'; $content = ''; if (is_readable($file)) { $content = @file_get_contents($file); } $info['content'] = $content; return $info; }