Newscoop\Controller\Action\Helper\Datatable\Adapter\Theme::getData PHP Method

getData() public method

public getData ( array $p_params, array $p_cols )
$p_params array
$p_cols array
    public function getData(array $p_params, array $p_cols)
    {
        $p_params = (object) $p_params;
        $dataCollection = null;
        if (isset($p_params->sort)) {
            $this->sort(!is_array($p_params->sort) ? array($p_params->sort) : $p_params->sort);
        }
        // for search by publication
        if (isset($p_params->search)) {
            if (@trim($p_params->search[$this->_pubColFilterIdx]) != "") {
                $p = new Publication();
                $p->setId(intval($p_params->search[$this->_pubColFilterIdx]));
                $dataCollection = $this->_service->getThemes($p, $this->getSearchObject());
            }
            // @todo ?
            $this->search($p_params->search);
        }
        $retThemes = array();
        if (is_null($dataCollection)) {
            $dataCollection = $this->_service->getUnassignedThemes($this->getSearchObject());
        }
        foreach ($dataCollection as $theme) {
            $images = array();
            foreach ($this->_service->getPresentationImages($theme) as $img) {
                $images[] = (string) $img->getPath();
                // @todo some sorting
            }
            $retThemes[] = array('id' => (string) $theme->getId(), 'title' => (string) $theme->getName(), 'designer' => (string) $theme->getDesigner(), 'version' => (string) $theme->getVersion(), 'subTitle' => (string) $theme->getMinorNewscoopVersion(), 'description' => (string) $theme->getDescription(), 'images' => $images, 'pubId' => isset($p) ? $p->getId() : null);
        }
        return $retThemes;
    }