Changeset 3374

Show
Ignore:
Timestamp:
12/19/06 17:16:16 (5 years ago)
Author:
gregmac
Message:

Added freepbx_get_contexts() function to invoke module _contexts() hook functions, and return an associatve array with all valid contexts (minimually containing 'context', 'description', and 'module')

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/trunk/amp_conf/htdocs/admin/functions.inc.php

    r3373 r3374  
    21872187} 
    21882188 
     2189function freepbx_get_contexts() { 
     2190  $modules = module_getinfo(false, MODULE_STATUS_ENABLED); 
     2191   
     2192  $contexts = array(); 
     2193   
     2194  foreach ($modules as $modname => $mod) { 
     2195                $funct = strtolower($modname.'_contexts'); 
     2196    if (function_exists($funct)) { 
     2197      // call the  modulename_contexts() function 
     2198      $contextArray = $funct(); // returns array with 'context' and 'description' 
     2199      if (is_array($contextArray)) { 
     2200        foreach ($contextArray as $con) { 
     2201          if (isset($con['context'])) { 
     2202            if (!isset($con['description'])) { 
     2203              $con['description'] = $con['context']; 
     2204            } 
     2205            if (!isset($con['module'])) { 
     2206              $con['module'] = $modname; 
     2207            } 
     2208            $contexts[ $con['context'] ] = $con['description']; 
     2209          } 
     2210        } 
     2211      } 
     2212    } 
     2213  } 
     2214  return $contexts; 
     2215} 
     2216 
    21892217?>