public function fetchCatalogsInFolderAction() { $prof = $this->_getParam('prof') ? $this->_getParam('prof') : ''; $profAuth = $this->_getParam('profAuth') ? $this->_getParam('profAuth') : ''; $startdt = $this->_getParam('startdt') ? $this->_getParam('startdt') : ''; $enddt = $this->_getParam('enddt') ? $this->_getParam('enddt') : ''; $report = $this->_getParam('report') ? $this->_getParam('report') : ''; $start = $this->_getParam('start') ? $this->_getParam('start') : 0; $end = $this->_getParam('limit') ? $this->_getParam('limit') : 10; $folderGuid = $this->_getParam('folderGuid') ? $this->_getParam('folderGuid') : ''; $modelCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog(); $a = array(); if ($startdt && $enddt) { if ($report == 'msk') { $rowset = $modelCatalog->fetchAll("createdDate BETWEEN '{$startdt}' AND '{$enddt}'", '', $end, $start); $rowCount = $modelCatalog->countCatalogsInBetween($startdt, $enddt); } elseif ($report == 'tbt') { $rowset = $modelCatalog->fetchAll("publishedDate BETWEEN '{$startdt}' AND '{$enddt}'", '', $end, $start); $rowCount = $modelCatalog->countCatalogsPubBetween($startdt, $enddt); } elseif ($prof !== "") { $rowset = $modelCatalog->fetchAll("createdDate BETWEEN '{$startdt}' AND '{$enddt}' AND profileGuid='{$prof}'", '', $end, $start); $rowCount = $modelCatalog->countCatalogsInBetweenProfile($startdt, $enddt, $prof); } $a['totalCount'] = $rowCount; } elseif ($prof) { $rowset = $modelCatalog->fetchAll("profileGuid = '{$prof}'", '', $end, $start); $rowCount = $modelCatalog->countCatalogsProfile($prof); $a['totalCount'] = $rowCount; } elseif ($profAuth) { $rowset = $modelCatalog->fetchAll("createdBy = '{$profAuth}'", '', $end, $start); $rowCount = $modelCatalog->countCatalogsForAuthor($profAuth); $a['totalCount'] = $rowCount; } else { $rowset = $modelCatalog->fetchCatalogInFolder($folderGuid, $start, $end); $a['totalCount'] = $modelCatalog->getCountCatalogsInFolder($folderGuid); } $now = date('Y-m-d H:i:s'); $ii = 0; if ($a['totalCount'] != 0) { foreach ($rowset as $row) { $modelCatalogAttribute = new Pandamp_Modules_Dms_Catalog_Model_CatalogAttribute(); $a['catalogs'][$ii]['guid'] = $row->guid; $a['catalogs'][$ii]['title'] = $modelCatalogAttribute->getCatalogAttributeValue($row->guid, 'fixedTitle'); $a['catalogs'][$ii]['subtitle'] = $modelCatalogAttribute->getCatalogAttributeValue($row->guid, 'fixedSubTitle'); $modelProfile = new Pandamp_Modules_Dms_Profile_Model_Profile(); $p = $modelProfile->getProfileByPG($row->profileGuid); $a['catalogs'][$ii]['profile_column'] = $p->title; $a['catalogs'][$ii]['createdby'] = $row->createdBy; $a['catalogs'][$ii]['modifiedby'] = $row->modifiedBy; $a['catalogs'][$ii]['createdDate'] = Pandamp_Lib_Formater::get_date($row->createdDate); if ($now <= $row->publishedDate && $row->status == 99) { $status = "publish_y"; } else { if (($now <= $row->expiredDate || $row->expiredDate == '0000-00-00 00:00:00') && $row->status == 99) { $status = "publish_g"; } else { if ($now > $row->expiredDate && $row->status == 99) { $status = "publish_r"; } else { if ($row->status == 0) { $status = "publish_x"; } else { if ($row->status == -1) { $status = "disabled"; } } } } } $a['catalogs'][$ii]['status'] = $status; $ii++; } } if ($a['totalCount'] == 0) { $a['catalogs'][0]['guid'] = 'XXX'; $a['catalogs'][0]['title'] = "No Data"; $a['catalogs'][0]['subtitle'] = "-"; $a['catalogs'][0]['createdDate'] = ''; } echo Zend_Json::encode($a); }