Ejemplo n.º 1
0
 function render()
 {
     $slim = $this->slim();
     $out = HC_Html_Factory::element('div');
     $out->add_attr('class', 'row');
     if ($slim) {
         $out->add_attr('class', 'row-slim');
     }
     $attr = $this->attr();
     foreach ($attr as $k => $v) {
         $out->add_attr($k, $v);
     }
     $scale = $this->scale();
     $items = $this->items();
     foreach ($items as $item) {
         list($item, $width, $more_attr) = $item;
         $slot = HC_Html_Factory::element('div')->add_attr('class', 'col-' . $scale . '-' . $width);
         if ($more_attr) {
             foreach ($more_attr as $k => $v) {
                 $slot->add_attr($k, $v);
             }
         }
         $slot->add_child($item);
         $out->add_child($slot);
     }
     return $out->render();
 }
Ejemplo n.º 2
0
 function render()
 {
     $error = $this->error();
     $label = $this->label();
     $content = $this->content();
     $div = HC_Html_Factory::element('div')->add_attr('class', 'form-group');
     if ($error) {
         $div->add_attr('class', 'has-error');
     }
     $attr = $this->attr();
     foreach ($attr as $k => $v) {
         $div->add_attr($k, $v);
     }
     if ($label) {
         $label_c = HC_Html_Factory::element('label')->add_attr('class', 'control-label')->add_child($label);
         $div->add_child($label_c);
     }
     $content_holder = HC_Html_Factory::element('div')->add_attr('class', 'control-holder');
     if ($this->content_static()) {
         $content_holder->add_attr('class', 'form-control-static');
     }
     foreach ($content as $cont) {
         $content_holder->add_child($cont);
     }
     $div->add_child($content_holder);
     return $div->render();
 }
Ejemplo n.º 3
0
 function render()
 {
     /* tabs */
     $id = $this->id();
     if (!$id) {
         $id = 'nts' . hc_random();
     }
     $tabs = HC_Html_Factory::widget('list')->add_attr('class', array('nav'))->add_attr('class', array('nav-tabs'))->add_attr('class', array('hc-tab-links'))->add_attr('id', $id);
     $my_tabs = $this->tabs();
     reset($my_tabs);
     foreach ($my_tabs as $key => $tab_array) {
         list($tab_label, $tab_content) = $tab_array;
         $tabs->add_item($key, HC_Html_Factory::widget('titled', 'a')->add_attr('href', '#' . $key)->add_attr('class', 'tab-toggler')->add_attr('data-toggle-tab', $key)->add_child($tab_label));
     }
     $active = $this->active();
     $tabs->add_item_attr($active, 'class', 'active');
     /* content */
     $content = HC_Html_Factory::element('div')->add_attr('class', 'hc-tab-content')->add_attr('style', 'overflow: visible;');
     reset($my_tabs);
     foreach ($my_tabs as $key => $tab_array) {
         list($tab_label, $tab_content) = $tab_array;
         $tab = HC_Html_Factory::element('div')->add_attr('class', 'hc-tab-pane')->add_attr('id', $key)->add_attr('data-tab-id', $key);
         if ($active == $key) {
             $tab->add_attr('class', 'active');
         }
         $tab->add_child($tab_content);
         $content->add_child($tab);
     }
     /* javascript */
     /* out */
     $out = HC_Html_Factory::widget('list')->add_attr('class', array('list-unstyled'))->add_attr('class', array('hc-tabs'));
     $out->add_item($tabs);
     $out->add_item($content);
     return $out->render();
 }
Ejemplo n.º 4
0
 function title($model, $vlevel = HC_PRESENTER::VIEW_HTML)
 {
     $return = array();
     switch ($vlevel) {
         case HC_PRESENTER::VIEW_HTML:
         case HC_PRESENTER::VIEW_HTML_ICON:
             $icon = HC_Html::icon(HC_App::icon_for('conflict'));
             $icon->add_attr('class', 'text-danger');
             $span = HC_Html_Factory::element('span')->add_attr('title', $model->present_title(HC_PRESENTER::VIEW_TEXT))->add_child($icon)->add_child($model->present_title(HC_PRESENTER::VIEW_TEXT));
             $return[] = $span;
             break;
         case HC_PRESENTER::VIEW_TEXT:
             $return[] = HCM::__('Conflict');
             $return[] = ': ';
             $return[] = $model->type;
             $return[] = ': ';
             $return[] = $model->details;
             break;
         case HC_PRESENTER::VIEW_RAW:
             $return[] = $model->type;
             $return[] = ': ';
             $return[] = $model->details;
             break;
     }
     $return = join('', $return);
     return $return;
 }
Ejemplo n.º 5
0
 function title($model, $vlevel = HC_PRESENTER::VIEW_HTML)
 {
     $return = array();
     $label = $this->label($model, $vlevel);
     if (strlen($label)) {
         $return[] = $label;
     }
     switch ($vlevel) {
         case HC_PRESENTER::VIEW_TEXT:
             $return[] = ': ';
             break;
     }
     switch ($vlevel) {
         case HC_PRESENTER::VIEW_HTML_ICON:
             break;
         default:
             if ($model->exists()) {
                 $return[] = $model->name;
             } else {
                 $return[] = HCM::__('Unknown');
             }
             break;
     }
     $return = join('', $return);
     switch ($vlevel) {
         case HC_PRESENTER::VIEW_HTML:
             $color = $model->present_color();
             $color = HC_Lib::adjust_color_brightness($color, -30);
             $return = HC_Html_Factory::element('span')->add_attr('class', 'label')->add_attr('class', 'label-success')->add_attr('class', 'label-lg')->add_child($return)->add_attr('style', 'background-color: ' . $color . ';');
             break;
     }
     return $return;
 }
Ejemplo n.º 6
0
 function render()
 {
     $folded = array();
     $items = $this->items();
     foreach ($items as $item) {
         list($item, $folding_key) = $item;
         if (!isset($folded[$folding_key])) {
             $folded[$folding_key] = array();
         }
         $folded[$folding_key][] = $item;
     }
     $out = HC_Html_Factory::element('ul')->add_attr('class', 'list-unstyled')->add_attr('class', 'collapse-panel');
     $attr = $this->attr();
     foreach ($attr as $k => $v) {
         $out->add_attr($k, $v);
     }
     reset($folded);
     foreach ($folded as $fk => $items) {
         $collapser = HC_Html_Factory::element('a')->add_attr('href', '#')->add_attr('class', 'hc-collapse-next')->add_attr('class', 'display-block')->add_child('HAHA');
         $out->add_child(HC_Html_Factory::element('li')->add_child($collapser));
         $subout = HC_Html_Factory::widget('list');
         foreach ($items as $item) {
             $subout->add_item($item);
         }
         $out->add_child(HC_Html_Factory::element('li')->add_attr('class', 'collapse')->add_child($subout));
     }
     return $out->render();
 }
Ejemplo n.º 7
0
 function render()
 {
     $out = array();
     /* build trigger */
     $title = $this->title();
     if (($active = $this->active()) && $this->item($active)) {
         $title = $this->item($active);
         $this->remove_item($active);
     }
     if (is_object($title) && $title->tag() == 'a') {
         $trigger = $title;
     } else {
         $full_title = $title;
         $title = strip_tags($title);
         $title = trim($title);
         $trigger = HC_Html_Factory::element('a')->add_attr('title', $title)->add_child($full_title);
     }
     $trigger->add_attr('href', '#')->add_attr('class', 'dropdown-toggle')->add_attr('data-toggle', 'dropdown');
     if (!$this->no_caret()) {
         $trigger->add_child(' ')->add_child(HC_Html_Factory::element('b')->add_attr('class', 'caret'));
     }
     $out[] = $trigger->render();
     $this->add_attr('class', 'dropdown-menu');
     $out[] = parent::render();
     $return = '';
     foreach ($out as $o) {
         $return .= $o;
     }
     if ($this->wrap()) {
         $wrap = HC_Html_Factory::element('div')->add_attr('class', 'dropdown')->add_child($return);
         $return = $wrap->render();
     }
     return $return;
 }
Ejemplo n.º 8
0
 function render()
 {
     $wrap = HC_Html_Factory::widget('list')->add_attr('class', array('list-inline', 'list-separated'));
     $wrap->add_item($this->fields['start']);
     $wrap->add_item(' - ');
     $wrap->add_item($this->fields['end']);
     return $this->decorate($wrap->render());
 }
Ejemplo n.º 9
0
 function render()
 {
     $wrap = HC_Html_Factory::element('div')->add_attr('class', 'hc-ajax-parent');
     $container = HC_Html_Factory::element('div')->add_attr('class', 'hc-ajax-container');
     $list = parent::render();
     $wrap->add_child($list);
     $wrap->add_child($container);
     return $wrap->render();
 }
Ejemplo n.º 10
0
 public function get_dates()
 {
     $date_input = HC_Html_Factory::input('recurring_date');
     $date_value = $date_input->unserialize($this->details, 'no-dates');
     $date_value['datestart'] = $this->date_start;
     $date_value['dateend'] = $this->date_end;
     $date_input->set_value($date_value);
     $return = $date_input->dates();
     return $return;
 }
Ejemplo n.º 11
0
 function set_input($name, $type, $convert = array())
 {
     $input = HC_Html_Factory::input($type, $name);
     $this->inputs[$name] = $input;
     if ($convert) {
         foreach ($convert as $kmodel => $kform) {
             $this->convert[$kmodel] = $name . '.' . $kform;
         }
     }
     return $this;
 }
Ejemplo n.º 12
0
 function render()
 {
     $closer = $this->closer();
     if (!$closer) {
         $closer = HC_Html_Factory::element('a')->add_child('Back')->add_attr('class', array('btn btn-warning-o'));
         $closer = HC_Html_Factory::element('a')->add_child(HC_Html::icon('times')->add_attr('class', array('text-muted')))->add_attr('title', HCM::__('Back'))->add_attr('class', array('close'));
     }
     $closer->add_attr('class', array('hc-flatmodal-closer'))->add_attr('href', '#')->add_attr('style', 'display: none;')->add_attr('style', 'margin-bottom: 1em;');
     $out = HC_Html_Factory::element('div')->add_attr('class', 'hc-flatmodal-parent')->add_child($closer)->add_child(HC_Html_Factory::element('div')->add_attr('class', array('hc-flatmodal-container', 'hc-ajax-container')))->add_child($this->content());
     $return = $out->render();
     return $return;
 }
Ejemplo n.º 13
0
    function render()
    {
        $name = $this->name();
        $value = $this->value();
        $id = 'nts-' . $name;
        $t = HC_Lib::time();
        $t->setNow();
        $t->setStartDay();
        if ($value) {
            $t->modify('+' . $value . ' seconds');
            // $value = $t->formatTime();
        }
        $out = HC_Html_Factory::widget('container');
        /* hidden field to store our value */
        $hidden = HC_Html_Factory::input('hidden')->set_name($name)->set_value($value)->set_id($id);
        $out->add_item($hidden);
        /* text field to display */
        $display_name = $name . '_display';
        $display_id = 'nts-' . $display_name;
        $text = HC_Html_Factory::input('text')->set_name($display_name)->set_id($display_id)->add_attr('size', 7);
        if (strlen($value)) {
            $display_value = $t->formatTime();
            $text->set_value($display_value);
        }
        $out->add_item($text);
        $time_format = $t->timeFormat();
        $script = HC_Html_Factory::element('script');
        $script->add_attr('language', 'JavaScript');
        $js_code = <<<EOT

jQuery("#{$display_id}").timepicker(
{
\t'appendTo' : '#nts',
\t'timeFormat' :'{$time_format}',
\t'step' : 5,
}
);

jQuery("#{$display_id}").on('change', function(){
\tvar dbTime = jQuery(this).timepicker('getSecondsFromMidnight');
\tjQuery('#{$id}').val( dbTime );
});

EOT;
        $script->add_child($js_code);
        $out->add_item($script);
        $return = $this->decorate($out->render());
        return $return;
    }
 function details($model, $vlevel = HC_PRESENTER::VIEW_HTML)
 {
     $conflicting_one = HC_App::model('availability');
     $conflicting_one->where('id', $model->details)->get();
     switch ($vlevel) {
         case HC_PRESENTER::VIEW_HTML:
             $return = HC_Html_Factory::widget('availability_view')->set_new_window(TRUE)->set_wide(TRUE);
             $return->set_model($conflicting_one);
             break;
         case HC_PRESENTER::VIEW_TEXT:
         case HC_PRESENTER::VIEW_RAW:
             $return = $conflicting_one->present_details($vlevel);
             break;
     }
     return $return;
 }
Ejemplo n.º 15
0
 function render()
 {
     $out = HC_Html_Factory::element('div')->add_attr('class', 'alert')->add_attr('class', 'display-block');
     $attr = $this->attr();
     foreach ($attr as $k => $v) {
         $out->add_attr($k, $v);
     }
     $items = $this->items();
     if (count($items) > 1) {
         $list = HC_Html_Factory::widget('list')->add_attr('class', 'list-unstyled');
         $list->set_items($items);
         $out->add_child($list);
     } else {
         $out->add_child($items);
     }
     return $out->render();
 }
Ejemplo n.º 16
0
 function render()
 {
     list($csrf_name, $csrf_value) = HC_App::csrf();
     $out = HC_Html_Factory::element('form')->add_attr('method', $this->method())->add_attr('accept-charset', 'utf-8')->add_attr('id', $this->id());
     $attr = $this->attr();
     foreach ($attr as $k => $v) {
         $out->add_attr($k, $v);
     }
     /* add csrf */
     if ($this->method() != 'get') {
         if (strlen($csrf_name) && strlen($csrf_value)) {
             $hidden = HC_Html_Factory::input('hidden', $csrf_name)->set_value($csrf_value);
             $out->add_child(HC_Html_Factory::element('div')->add_attr('style', 'display:none')->add_child($hidden));
         }
     }
     $out->add_child(parent::render());
     return $out->render();
 }
Ejemplo n.º 17
0
 function render()
 {
     $left = HC_Html_Factory::element('li')->add_attr('class', 'squeeze-in')->add_attr('class', 'pull-left')->add_attr('style', 'width: 50%;')->add_child($this->left());
     $right = HC_Html_Factory::element('li')->add_attr('class', 'squeeze-in')->add_attr('class', 'pull-right')->add_attr('style', 'width: 50%;')->add_child($this->right());
     if ($this->align_right) {
         $right->add_attr('class', 'text-right');
     }
     $clearfix = HC_Html_Factory::element('div')->add_attr('class', 'clearfix')->add_child('');
     $out = HC_Html_Factory::element('ul')->add_attr('class', 'list-inline')->add_child($left)->add_child($right);
     $total = array();
     $total[] = $out;
     $total[] = $clearfix;
     $return = '';
     foreach ($total as $t) {
         $return .= $t->render();
     }
     return $return;
 }
Ejemplo n.º 18
0
 function render()
 {
     $out = array();
     /* build trigger */
     $title = $this->title();
     if (is_object($title) && $title->tag() == 'a') {
         $trigger = $title;
     } else {
         $full_title = $title;
         $title = strip_tags($title);
         $title = trim($title);
         $trigger = HC_Html_Factory::element('a')->add_attr('title', $title)->add_child($full_title);
     }
     $trigger->add_attr('class', 'hc-ajax-loader');
     $wrap = HC_Html_Factory::element('div')->add_attr('class', 'hc-ajax-parent');
     $container = HC_Html_Factory::element('div')->add_attr('class', 'hc-ajax-container');
     $wrap->add_child($trigger);
     $wrap->add_child($container);
     return $wrap->render();
 }
Ejemplo n.º 19
0
 function render()
 {
     $out = array();
     $items = $this->items();
     $per_row = $this->per_row();
     $number_of_rows = ceil(count($items) / $per_row);
     $row_class = 'row';
     switch ($per_row) {
         case 1:
             $tile_class = array('col-sm-12');
             break;
         case 2:
             $tile_class = array('col-sm-6');
             break;
         case 3:
             $tile_class = array('col-sm-4');
             break;
         case 4:
             $tile_class = array('col-sm-3');
             break;
         case 6:
             $tile_class = array('col-sm-6');
             break;
     }
     for ($ri = 0; $ri < $number_of_rows; $ri++) {
         $row = HC_Html_Factory::element('div')->add_attr('class', $row_class, 1);
         for ($ii = $ri * $per_row; $ii < ($ri + 1) * $per_row; $ii++) {
             if (isset($items[$ii])) {
                 $tile = HC_Html_Factory::element('div')->add_attr('class', $tile_class, 1);
                 $row->add_child($tile->add_child($items[$ii]));
             }
         }
         $out[] = $row;
     }
     $return = '';
     foreach ($out as $o) {
         $return .= $o->render();
     }
     return $return;
 }
Ejemplo n.º 20
0
 function render()
 {
     $name = $this->name();
     $value = $this->value();
     $id = 'nts-' . $name;
     $t = HC_Lib::time();
     $value ? $t->setDateDb($value) : $t->setNow();
     $value = $t->formatDate_Db();
     $out = HC_Html_Factory::widget('container');
     /* hidden field to store our value */
     $hidden = HC_Html_Factory::input('hidden')->set_name($name)->set_value($value)->set_id($id);
     $out->add_item($hidden);
     /* text field to display */
     $display_name = $name . '_display';
     $display_id = 'nts-' . $display_name;
     $datepicker_format = $t->formatToDatepicker();
     $display_value = $t->formatDate();
     $text = HC_Html_Factory::input('text')->set_name($display_name)->set_value($display_value)->set_id($display_id)->add_attr('data-date-format', $datepicker_format)->add_attr('data-date-week-start', $t->weekStartsOn)->add_attr('style', 'width: 8em')->add_attr('class', 'hc-datepicker');
     $out->add_item($text);
     $return = $this->decorate($out->render());
     return $return;
 }
Ejemplo n.º 21
0
 function render()
 {
     $name = $this->name();
     $value = $this->value();
     $id = 'nts-' . $name;
     $t = HC_Lib::time();
     $t->setNow();
     $t->setStartDay();
     if ($value) {
         $t->modify('+' . $value . ' seconds');
         // $value = $t->formatTime();
     }
     $out = HC_Html_Factory::widget('container');
     /* hidden field to store our value */
     $hidden = HC_Html_Factory::input('hidden')->set_name($name)->set_value($value)->set_id($id);
     $attr = $this->attr();
     foreach ($attr as $k => $v) {
         if (!in_array($k, array('disabled', 'readonly'))) {
             continue;
         }
         $hidden->add_attr($k, $v);
     }
     $out->add_item($hidden);
     /* text field to display */
     $display_name = $name . '_display';
     $display_id = 'nts-' . $display_name;
     $text = HC_Html_Factory::input('text')->set_name($display_name)->set_id($display_id)->add_attr('size', 7)->add_attr('class', 'hc-timepicker');
     if (strlen($value)) {
         $display_value = $t->formatTime();
         $text->set_value($display_value);
     }
     foreach ($attr as $k => $v) {
         $text->add_attr($k, $v);
     }
     $out->add_item($text);
     $return = $this->decorate($out->render());
     return $return;
 }
Ejemplo n.º 22
0
 function render()
 {
     $out = HC_Html_Factory::element('ul');
     $attr = $this->attr();
     foreach ($attr as $k => $v) {
         $out->add_attr($k, $v);
     }
     $already_shown = 0;
     $items = $this->items();
     foreach ($items as $key => $item) {
         $li = HC_Html_Factory::element('li');
         $item_attr = $this->item_attr($key);
         foreach ($item_attr as $k => $v) {
             $li->add_attr($k, $v);
         }
         if (is_string($item) && $item == '-divider-') {
             if (!$already_shown) {
                 continue;
             }
             $item = '&nbsp;';
             $li->add_attr('class', 'divider');
             $li->add_attr('class', 'hidden-xs');
         } else {
             if ($key === $this->active()) {
                 $li->add_attr('class', 'active');
             }
             if (in_array('nav', $out->attr('class')) && (is_string($item) or is_object($item) && method_exists($item, 'tag') && $item->tag() == 'input')) {
                 $item = HC_Html_Factory::element('span')->add_child($item);
             }
         }
         $li->add_child($item);
         $out->add_child($li);
         $already_shown++;
     }
     return $out->render();
 }
Ejemplo n.º 23
0
<?php

$user_level = $user ? $user->level : 0;
$menu = HC_Html_Factory::widget('main_menu');
$menu->set_menu($menu_conf);
$menu->set_disabled($disabled_panels);
$menu->set_current($this_uri);
echo $menu->render($user_level . '/');
Ejemplo n.º 24
0
 function render()
 {
     $module_params = array();
     $link_params = array();
     $module_params[] = $this->url();
     foreach ($this->args() as $k) {
         $module_params[] = $k;
         // $link_params[$k] = $v;
     }
     foreach ($this->params() as $k => $v) {
         $module_params[] = $k;
         $module_params[] = $v;
         $link_params[$k] = $v;
     }
     foreach ($this->more_params() as $k => $v) {
         $module_params[] = $k;
         $module_params[] = $v;
         $link_params[$k] = $v;
     }
     $link = HC_Lib::link($this->url(), $link_params);
     $return = $this->content();
     if ($return === NULL) {
         $return = call_user_func_array('Modules::run', $module_params);
     }
     $show_empty = $this->show_empty();
     if (strlen($return) && $this->self_target() or $show_empty or !$this->skip_src()) {
         $out = HC_Html_Factory::element('div')->add_child($return);
         if ($this->self_target()) {
             $out->add_attr('class', 'hc-target');
         }
         if (!$this->skip_src()) {
             $out->add_attr('data-src', $link->url());
         }
         $attr = $this->attr();
         foreach ($attr as $k => $v) {
             $out->add_attr($k, $v);
         }
         $return = $out->render();
     }
     return $return;
 }
Ejemplo n.º 25
0
 function render($readonly = FALSE)
 {
     if (!$readonly && !($link = $this->link())) {
         return 'HC_Html_Widget_Date_Nav: link is not set!';
     }
     $t = HC_Lib::time();
     $nav_title = $this->_nav_title($readonly);
     if ($readonly) {
         $return = HC_Html_Factory::element('span')->add_attr('class', array('btn', 'btn-default'))->add_child($nav_title);
         return $return;
     }
     switch ($this->range()) {
         case 'all':
             $t->setNow();
             $start_date = $end_date = 0;
             // $start_date = $end_date = $t->formatDate_Db();
             break;
         case 'upcoming':
             $t->setNow();
             $start_date = $end_date = 0;
             break;
         case 'custom':
             list($start_date, $end_date) = explode('_', $this->date());
             $t->setDateDb($start_date)->modify('-1 day');
             $before_date = $t->formatDate_Db();
             $t->setDateDb($end_date)->modify('+1 day');
             $after_date = $t->formatDate_Db();
             break;
         case 'day':
             $t->setDateDb($this->date());
             $start_date = $end_date = $t->formatDate_Db();
             $t->modify('-1 day');
             $before_date = $t->formatDate_Db();
             $t->setDateDb($this->date());
             $t->modify('+1 day');
             $after_date = $t->formatDate_Db();
             break;
         case 'week':
             $t->setDateDb($this->date());
             $start_date = $t->setStartWeek()->formatDate_Db();
             $end_date = $t->setEndWeek()->formatDate_Db();
             $t->setDateDb($this->date());
             $t->modify('-1 week');
             $t->setStartWeek();
             $before_date = $t->formatDate_Db();
             $t->setDateDb($this->date());
             $t->setEndWeek();
             $t->modify('+1 day');
             $after_date = $t->formatDate_Db();
             break;
         case 'month':
             $t->setDateDb($this->date());
             $start_date = $t->setStartMonth()->formatDate_Db();
             $end_date = $t->setEndMonth()->formatDate_Db();
             $month_view = $t->getMonthName() . ' ' . $t->getYear();
             $t->setDateDb($this->date());
             $t->modify('-1 month');
             $t->setStartMonth();
             $before_date = $t->formatDate_Db();
             $t->setDateDb($this->date());
             $t->setEndMonth();
             $t->modify('+1 day');
             $after_date = $t->formatDate_Db();
             break;
     }
     // $this->add_attr('class', array('nav', 'nav-pills'));
     $this->add_attr('class', array('list-inline', 'list-separated'));
     $wrap_nav_title = HC_Html_Factory::element('a')->add_attr('class', array('btn', 'btn-default'))->add_child($nav_title);
     $current_nav = HC_Html_Factory::widget('dropdown')->set_title($wrap_nav_title);
     $range_options = array();
     /* week */
     $this_params = array($this->range_param() => 'week', $this->date_param() => $start_date ? $start_date : NULL);
     $range_options['week'] = HC_Html_Factory::element('a')->add_child(HCM::__('Week'))->add_attr('href', $link->url($this_params));
     /* month */
     $this_params = array($this->range_param() => 'month', $this->date_param() => $start_date ? $start_date : NULL);
     $range_options['month'] = HC_Html_Factory::element('a')->add_child(HCM::__('Month'))->add_attr('href', $link->url($this_params));
     /* day */
     $this_params = array($this->range_param() => 'day', $this->date_param() => $start_date ? $start_date : NULL);
     $range_options['day'] = HC_Html_Factory::element('a')->add_child(HCM::__('Day'))->add_attr('href', $link->url($this_params));
     /* custom */
     $date_param = '';
     if ($start_date && $end_date) {
         $date_param = $start_date . '_' . $end_date;
     } elseif ($start_date) {
         $date_param = $start_date;
     }
     $this_params = array($this->range_param() => 'custom', $this->date_param() => $date_param ? $date_param : NULL);
     $range_options['custom'] = HC_Html_Factory::element('a')->add_child(HCM::__('Custom Range'))->add_attr('href', $link->url($this_params));
     /* upcoming */
     $this_params = array($this->range_param() => 'upcoming', $this->date_param() => NULL);
     $range_options['upcoming'] = HC_Html_Factory::element('a')->add_child(HCM::__('Upcoming'))->add_attr('href', $link->url($this_params));
     /* all */
     $this_params = array($this->range_param() => 'all', $this->date_param() => NULL);
     $range_options['all'] = HC_Html_Factory::element('a')->add_child(HCM::__('All Time'))->add_attr('href', $link->url($this_params));
     $enabled = $this->enabled();
     foreach ($range_options as $k => $v) {
         if (!in_array($k, $enabled)) {
             continue;
         }
         if ($k != $this->range()) {
             $current_nav->add_item($range_options[$k]);
         }
     }
     $this->add_item_attr('current', 'class', array('dropdown'));
     $enabled = $this->enabled();
     switch ($this->range()) {
         case 'custom':
             $this->add_item('current', $current_nav);
             /* now add form */
             if (in_array($this->range(), $enabled)) {
                 $form = HC_Lib::form()->set_input('start_date', 'date')->set_input('end_date', 'date');
                 $form->set_values(array('start_date' => $start_date, 'end_date' => $end_date));
                 $display_form = HC_Html_Factory::widget('form')->add_attr('action', $this->submit_to());
                 $display_form->add_item(HC_Html_Factory::widget('list')->add_attr('class', 'list-inline')->add_attr('class', 'list-separated')->add_item($form->input('start_date'))->add_item('-')->add_item($form->input('end_date'))->add_item(HC_Html_Factory::element('input')->add_attr('type', 'submit')->add_attr('class', array('btn', 'btn-default'))->add_attr('title', HCM::__('OK'))->add_attr('value', HCM::__('OK'))));
             } else {
                 $display_form = HC_Html_Factory::widget('list')->add_attr('class', 'list-inline')->add_attr('class', 'list-separated')->add_item($t->formatDateRange($start_date, $end_date));
             }
             $this->add_item('form', $display_form);
             break;
         case 'all':
         case 'upcoming':
             $this->add_item('current', $current_nav);
             break;
         default:
             $this->add_item('before', HC_Html_Factory::element('a')->add_attr('href', $link->url(array($this->date_param() => $before_date)))->add_attr('class', array('btn', 'btn-default'))->add_child('&lt;&lt;'));
             $this->add_item('current', $current_nav);
             $this->add_item('after', HC_Html_Factory::element('a')->add_attr('href', $link->url(array($this->date_param() => $after_date)))->add_attr('class', array('btn', 'btn-default'))->add_child('&gt;&gt;'));
             break;
     }
     $this->set_active('current');
     return parent::render();
 }
    $cid = 0;
    if ($current_user_id) {
        $title = HC_Html_Factory::widget('list')->add_attr('class', 'list-unstyled')->add_attr('class', 'list-separated');
        $title->add_item($TITLES[$entity_id]);
        $title->add_item($QUICKSTATS[$entity_id]);
    } else {
        $title = $TITLES[$entity_id];
    }
    $out->set_cell($rid, $cid, $title);
    $out->add_cell_attr($rid, $cid, array('class' => 'padded'));
    $cid++;
    reset($dates);
    foreach ($dates as $date) {
        $cell_key = $entity_id . '_' . $date;
        $date_label = $DATE_LABELS[$date];
        $date_label = HC_Html_Factory::element('div')->add_attr('class', 'visible-xs')->add_child($date_label);
        $cell_content = array($date_label, $CELLS[$cell_key]);
        if ($LINKS[$cell_key]) {
            $links = HC_Html_Factory::element('div')->add_attr('class', 'hover-visible')->add_child($LINKS[$cell_key]);
            $cell_content[] = $links;
        }
        $out->set_cell($rid, $cid, $cell_content);
        $out->add_cell_attr($rid, $cid, array('class' => array('padded', 'hover-parent')));
        if (in_array($date, $week_border_days)) {
            $out->add_cell_attr($rid, $cid, array('class' => array('hc-div-table-cell-start-week')));
        }
        $cid++;
    }
    $rid++;
}
echo $out->render();
Ejemplo n.º 27
0
<?php

$current_user_id = $this->auth->check();
$display_form = HC_Html_Factory::widget('form')->add_attr('action', HC_Lib::link('admin/users/update/password/' . $object->id))->add_attr('class', 'form-horizontal')->add_attr('class', 'form-condensed');
/* BUTTONS */
$buttons = HC_Html_Factory::widget('list')->add_attr('class', array('list-inline', 'list-separated'));
$buttons->add_item(HC_Html_Factory::element('input')->add_attr('type', 'submit')->add_attr('class', array('btn', 'btn-default'))->add_attr('title', HCM::__('Save'))->add_attr('value', HCM::__('Save')));
$display_form->add_item(HC_Html_Factory::widget('label_row')->set_label(HCM::__('Password'))->set_content($form->input('password')->add_attr('size', 24))->set_error($form->input('password')->error()))->add_item(HC_Html_Factory::widget('label_row')->set_label(HCM::__('Confirm Password'))->set_content($form->input('confirm_password')->add_attr('size', 24))->set_error($form->input('confirm_password')->error()));
$display_form->add_item(HC_Html_Factory::widget('label_row')->set_content($buttons));
echo $display_form->render();
Ejemplo n.º 28
0
 function render()
 {
     $model = $this->model();
     $start_link = $this->start_link();
     if (!$start_link) {
         // $start_link = 'availability';
         $start_link = 'admin/users/zoom/index/id/' . $model->user_id . '/tab/availability/_pass';
     }
     $href = HC_Lib::link($start_link . '/zoom/index', array('id' => $model->id));
     $nolink = $this->nolink();
     $new_window = $this->new_window();
     $wide = $this->wide();
     $a_link = HC_Html_Factory::widget('titled', 'a')->add_attr('href', $href);
     if (!$new_window) {
         $a_link->add_attr('class', 'hc-flatmodal-loader');
     } else {
         $a_link->add_attr('target', '_blank');
         $a_link->add_attr('class', 'hc-parent-loader');
     }
     if ($wide === 'mini') {
         $out = HC_Html_Factory::element('div');
         if (!$nolink) {
             $title = clone $a_link;
             $title->add_child($model->present_title(HC_PRESENTER::VIEW_HTML_ICON));
         } else {
             $title = $model->present_title(HC_PRESENTER::VIEW_HTML_ICON);
         }
         $out->add_child($title);
     } elseif ($wide) {
         $out = HC_Html_Factory::widget('grid');
         if (!$nolink) {
             $present_title = clone $a_link;
             $present_title->add_child($model->present_title());
         } else {
             $present_title = $model->present_title();
         }
         if (!$nolink) {
             $present_date = clone $a_link;
             $present_date->add_child($model->present_date());
         } else {
             $present_date = $model->present_date();
         }
         $out->add_item($present_title, 6);
         $out->add_item($present_date, 6);
     } else {
         $out = HC_Html_Factory::element('div');
         if (!$nolink) {
             $title = clone $a_link;
             $title->add_child($model->present_title());
         } else {
             $title = $model->present_title(HC_PRESENTER::VIEW_HTML_ICON);
         }
         $out->add_child($title);
         $out->add_attr('class', array('text-smaller'))->add_attr('class', array('text-muted'));
     }
     $out->add_attr('class', 'hc-common-link-parent')->add_attr('class', 'hc-no-underline');
     return $out->render();
 }
Ejemplo n.º 29
0
		</div>
	<?php 
    }
    ?>
	</div>
<?php 
}
?>

<?php 
if ($error) {
    ?>
	<div>
	<?php 
    $danger = HC_Html_Factory::widget('alert')->add_attr('class', 'alert-danger')->set_items($error);
    echo $danger->render();
    ?>
	</div>
<?php 
}
?>

<?php 
if (isset($debug_message) && $debug_message) {
    if (!is_array($debug_message)) {
        $debug_message = array($debug_message);
    }
    $debug_message = HC_Html_Factory::widget('list')->add_attr('class', 'list-unstyled')->add_attr('class', 'list-separated')->add_attr('class', 'list-bordered')->set_items($debug_message);
    $debug = HC_Html_Factory::widget('alert')->add_attr('class', 'alert-warning-o')->set_items($debug_message);
    echo $debug->render();
}
Ejemplo n.º 30
0
<?php

$t = HC_Lib::time();
$out = HC_Html_Factory::widget('list')->add_attr('class', 'list-unstyled')->add_attr('class', 'list-separated');
foreach ($entries as $e) {
    $view = HC_Html_Factory::widget('availability_view');
    $view->set_model($e);
    if (isset($state['wide'])) {
        $view->set_wide($state['wide']);
    }
    $view->set_start_link('availability');
    $out->add_item($view);
    /*
    	$out->add_item(
    		HC_Html_Factory::widget('titled', 'span')
    			->add_child( $e->present_title() )
    			->add_attr('class', 'text-success')
    			->add_attr('class', 'text-smaller')
    		);
    */
}
echo $out->render();