getChildren() public méthode

(non-PHPdoc)
See also: include Gc\Component\IterableInterface#getChildren()
public getChildren ( ) : array
Résultat array
Exemple #1
0
 /**
  * Test
  *
  * @return void
  */
 public function testGetChildren()
 {
     $this->object->load(0);
     $this->assertInternalType('array', $this->object->getChildren());
 }
Exemple #2
0
 /** (non-PHPdoc)
  *
  * @see include \Gc\Component\IterableInterface#getChildren()
  * @return array
  */
 public function getChildren()
 {
     if ($this->getData('children') === null) {
         $children = new Collection();
         $children->load($this->getId());
         $this->setData('children', $children->getChildren());
     }
     return $this->getData('children');
 }
Exemple #3
0
 /**
  * Test
  *
  * @return void
  */
 public function testRenderWithIterableInterface()
 {
     $view = ViewModel::fromArray(array('name' => 'View Name', 'identifier' => 'View identifier', 'description' => 'View Description', 'content' => 'View Content'));
     $view->save();
     $layout = LayoutModel::fromArray(array('name' => 'Layout Name', 'identifier' => 'Layout identifier', 'description' => 'Layout Description', 'content' => 'Layout Content'));
     $layout->save();
     $user = UserModel::fromArray(array('lastname' => 'User test', 'firstname' => 'User test', 'email' => '*****@*****.**', 'login' => 'test', 'user_acl_role_id' => 1));
     $user->setPassword('test');
     $user->save();
     $documentType = DocumentTypeModel::fromArray(array('name' => 'Document Type Name', 'description' => 'Document Type description', 'icon_id' => 1, 'defaultview_id' => $view->getId(), 'user_id' => $user->getId()));
     $documentType->save();
     $document = DocumentModel::fromArray(array('name' => 'Document name', 'url_key' => 'url-key', 'status' => DocumentModel::STATUS_ENABLE, 'show_in_nav' => true, 'user_id' => $user->getId(), 'document_type_id' => $documentType->getId(), 'view_id' => $view->getId(), 'layout_id' => $layout->getId(), 'parent_id' => 0));
     $document->save();
     $collection = new DocumentCollection();
     $collection->load(0);
     $this->assertEquals(sprintf('<ul><li><a href="#tabs-%d">Document name</a></li></ul>', $document->getId()), $this->object->render($collection->getChildren()));
     $document->delete();
     $documentType->delete();
     $layout->delete();
     $view->delete();
     $user->delete();
 }
Exemple #4
0
 /**
  * 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)));
 }