コード例 #1
0
ファイル: list_folded.php プロジェクト: RCMmedia/rubicon
 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();
 }
コード例 #2
0
ファイル: location.php プロジェクト: RCMmedia/rubicon
 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;
 }
コード例 #3
0
ファイル: tabs.php プロジェクト: RCMmedia/rubicon
 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();
 }
コード例 #4
0
ファイル: label_row.php プロジェクト: RCMmedia/rubicon
 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();
 }
コード例 #5
0
ファイル: conflict.php プロジェクト: RCMmedia/rubicon
 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;
 }
コード例 #6
0
ファイル: grid.php プロジェクト: RCMmedia/rubicon
 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();
 }
コード例 #7
0
ファイル: dropdown.php プロジェクト: RCMmedia/rubicon
 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;
 }
コード例 #8
0
ファイル: list_ajax.php プロジェクト: RCMmedia/rubicon
 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();
 }
コード例 #9
0
ファイル: flatmodal.php プロジェクト: RCMmedia/rubicon
 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;
 }
コード例 #10
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;
    }
コード例 #11
0
ファイル: alert.php プロジェクト: RCMmedia/rubicon
 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();
 }
コード例 #12
0
ファイル: shift.php プロジェクト: RCMmedia/rubicon
 function id($model, $vlevel = HC_PRESENTER::VIEW_HTML)
 {
     $return = array();
     switch ($vlevel) {
         case HC_PRESENTER::VIEW_HTML:
             $return = 'id:' . $model->id;
             $return = HC_Html_Factory::element('span')->add_attr('class', 'text-muted')->add_attr('class', 'text-smaller2')->add_attr('class', 'squeeze-in')->add_child($return);
             break;
         case HC_PRESENTER::VIEW_TEXT:
             $return = 'id:' . $model->id;
             break;
         case HC_PRESENTER::VIEW_RAW:
             $return = $model->id;
             break;
     }
     return $return;
 }
コード例 #13
0
ファイル: form.php プロジェクト: RCMmedia/rubicon
 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();
 }
コード例 #14
0
ファイル: leftright.php プロジェクト: RCMmedia/rubicon
 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;
 }
コード例 #15
0
ファイル: ajax_loader.php プロジェクト: RCMmedia/rubicon
 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();
 }
コード例 #16
0
ファイル: tiles.php プロジェクト: RCMmedia/rubicon
 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;
 }
コード例 #17
0
ファイル: list.php プロジェクト: RCMmedia/rubicon
 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();
 }
コード例 #18
0
    $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();
コード例 #19
0
ファイル: password.php プロジェクト: RCMmedia/rubicon
<?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();
コード例 #20
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();
 }
コード例 #21
0
ファイル: login.php プロジェクト: RCMmedia/rubicon
<?php

$this->layout->set_partial('header', HC_Html::page_header(HC_Html_Factory::element('h2')->add_child(HCM::__('Log In'))));
$app_conf = HC_App::app_conf();
if ($app_conf->get('login_with') == 'username') {
    $identity_label = HCM::__('Username');
} else {
    $identity_label = HCM::__('Email');
}
$display_form = HC_Html_Factory::widget('form')->add_attr('action', HC_Lib::link('auth/login')->url())->add_attr('class', 'form-horizontal')->add_attr('class', 'form-condensed');
$display_form->add_item(HC_Html_Factory::widget('label_row')->set_label($identity_label)->set_content($form->input('identity')->add_attr('placeholder', $identity_label))->set_error($form->input('identity')->error()));
$display_form->add_item(HC_Html_Factory::widget('label_row')->set_label(HCM::__('Password'))->set_content($form->input('password')->add_attr('placeholder', HCM::__('Password')))->set_error($form->input('password')->error()));
$display_form->add_item(HC_Html_Factory::widget('label_row')->set_content(HC_Html_Factory::element('input')->add_attr('type', 'submit')->add_attr('class', array('btn', 'btn-default'))->add_attr('title', HCM::__('Log In'))->add_attr('value', HCM::__('Log In'))));
$out = HC_Html_Factory::widget('list')->add_attr('class', 'list-unstyled')->add_attr('class', 'list-separated');
$out->add_item($display_form);
$out->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', HC_Lib::link('auth/forgot_password'))->add_child(HCM::__('Lost your password?')));
echo $out->render();
コード例 #22
0
ファイル: draft.php プロジェクト: RCMmedia/rubicon
<?php

if (!$count) {
    return;
}
$temp_shift = HC_App::model('shift');
$linkto = HC_Lib::link('list/index', array('filter' => 'draft'));
$title = HC_Html_Factory::widget('list')->add_attr('class', 'list-inline')->add_attr('class', 'list-separated')->add_item('title', HC_Html_Factory::widget('titled', 'a')->add_attr('href', $linkto)->add_child(HCM::__('Draft Shifts')))->add_item('count', HC_Html_Factory::element('span')->add_attr('class', 'badge')->add_child($count));
$out = HC_Html_Factory::element('div')->add_attr('class', 'alert')->add_attr('class', 'alert-default-o')->add_child($title);
//$color = Hc_lib::random_html_color( 2 );
$color = '#dff0d8';
$color1 = HC_Lib::adjust_color_brightness($color, 0);
$color2 = HC_Lib::adjust_color_brightness($color, 20);
$out->add_attr('style', "background: repeating-linear-gradient(\r\n\t\t-45deg,\r\n\t\t{$color1},\r\n\t\t{$color1} 6px,\r\n\t\t{$color2} 6px,\r\n\t\t{$color2} 12px\r\n\t\t);\r\n\t");
echo $out->render();
コード例 #23
0
ファイル: overview_edit.php プロジェクト: RCMmedia/rubicon
/* LOCATION */
if ($object->type != $object->_const('TYPE_TIMEOFF')) {
    $location_view = HC_Html_Factory::widget('module')->set_url('shifts/zoom/form')->pass_arg($object)->pass_arg('location')->set_self_target(TRUE)->set_skip_src(TRUE);
    $display_form->add_item(HC_Html_Factory::widget('label_row')->set_label(HCM::__('Location'))->set_content($location_view));
}
/* time labels with shift templates */
$templates_label = '';
if (count($shift_templates) && $object->type == $object->_const('TYPE_SHIFT')) {
    $templates_label = HC_Html_Factory::widget('dropdown');
    $templates_label->set_wrap();
    $templates_label->set_no_caret(FALSE);
    $templates_label->set_title(HC_Html_Factory::element('a')->add_child(HC_Html::icon('clock-o'))->add_attr('title', HCM::__('Shift Templates'))->add_attr('class', array('btn', 'btn-default')));
    $t = HC_Lib::time();
    foreach ($shift_templates as $sht) {
        $end = $sht->end > 24 * 60 * 60 ? $sht->end - 24 * 60 * 60 : $sht->end;
        $templates_label->add_item(HC_Html_Factory::element('a')->add_attr('class', 'hc-shift-templates')->add_attr('href', '#')->add_attr('data-start', $sht->start)->add_attr('data-end', $end)->add_attr('data-start-display', $t->formatTimeOfDay($sht->start))->add_attr('data-end-display', $t->formatTimeOfDay($sht->end))->add_child($sht->name)->add_child('<br/>')->add_child($t->formatPeriodOfDay($sht->start, $sht->end)));
    }
}
/* TIME */
if ($templates_label) {
    $time_input = HC_Html_Factory::widget('list')->add_attr('class', 'list-unstyled')->add_attr('class', 'list-inline')->add_item('item', $form->input('time'))->add_item('label', $templates_label)->add_item_attr('label', 'style', 'margin-left: 1em;');
} else {
    $time_input = $form->input('time');
}
$display_form->add_item(HC_Html_Factory::widget('grid')->add_item(HC_Html_Factory::widget('label_row')->set_label(HCM::__('Time'))->set_content($time_input)->set_error($form->input('time')->error()), 7)->add_item(HC_Html_Factory::widget('label_row')->set_label(HCM::__('Date'))->set_content($form->input('date'))->set_error($form->input('date')->error()), 5));
/* STAFF */
$display_form->add_item($form->input('user'));
$staff_view = HC_Html_Factory::widget('module')->set_url('shifts/zoom/form')->pass_arg($object)->pass_arg('user')->set_self_target(TRUE)->set_skip_src(TRUE);
$display_form->add_item(HC_Html_Factory::widget('label_row')->set_label(HCM::__('Staff'))->set_content($staff_view));
/* STATUS */
$display_form->add_item(HC_Html_Factory::widget('label_row')->set_label(HCM::__('Status'))->set_content($form->input('status')->set_inline(TRUE)->add_option($object->_const('STATUS_DRAFT'), $object->set('status', $object->_const('STATUS_DRAFT'))->present_status())->add_option($object->_const('STATUS_ACTIVE'), $object->set('status', $object->_const('STATUS_ACTIVE'))->present_status())->render())->set_error($form->input('status')->error()));
コード例 #24
0
ファイル: index.php プロジェクト: RCMmedia/rubicon
$list = $layout->partial('list');
if (!($is_module or $is_print)) {
    if ($calendar_ajax) {
        $out = HC_Html_Factory::widget('flatmodal');
        $out->set_content($list);
        $list = $out->render();
    }
    if ($filter or $control) {
        $out = HC_Html_Factory::widget('list')->add_attr('class', 'list-unstyled');
        if ($filter) {
            $out->add_item('filter', $filter);
            $out->add_item_attr('filter', 'class', array('text-smaller'));
        }
        if ($control) {
            $out->add_item($control);
        }
        $out->add_item($list);
        echo $out->render();
    } else {
        echo $list;
    }
} else {
    if ($is_print) {
        /* DATE */
        $date_nav = HC_Html_Factory::widget('date_nav');
        $date_nav->set_range($state['range']);
        $date_nav->set_date($state['date']);
        echo HC_Html_Factory::element('p')->add_child($date_nav->render(TRUE));
    }
    echo $list;
}
コード例 #25
0
ファイル: shift_view.php プロジェクト: RCMmedia/rubicon
 function render()
 {
     $sh = $this->shift();
     $t = HC_Lib::time();
     $titles = array();
     $iknow = $this->iknow();
     $wide = $this->wide();
     $use_color = FALSE;
     $use_color = TRUE;
     if ($wide && $wide === 'mini') {
         $use_color = TRUE;
     }
     if (in_array($sh->type, array($sh->_const("TYPE_TIMEOFF")))) {
         $display = array('date', 'time', 'user', 'location');
     } else {
         if (!$wide or $wide === 'mini') {
             $display = array('date', 'time', 'location', 'user');
         } elseif ($wide) {
             $display = array('date', 'time', 'user', 'location');
         }
     }
     foreach ($iknow as $ik) {
         $display = HC_Lib::remove_from_array($display, $ik);
     }
     // if( in_array($sh->type, array($sh->_const("TYPE_TIMEOFF"))) ){
     // $display = HC_Lib::remove_from_array($display, 'location');
     // }
     foreach ($display as $ds) {
         $title_view = '';
         switch ($ds) {
             case 'date':
                 $title_view = $sh->present_date(HC_PRESENTER::VIEW_RAW);
                 break;
             case 'time':
                 $title_view = $sh->present_time();
                 break;
             case 'location':
                 if (in_array($sh->type, array($sh->_const("TYPE_TIMEOFF")))) {
                     $title_view = '';
                     // $title_view = HCM::__('Timeoff');
                     // $title_view = $sh->present_location();
                 } else {
                     $title_view = $sh->present_location();
                 }
                 break;
             case 'user':
                 if ($sh->type == $sh->_const('TYPE_TIMEOFF') && !in_array('time', $display)) {
                     $title_view = $sh->present_type(HC_PRESENTER::VIEW_HTML_ICON) . $sh->present_user(HC_PRESENTER::VIEW_RAW);
                 } else {
                     // $titles[] = $sh->present_user();
                     if ($sh->user_id) {
                         $title_view = $sh->present_user(HC_PRESENTER::VIEW_RAW);
                     } else {
                         $title_view = $sh->present_user();
                     }
                 }
                 break;
         }
         // if( $title_view ){
         $titles[] = $title_view;
         // }
     }
     $wrap = HC_Html_Factory::element('div')->add_attr('class', array('alert', 'display-block'))->add_attr('class', array('alert-default-o'))->add_attr('class', array('no-underline'))->add_attr('class', array('alert-condensed2'))->add_attr('class', array('text-smaller'))->add_attr('class', array('squeeze-in'));
     foreach ($sh->present_status_class() as $status_class) {
         // $wrap->add_attr('class', 'alert-' . $status_class);
     }
     /* background color depends on location */
     if ($use_color) {
         $color = $sh->location->present_color();
     } else {
         $type = $sh->type;
         switch ($type) {
             case $sh->_const('TYPE_TIMEOFF'):
                 $wrap->add_attr('class', array('alert-archive'));
                 $color = '#ddd';
                 break;
             default:
                 $wrap->add_attr('class', array('alert-success-o'));
                 $color = '#dff0d8';
                 break;
         }
     }
     if ($sh->status == $sh->_const('STATUS_DRAFT')) {
         $color1 = HC_Lib::adjust_color_brightness($color, 0);
         $color2 = HC_Lib::adjust_color_brightness($color, 20);
         // $color1 = '#fff';
         // $color2 = '#eee';
         $wrap->add_attr('style', "background: repeating-linear-gradient(\r\n\t\t\t\t\t-45deg,\r\n\t\t\t\t\t{$color1},\r\n\t\t\t\t\t{$color1} 6px,\r\n\t\t\t\t\t{$color2} 6px,\r\n\t\t\t\t\t{$color2} 12px\r\n\t\t\t\t\t);\r\n\t\t\t\t");
     } else {
         $wrap->add_attr('style', 'background-color: ' . $color . ';');
         // $wrap->add_attr('class', 'alert-success');
     }
     if (!$sh->user_id) {
         $wrap->add_attr('class', 'hc-red-triangled');
     }
     //		echo $color;
     /* ID */
     if (in_array('id', $iknow)) {
         $wrap->add_child($sh->present_id());
     }
     /* build link title */
     $nolink = $this->nolink();
     $new_window = $this->new_window();
     $a_link = HC_Html_Factory::widget('titled', 'a');
     $link_to = 'shifts/zoom/index/id/' . $sh->id;
     $a_link->add_attr('href', HC_Lib::link($link_to)->url());
     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 ($nolink) {
         $a_title = HC_Html_Factory::widget('titled', 'span');
     } else {
         $a_title = HC_Html_Factory::widget('titled', 'a');
     }
     $a_title = HC_Html_Factory::widget('titled', 'span');
     $a_title->add_attr('class', array('squeeze-in'));
     // $a_title->add_attr('style', 'border: red 1px solid;');
     // $a_title->add_attr('style', 'border-color: ' . $sh->location->present_color());
     if ($wide === 'mini') {
         if (!$nolink) {
             $final_ttl = clone $a_link;
             $final_ttl->add_child('&nbsp;')->add_attr('style', 'display: block;');
             $final_ttl->add_attr('title', join(' ', $titles));
         }
         $a_title->add_child($final_ttl);
     } else {
         if (count($display) > 1) {
             if ($wide) {
                 $titles2 = HC_Html_Factory::widget('grid');
                 $titles2->set_slim();
                 $grid_width = array(2 => 6, 3 => 4, 4 => 3, 5 => 2, 6 => 2);
                 $grid_width = isset($grid_width[count($display)]) ? $grid_width[count($display)] : 2;
                 for ($ti = 0; $ti < count($titles); $ti++) {
                     $ttl = $titles[$ti];
                     // next title is empty?
                     if ($ti < count($titles) - 1 && !strlen($titles[$ti + 1])) {
                         $ti++;
                         $grid_width += $grid_width;
                     }
                     $final_ttl = $ttl;
                     if (!$nolink) {
                         $final_ttl = clone $a_link;
                         $final_ttl->add_child($ttl);
                     }
                     $titles2->add_item($final_ttl, $grid_width, array('class' => 'squeeze-in'));
                 }
             } else {
                 $titles2 = HC_Html_Factory::widget('list')->add_attr('class', 'list-unstyled');
                 $this_index = 0;
                 foreach ($titles as $ttl) {
                     if (!strlen($ttl)) {
                         continue;
                     }
                     $final_ttl = $ttl;
                     if (!$nolink) {
                         $final_ttl = clone $a_link;
                         $final_ttl->add_child($ttl);
                     }
                     $titles2->add_item($this_index, $final_ttl);
                     $titles2->add_item_attr($ttl, 'class', array('squeeze-in'));
                     $this_index++;
                 }
             }
             $a_title->add_attr('title', join(' ', $titles));
             $a_title->add_child($titles2);
         } else {
             $final_ttl = $titles;
             if (!$nolink) {
                 $final_ttl = clone $a_link;
                 $final_ttl->add_child($titles);
             }
             $final_ttl->add_attr('title', join(' ', $titles));
             $a_title->add_child($final_ttl);
         }
     }
     $wrap->add_child($a_title);
     /* EXTENSIONS */
     $extensions = HC_App::extensions();
     $more_content = $extensions->set_skip($iknow)->run('shifts/quickview', $sh, $wrap);
     if ($wide !== 'mini') {
         if ($more_content) {
             $more_wrap = HC_Html_Factory::widget('list')->add_attr('class', 'list-unstyled')->add_attr('class', 'list-separated')->add_attr('class', 'text-small');
             $added = 0;
             foreach ($more_content as $mck => $mc) {
                 if ($mck && in_array($mck, $iknow)) {
                     continue;
                 }
                 $more_wrap->add_item($mc);
                 $added++;
             }
             if ($added) {
                 $wrap->add_child($more_wrap);
             }
         }
     }
     /* THIS CHILDREN */
     if ($wide !== 'mini') {
         $children = $this->children();
         foreach ($children as $child) {
             $wrap->add_child($child);
         }
     }
     $wrap->add_attr('class', 'common-link-parent');
     return $wrap->render();
 }
コード例 #26
0
ファイル: _header.php プロジェクト: RCMmedia/rubicon
<?php

$header = HC_Html_Factory::widget('list')->add_attr('class', 'list-unstyled')->add_item('title', HC_Html_Factory::element('h2')->add_child($object->present_title()));
/* 
$header->add_item(
	'staff',
	$object->present_user()
	);
*/
echo HC_Html::page_header($header);
コード例 #27
0
ファイル: setup.php プロジェクト: RCMmedia/rubicon
<?php

$this->layout->set_partial('header', HC_Html::page_header(HC_Html_Factory::element('h2')->add_child($page_title)));
$out = HC_Html_Factory::widget('list')->add_attr('class', 'list-unstyled')->add_attr('class', 'list-separated');
if ($offer_upgrade) {
    $link = HC_Lib::link('setup/upgrade');
    $out->add_item(HC_Html_Factory::element('a')->add_attr('href', $link->url())->add_child('You seem to have an older version already installed. Please click here to upgrade.'));
    $out->add_item('Or continue below to install from scratch.');
}
$link = HC_Lib::link('setup/run');
$display_form = HC_Html_Factory::widget('form')->add_attr('action', $link->url())->add_attr('class', 'form-horizontal')->add_attr('class', 'form-condensed');
$display_form->add_item(HC_Html_Factory::widget('label_row')->set_content(HC_Html_Factory::element('h4')->add_child(HCM::__('Admin')))->set_content_static());
$display_form->add_item(HC_Html_Factory::widget('label_row')->set_label(HCM::__('First Name'))->set_content($form->input('first_name')->add_attr('size', 24))->set_error($form->input('first_name')->error()));
$display_form->add_item(HC_Html_Factory::widget('label_row')->set_label(HCM::__('Last Name'))->set_content($form->input('last_name')->add_attr('size', 24))->set_error($form->input('last_name')->error()));
$display_form->add_item(HC_Html_Factory::widget('label_row')->set_label(HCM::__('Email'))->set_content($form->input('email')->add_attr('size', 48))->set_error($form->input('email')->error()));
$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()));
$display_form->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()));
$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', 'Proceed To Setup')->add_attr('value', 'Proceed To Setup'));
$display_form->add_item(HC_Html_Factory::widget('label_row')->set_content($buttons));
$out->add_item($display_form);
echo $out->render();
コード例 #28
0
ファイル: date_nav.php プロジェクト: RCMmedia/rubicon
 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();
 }
コード例 #29
0
ファイル: module.php プロジェクト: RCMmedia/rubicon
 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;
 }
コード例 #30
0
<?php

$my_own = FALSE;
if (!$wrap) {
    $my_own = TRUE;
    $wrap = HC_Html_Factory::widget('list')->add_attr('class', 'list-inline')->add_attr('class', 'list-separated');
}
if ($count_fail) {
    $title = sprintf(HCM::_n('%d Conflict', '%d Conflicts', $count_fail), $count_fail);
    $item = HC_Html_Factory::element('titled', 'span')->add_attr('class', 'display-block')->add_attr('class', 'alert')->add_attr('class', 'alert-condensed2')->add_attr('class', 'alert-danger')->add_attr('class', 'text-smaller2')->add_child($title);
    $wrap->add_item($item);
}
if ($my_own) {
    if ($wrap->items()) {
        echo $wrap->render();
    }
}