Exemplo n.º 1
0
 public function getRemoteTypeGroups()
 {
     if (!$this->useCache || !isset($this->data['settings']['remote']['typeGroups'])) {
         list($localPath, $tmpDirCreated) = $this->getTemporalDirectory();
         static::downloadFile(self::REMOTE_TYPE_GROUP_FILE, self::LOCAL_TYPE_GROUP_FILE, false, $localPath);
         $csv = new CSVReader();
         $res = $csv->ReadBlock($localPath . self::LOCAL_TYPE_GROUP_FILE);
         $result = array();
         foreach ($res as $line) {
             $result[$line['CODE']] = explode(':', $line['TYPES']);
         }
         $this->data['settings']['remote']['typeGroups'] = $result;
         $csv->CloseFile();
         if ($tmpDirCreated) {
             $this->deleteDirectory($localPath);
         }
     }
     return $this->data['settings']['remote']['typeGroups'];
 }