Kronolith_FreeBusy_View::singleton PHP Method

singleton() public static method

This method must be invoked as: $var = &Kronolith_FreeBusy_View::singleton()
public static singleton ( string $view ) : mixed
$view string The type of concrete Kronolith_FreeBusy_View subclass to return.
return mixed The created concrete Kronolith_FreeBusy_View instance, or false on an error.
    public static function &singleton($view)
    {
        static $instances = array();
        if (!isset($instances[$view])) {
            $instances[$view] = Kronolith_FreeBusy_View::factory($view);
        }
        return $instances[$view];
    }

Usage Example

示例#1
0
} else {
    $allResources = array();
}
// Get the current Free/Busy view; default to the 'day' view if none specified.
$view = Horde_Util::getFormData('view', 'Day');
// Pre-format our delete image/link.
$delimg = Horde::img('delete.png', _("Remove Attendee"));
$ident = $injector->getInstance('Horde_Core_Factory_Identity')->create();
$identities = $ident->getAll('id');
$vars = Horde_Variables::getDefaultVariables();
$tabs = new Horde_Core_Ui_Tabs(null, $vars);
$tabs->addTab(_("Day"), new Horde_Url('javascript:switchView(\'Day\')'), 'Day');
$tabs->addTab(_("Work Week"), new Horde_Url('javascript:switchView(\'Workweek\')'), 'Workweek');
$tabs->addTab(_("Week"), new Horde_Url('javascript:switchView(\'Week\')'), 'Week');
$tabs->addTab(_("Month"), new Horde_Url('javascript:switchView(\'Month\')'), 'Month');
$attendee_view =& Kronolith_FreeBusy_View::singleton($view);
// Add the creator as a required attendee in the Free/Busy display
$cal = @unserialize($prefs->getValue('fb_cals'));
if (!is_array($cal)) {
    $cal = null;
}
// If the free/busy calendars preference is empty, default to the user's
// default_share preference, and if that's empty, to their username.
if (!$cal) {
    $cal = 'internal_' . $prefs->getValue('default_share');
    if (!$cal) {
        $cal = 'internal_' . $GLOBALS['registry']->getAuth();
    }
    $cal = array($cal);
}
try {
All Usage Examples Of Kronolith_FreeBusy_View::singleton