示例#1
0
 public function __construct($meta = array())
 {
     // commands
     $this->commands = array();
     if (isset($meta['commands'])) {
         foreach ($meta['commands'] as $cmd) {
             $this->commands[] = new Command($cmd);
         }
     }
     parent::__construct($meta);
 }
示例#2
0
 public function checkErrors()
 {
     // check for the linked frame page
     if ($this->linkedPage) {
         $pages = \Meta\Builder::read('pages');
         if (!isset($pages[$this->linkedPage])) {
             throw new \Exception(t('The page defined as sub-frame `' . $this->linkedPage . '` not exists'));
         } else {
             if ($pages[$this->linkedPage]['pageType'] != 'frame') {
                 throw new \Exception(t('The associated page frame (page ' . $this->linkedPage . ') not has been defined of type FRAME.'));
             }
         }
     }
     // test for urls and substitutions
     \Meta\Builder::replaceURL($this->extraArgs);
     parent::checkErrors();
 }
示例#3
0
文件: View.php 项目: moiseh/metapages
 public function checkErrors()
 {
     // check template
     if ($this->templateFile) {
         $file = abspath('views/' . $this->templateFile);
         if (!file_exists($file)) {
             throw new \Exception(t("The template '{$this->templateFile}' not found."));
         }
     }
     // sql query errors
     if ($this->query) {
         $error = \Meta\Builder::sqlError($this->query);
         if ($error) {
             throw new \Exception($error);
         }
     }
     parent::checkErrors();
 }
示例#4
0
文件: Form.php 项目: moiseh/metapages
 public function checkErrors()
 {
     // check if form has defined at least one submit button
     foreach ($this->fields as $field) {
         $field instanceof Field;
         if (in_array($field->type, array('btn_validated', 'btn_simple'))) {
             break;
         }
         if ($field === end($this->fields)) {
             throw new \Exception(t('A form has been found with no buttons defined. This makes sense?'));
         }
     }
     // check form fields
     foreach ($this->fields as $field) {
         $field instanceof Field;
         $field->checkErrors();
     }
     // check Command errors
     Commands::checkCmds($this->onLoad);
     parent::checkErrors();
 }