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(); }
<?php if (!$count) { return; } $temp_shift = HC_App::model('shift'); $linkto = HC_Lib::link('list/index', array('filter' => 'conflicts')); $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::__('Conflicts')))->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-danger')->add_child($title); echo $out->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 if (!$count) { return; } $temp_shift = HC_App::model('shift'); $linkto = HC_Lib::link('list/index', array('filter' => 'release')); $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::__('Shift Release Pending')))->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-warning-o')->add_child($title); echo $out->render();
<?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();
$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 if (!$count) { return; } $temp_shift = HC_App::model('shift'); $linkto = HC_Lib::link('list-toff/index', array('filter' => 'pending-timeoffs')); $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::__('Pending Timeoff Requests')))->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-archive')->add_child($title); $color = '#eee'; $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();
<?php $link = HC_Lib::link('list/' . $tab, $state); $rootlink_this = HC_Lib::link($rootlink . '/' . $tab, $state); $rootlink = HC_Lib::link($rootlink, $state); $current_user_id = $this->auth->user()->id; /* FILTER STAFF */ $filter1 = NULL; if (count($all_staffs) > 1) { $filter1 = HC_Html_Factory::widget('filter'); $filter1->set_btn_size('xs')->set_link($rootlink_this)->set_param_name('staff')->set_title(HCM::__('Staff'))->set_panel('default'); foreach ($all_staffs as $oid => $obj) { $filter1->set_option($oid, $obj->present_title()); } if (isset($state['staff'])) { $filter1->set_selected($state['staff']); } } /* FILTER LOCATIONS */ $filter2 = NULL; if (count($all_locations) > 1) { $filter2 = HC_Html_Factory::widget('filter'); $filter2->set_btn_size('xs')->set_link($rootlink_this)->set_param_name('location')->set_title(HCM::__('Location'))->set_panel('default'); foreach ($all_locations as $oid => $obj) { $attr = array('style' => 'background-color: ' . $obj->present_color() . ';'); $filter2->set_option($oid, $obj->present_title(), $attr); } if (isset($state['location'])) { $filter2->set_selected($state['location']); } }
<?php $current_user_id = $this->auth->check(); $display_form = HC_Html_Factory::widget('form')->add_attr('action', HC_Lib::link('admin/users/update/index/' . $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')); if (!$form->readonly()) { $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'))); } if ($object->id != $current_user_id) { $buttons->add_divider(); if ($object->active == USER_HC_MODEL::STATUS_ACTIVE) { $buttons->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', HC_Lib::link('admin/users/update/index/' . $object->id . '/active/' . USER_HC_MODEL::STATUS_ARCHIVE))->add_attr('class', array('btn', 'btn-warning-o'))->add_attr('class', array('btn-sm'))->add_attr('class', array('hc-confirm'))->add_attr('title', HCM::__('Archive User'))->add_child(HCM::__('Archive User'))); } else { $buttons->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', HC_Lib::link('admin/users/update/index/' . $object->id . '/active/' . USER_HC_MODEL::STATUS_ACTIVE))->add_attr('class', array('btn', 'btn-success-o'))->add_attr('class', array('btn-sm'))->add_attr('class', array('hc-confirm'))->add_attr('title', HCM::__('Restore User'))->add_child(HCM::__('Restore User'))); } } $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()))->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()))->add_item(HC_Html_Factory::widget('label_row')->set_label(HCM::__('Email'))->set_content($form->input('email')->add_attr('size', 32))->set_error($form->input('email')->error())); $app_conf = HC_App::app_conf(); if ($app_conf->get('login_with') == 'username') { $display_form->add_item(HC_Html_Factory::widget('label_row')->set_label(HCM::__('Username'))->set_content($form->input('username')->add_attr('size', 24))->set_error($form->input('username')->error())); } $input_level = $form->input('level')->set_options(array(USER_HC_MODEL::LEVEL_STAFF => HCM::__('Staff'), USER_HC_MODEL::LEVEL_MANAGER => HCM::__('Manager'), USER_HC_MODEL::LEVEL_ADMIN => HCM::__('Admin'))); /* can't change own level */ if ($object->id == $this->auth->check()) { // $input_level->add_attr('disabled', 'disabled'); $input_level->set_readonly(); } $display_form->add_item(HC_Html_Factory::widget('label_row')->set_label(HCM::__('User Level'))->set_content($input_level)->set_error($input_level->error())->set_content_static($input_level->readonly())); $display_form->add_item(HC_Html_Factory::widget('label_row')->set_content($buttons)); echo $display_form->render();
function redirect($to = '', $parent_refresh = array()) { $parent = 0; if ($this->input->is_ajax_request()) { // if( $this->input->post() ) // { // clear flash $this->session->set_flashdata('message', NULL); $this->session->set_flashdata('error', NULL); // } if (!is_array($to) && $to == '-referrer-') { } else { // already starts with http:// ? if (!HC_Lib::is_full_url($to)) { $to = HC_Lib::link($to); $to = $to->url(); } } $out = array('redirect' => $to, 'parent' => $parent, 'parent_refresh' => $parent_refresh); $this->output->set_content_type('application/json'); $this->output->enable_profiler(FALSE); echo json_encode($out); hc_ci_before_exit(); exit; // return; } else { if (!is_array($to) && $to == '-referrer-') { $to = (!isset($_SERVER['HTTP_REFERER']) or $_SERVER['HTTP_REFERER'] == '') ? '' : trim($_SERVER['HTTP_REFERER']); } HC_Lib::redirect($to); return; } return; }
$link = HC_Lib::link('conf/admin/update/' . $tab); $this->layout->set_partial('header', HC_Html::page_header(HC_Html_Factory::element('h2')->add_child(HCM::__('Settings')))); /* check if we need tabs */ $these_fields = array_keys($fields); if (count($tabs) > 1) { $menubar = HC_Html_Factory::widget('list'); $menubar->add_attr('class', array('nav', 'nav-tabs')); $app_conf = HC_App::app_conf(); foreach ($tabs as $tk => $ms) { $conf_key = 'menu_conf_settings:' . $tk; $tab_label = $app_conf->conf($conf_key); if ($tab_label === FALSE) { $tab_label = $tk; } $menubar->add_item($tk, HC_Html_Factory::widget('titled', 'a')->add_attr('href', HC_Lib::link('conf/admin/index/' . $tk))->add_child($tab_label)); } $menubar->set_active($tab); echo $menubar->render(); $these_fields = $tabs[$tab]; } $display_form = HC_Html_Factory::widget('form')->add_attr('action', $link->url())->add_attr('class', 'form-horizontal')->add_attr('class', 'form-condensed'); foreach ($these_fields as $fn) { $f = $fields[$fn]; $field_input = $form->input($fn); switch ($f['type']) { case 'dropdown': $field_input->set_options($f['options']); break; case 'checkbox_set': $field_input->set_options($f['options']);
} 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();
private function _grab_state($args, $tab = 'browse') { $t = HC_Lib::time(); $state = array('range' => 'week', 'date' => $t->formatDate_Db(), 'by' => NULL, 'location' => array(), 'staff' => array(), 'type' => NULL, 'wide' => NULL, 'filter' => NULL); $default_params = $this->default_params; $supplied = hc_parse_args($args); $supplied = array_merge($default_params, $supplied); foreach ($supplied as $k => $v) { if (in_array($k, array('staff', 'location', 'type'))) { if (strpos($v, '.') !== FALSE) { $v = explode('.', $v); } elseif (strpos($v, ',') !== FALSE) { $v = explode(',', $v); } else { $v = array($v); } } $state[$k] = $v; } /* check _current_user_id_ */ if (isset($state['staff'])) { $check_current_user = array('_current_user_id_', '_current_user_id', 'current_user_id', 'current_user', '_current_user_'); $current_user_key = ''; foreach ($check_current_user as $cuk) { if (in_array($cuk, $state['staff'])) { $current_user_key = $cuk; break; } } if ($current_user_key) { $current_user_id = 0; if ($test_user = $this->auth->user()) { $current_user_id = $test_user->id; } $state['staff'] = HC_Lib::replace_in_array($state['staff'], $current_user_key, $current_user_id); } } /* fixed ? */ $force_fixed = array('location', 'staff'); foreach ($default_params as $k => $v) { if (in_array($k, $force_fixed)) { $this->fix[$k] = $state[$k]; } } switch ($state['range']) { case 'all': $t = HC_Lib::time(); $shifts = HC_App::model('shift'); $min_date = $shifts->select_min('date')->get()->date; $max_date = $shifts->select_max('date_end')->get()->date_end; if ($min_date && $max_date) { $state['date'] = $min_date . '_' . $max_date; } break; case 'upcoming': $t = HC_Lib::time(); $shifts = HC_App::model('shift'); $min_date = $t->setNow()->formatDate_Db(); $max_date = $shifts->select_max('date_end')->get()->date_end; if ($min_date && $max_date) { $state['date'] = $min_date . '_' . $max_date; } break; case 'day': case 'week': case 'month': if (!$state['date']) { $t->setNow(); $state['date'] = $t->formatDate_Db(); } break; case 'custom': if (strpos($state['date'], '_') !== FALSE) { list($start_date, $end_date) = explode('_', $state['date']); } else { $start_date = $end_date = $state['date']; } $t->setNow(); if (!$start_date) { $start_date = $t->formatDate_Db(); } if (!$end_date) { $end_date = $t->formatDate_Db(); } $state['date'] = join('_', array($start_date, $end_date)); break; default: // attempt to parse the range text in time $start_date = $state['date']; if (!$start_date) { $t->setNow(); $start_date = $t->formatDate_Db(); } $t->setDateDb($start_date); $t->modify('+' . $state['range']); $end_date = $t->formatDate_Db(); $state['date'] = join('_', array($start_date, $end_date)); $state['range'] = 'custom'; break; } /* if custom dates supplied */ if (isset($supplied['customdates']) && $supplied['customdates']) { $post = $this->input->post(); if (isset($post['start_date']) && isset($post['end_date'])) { if ($post['end_date'] <= $post['start_date']) { $post['end_date'] = $post['start_date']; } $state['date'] = $post['start_date'] . '_' . $post['end_date']; $state['range'] = 'custom'; unset($state['customdates']); $link = HC_Lib::link($this->views_path . '/' . $tab, $state); $redirect_to = $link->url(); $this->redirect($redirect_to); return; } } /* something fixed ? */ foreach ($this->fix as $fk => $fv) { if ($fv) { unset($state[$fk]); } } return $state; }
<?php $link = HC_Lib::link('shifts/add/insert'); /* count how many shifts will be created */ $pa = $params->to_array(); $shifts_count = 1; $shifts_count *= count($dates); $check = array('location', 'user'); foreach ($check as $ch) { if (is_array($pa[$ch])) { $shifts_count *= count($pa[$ch]); } } $display_form = HC_Html_Factory::widget('form')->add_attr('action', $link->url($params->to_array()))->add_attr('class', 'form-condensed')->add_attr('class', 'form-small-labels'); $out = HC_Html_Factory::widget('list')->add_attr('class', array('list-unstyled', 'list-separated')); /* STATUS CHECKBOX */ $status_input = NULL; $statuses = $params->get_options('status'); if (count($statuses) > 1) { $status_input = $form->input('status'); $status_input->set_inline(TRUE); foreach ($statuses as $status_option) { $status_input->add_option($status_option, $model->set('status', $status_option)->present_status()); } } elseif (count($statuses) == 1) { reset($statuses); $status_input = $model->set('status', key($statuses))->present_status(); } if ($status_input !== NULL) { $out->add_item(HC_Html_Factory::widget('label_row')->set_label(HCM::__('Status'))->set_content($status_input)); }
} 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 if (!$count) { return; } $title = sprintf(HCM::_n('%d Pending Timeoff Request', '%d Pending Timeoff Requests', $count), $count); $temp_shift = HC_App::model('shift'); $linkto = HC_Lib::link('list/browse', array('type' => $temp_shift->_const('TYPE_TIMEOFF'), 'status' => $temp_shift->_const('STATUS_DRAFT'), 'range' => 'upcoming')); $item = HC_Html_Factory::widget('titled', 'a')->add_attr('class', 'display-block')->add_attr('href', $linkto)->add_attr('class', 'alert')->add_attr('class', 'alert-archive')->add_attr('title', $title)->add_child($title); echo $item->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();
private function _prepare_menu() { if (!($this->menu && is_array($this->menu))) { return; } $order = 1; $menu_keys = array_keys($this->menu); reset($menu_keys); $active_k = ''; foreach ($menu_keys as $k) { if (!is_array($this->menu[$k])) { $this->menu[$k] = array('title' => $this->menu[$k]); } if (!isset($this->menu[$k]['order'])) { $this->menu[$k]['order'] = $order++; } if (!isset($this->menu[$k]['icon'])) { $this->menu[$k]['icon'] = ''; } if (!(isset($this->menu[$k]['external']) && $this->menu[$k]['external'] or isset($this->menu[$k]['href']) && $this->menu[$k]['href'])) { switch ($this->engine()) { case 'ci': $this->menu[$k]['slug'] = $this->menu[$k]['link']; $this->menu[$k]['href'] = HC_Lib::link($this->menu[$k]['link']); break; case 'nts': if (!isset($this->menu[$k]['panel'])) { $this->menu[$k]['panel'] = $k; } $this->menu[$k]['slug'] = $this->menu[$k]['panel']; $this->menu[$k]['href'] = ntsLink::makeLink($this->menu[$k]['panel'], '', array(), FALSE, TRUE); break; } } if ($this->disabled && !(isset($this->menu[$k]['external']) && $this->menu[$k]['external'])) { $this_slug = $this->menu[$k]['slug']; if (in_array($this_slug, $this->disabled)) { // echo "DISABLE " . $this->menu[$k]['slug'] . '<br>'; unset($this->menu[$k]); } else { /* also check if a parent is disabled */ foreach ($this->disabled as $ds) { if (substr($this_slug, 0, strlen($ds)) == $ds) { unset($this->menu[$k]); break; } } } } /* check if current */ if ($this->current && !$active_k) { $slug = isset($this->menu[$k]['slug']) ? $this->menu[$k]['slug'] : ''; $current = $this->current; if ($current == $slug or substr($current, 0, strlen($slug)) == $slug && substr($current, strlen($slug), 1) == '/') { $active_k = $k; } } } /* set current */ if ($active_k) { reset($menu_keys); foreach ($menu_keys as $k) { if ($k == $active_k or substr($active_k, 0, strlen($k)) == $k && substr($active_k, strlen($k), 1) == '/') { $this->menu[$k]['active'] = TRUE; } } } uasort($this->menu, create_function('$a, $b', 'return ($a["order"] - $b["order"]);')); }
<?php $list = HC_Html_Factory::widget('list')->add_attr('class', array('list-unstyled')); $list->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', HC_Lib::link('shifts/zoom/index/id/' . $shift->id . '/tab/pickup'))->add_attr('class', array('hc-flatmodal-loader'))->add_attr('class', array('btn'))->add_attr('class', array('btn-success-o'))->add_attr('class', array('btn-xs'))->add_child(HCM::__('Pick Up Shift'))); echo $list->render();
static function redirect($uri = '', $method = 'location', $http_response_code = 302) { if (!(!is_array($uri) && preg_match('#^https?://#i', $uri))) { $uri = HC_Lib::link($uri)->url(); } /* this is a hack to ensure that post controller and post system hooks are triggered */ hc_ci_before_exit(); switch ($method) { case 'refresh': header("Refresh:0;url=" . $uri); break; default: header("Location: " . $uri, TRUE, $http_response_code); break; } return; }
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(' ')->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(); }
$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 $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 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 */
<?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 $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();
<?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(); }
<?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();
<?php $this_buttons = HC_Html_Factory::widget('list')->add_attr('class', array('list-unstyled')); $this_buttons->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('class', array('btn', 'btn-default'))->add_child(HCM::__('Click Here To Pick Up The Shift'))->add_attr('href', HC_Lib::link('pickup/edit/insert/' . $object->id))); echo $this_buttons->render();
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; }
<?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();