function save() { JeaModelRealtors::save(); $id = JRequest::getInt('id', '', 'POST'); if ('apply' == $this->getTask()) { $this->_controllerUrl .= '&task=edit&id=' . $id; } else { $this->_setDefaultRedirect(); } $msg = JText::sprintf('Successfully saved realtor', $row['ten']); $this->setRedirect($this->_controllerUrl, $msg); }
function getRealtorById($id) { $realtorModel = new JeaModelRealtors(); $realtorData = $realtorModel->getRowById($id); $realtorData->link = $this->getRealtorLink($id); return $realtorData; }
function uploadImages($id = null) { //echo $id; //echo "vao toi uploadImages "; //exit; if (!$id) { return false; } require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'library/Http_File.php'; jimport('joomla.filesystem.folder'); global $u_reGlobalConfig; $realtorImagePath = $u_reGlobalConfig['IMAGE']['realtor_image_path']; $base_upload_dir = JPATH_ROOT . DS . $realtorImagePath; $validExtensions = array('jpg', 'JPG', 'jpeg', 'JPEG', 'gif', 'GIF', 'png', 'PNG'); $image = new Http_File(JRequest::getVar('image', array(), 'files', 'array')); if (!JFolder::exists($base_upload_dir)) { JFolder::create($base_upload_dir); } $upload_dir = $base_upload_dir . DS . $id; $config =& ComJea::getParams(); $maxPreviewWidth = $config->get('max_previews', 400); $maxThumbnailWidth = $config->get('max_thumbnails', 120); $maxThumbnailHeight = 90; //default max height : 90px $jpgQuality = $config->get('jpg_quality', 90); if ($image->isPosted()) { if (!JFolder::exists($upload_dir)) { JFolder::create($upload_dir); } $image->setValidExtensions($validExtensions); $image->setName('avatar.jpg'); if (!($fileName = $image->moveTo($upload_dir))) { JError::raiseWarning(200, JText::_($image->getError())); return false; } //make preview JeaModelRealtors::_resizeImage($upload_dir . DS . $fileName, $upload_dir . DS . 'avatar.jpg', null, $maxPreviewWidth, $jpgQuality); //make min JeaModelRealtors::_resizeImage($upload_dir . DS . 'avatar.jpg', $upload_dir . DS . 'thumbnail.jpg', $maxThumbnailHeight, $maxThumbnailWidth, $jpgQuality); } return true; }
function getDeleteImage($id) { // ilandCommonUtils::delete_img( $id ); $ModelRealtors = new JeaModelRealtors(); $ModelRealtors->delete_img($id); }