Exemplo n.º 1
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.");
                     });
                 });
             });
         });
     });
 }
Exemplo n.º 2
0
 /**
  * This centralizes all input type radio to-HTML necessities.
  *
  * @param array $params This array expects three parameters:
  * . name - the form element's name
  * . label (optional) - human readable description
  * . values - a 0-based indexed array of arrays with the following keys:
  *   -> help (optional) - the help block to append to a radio option
  *   -> label - the label for a radio option
  *   -> value - the value for a radio option
  *   -> checked - different than false for checked or empty for not
  */
 public function getHtmlInputRadio(array $params = array())
 {
     $inputDivParams = array('class' => 'clearfix');
     if (!empty($params['help'])) {
         $inputDivParams['title'] = $params['help'];
         $inputDivParams['class'] .= ' tooltip';
     }
     h::div($inputDivParams, function () use($params) {
         h::label(isset($params['label']) ? $params['label'] : '');
         h::div(array('class' => 'input'), function () use($params) {
             h::ul(array('class' => 'inputs-list'), function () use($params) {
                 foreach ($params['values'] as $values) {
                     h::li(function () use($params, $values) {
                         h::label(function () use($params, $values) {
                             $inputParams = array('type' => 'radio', 'name' => $params['name'], 'value' => $values['value']);
                             if (!empty($values['checked'])) {
                                 $inputParams['checked'] = 'checked';
                             }
                             h::input($inputParams);
                             h::span($values['label']);
                             /*if (!empty($values['help'])) {
                                 h::span(array('class' => 'help-block'), $values['help']);
                               }*/
                         });
                     });
                 }
             });
         });
     });
 }
Exemplo n.º 3
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);