Example #1
0
 function kieu_compobox($param)
 {
     $onchang = $param['onchang'];
     $rows = U_reViewmanage::lay_du_lieu($param['table']);
     if ($param['table'] == 'quan_huyen') {
         $rows = U_reViewmanage::lay_du_lieu($param['table'], $param['is_town']);
     }
     // xu ly rieng cho truong hop danh sach loai bat dong san
     /*if ( $param['div_id'] == 'loai_bds_tkkv_id' )
     		{
     			$propertyModel = new U_reModelProperties(); 
     			$rows = $propertyModel->layDanhSachLoaiBDSTheoQuanHuyen( 'vi', JRequest::getVar('quan_huyen_id', 0), 
     														JRequest::getVar('tinh_thanh_id', 0) );
     		}
     		*/
     for ($i = 0; $i < count($rows); $i++) {
         // $rows[$i]['title'] = $rows[$i]['id'] . '-' . $rows[$i]['alias'];
         $rows[$i]['title'] = $rows[$i]['alias'];
     }
     $index = $param['index'];
     // print_r( $index );
     if (@$param['classname']) {
         $classname = $param['classname'];
     } else {
         $classname = "inputbox3";
     }
     if (isset($param['title'])) {
         $title = array('id' => 0, 'ten' => $param['title']);
         array_unshift($rows, $title);
         // array_unshift($rows, JHTML::_('select.option', 0, $param['title'] ));
     }
     if ($param['is_town'] == true) {
         if (JFactory::getURI()->getVar("town_id")) {
             $index = JFactory::getURI()->getVar("town_id");
         }
         if ($param['table'] == 'quan_huyen') {
             return JHTML::_('select.genericlist', $rows, $param['div_id'], 'class="' . $classname . '" size="1" ' . $onchang . 'multiple="multiple"', 'id', 'ten', $index);
         }
         return JHTML::_('select.genericlist', $rows, $param['div_id'], 'class="' . $classname . '" size="1" ' . $onchang, 'id', 'ten', $index);
     } else {
         return JHTML::_('select.genericlist', $rows, $param['div_id'], 'class="' . $classname . '" size="1" ' . $onchang, 'id', 'ten', $index);
     }
 }