function index() { $args = hc_parse_args(func_get_args(), TRUE); if (!isset($args['id'])) { echo 'PARAMS MISSING IN availability/delete<br>'; return; } $id = $args['id']; $model = HC_App::model('availability'); $model->where('id', $id)->get(); $this->_check_model($model); $acl = HC_App::acl(); if (!$acl->set_object($model)->can('delete')) { return; } /* what to refresh on referring page */ $parent_refresh = $model->present_calendar_refresh(); $parent_refresh = array_keys($parent_refresh); if ($model->delete()) { $this->session->set_flashdata('message', HCM::__('Availability deleted')); } else { $this->session->set_flashdata('error', HCM::__('Error')); } $redirect_to = $this->my_parent(); $this->redirect($redirect_to, $parent_refresh); }
function insert() { $model = HC_App::model('user'); /* supplied as parameters */ $args = func_get_args(); $values = hc_parse_args($args); /* if post supplied */ $post = $this->input->post(); if ($post) { $this->forms['add']->grab($post); $post = $this->forms['add']->values(); $values = array_merge($values, $post); } if (!$values) { $redirect_to = 'admin/users/add'; $this->redirect($redirect_to); return; } $related = $model->from_array($values); if ($model->save($related)) { /* save and redirect here */ $msg = HCM::__('User added'); $this->session->set_flashdata('message', $msg); $redirect_to = 'admin/users/index'; $this->redirect($redirect_to); } else { /* final layout */ $this->layout->set_partial('content', Modules::run('admin/users/add/index', $model)); $this->layout(); } }
private function _update($tab, $args) { $id = array_shift($args); $model = HC_App::model('user'); $model->where('id', $id)->get(); $this->_check_model($model); $original_model = clone $model; /* supplied as parameters */ $values = hc_parse_args($args); /* if post supplied */ $post = $this->input->post(); if ($post) { $this->forms[$tab]->grab($post); $post = $this->forms[$tab]->values(); $values = array_merge($values, $post); } if (!$values) { $redirect_to = 'admin/users/zoom/index/id/' . $id . '/tab/' . $tab; $this->redirect($redirect_to); return; } $related = $model->from_array($values); if ($model->save($related)) { /* save and redirect here */ $msg = HCM::__('User updated'); $this->session->set_flashdata('message', $msg); $redirect_to = 'admin/users/zoom/index/id/' . $id . '/tab/' . $tab; $this->redirect($redirect_to); } else { /* final layout */ $this->layout->set_partial('content', Modules::run('admin/users/zoom/index', 'id', $model, 'tab', $tab)); $this->layout(); } }
function update($id = 0) { $model = HC_App::model('shift_template'); $model->get_by_id($id); $this->_check_model($model); $post = $this->input->post(); if (!$post) { return; } $this->form->grab($post); $values = $this->form->values(); $model->from_array($values); if ($model->save()) { /* save and redirect here */ $msg = HCM::__('OK'); $this->session->set_flashdata('message', $msg); $redirect_to = 'admin/shift_templates'; $this->redirect($redirect_to); } else { $errors = $model->errors(); $this->form->set_values($values); $this->form->set_errors($errors); $content = $this->render('admin/shift_templates/edit', array('form' => $this->form, 'id' => $id)); $this->layout->set_partial('content', $content); $this->layout(); } }
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; }
public function index() { /* if post supplied */ $post = $this->input->post(); $values = array(); if ($post) { $this->form_add->grab($post); $form_values = $this->form_add->values(); $values = array_merge($values, $form_values); } $date_value = $this->form_add->input('date')->value(TRUE); if ($date_value['recurring'] == 'single') { $values['date_start'] = $date_value['datesingle']; $values['date_end'] = $date_value['datesingle']; $values['details'] = ''; } else { $values['date_start'] = $date_value['datestart']; $values['date_end'] = $date_value['dateend']; $values['details'] = $this->form_add->input('date')->value(FALSE, TRUE); } unset($values['date']); $model = HC_App::model('availability'); $related = $model->from_array($values); $action_result = $model->save($related); if ($action_result) { $msg = HCM::__('Availability added'); $this->session->set_flashdata('message', $msg); $redirect_to = $this->my_parent(); $this->redirect($redirect_to); } else { $this->form_add->set_errors($model->errors()); $this->layout->set_partial('content', $this->render('availability/add', array('form' => $this->form_add))); $this->layout(); } }
public function _check_time($field) { $return = $this->end != $this->start ? TRUE : FALSE; if (!$return) { $return = HCM::__('The end time should differ from the start time'); } return $return; }
public function index() { $args = hc_parse_args(func_get_args(), TRUE); if (!isset($args['id'])) { echo 'PARAMS MISSING IN availability/update/index<br>'; return; } $id = $args['id']; if (is_object($id)) { $model = $id; } else { $model = HC_App::model('availability'); $model->where('id', $id)->get(); $this->_check_model($model); } $acl = HC_App::acl(); if (!$acl->set_object($model)->can('edit')) { return; } // $values = hc_parse_args( $args ); $values = array(); $form = $this->form_edit; $post = $this->input->post(); if ($post) { $form->grab($post); $form_values = $form->values(); $values = array_merge($values, $form_values); } $date_value = $form->input('date')->value(TRUE); if ($date_value['recurring'] == 'single') { $values['date_start'] = $date_value['datesingle']; $values['date_end'] = $date_value['datesingle']; $values['details'] = ''; } else { $values['date_start'] = $date_value['datestart']; $values['date_end'] = $date_value['dateend']; $values['details'] = $form->input('date')->value(FALSE, TRUE); } unset($values['date']); $related = $model->from_array($values); // $action_result = $model->save( $related ); $action_result = $model->save(); if ($action_result) { $msg = HCM::__('Availability updated'); $this->session->set_flashdata('message', $msg); $redirect_to = $this->my_parent(); $redirect_to .= '/user/' . $model->user_id; /* what to refresh on referring page */ $parent_refresh = $model->present_calendar_refresh(); $parent_refresh = array_keys($parent_refresh); $this->redirect($redirect_to, $parent_refresh); } else { $form->set_errors($model->errors()); $this->layout->set_partial('content', $this->render('availability/zoom/index', array('form' => $form, 'object' => $model))); $this->layout(); } }
private function _status_details($model) { $return = NULL; $status = $model->status; $details = array($model->_const('STATUS_PENDING') => array(HCM::__('Pending'), 'warning'), $model->_const('STATUS_ACTIVE') => array(HCM::__('Active'), 'success'), $model->_const('STATUS_CANCELLED') => array(HCM::__('Cancelled'), 'archive')); if (isset($details[$status])) { $return = $details[$status]; } return $return; }
public function line($line) { $array = array('validation_required' => HCM::__("Required field"), 'validation_related_required' => HCM::__("Required field"), 'validation_min_length' => HCM::__("At least %s characters required"), 'validation_differs' => HCM::__("These values should differ from each other"), 'validation_unique' => HCM::__("This value is already used"), 'validation_matches' => HCM::__("The %s field does not match the %s field"), 'validation_valid_email' => HCM::__("Valid email address required")); if (isset($array[$line])) { $return = $array[$line]; } else { $return = $line; } 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 delete($id) { $model = HC_App::model('user'); $model->where('id', $id)->get(); $this->_check_model($model); if ($model->delete()) { $msg = 'User deleted'; $this->session->set_flashdata('message', $msg); } else { $errors = $model->errors(); $msg = HCM::__('Error') . ': ' . join(' ', $errors); $this->session->set_flashdata('error', $msg); } $redirect_to = 'admin/users'; $this->redirect($redirect_to); return; }
function deleterel($id, $relname, $relid) { $model = HC_App::model('shift'); $model->get_by_id($id); $this->_check_model($model); $acl = HC_App::acl(); if (!$acl->set_object($model)->can($relname . '::delete')) { return; } $rel = $model->{$relname}->get_by_id($relid); if ($model->delete($rel, $relname)) { $this->session->set_flashdata('message', sprintf(HCM::_n('%d shift updated', '%d shifts updated', 1), 1)); } else { $this->session->set_flashdata('error', HCM::__('Error')); } $redirect_to = 'shifts/zoom/' . $id; // $redirect_to = '-referrer-'; $this->redirect($redirect_to); return; }
function insert() { $args = func_get_args(); $id = array_shift($args); $model = HC_App::model('shift'); $model->where('id', $id)->get(); $this->_check_model($model); $acl = HC_App::acl(); if (!$acl->set_object($model)->can('pickup')) { return; } $current_user = $this->auth->user(); $related = array('user' => $current_user); $model->user = $current_user; $app_conf = HC_App::app_conf(); $approval_required = $app_conf->get('pickup:approval_required'); if ($approval_required) { $model->status = $model->_const('STATUS_DRAFT'); } $action_result = $model->save($related); if ($action_result) { if ($approval_required) { $msg = HCM::__('Shift pickup request received'); } else { $msg = HCM::__('Shift picked up'); } /* save and redirect here */ $this->session->set_flashdata('message', $msg); } else { /* save and redirect here */ $this->session->set_flashdata('error', HCM::__('Error')); } $redirect_to = 'shifts/zoom/index/' . $id; // $redirect_to = '-referrer-'; /* what to refresh on referring page */ $parent_refresh = $model->present_calendar_refresh(); $parent_refresh = array_keys($parent_refresh); $this->redirect($redirect_to, $parent_refresh); }
function update($tab = 'core') { $app_conf = HC_App::app_conf(); $fields = $this->config->items('settings'); $tabs = $this->_get_tabs($fields); $these_fields = $tabs[$tab]; $validator = new HC_Validator(); foreach ($these_fields as $fn) { $f = $fields[$fn]; if (isset($f['rules'])) { $validator->set_rules($fn, $f['rules']); } } $post = $this->input->post(); $this->form->grab($post); $values = $this->form->values(); if ($values && $validator->run($values) == TRUE) { reset($these_fields); foreach ($these_fields as $fn) { $app_conf->set($fn, $values[$fn]); } // redirect back $msg = HCM::__('Settings updated'); $this->session->set_flashdata('message', $msg); $to = 'conf/admin/index/' . $tab; $this->redirect($to); } else { $errors = $validator->error(); $this->form->set_values($values); $this->form->set_errors($errors); $fields = $this->config->items('settings'); /* render view */ $this->layout->set_partial('content', $this->render('conf/admin/index', array('fields' => $fields, 'form' => $this->form, 'tab' => $tab, 'tabs' => $tabs))); $this->layout(); } }
public function forgotten_password($email) { $this->auth_model->get_by_email($email); if ($this->auth_model->exists()) { $new_password = mt_rand(100000, 999999); $user = $this->auth_model->all[0]; $user->password = $new_password; $user->confirm_password = $new_password; if ($user->save()) { $msg = array(); $msg['email'] = HCM::__('Email') . ': ' . $email; $msg['password'] = HCM::__('Password') . ': ' . $new_password; $messages = HC_App::model('messages'); $messages->send('user.password_changed', $user, array("msg" => $msg)); return TRUE; } else { $this->error = $this->auth_model->string; return FALSE; } } else { $this->error = sprintf(HCM::__('This email address %s was not found'), $email); return FALSE; } }
function type($model) { /* translators: availability type */ $return = HCM::__('Unavailable'); return $return; }
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 $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->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 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();
$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())); /* 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'); foreach ($more_content as $mc) { $more_holder->add_item($mc); } $display_form->add_item($more_holder); } $display_form->add_item(HC_Html_Factory::widget('label_row')->set_content($buttons)->add_attr('class', 'padded2')->add_attr('style', 'border-top: #eee 1px solid; margin-top: 1em;')); // echo $display_form->render(); $out = HC_Html_Factory::widget('flatmodal'); $out->set_content($display_form); /*
<?php $t = HC_Lib::time(); $table = HC_Html_Factory::widget('table')->add_attr('class', 'table')->add_attr('class', 'table-striped')->add_attr('class', 'table-condensed'); $header = array(); $header[] = HCM::__('Date and Time'); if (!$user_id) { $header[] = HCM::__('User'); } $header[] = 'IP'; $table->set_header($header); foreach ($entries as $e) { $row = array(); $t->setTimestamp($e->action_time); $this_view = ''; $this_view .= $t->formatWeekdayShort(); $this_view .= ', '; $this_view .= $t->formatDate(); $this_view .= ' '; $this_view .= $t->formatTime(); $row[] = $this_view; if (!$user_id) { $row[] = $e->user->present_title(); } $row[] = $e->remote_ip; $table->add_row($row); } echo $table->render();
public function time($model, $vlevel = HC_PRESENTER::VIEW_HTML) { $t = HC_Lib::time(); $return = array(); switch ($vlevel) { case HC_PRESENTER::VIEW_TEXT: $return[] = HCM::__('Time'); $return[] = ': '; break; } $period_view = $t->formatPeriodOfDay($model->start, $model->end); $period_view = str_replace(' ', '', $period_view); $return[] = $period_view; $return = join('', $return); return $return; }
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('<<')); $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('>>')); break; } $this->set_active('current'); return parent::render(); }
<?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();
<?php $label = HCM::__('Conflicts'); echo $label;
} 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();
$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 $config['notifications_email:shift.owner.pickup_pending'] = HCM::__('Shift pickup request received'); $config['notifications_email:shift.admin.pickup_pending'] = HCM::__('Shift pickup request received');