?> </li> </ul> </div> <div class="clear"></div> <div class="emp_right_contner"> <div class="emp_tabwrapper"> <?php $this->renderPartial('tab'); ?> <div class="clear"></div> <div class="emp_cntntbx" > <?php $electives = StudentElectives::model()->findAll("student_id=:x", array(':x' => $_REQUEST['id'])); ?> <div class="tableinnerlist"> <table width="100%" cellpadding="0" cellspacing="0"> <tr> <th><?php echo Yii::t('students', 'Code'); ?> </th> <th><?php echo Yii::t('students', 'Subject'); ?> </th> <th><?php echo Yii::t('students', 'Actions'); ?>
} else { $displayed_flag = ''; 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) {
echo Yii::t('examination', '<i><span style="color:#E26214;">Elective not assigned</span></i> ') . CHtml::link('Add now', array('/courses/batches/elective', 'id' => $_REQUEST['id'])); ?> <?php } } ?> <?php echo $form->hiddenField($model, 'student_id[]', array('value' => $posts_1->id, 'id' => $posts_1->id)); ?> </td> <td><?php echo $sub->name; if ($sub->elective_group_id != "0") { $ele = StudentElectives::model()->findByAttributes(array('student_id' => $posts_1->id, 'batch_id' => $sub->batch_id, 'elective_group_id' => $sub->elective_group_id, 'status' => '1')); $elename = Electives::model()->findByAttributes(array('id' => $ele->elective_id)); $sub_name = "(" . @$elename->name . ")"; echo $sub_name; } ?> </td> <td><?php echo $form->textField($model, 'marks[]', array('size' => 7, 'maxlength' => 3, 'id' => $posts_1->id, 'onclick' => 'alertmessage()')); ?> </td> <td><?php echo $form->textField($model, 'remarks[]', array('size' => 30, 'maxlength' => 255, 'id' => $posts_1->id));
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new ExamScores(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['ExamScores'])) { $list = $_POST['ExamScores']; $count = count($list['student_id']); for ($i = 0; $i < $count; $i++) { if ($list['marks'][$i] != NULL or $list['remarks'][$i] != NULL) { $exam = Exams::model()->findByAttributes(array('id' => $_REQUEST['examid'])); $sub = Subjects::model()->findByAttributes(array('id' => $exam->subject_id)); // if elective not assigned if ($sub->elective_group_id != 0) { $studentelctive = StudentElectives::model()->findByAttributes(array('student_id' => $list['student_id'][$i])); if ($studentelctive == NULL) { Yii::app()->user->setFlash('error', 'Elective is not assigned for the student'); $this->redirect(array('examScores/create', 'id' => $_REQUEST['id'], 'examid' => $_REQUEST['examid'])); } else { $model = new ExamScores(); $model->exam_id = $list['exam_id']; $model->student_id = $list['student_id'][$i]; $model->marks = $list['marks'][$i]; $model->remarks = $list['remarks'][$i]; $model->grading_level_id = $list['grading_level_id']; if ($list['marks'][$i] < $exam->minimum_marks) { $model->is_failed = 1; } else { $model->is_failed = ''; } $model->created_at = $list['created_at']; $model->updated_at = $list['updated_at']; //$model->save(); if ($model->save()) { $student = Students::model()->findByAttributes(array('id' => $model->student_id)); $student_name = ucfirst($student->first_name) . ' ' . ucfirst($student->middle_name) . ' ' . ucfirst($student->last_name); $subject_name = Subjects::model()->findByAttributes(array('id' => $exam->subject_id)); $examgroup = ExamGroups::model()->findByAttributes(array('id' => $exam->exam_group_id)); $batch = Batches::model()->findByAttributes(array('id' => $examgroup->batch_id)); $exam = ucfirst($subject_name->name) . ' - ' . ucfirst($examgroup->name) . ' (' . ucfirst($batch->name) . '-' . ucfirst($batch->course123->course_name) . ')'; $goal_name = $student_name . ' for the exam ' . $exam; //Adding activity to feed via saveFeed($initiator_id,$activity_type,$goal_id,$goal_name,$field_name,$initial_field_value,$new_field_value) ActivityFeed::model()->saveFeed(Yii::app()->user->Id, '20', $model->id, $goal_name, NULL, NULL, NULL); } } } else { $model = new ExamScores(); $model->exam_id = $list['exam_id']; $model->student_id = $list['student_id'][$i]; $model->marks = $list['marks'][$i]; $model->remarks = $list['remarks'][$i]; $model->grading_level_id = $list['grading_level_id']; if ($list['marks'][$i] < $exam->minimum_marks) { $model->is_failed = 1; } else { $model->is_failed = ''; } $model->created_at = $list['created_at']; $model->updated_at = $list['updated_at']; //$model->save(); if ($model->save()) { $student = Students::model()->findByAttributes(array('id' => $model->student_id)); $student_name = ucfirst($student->first_name) . ' ' . ucfirst($student->middle_name) . ' ' . ucfirst($student->last_name); $subject_name = Subjects::model()->findByAttributes(array('id' => $exam->subject_id)); $examgroup = ExamGroups::model()->findByAttributes(array('id' => $exam->exam_group_id)); $batch = Batches::model()->findByAttributes(array('id' => $examgroup->batch_id)); $exam = ucfirst($subject_name->name) . ' - ' . ucfirst($examgroup->name) . ' (' . ucfirst($batch->name) . '-' . ucfirst($batch->course123->course_name) . ')'; $goal_name = $student_name . ' for the exam ' . $exam; //Adding activity to feed via saveFeed($initiator_id,$activity_type,$goal_id,$goal_name,$field_name,$initial_field_value,$new_field_value) ActivityFeed::model()->saveFeed(Yii::app()->user->Id, '20', $model->id, $goal_name, NULL, NULL, NULL); } } } } $this->redirect(array('examScores/create', 'id' => $_REQUEST['id'], 'examid' => $_REQUEST['examid'])); } $this->render('create', array('model' => $model)); }
public function actionRemoveelective() { StudentElectives::model()->deleteAllByAttributes(array('id' => $_REQUEST['eid'])); $this->redirect(array('studentelectives', 'id' => $_REQUEST['id'])); }
public function actionAjax_Create() { if (isset($_POST['StudentElectives'])) { $model = new StudentElectives(); //set the submitted values $model->attributes = $_POST['StudentElectives']; //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; } } }
?> <div class="table_listbx"> <?php if (isset($_REQUEST['id'])) { $criteria = new CDbCriteria(); $criteria->condition = 'batch_id=:x and status=:y'; $criteria->params = array(':x' => $_REQUEST['id'], ':y' => '1'); $criteria->order = '`id` desc'; $total = StudentElectives::model()->count($criteria); $pages = new CPagination($total); $pages->setPageSize(Yii::app()->params['listPerPage']); $pages->applyLimit($criteria); // the trick is here! $posts = StudentElectives::model()->findAll($criteria); $item_count = $total; $page_size = Yii::app()->params['listPerPage']; // $posts=StudentElectives::model()->findAll("batch_id=:x and status=:y", array(':x'=>$_REQUEST['id'],':y'=>'1')); if ($posts != NULL) { ?> <table width="100%" cellspacing="0" cellpadding="0" border="0"> <tr class="listbxtop_hdng"> <td class="listbx_subhdng"><?php echo Yii::t('Batch', 'Sl no.'); ?> </td> <td class="listbx_subhdng"><?php echo Yii::t('Batch', 'Student Name'); ?> </td>
public function actionAjax_delete() { $id = $_POST['id']; EmployeeElectiveSubjects::model()->deleteAllByAttributes(array('elective_id' => $id)); StudentElectives::model()->deleteAllByAttributes(array('elective_id' => $id)); //$timetable = TimetableEntries::model()->deleteAllByAttributes(array('subject_id'=>$subject->id)); $deleted = $this->loadModel($id); if ($deleted->delete()) { echo json_encode(array('success' => true)); exit; } else { echo json_encode(array('success' => false)); exit; } }
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; } }
public function actionRemoveelective() { if (isset($_REQUEST['elective']) and $_REQUEST['elective'] != NULL) { $StudentElectives = StudentElectives::model()->deleteAllByAttributes(array('id' => $_REQUEST['elective'])); $this->redirect(array('/students/students/electives', 'id' => $_REQUEST['id'])); } }
<div class="formCon"> <div class="formConInner"> <?php if (isset($_REQUEST['id']) and isset($_REQUEST['elective'])) { $posts = StudentElectives::model()->findAll("elective_id=:x and status=:y", array(':x' => $_REQUEST['elective'], ':y' => 1)); //$posts=Students::model()->findAll("batch_id=:x and is_active=:y and is_deleted=:z", array(':x'=>$_REQUEST['id'],':y'=>1,':z'=>0)); ?> <?php if ($posts != NULL) { ?> <?php $form = $this->beginWidget('CActiveForm', array('id' => 'exam-scores-form', 'enableAjaxValidation' => false)); ?> <h3><?php echo Yii::t('examination', 'Enter Exam Scores here:'); ?> </h3> <?php echo $form->hiddenField($model, 'exam_id', array('value' => $_REQUEST['examid'])); ?> <div class="tableinnerlist"> <table width="95%" cellspacing="0" cellpadding="0"> <?php $i = 1; $j = 0; foreach ($posts as $posts_1) {