Пример #1
0
 /**
  * แสดงผล
  */
 public function render($login)
 {
     // send email form
     $form = Html::create('form', array('id' => 'write_frm', 'class' => 'setup_frm', 'action' => 'index.php/index/model/sendmail/save', 'onsubmit' => 'doFormSubmit', 'token' => true, 'ajax' => true));
     $fieldset = $form->add('fieldset', array('title' => '{LNG_Details of} {LNG_Email}'));
     // reciever
     $reciever = self::$request->get('to')->topic();
     $fieldset->add('text', array('id' => 'reciever', 'itemClass' => 'item', 'labelClass' => 'g-input icon-email-sent', 'label' => '{LNG_Reciever}', 'comment' => '{LNG_Recipient's Email Address Many can be found Each separated by, (comma).}', 'autofocus', 'value' => $reciever));
     // email_from
     $datas = array($login['email'] => $login['email']);
     if (Login::isAdmin() && empty($login['fb'])) {
         $datas[self::$cfg->noreply_email] = self::$cfg->noreply_email;
         foreach (\Index\Sendmail\Model::findAdmin(self::$request) as $item) {
             $datas[$item] = $item;
         }
     }
     $fieldset->add('select', array('id' => 'from', 'itemClass' => 'item', 'labelClass' => 'g-input icon-email', 'label' => '{LNG_Sender}', 'options' => $datas));
     // subject
     $fieldset->add('text', array('id' => 'subject', 'itemClass' => 'item', 'labelClass' => 'g-input icon-edit', 'label' => '{LNG_Subject}', 'comment' => '' . '{LNG_Please fill in} {LNG_Subject}'));
     // detail
     $fieldset->add('ckeditor', array('id' => 'detail', 'itemClass' => 'item', 'height' => 300, 'language' => Language::name(), 'toolbar' => 'Email', 'label' => '{LNG_Detail}', 'value' => Template::load('', '', 'mailtemplate')));
     $fieldset = $form->add('fieldset', array('class' => 'submit'));
     // submit
     $fieldset->add('submit', array('class' => 'button ok large', 'value' => '{LNG_Send message}'));
     return $form->render();
 }
Пример #2
0
 /**
  * Class constructor.
  */
 public function __construct()
 {
     try {
         $this->breadcrumb_template = Template::load('', '', 'breadcrumb');
     } catch (\Exception $exc) {
         $this->breadcrumb_template = '';
     }
 }
Пример #3
0
 /**
  * แสดงผล
  *
  * @param Request $request
  */
 public function index(Request $request)
 {
     // เริ่มต้นการใช้งาน Template
     Template::init(self::$cfg->skin);
     // ถ้าไม่มีโมดูลเลือกหน้า home
     $module = $request->get('module', 'home')->toString();
     // สร้าง View
     $view = new \Kotchasan\View();
     // template default
     $view->setContents(array('/{MENU}/' => createClass('Index\\Menu\\Controller')->render($module), '/{TITLE}/' => self::$cfg->web_title, '/{CONTENT}/' => Template::load('', '', $module), '/{TIME}/' => Date::format()));
     // ส่งออกเป็น HTML
     echo $view->renderHTML();
 }
Пример #4
0
 /**
  * GLoader
  *
  * @param Request $request
  */
 public function index(Request $request)
 {
     // session cookie
     $request->initSession();
     // กำหนด skin ให้กับ template
     Template::init(self::$cfg->skin);
     // ตรวจสอบโมดูลที่เรียก
     $index = \Index\Export\Model::module($request->get('module')->toString());
     if ($index) {
         $className = ucfirst($index->owner) . '\\Export\\Controller';
         if (method_exists($className, 'init')) {
             $detail = createClass($className)->init($request, $index);
         }
         if ($detail != '') {
             $view = new \Kotchasan\View();
             $view->setContents(array('/{CONTENT}/' => $detail));
             echo $view->renderHTML(Template::load('', '', 'print'));
             exit;
         }
     }
     // ไม่พบโมดูลหรือไม่มีสิทธิ
     new \Kotchasan\Http\NotFound();
 }
Пример #5
0
 /**
  * ส่งออกเป็น HTML
  *
  * @param string|null $template HTML Template ถ้าไม่กำหนด (null) จะใช้ index.html
  */
 public function renderHTML($template = null)
 {
     // default for template
     if (!empty($this->metas)) {
         $this->contents['/(<head.*)(<\\/head>)/isu'] = '$1' . implode("\n", $this->metas) . "\n" . '$2';
     }
     $this->contents['/{LNG_([^}]+)}/e'] = '\\Kotchasan\\Language::get(array(1=>"$1"))';
     $this->contents['/{WEBTITLE}/'] = self::$cfg->web_title;
     $this->contents['/{WEBDESCRIPTION}/'] = self::$cfg->web_description;
     $this->contents['/{WEBURL}/'] = WEB_URL;
     $this->contents['/{SKIN}/'] = Template::$src;
     $this->contents['/{LANGUAGE}/'] = \Kotchasan\Language::name();
     $this->contents['/^[\\s\\t]+/m'] = '';
     foreach ($this->after_contents as $key => $value) {
         $this->contents[$key] = $value;
     }
     // แทนที่ลงใน Template
     if ($template === null) {
         // ถ้าไม่ได้กำหนดมาใช้ index.html
         $template = Template::load('', '', 'index');
     }
     return Template::pregReplace(array_keys($this->contents), array_values($this->contents), $template);
 }