function display($tpl = null) { // Create the form $this->form =& ComJea::getParams(); $this->form->loadSetupFile(JPATH_COMPONENT . DS . 'models' . DS . 'Config.xml'); JHTML::_('behavior.tooltip'); JToolBarHelper::title('JEA : ' . JText::_('Configuration'), 'config.png'); JToolBarHelper::save(); JToolBarHelper::makeDefault(); parent::display($tpl); }
function display($tpl = null) { $this->user =& JFactory::getUser(); switch ($tpl) { case 'form': $this->editItem(); break; default: $this->listIems(); } $params =& ComJea::getParams(); $this->assignRef('params', $params); // parent::display($tpl); }
function getItemDetail($id) { //$sql =& $this->get('project'); //echo "id:$id<br>"; //echo "sql:$sql<br>"; $row =& $this->get('project'); if (!$row->id) { return; } $this->assignRef('row', $row); $res = ComJea::getImagesById($row->id, true); $this->assignRef('main_image', $res['main_image']); $this->assignRef('secondaries_images', $res['secondaries_images']); // Add list of other projects and the same investor projects $listOtherProjects = $this->getListOtherProjects($row->project_group_ids, $row->id); $listSameInvestorProject = $this->getListSameInvestorProjects($row->investor, $id); $loaihinh = $this->getProject_Group(); $this->assignRef('listOther', $listOtherProjects); $this->assignRef('listSameInvestor', $listSameInvestorProject); $this->assignRef('loaihinh', $loaihinh); $document =& JFactory::getDocument(); if ($this->escape($row->page_title) == NULL) { $page_title = ucfirst(JText::sprintf($this->escape($row->value) . ', ' . $this->escape($row->town))); } else { $page_title = ucfirst($this->escape($row->page_title)); } if ($this->escape($row->page_keywords) != NULL) { $page_keywords = ucfirst($this->escape($row->page_keywords)); $document->setMetaData('keywords', $page_keywords); } if ($this->escape($row->page_description) != NULL) { $page_description = ucfirst($this->escape($row->page_description)); $document->setMetaData('description', $page_description); } $this->assign('page_title', $page_title); $mainframe =& JFactory::getApplication(); $pathway =& $mainframe->getPathway(); $pathway->addItem($page_title); $document->setTitle($page_title); }
<?php /** * This file is part of Joomla Estate Agency - Joomla! extension for real estate agency * * @version 0.9 2009-10-14 * @package Jea.admin * @copyright Copyright (C) 2008 PHILIP Sylvain. All rights reserved. * @license GNU/GPL, see LICENSE.php * Joomla Estate Agency is free software. This version may have been modified pursuant to the * GNU General Public License, and as distributed it includes or is derivative * of works licensed under the GNU General Public License or other free or open * source software licenses. * */ // no direct access defined('_JEXEC') or die('Restricted access'); //defined('BDS-ThienMinh-117') or die('chua co BDS-ThienMinh-117'); require JPATH_COMPONENT . DS . 'jea.class.php'; ComJea::run();
function getCompare() { $idCompare = JRequest::getVar('sosanh', array(), '', 'array'); $model =& $this->getModel(); $i = 0; $rows = array(); /*foreach($idCompare as $id) { $rows[$i] = $model->getPropertyCompare($id); $res = ComJea::getImagesById($id); $this->assignRef("main_image_$i", $res['main_image']); $this->assignRef("secondaries_images_$i", $res['secondaries_images']); $i++; }*/ // lay 2 bien session de so sanh $session =& JFactory::getSession(); //echo "Session: ".$session->get('valueCompare_1'); $rows[0] = $model->getPropertyCompare($session->get('valueCompare_1')); $res = ComJea::getImagesById($session->get('valueCompare_1')); $this->assignRef("main_image_0", $res['main_image']); $this->assignRef("secondaries_images_0", $res['secondaries_images']); $rows[1] = $model->getPropertyCompare($session->get('valueCompare_2')); $res = ComJea::getImagesById($session->get('valueCompare_2')); $this->assignRef("main_image_1", $res['main_image']); $this->assignRef("secondaries_images_1", $res['secondaries_images']); // $this->assignRef('row1', $rows[0]); $this->assignRef('row2', $rows[1]); parent::display('compare'); }
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 deleteimg() { $access =& ComJea::getAccess(); if ($access->canEdit || $access->canEditOwn) { require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'models' . DS . 'properties.php'; $model = new JeaModelProperties(); $id = JRequest::getInt('id', 0); $Itemid = JRequest::getInt('Itemid', 0); $model->delete_img(); $this->setRedirect('index.php?option=com_jea&view=manage&' . 'layout=form&id=' . $id . '&Itemid=' . $Itemid); } }
function getPreviousAndNext() { $result = array(); $currentRow =& $this->getRow(); $result['prev_item'] = null; $result['next_item'] = null; $params = ComJea::getParams(); $sql = 'SELECT id FROM #__jea_projects WHERE published=1'; // $where = ( $currentRow->is_renting )? 'is_renting=1' : 'is_renting=0' ; // $where .= ' AND published=1'; // Bug fix [#16275] Problem with 'Previous' and 'Next' navigation /* if ( $type_id = JRequest::getInt('type_id', $params->get('type_id', 0)) ) { $where .= ' AND type_id = ' . intval( $type_id ) ; } if ( $department_id = JRequest::getInt('department_id', $params->get('department_id', 0)) ) { $where .= ' AND department_id = ' . intval( $department_id ) ; } if ( $town_id = JRequest::getInt('town_id', $params->get('town_id', 0)) ) { $where .= ' AND town_id = ' . intval( $town_id ) ; } if ( $area_id = JRequest::getInt('area_id', $params->get('area_id', 0)) ) { $where .= ' AND area_id = ' . intval( $area_id ) ; } // End Bug fix [#16275] */ $this->_db->setQuery($sql); //. $where $rows = $this->_db->loadObjectList(); if ($rows) { $place = 0; foreach ($rows as $k => $row) { if ($row->id == $currentRow->id) { $place = $k; } } if (isset($rows[$place - 1])) { $result['prev_item'] = $rows[$place - 1]; } if (isset($rows[$place + 1])) { $result['next_item'] = $rows[$place + 1]; } } return $result; }
function getItemDetail() { //try to increase memory ini_set('memory_limit', '32M'); $text = ''; $row =& $this->get('property'); if (!$row->id) { return $text; } $res = ComJea::getImagesById($row->id); $webpage_to_property = 'http://' . $_SERVER['SERVER_NAME'] . str_replace('&format=pdf', '', $_SERVER['REQUEST_URI']); $page_title = ucfirst(JText::sprintf('PROPERTY TYPE IN TOWN', $this->escape($row->type), $this->escape($row->town))); $document =& JFactory::getDocument(); $document->setTitle($page_title . ' ' . JText::_('ref') . ' : ' . $row->ref); $document->setName($row->ref); if (is_file(JPATH_ROOT . DS . 'images' . DS . 'com_jea' . DS . 'images' . DS . $row->id . DS . 'preview.jpg')) { $text .= '<p><img src="' . $this->UrlAbsoluteToRelative($res['main_image']['preview_url']) . '" alt="" /></p>'; } $text .= $row->description . '<br /><br />'; $text .= $row->is_renting ? JText::_('Renting price') : JText::_('Selling price'); $text .= ' : ' . $this->formatPrice(floatval($row->price), JText::_('Consult us')) . '<br />'; if ($row->charges) { $text .= JText::_('Charges') . ' : ' . $this->formatPrice(floatval($row->charges), JText::_('Consult us')) . '<br />'; } if ($row->fees) { $text .= JText::_('Fees') . ' : ' . $this->formatPrice(floatval($row->fees), JText::_('Consult us')) . '<br />'; } if ($row->condition) { $text .= JText::_('Condition') . ' : ' . ucfirst($this->escape($row->condition)) . '<br />'; } if ($row->living_space) { $text .= JText::_('Living space') . ' : ' . $row->living_space . ' ' . $this->params->get('surface_measure') . '<br />'; } if ($row->land_space) { $text .= JText::_('Land space') . ' : ' . $row->land_space . ' ' . $this->params->get('surface_measure') . '<br />'; } if ($row->rooms) { $text .= JText::_('Number of rooms') . ' : ' . $row->rooms . '<br />'; } if ($row->floor) { $text .= JText::_('Number of floors') . ' : ' . $row->floor . '<br />'; } if ($row->bathrooms) { $text .= JText::_('Number of bathrooms') . ' : ' . $row->bathrooms . '<br />'; } if ($row->toilets) { $text .= JText::_('Number of toilets') . ' : ' . $row->toilets . '<br />'; } if ($row->hot_water_type) { $text .= JText::_('Hot water type') . ' : ' . ucfirst($this->escape($row->hot_water)) . '<br />'; } if ($row->heating_type) { $text .= JText::_('Heating type') . ' : ' . ucfirst($this->escape($row->heating)) . '<br />'; } if (intval($row->availability)) { $text .= '<p><em>' . JText::_('Availability date') . ' : ' . $row->availability . '</em> </p>'; } $text .= '<br /><br />'; if ($row->advantages) { $text .= '<h3>' . JText::_('Advantages') . ' :</h3>'; $text .= $this->getAdvantages($row->advantages); } $text .= '<h3>' . JText::_('Adress') . ' :</h3><br />'; if ($row->adress) { $text .= trim($row->adress) . ",<br />\n"; } if ($row->zip_code) { $text .= trim($row->zip_code) . ' '; } if ($row->town) { $text .= strtoupper($this->escape($row->town)) . "<br />\n"; } if ($row->area) { $text .= JText::_('Area') . ' : ' . $this->escape($row->area) . "\n"; } $text .= '<br /><br />' . $webpage_to_property; return $text; }
function _uploadImages($id = null) { if (!$id) { return false; } require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'library/Http_File.php'; jimport('joomla.filesystem.folder'); $base_upload_dir = JPATH_ROOT . DS . 'images' . DS . 'com_jea' . DS . 'images'; $validExtensions = array('jpg', 'JPG', 'jpeg', 'JPEG', 'gif', 'GIF', 'png', 'PNG'); $mainImage = new Http_File(JRequest::getVar('main_image', array(), 'files', 'array')); $secondImage = new Http_File(JRequest::getVar('secondaries_images0', array(), 'files', 'array')); $secondImage1 = new Http_File(JRequest::getVar('secondaries_images1', array(), 'files', 'array')); $secondImage2 = new Http_File(JRequest::getVar('secondaries_images2', array(), 'files', 'array')); $secondImage3 = new Http_File(JRequest::getVar('secondaries_images3', array(), 'files', 'array')); $secondImage = new Http_File(JRequest::getVar('secondaries_images0', array(), 'files', 'array')); $secondImage1 = new Http_File(JRequest::getVar('secondaries_images1', array(), 'files', 'array')); $secondImage2 = new Http_File(JRequest::getVar('secondaries_images2', array(), 'files', 'array')); $secondImage3 = new Http_File(JRequest::getVar('secondaries_images3', array(), 'files', 'array')); if (!JFolder::exists($base_upload_dir)) { JFolder::create($base_upload_dir); } $upload_dir = $base_upload_dir . DS . "Plan_" . $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); //main image if ($mainImage->isPosted()) { if (!JFolder::exists($upload_dir)) { JFolder::create($upload_dir); } $mainImage->setValidExtensions($validExtensions); $mainImage->setName('main.jpg'); if (!($fileName = $mainImage->moveTo($upload_dir))) { JError::raiseWarning(200, JText::_($mainImage->getError())); return false; } //make preview $this->_resizeImage($upload_dir . DS . $fileName, $upload_dir . DS . 'preview.jpg', null, $maxPreviewWidth, $jpgQuality); //make min $this->_resizeImage($upload_dir . DS . 'preview.jpg', $upload_dir . DS . 'min.jpg', $maxThumbnailHeight, $maxThumbnailWidth, $jpgQuality); } if ($secondImage->isPosted()) { $upload_dir = $upload_dir . DS . 'secondary'; $preview_dir = $upload_dir . DS . 'preview'; $thumbnail_dir = $upload_dir . DS . 'min'; if (!JFolder::exists($upload_dir)) { JFolder::create($upload_dir); } if (!JFolder::exists($preview_dir)) { JFolder::create($preview_dir); } if (!JFolder::exists($thumbnail_dir)) { JFolder::create($thumbnail_dir); } $secondImage->setValidExtensions($validExtensions); $secondImage->nameToSafe(); if (!($fileName = $secondImage->moveTo($upload_dir))) { JError::raiseWarning(200, JText::_($secondImage->getError())); return false; } //make preview $this->_resizeImage($upload_dir . DS . $fileName, $preview_dir . DS . $fileName, null, $maxPreviewWidth, $jpgQuality); //make min $this->_resizeImage($preview_dir . DS . $fileName, $thumbnail_dir . DS . $fileName, $maxThumbnailHeight, $maxThumbnailWidth, $jpgQuality); } if ($secondImage1->isPosted()) { $upload_dir = $base_upload_dir . DS . "Plan_" . $id; $upload_dir = $upload_dir . DS . 'secondary'; $preview_dir = $upload_dir . DS . 'preview'; $thumbnail_dir = $upload_dir . DS . 'min'; if (!JFolder::exists($upload_dir)) { JFolder::create($upload_dir); } if (!JFolder::exists($preview_dir)) { JFolder::create($preview_dir); } if (!JFolder::exists($thumbnail_dir)) { JFolder::create($thumbnail_dir); } $secondImage1->setValidExtensions($validExtensions); $secondImage1->nameToSafe(); if (!($fileName = $secondImage1->moveTo($upload_dir))) { JError::raiseWarning(200, JText::_($secondImage1->getError())); return false; } //make preview $this->_resizeImage($upload_dir . DS . $fileName, $preview_dir . DS . $fileName, null, $maxPreviewWidth, $jpgQuality); //make min $this->_resizeImage($preview_dir . DS . $fileName, $thumbnail_dir . DS . $fileName, $maxThumbnailHeight, $maxThumbnailWidth, $jpgQuality); } if ($secondImage2->isPosted()) { $upload_dir = $base_upload_dir . DS . "Plan_" . $id; $upload_dir = $upload_dir . DS . 'secondary'; $preview_dir = $upload_dir . DS . 'preview'; $thumbnail_dir = $upload_dir . DS . 'min'; if (!JFolder::exists($upload_dir)) { JFolder::create($upload_dir); } if (!JFolder::exists($preview_dir)) { JFolder::create($preview_dir); } if (!JFolder::exists($thumbnail_dir)) { JFolder::create($thumbnail_dir); } $secondImage2->setValidExtensions($validExtensions); $secondImage2->nameToSafe(); if (!($fileName = $secondImage2->moveTo($upload_dir))) { JError::raiseWarning(200, JText::_($secondImage2->getError())); return false; } //make preview $this->_resizeImage($upload_dir . DS . $fileName, $preview_dir . DS . $fileName, null, $maxPreviewWidth, $jpgQuality); //make min $this->_resizeImage($preview_dir . DS . $fileName, $thumbnail_dir . DS . $fileName, $maxThumbnailHeight, $maxThumbnailWidth, $jpgQuality); } if ($secondImage3->isPosted()) { $upload_dir = $base_upload_dir . DS . "Plan_" . $id; $upload_dir = $upload_dir . DS . 'secondary'; $preview_dir = $upload_dir . DS . 'preview'; $thumbnail_dir = $upload_dir . DS . 'min'; if (!JFolder::exists($upload_dir)) { JFolder::create($upload_dir); } if (!JFolder::exists($preview_dir)) { JFolder::create($preview_dir); } if (!JFolder::exists($thumbnail_dir)) { JFolder::create($thumbnail_dir); } $secondImage3->setValidExtensions($validExtensions); $secondImage3->nameToSafe(); if (!($fileName = $secondImage3->moveTo($upload_dir))) { JError::raiseWarning(200, JText::_($secondImage3->getError())); return false; } //make preview $this->_resizeImage($upload_dir . DS . $fileName, $preview_dir . DS . $fileName, null, $maxPreviewWidth, $jpgQuality); //make min $this->_resizeImage($preview_dir . DS . $fileName, $thumbnail_dir . DS . $fileName, $maxThumbnailHeight, $maxThumbnailWidth, $jpgQuality); } return true; }
/** * constructor * * @param array $config */ function __construct($config = array()) { parent::__construct($config); // Get the page/component configuration $this->params =& ComJea::getParams(); }
function getListingByRealtorId($id) { // get basic info $sql = "SELECT p.id, p.ref, p.price, p.price_unit AS `price_unit`, p.address, \n \t\t\t\t\t\tp.price_area_unit AS `price_area_unit`, p.living_space, \n \t\t\t\t\t\ta.value AS `area`, t.value AS `town`, p.kind_id AS `kind_id` " . " FROM #__jea_properties p" . PHP_EOL . "LEFT JOIN #__jea_areas AS a ON a.id = p.area_id" . PHP_EOL . "LEFT JOIN #__jea_towns AS t ON t.id = p.town_id" . PHP_EOL . "LEFT JOIN #__jea_price_units AS pu ON pu.id = p.price_unit" . PHP_EOL . "LEFT JOIN #__jea_price_area_units AS pau ON pau.id = p.price_area_unit" . PHP_EOL . "WHERE p.realtor_id = " . $id . PHP_EOL . "AND p.published = 1 " . PHP_EOL . "ORDER BY p.ordering"; $this->_db->setQuery($sql); $rows = $this->_db->loadObjectList(); foreach ($rows as $row) { // TODO: refractor --- get Itemid $Itemid = 1; if ($row->kind_id == 1) { $row->itemid = '10'; } else { if ($row->kind_id == 2) { $row->itemid = '11'; } else { if ($row->kind_id == 3) { $row->itemid = '12'; } else { if ($row->kind_id == 4) { $row->itemid = '13'; } } } } // make link $row->link = "index.php?option=com_jea&view=properties&id=" . $row->id . "&Itemid=" . $row->itemid; // get images $images_info = ComJea::getImagesById($row->id); if (!empty($images_info['main_image']['min_url'])) { $row->image = $images_info['main_image']['min_url']; } else { $row->image = "images/noimage.jpg"; } $priceStr = reFormatPrice($row->price) . $row->price_unit . '/' . $row->price_area_unit; $row->full_price = $priceStr; // format price } return $rows; }
// no direct access defined('_JEXEC') or die('Restricted access'); jimport('joomla.html.pane'); JHTML::stylesheet('jea.admin.css', 'media/com_jea/css/'); $pane =& JPane::getInstance('tabs'); ?> <?php echo $pane->startPane('jea_info'); echo $pane->startPanel(JText::_('About'), 'pan1'); ?> <img src="../media/com_jea/images/logo.png" alt="logo.png" style="float:left;margin-right: 50px" /> <p> <strong>Joomla Estate Agency <?php echo ComJea::version(); ?> </strong> </p> <p style="height:200px"> <?php echo JText::_('Main developer'); ?> : Sylvain Philip, contact@sphilip.com </p> <?php echo $pane->endPanel(); echo $pane->startPanel(JText::_('Licence'), 'pan2'); ?>
<?php /** * This file is part of Joomla Estate Agency - Joomla! extension for real estate agency * * @version 0.9 2009-10-14 * @package Jea.site * @copyright Copyright (C) 2008 PHILIP Sylvain. All rights reserved. * @license GNU/GPL, see LICENSE.php * Joomla Estate Agency is free software. This version may have been modified pursuant to the * GNU General Public License, and as distributed it includes or is derivative * of works licensed under the GNU General Public License or other free or open * source software licenses. * */ // no direct access //defined('_JEXEC') or die('Restricted access'); //defined('BDS-ThienMinh-117') or die('chua co BDS-ThienMinh-117'); require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'jea.class.php'; //add ACL $acl =& JFactory::getACL(); $acl->addACL('com_jea', 'edit', 'users', 'jea agent', 'property', 'own'); $acl->addACL('com_jea', 'edit', 'users', 'registered', 'property', 'own'); $acl->addACL('com_jea', 'edit', 'users', 'manager', 'property', 'all'); $acl->addACL('com_jea', 'edit', 'users', 'administrator', 'property', 'all'); $acl->addACL('com_jea', 'edit', 'users', 'super administrator', 'property', 'all'); ComJea::run('properties');