Example #1
0
 /**  use for FE search and Member module
  * @Author: ANH DUNG Apr 07, 2014
  * @Todo: render ra select group cho property type
  * @Param: $name select
  * @Param: $id model user
  * @Param: $value value selected
  * @Param: $hasEmpty is string for empty value: ex: Select, All property types
  * @Return: string html select
  */
 public static function getOptionSelectGroupByParent($parent_id, $name, $id, $value = '', $hasEmpty = '', $classSelect = null)
 {
     $criteria = new CDbCriteria();
     $criteria->compare('t.status', STATUS_ACTIVE);
     //        $criteria->compare('t.parent_id', $parent_id);
     $criteria->order = 'parent_id ASC, name asc';
     $aPropertyType = ProPropertyType::model()->findAll($criteria);
     $strSelect = '<select  class="' . $classSelect . '" name=' . $name . ' id=' . $id . '>';
     $mPropertyType = new ProPropertyType();
     if (trim($hasEmpty) != '') {
         $strSelect .= "<option value=''>{$hasEmpty}</option>";
     }
     $mPropertyType->buildSelectGroup($parent_id, $aPropertyType, $value);
     $strSelect .= $mPropertyType->strOptionGroup;
     $strSelect .= '</select>';
     return $strSelect;
 }