getChildren() 공개 메소드

(non-PHPdoc)
또한 보기: include Gc\Component\IterableInterface#getChildren()
public getChildren ( ) : array
리턴 array
예제 #1
0
 /**
  * Test
  *
  * @return void
  */
 public function testGetChildren()
 {
     $this->object->load(0);
     $this->assertInternalType('array', $this->object->getChildren());
 }
예제 #2
0
파일: Model.php 프로젝트: gotcms/gotcms
 /** (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');
 }
예제 #3
0
파일: TabsTest.php 프로젝트: gotcms/gotcms
 /**
  * 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();
 }
예제 #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)));
 }