예제 #1
0
    $total_objects = 0;
    foreach ($pages as $pg) {
        if (isset($pg['objects'])) {
            $total_objects += count($pg['objects']);
        }
    }
    $page = new \Meta\Builder\Page($path, $pageArray);
    // create json of all objects
    $objectsJson = array();
    foreach ((array) $page->objects as $object) {
        if ($object instanceof \Meta\Builder\Object) {
            $objectsJson[] = json_encode($object);
        }
    }
    $side_content = render('builder-objects.php', array('pages' => $pages, 'page_current' => $path, 'count_objects' => $total_objects));
    echo render('builder-manage.php', array('pageLabel' => $page->label, 'pageType' => $page->pageType, 'pageTypes' => \Meta\Builder::pageTypes(), 'pageShowOnMenu' => $page->showonmenu, 'pageParent' => $page->parentmenu, 'pageIcon' => $page->menuIcon, 'pageCheckPerms' => $page->checkperms, 'pageGroupsAllowed' => $page->groupsAllowed, 'pageObjects' => $page->objects, 'pagesList' => \Meta\Builder\Menu::buildSelect(), 'page_name' => $path, 'side_content' => $side_content, 'groupList' => \Meta\Builder::listGroups(), 'componentList' => \Meta\Builder::listComponents(), 'iconList' => bootstrap_glyphicons_list(), 'objectsJson' => $objectsJson, 'rulesList' => json_encode(\Meta\Builder\Conditions::listConditions()), 'cmdsList' => json_encode(\Meta\Builder\Commands::listCmds()), 'validationsList' => json_encode(\Meta\Builder\Validations::listValidations()), 'formattersList' => json_encode(\Meta\Builder\Formatters::listFormatters()), 'framesList' => json_encode(\Meta\Builder::pageNames('frame'))));
});
// re-order page object
route_add('builder/page/reorder/*', function ($page_name) {
    $resp = array();
    $resp['errors'] = array();
    if (is_demo()) {
        $resp['errors'][] = \Meta\Builder::demoMsg();
    }
    if (!$resp['errors']) {
        $pages = \Meta\Builder::read('pages');
        $old_list = $pages[$page_name]['objects'];
        $new_list = array();
        foreach ((array) $_REQUEST['item'] as $key) {
            $new_list[$key] = $old_list[$key];
            $new_list[$key]['id'] = $key;
예제 #2
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();
 }
예제 #3
0
 public function checkErrors()
 {
     // check command errors
     Commands::checkCmds($this->commands);
 }
예제 #4
0
파일: Field.php 프로젝트: moiseh/metapages
 public function checkErrors()
 {
     // check for type-specific errors
     switch ($this->type) {
         case 'select':
         case 'radio':
             if ($this->optionsSql) {
                 $err = \Meta\Builder::sqlError($this->optionsSql);
                 if ($err) {
                     throw new \Exception(t('Error on SQL of field ' . $this->name . ': ' . $err));
                 }
             } else {
                 if ($this->optionsFunction && !function_exists($this->optionsFunction)) {
                     throw new \Exception(t("The public function defined `{$this->optionsFunction}` not exists"));
                 }
             }
             break;
         case 'btn_validated':
         case 'btn_simple':
             if ($this->commands) {
                 \Meta\Builder\Commands::checkCmds($this->commands);
             }
             break;
     }
     // check for validations errors
     foreach ($this->validations as $valid) {
         $valid instanceof Validation;
         $valid->checkErrors();
     }
 }