public function type($model, $vlevel = HC_PRESENTER::VIEW_HTML) { $return = ''; switch ($model->type) { case $model->_const('TYPE_UNAVAILABLE'): /* translators: availability type */ $title = HCM::__('Unavailable'); $label = HC_Html::icon('thumbs-down'); break; case $model->_const('TYPE_PREFERRED'): /* translators: availability type */ $title = HCM::__('Preferred'); $label = HC_Html::icon('thumbs-up'); break; } switch ($vlevel) { case HC_PRESENTER::VIEW_HTML: $return = HC_Html_Factory::widget('titled', 'span')->add_child($label)->add_child($title)->add_attr('class', $model->present_style_class()); break; case HC_PRESENTER::VIEW_HTML_ICON: $return = HC_Html_Factory::widget('titled', 'span')->add_child($label)->add_attr('class', $model->present_style_class()); break; default: $return = $title; break; } return $return; }
function created($model, $vlevel = HC_PRESENTER::VIEW_HTML) { $value = $model->created; $t = HC_Lib::time(); $t->setTimestamp($value); $return = array(); switch ($vlevel) { case HC_PRESENTER::VIEW_HTML: $return[] = HC_Html::icon(HC_App::icon_for('date')); break; } $return[] = $t->formatDateFull(); switch ($vlevel) { case HC_PRESENTER::VIEW_HTML: $return[] = HC_Html::icon(HC_App::icon_for('time')); break; } $return[] = $t->formatTime(); switch ($vlevel) { case HC_PRESENTER::VIEW_TEXT: case HC_PRESENTER::VIEW_RAW: $return = join(' ', $return); break; default: $return = join('', $return); break; } return $return; }
function label($model, $vlevel = HC_PRESENTER::VIEW_HTML) { $return = ''; switch ($vlevel) { case HC_PRESENTER::VIEW_HTML: case HC_PRESENTER::VIEW_HTML_ICON: $ri = HC_Lib::ri(); if ($ri == 'wordpress') { $avatar = get_avatar($model->email, 16); $return = HC_Html::icon('', TRUE, $avatar); } else { $return = HC_Html::icon(HC_App::icon_for('user')); if (!$model->exists()) { $return->add_attr('class', 'text-danger'); } else { if ($model->id && $model->active != $model->_const('STATUS_ACTIVE')) { $return = HC_Html::icon_stack(array(HC_App::icon_for('user'), array('ban', 'text-muted'))); } } } break; case HC_PRESENTER::VIEW_TEXT: $return = HCM::__('Staff'); break; } return $return; }
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; }
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; }
function label($model, $vlevel = HC_PRESENTER::VIEW_HTML) { $return = ''; switch ($vlevel) { case HC_PRESENTER::VIEW_HTML: case HC_PRESENTER::VIEW_HTML_ICON: $return = HC_Html::icon(HC_App::icon_for('location')); $color = $model->present_color(); $return->add_attr('style', 'color: ' . $color . ';'); $return->add_attr('title', $model->present_title(HC_PRESENTER::VIEW_RAW)); // $return->add_attr('style', 'border: blue 1px solid;'); $return = NULL; break; case HC_PRESENTER::VIEW_TEXT: $return = HCM::__('Location'); break; } return $return; }
<?php $list = HC_Html_Factory::widget('list')->add_attr('class', array('list-unstyled')); if ($shift->release_request) { $list->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', HC_Lib::link('shifts/zoom/index/id/' . $shift->id . '/tab/release'))->add_attr('class', array('hc-flatmodal-loader'))->add_attr('class', array('btn'))->add_attr('class', array('btn-xs'))->add_attr('class', array('btn-warning'))->add_child(HC_Html::icon('sign-out'))->add_child(HCM::__('Shift Release Pending'))); } if ($list->items()) { echo $list->render(); }
$item->add_child($main); /* EXTENSIONS SUCH AS CONFLICTS */ for ($mi = 0; $mi < count($models); $mi++) { $models[$mi]->user_id = $st->id; } $more_content = $extensions->run('shifts/assign/quickview', $models); 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')->add_attr('style', 'margin-top: 0.5em;'); $added = 0; foreach ($more_content as $mck => $mc) { $more_wrap->add_item($mc); $added++; } if ($added) { $item->add_child($more_wrap); } } $out2->add_item($item); } } $display_form->add_item($out2); $buttons = HC_Html_Factory::widget('list')->add_attr('class', array('list-inline', 'list-separated')); if ($free_staff) { $buttons->add_item(HC_Html_Factory::element('input')->add_attr('type', 'submit')->add_attr('class', array('btn', 'btn-default'))->add_attr('title', HCM::__('Assign Selected Staff'))->add_attr('value', HCM::__('Assign Selected Staff'))); } else { $buttons->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('class', array('btn', 'btn-default'))->add_attr('href', HC_Lib::link('shifts/add/index')->url($params->to_array()))->add_child(HC_Html::icon('arrow-left'))->add_child(HCM::__('Back'))); } $display_form->add_item(HC_Html_Factory::widget('label_row')->set_content($buttons)); // $out->add_item( $out2 ); $out->add_item($display_form); echo $out->render();
<?php $acl = HC_App::acl(); $t = HC_Lib::time(); $list = HC_Html_Factory::widget('list')->add_attr('class', array('list-unstyled'))->add_attr('class', array('list-separated')); foreach ($entries as $e) { $can = $acl->set_object($e)->can('edit'); $t->setTimestamp($e->created); $wrap = HC_Html_Factory::widget('panel')->add_attr('class', 'panel-default')->add_attr('class', 'panel-condensed'); $header = HC_Html_Factory::widget('container'); if ($can) { $header->add_item(HC_Html_Factory::element('a')->add_child(HC_Html::icon('times')->add_attr('class', 'text-danger'))->add_attr('href', HC_Lib::link('notes/delete/' . $e->id))->add_attr('title', HCM::__('Delete'))->add_attr('class', array('close', 'text-danger', 'hc-confirm'))); } $header->add_item(HC_Html_Factory::widget('list')->add_attr('class', array('list-inline'))->add_attr('class', array('list-separated'))->add_attr('class', array('text-small'))->add_item($e->present_created(HC_PRESENTER::VIEW_TEXT))->add_item($e->author->present_title())); $wrap->set_header($header); $wrap->set_body(HC_Html_Factory::element('em')->add_child($e->content)); if ($can && count($access_levels) > 1) { $wrap->set_footer(HC_Html_Factory::widget('list')->add_attr('class', 'list-unstyled')->add_attr('class', 'list-separated')->add_attr('class', array('text-muted'))->add_attr('class', array('text-small'))->add_item(HCM::__('Comment Visible To') . ':')->add_item(HC_Html_Factory::element('strong')->add_child($access_levels[$e->access_level]))); } $list->add_item($wrap); } $acl = HC_App::acl(); if ($acl->set_object($parent_object)->can('notes::add')) { $display_form = HC_Html_Factory::widget('form')->add_attr('action', HC_Lib::link('notes/add/' . $parent_object->my_class() . '/' . $parent_object->id))->add_attr('class', 'form-horizontal')->add_attr('class', 'form-condensed'); $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-primary'))->add_attr('title', HCM::__('Add New Comment'))->add_attr('value', HCM::__('Add New Comment'))); $display_form->add_item($this->load->view('notes/add_form_inputs', array('parent_object' => $parent_object, 'form' => $form, 'buttons' => $buttons), TRUE)); $list->add_item($display_form); } echo $list->render();
<?php $t = HC_Lib::time(); $list = HC_Html_Factory::widget('list')->add_attr('class', array('list-unstyled'))->add_attr('class', array('list-separated'))->add_attr('style', 'vertical-align: top;'); $list->add_item($form->input('notes')->add_attr('style', 'width: 90%;')); if (count($access_levels) > 1) { $list->add_item('visible', HC_Html_Factory::widget('list')->add_attr('class', array('list-unstyled'))->add_item('label', HCM::__('Comment Visible To'))->add_item_attr('label', 'class', array('text-muted', 'text-smaller'))->add_item('input', $form->input('access_level')->set_options($access_levels)->add_attr('class', 'text-smaller')->add_attr('style', 'width: 90%;')))->add_item_attr('visible', 'style', 'vertical-align: top;'); } if (isset($buttons)) { $list = HC_Html_Factory::widget('list')->add_attr('class', 'list-unstyled')->add_attr('class', 'list-separated')->add_item($list)->add_item($buttons); } $out = HC_Html_Factory::widget('collapse')->set_title(HC_Html_Factory::element('span')->add_attr('class', 'text-smaller')->add_child(HC_Html::icon('comment-o') . HCM::__('Add New Comment')))->set_content($list)->set_indented(FALSE); echo $out->render();
public function render($root) { $menu = $this->_get_menu($root); $return = ''; if (!$menu) { return $return; } $container = HC_Html_Factory::element('div')->add_attr('class', array('navbar', 'navbar-default'))->add_attr('class', array('collapse-panel'))->add_child(HC_Html_Factory::element('div')->add_attr('class', array('navbar-header'))->add_child(HC_Html_Factory::element('button')->add_attr('type', 'button')->add_attr('class', 'hc-collapse-next')->add_attr('class', 'navbar-toggle')->add_child(HC_Html_Factory::element('span')->add_child('Toggle Navigation')->add_attr('class', 'sr-only'))->add_child(HC_Html_Factory::element('span')->add_child(HC_Html::icon('bars'))))); $nav_container = HC_Html_Factory::element('div')->add_attr('class', array('collapse', 'navbar-collapse')); $nav = HC_Html_Factory::widget('list')->add_attr('class', array('nav', 'navbar-nav')); foreach ($menu as $mk => $m) { $li_attrs = array(); if (isset($m['children']) && $m['children']) { $item = HC_Html_Factory::widget('dropdown_menu'); $item->set_items($m['children']); $item->set_title(array('title' => $m['title'], 'icon' => isset($m['icon']) ? $m['icon'] : '')); } else { if (isset($m['external']) && $m['external']) { $item = HC_Html_Factory::element('a')->add_attr('href', $m['link'])->add_attr('title', $m['title'])->add_attr('target', '_blank')->add_child(HC_Html_Factory::element('span')->add_attr('class', array('alert', 'alert-success-o'))->add_child($m['title'])); } else { $item = HC_Html_Factory::element('a')->add_attr('href', $m['href'])->add_attr('title', $m['title'])->add_child(HC_Html::icon($m['icon']) . $m['title']); } } $nav->add_item($mk, $item, $li_attrs); if (isset($m['active']) && $m['active']) { $nav->add_item_attr($mk, 'class', 'active'); } } $nav_container->add_child($nav); $container->add_child($nav_container); return $container->render(); }
} if ($added) { $user_item->add_child($more_wrap); } } } $item->add_item($user_item); } } break; } switch ($this_tab) { case 'user': if ($tab != 'more_user') { if ($params->get('type') != $temp_shift->_const('TYPE_TIMEOFF') or $remain_users > 0) { // $item->add_divider(); $item->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', HC_Lib::link('shifts/add/add_user')->url($params->to_array()))->add_attr('class', array('btn'))->add_attr('class', array('btn-default'))->add_attr('class', array('btn-archive'))->add_attr('class', array('btn-sm'))->add_child(HC_Html::icon('plus') . ' ' . HCM::__('Add Staff'))); $item = HC_Html_Factory::widget('list')->add_attr('class', 'list-unstyled')->add_attr('class', 'list-separated')->add_item($item); } } $item = HC_Html_Factory::widget('label_row')->set_label(HCM::__('Staff'))->set_content($item); break; default: break; } if ($item) { $menubar->add_item($this_tab, $item); } } } echo $menubar->render();
$icon = HC_Html::icon('check-circle'); $icon->add_attr('class', 'text-success'); $item->add_child($icon); $title = $count_fail + $count_ok > 1 ? $count_ok : HCM::__('OK'); $item->add_child($title); $item->add_attr('title', HCM::__('OK')); if (!$count_fail) { $out->add_item($item); } } $t = HC_Lib::time(); /* failed */ if ($count_fail) { /* link to detailed conflicts view */ $item = HC_Html_Factory::widget('titled', 'span')->add_attr('class', array('alert', 'alert-danger'))->add_attr('class', array('alert-condensed')); $icon = HC_Html::icon(HC_App::icon_for('conflict')); $icon->add_attr('class', 'text-danger'); $item->add_child($icon); $title = sprintf(HCM::_n('%d Conflict', '%d Conflicts', $count_fail), $count_fail); $item->add_child($title); $item->add_child(' ')->add_child(HC_Html_Factory::element('b')->add_attr('class', 'caret')); /* red border for wrap */ if ($wrap) { $wrap->add_attr('style', 'border-width: 2px; border-color: red;'); } /* now add detailed view */ // _print_r( $conflicts ); $conflict_list = HC_Html_Factory::widget('list')->add_attr('class', array('list-unstyled'))->add_attr('class', array('list-separated')); foreach ($conflicts as $date => $date_conflicts) { if (!$date_conflicts) { continue;
<?php $out = HC_Html_Factory::widget('container'); $out->add_item($form->input('location')); $location_view = HC_Html_Factory::element('div')->add_attr('class', 'alert')->add_attr('class', 'alert-default-o')->add_child(HC_Html_Factory::element('a')->add_attr('class', 'hc-flatmodal-loader')->add_attr('href', HC_Lib::link('shifts/zoom/change/' . $object->id . '/location/' . $form->input('location')->value()))->add_attr('class', 'display-block')->add_child($object->present_location())->add_child(HC_Html::icon('caret-down')->add_attr('style', 'float: right;'))); $out->add_item($location_view); echo $out->render();
<?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();
static function icon_stack($icons) { $icon1 = array_shift($icons); $icon2 = array_shift($icons); $return = HC_Html_Factory::element('span')->add_attr('class', 'fa-stack')->add_attr('class', 'fa-fw'); if (!is_array($icon1)) { $icon1 = array($icon1); } if (!is_array($icon2)) { $icon2 = array($icon2); } $step1 = HC_Html::icon(array_shift($icon1), FALSE); foreach ($icon1 as $ic1) { $step1->add_attr('class', $ic1); } $step2 = HC_Html::icon(array_shift($icon2), FALSE); foreach ($icon2 as $ic2) { $step2->add_attr('class', $ic2); } $step1->add_attr('class', 'fa-stack-1x'); // $step1->add_attr('class', 'align-right'); $step2->add_attr('class', 'fa-stack-15x'); // $step2->add_attr('class', 'align-right'); $return->add_child($step1); $return->add_child($step2); return $return; }
<?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);
<?php echo HC_Html::page_header(HC_Html_Factory::element('h2')->add_child(HCM::__('Users')));
function render() { if (!($link = $this->link())) { return 'HC_Html_Widget_Filter: link is not set!'; } // $this->set_panel('default'); $add_title = $this->title(); $readonly = $this->readonly(); $allow_multiple = $this->allow_multiple(); $require_one = $this->require_one(); $fixed = $this->fixed(); $title = $add_title; $selected = $this->selected(); if ($selected) { $title = array(); foreach ($selected as $sel) { $title[] = $this->option($sel); } $title = join(' ', $title); } $filter_icon = HC_Html_Factory::element('span')->add_attr('class', 'btn')->add_attr('class', 'btn-default')->add_child(HC_Html::icon('glass')); $filter_icon = ''; if ($readonly && !$this->selected()) { return NULL; } $title = $filter_icon . $title; $this->set_title($title); $content = HC_Html_Factory::widget('list')->add_attr('class', 'list-inline')->add_attr('class', 'list-separated')->add_attr('class', 'list-separated-ver'); $btn_size = $this->btn_size(); $btn_size = 'btn-' . $btn_size; /* remaining possible options */ $remain_options = FALSE; if (!$this->selected() or $allow_multiple) { $param_name = $this->param_name(); foreach ($this->options() as $id => $label) { if (!in_array($id, $this->selected())) { $option_wrap = HC_Html_Factory::widget('titled', 'a')->add_attr('class', 'btn')->add_attr('class', $btn_size)->add_attr('class', 'btn-default')->add_attr('class', 'squeeze-in')->add_attr('class', 'text-left')->add_attr('style', 'width: 10em;')->add_attr('style', 'text-align: left;'); if ($param_name === NULL) { $option_wrap->add_attr('href', $link->url($id, array())); } else { $option_wrap->add_attr('href', $link->url(array($param_name . '+' => $id))); } $option_wrap->add_child($label); $attr = isset($this->option_attr[$id]) ? $this->option_attr[$id] : array(); foreach ($attr as $attr_k => $attr_v) { $option_wrap->add_attr($attr_k, $attr_v); } $content->add_item($id, $option_wrap); $remain_options = TRUE; } } } $this->set_content($content); $panel = $this->panel(); $out = HC_Html_Factory::widget('list')->add_attr('class', 'list-unstyled')->add_attr('class', 'collapse-panel'); if ($panel) { $out->add_attr('class', array('panel', 'panel-' . $panel)); $out->add_attr('class', array('panel-condensed')); } /* build trigger */ $title = HC_Html_Factory::widget('list')->add_attr('class', 'list-separated')->add_attr('class', 'list-inline'); /* current selection */ $selected = $this->selected(); if ($selected) { foreach ($selected as $sel) { if ($require_one) { $option_wrap = HC_Html_Factory::widget('titled', 'a')->add_attr('href', '#')->add_attr('class', 'hc-collapse-next'); } else { $option_wrap = HC_Html_Factory::widget('titled', 'div'); if (!$fixed) { $option_wrap->add_child(HC_Html_Factory::element('a')->add_attr('href', $link->url(array($this->param_name() . '-' => $sel)))->add_attr('class', 'btn-close')->add_attr('class', 'btn')->add_attr('class', 'btn-danger-o')->add_child(HC_Html::icon('times'))); } } $option_wrap->add_attr('class', 'btn')->add_attr('class', $btn_size)->add_attr('class', 'btn-default')->add_attr('class', 'btn')->add_attr('class', 'squeeze-in')->add_attr('class', 'text-left')->add_attr('style', 'width: 10em;')->add_attr('style', 'text-align: left;'); $option_label = $this->option($sel); $option_wrap->add_child($option_label); if ($require_one) { $option_wrap->add_child(' ')->add_child(HC_Html_Factory::element('b')->add_attr('class', 'caret')); } $attr = isset($this->option_attr[$sel]) ? $this->option_attr[$sel] : array(); foreach ($attr as $attr_k => $attr_v) { $option_wrap->add_attr($attr_k, $attr_v); } $title->add_item($sel, $option_wrap); } } if ($remain_options && !$require_one) { $trigger = HC_Html_Factory::element('a')->add_child(HC_Html::icon('plus') . HCM::_x('Filter', 'noun') . ': ' . $add_title)->add_attr('href', '#')->add_attr('class', 'hc-collapse-next')->add_attr('class', 'btn')->add_attr('class', 'btn-success-o')->add_attr('class', $btn_size); $title->add_item($trigger); } $out->add_item('header', $title); if ($panel) { $out->add_item_attr('header', 'class', 'panel-heading'); } $out->add_item_attr('content', 'class', 'collapse'); if ($panel) { $out->add_item_attr('content', 'class', 'panel-collapse'); } if ($this->default_in()) { $out->add_item_attr('content', 'class', 'in'); } if ($panel) { $out->add_item('content', HC_Html_Factory::element('div')->add_attr('class', 'panel-body')->add_child($this->content())); } else { $out->add_item('content', $this->content()); } return $out->render(); return parent::render(); }
} } else { $old_view = ''; if ($e->old !== NULL) { $this_object->{$pname} = $e->old; $old_view = $this_object->{'present_' . $pname}(); } $this_object->{$pname} = $e->new; $new_view = $this_object->{'present_' . $pname}(); } $change_view = HC_Html_Factory::widget('list')->add_attr('class', array('list-inline')); if ($old_view) { $change_view->add_item($old_view); } if ($new_view && $old_view) { $change_view->add_item(HC_Html::icon('arrow-right')); } if ($new_view) { $change_view->add_item($new_view); } } if (strlen($pname_view)) { $row->add_item($pname_view, 4); $row->add_item($change_view, 8); } else { $row->add_item($change_view, 12); } } $body->add_item($row); } /*
} else { $user_title .= $user->email; } $user_title .= ']'; $link_profile = 'auth/profile'; $nav->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', HC_Lib::link($link_profile))->add_child($user_title)); $auth_user = $this->auth->user(); $acl = HC_App::acl(); $acl_user = $acl->user(); $ri = HC_Lib::ri(); if ($auth_user->id != $acl_user->id) { if ($ri == 'wordpress') { if ($auth_user->level >= $auth_user->_const('LEVEL_MANAGER')) { $nav->add_divider(); $app = HC_App::app(); $admin_url = get_admin_url() . 'admin.php?page=' . $app; $nav->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', $admin_url)->add_child(HC_Html::icon('cogs'))->add_child(HC_Html_Factory::element('span')->add_attr('class', 'hidden-xs')->add_child(HCM::__('Admin Area')))); } } } $nav->add_divider(); $nav->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', HC_Lib::link('auth/logout'))->add_child(HC_Html_Factory::element('span')->add_attr('class', 'hidden-xs')->add_child(HCM::__('Log Out')))->add_child(HC_Html::icon('sign-out'))); } else { if ($this_method != 'login') { $nav->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', HC_Lib::link('auth/login'))->add_child(HC_Html::icon('sign-in'))->add_child(HC_Html_Factory::element('span')->add_attr('class', 'hidden-xs')->add_child(HCM::__('Log In')))); } else { $nav->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', HC_Lib::link())->add_child(HC_Html::icon('arrow-left'))->add_child(HCM::__('Back To Start Page'))); } } $out->add_child($nav); echo $out->render();
<?php $this->layout->set_partial('header', HC_Html::page_header(HC_Html_Factory::element('h2')->add_child(HCM::__('Shift Templates')))); $menubar = HC_Html_Factory::widget('list'); $menubar->add_attr('class', array('list-inline', 'list-separated')); $menubar->add_item('add', HC_Html_Factory::element('a')->add_attr('href', HC_Lib::link('admin/shift_templates/add'))->add_attr('class', array('btn', 'btn-default'))->add_attr('title', HCM::__('Add New Shift Template'))->add_child(HC_Html::icon('plus')->add_attr('class', 'text-success'))->add_child(HCM::__('Add New Shift Template'))); $t = HC_Lib::time(); $view_entries = array(); foreach ($entries as $e) { $wrap = HC_Html_Factory::element('div')->add_attr('class', array('alert', 'alert-default-o'))->add_child(HC_Html_Factory::element('a')->add_child(HC_Html::icon('times')->add_attr('class', array('text-danger')))->add_attr('href', HC_Lib::link('admin/shift_templates/delete/' . $e->id))->add_attr('title', HCM::__('Delete'))->add_attr('class', array('close', 'text-danger', 'hc-confirm')))->add_child(HC_Html_Factory::widget('list')->add_attr('class', array('list-unstyled'))->add_item(HC_Html_Factory::element('a')->add_child($e->name)->add_attr('href', HC_Lib::link('admin/shift_templates/edit/' . $e->id)))->add_item($t->formatPeriodOfDay($e->start, $e->end))->add_item('[' . $t->formatPeriodExtraShort($e->get_duration(), 'hour') . ']')); $view_entries[] = $wrap; } $tiles = HC_Html_Factory::widget('tiles'); $tiles->set_items($view_entries); $out = HC_Html_Factory::widget('container'); $out->add_item($menubar); $out->add_item($tiles); echo $out->render();
<?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();
function date($model, $vlevel = HC_PRESENTER::VIEW_HTML, $with_change = FALSE) { $t = HC_Lib::time(); $t->setDateDb($model->date); $return = array(); switch ($vlevel) { case HC_PRESENTER::VIEW_HTML: $return[] = HC_Html::icon(HC_App::icon_for('date')); break; case HC_PRESENTER::VIEW_TEXT: $return[] = HCM::__('Date'); $return[] = ': '; break; } $return[] = $t->formatDateFull(); if ($with_change) { $changes = $model->get_changes(); if (isset($changes['date'])) { $t->setDateDb($changes['date']); $return[] = ' [' . HCM::__('Old Value') . ': ' . $t->formatDateFull() . ']'; } } $return = join('', $return); return $return; }
$this_state = $state; $date_content = NULL; $this_state['date'] = $this_date; $date_content = HC_Html_Factory::widget('module')->set_url($rootlink . '/day')->pass_arg(array($this_shifts, $this_state))->set_params($this_state)->set_param('date', $this_date)->add_attr('class', 'hc-rfr-' . 'dat-' . $this_date); $CELLS[$this_date] = $date_content; /* links */ $LINKS[$this_date] = NULL; if ($can_add) { $href_details = array('date' => $this_date, 'type' => $test_shift->_const('TYPE_SHIFT')); if (isset($state['staff']) && $state['staff'] && count($state['staff']) == 1) { $href_details['user'] = $state['staff'][0]; } if (isset($state['location']) && $state['location'] && count($state['location']) == 1) { $href_details['location'] = $state['location'][0]; } $btns = HC_Html_Factory::element('a')->add_attr('href', HC_Lib::link('shifts/add/index')->url($href_details))->add_attr('class', 'hc-flatmodal-loader')->add_attr('class', 'btn')->add_attr('class', 'btn-archive')->add_attr('class', 'display-block')->add_attr('style', 'text-align: center;')->add_attr('class', 'btn-sm')->add_child(HCM::__('Add'))->add_child(HC_Html::icon('plus'))->add_attr('title', HCM::__('Add')); $LINKS[$this_date] = $btns; } } /* stats view */ $quickstats_view = HC_Html_Factory::widget('module')->set_url($rootlink . '/quickstats')->pass_arg(array($shifts, $this_state))->set_show_empty(TRUE)->add_attr('class', 'hc-rfr'); foreach ($this_state as $k => $v) { if ($v or $v === 0) { $quickstats_view->set_param($k, $v); } } $QUICKSTATS = $quickstats_view; /* form view */ $QUICKFORM = NULL; if ($form) { $quickform_view = HC_Html_Factory::widget('module')->set_url($rootlink . '/quickform')->pass_arg(array($shifts, $this_state))->set_show_empty(TRUE)->add_attr('class', 'hc-rfr')->set_self_target(FALSE);
<?php $object = clone $object; $display_form = HC_Html_Factory::widget('form')->add_attr('action', HC_Lib::link('shifts/update/index/' . $object->id))->add_attr('class', 'form-condensed')->add_attr('class', 'form-small-labels'); /* 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'))->add_attr('class', array('btn-success'))->add_attr('title', HCM::__('Save'))->add_attr('value', HCM::__('Save'))); /* DELETE BUTTON */ $link = HC_Lib::link('shifts/delete/index/' . $object->id); $btn = HC_Html_Factory::element('a')->add_attr('class', array('btn'))->add_attr('href', $link->url())->add_attr('title', HCM::__('Delete'))->add_attr('class', 'btn-danger')->add_attr('class', 'btn-sm')->add_attr('class', 'hc-confirm')->add_child(HC_Html::icon('times') . HCM::__('Delete')); $buttons->add_item('delete', $btn); $buttons->add_item_attr('delete', 'class', 'pull-right'); /* 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 */ $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($form->input('time'))->set_error($form->input('time')->error()), 6)->add_item(HC_Html_Factory::widget('label_row')->set_label(HCM::__('Date'))->set_content($form->input('date'))->set_error($form->input('date')->error()), 6)); /* 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())); /* ADD NOTE IF POSSIBLE */ $extensions = HC_App::extensions(); $more_content = $extensions->run('shifts/zoom/confirm'); if ($more_content) { $more_holder = HC_Html_Factory::widget('list')->add_attr('class', 'list-unstyled')->add_attr('class', 'list-separated2');
$link = HC_Lib::link('shifts/delete/index/' . $object->id); $btn = HC_Html_Factory::element('a')->add_attr('class', array('btn'))->add_attr('href', $link->url())->add_attr('title', HCM::__('Delete'))->add_attr('class', 'btn-danger')->add_attr('class', 'btn-sm')->add_attr('class', 'hc-confirm')->add_child(HC_Html::icon('times') . HCM::__('Delete')); $buttons->add_item('delete', $btn); $buttons->add_item_attr('delete', 'class', 'pull-right'); /* 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'));
<?php if (!(count($all_staffs) > 1 or count($all_locations) > 1)) { return; } $options = array('none' => HC_Html_Factory::element('a')->add_attr('href', $rootlink->url($tab, array('by' => NULL)))->add_child(HC_Html::icon('ellipsis-v'))->add_attr('title', HCM::__('No Grouping'))); if (count($all_staffs) > 1) { $options['staff'] = HC_Html_Factory::element('a')->add_attr('href', $rootlink->url($tab, array('by' => 'staff')))->add_child(HC_Html::icon(HC_App::icon_for('user')))->add_attr('title', HCM::__('Group By Staff')); } if (count($all_locations) > 1) { $options['location'] = HC_Html_Factory::element('a')->add_attr('href', $rootlink->url($tab, array('by' => 'location')))->add_child(HC_Html::icon(HC_App::icon_for('location')))->add_attr('title', HCM::__('Group By Location')); } $state_by = $state['by'] ? $state['by'] : 'none'; $nav = HC_Html_Factory::element('div')->add_attr('class', 'btn-group'); foreach ($options as $key => $option) { $option->add_attr('class', array('btn'))->add_attr('class', array('btn-sm')); if ($key == $state_by) { $option->add_attr('class', array('btn-archive')); } else { $option->add_attr('class', array('btn-default')); } $nav->add_child($option); } echo $nav->render();
break; } if ($sh->date < $this_date) { continue; } $this_shifts[] = $sh; } $date_content = NULL; $this_state['date'] = $this_date; $date_content = HC_Html_Factory::widget('module')->set_url($rootlink . '/day')->pass_arg(array($this_shifts, $this_state))->set_param('date', $this_date)->set_param('location', $entity_id)->set_param('wide', 'mini')->add_attr('class', 'hc-rfr-' . 'dat-' . $this_date . '-loc-' . $entity_id); $cell_key = $entity_id . '_' . $this_date; $CELLS[$cell_key] = $date_content; /* links */ $LINKS[$cell_key] = NULL; if ($can_add) { $btns = HC_Html_Factory::element('a')->add_attr('href', HC_Lib::link('shifts/add/index')->url(array('date' => $this_date, 'location' => $entity_id, 'type' => $test_shift->_const('TYPE_SHIFT'))))->add_attr('class', 'hc-flatmodal-loader')->add_attr('class', 'btn')->add_attr('class', 'btn-xs')->add_attr('class', 'btn-archive')->add_attr('class', 'display-block')->add_attr('style', 'text-align: center;')->add_child(HC_Html::icon('plus'))->add_attr('title', HCM::__('Add')); $LINKS[$cell_key] = $btns; } } } /* now display */ $out = HC_Html_Factory::widget('table')->set_engine('div'); /* dates row */ $rid = 0; $cid = 0; $out->set_cell($rid, $cid, ''); $out->add_cell_attr($rid, $cid, array('class' => array('cal-cell-title'))); $cid++; reset($dates); foreach ($dates as $date) { $out->set_cell($rid, $cid, $DATE_LABELS[$date]);
<?php $out = HC_Html_Factory::widget('container')->add_item(HC_Html::icon('comment-o'))->add_item(sprintf(HCM::_n('%d Comment', '%d Comments', $count), $count)); echo $out;