/** * Public function that creates a single instance */ public static function getInstance() { if (!isset(self::$_instance)) { self::$_instance = new self(); } return self::$_instance; }
/** * This function provides JSON container objects instead of standard * HTML (XML) output. Function takes all the parameters from $_REQUEST. */ private function json_ContainerList() { $manager = GalleryContainerManager::getInstance(); $items = $manager->getItems($manager->getFieldNames(), array(), array('name')); $result = array('error' => false, 'error_message' => '', 'items' => array()); if (count($items) > 0) { foreach ($items as $item) { $result['items'][] = array('id' => $item->id, 'name' => $item->name, 'description' => $item->description); } } else { $result['error'] = true; $result['error_message'] = $this->getLanguageConstant('message_json_error_object'); } print json_encode($result); }