public function __construct($collegeId) { $this->thread = new Thread(); $this->postItem = new PostItem(); $this->postItem->post_type_id = 7; // type Thread $this->thread->college_id = $collegeId; $this->collegeName = College::model()->findByPk($collegeId)->college_name; }
public static function getProgramsByCollege($college_id) { $college = College::model()->cache(Yii::app()->params['dbCacheInterval'])->findByPk($college_id); if ($college != null) { return $college->programs; } else { return array(); } }
<legend><?php echo Yii::t('view', 'account_info_lb'); ?> </legend> <?php $this->renderPartial('application.modules.account.views.common.register._form', array('model' => $model, 'form' => $form)); ?> </fieldset> <fieldset> <legend><?php echo Yii::t('view', 'student_info_lb'); ?> </legend> <?php echo $form->dropDownListRow($model->student, 'college_id', CHtml::listData(College::model()->findAll(), 'college_id', 'college_name'), array('prompt' => Yii::t('model', 'student.college_id_empty'), 'ajax' => array('type' => 'POST', 'url' => $this->createUrl('register/ajaxCollegePrograms'), 'update' => '#' . CHtml::activeId($model->student, 'program_id'), 'data' => array('college' => 'js:this.value')))); ?> <!-- <?php echo $form->dropDownListRow($model->student, 'program_id', CHtml::listData(College::getProgramsByCollege($model->student->college_id), 'program_id', 'program_name'), array('prompt' => Yii::t('model', 'student.program_id_empty'))); ?> <?php echo $form->textFieldRow($model->student, 'program_code'); ?> --> <?php echo $form->dropDownListRow($model->student, 'education_level_id', CHtml::listData(EducationLevel::model()->findAll(), 'education_level_id', 'education_level_name'), array('prompt' => Yii::t('model', 'student.education_level_id_empty'))); ?> <?php echo $form->textFieldRow($model->student, 'major_name'); ?>
/** * 获取用户的大学学校信息 * @param unknown_type $uid */ public function getUserUniversity($uid = null) { $model = self::getProfileModel($uid); return College::model()->getCollege($model->profiles->university); }
?> <span><a href="<?php echo $this->createUrl('ehighschool'); ?> " id="chighschool" onclick="showAddress(this.href);return false;">修改</a></span> <?php echo $form->error($model, 'highschool'); ?> </div> <hr class="space" /> <div class="row"> <?php echo $form->labelEx($model, 'university'); ?> <span id="universityHolder"><?php echo College::model()->getCollegeName($model->university); ?> </span> <?php echo $form->hiddenField($model, 'university', array('size' => 20, 'maxlength' => 20, 'class' => 'span-9 poshy', 'title' => '您就读的大学')); ?> <span><a href="<?php echo $this->createUrl('euniversity'); ?> " id="cuniversity" onclick="showAddress(this.href);return false;">修改</a></span> <?php echo $form->error($model, 'university'); ?> </div> <hr class="space" /> <div class="row">
echo $form->textFieldRow($model->user, 'last_name', array('class' => 'span5', 'maxlength' => 20)); ?> <?php echo $form->passwordFieldRow($model->user, 'password', array('class' => 'span5', 'maxlength' => 255)); ?> <?php echo $form->passwordFieldRow($model, 'confirmPassword', array('class' => 'span5', 'maxlength' => 255)); ?> <?php echo $form->hiddenField($model->user, 'user_group_id'); ?> <?php echo $form->hiddenField($model, 'consented', array('value' => '1')); ?> <?php echo $form->dropDownListRow($model->collegeAdmin, 'college_id', CHtml::listData(College::model()->findAll(), 'college_id', 'college_name'), array('prompt' => Yii::t('model', 'student.college_id_empty'))); ?> <div class="form-actions"> <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => 'Create')); ?> </div> <?php $this->endWidget();
/** * 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 = College::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }