예제 #1
0
 public function loadCSVColumns()
 {
     $app = JFactory::getApplication();
     $path = $app->getUserState('file_path', '');
     $delimiter = $app->getUserState('delimiter', ',');
     $enclosure = $app->getUserState('enclosure', '"');
     if (!JFile::exists($path)) {
         $this->setError(JText::sprintf("COM_JUDOWNLOAD_IMPORT_IMAGE_FILE_S_NOT_FOUND", $path));
         return false;
     }
     $rows = JUDownloadHelper::getCSVData($path, $delimiter, $enclosure, 'r+', 0, null, true);
     $csvColumnRows = array_shift($rows);
     $totalCsvRow = count($rows);
     $app->setUserState('csv_total_row', $totalCsvRow);
     return $csvColumnRows;
 }