Changeset 5259

Show
Ignore:
Timestamp:
11/18/07 23:12:36 (6 years ago)
Author:
p_lindheimer
Message:

added timeconditions_check_destinations() for destination registry

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.4/timeconditions/functions.inc.php

    r2453 r5259  
    3737    break; 
    3838  } 
     39} 
     40 
     41function 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; 
    3978} 
    4079