public function fetchDataSet()
 {
     parent::fetchDataSet();
     $svc = Openbiz::getService("market.lib.PackageService");
     $resultSet = array();
     $repo_uri = $this->getDefaultRepoURI();
     $params = array("searchRule" => $this->remoteSearchRule, "sortRule" => $this->sortRule, "startItem" => ($this->currentPage - 1) * $this->range, "range" => $this->range);
     $appList = $svc->discoverApplication($repo_uri, $cat_id, $params);
     if (is_array($appList['data'])) {
         foreach ($appList['data'] as $appInfo) {
             $appInfo['icon'] = $repo_uri . $appInfo['icon'];
             $resultSet[] = $appInfo;
         }
     }
     $this->totalRecords = $appList['totalRecords'];
     if ($this->range && $this->range > 0) {
         $this->totalPages = ceil($this->totalRecords / $this->range);
     }
     return $resultSet;
 }
 public function fetchDataSet()
 {
     $resultSet = parent::_fetchDataSet();
     $repoAppsArr = array();
     $repoIdsArr = array();
     $AppsInfoArr = array();
     if (!$resultSet) {
         return;
     }
     $svc = Openbiz::getService("market.lib.PackageService");
     foreach ($resultSet as $record) {
         $repoAppsArr[$record['repository_uid']][] = $record['app_id'];
     }
     foreach ($repoAppsArr as $repo_uid => $apps) {
         if ($repo_uid) {
             $repoInfo = $this->getRepoInfo($repo_uid);
             $repo_url = $repoInfo['repository_uri'];
             $repoIdsArr[$repo_uid] = $repoInfo['Id'];
             $appList = $svc->discoverAppList($repo_url, $apps);
             if (is_array($appList)) {
                 foreach ($appList as $appInfo) {
                     $appInfo['icon'] = $repo_url . $appInfo['icon'];
                     $AppsInfoArr[$repo_uid][$appInfo['Id']] = $appInfo;
                 }
             }
         }
     }
     $newResultSet = array();
     foreach ($resultSet as $key => $value) {
         $appInfo = $AppsInfoArr[$value['repository_uid']][$value['app_id']];
         $value['repo_id'] = $repoIdsArr[$value['repository_uid']];
         if (is_array($appInfo)) {
             foreach ($appInfo as $app_key => $app_value) {
                 $value[$app_key] = $app_value;
             }
             $newResultSet[$key] = $value;
         }
     }
     return $newResultSet;
 }