public function actionAjaxJobTitles() { if (isset($_POST['jobCat'])) { $titles = CHtml::listData(JobTitle::getTitlesByCategory($_POST['jobCat'], Yii::app()->user->id), 'job_title_id', 'job_title_name'); if (empty($titles)) { echo CHtml::tag('label', array('class' => 'checkbox'), Yii::t('model', 'postResumeForm.jobTitles_empty'), true); } else { $model = new PostResumeForm(); echo CHtml::activeCheckBoxList($model, 'jobTitles', $titles, array('container' => '', 'separator' => '', 'template' => '<label class="checkbox">{input} {label}</label>')); } } }
?> </fieldset> <fieldset> <legend><?php echo Yii::t('view', 'resumePost.job_info_lb'); ?> </legend> <?php echo $form->dropDownListRow($model, 'jobCat', CHtml::listData(JobCat::getAllCategories(), 'job_cat_id', 'job_cat_name'), array('prompt' => Yii::t('model', 'postResumeForm.jobCat_empty'), 'ajax' => array('type' => 'POST', 'url' => $this->createUrl('resumePost/ajaxJobTitles'), 'update' => '#jobTitles .controls', 'data' => array('jobCat' => 'js:this.value')), 'class' => 'span9')); ?> <div id="jobTitles"> <?php echo $form->checkBoxListRow($model, 'jobTitles', CHtml::listData(JobTitle::getTitlesByCategory($model->jobCat, Yii::app()->user->id), 'job_title_id', 'job_title_name')); ?> </div> </fieldset> <div class="form-actions"> <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => Yii::t('view', 'form.post_lb'))); ?> <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'link', 'type' => 'link', 'label' => Yii::t('view', 'cancel_lb'), 'url' => $this->createUrl('index'))); ?>