private function getFilesList($path, $relation) {
		$fileSystemTypes = FileSystemTypes::getInstance();
		LogMaster::log("Query filesystem: ".$path);
		$dir = opendir($path.'/'.$relation);
		$result = new FileSystemResult();
		// forms fields list
		for ($i = 0; $i < count($this->config->data); $i++) {
			$fields[] = $this->config->data[$i]['db_name'];
		}
		// for every file and directory of folder
		while ($file = readdir($dir)) {
			// . and .. should not be in output list
			if (($file == '.')||($file == '..')) {
				continue;
			}
			$newFile = array();
			// parse file name as Array('name', 'ext', 'is_dir')
			$fileNameExt = $this->parseFileName($path.'/'.$relation, $file);
			// checks if file should be in output array
			if (!$fileSystemTypes->checkFile($file, $fileNameExt)) {
				continue;
			}
			// takes file stat if it's need
			if ((in_array('size', $fields))||(in_array('date', $fields))) {
				$fileInfo = stat($path.'/'.$file);
			}

			// for every field forms list of fields
			for ($i = 0; $i < count($fields); $i++) {
				$field = $fields[$i];
				switch ($field) {
					case 'filename':
						$newFile['filename'] = $file;
						break;
					case 'full_filename':
						$newFile['full_filename'] = $path."/".$file;
						break;
					case 'size':
						$newFile['size'] = $fileInfo['size'];
						break;
					case 'extention':
						$newFile['extention'] = $fileNameExt['ext'];
						break;
					case 'name':
						$newFile['name'] = $fileNameExt['name'];
						break;
					case 'date':
						$newFile['date'] = date("Y-m-d H:i:s", $fileInfo['ctime']);
						break;
				}
				$newFile['relation_id'] = $relation.'/'.$file;
				$newFile['safe_name'] = $this->setFileName($relation.'/'.$file);
				$newFile['is_folder'] = $fileNameExt['is_dir'];
			}
			// add file in output list
			$result->addFile($newFile);
		}
		return $result;
	}
private function getFilesList($path, $relation) {
		$fileSystemTypes = FileSystemTypes::getInstance();
		LogMaster::log("Query filesystem: ".$path);
		$dir = opendir($path.'/'.$relation);
		$result = new FileSystemResult();
		// forms fields list
		for ($i = 0; $i < count($this->config->data); $i++) {
			$fields[] = $this->config->data[$i]['db_name'];
		}
		// for every file and directory of folder
		while ($file = readdir($dir)) {
			// . and .. should not be in output list
			if (($file == '.')||($file == '..')) {
				continue;
			}
			$newFile = array();
			// parse file name as Array('name', 'ext', 'is_dir')
			$fileNameExt = $this->parseFileName($path.'/'.$relation, $file);
			// checks if file should be in output array
			if (!$fileSystemTypes->checkFile($file, $fileNameExt)) {
				continue;
			}
			// takes file stat if it's need
			if ((in_array('size', $fields))||(in_array('date', $fields))) {
				$fileInfo = stat($path.'/'.$file);
			}

			// for every field forms list of fields
			for ($i = 0; $i < count($fields); $i++) {
				$field = $fields[$i];
				switch ($field) {
					case 'filename':
						$newFile['filename'] = $file;
						break;
					case 'full_filename':
						$newFile['full_filename'] = $path."/".$file;
						break;
					case 'size':
						$newFile['size'] = $fileInfo['size'];
						break;
					case 'extention':
						$newFile['extention'] = $fileNameExt['ext'];
						break;
					case 'name':
						$newFile['name'] = $fileNameExt['name'];
						break;
					case 'date':
						$newFile['date'] = date("Y-m-d H:i:s", $fileInfo['ctime']);
						break;
				}
				$newFile['relation_id'] = $relation.'/'.$file;
				$newFile['safe_name'] = $this->setFileName($relation.'/'.$file);
				$newFile['is_folder'] = $fileNameExt['is_dir'];
			}
			// add file in output list
			$result->addFile($newFile);
		}
		return $result;
	}
private function getFilesList ( $ path , $ relation ) { $ fileSystemTypes = FileSystemTypes :: getInstance ( ) ; LogMaster :: log ( "Query filesystem: " . $ path ) ; $ dir = opendir ( $ path . '/' . $ relation ) ; $ result = new FileSystemResult ( ) ; // forms fields list for ( $ i = 0 ; $ i < count ( $ this -> config -> data ) ; $ i ++ ) { $ fields [ ] = $ this -> config -> data [ $ i ] [ 'db_name' ] ; } // for every file and directory of folder while ( $ file = readdir ( $ dir ) ) { // . and .. should not be in output list if ( ( $ file == '.' ) || ( $ file == '..' ) ) { continue ; } $ newFile = array ( ) ; // parse file name as Array('name', 'ext', 'is_dir') $ fileNameExt = $ this -> parseFileName ( $ path . '/' . $ relation , $ file ) ; // checks if file should be in output array if ( ! $ fileSystemTypes -> checkFile ( $ file , $ fileNameExt ) ) { continue ; } // takes file stat if it's need if ( ( in_array ( 'size' , $ fields ) ) || ( in_array ( 'date' , $ fields ) ) ) { $ fileInfo = stat ( $ path . '/' . $ file ) ; } // for every field forms list of fields for ( $ i = 0 ; $ i < count ( $ fields ) ; $ i ++ ) { $ field = $ fields [ $ i ] ; switch ( $ field ) { case 'filename' : $ newFile [ 'filename' ] = $ file ; break ; case 'full_filename' : $ newFile [ 'full_filename' ] = $ path . "/" . $ file ; break ; case 'size' : $ newFile [ 'size' ] = $ fileInfo [ 'size' ] ; break ; case 'extention' : $ newFile [ 'extention' ] = $ fileNameExt [ 'ext' ] ; break ; case 'name' : $ newFile [ 'name' ] = $ fileNameExt [ 'name' ] ; break ; case 'date' : $ newFile [ 'date' ] = date ( "Y-m-d H:i:s" , $ fileInfo [ 'ctime' ] ) ; break ; } $ newFile [ 'relation_id' ] = $ relation . '/' . $ file ; $ newFile [ 'safe_name' ] = $ this -> setFileName ( $ relation . '/' . $ file ) ; $ newFile [ 'is_folder' ] = $ fileNameExt [ 'is_dir' ] ; } // add file in output list $ result -> addFile ( $ newFile ) ; } return $ result ; }
gets files and directory list
gets files and directory list