/** * 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 = Electives::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
foreach ($exam as $exams) { $exm = Exams::model()->findByAttributes(array('id' => $exams->exam_id)); $group = ExamGroups::model()->findByAttributes(array('id' => $exm->exam_group_id, 'result_published' => 1)); $grades = GradingLevels::model()->findAllByAttributes(array('batch_id' => $exams->grading_level_id)); $t = count($grades); 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 = Subjects::model()->findByAttributes(array('id' => $exm->subject_id)); if ($sub->elective_group_id != 0 and $sub->elective_group_id != NULL) { $student_elective = StudentElectives::model()->findByAttributes(array('student_id' => $student->id)); if ($student_elective != NULL) { $electname = Electives::model()->findByAttributes(array('id' => $student_elective->elective_id, 'elective_group_id' => $sub->elective_group_id)); if ($electname != NULL) { echo '<td>' . $electname->name . '</td>'; } } } else { echo '<td>' . $sub->name . '</td>'; } if ($group->exam_type == 'Marks') { echo "<td>" . $exams->marks . "</td>"; } else { if ($group->exam_type == 'Grades') { echo "<td>"; foreach ($grades as $grade) { if ($grade->min_score <= $exams->marks) { $grade_value = $grade->name;
<th><?php echo Yii::t('students', 'Subject'); ?> </th> <th><?php echo Yii::t('students', 'Actions'); ?> </th> </tr> <?php if ($electives != NULL) { foreach ($electives as $elective) { echo '<tr>'; $group = Electives::model()->findByAttributes(array('id' => $elective->elective_id)); echo '<td>' . $group->code . '</td>'; echo '<td>' . $group->name . '</td>'; echo '<td>' . CHtml::link('Remove', array('removeelective', 'elective' => $elective->id, 'id' => $_REQUEST['id']), array('confirm' => 'Are you sure you want to remove elective?')) . '</td>'; echo '</tr>'; } } else { echo '<tr>'; echo '<td colspan="4"> No Electives assigned!</td>'; echo '<tr>'; } ?> </table> </div> </div> </div>
} 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>'; } else { ?>
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>'; } } } else {
echo Yii::t('Batch', 'Elective'); ?> </td> <td class="listbx_subhdng"><?php echo Yii::t('Batch', 'Action'); ?> </td> </tr> <?php $i = 0; $elective_flag = 0; foreach ($posts as $posts_1) { $student = Students::model()->findByAttributes(array('id' => $posts_1->student_id, 'batch_id' => $_REQUEST['id'], 'is_deleted' => '0', 'is_active' => '1')); if ($student) { $elective_flag = 1; $elective = Electives::model()->findByAttributes(array('id' => $posts_1->elective_id)); $group = ElectiveGroups::model()->findByAttributes(array('id' => $elective->elective_group_id)); $i++; echo '<tr>'; echo '<td>' . $i . '</td>'; echo '<td>' . CHtml::link(ucfirst($student->first_name) . ' ' . ucfirst($student->middle_name) . ' ' . ucfirst($student->last_name), array('/students/students/view', 'id' => $student->id)) . '</td>'; echo '<td>' . $student->admission_no . '</td>'; ?> <td><?php echo $group->name; ?> </td> <td><?php echo $elective->name; ?> </td>
public function actionElectivename() { if (isset($_POST['elective_group_id'])) { $data = Electives::model()->findAll('elective_group_id=:x', array(':x' => $_POST['elective_group_id'])); } echo CHtml::tag('option', array('value' => 0), CHtml::encode('Select'), true); $data = CHtml::listData($data, 'id', 'name'); foreach ($data as $value => $title) { echo CHtml::tag('option', array('value' => $value), CHtml::encode($title), true); } }
public function actionAssign() { $model = new EmployeeElectiveSubjects(); $elective = Electives::model()->findByAttributes(array('id' => $_REQUEST['elect'])); $subject = Subjects::model()->findByAttributes(array('elective_group_id' => $elective->elective_group_id)); $model->employee_id = $_REQUEST['emp_id']; $model->elective_id = $_REQUEST['elect']; $model->subject_id = $subject->id; $model->save(); $this->redirect(array('employeesSubjects/create', 'bid' => $_REQUEST['bid'], 'elect' => $_REQUEST['elect'], 'dep' => $_REQUEST['dep'])); }
public function actionAjax_delete() { $id = $_POST['id']; $deleted = $this->loadModel($id); if ($deleted->delete()) { $subject = Subjects::model()->findByAttributes(array('elective_group_id' => $id)); TimetableEntries::model()->deleteAllByAttributes(array('subject_id' => $subject->id)); Exams::model()->deleteAllByAttributes(array('subject_id' => $subject->id)); EmployeeElectiveSubjects::model()->deleteAllByAttributes(array('subject_id' => $subject->id)); $elect = Electives::model()->findAllByAttributes(array('elective_group_id' => $id)); foreach ($elect as $ele) { StudentElectives::model()->deleteAllByAttributes(array('elective_id' => $ele->id)); $ele->delete(); } $subject->delete(); echo json_encode(array('success' => true)); exit; } else { echo json_encode(array('success' => false)); exit; } }