/** * This method returns the array of amenity for a particular projectId. * Returns the array of amenity names using amenity_id as index if amenities for given projectid is successfully found. * Returns false if not found. * * @param string $projectId * @return array|boolean */ public static function getAmenitiesForProject($projectId) { $models = CategoryAmenities::model()->findAllBySql("SELECT * FROM category_amenities where id IN\n\t\t(SELECT amenity_id FROM project_amenities WHERE project_id=:projectId)", array(':projectId' => $projectId)); $result = array(); if ($models) { foreach ($models as $obj) { $result["{$obj->id}"] = $obj->amenity; } return $result; } else { return false; } }
</li> <li class="error_message"><?php echo $form->error($modelAmenities, 'amenity_id'); ?> </li> </ul> <ul> <li><span><label for="Property_description" class="required">External Amenities <span class="required">*</span></label></span> <?php //echo $form->dropdownList($propertyAmenities,'amenity_id[]',CHtml::listData(CategoryAmenities::model()->findAll(),'id','amenity'),array('size'=>'5','multiple'=>'multiple','id'=>'amenities-multi')) ?> <div class="multi_checkbox avg"> <?php $amenities = isset($_POST['amenity_id']) ? $_POST['amenity_id'] : null; echo CHtml::checkBoxList('amenity_id', $amenities, CHtml::listData(CategoryAmenities::model()->findAll('amenity_type=:amenityType', array(':amenityType' => '1')), 'id', 'amenity')); ?> </div> </li> <li class="error_message"><?php echo $form->error($modelAmenities, 'amenity_id'); ?> </li> </ul>
echo CHtml::activeCheckBoxList($propertyAmenities, 'houseAmenities', CHtml::listData(CategoryAmenities::model()->findAll('amenity_type=:amenityType', array(':amenityType' => '0')), 'id', 'amenity')); ?> </div> </li> <li class="error_message"><?php echo CHtml::error($propertyAmenities, 'houseAmenities'); ?> </li> </ul> <ul> <li><span><label for="Property_description" class="required">External Amenities <span class="required"></span></label></span> <?php //echo CHtml::activeDropdownList($propertyAmenities,'amenity_id[]',CHtml::listData(CategoryAmenities::model()->findAll(),'id','amenity'),array('size'=>'5','multiple'=>'multiple','id'=>'amenities-multi')) ?> <div class="multi_checkbox avg"><?php echo CHtml::activeCheckBoxList($propertyAmenities, 'externalAmenities', CHtml::listData(CategoryAmenities::model()->findAll('amenity_type=:amenityType', array(':amenityType' => '1')), 'id', 'amenity')); ?> </div> </li> <li class="error_message"><?php echo CHtml::error($propertyAmenities, 'externalAmenities'); ?> </li> </ul> </fieldset> <?php break; } ?>
<li> <h3>Property Features</h3> <div class="acc-section"> <table width="92%" border="0" cellpadding="0" cellspacing="0" align="center"> <tr> <td><label>Type of Ownership</label> <?php echo $form->dropdownList($modelProject, 'ownership_type_id', CHtml::listData(CategoryOwnershipTypes::model()->findAll(), 'id', 'ownership_type'), array('empty' => 'All')); ?> </td> </tr> <tr> <td><label>Amenities</label><br /> <div class="multi_checkbox med"> <?php $property_type_id = isset($_POST['property_type_id']) ? $_POST['property_type_id'] : null; echo CHtml::checkBoxList('amenity_id', $amenities, CHtml::listData(CategoryAmenities::model()->findAll(), 'id', 'amenity'), array('size' => '5', 'multiple' => 'multiple', 'id' => 'project-amenities-multi')); ?> </div> </td> </tr> </table> </div> </li> <li> <h3>Others</h3> <div class="acc-section"> <table align="center" width="94%"> <tr> <td>Posted by <table width="92%" border="0"> <tr>
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = CategoryAmenities::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public static function amenityList() { $model = CategoryAmenities::model()->findAll(); $amenityList = null; foreach ($model as $amenity) { $amenityList[$amenity->id] = $amenity->amenity; } return $amenityList; }
echo CHtml::activeDropDownList($modelProperty, 'transaction_type_id', CHtml::listData(PropertyTransactionTypes::model()->findAll(), 'id', 'transaction_type'), array('class' => 'select_box', 'empty' => 'All')); ?> </td> </tr> <tr> <td><label>Age Of Construction</label><br /> <?php echo CHtml::activeDropDownList($modelProperty, 'age_of_construction', CHtml::listData(PropertyAgeOfConstruction::model()->findAll(), 'id', 'age'), array('empty' => 'All', 'class' => 'select_box')); ?> </td> </tr> <tr> <td><label>Type of Ownership</label> <?php echo CHtml::activeDropDownList($modelProperty, 'ownership_type_id', CHtml::listData(CategoryOwnershipTypes::model()->findAll(), 'id', 'ownership_type'), array('empty' => 'All', 'class' => 'select_box')); ?> </td> </tr> <tr> <td><label>Amenities</label><br /> <div class="multi_checkbox med"><?php //$amenities = isset($_POST['amenity_id'])? $_POST['amenity_id'] : null; echo CHtml::activeCheckBoxList($propertyAmenities, 'amenity_id', CHtml::listData(CategoryAmenities::model()->findAll(), 'id', 'amenity'), array('size' => '5', 'multiple' => 'multiple', 'id' => 'amenities-multi')); //echo CHtml::checkBoxList('amenity_id',$amenities,CHtml::listData(CategoryAmenities::model()->findAll(),'id','amenity'),array('size'=>'5','multiple'=>'multiple','id'=>'amenities-multi')); ?> </div> </td> </tr> </table> <?php break; }
public static function getAmenitiesById($amenitiesId) { return DbUtils::getDbValues(new CategoryAmenities(), 'id', $amenitiesId, 'amenity '); $models = CategoryAmenities::model()->findAllBySql("SELECT * FROM category_amenities where id IN\n\t\t(SELECT amenity_id FROM property_amenities WHERE property_id=:propertyId)", array(':propertyId' => $propertyId)); }