Example #1
0
 /**
  *
  */
 public function toHtml(array $params = array(), array $innerCallbacks = array())
 {
     require_once 'lib/lib.htmlgen.php';
     $o = $this;
     //h::li(function () use ($o, $params, $innerCallbacks) {
     h::li(array('id' => $o->getInternalId()), function () use($o, $params, $innerCallbacks) {
         h::div(array('class' => 'builderElementLine'), function () use($o, $params) {
             h::h3($params['title']);
             /*
                       h::div(array('class' => 'builderElementActionItems'), function() use ($o) {
                         if ($o->isEditable()) {
                           h::a('Details', '#', array('class' => 'btn details'));
                         }
                         if ($o->isDeletable()) {
                           h::a('Delete', '#', array('class' => 'delete btn danger'));
                         }
                       });*/
         });
         h::div(array('class' => 'popover builderElementPopover right'), function () use($o, $params, $innerCallbacks) {
             h::div(array('class' => 'arrow'));
             h::div(array('class' => 'inner'), function () use($o, $params, $innerCallbacks) {
                 h::h3(array('class' => 'title'), function () use($o, $params) {
                     h::div(array('class' => 'actualTitle'), 'Details for ' . $params['title']);
                 });
                 h::div(array('class' => 'content'), function () use($o, $innerCallbacks) {
                     h::form(array('class' => 'form', 'action' => ''), function () use($o, $innerCallbacks) {
                         h::fieldset(function () use($o, $innerCallbacks) {
                             $params = array('help' => "Uncheck this if you don't want this task to execute at all.", 'label' => 'Active?', 'name' => 'active', 'checked' => $o->isActive());
                             $o->getHtmlInputCheckbox($params);
                             foreach ($innerCallbacks as $cb) {
                                 //
                                 // Filesets are special cases, because we might need to
                                 // iterate on more than one (in the future)
                                 //
                                 if ($cb['cb'] == 'getFilesets') {
                                     if ($o->getFilesets()) {
                                         $filesets = $o->getFilesets();
                                         foreach ($filesets as $fileset) {
                                             $fileset->toHtml();
                                         }
                                     }
                                     //
                                     // Normal to-HTML callbacks
                                     //
                                 } else {
                                     call_user_func(array($o, $cb['cb']), $cb);
                                 }
                             }
                             h::div(array('class' => 'actions'), function () {
                                 h::input(array('type' => 'submit', 'class' => 'btn', 'value' => 'Nothing to save', 'disabled' => 'disabled'));
                                 h::button(array('class' => 'btn delete danger'), 'Delete');
                             });
                         });
                     });
                 });
             });
         });
     });
     //});
 }
Example #2
0
            $permission = (int) $_POST['permission'];
            $content = [];
            foreach ($users_list as $user) {
                if (in_array($user, $found_users)) {
                    continue;
                }
                $found_users[] = $user;
                $value = $User->db()->qfs(["SELECT `value`\n\t\t\t\t\tFROM `[prefix]users_permissions`\n\t\t\t\t\tWHERE\n\t\t\t\t\t\t`id`\t\t\t= '%s' AND\n\t\t\t\t\t\t`permission`\t= '%s'", $user, $permission]);
                $content[] = h::th($User->username($user)) . h::{'td input[type=radio]'}(['name' => 'users[' . $user . ']', 'checked' => $value !== false ? $value : -1, 'value' => [-1, 0, 1], 'in' => [$L->inherited . ' (' . ($value !== false && !$value ? '-' : '+') . ')', $L->deny, $L->allow]]);
            }
            $Page->content(h::{'table.cs-table-borderless.cs-center-all tr'}($content));
            break;
    }
}
if ($form) {
    $a->reset_button = false;
    $a->post_buttons .= h::{'button.cs-reload-button'}($L->reset);
    $blocks_array = ['top' => '', 'left' => '', 'floating' => '', 'right' => '', 'bottom' => ''];
    if (!empty($Config->components['blocks'])) {
        foreach ($Config->components['blocks'] as $id => $block) {
            $blocks_array[$block['position']] .= h::li(h::{'div.cs-blocks-items-title'}("#{$block['index']} " . get_block_title($id)) . h::a([h::{'div icon'}('pencil'), ['href' => "{$a->action}/edit/{$id}", 'data-title' => $L->edit]], [h::{'div icon'}('key'), ['href' => "{$a->action}/permissions/{$id}", 'data-title' => $L->edit_permissions]], [h::{'div icon'}($block['active'] ? 'minus' : 'check'), ['href' => "{$a->action}/" . ($block['active'] ? 'disable' : 'enable') . "/{$id}", 'data-title' => $L->{$block['active'] ? 'disable' : 'enable'}]], [h::{'div icon'}('trash-o'), ['href' => "{$a->action}/delete/{$id}", 'data-title' => $L->delete]]), ['id' => "block{$id}", 'class' => $block['active'] ? 'uk-button-success' : 'uk-button-default']);
            unset($block_data);
        }
        unset($id, $block);
    }
    foreach ($blocks_array as $position => &$content) {
        $content = h::{'td.cs-blocks-items-groups ul.cs-blocks-items'}(h::{'li.uk-button-primary'}($L->{"{$position}_blocks"}, ['onClick' => "cs.blocks_toggle('{$position}');"]) . $content, ['data-mode' => 'open', 'id' => "cs-{$position}-blocks-items"]);
    }
    unset($position, $content);
    $a->content(h::{'table.cs-table-borderless tr'}([h::td() . $blocks_array['top'] . h::td(), "{$blocks_array['left']}{$blocks_array['floating']}{$blocks_array['right']}", h::td() . $blocks_array['bottom'] . h::td()]) . h::{'p.cs-left a.cs-button'}("{$L->add} {$L->block}", ['href' => "admin/System/{$rc['0']}/{$rc['1']}/add"]) . h::{'input#cs-blocks-position[type=hidden][name=position]'}());
}
Example #3
0
 public function getViewGlobalSettings()
 {
     require_once 'lib/lib.htmlgen.php';
     $o = $this;
     h::div(array('class' => 'clearfix'), function () use($o) {
         h::label(array('for' => SystemSettings::ALLOW_USER_REGISTRATION), 'Allow registration?');
         h::div(array('class' => 'input'), function () use($o) {
             h::ul(array('class' => 'inputs-list'), function () use($o) {
                 h::li(function () use($o) {
                     h::label(function () use($o) {
                         $inputParams = array('type' => 'checkbox', 'name' => SystemSettings::ALLOW_USER_REGISTRATION);
                         if ($o[SystemSettings::ALLOW_USER_REGISTRATION]) {
                             $inputParams['checked'] = 'checked';
                         }
                         h::input($inputParams);
                         h::span(array('class' => 'help-block'), "Allows user registration on the authentication prompt.");
                     });
                 });
             });
         });
     });
     h::div(array('class' => 'clearfix'), function () use($o) {
         h::label(array('for' => SystemSettings::INTERNAL_BUILDER_ACTIVE), 'Internal builder?');
         h::div(array('class' => 'input'), function () use($o) {
             h::ul(array('class' => 'inputs-list'), function () use($o) {
                 h::li(function () use($o) {
                     h::label(function () use($o) {
                         $inputParams = array('type' => 'checkbox', 'name' => SystemSettings::INTERNAL_BUILDER_ACTIVE);
                         if ($o[SystemSettings::INTERNAL_BUILDER_ACTIVE]) {
                             $inputParams['checked'] = 'checked';
                         }
                         h::input($inputParams);
                         h::span(array('class' => 'help-block'), "Activates the internal automatic integration builder. Use this if you can't setup supervise or similar on the host system.");
                     });
                 });
             });
         });
     });
 }
Example #4
0
require "lib.htmlgen.php";
h::set_variable("table_data", array("foo" => "bar", "hello" => "world", "123" => "456", "abc" => "xyz"));
h::set_indent_pattern("  ");
h::html(function () {
    h::head(function () {
        h::meta(array("charset" => "UTF-8"));
        h::link(array("rel" => "stylesheet", "type" => "text/css", "href" => "global.css"));
    });
    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);