Newscoop\Service\Implementation\ThemeManagementServiceLocal::getThemes PHP Method

getThemes() public method

public getThemes ( $publication, SearchTheme $search = NULL, $offset, $limit )
$search Newscoop\Service\Model\SearchTheme
    public function getThemes($publication, SearchTheme $search = NULL, $offset = 0, $limit = -1)
    {
        return $this->trim($this->getThemesData($publication, $search), $offset, $limit);
    }

Usage Example

Example #1
0
 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;
 }