public function groupname($data, $row) { //print_r($data); $group = ElectiveGroups::model()->findByAttributes(array('id' => $data->elective_group_id)); return $group->name; }
}'))); ?> <?php echo $form->errorSummary($model, ' <div style="font-weight:bold">Please correct these errors:</div> ', NULL, array('class' => 'errorsum notification errorshow png_bg')); ?> <p class="note">Fields with <span class="required">*</span> are required.</p> <div class="row"> <?php echo $form->labelEx($model, 'elective_group_id', array('style' => 'color:#000000')); ?> <?php $models = ElectiveGroups::model()->findAll("is_deleted=:x and batch_id=:y", array(':x' => 0, ':y' => $_POST['batch_id'])); $data = array(); foreach ($models as $model_1) { $data[$model_1->id] = @$model_1->name; } ?> <?php echo $form->dropDownList($model, 'elective_group_id', $data, array('empty' => 'Select Group')); ?> <?php /*?><?php $data = CHtml::listData(ElectiveGroups::model()->findAll("is_deleted=:x", array(':x'=>0)),'id','name'); ?> <?php echo $form->labelEx($model,'elective_group_id', array('style'=>'color:#000000')); ?>
public function actionAjax_Create() { if (isset($_POST['ElectiveGroups'])) { $model = new ElectiveGroups(); //set the submitted values $model->attributes = $_POST['ElectiveGroups']; //return the JSON result to provide feedback. if ($model->save(false)) { echo json_encode(array('success' => true, 'id' => $model->primaryKey)); exit; } else { echo json_encode(array('success' => false)); exit; } } }
<?php for ($i = 0; $i < $count_timing; $i++) { echo ' <td class="td"> <div onclick="" style="position: relative; "> <div class="tt-subject"> <div class="subject">'; $set = TimetableEntries::model()->findByAttributes(array('batch_id' => $_REQUEST['id'], 'weekday_id' => $weekdays[6]['weekday'], 'class_timing_id' => $timing[$i]['id'], 'employee_id' => $employee->id)); if (count($set) == 0) { $is_break = ClassTimings::model()->findByAttributes(array('id' => $timing[$i]['id'], 'is_break' => 1)); if ($is_break != NULL) { echo Yii::t('teachersportal', 'Break'); } else { $set = TimetableEntries::model()->findByAttributes(array('batch_id' => $_REQUEST['id'], 'weekday_id' => $weekdays[6]['weekday'], 'class_timing_id' => $timing[$i]['id'], 'employee_id' => NULL)); $time_sub = Subjects::model()->findByAttributes(array('id' => $set->subject_id)); if ($time_sub->elective_group_id != 0) { $time_elective_group = ElectiveGroups::model()->findByAttributes(array('id' => $time_sub->elective_group_id)); $time_elective_sub = Electives::model()->findAllByAttributes(array('elective_group_id' => $time_elective_group->id)); foreach ($time_elective_sub as $elective_sub) { //echo $elective_sub->name; $emp_elective_sub = EmployeeElectiveSubjects::model()->findByAttributes(array('elective_id' => $elective_sub->id, 'employee_id' => $employee->id)); if (count($emp_elective_sub) == 1) { echo $time_elective_group->name . '<br>'; echo '(' . $elective_sub->name . ')<br>'; echo '<div class="employee">' . ucfirst($employee->first_name) . '</div>'; } else { continue; } } //echo $time_elective_group->name.'<br>'; } }
$data2 = CHtml::listData(Batches::model()->findAll("is_deleted=:x", array(':x' => 0), array('order' => 'name DESC')), 'id', 'name'); if (isset($_REQUEST['bid'])) { $sel = $_REQUEST['bid']; } else { $sel = ''; } echo '<div class="formCon"><div class="formConInner"><div style="float:left; width:380px;"><span style="font-size:14px; font-weight:bold; color:#666;">Batch</span> '; echo CHtml::dropDownList('bid', '', $data2, array('prompt' => 'Select', 'onchange' => 'coursename()', 'id' => 'bid', 'options' => array($sel => array('selected' => true)))); echo '</div>'; echo '<div style="float:left; width:300px;"><span style="font-size:14px; font-weight:bold; color:#666;">Subject</span> '; ?> <?php $data_2 = array(); if (isset($_REQUEST['bid'])) { $batches = ElectiveGroups::model()->findAll("batch_id=:x and is_deleted=:y", array(':x' => $_REQUEST['bid'], ':y' => 0)); /*$data_1=Subjects::model()->findAll(array('join' => 'JOIN batches ON batch_id = batches.id','condition'=>'batches.course_id=:id', 'params'=>array(':id'=>(int) $_REQUEST['cou'])));*/ $data_2 = CHtml::listData(Electives::model()->findAll(array('join' => 'JOIN elective_groups ON elective_group_id = elective_groups.id', 'condition' => 'elective_groups.batch_id=:id', 'params' => array(':id' => (int) $_REQUEST['bid']))), 'id', 'name'); } if (isset($_REQUEST['elect'])) { $sel_1 = $_REQUEST['elect']; } else { $sel_1 = ''; } echo CHtml::dropDownList('elective', '', $data_2, array('prompt' => 'Select', 'id' => 'elect', 'onchange' => 'batchname()', 'options' => array($sel_1 => array('selected' => true)))); echo '<br/></div><div class="clear"></div></div></div>'; if (isset($_REQUEST['elect'])) { $emp_electsub = EmployeeElectiveSubjects::model()->findAll("elective_id=:x", array(':x' => $_REQUEST['elect'])); if (count($emp_electsub) == 0) { echo '<br> <br>' . Yii::t('employees', '<i>No Employee assigned yet.</i>') . '<br> <br>';
/** * 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 = ElectiveGroups::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function actionAjax_Create() { if (isset($_POST['ElectiveGroups'])) { $model = new ElectiveGroups(); $subject = new Subjects(); //set the submitted values $model->attributes = $_POST['ElectiveGroups']; //return the JSON result to provide feedback. if ($model->save(false)) { $subject->name = $model->name; $subject->code = $model->code; $subject->batch_id = $model->batch_id; $subject->no_exams = 0; $subject->max_weekly_classes = 3; $subject->elective_group_id = $model->id; $subject->is_deleted = 0; $subject->created_at = date('Y-m-d h:i:s'); $subject->save(); echo json_encode(array('success' => true, 'id' => $model->primaryKey)); exit; } else { echo json_encode(array('success' => false)); exit; } } }
</tr> <?php if ($electives == NULL) { echo '<tr><td align="center" colspan="4"><i>' . Yii::t('studentportal', 'No Assessments') . '</i></td></tr>'; } else { $displayed_flag = ''; foreach ($electives as $elective) { $exm = ElectiveExams::model()->findByAttributes(array('id' => $elective->exam_id)); $group = ExamGroups::model()->findByAttributes(array('id' => $exm->exam_group_id, 'result_published' => 1)); if ($group != NULL and count($group) > 0) { echo '<tr>'; if ($exm != NULL) { $displayed_flag = 1; //$group=ExamGroups::model()->findByAttributes(array('id'=>$exm->exam_group_id)); echo '<td>' . $group->name . '</td>'; $sub = ElectiveGroups::model()->findByAttributes(array('id' => $exm->elective_id)); echo '<td>' . $sub->name . '</td>'; echo '<td>' . $elective->marks . '</td>'; echo '<td>'; if ($elective->remarks != NULL) { echo $elective->remarks; } else { echo '-'; } echo '</td>'; if ($elective->is_failed == NULL) { echo '<td>' . Yii::t('parentportal', 'Passed') . '</td>'; } else { echo '<td>' . Yii::t('parentportal', 'Failed') . '</td>'; } }
?> </td> <td><?php echo $model->name; ?> </td> </tr> <tr> <td><?php echo Yii::t('Electives', 'Subject Code'); ?> </td> <td><?php echo $model->code; ?> </td> </tr> <tr> <td><?php echo Yii::t('Electives', 'Elective Group'); ?> </td> <td><?php $posts = ElectiveGroups::model()->findByAttributes(array('id' => $model->elective_group_id)); echo $posts->name; ?> </td> </tr> </table> </div>
$this->renderPartial('tab'); ?> <?php $this->beginWidget('CActiveForm'); ?> <div class="formCon" style="margin-bottom:10px; position:relative;margin-top:10px;"> <div class="formConInner"> <table width="42%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><strong><?php echo Yii::t('Batch', 'Select Group'); ?> </strong></td> <td><?php //$data1 = CHtml::listData(ElectiveGroups::model()->findAll('batch_id=:cid and is_deleted=:x',array(':cid'=>$_REQUEST['id'],':x'=>0)),'id','name'); $data1 = CHtml::listData(ElectiveGroups::model()->findAll(array('order' => 'name ASC', 'condition' => 'batch_id=:cid and is_deleted=:x', 'params' => array(':cid' => $_REQUEST['id'], ':x' => 0))), 'id', 'name'); echo CHtml::dropDownList('elective_group_id', '', $data1, array('prompt' => Yii::t('Batch', 'Select'), 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('/courses/electives/electivename'), 'update' => '#elective_id', 'data' => 'js:$(this).serialize()'), 'style' => 'width:270px;')); // echo CHtml::dropDownList('elective_id','',$data1,array('prompt'=>'Select','id'=>'elective_id1')); ?> </td> <td> </td> </tr> <tr> <td><strong><?php echo Yii::t('Batch', 'Select Subject'); ?> </strong></td> <td><?php echo CHtml::dropDownList('elective_id', '', $data, array('prompt' => 'Select', 'id' => 'elective_id')); ?>