예제 #1
0
 function getlistproperties()
 {
     jimport('joomla.html.pagination');
     $this->assignRef('lang', $this->getLanguage());
     global $u_reGlobalConfig;
     // get return field
     $returnField = $u_reGlobalConfig['PROPERTY']['du_lieu_tra_ve'];
     $limit = $u_reGlobalConfig['PROPERTY']['list_limit'];
     $orderby = $u_reGlobalConfig['PROPERTY']['orderby'];
     $limitstart =& JRequest::getVar('limitstart', 0);
     $page = ($limitstart + $limit) / $limit;
     $propertiesModel = new U_ReModelProperties();
     $propertiesData = $propertiesModel->layDanhSachBatDongSan($returnField, $page, $limit, $this->lang, $orderby, 1);
     $this->assignRef('tongDong', $propertiesData['rows'][0]);
     $this->pagination = new JPagination($this->tongDong, $limitstart, $limit);
     $this->assignRef('rows', $propertiesData['rows'][3]);
     // print_r( $propertiesData );
     // exit;
     foreach ($this->rows as $k => $row) {
         $tien = array('gia' => $row['gia'], 'don_vi_tien_id' => $row['don_vi_tien_id'], 'don_vi_dien_tich_id' => $row['don_vi_dien_tich_id']);
         $gia = ilandCommonUtils::layGiaTien($tien);
         $this->rows[$k]['gia'] = $gia;
         // lay luot xem
         $this->rows[$k]['luot_xem'] = ilandCommonUtils::demLuotXemBDS($this->rows[$k]['id']);
     }
     $this->assignRef('loai_bds_id', $propertiesData['loai_bds_id']);
     $type = ilandCommonUtils::getSelectBox('loai_bds', 'loai_bds_id', JText::_('TYPE'), $this->loai_bds_id, 'onchange=document.adminForm.submit()');
     $this->assignRef('loai_bds', $type);
     $this->assignRef('town_id', $propertiesData['town_id']);
     $towns = ilandCommonUtils::getSelectBox('tinh_thanh', 'town_id', JText::_('TOWNS'), $this->town_id, 'onchange=document.adminForm.submit()');
     $this->assignRef('towns', $towns);
     $this->assignRef('area_id', $propertiesData['area_id']);
     $areas = ilandCommonUtils::getSelectBox('quan_huyen', 'area_id', JText::_('AREAS'), $this->area_id, 'onchange=document.adminForm.submit()', $this->town_id);
     $this->assignRef('areas', $areas);
     $this->assignRef('emphasis', $propertiesData['emphasis']);
     $this->assignRef('published', $propertiesData['published']);
     $this->assignRef('search', $propertiesData['search']);
     // get template
     $currentTemplate = JFactory::getApplication()->getTemplate();
     $templatePath = JPATH_THEMES . DS . $currentTemplate . DS . "html" . DS . "com_u_re" . DS . "properties";
     $this->addTemplatePath($templatePath);
     $this->setLayout($u_reGlobalConfig['PROPERTY']['dang_tin_fontend_template']);
     parent::display();
 }
예제 #2
0
 function getlistproperties()
 {
     global $u_reGlobalConfig;
     $backEndList = $u_reGlobalConfig['IFRAME']['backEndList'];
     if ($backEndList == 1) {
         // echo "<strong><a href='index.php?option=com_jea&controller=properties&task=add'>".JText::_('ADD_NEW_PROPERTY')."</a></strong>";
         $templatePath = "../templates/mlbds/html/com_u_re/properties/";
         $this->addTemplatePath($templatePath);
         $this->setLayout('admin_list');
     } else {
         jimport('joomla.html.pagination');
         $cat =& JRequest::getVar('cat', '');
         //JToolBarHelper::title( JText::_( ucfirst( $this->get('category') ) . ' management' ), 'jea.png' );
         JToolBarHelper::title(JText::_(ucfirst($cat) . ' management'), 'jea.png');
         JToolBarHelper::publish('unspamlist', 'Bỏ qua sai phạm');
         JToolBarHelper::publish();
         JToolBarHelper::unpublish();
         JToolBarHelper::addNew();
         JToolBarHelper::editList();
         JToolBarHelper::deleteList(JText::_('CONFIRM_DELETE_MSG'));
         $this->assignRef('lang', $this->getLanguage());
         $this->assignRef('cat', $cat);
         // get return field
         $returnField = $u_reGlobalConfig['PROPERTY']['du_lieu_tra_ve'];
         $returnField .= ',da_ban';
         $limit = $u_reGlobalConfig['PROPERTY']['list_limit'];
         $orderby = $u_reGlobalConfig['PROPERTY']['orderby'];
         $limitstart =& JRequest::getVar('limitstart', 0);
         $page = ($limitstart + $limit) / $limit;
         $propertiesModel = new U_ReModelProperties();
         $propertiesData = $propertiesModel->layDanhSachBatDongSan($returnField, $page, $limit, $this->lang, $orderby);
         $this->assignRef('tongDong', $propertiesData['rows'][0]);
         $this->pagination = new JPagination($this->tongDong, $limitstart, $limit);
         $this->assignRef('rows', $propertiesData['rows'][3]);
         $db = JFactory::getDBO();
         if (!empty($this->rows)) {
             foreach ($this->rows as $k => $row) {
                 $id = $row['id'];
                 $mainImage = ilandCommonUtils::getPropertyMainImage($id);
                 $subImages = ilandCommonUtils::getPropertySubImages($id);
                 if (!is_file($mainImage['isfile'])) {
                     $mainImage['max_url'] = JURI::root() . "images/noimage.jpg";
                 }
                 $this->rows[$k]['hinhanh1'] = $mainImage;
                 $this->rows[$k]['hinhanh'] = $subImages;
                 $tien = array('gia' => $row['gia'], 'don_vi_tien_id' => $row['don_vi_tien_id'], 'don_vi_dien_tich_id' => $row['don_vi_dien_tich_id']);
                 $gia = ilandCommonUtils::layGiaTien($tien);
                 $this->rows[$k]['gia'] = $gia;
                 $query = "SELECT username FROM jos_users WHERE id=" . $row['ma_nguoi_dang'];
                 $db->setQuery($query);
                 $tennguoidang = $db->loadRow();
                 $this->rows[$k]['ten_nguoi_dang'] = $tennguoidang[0];
             }
         }
         $this->assignRef('loai_bds_id', $propertiesData['loai_bds_id']);
         $type = ilandCommonUtils::getSelectBox('loai_bds', 'loai_bds_id', JText::_('TYPE'), $this->loai_bds_id, 'onchange=document.adminForm.submit()');
         $this->assignRef('loai_bds', $type);
         $this->assignRef('town_id', $propertiesData['town_id']);
         $towns = ilandCommonUtils::getSelectBox('tinh_thanh', 'town_id', JText::_('TOWNS'), $this->town_id, 'document.adminForm.submit()');
         $this->assignRef('towns', $towns);
         $this->assignRef('area_id', $propertiesData['area_id']);
         $areas = ilandCommonUtils::getSelectBox('quan_huyen', 'area_id', JText::_('AREAS'), $this->area_id, 'onchange=document.adminForm.submit()', $this->town_id);
         $this->assignRef('areas', $areas);
         $this->assignRef('emphasis', $propertiesData['emphasis']);
         $this->assignRef('published', $propertiesData['published']);
         $this->assignRef('spam', $propertiesData['spam']);
         $this->assignRef('search', $propertiesData['search']);
     }
     parent::display();
 }