Example #1
0
<?php

/* @var $this ScheduleController */
/* @var $model Schedule */
/* @var $form CActiveForm */
$dataProgram = Programs::model()->findAll();
$optionArrayPrograms = CHtml::listData($dataProgram, 'program_Id', 'program_Name');
$dataProfessor = Professors::model()->findAll();
$professorData = CHtml::listData($dataProfessor, 'professor_Id', 'fullName');
$roomData = ClassType::model()->with('room')->findAll();
$roomArray = CHtml::listData($roomData, 'class_Type_Id', 'room.room_Number');
?>

<div class="form">

<?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'schedule-form', 'enableAjaxValidation' => false));
$ajax = array('type' => 'GET', 'url' => $this->createUrl('schedule/getProfessorCource'), 'data' => array('id' => 'js:$(this).val()'), 'update' => '#Schedule_professor_Course_Id');
$ajax2 = array('type' => 'GET', 'url' => $this->createUrl('schedule/getClassType'), 'data' => array('id' => 'js:$(this).val()'), 'update' => '#Schedule_class_Type_Id');
?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php 
echo $form->errorSummary(array($model, $model2));
?>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'program_Id');
?>
 /**
  * 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 $id the ID of the model to be loaded
  * @return Professors the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Professors::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }