Logo Search packages:      
Sourcecode: nag2 version File versions  Download package

& Nag_Driver::singleton ( tasklist = '',
driver = null,
params = null 
) [inherited]

Attempts to return a reference to a concrete Nag_Driver instance based on $driver. It will only create a new instance if no Nag_Driver instance with the same parameters currently exists.

This should be used if multiple storage sources are required.

This method must be invoked as: $var = &Nag_Driver::singleton()

Parameters:
string$tasklistThe name of the tasklist to load.
string$driverThe type of concrete Nag_Driver subclass to return. The is based on the storage driver ($driver). The code is dynamically included.
array$params(optional) A hash containing any additional configuration or connection parameters a subclass might need.
Returns:
mixed The created concrete Nag_Driver instance, or false on error.

Definition at line 276 of file Driver.php.

References Nag_Driver::factory().

Referenced by add(), Nag_Driver_datatree::add(), Nag_Driver_datatree::delete(), Nag::listAlarms(), Nag::listTasks(), modify(), Nag_Driver_datatree::modify(), Nag_Driver_datatree::move(), Nag_Driver_datatree::Nag_Driver_datatree(), and Nag_Driver::toiCalendar().

    {
        static $instances;

        if (is_null($driver)) {
            $driver = $GLOBALS['conf']['storage']['driver'];
        }

        if (is_null($params)) {
            $params = Horde::getDriverConfig('storage', $driver);
        }

        if (!isset($instances)) {
            $instances = array();
        }

        $signature = serialize(array($tasklist, $driver, $params));
        if (!isset($instances[$signature])) {
            $instances[$signature] = &Nag_Driver::factory($tasklist, $driver, $params);
        }

        return $instances[$signature];
    }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index