Esempio n. 1
0
 public static function buildSelect()
 {
     $menu = new self();
     $menu->checkPermissions = false;
     $pages = \Meta\Builder::read('pages');
     $items = $menu->buildItems($pages);
     return $menu->buildMenuHierarchy($items);
 }
Esempio n. 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();
 }
Esempio n. 3
0
 public static function pageExists($page)
 {
     $pages = \Meta\Builder::read('pages');
     return isset($pages[$page]);
 }
Esempio n. 4
0
    $pages = \Meta\Builder::read('pages');
    $page = new \Meta\Builder\Page($path, $pages[$path]);
    $object = $page->objects[$oid];
    echo json_encode($object);
});
route_add('builder/analizesql/*/*', function ($pname, $oid) {
    $errors = array();
    $cols = array();
    $sql = \Meta\Builder::replaceSQL(\Meta\Core\Db::sqlNormalize($_REQUEST['query']));
    $statement = \Meta\Core\Db::getPDO()->prepare($sql);
    if ($statement->execute()) {
        for ($i = 0; $i < $statement->columnCount(); $i++) {
            $meta = $statement->getColumnMeta($i);
            //            $cols[$meta['name']] = $meta['native_type'];
            $cols[$meta['name']] = $meta['name'];
        }
    } else {
        $errors = $statement->errorInfo();
    }
    // ataualiza colunas do SQL na base (array)
    $pages = \Meta\Builder::read('pages');
    $pages[$pname]['objects'][$oid]['sqlCols'] = $cols;
    \Meta\Builder::write('pages', $pages);
    echo json_encode(array('errors' => $errors, 'sql_cols' => $cols));
});
route_add('builder/print-metadata/*', function ($pname) {
    $pages = \Meta\Builder::read('pages');
    print_header();
    highlight_string("<?php\n" . var_export($pages[$pname], true));
    print_footer();
});
Esempio n. 5
0
 /**
  * Callback to execute before render page.
  * It allows a developer to modify behaviors and customize app.
  */
 public static function beforeRender($page_name, $callback)
 {
     static $pages;
     if (!$pages) {
         $pages = \Meta\Builder::read('pages');
     }
     // assina no globals
     self::$beforeRender[$page_name] = $callback;
 }