예제 #1
0
    });
    h::body(function () {
        h::div(array("id" => "wrapper"), function () {
            h::h1("Hello, World", array("class" => "title"));
            h::comment("navigation");
            h::ul(array("class" => "links"), function () {
                foreach (array(1, 2, 3) as $x) {
                    h::li(function () use($x) {
                        h::a("Link {$x}", "#{$x}");
                    });
                }
            });
            h::comment("let's see some text");
            h::p("Lorem ipsum dolor sit amet, consectetur adipisicing elit...");
            h::comment("now for a table");
            h::table(function () {
                $table_data = h::get_variable('table_data', array());
                h::tr(array("class" => "header"), function () {
                    h::th("key");
                    h::th("value");
                });
                foreach ($table_data as $k => $v) {
                    h::tr(array("class" => h::cycle(array("odd", "even"))), function () use($k, $v) {
                        h::td($k);
                        h::td($v);
                    });
                }
            });
        });
    });
});
예제 #2
0
파일: users.php 프로젝트: hypnomez/opir.org
     unset($block);
     foreach ($permissions as $group => $list) {
         $tabs[] = h::a($group, ['href' => '#permissions_group_' . strtr($group, '/', '_')]);
         $content = [];
         foreach ($list as $label => $id) {
             $content[] = h::th($group != 'Block' ? $label : Text::instance()->process($Config->module('System')->db('texts'), $blocks[$label])) . h::{'td input[type=radio]'}(['name' => "permission[{$id}]", 'checked' => isset($user_permissions[$id]) ? $user_permissions[$id] : -1, 'value' => [-1, 0, 1], 'in' => [$L->inherited . ' (' . (isset($user_permissions[$id]) && !$user_permissions[$id] ? '-' : '+') . ')', $L->deny, $L->allow]]);
         }
         if (count($list) % 2) {
             $content[] = h::{'td[colspan=2]'}();
         }
         $count = count($content);
         $content_ = [];
         for ($i = 0; $i < $count; $i += 2) {
             $content_[] = $content[$i] . $content[$i + 1];
         }
         $tabs_content .= h::{'div#permissions_group_' . strtr($group, '/', '_') . ' table.cs-table-borderless.cs-center-all'}(h::{'tr td.cs-left-all[colspan=4]'}(h::{'button.cs-permissions-invert'}($L->invert) . h::{'button.cs-permissions-deny-all'}($L->deny_all) . h::{'button.cs-permissions-allow-all'}($L->allow_all)) . h::tr($content_));
     }
     unset($content, $content_, $count, $i, $permissions, $group, $list, $label, $id, $blocks);
     $Page->title($L->{$is_bot ? 'permissions_for_bot' : 'permissions_for_user'}($User->username($rc[3])));
     $a->content(h::{'p.lead.cs-center'}($L->{$is_bot ? 'permissions_for_bot' : 'permissions_for_user'}($User->username($rc[3]))) . h::{'ul.cs-tabs li'}($tabs) . h::div($tabs_content) . h::br() . h::{'input[type=hidden]'}(['name' => 'id', 'value' => $rc[3]]));
     break;
 case 'groups':
     if (!isset($rc[3]) || $rc[3] == User::ROOT_ID || $is_bot) {
         break;
     }
     $a->apply_button = false;
     $a->reset_button = false;
     $a->cancel_button_back = true;
     $Group = Group::instance();
     $user_groups = array_reverse($User->get_groups($rc[3]));
     $all_groups = $Group->get_all();
예제 #3
0
            break;
    }
    $a->content(h::{'input[type=hidden]'}(['name' => 'mode', 'value' => $rc[2]]));
} else {
    $a->buttons = false;
    $permissions = $Permission->get_all();
    $permissions_list = [h::th([$L->action, 'id', $L->group, $L->label]), h::th([$L->action, 'id', $L->group, $L->label])];
    $count = 0;
    $blocks = [];
    foreach ($Config->components['blocks'] as $block) {
        $blocks[$block['index']] = $block['title'];
    }
    unset($block);
    foreach ($permissions as $group => $list) {
        foreach ($list as $label => $id) {
            ++$count;
            $permissions_list[] = h::{'td.cs-left-all'}([h::{'a.cs-button-compact'}(h::icon('pencil'), ['href' => "{$a->action}/edit/{$id}", 'data-title' => $L->edit]) . h::{'a.cs-button-compact'}(h::icon('trash-o'), ['href' => "{$a->action}/delete/{$id}", 'data-title' => $L->delete]), $id, h::span($group), h::span($label, ['data-title' => $group == 'Block' ? Text::instance()->process($Config->module('System')->db('texts'), $blocks[$label]) : false])]);
        }
    }
    if ($count % 2) {
        $permissions_list[] = h::{'td[colspan=4]'}();
    }
    unset($permissions, $group, $list, $label, $id, $blocks);
    $count = count($permissions_list);
    $permissions_list_ = '';
    for ($i = 0; $i < $count; $i += 2) {
        $permissions_list_ .= h::tr($permissions_list[$i] . $permissions_list[$i + 1]);
    }
    unset($permissions_list);
    $a->content(h::{'table.cs-table.cs-center-all'}($permissions_list_) . h::{'p.cs-left a.cs-button'}($L->add_permission, ['href' => "admin/System/{$rc['0']}/{$rc['1']}/add"]));
}