public function getChildren($p) { $rez = array(); //unset restricted query params from user input unset($p['fq']); /* prepare params */ $path = '/'; if (!isset($p['path']) || strlen($p['path']) < 1) { if (!empty($p['pid'])) { $path = $p['pid']; } } else { $path = $p['path']; } $p['path'] = $path; //check if user have changed the row limit in grid if (!empty($p['setMaxRows']) && !empty($p['rows'])) { User::setGridMaxRows($p['rows']); } //the navigation goes from search results. We should get the real path of the node if (!empty($p['lastQuery']) && empty($p['query'])) { while (substr($path, -1) == '/') { $path = substr($path, 0, strlen($path) - 1); } $a = explode('/', $path); if (!empty($a) && is_numeric($a[sizeof($a) - 1])) { $p['path'] = @Path::getPath(array_pop($a))['path']; } } $this->showFoldersContent = isset($p['showFoldersContent']) ? $p['showFoldersContent'] : false; $this->requestParams = $p; /* end of prepare params */ /* we should: 1. load available plugins for the tree with their configs 2. fire the on treeInitialize event 3. call each plugin with received params 4. join and sort received data */ //detect tree nodes config, //but leave only SearchResults plugin when searching if (empty($p['search'])) { if (empty($p['query'])) { $this->treeNodeConfigs = Config::get('treeNodes'); } // default is only DBNode if nothing defined in cofig if (empty($this->treeNodeConfigs)) { $this->treeNodeConfigs = array('Dbnode' => array()); } } else { $this->treeNodeConfigs = array('SearchResults' => $p['search']); $path = Path::getGUID('SearchResults') . '-'; } $params = array('params' => &$p, 'plugins' => &$this->treeNodeConfigs); fireEvent('treeInitialize', $params); // array of all available classes defined in treeNodes // used to check if any class should add its nodes based // on last node from current path $this->treeNodeClasses = Path::getNodeClasses($this->treeNodeConfigs); foreach ($this->treeNodeClasses as &$nodeClass) { $cfg = $nodeClass->getConfig(); $this->treeNodeGUIDConfigs[$cfg['guid']] = $cfg; } $this->path = Path::createNodesPath($path, $this->treeNodeGUIDConfigs); //set path and input params for last node //because iterating each class and requesting children can //invoke a search that will use last node to get facets and DC if (!empty($this->path)) { $lastNode = $this->path[sizeof($path) - 1]; $lastNode->path = $this->path; $lastNode->requestParams = $this->requestParams; } Cache::set('current_path', $this->path); $this->result = array('data' => array(), 'facets' => array(), 'pivot' => array(), 'search' => array(), 'view' => array(), 'sort' => array(), 'group' => array(), 'stats' => array(), 'DC' => array(), 'total' => 0); //get view config and apply to request params and for result $viewConfig = $this->detectViewConfig(); $this->requestParams = array_merge($this->requestParams, $viewConfig); $this->result = array_merge($this->result, $viewConfig); $this->requestParams['facets'] = $this->detectFacets(); $this->collectAllChildren(); $this->prepareResult(); $rez = array('success' => true, 'pathtext' => $this->getPathText($p), 'folderProperties' => $this->getPathProperties($p), 'page' => @$p['page'], 'data' => array()); foreach ($this->result as $k => &$v) { if (!empty($this->result[$k])) { $rez[$k] =& $v; } } return $rez; }