Beispiel #1
0
 /**
  * Function returns Report Models for the folder
  * @param <Vtiger_Paging_Model> $pagingModel
  * @return <Reports_Record_Model>
  */
 function getReports($pagingModel, $search_params = array())
 {
     $paramsList = array('startIndex' => $pagingModel->getStartIndex(), 'pageLimit' => $pagingModel->getPageLimit(), 'orderBy' => $this->get('orderby'), 'sortBy' => $this->get('sortby'));
     //$reportClassInstance = Vtiger_Module_Model::getClassInstance('ITS4YouReports');
     $fldrId = $this->getId();
     if ($fldrId == 'All') {
         $fldrId = false;
         $paramsList = array('startIndex' => $pagingModel->getStartIndex(), 'pageLimit' => $pagingModel->getPageLimit(), 'orderBy' => $this->get('orderby'), 'sortBy' => $this->get('sortby'));
     }
     //$reportsList = $reportClassInstance->sgetRptsforFldr($fldrId, $paramsList);
     $reportsList = ITS4YouReports::sgetRptsforFldr($fldrId, $paramsList, $search_params);
     /*
      if(!$fldrId){
      foreach ($reportsList as $reportId => $reports) {
      $reportsCount += count($reports);
      }
      }else{
      $reportsCount = count($reportsList);
      }
     */
     $reportModuleModel = Vtiger_Module_Model::getInstance('ITS4YouReports');
     if ($fldrId == false) {
         return $this->getAllReportModels($reportsList, $reportModuleModel);
     } else {
         $reportModels = array();
         for ($i = 0; $i < count($reportsList); $i++) {
             $reportModel = new ITS4YouReports_Record_Model();
             $reportModel->setData($reportsList[$i])->setModuleFromInstance($reportModuleModel);
             $reportModels[] = $reportModel;
             unset($reportModel);
         }
         return $reportModels;
     }
 }