public function execute() { $this->init(); $this->reader->seek(max(0, waRequest::request('row', 0, waRequest::TYPE_INT))); $limit = max(1, waRequest::request('limit', 50, waRequest::TYPE_INT)); $this->reader->columns(array(array('shopCsvProductviewController', 'tableRowHandler'), array(__CLASS__, 'columns'))); $n = 0; $this->response['tbody'] = ''; while (++$n <= $limit && $this->reader->next()) { $this->response['tbody'] .= $this->reader->getTableRow(); } $this->response['rows_count'] = $this->reader->count(); $this->response['current'] = $this->reader->key(); }
/** * @return bool * @uses stepImportCategory * @uses stepImportProduct * @uses stepImportSku * @uses stepImportImage * @usedby step */ private function stepImport() { $result = false; if ($this->data['count'][self::STAGE_IMAGE] > $this->data['current'][self::STAGE_IMAGE]) { $result = $this->stepImportImage(); } else { if ($this->reader->next() && ($current = $this->reader->current())) { $this->data['current'][self::STAGE_FILE] = $this->reader->offset(); if ($type = self::getDataType($current)) { $method_name = 'stepImport' . ucfirst($type); if (method_exists($this, $method_name)) { $result = $this->{$method_name}($current); } else { $this->error(sprintf("Unsupported import data type %s", $type)); } if (false) { //TODO write $row = $this->reader->getTableRow(); } } } elseif (!$this->reader->valid()) { $this->data['current'][self::STAGE_FILE] = $this->reader->offset(); } } return $result; }