Example #1
0
                    <?php 
}
?>
                </table>
                <span class="b-hint">This page only can be accessed if the logged user belongs to one or more of selected groups. See more on <?php 
echo anchor('manage-groups', 'Groups manager');
?>
 interface.</span>
            </fieldset>
        </div>
        <br/>
        <?php 
\Meta\Core\Form::submit(t('Save'));
?>
        <?php 
\Meta\Core\Form::close();
?>
    </div>
</div>
<script>
    checkMenu = function(){ $('#showonmenu').is(':checked') ? $('.menu-props').show() : $('.menu-props').hide(); }
    $(function() { $('#showonmenu').click(checkMenu); checkMenu(); });
    
    checkPerms = function(){ $('#checkperms').is(':checked') ? $('.permissions').show() : $('.permissions').hide(); }
    $(function() { $('#checkperms').click(checkPerms); checkPerms(); });
</script>

<div style="float: left; width: 68%;">
  <h3 class="ui-widget-header">Added page objects <?php 
echo helpIcon(t('Click on object do edit their properties'));
?>
Example #2
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 #3
0
<?php

use Meta\Core\Flash;
use Meta\Core\Form;
use Meta\Core\User;
use Meta\Builder\Page;
route_add('user-login', function () {
    set_page_title('User authentication');
    Form::validateRequired('username');
    Form::validateRequired('password');
    if (Form::hasValidated()) {
        if (User::authenticate($_POST['username'], $_POST['password'])) {
            if (isset($_GET['back_to'])) {
                redirect(urldecode($_GET['back_to']));
            } else {
                redirect(PAGE_HOME);
            }
        } else {
            Flash::error(t('Invalid username or password!'));
        }
    }
    echo Page::renderLayout(array('content' => render('user-login.php')));
});
route_add('user-logout', function () {
    User::logout();
    redirect(PAGE_HOME);
});
Example #4
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'])) {
Example #5
0
 public function render()
 {
     $value = $this->getValue();
     $vars = $this->getTemplateVars();
     // quebrar este switch em multiplas funcoes (ex.: renderButton, renderSelect...)
     switch ($this->type) {
         case 'btn_validated':
         case 'btn_simple':
             return render('field-button.php', $vars);
             break;
         case 'select':
             $vars['options'] = $this->buildOptions();
             return render('field-select.php', $vars);
             break;
         case 'radio':
             $vars['options'] = $this->buildOptions();
             return render('field-radio.php', $vars);
             break;
         case 'hidden':
             return \Meta\Core\Form::hidden($this->name, $value);
             break;
         case 'pkeyfield':
             // campo deste tipo (chave primaria) deve apenas ser exibido quando houver o valor sendo passado na URL
             if ($value) {
                 return render('field-primary.php', $vars);
             }
             break;
         case 'boolean':
             $vars['options'] = array(1 => 'Sim', 0 => 'Nao');
             return render('field-select.php', $vars);
             break;
         case 'checkbox':
             return render('field-checkbox.php', $vars);
             break;
         case 'date':
             return render('field-date.php', $vars);
             break;
         case 'datetime':
             return render('field-datetime.php', $vars);
             break;
         case 'time':
             return render('field-time.php', $vars);
             break;
         case 'autocomplete':
             break;
         case 'password':
             return render('field-password.php', $vars);
             break;
         case 'text':
         default:
             return render('field-text.php', $vars);
             break;
     }
 }