/** * Do the real exporting * * @return string The JSON dump of the items and categories * * @throws AppExporterException * * @since 2.0 */ public function export() { if (!($this->_application = $this->app->zoo->getApplication())) { throw new AppExporterException('No application selected.'); } // export frontpage $frontpage = $this->app->object->create('Category'); $frontpage->name = 'Root'; $frontpage->alias = '_root'; $frontpage->description = $this->_application->description; // export categories $this->_categories = $this->_application->getCategories(); $this->_categories[0] = $frontpage; foreach ($this->_categories as $category) { $this->_addZooCategory($category); } // export items $this->_comment_table = $this->app->table->comment; $item_table = $this->app->table->item; foreach ($this->_application->getTypes() as $type) { foreach ($item_table->getByType($type->id, $this->_application->id) as $key => $item) { $this->_addZooItem($item, $type); $item_table->unsetObject($key); } } return parent::export(); }