예제 #1
0
 public function __construct($view, $model, $lang, $conf)
 {
     \bootstrap::iniControllerParams($this, $view);
     if (request::isGet() && $model->validateBefore()) {
         $pages = new pdo\select('page');
         $pages->setColumns(array('page.id', 'page.sequence', 'page.uri', 'page.label', 'page.title', 'page.heading', 'page.description', 'page.content', 'page.icon', 'page.dateCreated', 'page.dateUpdated', 'page.isActive', 'p.id AS parentPageId', 'p.uri AS uriParent', 'p.label AS parentPageTitle'))->addJoin('p', 'id', 'parentId', 'LEFT', true, 'page')->addWhere('page.id', '=', request::get('id'))->execute('fetch');
         $view->editData = $pages->data;
     }
     $page = new pdo\select('page');
     $page->setColumns(array('*'))->addWhere('parentId', '=', 0)->addWhere('isActive', '=', 1)->addWhere('uri', '!=', 'about')->orderBy('page.sequence', 'asc')->count()->execute();
     $view->navItems = $page->data;
     $page = new pdo\select('page');
     $page->setColumns(array('
         page.id, 
         page.uri, 
         page.label, 
         page.title, 
         page.description, 
         page.content'))->addJoin('page_role', 'pageId', 'id', 'RIGHT')->addWhere('uri', '=', 'add')->addWhere('page_role.roleId', '=', session::get('roleId'))->execute('fetch');
     $view->page = $page->data;
     $page = new pdo\select('page');
     $page->setColumns(array('
         id, 
         label'))->orderBy('sequence', 'asc')->execute()->asList('id', 'label');
     $view->lookupPageParent = $page->data;
     if (request::isPost()) {
         if ($model->validateAfter()) {
             $data = array('parentId' => request::get('parentId'), 'sequence' => request::get('sequence'), 'uri' => request::get('uri'), 'label' => request::get('label'), 'title' => request::get('title'), 'heading' => request::get('heading'), 'description' => request::get('description'), 'icon' => request::get('icon'), 'content' => request::get('content'), 'dateUpdated' => date('Y-m-d H:i:s'));
             $page = new pdo\insert('page');
             $page->setColumns(array_keys($data))->setValues(array_values($data))->execute();
             $view->data = $data;
         } else {
             $view->errors = $model->getErrors();
         }
     }
     $navSub = new pdo\select('page');
     $navSub->setColumns(array('
         page.id, 
         page.uri, 
         page.label, 
         page.title, 
         page.icon, 
         page.description, 
         page.content,
         p.id AS parentPageId,
         p.uri AS uriParent,
         p.label AS parentPageTitle'))->addJoin('p', 'id', 'parentId', 'LEFT', true, 'page')->addJoin('page_role', 'pageId', 'id', 'RIGHT')->addWhere('page_role.isNav', '=', 1)->addWhere('page_role.roleId', '=', session::get('roleId'))->orderBy('page.sequence', 'asc')->execute();
     // echo '<pre>';
     //print_r($navSub->data);
     //die('kj');
     $view->navSub = $navSub->data;
 }
예제 #2
0
 /**
  * Load captcha class
  *
  * @return void
  */
 private function iniViewCaptcha()
 {
     $captchaSessionName = implode('-', url::getSegments());
     $captcha = captcha::load();
     \lib\session::set($captchaSessionName, $captcha->code);
     $captcha->create();
 }
예제 #3
0
 public function __construct($view, $model, $locale, $conf)
 {
     request::load();
     session::load();
 }