| | 39 | } |
|---|
| | 40 | |
|---|
| | 41 | function timeconditions_check_destinations($dest=true) { |
|---|
| | 42 | global $active_modules; |
|---|
| | 43 | |
|---|
| | 44 | $destlist = array(); |
|---|
| | 45 | if (is_array($dest) && empty($dest)) { |
|---|
| | 46 | return $destlist; |
|---|
| | 47 | } |
|---|
| | 48 | $sql = "SELECT timeconditions_id, displayname, truegoto, falsegoto FROM timeconditions "; |
|---|
| | 49 | if ($dest !== true) { |
|---|
| | 50 | $sql .= "WHERE (truegoto in ('".implode("','",$dest)."') ) OR (falsegoto in ('".implode("','",$dest)."') )"; |
|---|
| | 51 | } |
|---|
| | 52 | $results = sql($sql,"getAll",DB_FETCHMODE_ASSOC); |
|---|
| | 53 | |
|---|
| | 54 | $type = isset($active_modules['timeconditions']['type'])?$active_modules['timeconditions']['type']:'setup'; |
|---|
| | 55 | |
|---|
| | 56 | foreach ($results as $result) { |
|---|
| | 57 | $thisdest = $result['truegoto']; |
|---|
| | 58 | $thisid = $result['timeconditions_id']; |
|---|
| | 59 | $description = 'Timecondition: '.$result['displayname']; |
|---|
| | 60 | $thisurl = 'config.php?display=timeconditions&itemid='.urlencode($thisid); |
|---|
| | 61 | if ($dest === true || $dest = $thisdest) { |
|---|
| | 62 | $destlist[] = array( |
|---|
| | 63 | 'dest' => $thisdest, |
|---|
| | 64 | 'description' => $description, |
|---|
| | 65 | 'edit_url' => $thisurl, |
|---|
| | 66 | ); |
|---|
| | 67 | } |
|---|
| | 68 | $thisdest = $result['falsegoto']; |
|---|
| | 69 | if ($dest === true || $dest = $thisdest) { |
|---|
| | 70 | $destlist[] = array( |
|---|
| | 71 | 'dest' => $thisdest, |
|---|
| | 72 | 'description' => $description, |
|---|
| | 73 | 'edit_url' => $thisurl, |
|---|
| | 74 | ); |
|---|
| | 75 | } |
|---|
| | 76 | } |
|---|
| | 77 | return $destlist; |
|---|