/** * Retrieve the group model associated with the banner * * @param Fishpig_iBanners_Model_Banner $banner * @return Fishpig_iBanners_Model_Group */ public function getGroup(Fishpig_iBanners_Model_Banner $banner) { if ($banner->getGroupId()) { $group = Mage::getModel('ibanners/group')->load($banner->getGroupId()); if ($group->getId()) { return $group; } } return false; }
/** * Upload an image and assign it to the model * * @param Fishpig_iBanners_Model_Banner $banner * @param string $field = 'image' */ protected function _handleImageUpload(Fishpig_iBanners_Model_Banner $banner, $field = 'image') { $data = $banner->getData($field); if (isset($data['value'])) { $banner->setData($field, $data['value']); } if (isset($data['delete']) && $data['delete'] == '1') { $banner->setData($field, ''); } if ($filename = Mage::helper('ibanners/image')->uploadImage($field)) { $banner->setData($field, $filename); } }