_slideId = (int) $slideId; $this->clearData(); return $this; } public function getSlideId() { return $this->_slideId; } protected function _initSlide() { if (null == $this->_slideObj) { $this->_slideObj = new App_Slide_Admin_Obj(); $this->_slideObj->setPrimaryKey($this->_slideId); $this->_slideObj->initData(); self::$_slideData = $this->_slideObj->getData(); if (!empty(self::$_slideData)) { self::$_slideData['width'] = $this->getConfig('image')->get('width'); self::$_slideData['height'] = $this->getConfig('image')->get('height'); self::$_slideData['resizeMethod'] = $this->getConfig('image')->get('resizeMethod'); } } return $this; } public function getSlideImage() { $this->_initSlide(); $image = ''; if (!empty(self::$_slideData)) { $image = self::$_slideData['image']; } return $image; } public function getSlideTitle() { $this->_initSlide(); $title = ''; if (!empty(self::$_slideData)) { $title = self::$_slideData['title']; } return $title; } public function getSlideData($field = null) { $data = []; $this->_initSlide(); if (!empty(self::$_slideData)) { $data = self::$_slideData; } return Qs_Array::get($data, $field); } public function getData($field = null, $default = null) { if (null === $this->_data && $this->_slideId && $data = $this->_getFromDb($this->_slideId)) { $this->_data = $data; } if (null === $this->_data) { return null; } return Qs_Array::get($this->_data, $field, $default); } protected function _getFromDb($primaryKey, $field = null) { $select = $this->_db->select(); $select->from($this->_getPair(), $this->_getFromDbColumns()); $select->where("{$this->_tableAlias}.slideId = ?", (int) $this->getSlideId()); $statement = $select->query(); $rows = $statement->fetchAll(); return ($rows) ? $rows : false; } public function getObjectInfo() { $data = []; $data['itemTitle'] = $this->getSlideTitle(); return $data; } public function getObjectId() { return $this->getSlideId(); } }