Example #1
0
 public static function select($name, $args = array())
 {
     // attribs
     $args['name'] = $name;
     $args['id'] = $name;
     // value
     $value = \Meta\Core\Form::value($name, $args['value']);
     // label
     if ($args['label']) {
         echo \Meta\Core\Form::label($name, $args['label']);
         unset($args['label']);
     }
     // options
     $options = '';
     if (!isset($args['required']) || isset($args['required']) && !$args['required']) {
         $options .= '<option value=""></option>' . "\n";
     }
     if (is_array($args['options'])) {
         foreach ($args['options'] as $key => $val) {
             $selected = $value == $key ? ' selected="selected"' : '';
             $options .= '<option ' . html_tag_values(array('value' => $key)) . $selected . '>' . $val . '</option>' . "\n";
         }
     }
     // input <select>
     unset($args['options']);
     $html = '<select ' . html_tag_values($args) . '>' . $options . '</select>';
     echo $html;
 }
Example #2
0
         \Meta\Core\Flash::success(t('Page updated.'));
         // changes the new page name
         if ($renamed) {
             $pages[$new_name] = $pages[$path];
             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'])) {