Example #1
0
 /**
  * Load a Renderer or DataSource driver
  * 
  * @param string $className Name of the driver class
  * @access private
  * @return object The driver object or a PEAR_Error
  * @static
  */
 function &loadDriver($className)
 {
     if (!Structures_DataGrid::classExists($className)) {
         $fileName = str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
         $fileName = $className . '.php';
         if (!(include_once $fileName)) {
             if (!Structures_DataGrid::fileExists($fileName)) {
                 $msg = "unable to find package '{$className}' file '{$fileName}'";
             } else {
                 $msg = "unable to load driver class '{$className}' from file '{$fileName}'";
             }
             $error = PEAR::raiseError($msg);
             return $error;
         }
     }
     $driver =& new $className();
     return $driver;
 }