AAAAhome/academiac/www/administrator/components/com_csvi/helpers/file/import/xls.php000060400000006641151476351750024311 0ustar00data[0]['numRows']; } /** * Load the column headers from a file * * @copyright * @author RolandD * @todo * @see * @access public * @param * @return bool true * @since 3.0 */ public function loadColumnHeaders() { $jinput = JFactory::getApplication()->input; // Make sure we include the empty fields for ($i=1; $i<=$this->data[0]['numCols']; $i++) { if (!isset($this->data[0]['cells'][1])) $this->data[0]['cells'][1][$i] = ''; } $headers = array_values($this->data[0]['cells'][1]); $jinput->set('columnheaders', $headers); $this->linepointer++; return true; } /** * Get the file position * * @copyright * @author RolandD * @todo * @see * @access public * @param * @return int current position in the file * @since 3.0 */ public function getFilePos() { return $this->linepointer; } /** * Set the file position * * @copyright * @author RolandD * @todo * @see * @access public * @param int $pos the position to move to * @return int current position in the file * @since 3.0 */ public function setFilePos($pos) { $this->linepointer = $pos; return $this->linepointer; } /** * Read the next line in the file * * @copyright * @author RolandD * @todo * @see * @access public * @param * @return array with the line of data read | false if data cannot be read * @since 3.0 */ public function readNextLine() { if ($this->data[0]['numRows'] >= $this->linepointer) { $newdata = array(); // Make sure we include the empty fields for ($i=1; $i <= $this->data[0]['numCols']; $i++) { if (!isset($this->data[0]['cells'][$this->linepointer][$i])) $newdata[] = ''; else $newdata[] = $this->data[0]['cells'][$this->linepointer][$i]; } $this->linepointer++; return $newdata; } else return false; } /** * Process the file to import * * @copyright * @author RolandD * @todo * @see * @access public * @param * @return * @since 3.0 */ public function processFile() { $jinput = JFactory::getApplication()->input; $template = $jinput->get('template', null, null); $this->fp = true; $this->data = new Spreadsheet_Excel_Reader($this->filename, false); $this->data = $this->data->sheets; return true; } /** * Sets the file pointer back to beginning * * @copyright * @author RolandD * @todo * @see * @access public * @param * @return * @since 3.0 */ public function rewind() { $this->setFilePos(1); } } ?>