| 1 |
<?php |
| 2 |
if( ! isset($wide_view) ) |
| 3 |
{ |
| 4 |
$wide_view = FALSE; |
| 5 |
} |
| 6 |
|
| 7 |
$this->hc_time->setNow(); |
| 8 |
$today = $this->hc_time->formatDate_Db(); |
| 9 |
|
| 10 |
/* CLASS */ |
| 11 |
$class = array(); |
| 12 |
$class[] = 'alert'; |
| 13 |
$class[] = 'alert-condensed'; |
| 14 |
|
| 15 |
if( $sh->user_id ) |
| 16 |
{ |
| 17 |
$class[] = ( $sh->status == SHIFT_MODEL::STATUS_ACTIVE ) ? 'alert-success' : 'alert-warning'; |
| 18 |
} |
| 19 |
else |
| 20 |
{ |
| 21 |
$class[] = 'alert-danger'; |
| 22 |
} |
| 23 |
$class = join( ' ', $class ); |
| 24 |
|
| 25 |
$trade_label = ''; |
| 26 |
$trade_icon = ''; |
| 27 |
if( $sh->user_id && $sh->has_trade && $this->hc_modules->exists('shift_trades') ) |
| 28 |
{ |
| 29 |
$trade_label = lang('trade_request'); |
| 30 |
$trade_icon = '<i class="fa fa-exchange"></i>'; |
| 31 |
} |
| 32 |
|
| 33 |
/* TITLES */ |
| 34 |
$title = array(); |
| 35 |
|
| 36 |
/* TITLE - TIME */ |
| 37 |
if( in_array('time', $titles) ) |
| 38 |
{ |
| 39 |
$time_key = $sh->start . '-' . $sh->end; |
| 40 |
$time_title = isset($shift_template_titles[$time_key]) ? $shift_template_titles[$time_key] : $this->hc_time->formatTimeOfDay($sh->start) . ' - ' . $this->hc_time->formatTimeOfDay($sh->end); |
| 41 |
// $time_title = '<i class="fa fa-clock-o"></i> ' . $time_title; |
| 42 |
$time_title = $time_title; |
| 43 |
$title['time'] = $time_title; |
| 44 |
} |
| 45 |
|
| 46 |
/* TITLE - LOCATION */ |
| 47 |
if( in_array('location', $titles) ) |
| 48 |
{ |
| 49 |
$icon = ( $trade_icon && (! in_array('staff', $titles)) ) ? $trade_icon : '<i class="fa fa-home"></i>'; |
| 50 |
$title['location'] = $icon . ' ' . $sh->location_name; |
| 51 |
} |
| 52 |
|
| 53 |
/* TITLE - STAFF */ |
| 54 |
if( in_array('staff', $titles) ) |
| 55 |
{ |
| 56 |
/* TITLE - STAFF */ |
| 57 |
$icon = $trade_icon ? $trade_icon : '<i class="fa fa-user"></i>'; |
| 58 |
if( $sh->user_id && isset($staffs[$sh->user_id]) ) |
| 59 |
{ |
| 60 |
$title['staff'] = $icon . ' ' . $staffs[$sh->user_id]->full_name(); |
| 61 |
} |
| 62 |
elseif( count($titles) <= 1 ) |
| 63 |
{ |
| 64 |
$title['staff'] = $icon . ' ' . '________'; |
| 65 |
} |
| 66 |
else |
| 67 |
{ |
| 68 |
$title['staff'] = ''; |
| 69 |
} |
| 70 |
} |
| 71 |
|
| 72 |
$final_title = array(); |
| 73 |
$final_title[] = '<ul class="list-unstyled">'; |
| 74 |
|
| 75 |
if( isset($title['location']) && isset($title['staff']) ) |
| 76 |
{ |
| 77 |
list( $this_title_title, $this_title_icon ) = Hc_lib::parse_icon( $title['location'] ); |
| 78 |
$final_title[] = '<li class="squeeze-in" title="' . $this_title_title . '">'; |
| 79 |
$final_title[] = $title['location']; |
| 80 |
$final_title[] = '</li>'; |
| 81 |
} |
| 82 |
|
| 83 |
if( $wide_view && ( isset($title['staff']) OR isset($title['location']) ) ) |
| 84 |
{ |
| 85 |
$final_title[] = '<li>'; |
| 86 |
$final_title[] = '<ul class="list-inline">'; |
| 87 |
|
| 88 |
list( $this_title_title, $this_title_icon ) = Hc_lib::parse_icon( $title['time'] ); |
| 89 |
$final_title[] = '<li class="squeeze-in pull-left" style="width: 50%;" title="' . $this_title_title . '">'; |
| 90 |
$final_title[] = $title['time']; |
| 91 |
$final_title[] = '</li>'; |
| 92 |
|
| 93 |
$this_title = ' '; |
| 94 |
if( isset($title['staff']) ) |
| 95 |
$this_title = $title['staff']; |
| 96 |
elseif( isset($title['location']) ) |
| 97 |
$this_title = $title['location']; |
| 98 |
list( $this_title_title, $this_title_icon ) = Hc_lib::parse_icon( $this_title ); |
| 99 |
if( $trade_label ) |
| 100 |
$this_title_title = $trade_label; |
| 101 |
$final_title[] = '<li class="squeeze-in pull-right" style="width: 50%;" title="' . $this_title_title . '">'; |
| 102 |
$final_title[] = $this_title; |
| 103 |
$final_title[] = '</li>'; |
| 104 |
|
| 105 |
|
| 106 |
$final_title[] = '</ul>'; |
| 107 |
$final_title[] = '<div class="clearfix"></div>'; |
| 108 |
$final_title[] = '</li>'; |
| 109 |
} |
| 110 |
else |
| 111 |
{ |
| 112 |
if( isset($title['time']) ) |
| 113 |
{ |
| 114 |
$final_title[] = '<li>'; |
| 115 |
$final_title[] = $title['time']; |
| 116 |
$final_title[] = '</li>'; |
| 117 |
} |
| 118 |
if( isset($title['staff']) ) |
| 119 |
{ |
| 120 |
$final_title[] = '<li>'; |
| 121 |
$final_title[] = $title['staff']; |
| 122 |
$final_title[] = '</li>'; |
| 123 |
} |
| 124 |
elseif( isset($title['location']) ) |
| 125 |
{ |
| 126 |
$final_title[] = '<li>'; |
| 127 |
$final_title[] = $title['location']; |
| 128 |
$final_title[] = '</li>'; |
| 129 |
} |
| 130 |
} |
| 131 |
$final_title[] = '</ul>'; |
| 132 |
|
| 133 |
$title = join( '', $final_title ); |
| 134 |
?> |
| 135 |
<div class="<?php echo $class; ?>"> |
| 136 |
<?php echo $title; ?> |
| 137 |
|
| 138 |
<?php |
| 139 |
if( |
| 140 |
($today <= $sh->date) && |
| 141 |
$this->auth && |
| 142 |
$this->auth->user() |
| 143 |
) : |
| 144 |
?> |
| 145 |
<?php |
| 146 |
if( |
| 147 |
( |
| 148 |
(! $sh->user_id) && |
| 149 |
$this->app_conf->get('staff_pick_shifts') |
| 150 |
) |
| 151 |
OR |
| 152 |
( |
| 153 |
$sh->has_trade && |
| 154 |
$this->hc_modules->exists('shift_trades') |
| 155 |
) |
| 156 |
) : |
| 157 |
?> |
| 158 |
<a class="btn btn-default btn-sm" href="<?php echo ci_site_url( array('staff/shifts', 'pickup', $sh->id) ); ?>"> |
| 159 |
<i class="fa fa-check text-success"></i> <?php echo lang('shift_pick_up'); ?> |
| 160 |
</a> |
| 161 |
<?php endif; ?> |
| 162 |
|
| 163 |
<?php endif; ?> |
| 164 |
</div> |