public static function getDefaultSession() { if (!self::$_default) { $session = new self(); self::$_default = $session->getOID(); } return self::getSession(self::$_default); }
/** * Get the array of DEnum options from the database. * * @param bool $alphaSort * * @return array * * @since 1.0 * * @throws Alpha\Exception\AlphaException */ public function getOptions($alphaSort = false) { try { $options = new self(); $options->loadByAttribute('name', $this->name->getValue()); } catch (RecordNotFoundException $e) { throw new AlphaException('Failed to load DEnum ' . $this->name->getValue() . ', not found in database.'); } // now build an array of item indexes to be returned $count = 0; $this->options = array(); $tmp = new DEnumItem(); foreach ($tmp->loadItems($options->getOID()) as $DEnumItem) { $this->options[$DEnumItem->getID()] = $DEnumItem->getValue(); ++$count; } if ($alphaSort) { asort($this->options, SORT_STRING); } return $this->options; }