I´am working with Yii Framework
I am trying to make 3 DropdwnList in the create form of my Courses Model, but when I try to display one of them, It does not work
I have 3 models Courses (which is the model where I want to create with the form) Users (a list with the users) EnglishGroups (a list with the Groups) this is the one that is not working, here is my code
<?php
echo $form->labelEx($model,'english_groups_id');
echo $form->dropDownList($model,'english_groups_id', EnglishGroups::model()- >getEnglishGroupsList());?>
<?php
echo $form->labelEx($model,'courses_catalog_id');
echo $form->dropDownList($model,'courses_catalog_id', CoursesCatalog::model()->getCoursesCatalogList());
//var_dump(getCoursesCatalogList());?>
I already have getCoursesCatalogList(); and getEnglishGroups(); but the getEnglishGroups is not working, here is the code
<?php
...
public function getEnglishGroupsList()
{
$EnglishGroupsRows = EnglishGroups::model()->findAll(array('condition'=>'is_active = 1',"condition"=>"users_id = ".Yii::app()->user->id));
$ar = CHtml::listData($EnglishGroupsRows , 'id' , function($EnglishGroupsRows) {
return 'Course: ' . $EnglishGroupsRows->id;
});
$tmp[NULL] = "<Please select a Group>";
$ar = $tmp + $ar;
return $ar;
}
?>
any help please