Esempio n. 1
0
 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;
 }
Esempio n. 2
0
 function title($model, $vlevel = HC_PRESENTER::VIEW_HTML)
 {
     $return = array();
     $label = $this->label($model, $vlevel);
     if (strlen($label)) {
         $return[] = $label;
     }
     switch ($vlevel) {
         case HC_PRESENTER::VIEW_TEXT:
             $return[] = ': ';
             break;
     }
     switch ($vlevel) {
         case HC_PRESENTER::VIEW_HTML_ICON:
             break;
         default:
             if ($model->exists()) {
                 $return[] = $model->name;
             } else {
                 $return[] = HCM::__('Unknown');
             }
             break;
     }
     $return = join('', $return);
     switch ($vlevel) {
         case HC_PRESENTER::VIEW_HTML:
             $color = $model->present_color();
             $color = HC_Lib::adjust_color_brightness($color, -30);
             $return = HC_Html_Factory::element('span')->add_attr('class', 'label')->add_attr('class', 'label-success')->add_attr('class', 'label-lg')->add_child($return)->add_attr('style', 'background-color: ' . $color . ';');
             break;
     }
     return $return;
 }
Esempio n. 3
0
 function todo()
 {
     $conflict_ids = array();
     $t = HC_Lib::time();
     $today = $t->setNow()->formatDate_Db();
     /* find conflicts in upcoming shifts */
     $shifts = HC_App::model('shift');
     $shifts->where('date_end >=', $today)->where_related('user', 'id IS NOT ', 'NULL', FALSE);
     $shifts->get();
     $acl = HC_App::acl();
     $cmm = HC_App::model('conflict_manager');
     $count = 0;
     foreach ($shifts as $obj) {
         if (!$acl->set_object($obj)->can('conflicts::view')) {
             continue;
         }
         $entries = $cmm->get($obj, TRUE);
         if ($entries) {
             foreach ($entries as $e) {
                 $conflict_ids[$e->id] = 1;
             }
         }
     }
     if (!count($conflict_ids)) {
         return;
     }
     /* render view */
     $this->layout->set_partial('content', $this->render('conflicts/todo', array('count' => count($conflict_ids))));
     $this->layout();
 }
Esempio n. 4
0
 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;
 }
Esempio n. 5
0
 function __construct()
 {
     parent::__construct(USER_HC_MODEL::LEVEL_MANAGER);
     $this->forms = array();
     $this->forms['edit'] = HC_Lib::form()->set_input('first_name', 'text')->set_input('last_name', 'text')->set_input('email', 'text')->set_input('username', 'text')->set_input('level', 'select');
     $this->forms['password'] = HC_Lib::form()->set_input('password', 'password')->set_input('confirm_password', 'password');
 }
Esempio n. 6
0
 function __construct($check_active = TRUE)
 {
     parent::__construct();
     $this->load->library('migration');
     if (!$this->migration->current()) {
         //			show_error($this->migration->error_string());
         return false;
     }
     $nts_config = HC_Lib::nts_config();
     if (isset($nts_config['FORCE_LOGIN_ID'])) {
         $id = $nts_config['FORCE_LOGIN_ID'];
         $this->auth->login($id);
     }
     if ($check_active) {
         $user = $this->auth->user();
         $user_active = 1;
         if ($user && $user->id) {
             $user_active = $user->active;
         }
         if (!$user_active) {
             $to = 'auth/notallowed';
             $this->redirect($to);
             exit;
         }
     }
 }
Esempio n. 7
0
 function forgot_password()
 {
     $post = $this->input->post();
     $form = HC_Lib::form();
     $form->set_inputs(array('email' => 'text'));
     $validator = new HC_Validator();
     $validator->set_rules('email', 'required');
     if ($post && $validator->run($post) == TRUE) {
         $form->grab($post);
         $values = $form->values();
         $forgotten = $this->auth->forgotten_password($values['email']);
         if ($forgotten) {
             //if there were no errors
             $this->session->set_flashdata('message', HCM::__('Password reset message has been sent to your email'));
             $this->redirect('auth/login');
         } else {
             $this->session->set_flashdata('error', $this->auth->error);
             $this->redirect('auth/forgot_password');
         }
     }
     $errors = $validator->error();
     $form->set_values($post);
     $form->set_errors($errors);
     $this->layout->set_partial('content', $this->render('auth/forgot_password', array('form' => $form)));
     $this->layout();
 }
Esempio n. 8
0
 function __construct($name = '')
 {
     if (!strlen($name)) {
         $name = 'nts_' . HC_Lib::generate_rand();
     }
     $this->set_name($name);
 }
Esempio n. 9
0
 function render()
 {
     $model = $this->model();
     $start_link = $this->start_link();
     if (!$start_link) {
         // $start_link = 'availability';
         $start_link = 'admin/users/zoom/index/id/' . $model->user_id . '/tab/availability/_pass';
     }
     $href = HC_Lib::link($start_link . '/zoom/index', array('id' => $model->id));
     $nolink = $this->nolink();
     $new_window = $this->new_window();
     $wide = $this->wide();
     $a_link = HC_Html_Factory::widget('titled', 'a')->add_attr('href', $href);
     if (!$new_window) {
         $a_link->add_attr('class', 'hc-flatmodal-loader');
     } else {
         $a_link->add_attr('target', '_blank');
         $a_link->add_attr('class', 'hc-parent-loader');
     }
     if ($wide === 'mini') {
         $out = HC_Html_Factory::element('div');
         if (!$nolink) {
             $title = clone $a_link;
             $title->add_child($model->present_title(HC_PRESENTER::VIEW_HTML_ICON));
         } else {
             $title = $model->present_title(HC_PRESENTER::VIEW_HTML_ICON);
         }
         $out->add_child($title);
     } elseif ($wide) {
         $out = HC_Html_Factory::widget('grid');
         if (!$nolink) {
             $present_title = clone $a_link;
             $present_title->add_child($model->present_title());
         } else {
             $present_title = $model->present_title();
         }
         if (!$nolink) {
             $present_date = clone $a_link;
             $present_date->add_child($model->present_date());
         } else {
             $present_date = $model->present_date();
         }
         $out->add_item($present_title, 6);
         $out->add_item($present_date, 6);
     } else {
         $out = HC_Html_Factory::element('div');
         if (!$nolink) {
             $title = clone $a_link;
             $title->add_child($model->present_title());
         } else {
             $title = $model->present_title(HC_PRESENTER::VIEW_HTML_ICON);
         }
         $out->add_child($title);
         $out->add_attr('class', array('text-smaller'))->add_attr('class', array('text-muted'));
     }
     $out->add_attr('class', 'hc-common-link-parent')->add_attr('class', 'hc-no-underline');
     return $out->render();
 }
Esempio n. 10
0
 private function _content_password($model)
 {
     $form = HC_Lib::form()->set_input('password', 'password')->set_input('confirm_password', 'password');
     if ($ri = HC_Lib::ri()) {
         $form->set_readonly();
     }
     // $form->set_values( $model->to_array() );
     $form->set_errors($model->errors());
     return $this->render('admin/users/zoom/password', array('form' => $form, 'object' => $model));
 }
 function add_form_inputs($parent_object = NULL)
 {
     $acl = HC_App::acl();
     if ($parent_object) {
         if (!$acl->set_object($parent_object)->can('notification_email::skip')) {
             return;
         }
     }
     $form = HC_Lib::form();
     $form->set_inputs(array('notifications_email_skip' => 'checkbox'));
     return $this->render('notifications_email/add_form_inputs', array('form' => $form));
 }
Esempio n. 12
0
 function __construct()
 {
     parent::__construct();
     $this->form = HC_Lib::form();
     $wum = HC_App::model('wordpress_user');
     $wordpress_roles = $wum->wp_roles();
     foreach ($wordpress_roles as $role_value => $role_name) {
         $field_name = 'role_' . $role_value;
         $this->form->set_input($field_name, 'dropdown');
     }
     $this->form->set_input('append_role_name', 'checkbox');
 }
    function render()
    {
        $name = $this->name();
        $value = $this->value();
        $id = 'nts-' . $name;
        $t = HC_Lib::time();
        $t->setNow();
        $t->setStartDay();
        if ($value) {
            $t->modify('+' . $value . ' seconds');
            // $value = $t->formatTime();
        }
        $out = HC_Html_Factory::widget('container');
        /* hidden field to store our value */
        $hidden = HC_Html_Factory::input('hidden')->set_name($name)->set_value($value)->set_id($id);
        $out->add_item($hidden);
        /* text field to display */
        $display_name = $name . '_display';
        $display_id = 'nts-' . $display_name;
        $text = HC_Html_Factory::input('text')->set_name($display_name)->set_id($display_id)->add_attr('size', 7);
        if (strlen($value)) {
            $display_value = $t->formatTime();
            $text->set_value($display_value);
        }
        $out->add_item($text);
        $time_format = $t->timeFormat();
        $script = HC_Html_Factory::element('script');
        $script->add_attr('language', 'JavaScript');
        $js_code = <<<EOT

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

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

EOT;
        $script->add_child($js_code);
        $out->add_item($script);
        $return = $this->decorate($out->render());
        return $return;
    }
Esempio n. 14
0
 function __construct()
 {
     parent::__construct(USER_HC_MODEL::LEVEL_ADMIN);
     $this->form = HC_Lib::form();
     $defaults = array();
     $app_conf = HC_App::app_conf();
     $wum = HC_App::model('wordpress_user');
     $wordpress_roles = $wum->wp_roles();
     foreach ($wordpress_roles as $role_value => $role_name) {
         $field_name = 'role_' . $role_value;
         $this->form->set_input($field_name, 'dropdown');
         $default = $app_conf->get('wordpress_' . $field_name);
         $defaults[$field_name] = $default;
     }
     $this->form->set_input('append_role_name', 'checkbox');
     $this->form->set_values($defaults);
 }
Esempio n. 15
0
 function __construct($user_level = 0)
 {
     parent::__construct();
     $this->load->library('migration');
     if (!$this->migration->current()) {
         //			show_error($this->migration->error_string());
         return false;
     }
     $nts_config = HC_Lib::nts_config();
     if (isset($nts_config['FORCE_LOGIN_ID'])) {
         $id = $nts_config['FORCE_LOGIN_ID'];
         $this->auth->login($id);
     }
     if (!$this->auth->check()) {
         $this->redirect('auth/login');
         exit;
     }
     /* check user active */
     $user_active = 0;
     if ($test_user = $this->auth->user()) {
         $user_active = $test_user->active;
     }
     if (!$user_active) {
         $to = 'auth/notallowed';
         $this->redirect($to);
         exit;
     }
     /* check user level */
     if ($user_level) {
         $this->check_level($user_level);
     }
     /* check license code */
     if ($this->hc_modules->exists('license')) {
         $license_model = HC_App::model('hitcode_license');
         $code = $license_model->get();
         if (!$code) {
             $to = 'license/admin';
             $current_slug = $this->get_current_slug();
             if ($current_slug != $to) {
                 $this->session->set_flashdata('error', 'license_code_required');
                 $this->redirect($to);
                 exit;
             }
         }
     }
 }
Esempio n. 16
0
 function open()
 {
     $t = HC_Lib::time();
     $today = $t->setNow()->formatDate_Db();
     $shifts = HC_App::model('shift');
     $shifts->where('date_end >=', $today)->where('status', $shifts->_const('STATUS_ACTIVE'))->where_related('user', 'id', NULL, TRUE);
     $shifts->get();
     $acl = HC_App::acl();
     $count = 0;
     foreach ($shifts as $obj) {
         if (!$acl->set_object($obj)->can('view')) {
             continue;
         }
         $count++;
     }
     /* view */
     $this->layout->set_partial('content', $this->render('admin/todo/open', array('count' => $count)));
     $this->layout();
 }
Esempio n. 17
0
 public function index()
 {
     $args = hc_parse_args(func_get_args(), TRUE);
     if (!isset($args['user'])) {
         echo 'PARAMS MISSING IN availability/index<br>';
         return;
     }
     $user_id = is_object($args['user']) ? $args['user']->id : $args['user'];
     $t = HC_Lib::time();
     $t->setNow();
     $date_start = $t->formatDate_Db();
     $t->setEndMonth();
     // $t->modify('+1 month');
     $date_end = $t->formatDate_Db();
     $form_values = array('user' => $user_id, 'date' => array('recurring' => 'single', 'datesingle' => $date_start, 'datestart' => $date_start, 'dateend' => $date_end, 'repeat' => 'daily'));
     $this->form_add->set_values($form_values);
     $this->layout->set_partial('content', $this->render('availability/add', array('form' => $this->form_add)));
     $this->layout();
 }
Esempio n. 18
0
 function get($model)
 {
     $limit_qty = 2;
     $limit_duration = 4 * 60 * 60;
     $this->shift_id = $model->id;
     $return = array();
     /* find if the employee has more shifts that allowed per week */
     if (!(strlen($model->start) && strlen($model->end))) {
         return $return;
     }
     if (!($model->date && $model->date_end)) {
         return $return;
     }
     if (!$model->user_id) {
         return $return;
     }
     if ($model->type != $model->_const('TYPE_SHIFT')) {
         return $return;
     }
     $t = HC_Lib::time();
     $t->setDateDb($model->date);
     list($start_week, $end_week) = $t->getDates('week', TRUE);
     $my_qty = 0;
     $my_duration = 0;
     $sm = HC_App::model('shift');
     $sm->select('id, date, date_end, start, end')->where_related('user', 'id', $model->user_id)->where('date_end >=', $start_week)->where('date <=', $end_week);
     $sm->get_iterated_slim();
     foreach ($sm as $test) {
         $my_qty += 1;
         $my_duration += $test->get_duration();
     }
     if ($my_qty > $limit_qty) {
         $conflict = clone $this;
         $conflict->details = 'qty:' . $my_qty;
         $return[] = $conflict;
     }
     if ($my_duration > $limit_duration) {
         $conflict = clone $this;
         $conflict->details = 'duration:' . $my_duration;
         $return[] = $conflict;
     }
     return $return;
 }
Esempio n. 19
0
 function __construct($name = '')
 {
     parent::__construct($name);
     // $this->add_attr('class', 'timepicker');
     $start_with = 0;
     $end_with = 24 * 60 * 60;
     /*
     		if( isset($more['conf']['min']) && ($more['conf']['min'] > $start_with) )
     		{
     			$start_with = $more['conf']['min'];
     		}
     		if( isset($more['conf']['max']) && ($more['conf']['max'] < $end_with) )
     		{
     			$end_with = $more['conf']['max'];
     		}
     		unset( $more['conf'] );
     */
     if ($end_with < $start_with) {
         $end_with = $start_with;
     }
     $step = 15 * 60;
     $options = array();
     $t = HC_Lib::time();
     $t->setDateDb(20130118);
     /*
     		if( $value && ($value > $end_with) )
     		{
     			$value = $value - 24 * 60 * 60;
     		}
     */
     if ($start_with) {
         $t->modify('+' . $start_with . ' seconds');
     }
     $no_of_steps = ($end_with - $start_with) / $step;
     for ($ii = 0; $ii <= $no_of_steps; $ii++) {
         $sec = $start_with + $ii * $step;
         $options[$sec] = $t->formatTime();
         $t->modify('+' . $step . ' seconds');
     }
     $this->set_options($options);
 }
Esempio n. 20
0
 function render()
 {
     $name = $this->name();
     $value = $this->value();
     $id = 'nts-' . $name;
     $t = HC_Lib::time();
     $value ? $t->setDateDb($value) : $t->setNow();
     $value = $t->formatDate_Db();
     $out = HC_Html_Factory::widget('container');
     /* hidden field to store our value */
     $hidden = HC_Html_Factory::input('hidden')->set_name($name)->set_value($value)->set_id($id);
     $out->add_item($hidden);
     /* text field to display */
     $display_name = $name . '_display';
     $display_id = 'nts-' . $display_name;
     $datepicker_format = $t->formatToDatepicker();
     $display_value = $t->formatDate();
     $text = HC_Html_Factory::input('text')->set_name($display_name)->set_value($display_value)->set_id($display_id)->add_attr('data-date-format', $datepicker_format)->add_attr('data-date-week-start', $t->weekStartsOn)->add_attr('style', 'width: 8em')->add_attr('class', 'hc-datepicker');
     $out->add_item($text);
     $return = $this->decorate($out->render());
     return $return;
 }
Esempio n. 21
0
 function add_form_inputs($parent_object = NULL)
 {
     $acl = HC_App::acl();
     if ($parent_object) {
         if (!$acl->set_object($parent_object)->can('notification_email::skip')) {
             return;
         }
     }
     $form = HC_Lib::form();
     $form->set_inputs(array('notifications_email_skip' => 'checkbox'));
     $default_values = array('notifications_email_skip' => 0);
     /* extensions */
     $extensions = HC_App::extensions();
     $change_values = $extensions->run('notifications_email/insert/defaults');
     foreach ($change_values as $change_array) {
         foreach ($change_array as $k => $v) {
             $default_values[$k] = $v;
         }
     }
     $form->set_values($default_values);
     return $this->render('notifications_email/add_form_inputs', array('form' => $form));
 }
Esempio n. 22
0
 function render()
 {
     $name = $this->name();
     $value = $this->value();
     $id = 'nts-' . $name;
     $t = HC_Lib::time();
     $t->setNow();
     $t->setStartDay();
     if ($value) {
         $t->modify('+' . $value . ' seconds');
         // $value = $t->formatTime();
     }
     $out = HC_Html_Factory::widget('container');
     /* hidden field to store our value */
     $hidden = HC_Html_Factory::input('hidden')->set_name($name)->set_value($value)->set_id($id);
     $attr = $this->attr();
     foreach ($attr as $k => $v) {
         if (!in_array($k, array('disabled', 'readonly'))) {
             continue;
         }
         $hidden->add_attr($k, $v);
     }
     $out->add_item($hidden);
     /* text field to display */
     $display_name = $name . '_display';
     $display_id = 'nts-' . $display_name;
     $text = HC_Html_Factory::input('text')->set_name($display_name)->set_id($display_id)->add_attr('size', 7)->add_attr('class', 'hc-timepicker');
     if (strlen($value)) {
         $display_value = $t->formatTime();
         $text->set_value($display_value);
     }
     foreach ($attr as $k => $v) {
         $text->add_attr($k, $v);
     }
     $out->add_item($text);
     $return = $this->decorate($out->render());
     return $return;
 }
Esempio n. 23
0
 public function up()
 {
     if (!$this->db->field_exists('date_end', 'shifts')) {
         $this->dbforge->add_column('shifts', array('date_end' => array('type' => 'INT', 'null' => FALSE)), 'start');
         // init date end
         $this->db->set('date_end', 'date', FALSE);
         $this->db->update('shifts');
         // now check those that go next day
         $this->db->where('end > ', 24 * 60 * 60);
         $this->db->set('end', 'end - ' . 24 * 60 * 60, FALSE);
         $this->db->update('shifts');
         $affected_count = 0;
         $t = HC_Lib::time();
         $query = $this->db->where('start >= ', 'end', FALSE)->get('shifts');
         foreach ($query->result_array() as $row) {
             $t->setDateDb($row['date']);
             $t->modify('+1 day');
             $date_end = $t->formatDate_Db();
             $this->db->where('id', $row['id'])->update('shifts', array('date_end' => $date_end));
             $affected_count++;
         }
     }
 }
Esempio n. 24
0
 function render()
 {
     $module_params = array();
     $link_params = array();
     $module_params[] = $this->url();
     foreach ($this->args() as $k) {
         $module_params[] = $k;
         // $link_params[$k] = $v;
     }
     foreach ($this->params() as $k => $v) {
         $module_params[] = $k;
         $module_params[] = $v;
         $link_params[$k] = $v;
     }
     foreach ($this->more_params() as $k => $v) {
         $module_params[] = $k;
         $module_params[] = $v;
         $link_params[$k] = $v;
     }
     $link = HC_Lib::link($this->url(), $link_params);
     $return = $this->content();
     if ($return === NULL) {
         $return = call_user_func_array('Modules::run', $module_params);
     }
     $show_empty = $this->show_empty();
     if (strlen($return) && $this->self_target() or $show_empty or !$this->skip_src()) {
         $out = HC_Html_Factory::element('div')->add_child($return);
         if ($this->self_target()) {
             $out->add_attr('class', 'hc-target');
         }
         if (!$this->skip_src()) {
             $out->add_attr('data-src', $link->url());
         }
         $attr = $this->attr();
         foreach ($attr as $k => $v) {
             $out->add_attr($k, $v);
         }
         $return = $out->render();
     }
     return $return;
 }
Esempio n. 25
0
 function render($readonly = FALSE)
 {
     if (!$readonly && !($link = $this->link())) {
         return 'HC_Html_Widget_Date_Nav: link is not set!';
     }
     $t = HC_Lib::time();
     $nav_title = $this->_nav_title($readonly);
     if ($readonly) {
         $return = HC_Html_Factory::element('span')->add_attr('class', array('btn', 'btn-default'))->add_child($nav_title);
         return $return;
     }
     switch ($this->range()) {
         case 'all':
             $t->setNow();
             $start_date = $end_date = 0;
             // $start_date = $end_date = $t->formatDate_Db();
             break;
         case 'upcoming':
             $t->setNow();
             $start_date = $end_date = 0;
             break;
         case 'custom':
             list($start_date, $end_date) = explode('_', $this->date());
             $t->setDateDb($start_date)->modify('-1 day');
             $before_date = $t->formatDate_Db();
             $t->setDateDb($end_date)->modify('+1 day');
             $after_date = $t->formatDate_Db();
             break;
         case 'day':
             $t->setDateDb($this->date());
             $start_date = $end_date = $t->formatDate_Db();
             $t->modify('-1 day');
             $before_date = $t->formatDate_Db();
             $t->setDateDb($this->date());
             $t->modify('+1 day');
             $after_date = $t->formatDate_Db();
             break;
         case 'week':
             $t->setDateDb($this->date());
             $start_date = $t->setStartWeek()->formatDate_Db();
             $end_date = $t->setEndWeek()->formatDate_Db();
             $t->setDateDb($this->date());
             $t->modify('-1 week');
             $t->setStartWeek();
             $before_date = $t->formatDate_Db();
             $t->setDateDb($this->date());
             $t->setEndWeek();
             $t->modify('+1 day');
             $after_date = $t->formatDate_Db();
             break;
         case 'month':
             $t->setDateDb($this->date());
             $start_date = $t->setStartMonth()->formatDate_Db();
             $end_date = $t->setEndMonth()->formatDate_Db();
             $month_view = $t->getMonthName() . ' ' . $t->getYear();
             $t->setDateDb($this->date());
             $t->modify('-1 month');
             $t->setStartMonth();
             $before_date = $t->formatDate_Db();
             $t->setDateDb($this->date());
             $t->setEndMonth();
             $t->modify('+1 day');
             $after_date = $t->formatDate_Db();
             break;
     }
     // $this->add_attr('class', array('nav', 'nav-pills'));
     $this->add_attr('class', array('list-inline', 'list-separated'));
     $wrap_nav_title = HC_Html_Factory::element('a')->add_attr('class', array('btn', 'btn-default'))->add_child($nav_title);
     $current_nav = HC_Html_Factory::widget('dropdown')->set_title($wrap_nav_title);
     $range_options = array();
     /* week */
     $this_params = array($this->range_param() => 'week', $this->date_param() => $start_date ? $start_date : NULL);
     $range_options['week'] = HC_Html_Factory::element('a')->add_child(HCM::__('Week'))->add_attr('href', $link->url($this_params));
     /* month */
     $this_params = array($this->range_param() => 'month', $this->date_param() => $start_date ? $start_date : NULL);
     $range_options['month'] = HC_Html_Factory::element('a')->add_child(HCM::__('Month'))->add_attr('href', $link->url($this_params));
     /* day */
     $this_params = array($this->range_param() => 'day', $this->date_param() => $start_date ? $start_date : NULL);
     $range_options['day'] = HC_Html_Factory::element('a')->add_child(HCM::__('Day'))->add_attr('href', $link->url($this_params));
     /* custom */
     $date_param = '';
     if ($start_date && $end_date) {
         $date_param = $start_date . '_' . $end_date;
     } elseif ($start_date) {
         $date_param = $start_date;
     }
     $this_params = array($this->range_param() => 'custom', $this->date_param() => $date_param ? $date_param : NULL);
     $range_options['custom'] = HC_Html_Factory::element('a')->add_child(HCM::__('Custom Range'))->add_attr('href', $link->url($this_params));
     /* upcoming */
     $this_params = array($this->range_param() => 'upcoming', $this->date_param() => NULL);
     $range_options['upcoming'] = HC_Html_Factory::element('a')->add_child(HCM::__('Upcoming'))->add_attr('href', $link->url($this_params));
     /* all */
     $this_params = array($this->range_param() => 'all', $this->date_param() => NULL);
     $range_options['all'] = HC_Html_Factory::element('a')->add_child(HCM::__('All Time'))->add_attr('href', $link->url($this_params));
     $enabled = $this->enabled();
     foreach ($range_options as $k => $v) {
         if (!in_array($k, $enabled)) {
             continue;
         }
         if ($k != $this->range()) {
             $current_nav->add_item($range_options[$k]);
         }
     }
     $this->add_item_attr('current', 'class', array('dropdown'));
     $enabled = $this->enabled();
     switch ($this->range()) {
         case 'custom':
             $this->add_item('current', $current_nav);
             /* now add form */
             if (in_array($this->range(), $enabled)) {
                 $form = HC_Lib::form()->set_input('start_date', 'date')->set_input('end_date', 'date');
                 $form->set_values(array('start_date' => $start_date, 'end_date' => $end_date));
                 $display_form = HC_Html_Factory::widget('form')->add_attr('action', $this->submit_to());
                 $display_form->add_item(HC_Html_Factory::widget('list')->add_attr('class', 'list-inline')->add_attr('class', 'list-separated')->add_item($form->input('start_date'))->add_item('-')->add_item($form->input('end_date'))->add_item(HC_Html_Factory::element('input')->add_attr('type', 'submit')->add_attr('class', array('btn', 'btn-default'))->add_attr('title', HCM::__('OK'))->add_attr('value', HCM::__('OK'))));
             } else {
                 $display_form = HC_Html_Factory::widget('list')->add_attr('class', 'list-inline')->add_attr('class', 'list-separated')->add_item($t->formatDateRange($start_date, $end_date));
             }
             $this->add_item('form', $display_form);
             break;
         case 'all':
         case 'upcoming':
             $this->add_item('current', $current_nav);
             break;
         default:
             $this->add_item('before', HC_Html_Factory::element('a')->add_attr('href', $link->url(array($this->date_param() => $before_date)))->add_attr('class', array('btn', 'btn-default'))->add_child('&lt;&lt;'));
             $this->add_item('current', $current_nav);
             $this->add_item('after', HC_Html_Factory::element('a')->add_attr('href', $link->url(array($this->date_param() => $after_date)))->add_attr('class', array('btn', 'btn-default'))->add_child('&gt;&gt;'));
             break;
     }
     $this->set_active('current');
     return parent::render();
 }
                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]);
Esempio n. 27
0
<?php

$current_user_id = $this->auth->check();
$display_form = HC_Html_Factory::widget('form')->add_attr('action', HC_Lib::link('admin/users/update/password/' . $object->id))->add_attr('class', 'form-horizontal')->add_attr('class', 'form-condensed');
/* BUTTONS */
$buttons = HC_Html_Factory::widget('list')->add_attr('class', array('list-inline', 'list-separated'));
$buttons->add_item(HC_Html_Factory::element('input')->add_attr('type', 'submit')->add_attr('class', array('btn', 'btn-default'))->add_attr('title', HCM::__('Save'))->add_attr('value', HCM::__('Save')));
$display_form->add_item(HC_Html_Factory::widget('label_row')->set_label(HCM::__('Password'))->set_content($form->input('password')->add_attr('size', 24))->set_error($form->input('password')->error()))->add_item(HC_Html_Factory::widget('label_row')->set_label(HCM::__('Confirm Password'))->set_content($form->input('confirm_password')->add_attr('size', 24))->set_error($form->input('confirm_password')->error()));
$display_form->add_item(HC_Html_Factory::widget('label_row')->set_content($buttons));
echo $display_form->render();
Esempio n. 28
0
<?php

$t = HC_Lib::time();
$out = HC_Html_Factory::widget('list')->add_attr('class', 'list-unstyled')->add_attr('class', 'list-separated');
foreach ($entries as $e) {
    $view = HC_Html_Factory::widget('availability_view');
    $view->set_model($e);
    if (isset($state['wide'])) {
        $view->set_wide($state['wide']);
    }
    $view->set_start_link('availability');
    $out->add_item($view);
    /*
    	$out->add_item(
    		HC_Html_Factory::widget('titled', 'span')
    			->add_child( $e->present_title() )
    			->add_attr('class', 'text-success')
    			->add_attr('class', 'text-smaller')
    		);
    */
}
echo $out->render();
Esempio n. 29
0
<?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();
Esempio n. 30
0
 function __construct()
 {
     parent::__construct(USER_HC_MODEL::LEVEL_ADMIN);
     $this->form = HC_Lib::form()->set_input('name', 'text')->set_input('time', 'timeframe', array('start' => 'start', 'end' => 'end'));
 }