Beispiel #1
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();
 }
Beispiel #2
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;
 }
    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;
    }
Beispiel #4
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();
 }
 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();
 }
 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;
 }
Beispiel #7
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);
 }
Beispiel #8
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;
 }
Beispiel #9
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;
 }
Beispiel #10
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++;
         }
     }
 }
Beispiel #11
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');
        $out->add_item($text);
        /* JavaScript to make it work */
        $js_options = array();
        $options = $this->options();
        foreach ($options as $k => $v) {
            switch ($k) {
                case 'startDate':
                    if ($v > $value) {
                        $value = $v;
                    }
                    $t->setDateDb($v);
                    $v = $t->formatDate();
                    break;
            }
            $js_options[] = "{$k}: \"{$v}\"";
        }
        $js_options[] = "weekStart: " . $t->weekStartsOn;
        $js_options = join(",\n", $js_options);
        $script = HC_Html_Factory::element('script');
        $script->add_attr('language', 'JavaScript');
        $cal_language = array('days' => array(HCM::__('Sun'), HCM::__('Mon'), HCM::__('Tue'), HCM::__('Wed'), HCM::__('Thu'), HCM::__('Fri'), HCM::__('Sat'), HCM::__('Sun')), 'daysShort' => array(HCM::__('Sun'), HCM::__('Mon'), HCM::__('Tue'), HCM::__('Wed'), HCM::__('Thu'), HCM::__('Fri'), HCM::__('Sat'), HCM::__('Sun')), 'daysMin' => array(HCM::__('Sun'), HCM::__('Mon'), HCM::__('Tue'), HCM::__('Wed'), HCM::__('Thu'), HCM::__('Fri'), HCM::__('Sat'), HCM::__('Sun')), 'months' => array(HCM::__('Jan'), HCM::__('Feb'), HCM::__('Mar'), HCM::__('Apr'), HCM::__('May'), HCM::__('Jun'), HCM::__('Jul'), HCM::__('Aug'), HCM::__('Sep'), HCM::__('Oct'), HCM::__('Nov'), HCM::__('Dec')), 'monthsShort' => array(HCM::__('Jan'), HCM::__('Feb'), HCM::__('Mar'), HCM::__('Apr'), HCM::__('May'), HCM::__('Jun'), HCM::__('Jul'), HCM::__('Aug'), HCM::__('Sep'), HCM::__('Oct'), HCM::__('Nov'), HCM::__('Dec')), 'today' => 'Today', 'clear' => 'Clear');
        $cal_language_js_code = array();
        foreach ($cal_language as $k => $v) {
            $cal_language_js_code_line = '';
            $cal_language_js_code_line .= $k . ': ';
            if (is_array($v)) {
                $cal_language_js_code_line .= '[';
                $cal_language_js_code_line .= join(', ', array_map(create_function('$v', 'return "\\"" . $v . "\\"";'), $v));
                $cal_language_js_code_line .= ']';
            } else {
                $cal_language_js_code_line .= '"' . $v . '"';
            }
            $cal_language_js_code[] = $cal_language_js_code_line;
        }
        $cal_language_js_code = join(",\n", $cal_language_js_code);
        // echo $cal_language_js_code;
        $js_code = <<<EOT

;(function(\$){
\t\$.fn.datepicker.dates['en'] = {
\t\t{$cal_language_js_code}
\t};
}(jQuery));

jQuery('#{$display_id}').datepicker({
\t{$js_options},
\tdateFormat: '{$datepicker_format}',
\tautoclose: true,
\t})
\t.on('changeDate', function(ev)
\t\t{
\t\tvar dbDate = 
\t\t\tev.date.getFullYear() 
\t\t\t+ "" + 
\t\t\t("00" + (ev.date.getMonth()+1) ).substr(-2)
\t\t\t+ "" + 
\t\t\t("00" + ev.date.getDate()).substr(-2);
\t\tjQuery('#{$id}').val( dbDate );
\t\t});

EOT;
        $script->add_child($js_code);
        $out->add_item($script);
        $return = $this->decorate($out->render());
        return $return;
    }
 function differ($other)
 {
     if (!is_object($other)) {
         $other_date = $other;
         $other = HC_Lib::time();
         $other->setDateDb($other_date);
     } else {
         $other_date = $other->formatDate_Db();
     }
     $this_date = $this->formatDate_Db();
     if ($this_date == $other_date) {
         $delta = 0;
     } elseif ($this_date > $other_date) {
         $delta = $this->getTimestamp() - $other->getTimestamp();
     } else {
         $delta = $other->getTimestamp() - $this->getTimestamp();
     }
     if ($delta) {
         $return = floor($delta / (24 * 60 * 60));
     }
     return $return;
 }
Beispiel #13
0
    function render()
    {
        $enabled = $this->enabled();
        $value = $this->value(TRUE);
        $t = HC_Lib::time();
        if (isset($value['datestart'])) {
            $t->setDateDb($value['datestart']);
        }
        /* single date part */
        $wrap_single = HC_Html_Factory::widget('list')->add_attr('class', array('list-unstyled', 'list-separated'));
        $wrap_single->add_item($this->fields['datesingle']);
        /* recurring part */
        $wrap = HC_Html_Factory::widget('list')->add_attr('class', array('list-unstyled', 'list-separated'))->add_attr('class', 'hc-radio-info-container');
        /* DATES */
        $item_dates = HC_Html_Factory::widget('list')->add_attr('class', array('list-inline', 'list-separated'));
        $item_dates->add_item($this->fields['datestart']);
        $item_dates->add_item(' - ');
        $item_dates->add_item($this->fields['dateend']);
        $wrap->add_item($item_dates);
        /* RECURRING OPTIONS */
        $repeat = clone $this->fields['repeat'];
        $repeat->add_option('daily', HCM::__('Daily'));
        $repeat->add_option('weekday', HCM::__('Every Weekday') . ' (' . $t->formatWeekdayShort(1) . ' - ' . $t->formatWeekdayShort(5) . ')');
        $repeat->add_option('weekly', HCM::__('Weekly') . ' (' . $t->formatWeekdayShort() . ')');
        $wkds = array(0, 1, 2, 3, 4, 5, 6);
        $wkds = $t->sortWeekdays($wkds);
        /* weekly custom */
        $weekly_custom = clone $this->fields['weeklycustom'];
        $this_weekday = $t->getWeekday();
        if (!$weekly_custom->value()) {
            $weekly_custom->set_value(array($this_weekday));
        }
        reset($wkds);
        foreach ($wkds as $wkd) {
            $weekly_custom->add_option($wkd, $t->formatWeekdayShort($wkd));
        }
        // $weekly_custom->set_readonly($this_weekday);
        $repeat->add_option('weeklycustom', HCM::__('Weekly') . ' (' . HCM::__('Selected Days') . ')', $weekly_custom);
        /* biweekly custom */
        $this_weekday = $t->getWeekday();
        $biweekly_custom1 = clone $this->fields['biweeklycustom1'];
        if (!$biweekly_custom1->value()) {
            $biweekly_custom1->set_value(array($this_weekday));
        }
        $biweekly_custom2 = clone $this->fields['biweeklycustom2'];
        if (!$biweekly_custom2->value()) {
            $biweekly_custom2->set_value(array($this_weekday));
        }
        reset($wkds);
        foreach ($wkds as $wkd) {
            $biweekly_custom1->add_option($wkd, $t->formatWeekdayShort($wkd));
            $biweekly_custom2->add_option($wkd, $t->formatWeekdayShort($wkd));
        }
        // $weekly_custom->set_readonly($this_weekday);
        $repeat->add_option('biweeklycustom', HCM::__('Biweekly') . ' (' . HCM::__('Selected Days') . ')', array($biweekly_custom1, $biweekly_custom2));
        /* in/out */
        if (!$this->fields['inoutin']->value()) {
            $this->fields['inoutin']->set_value(2);
        }
        if (!$this->fields['inoutout']->value()) {
            $this->fields['inoutout']->set_value(2);
        }
        $repeat->add_option('inout', join(' / ', array(sprintf(HCM::_n('%s Day On', '%s Days On', 100), 'X'), sprintf(HCM::_n('%s Day Off', '%s Days Off', 100), 'Y'))), HC_Html_Factory::widget('list')->add_attr('class', array('list-inline', 'list-separated'))->add_item($this->fields['inoutin']->add_attr('size', 2))->add_item('/')->add_item($this->fields['inoutout']->add_attr('size', 2)));
        $repeat->add_option('monthlyday', HCM::__('Monthly') . ' (' . join(', ', array($t->formatWeekdayShort(), $t->formatWeekOfMonth())) . ')');
        $repeat->add_option('monthlydayend', HCM::__('Monthly') . ' (' . join(', ', array($t->formatWeekdayShort(), $t->formatWeekOfMonthFromEnd())) . ')');
        $repeat->add_option('monthlydate', HCM::__('Monthly') . ' (' . HCM::__('Day') . ': ' . $t->getDay() . ')');
        $wrap->add_item($repeat);
        /* build output */
        // $recurring_part = $wrap->render();
        // $recurring_part = $this->decorate( $recurring_part );
        // $single_part = $wrap_single->render();
        // $single_part = $this->decorate( $wrap_single );
        $return = HC_Html_Factory::widget('container');
        if (count($enabled) > 1) {
            $tabs = HC_Html_Factory::widget('tabs');
            $tabs_id = 'nts' . hc_random();
            $tabs->set_id($tabs_id);
            $tabs->add_tab('single', HCM::__('Single Day'), $wrap_single);
            $tabs->add_tab('recurring', HCM::__('Multiple Days'), $wrap);
            $value_recurring = $value['recurring'];
            $tabs->set_active($value_recurring);
            $return->add_item($this->fields['recurring']);
            $return->add_item($tabs);
            $name_recurring = $this->fields['recurring']->name();
            $tabs_js = <<<EOT

<script language="JavaScript">
jQuery('#{$tabs_id}').closest('form').find('[name={$name_recurring}]').val( "{$value_recurring}" )
jQuery('#{$tabs_id} a.hc-tab-toggler').on('shown.hc.tab', function(e)
{
\tvar active_tab = jQuery(this).data('toggle-tab');
\tjQuery(this).closest('form').find('[name={$name_recurring}]').val( active_tab );
});
</script>

EOT;
            $return->add_item($tabs_js);
        } else {
            if (in_array('single', $enabled)) {
                $return->add_item($wrap_single);
            }
            if (in_array('recurring', $enabled)) {
                $return->add_item($wrap);
            }
        }
        $return = $return->render();
        // return $return;
        return $this->decorate($return);
    }
Beispiel #14
0
 function date($model, $vlevel = HC_PRESENTER::VIEW_HTML, $with_change = FALSE)
 {
     $t = HC_Lib::time();
     $t->setDateDb($model->date);
     $return = array();
     switch ($vlevel) {
         case HC_PRESENTER::VIEW_HTML:
             $return[] = HC_Html::icon(HC_App::icon_for('date'));
             break;
         case HC_PRESENTER::VIEW_TEXT:
             $return[] = HCM::__('Date');
             $return[] = ': ';
             break;
     }
     $return[] = $t->formatDateFull();
     if ($with_change) {
         $changes = $model->get_changes();
         if (isset($changes['date'])) {
             $t->setDateDb($changes['date']);
             $return[] = ' [' . HCM::__('Old Value') . ': ' . $t->formatDateFull() . ']';
         }
     }
     $return = join('', $return);
     return $return;
 }
Beispiel #15
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();
 }
Beispiel #16
0
 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;
 }
 public function _check_date_end($field)
 {
     if (!$this->date) {
         return TRUE;
     }
     if ($this->end <= $this->start) {
         $t = HC_Lib::time();
         $t->setDateDb($this->date);
         $t->modify('+1 day');
         $this->date_end = $t->formatDate_Db();
     } else {
         $this->date_end = $this->date;
     }
     return TRUE;
 }
Beispiel #18
0
 public function save($model, $form)
 {
     $t = HC_Lib::time();
     $post = array();
     $also_get = array('date_from', 'date_to', 'repeat_type', 'repeat', 'custom_weekday', 'in_out_in', 'in_out_out');
     reset($also_get);
     foreach ($also_get as $ag) {
         $post[$ag] = $this->input->post($ag);
     }
     $form->set_defaults($post);
     $dates = array();
     if ($post['repeat'] == 'multiple') {
         $t->setDateDb($post['date_from']);
         $rex_date = $post['date_from'];
         while ($rex_date <= $post['date_to']) {
             $dates[] = $rex_date;
             switch ($post['repeat_type']) {
                 case 'daily':
                     $t->modify('+1 day');
                     break;
                 case 'weekday':
                     $t->modify('+1 day');
                     while (in_array($t->getWeekday(), array(0, 6))) {
                         $t->modify('+1 day');
                     }
                     break;
                 case 'weekly':
                     $t->modify('+1 week');
                     break;
                 case 'weekly-custom':
                     $custom_weekday = $post['custom_weekday'];
                     $t->modify('+1 day');
                     while (!in_array($t->getWeekday(), $custom_weekday)) {
                         $t->modify('+1 day');
                     }
                     break;
                 case 'monthly-day':
                     $this_week = $t->getWeekOfMonth();
                     $t->modify('+4 weeks');
                     while ($t->getWeekOfMonth() != $this_week) {
                         $t->modify('+1 week');
                     }
                     break;
                 case 'monthly-day-end':
                     $this_week = $this->hc_time->getWeekOfMonthFromEnd();
                     $this->hc_time->modify('+4 weeks');
                     while ($this->hc_time->getWeekOfMonthFromEnd() != $this_week) {
                         $this->hc_time->modify('+1 week');
                     }
                     break;
                 case 'monthly-date':
                     $t->modify('+1 month');
                     break;
                 case 'in-out':
                     $in_out_in = $post['in_out_in'];
                     $in_out_out = $post['in_out_out'];
                     if (!isset($in_out_count)) {
                         $in_out_count = 1;
                     }
                     if ($in_out_count < $in_out_in) {
                         $t->modify('+1 day');
                         $in_out_count++;
                     } else {
                         $in_out_count = 1;
                         $t->modify('+' . ($in_out_out + 1) . ' day');
                     }
                     break;
             }
             $rex_date = $t->formatDate_Db();
         }
     } else {
         $dates = array($model->date);
     }
     $model->date = $dates;
     if (count($dates) > 1) {
         /* set the shift group_id */
         $sm = HC_App::model('shift');
         $max_group_id = $sm->select_max('group_id')->get()->group_id;
         if (!$max_group_id) {
             $max_group_id = 0;
         }
         $model->group_id = $max_group_id + 1;
     }
     $return = array($model, $form);
     return $return;
 }
Beispiel #19
0
 function render()
 {
     $sh = $this->shift();
     $t = HC_Lib::time();
     $titles = array();
     $iknow = $this->iknow();
     $wide = $this->wide();
     $use_color = FALSE;
     $use_color = TRUE;
     if ($wide && $wide === 'mini') {
         $use_color = TRUE;
     }
     if (in_array($sh->type, array($sh->_const("TYPE_TIMEOFF")))) {
         $display = array('date', 'time', 'user', 'location');
     } else {
         if (!$wide or $wide === 'mini') {
             $display = array('date', 'time', 'location', 'user');
         } elseif ($wide) {
             $display = array('date', 'time', 'user', 'location');
         }
     }
     foreach ($iknow as $ik) {
         $display = HC_Lib::remove_from_array($display, $ik);
     }
     // if( in_array($sh->type, array($sh->_const("TYPE_TIMEOFF"))) ){
     // $display = HC_Lib::remove_from_array($display, 'location');
     // }
     foreach ($display as $ds) {
         $title_view = '';
         switch ($ds) {
             case 'date':
                 $title_view = $sh->present_date(HC_PRESENTER::VIEW_RAW);
                 break;
             case 'time':
                 $title_view = $sh->present_time();
                 break;
             case 'location':
                 if (in_array($sh->type, array($sh->_const("TYPE_TIMEOFF")))) {
                     $title_view = '';
                     // $title_view = HCM::__('Timeoff');
                     // $title_view = $sh->present_location();
                 } else {
                     $title_view = $sh->present_location();
                 }
                 break;
             case 'user':
                 if ($sh->type == $sh->_const('TYPE_TIMEOFF') && !in_array('time', $display)) {
                     $title_view = $sh->present_type(HC_PRESENTER::VIEW_HTML_ICON) . $sh->present_user(HC_PRESENTER::VIEW_RAW);
                 } else {
                     // $titles[] = $sh->present_user();
                     if ($sh->user_id) {
                         $title_view = $sh->present_user(HC_PRESENTER::VIEW_RAW);
                     } else {
                         $title_view = $sh->present_user();
                     }
                 }
                 break;
         }
         // if( $title_view ){
         $titles[] = $title_view;
         // }
     }
     $wrap = HC_Html_Factory::element('div')->add_attr('class', array('alert', 'display-block'))->add_attr('class', array('alert-default-o'))->add_attr('class', array('no-underline'))->add_attr('class', array('alert-condensed2'))->add_attr('class', array('text-smaller'))->add_attr('class', array('squeeze-in'));
     foreach ($sh->present_status_class() as $status_class) {
         // $wrap->add_attr('class', 'alert-' . $status_class);
     }
     /* background color depends on location */
     if ($use_color) {
         $color = $sh->location->present_color();
     } else {
         $type = $sh->type;
         switch ($type) {
             case $sh->_const('TYPE_TIMEOFF'):
                 $wrap->add_attr('class', array('alert-archive'));
                 $color = '#ddd';
                 break;
             default:
                 $wrap->add_attr('class', array('alert-success-o'));
                 $color = '#dff0d8';
                 break;
         }
     }
     if ($sh->status == $sh->_const('STATUS_DRAFT')) {
         $color1 = HC_Lib::adjust_color_brightness($color, 0);
         $color2 = HC_Lib::adjust_color_brightness($color, 20);
         // $color1 = '#fff';
         // $color2 = '#eee';
         $wrap->add_attr('style', "background: repeating-linear-gradient(\r\n\t\t\t\t\t-45deg,\r\n\t\t\t\t\t{$color1},\r\n\t\t\t\t\t{$color1} 6px,\r\n\t\t\t\t\t{$color2} 6px,\r\n\t\t\t\t\t{$color2} 12px\r\n\t\t\t\t\t);\r\n\t\t\t\t");
     } else {
         $wrap->add_attr('style', 'background-color: ' . $color . ';');
         // $wrap->add_attr('class', 'alert-success');
     }
     if (!$sh->user_id) {
         $wrap->add_attr('class', 'hc-red-triangled');
     }
     //		echo $color;
     /* ID */
     if (in_array('id', $iknow)) {
         $wrap->add_child($sh->present_id());
     }
     /* build link title */
     $nolink = $this->nolink();
     $new_window = $this->new_window();
     $a_link = HC_Html_Factory::widget('titled', 'a');
     $link_to = 'shifts/zoom/index/id/' . $sh->id;
     $a_link->add_attr('href', HC_Lib::link($link_to)->url());
     if (!$new_window) {
         $a_link->add_attr('class', 'hc-flatmodal-loader');
     } else {
         $a_link->add_attr('target', '_blank');
         $a_link->add_attr('class', 'hc-parent-loader');
     }
     if ($nolink) {
         $a_title = HC_Html_Factory::widget('titled', 'span');
     } else {
         $a_title = HC_Html_Factory::widget('titled', 'a');
     }
     $a_title = HC_Html_Factory::widget('titled', 'span');
     $a_title->add_attr('class', array('squeeze-in'));
     // $a_title->add_attr('style', 'border: red 1px solid;');
     // $a_title->add_attr('style', 'border-color: ' . $sh->location->present_color());
     if ($wide === 'mini') {
         if (!$nolink) {
             $final_ttl = clone $a_link;
             $final_ttl->add_child('&nbsp;')->add_attr('style', 'display: block;');
             $final_ttl->add_attr('title', join(' ', $titles));
         }
         $a_title->add_child($final_ttl);
     } else {
         if (count($display) > 1) {
             if ($wide) {
                 $titles2 = HC_Html_Factory::widget('grid');
                 $titles2->set_slim();
                 $grid_width = array(2 => 6, 3 => 4, 4 => 3, 5 => 2, 6 => 2);
                 $grid_width = isset($grid_width[count($display)]) ? $grid_width[count($display)] : 2;
                 for ($ti = 0; $ti < count($titles); $ti++) {
                     $ttl = $titles[$ti];
                     // next title is empty?
                     if ($ti < count($titles) - 1 && !strlen($titles[$ti + 1])) {
                         $ti++;
                         $grid_width += $grid_width;
                     }
                     $final_ttl = $ttl;
                     if (!$nolink) {
                         $final_ttl = clone $a_link;
                         $final_ttl->add_child($ttl);
                     }
                     $titles2->add_item($final_ttl, $grid_width, array('class' => 'squeeze-in'));
                 }
             } else {
                 $titles2 = HC_Html_Factory::widget('list')->add_attr('class', 'list-unstyled');
                 $this_index = 0;
                 foreach ($titles as $ttl) {
                     if (!strlen($ttl)) {
                         continue;
                     }
                     $final_ttl = $ttl;
                     if (!$nolink) {
                         $final_ttl = clone $a_link;
                         $final_ttl->add_child($ttl);
                     }
                     $titles2->add_item($this_index, $final_ttl);
                     $titles2->add_item_attr($ttl, 'class', array('squeeze-in'));
                     $this_index++;
                 }
             }
             $a_title->add_attr('title', join(' ', $titles));
             $a_title->add_child($titles2);
         } else {
             $final_ttl = $titles;
             if (!$nolink) {
                 $final_ttl = clone $a_link;
                 $final_ttl->add_child($titles);
             }
             $final_ttl->add_attr('title', join(' ', $titles));
             $a_title->add_child($final_ttl);
         }
     }
     $wrap->add_child($a_title);
     /* EXTENSIONS */
     $extensions = HC_App::extensions();
     $more_content = $extensions->set_skip($iknow)->run('shifts/quickview', $sh, $wrap);
     if ($wide !== 'mini') {
         if ($more_content) {
             $more_wrap = HC_Html_Factory::widget('list')->add_attr('class', 'list-unstyled')->add_attr('class', 'list-separated')->add_attr('class', 'text-small');
             $added = 0;
             foreach ($more_content as $mck => $mc) {
                 if ($mck && in_array($mck, $iknow)) {
                     continue;
                 }
                 $more_wrap->add_item($mc);
                 $added++;
             }
             if ($added) {
                 $wrap->add_child($more_wrap);
             }
         }
     }
     /* THIS CHILDREN */
     if ($wide !== 'mini') {
         $children = $this->children();
         foreach ($children as $child) {
             $wrap->add_child($child);
         }
     }
     $wrap->add_attr('class', 'common-link-parent');
     return $wrap->render();
 }
Beispiel #20
0
 private function _add_time($layout, $params)
 {
     $default_date = $params->get('date') ? $params->get('date') : HC_Lib::time()->setNow()->formatDate_Db();
     if ($default_date) {
         $already_value = $this->form_add_time->input('date')->value();
         if (!$already_value) {
             $t = HC_Lib::time();
             $date_end = $t->setDateDb($default_date)->modify('+1 month')->formatDate_Db();
             $this->form_add_time->set_values(array('date' => array('recurring' => 'single', 'datesingle' => $default_date, 'datestart' => $default_date, 'dateend' => $date_end, 'repeat' => 'daily')));
         }
     }
     $stm = HC_App::model('shift_template');
     $shift_templates = $stm->get()->all;
     $locations = array();
     if ($params->get('location') === NULL) {
         $locations = $params->get_options('location');
     }
     $layout->set_partial('content', $this->render('shifts/add/time', array('form' => $this->form_add_time, 'shift_templates' => $shift_templates, 'params' => $params, 'locations' => $locations)));
     return $layout;
 }
<?php

$t = HC_Lib::time();
$current_user_id = $this->auth->user()->id;
$test_shift = HC_App::model('shift');
$is_print = isset($state['print']) && $state['print'] ? 1 : 0;
$can_add = TRUE;
if ($is_print or !$current_user_id) {
    $can_add = FALSE;
}
$t->setDateDb($state['date']);
$dates = $t->getDates($state['range']);
/* date labels */
$week_starts_on = $t->weekStartsOn();
$week_border_days = array();
$DATE_LABELS = array();
reset($dates);
foreach ($dates as $date) {
    $t->setDateDb($date);
    if ($t->getWeekDay() == $week_starts_on) {
        $week_border_days[] = $date;
    }
    $date_label = HC_Html_Factory::element('div')->add_attr('class', 'text-center')->add_attr('class', 'text-smaller')->add_child(HC_Html_Factory::widget('list')->add_attr('class', 'squeeze-in')->add_attr('class', 'list-unstyled')->add_item(HC_Html_Factory::element('small')->add_child($t->formatWeekdayShort()))->add_item($t->getDayShort()));
    $DATE_LABELS[$date] = $date_label;
}
/* titles */
$TITLES = array();
reset($locations);
foreach ($locations as $location) {
    $entity_title = $location->present_title();
    $TITLES[$location->id] = $entity_title;
Beispiel #22
0
 function render()
 {
     $t = HC_Lib::time();
     $t->setDateDb($this->date());
     $start_date = $this->date();
     $end_date = $this->end_date();
     if (!$end_date) {
         switch ($this->range()) {
             case 'week':
                 $t->setDateDb($this->date());
                 $t->setStartWeek();
                 $start_date = $t->formatDate_Db();
                 $t->setEndWeek();
                 $end_date = $t->formatDate_Db();
                 break;
             case 'month':
                 $t->setDateDb($this->date());
                 $t->setStartMonth();
                 $start_date = $t->formatDate_Db();
                 $t->setEndMonth();
                 $end_date = $t->formatDate_Db();
                 break;
         }
     }
     $t->setDateDb($start_date);
     $month_matrix = $t->getMonthMatrix($end_date);
     $slot_width = 1;
     $title = $this->title();
     /* wide slot */
     if ($this->range() == 'week' && $this->wide_slot()) {
         $title = NULL;
         $slot_width = 3;
         $month_matrix = array(array_slice($month_matrix[0], 0, 4), array_slice($month_matrix[0], 4));
     }
     $out = HC_Html_Factory::element('div')->add_attr('class', 'cal');
     if ($title) {
         // $out->add_attr('class', 'cal-title');
     }
     foreach ($month_matrix as $week => $days) {
         $grid = HC_Html_Factory::widget('grid')->add_attr('class', 'cal-row')->add_attr('class', 'flex-box')->add_attr('class', 'row-slim')->add_attr('class', 'flex-bordered');
         if ($title) {
             $title_cell = HC_Html_Factory::element('div')->add_attr('class', 'squeeze-in')->add_attr('style', 'padding: 2px;');
             $title_cell->add_child($title);
             $grid->add_item($title_cell, 2, array('class' => array('hc-cal-day')));
         }
         foreach ($days as $rex_date) {
             $t->setDateDb($rex_date);
             $day = HC_Html_Factory::element('div')->add_attr('class', 'squeeze-in')->add_attr('style', 'padding: 2px;');
             $date_content = $this->date_content($rex_date);
             if ($date_content) {
                 $day->add_child($date_content);
             } else {
                 $day = '';
             }
             $grid->add_item($day, $slot_width, array('class' => array('hc-cal-day'), 'style' => 'border: green 1px solid;'));
         }
         $out->add_child($grid);
     }
     return $out->render();
 }
Beispiel #23
0
 private function _download($shifts)
 {
     $app_conf = HC_App::app_conf();
     $separator = $app_conf->get('csv_separator');
     // header
     $headers = array(HCM::__('Type'), HCM::__('Date'), HCM::__('Time'), HCM::__('Duration'), HCM::__('Staff'), HCM::__('Location'), HCM::__('Status'));
     $data = array();
     $data[] = join($separator, $headers);
     $t = HC_Lib::time();
     // shifts
     foreach ($shifts as $sh) {
         $values = array();
         // type
         $values[] = $sh->present_type(HC_PRESENTER::VIEW_RAW);
         // date
         $values[] = $sh->present_date(HC_PRESENTER::VIEW_RAW);
         // time
         $values[] = $sh->present_time(HC_PRESENTER::VIEW_RAW);
         // duration
         $values[] = $t->formatPeriodExtraShort($sh->get_duration(), 'hour');
         // staff
         $values[] = $sh->present_user(HC_PRESENTER::VIEW_RAW);
         // location
         $values[] = $sh->present_location(HC_PRESENTER::VIEW_RAW);
         // status
         $values[] = $sh->present_status(HC_PRESENTER::VIEW_RAW);
         /* add csv line */
         $data[] = HC_Lib::build_csv(array_values($values), $separator);
     }
     // output
     $out = join("\n", $data);
     $file_name = isset($this->conf['export']) ? $this->conf['export'] : 'export';
     $file_name .= '-' . date('Y-m-d_H-i') . '.csv';
     $this->load->helper('download');
     force_download($file_name, $out);
     return;
 }
Beispiel #24
0
 function render()
 {
     $t = HC_Lib::time();
     $start_date = $this->date();
     $end_date = $this->end_date();
     $months = array();
     $t->setDateDb($start_date);
     $t->setStartMonth();
     $months[] = $t->formatDate_Db();
     $t->setEndMonth();
     $rex_date = $t->formatDate_Db();
     while ($rex_date < $end_date) {
         $t->modify('+1 day');
         $t->setStartMonth();
         $months[] = $t->formatDate_Db();
         $t->setEndMonth();
         $rex_date = $t->formatDate_Db();
     }
     $full_out = HC_Html_Factory::widget('list')->add_attr('class', 'list-inline')->add_attr('class', 'list-separated-hori');
     $show_other = $this->show_other();
     $show_weekdays = $this->show_weekdays();
     foreach ($months as $start_month_day) {
         $t->setDateDb($start_month_day);
         $month_matrix = $t->getMonthMatrix();
         $t->setDateDb($start_month_day);
         $start_month = $t->formatDate_Db();
         $t->setEndMonth();
         $end_month = $t->formatDate_Db();
         $out = HC_Html_Factory::widget('table')->set_engine('div')->add_attr('style', 'width: 14em;');
         $rid = 0;
         if ($show_weekdays) {
             $cid = 0;
             foreach ($month_matrix[0] as $date) {
                 $t->setDateDb($date);
                 $cell_content = $t->formatWeekDayShort();
                 $cell_content = HC_Html_Factory::element('div')->add_attr('class', array('text-muted'))->add_attr('class', array('text-smaller'))->add_attr('class', array('text-center'))->add_child($cell_content);
                 $out->set_cell($rid, $cid, $cell_content);
                 $out->add_cell_attr($rid, $cid, array('class' => array('noborder')));
                 $cid++;
             }
             $rid++;
         }
         foreach ($month_matrix as $week => $week_dates) {
             $cid = 0;
             foreach ($week_dates as $date) {
                 if (!$show_other && ($date > $end_month or $date < $start_month)) {
                     $cell_content = '';
                     /* empty cell */
                     if (!$show_weekdays) {
                         $out->add_cell_attr($rid, $cid, array('class' => array('noborder')));
                     }
                 } else {
                     $t->setDateDb($date);
                     $cell_content = $this->date_content($date);
                     if ($cell_content === NULL) {
                         $cell_content = clone $this->default_date_content();
                     }
                     if (is_object($cell_content)) {
                         $cell_content->add_child($t->getDayShort());
                     } elseif ($cell_content !== NULL) {
                     } else {
                         $cell_content = $t->getDayShort();
                     }
                     $out->add_cell_attr($rid, $cid, array());
                 }
                 $out->set_cell($rid, $cid, $cell_content);
                 $cid++;
             }
             $rid++;
         }
         $month_out = HC_Html_Factory::widget('list')->add_attr('class', 'list-unstyled')->add_attr('class', 'list-separated');
         $t->setDateDb($start_month_day);
         $month_label = $t->getMonthName() . ' ' . $t->getYear();
         $month_out->add_item('label', $month_label);
         $month_out->add_item_attr('label', 'class', 'text-center');
         $month_out->add_item('calendar', $out);
         $full_out->add_item('month_' . $start_month_day, $month_out);
         $full_out->add_item_attr('month_' . $start_month_day, 'style', 'vertical-align: top;');
     }
     return $full_out->render();
 }