Skip to content

Commit

Permalink
allow to hide events from the schedule without deleting them.
Browse files Browse the repository at this point in the history
  • Loading branch information
x42 committed Oct 24, 2013
1 parent 3798d13 commit 120c70d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/programdb.php
Expand Up @@ -208,7 +208,7 @@ function fetch_selectlist($db, $table='user', $order='ORDER BY id') {
if ($table=='durations')
return array('' => '-unset-', '10' => '10 mins', '20' => '20 mins', '40' => '40 mins', '60' => '1 hour', '80' => '80 mins', '120' => '2 hours', '160' => '2 3/4 hours', '180' => '3 hours');
if ($table=='status')
return array('1' => 'confirmed', '0' => 'cancelled');
return array('2' => 'hidden', '1' => 'confirmed', '0' => 'cancelled');

$rv = array('0' => '-unset-');
$q='SELECT id, name from '.$table.' '.$order.';';
Expand Down Expand Up @@ -811,6 +811,7 @@ function query_out($db, $q, $details=true, $type=true, $location=true, $day=fals

foreach ($result as $r) {
if (substr($r['title'],0,7) == 'COFFEE ') continue; # XXX
if ($r['status'] == 2) continue; # hide hidden entries
if ($day) {
if ($r['day'] == 5) { ## every day
if (!$print) {echo 'every day - all day  ';}
Expand Down Expand Up @@ -1526,7 +1527,7 @@ function table_program($db, $day, $print=false) {
$stmt=$res->fetchAll();
foreach ($stmt as $r) {
if (empty($r['starttime'])) continue;
if ($r['status']==0) continue; # skip cancelled
if ($r['status']!=1) continue; # skip cancelled and hidden
$table[$i][$r['starttime']]=$r;
}
$i++;
Expand Down Expand Up @@ -1753,7 +1754,7 @@ function export_progam_sv($db, $sep="\t") {
$rv.= '"'.iso8601($r).'"'.$sep;
$rv.= '"'.iso8601($r,false).'"'.$sep;
$rv.= '"'.($a_types[$r['type']]).'"'.$sep;
$rv.= '"'.($r['status']&1?'confirmed':'cancelled').'"'.$sep;
$rv.= '"'.($r['status']==1?'confirmed':($r['status']==2?'hidden':'cancelled')).'"'.$sep;
$rv.= '"'.($a_locations[$r['location_id']]).'"'.$sep;
$rv.= '"'.trim($r['title']).'"'.$sep;
$rv.= '"'.
Expand Down Expand Up @@ -1834,7 +1835,7 @@ function vcal_program($db,$version='2.0',$raw=true) {
foreach ($result as $r) {
if (empty($r['starttime'])) continue;
if (empty($r['duration']) || $r['duration'] == 0 || strstr($r['duration'], ':')) continue;
if ($r['status']==0) continue; // XXX cancelled
if ($r['status']!=1) continue; // XXX cancelled, hidden

echo 'BEGIN:VEVENT'."\r\n";
echo 'UID:lac'.LACY.'-'.$r['id'].'@'.$config['organizaion']."\r\n";
Expand Down

0 comments on commit 120c70d

Please sign in to comment.