/** * Test * * @return void */ public function testRender() { Registry::get('Application')->getRequest()->getUri()->setPath($this->documentChildren->getEditUrl()); $collection = new DocumentCollection(); $collection->load(0); $array = array_merge(array($collection), array('test' => 'value')); $this->assertTrue(strlen($this->object->render($array)) > 0); }
/** * Initialize Document Controller * * @return void */ public function init() { $documents = new DocumentCollection(); $documents->load(0); $this->layout()->setVariable('treeview', Component\TreeView::render(array($documents))); $routes = array('edit' => 'content/document/edit', 'new' => 'content/document/create', 'delete' => 'content/document/delete', 'copy' => 'content/document/copy', 'cut' => 'content/document/cut', 'paste' => 'content/document/paste', 'publish' => 'content/document/publish', 'unpublish' => 'content/document/unpublish', 'refresh' => 'content/document/refresh-treeview'); $arrayRoutes = array(); foreach ($routes as $key => $route) { $arrayRoutes[$key] = $this->url()->fromRoute($route, array('id' => 'itemId')); } $this->layout()->setVariable('routes', Json::encode($arrayRoutes)); }
/** * Refresh treeview * * @return \Zend\View\Model\ViewModel */ public function refreshTreeviewAction() { $documentId = $this->getRouteMatch()->getParam('id', 0); if (empty($documentId)) { $documents = new DocumentCollection(); $documents->load($documentId); $documentsList = $documents->getChildren(); } else { $documents = DocumentModel::fromId($documentId); $documentsList = $documents->getChildren(); } return $this->returnJson(array('treeview' => Component\TreeView::render($documentsList, false))); }