Ejemplo n.º 1
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;
 }
Ejemplo n.º 2
0
 function title($model, $vlevel = HC_PRESENTER::VIEW_HTML)
 {
     $return = array();
     switch ($vlevel) {
         case HC_PRESENTER::VIEW_HTML:
         case HC_PRESENTER::VIEW_HTML_ICON:
             $icon = HC_Html::icon(HC_App::icon_for('conflict'));
             $icon->add_attr('class', 'text-danger');
             $span = HC_Html_Factory::element('span')->add_attr('title', $model->present_title(HC_PRESENTER::VIEW_TEXT))->add_child($icon)->add_child($model->present_title(HC_PRESENTER::VIEW_TEXT));
             $return[] = $span;
             break;
         case HC_PRESENTER::VIEW_TEXT:
             $return[] = HCM::__('Conflict');
             $return[] = ': ';
             $return[] = $model->type;
             $return[] = ': ';
             $return[] = $model->details;
             break;
         case HC_PRESENTER::VIEW_RAW:
             $return[] = $model->type;
             $return[] = ': ';
             $return[] = $model->details;
             break;
     }
     $return = join('', $return);
     return $return;
 }
Ejemplo n.º 3
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;
 }
Ejemplo n.º 4
0
 private function _time($value, $vlevel = HC_PRESENTER::VIEW_HTML)
 {
     $return = array();
     switch ($vlevel) {
         case HC_PRESENTER::VIEW_HTML:
             $return[] = HC_Html::icon(HC_App::icon_for('time'));
             break;
         case HC_PRESENTER::VIEW_TEXT:
             $return[] = HCM::__('Time');
             $return[] = ': ';
             break;
     }
     $t = HC_Lib::time();
     $t->setTimestamp($value);
     $return[] = $t->formatTime();
     $return = join('', $return);
     return $return;
 }
Ejemplo n.º 5
0
 function label($model, $vlevel = HC_PRESENTER::VIEW_HTML)
 {
     $return = '';
     switch ($vlevel) {
         case HC_PRESENTER::VIEW_HTML:
         case HC_PRESENTER::VIEW_HTML_ICON:
             $return = HC_Html::icon(HC_App::icon_for('location'));
             $color = $model->present_color();
             $return->add_attr('style', 'color: ' . $color . ';');
             $return->add_attr('title', $model->present_title(HC_PRESENTER::VIEW_RAW));
             // $return->add_attr('style', 'border: blue 1px solid;');
             $return = NULL;
             break;
         case HC_PRESENTER::VIEW_TEXT:
             $return = HCM::__('Location');
             break;
     }
     return $return;
 }
Ejemplo n.º 6
0
    $icon = HC_Html::icon('check-circle');
    $icon->add_attr('class', 'text-success');
    $item->add_child($icon);
    $title = $count_fail + $count_ok > 1 ? $count_ok : HCM::__('OK');
    $item->add_child($title);
    $item->add_attr('title', HCM::__('OK'));
    if (!$count_fail) {
        $out->add_item($item);
    }
}
$t = HC_Lib::time();
/* failed */
if ($count_fail) {
    /* link to detailed conflicts view */
    $item = HC_Html_Factory::widget('titled', 'span')->add_attr('class', array('alert', 'alert-danger'))->add_attr('class', array('alert-condensed'));
    $icon = HC_Html::icon(HC_App::icon_for('conflict'));
    $icon->add_attr('class', 'text-danger');
    $item->add_child($icon);
    $title = sprintf(HCM::_n('%d Conflict', '%d Conflicts', $count_fail), $count_fail);
    $item->add_child($title);
    $item->add_child(' ')->add_child(HC_Html_Factory::element('b')->add_attr('class', 'caret'));
    /* red border for wrap */
    if ($wrap) {
        $wrap->add_attr('style', 'border-width: 2px; border-color: red;');
    }
    /* now add detailed view */
    // _print_r( $conflicts );
    $conflict_list = HC_Html_Factory::widget('list')->add_attr('class', array('list-unstyled'))->add_attr('class', array('list-separated'));
    foreach ($conflicts as $date => $date_conflicts) {
        if (!$date_conflicts) {
            continue;
Ejemplo n.º 7
0
<?php

if (!(count($all_staffs) > 1 or count($all_locations) > 1)) {
    return;
}
$options = array('none' => HC_Html_Factory::element('a')->add_attr('href', $rootlink->url($tab, array('by' => NULL)))->add_child(HC_Html::icon('ellipsis-v'))->add_attr('title', HCM::__('No Grouping')));
if (count($all_staffs) > 1) {
    $options['staff'] = HC_Html_Factory::element('a')->add_attr('href', $rootlink->url($tab, array('by' => 'staff')))->add_child(HC_Html::icon(HC_App::icon_for('user')))->add_attr('title', HCM::__('Group By Staff'));
}
if (count($all_locations) > 1) {
    $options['location'] = HC_Html_Factory::element('a')->add_attr('href', $rootlink->url($tab, array('by' => 'location')))->add_child(HC_Html::icon(HC_App::icon_for('location')))->add_attr('title', HCM::__('Group By Location'));
}
$state_by = $state['by'] ? $state['by'] : 'none';
$nav = HC_Html_Factory::element('div')->add_attr('class', 'btn-group');
foreach ($options as $key => $option) {
    $option->add_attr('class', array('btn'))->add_attr('class', array('btn-sm'));
    if ($key == $state_by) {
        $option->add_attr('class', array('btn-archive'));
    } else {
        $option->add_attr('class', array('btn-default'));
    }
    $nav->add_child($option);
}
echo $nav->render();
Ejemplo n.º 8
0
         $pname_view[] = '::';
     }
 }
 if ($pname == 'id') {
     /* translators: this is an entry in the list of changes history of an object */
     $pname_view[] = HCM::__('Object Created');
 } else {
     $pname_view[] = $this_object->present_property_name($pname, HC_PRESENTER::VIEW_TEXT);
 }
 $pname_view = join('', $pname_view);
 $change_view = '';
 if ($pname == 'id') {
     switch ($this_class) {
         case 'note':
             $pname_view = '';
             $change_view = HC_Html_Factory::element('em')->add_child(HC_Html::icon(HC_App::icon_for('comment')))->add_child($this_object->present_content());
             break;
         default:
             if ($status_as_created !== NULL) {
                 $this_object->status = $status_as_created;
                 $change_view = $this_object->present_status();
             }
             break;
     }
 } else {
     if (is_object($this_object->{$pname})) {
         $pobject = HC_App::model($pname);
         $old_view = '';
         $new_view = '';
         if ($e->old) {
             $pobject->get_by_id($e->old);
Ejemplo n.º 9
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;
 }
Ejemplo n.º 10
0
<?php

$label = NULL;
if ($entries) {
    $label = array();
    $icon = HC_Html::icon(HC_App::icon_for('conflict'))->add_attr('class', 'text-danger');
    $label[] = $icon;
    $label[] = sprintf(HCM::_n('%d Conflict', '%d Conflicts', count($entries)), count($entries));
    $label = join('', $label);
    $label = HC_Html_Factory::widget('titled', 'span')->add_attr('class', array('alert', 'alert-danger'))->add_attr('class', array('alert-condensed'))->add_attr('class', array('display-block'))->add_child($label);
}
if ($label) {
    $out = HC_Html_Factory::widget('container')->add_item($label);
    echo $out;
}
Ejemplo n.º 11
0
<?php

defined('BASEPATH') or exit('No direct script access allowed');
$CI =& ci_get_instance();
$config = array();
$config = array(USER_HC_MODEL::LEVEL_ADMIN . '/calendar' => array('title' => HCM::__('Full Schedule'), 'icon' => 'calendar', 'link' => 'list'), USER_HC_MODEL::LEVEL_ADMIN . '/calendarme' => array('title' => HCM::__('My Schedule'), 'icon' => 'calendar-o', 'link' => 'listme'), USER_HC_MODEL::LEVEL_ADMIN . '/timeoffs' => array('title' => HCM::__('Timeoff Requests'), 'icon' => HC_Html::icon(HC_App::icon_for('timeoff')), 'link' => 'list-toff'), USER_HC_MODEL::LEVEL_ADMIN . '/todo' => array('title' => HCM::__('Todo'), 'icon' => 'list-ol', 'link' => 'admin/todo'), USER_HC_MODEL::LEVEL_ADMIN . '/users' => array('title' => HCM::__('Users'), 'icon' => 'user', 'link' => 'admin/users'), USER_HC_MODEL::LEVEL_ADMIN . '/conf' => array('title' => HCM::__('Configuration'), 'icon' => 'cog', 'link' => '', 'order' => 100), USER_HC_MODEL::LEVEL_ADMIN . '/conf/locations' => array('title' => HCM::__('Locations'), 'icon' => 'home', 'link' => 'admin/locations'), USER_HC_MODEL::LEVEL_ADMIN . '/conf/settings' => array('title' => HCM::__('Settings'), 'icon' => 'cogs', 'link' => 'conf/admin', 'order' => 100));
$config[USER_HC_MODEL::LEVEL_MANAGER . '/calendar'] = array('title' => HCM::__('Full Schedule'), 'icon' => 'calendar', 'link' => 'list');
$config[USER_HC_MODEL::LEVEL_MANAGER . '/calendarme'] = array('title' => HCM::__('My Schedule'), 'icon' => 'calendar-o', 'link' => 'listme');
$config[USER_HC_MODEL::LEVEL_MANAGER . '/timeoffs'] = array('title' => HCM::__('Timeoff Requests'), 'icon' => HC_Html::icon(HC_App::icon_for('timeoff')), 'link' => 'list-toff');
$config[USER_HC_MODEL::LEVEL_STAFF . '/calendarme'] = array('title' => HCM::__('My Schedule'), 'icon' => 'calendar-o', 'link' => 'listme');
$config[USER_HC_MODEL::LEVEL_STAFF . '/timeoffs'] = array('title' => HCM::__('Timeoff Requests'), 'icon' => HC_Html::icon(HC_App::icon_for('timeoff')), 'link' => 'list-toff');
$app_conf = HC_App::app_conf();
$wall_schedule_display = $app_conf->get('wall:schedule_display');
if ($wall_schedule_display <= USER_HC_MODEL::LEVEL_STAFF) {
    $config[USER_HC_MODEL::LEVEL_STAFF . '/calendar'] = array('title' => HCM::__('Full Schedule'), 'icon' => 'calendar', 'link' => 'list');
}
$promo_url = $CI->config->item('nts_promo_url');
if ($promo_url) {
    $promo_title = $CI->config->item('nts_promo_title');
    $config[USER_HC_MODEL::LEVEL_ADMIN . '/promo'] = array('title' => $promo_title, 'link' => $promo_url, 'external' => TRUE, 'order' => 200);
}
/* End of file menu.php */
/* Location: ./application/config/menu.php */
Ejemplo n.º 12
0
<?php

if (!count($entries)) {
    return;
}
$t = HC_Lib::time();
$list = HC_Html_Factory::widget('list')->add_attr('class', array('list-unstyled'));
foreach ($entries as $e) {
    $list->add_item(HC_Html_Factory::element('em')->add_attr('title', strip_tags($e->content))->add_child(HC_Html::icon(HC_App::icon_for('comment')))->add_child($e->content));
}
echo $list->render();
Ejemplo n.º 13
0
        }
        $list->add_item($item);
    }
    if ($count['timeoff_active']) {
        $title_title = $shift->set('type', $shift->_const('TYPE_TIMEOFF'))->set('status', $shift->_const('STATUS_ACTIVE'))->present_status(HC_PRESENTER::VIEW_RAW);
        $title_class = $shift->set('type', $shift->_const('TYPE_TIMEOFF'))->set('status', $shift->_const('STATUS_ACTIVE'))->present_status_class();
        $item = HC_Html_Factory::element('span')->add_attr('class', 'display-block')->add_attr('class', 'alert')->add_attr('class', 'alert-condensed2')->add_attr('class', 'text-smaller2')->add_attr('title', $title_title)->add_child(HC_Html::icon(HC_App::icon_for('timeoff')))->add_child($count['timeoff_active'])->add_child(' ')->add_child(HC_Html::icon(HC_App::icon_for('time')))->add_child($t->formatPeriod($duration['timeoff_active'], 'hour'));
        foreach ($title_class as $tc) {
            $item->add_attr('class', 'alert-' . $tc);
        }
        $list->add_item($item);
    }
    if ($count['timeoff_draft']) {
        $title_title = $shift->set('type', $shift->_const('TYPE_TIMEOFF'))->set('status', $shift->_const('STATUS_DRAFT'))->present_status(HC_PRESENTER::VIEW_RAW);
        $title_class = $shift->set('type', $shift->_const('TYPE_TIMEOFF'))->set('status', $shift->_const('STATUS_DRAFT'))->present_status_class();
        $item = HC_Html_Factory::element('span')->add_attr('class', 'display-block')->add_attr('class', 'alert')->add_attr('class', 'alert-condensed2')->add_attr('class', 'text-smaller2')->add_attr('title', $title_title)->add_child(HC_Html::icon(HC_App::icon_for('timeoff')))->add_child($count['timeoff_draft'])->add_child(' ')->add_child(HC_Html::icon(HC_App::icon_for('time')))->add_child($t->formatPeriod($duration['timeoff_draft'], 'hour'));
        foreach ($title_class as $tc) {
            $item->add_attr('class', 'alert-' . $tc);
        }
        $list->add_item($item);
    }
} else {
    if ($count['shift_active'] + $count['shift_draft']) {
        $title_title = $shift->set('type', $shift->_const('TYPE_SHIFT'))->set('status', $shift->_const('STATUS_ACTIVE'))->present_status(HC_PRESENTER::VIEW_RAW);
        $title_class = $shift->set('type', $shift->_const('TYPE_SHIFT'))->set('status', $shift->_const('STATUS_ACTIVE'))->present_status_class();
        $item = HC_Html_Factory::element('span')->add_attr('class', 'display-block')->add_attr('class', 'alert')->add_attr('class', 'alert-condensed2')->add_attr('class', 'text-smaller2')->add_attr('title', $title_title)->add_child($t->formatPeriodExtraShort($duration['shift_active'] + $duration['shift_draft'], 'hour'));
        foreach ($title_class as $tc) {
            $item->add_attr('class', 'alert-' . $tc);
        }
        $list->add_item($item);
    }
Ejemplo n.º 14
0
<?php

$temp_shift = HC_App::model('shift');
/* create buttons */
$create_btns = array();
$create_btns['shift'] = HC_Html_Factory::element('a')->add_attr('class', array('btn'))->add_attr('class', array('btn-success'))->add_attr('href', HC_Lib::link('shifts/add/index')->url(array('type' => $temp_shift->_const('TYPE_SHIFT'))))->add_child(HC_Html::icon(HC_App::icon_for('shift')))->add_attr('title', sprintf(HCM::_n('Add New Shift', 'Add %d New Shifts', 1), 1));
$create_btns['timeoff'] = HC_Html_Factory::element('a')->add_attr('class', array('btn'))->add_attr('class', array('btn-warning-o'))->add_attr('href', HC_Lib::link('shifts/add/index')->url(array('type' => $temp_shift->_const('TYPE_TIMEOFF'))))->add_child(HC_Html::icon(HC_App::icon_for('timeoff')))->add_child(sprintf(HCM::_n('Request New Timeoff', 'Request %d New Timeoffs', 1), 1))->add_attr('title', sprintf(HCM::_n('Request New Timeoff', 'Request %d New Timeoffs', 1), 1));
$btns = HC_Html_Factory::widget('list')->add_attr('class', 'list-inline')->add_attr('class', 'list-separated');
$this_user_id = $this->auth->user()->id;
$acl = HC_App::acl();
$test_shift = HC_App::model('shift');
$test_shift->user_id = $this_user_id;
$add_btns = array();
if (isset($fix) && isset($fix['type']) && $fix['type'] && is_array($fix['type']) && count($fix['type']) == 1) {
    switch ($fix['type'][0]) {
        case $test_shift->_const('TYPE_TIMEOFF'):
            $test_shift->type = $fix['type'][0];
            if ($acl->set_object($test_shift)->can('validate')) {
                $add_btns[] = $create_btns['timeoff'];
            }
            break;
    }
} else {
    /*
    	$test_shift->type = $test_shift->_const('TYPE_SHIFT');
    	if( $acl->set_object($test_shift)->can('validate') ){
    		$add_btns[] = $create_btns['shift'];
    	}
    
    	$test_shift->type = $test_shift->_const('TYPE_TIMEOFF');
    	if( $acl->set_object($test_shift)->can('validate') ){