Esempio n. 1
0
 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);
 }
Esempio n. 2
0
 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');
 }
Esempio n. 3
0
 function getItem()
 {
     $result = array();
     $row =& $this->getRow();
     if ($row->id == 0) {
         $row->published = 0;
         $row->dispo = '';
     }
     $imgs = ComJea::getImagesById($row->id, true);
     $rootURL = JURI::root();
     $this->_cat = '';
     if (!empty($imgs['main_image']) && is_array($imgs['main_image'])) {
         $imgs['main_image']['delete_url'] = $rootURL . 'administrator/index2.php?option=com_jea' . '&amp;controller=' . JRequest::getVar('controller', '') . '&amp;task=deleteimg&amp;id=' . $row->id . '&amp;cat=' . $this->_cat;
     }
     foreach ($imgs['secondaries_images'] as $k => $v) {
         $imgs['secondaries_images'][$k]['delete_url'] = $rootURL . 'administrator/index.php?option=com_jea' . '&amp;controller=' . JRequest::getVar('controller', '') . '&amp;task=deleteimg&amp;id=' . $row->id . '&amp;image=' . $v['name'] . '&amp;cat=' . $this->_cat;
     }
     $result['row'] = $row;
     return $result + $imgs;
 }
Esempio n. 4
0
 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;
 }
Esempio n. 5
0
 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;
 }