Example #1
0
 /**
  * Fix possible problems in array of pages
  */
 public static function fixObjects()
 {
     //        $pages = \Meta\Builder::read('pages');
     //
     //        if ( isset($p['objects']) ) {
     //            foreach ( $pages as &$p ) {
     //                $p['objects'] = array_values($p['objects']); // reorder indices
     //
     //                foreach ($p['objects'] as $key => &$obj) {
     //                    $obj['id'] = $key; // set the correct id
     //                }
     //            }
     //        }
     //
     //        \Meta\Builder::write('pages', $pages);
     \Meta\Builder::reorderPages();
 }
Example #2
0
             unset($pages[$path]);
             $path = $new_name;
         }
         // atualiza array
         $page = new \Meta\Builder\Page($path, $pageArray);
         $page->label = \Meta\Core\Form::value('label');
         $page->showonmenu = \Meta\Core\Form::checked('showonmenu');
         $page->checkperms = \Meta\Core\Form::checked('checkperms');
         $page->groupsAllowed = array_keys((array) $_REQUEST['groups']);
         $page->parentmenu = \Meta\Core\Form::value('parentmenu');
         $page->menuIcon = \Meta\Core\Form::value('menuIcon');
         $page->pageType = \Meta\Core\Form::value('pageType');
         $pages[$path] = $page->toArray();
         \Meta\Builder::write('pages', $pages);
         if ($renamed) {
             \Meta\Builder::reorderPages();
         }
         // redireciona para nome correto
         redirect('builder/page/' . $path);
     }
 }
 //
 // adiciona todos objetos na sidebar
 //
 $total_objects = 0;
 foreach ($pages as $pg) {
     if (isset($pg['objects'])) {
         $total_objects += count($pg['objects']);
     }
 }
 $page = new \Meta\Builder\Page($path, $pageArray);