Changeset 842

Show
Ignore:
Timestamp:
01/06/06 16:45:19 (7 years ago)
Author:
rcourtna
Message:

yeehaa, a working amp module. Conferences creates simple meetme rooms, and is a good demonstration of how an AMP module should look.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/AMP/amp_conf/bin/retrieve_conf

    r827 r842  
    206206} 
    207207 
     208// create an object of the extensions class 
    208209require_once($amp_conf['AMPWEBROOT']."/admin/extensions.class.php"); 
    209210$ext = new extensions; 
    210211 
    211 function generateConf($modules) { 
    212   global $ext; 
    213   $engine = "asterisk"; 
    214   foreach($modules as $module) { 
    215     $funcname = $module."_get_config"; 
    216     if (function_exists($funcname)) {  
    217       $funcname($engine); 
    218       /*$config = $funcname($engine);   
    219       foreach ($config as $file=>$contents) {  
    220         echo $file; 
    221       }*/ 
    222     } 
    223   } 
    224   echo $ext->generateConf(); 
    225 
    226  
    227  
    228 generateConf($active_modules);  
    229  
     212// create objects for any module classes 
     213// currently only 1 class can be declared per module, not sure if that will be an issue 
     214foreach($active_modules as $active_module) {  
     215  $classname = $active_module."_conf"; 
     216  if(class_exists($classname)) { 
     217    ${$classname} = new $classname; 
     218  } 
     219
     220 
     221 
     222// run all of the *_get_config functions, which will populate the appropriate objects 
     223$engine = "asterisk"; 
     224foreach($active_modules as $module) { 
     225  $funcname = $module."_get_config"; 
     226  if (function_exists($funcname)) {  
     227    $funcname($engine); 
     228  } 
     229
     230 
     231// extensions_additional.conf 
     232echo $ext->get_filename(); 
     233echo $ext->generateConf(); 
     234 
     235 
     236// now we write out our conf files for modules 
     237// check for any objects for each of the active modules 
     238foreach($active_modules as $active_module) {  
     239  $classname = $active_module."_conf"; 
     240  if(class_exists($classname) && get_class(${$classname}) !== false) { 
     241    echo ${$classname}->get_filename(); 
     242    echo ${$classname}->generateConf(); 
     243  } 
     244
    230245 
    231246 
  • trunk/AMP/amp_conf/htdocs/admin/extensions.class.php

    r841 r842  
    1414   
    1515  var $_sorted; 
     16   
     17  /** The filename to write this configuration to 
     18  */ 
     19  function get_filename() { 
     20    return "extensions_additional.conf"; 
     21  } 
    1622   
    1723  /** Add an entry to the extensions file 
  • trunk/AMP/amp_conf/htdocs/admin/modules/core/functions.inc.php

    r835 r842  
    16561656/* end page.routing.php functions */ 
    16571657 
    1658  
    1659  
    16601658?> 
  • trunk/AMP/amp_conf/htdocs/admin/modules/ringgroups/functions.inc.php

    r840 r842  
    1818} 
    1919 
    20 /*  Generates dialplan for "core" components (extensions & inbound routing) 
     20/*  Generates dialplan for ringgroups 
    2121  We call this with retrieve_conf 
    2222*/ 
  • trunk/AMP/amp_conf/htdocs/admin/page.modules.php

    r839 r842  
    22 
    33// executes the SQL found in a module install.sql or uninstall.sql 
    4 function runModuleSQL($modDir,$type){ 
     4function runModuleSQL($moddir,$type){ 
    55  global $db; 
    66  if (is_file("modules/{$moddir}/{$type}.sql")) { 
    77    // run sql script 
    8     $fd = fopen("modules/{$moddir}/{$type}.sql"); 
     8    $fd = fopen("modules/{$moddir}/{$type}.sql","r"); 
    99    while (!feof($fd)) { 
    1010      $data .= fread($fd, 1024);