/** * 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'])); $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(); } } $this->redirect(array('examScores/create', 'id' => $_REQUEST['id'], 'examid' => $_REQUEST['examid'])); } $this->render('create', array('model' => $model)); }
<div class="edit_bttns" style="width:250px; top:-10px; right:-123px;"> <ul> <li> <?php echo CHtml::link('<span>' . Yii::t('examination', 'Clear All Scores') . '</span>', array('examScores/deleteall', 'id' => $_REQUEST['id'], 'examid' => $_REQUEST['examid']), array('class' => 'addbttn last', 'confirm' => Yii::t('examination', 'Are You Sure? All Scores will be deleted.'))); ?> </li> </ul> <div class="clear"></div> </div> </div> <?php $exm = Exams::model()->findByAttributes(array('id' => $_REQUEST['examid'])); $examgroups = ExamGroups::model()->findByAttributes(array('id' => $exm->exam_group_id)); if ($examgroups->exam_type == 'Marks') { $checkscores = ExamScores::model()->findByAttributes(array('exam_id' => $_REQUEST['examid'])); if ($checkscores != NULL) { $this->widget('zii.widgets.grid.CGridView', array('id' => 'exam-scores-grid', 'dataProvider' => $model1->search(), 'pager' => array('cssFile' => Yii::app()->baseUrl . '/css/formstyle.css'), 'cssFile' => Yii::app()->baseUrl . '/css/formstyle.css', 'columns' => array(array('header' => Yii::t('examination', 'Student Name'), 'value' => array($model, 'studentname'), 'name' => 'firstname', 'sortable' => true), 'marks', 'remarks', array('class' => 'CButtonColumn', 'buttons' => array('update' => array('label' => 'update', 'url' => 'Yii::app()->createUrl("/courses/examScores/update", array("sid"=>$data->id,"examid"=>$data->exam_id,"id"=>$_REQUEST["id"]))')), 'template' => '{update} {delete}', 'afterDelete' => 'function(){window.location.reload();}')))); } } else { if ($examgroups->exam_type == 'Grades') { $checkscores = ExamScores::model()->findByAttributes(array('exam_id' => $_REQUEST['examid'])); if ($checkscores != NULL) { $this->widget('zii.widgets.grid.CGridView', array('id' => 'exam-scores-grid', 'dataProvider' => $model1->search(), 'pager' => array('cssFile' => Yii::app()->baseUrl . '/css/formstyle.css'), 'cssFile' => Yii::app()->baseUrl . '/css/formstyle.css', 'columns' => array(array('header' => Yii::t('examination', 'Student Name'), 'value' => array($model, 'studentname'), 'name' => 'firstname', 'sortable' => true), 'marks', array('header' => 'Grades', 'value' => array($model, 'getgradinglevel'), 'name' => 'grading_level_id'), 'remarks', array('class' => 'CButtonColumn', 'buttons' => array('update' => array('label' => 'update', 'url' => 'Yii::app()->createUrl("/courses/examScores/update", array("sid"=>$data->id,"examid"=>$data->exam_id,"id"=>$_REQUEST["id"]))')), 'template' => '{update} {delete}', 'afterDelete' => 'function(){window.location.reload();}')))); } } else { $checkscores = ExamScores::model()->findByAttributes(array('exam_id' => $_REQUEST['examid'])); if ($checkscores != NULL) {
public function actionAssessmentSMS() { $model_1 = new ExamGroups(); $criteria = new CDbCriteria(); if (isset($_POST['search'])) { if (isset($_POST['ExamGroups']['id']) && $_POST['ExamGroups']['id'] != NULL) { $criteria->condition = 'exam_group_id LIKE :match'; $criteria->params = array(':match' => $_POST['ExamGroups']['id'] . '%'); } $criteria->order = 'id ASC'; $total = Exams::model()->count($criteria); $pages = new CPagination($total); $pages->setPageSize(Yii::app()->params['listPerPage']); $pages->applyLimit($criteria); // the trick is here! $posts = Exams::model()->findAll($criteria); $this->render('assessmentsms', array('model_1' => $model_1, 'list' => $posts, 'batch_id' => $_POST['batch'], 'group_id' => $_POST['ExamGroups']['id'])); } else { $this->render('assessmentsms', array('model_1' => $model_1)); } }
</th> <th style="width:100px;"><?php echo Yii::t('report', 'Mark'); ?> </th> <th style="width:100px;"><?php echo Yii::t('report', 'Grade'); ?> </th> <th style="width:200px;"><?php echo Yii::t('report', 'Remarks'); ?> </th> </tr> <?php $exams = Exams::model()->findAll('exam_group_id=:x', array(':x' => $_REQUEST['exam_group_id'])); // Selecting exams(subjects) in an exam group if ($exams != NULL) { foreach ($exams as $exam) { $subject = Subjects::model()->findByAttributes(array('id' => $exam->subject_id)); if ($subject != NULL) { ?> <tr> <td> <?php if ($subject->name != NULL) { echo ucfirst($subject->name); } else { continue; } ?>
<?php } ?> <!--<?php echo Yii::t('students', 'Adm No.'); ?> --> <!--<?php echo Yii::t('students', 'Name'); ?> --> <?php $exams = Exams::model()->findAllByAttributes(array('exam_group_id' => $_REQUEST['examid'])); // foreach($exams as $exam) // Creating subject column(s) // { // $subject=Subjects::model()->findByAttributes(array('id'=>$exam->subject_id)); // // <!--<?php if(count($exams)>7){ echo @$subject->code; } else { echo @$subject->name; } // $subjectnames[] = $subject->name; // // } $final_message = ""; foreach ($students as $student) { $guardian = Guardians::model()->findByAttributes(array('id' => $student->parent_id)); $to = ""; $grd = 0; if (count($guardian) != 0 && $guardian->mobile_phone && $guardian->mobile_phone != "") { $to = $guardian->mobile_phone;
<th><?php echo Yii::t('parentportal', 'Remarks'); ?> </th> <th><?php echo Yii::t('parentportal', 'Result'); ?> </th> </tr> <?php if ($exam == NULL) { echo '<tr><td align="center" colspan="4"><i>' . Yii::t('parentportal', 'No Assessments') . '</i></td></tr>'; } 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) {
<tr class="tablebx_topbg"> <td><?php echo Yii::t('report', 'Subject'); ?> </td> <td><?php echo Yii::t('report', 'Score'); ?> </td> <td><?php echo Yii::t('report', 'Remarks'); ?> </td> </tr> <?php $exams = Exams::model()->findAll('exam_group_id=:x', array(':x' => $examgroup->id)); // Selecting exams(subjects) in an exam group if ($exams != NULL) { foreach ($exams as $exam) { $subject = Subjects::model()->findByAttributes(array('id' => $exam->subject_id)); if ($subject != NULL) { ?> <tr> <td style="padding-top:10px; padding-bottom:10px;"> <?php if ($subject->name != NULL) { echo ucfirst($subject->name); } else { continue; } ?>
/** * 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 = Exams::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function actionUpdate($id) { $model = ExamScores::model()->findByAttributes(array('id' => $id)); $old_model = $model->attributes; // For activity feed // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['ExamScores'])) { $model->attributes = $_POST['ExamScores']; $exam = Exams::model()->findByAttributes(array('id' => $_REQUEST['exam_id'])); if ($model->marks < $exam->minimum_marks) { $model->is_failed = 1; } else { $model->is_failed = ''; } if ($model->save()) { // Saving to activity feed $results = array_diff_assoc($model->attributes, $old_model); // To get the fields that are modified. foreach ($results as $key => $value) { if ($key != 'updated_at') { $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_name = ucfirst($subject_name->name) . ' - ' . ucfirst($examgroup->name) . ' (' . ucfirst($batch->name) . '-' . ucfirst($batch->course123->course_name) . ')'; $goal_name = $student_name . ' for the exam ' . $exam_name; if ($key == 'is_failed') { if ($value == 1) { $value = 'Fail'; } else { $value = 'Pass'; } if ($old_model[$key] == 1) { $old_model[$key] = 'Fail'; } else { $old_model[$key] = 'Pass'; } } //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, '21', $model->id, $goal_name, $model->getAttributeLabel($key), $old_model[$key], $value); } } //END saving to activity feed if ($_REQUEST['allexam'] == 1) { $url = 'default/allexam'; } else { $url = 'default/classexam'; } $this->redirect(array($url, 'bid' => $_REQUEST['bid'], 'exam_group_id' => $_REQUEST['exam_group_id'], 'r_flag' => $_REQUEST['r_flag'], 'exam_id' => $_REQUEST['exam_id'])); } } $this->render('examination/examination', array('model' => $model)); }
</th> <th><?php echo Yii::t('students', 'Admission No.'); ?> </th> <th><?php echo Yii::t('students', 'Marks'); ?> </th> <th><?php echo Yii::t('students', 'Remarks'); ?> </th></tr> <?php $data = Exams::model()->findAll("id=:x", array(':x' => $_REQUEST['examid'])); foreach ($data as $data1) { $score = $exam = ExamScores::model()->findAll('exam_id=:x', array(':x' => $data1->id)); foreach ($exam as $exam_1) { $student = Students::model()->findByAttributes(array('id' => $exam_1->student_id)); echo '<tr>'; echo '<td>' . $student->first_name . '</td>'; echo '<td>' . ($no = $student->admission_no . '</td>'); echo '<td>' . ($mark = $exam_1->marks . '</td>'); echo '<td>' . ($remark = $exam_1->remarks . '</td>'); echo '</tr>'; } } ?> </table>
<?php if ($exam_group_id != NULL) { $exam = ExamGroups::model()->findByAttributes(array('id' => $exam_group_id, 'batch_id' => $batch_id)); ?> <td> <strong><?php echo Yii::t('examination', 'Exam'); ?> : </strong><?php echo $exam->name; ?> </td> <?php } if ($exam_id != NULL) { $subject_id = Exams::model()->findByAttributes(array('id' => $exam_id)); $subject = Subjects::model()->findByAttributes(array('id' => $subject_id->subject_id)); ?> <td> <strong><?php echo Yii::t('examination', 'Subject'); ?> : </strong><?php echo $subject->name; ?> </td> <?php } ?> </tr> <tr>
public function actionRemove() { $val = $_GET['val1']; $model = Batches::model()->findByPk($val); $model->is_active = 0; $model->is_deleted = 1; $model->employee_id = ' '; if ($model->save()) { // Student Deletion $students = Students::model()->findAllByAttributes(array('batch_id' => $model->id)); foreach ($students as $student) { //Making student user inactive if ($student->uid != NULL and $student->uid != 0) { $student_user = User::model()->findByAttributes(array('id' => $student->uid)); if ($student_user != NULL) { $student_user->saveAttributes(array('status' => '0')); } } //Making parent user inactive $parent = Guardians::model()->findByAttributes(array('ward_id' => $student->id)); if ($parent->uid != NULL and $parent->uid != 0) { $parent_user = User::model()->findByAttributes(array('id' => $parent->uid)); if ($parent_user != NULL) { $parent_user->saveAttributes(array('status' => '0')); } } $student->saveAttributes(array('is_active' => '0', 'is_deleted' => '1')); // Student Deleted } // Subject Association Deletion $subjects = Subjects::model()->findAllByAttributes(array('batch_id' => $model->id)); foreach ($subjects as $subject) { EmployeesSubjects::model()->DeleteAllByAttributes(array('subject_id' => $subject->id)); $subject->delete(); } // Exam Group Deletion $examgroups = ExamGroups::model()->findAllByAttributes(array('batch_id' => $model->id)); foreach ($examgroups as $examgroup) { // Exams Deletion $exams = Exams::model()->findAllByAttributes(array('exam_group_id' => $examgroup->id)); foreach ($exams as $exam) { //Exam Score Deletion $examscores = ExamScores::model()->DeleteAllByAttributes(array('exam_id' => $exam->id)); $exam->delete(); //Exam Deleted } $examgroup->delete(); //Exam Group Deleted } //Fee Collection Deletion $collections = FinanceFeeCollections::model()->findAllByAttributes(array('batch_id' => $model->id)); foreach ($collections as $collection) { // Finance Fees Deletion $student_fees = FinanceFees::model()->DeleteAllByAttributes(array('fee_collection_id' => $collection->id)); $collection->delete(); // Fee Collection Deleted } //Fee Category Deletion $categories = FinanceFeeCategories::model()->findAllByAttributes(array('batch_id' => $model->id)); foreach ($categories as $category) { // Fee Particular Deletion $particulars = FinanceFeeParticulars::model()->DeleteAllByAttributes(array('finance_fee_category_id' => $category->id)); $category->delete(); // Fee Category Deleted } //Timetable Entry Deletion $periods = TimetableEntries::model()->DeleteAllByAttributes(array('batch_id' => $model->id)); //Class Timings Deletion $class_timings = ClassTimings::model()->DeleteAllByAttributes(array('batch_id' => $model->id)); //Delete Weekdays $weekdays = Weekdays::model()->DeleteAllByAttributes(array('batch_id' => $model->id)); } echo $val; }
<li> <?php echo CHtml::link('<span>' . Yii::t('examination', 'Change Batch') . '</span>', array($url), array('id' => 'add_exam-groups', 'class' => 'addbttn')); ?> </li> </ul> <div class="clear"></div> </div> <?php if ($exam_group_id == NULL) { // If $exam_group_id == NULL, list of exams will be displayed $this->renderPartial('examination/exams', array('employee_id' => $employee->id, 'batch_id' => $batch_id)); } else { //If $exam_group_id != NULL, details of the selected exam will be displayed //echo '<br/>Exam Group ID: '.$exam_group_id.'<br/>'; $checkgroup = Exams::model()->findByAttributes(array('exam_group_id' => $exam_group_id)); if ($checkgroup != NULL) { ?> <div > <div > <?php $model = new Exams('search'); $model->unsetAttributes(); // clear any default values if (isset($exam_group_id)) { $model->exam_group_id = $exam_group_id; } ?> <h3> <?php echo Yii::t('examination', 'Exam Results'); ?>
public function actionAjax_delete() { $id = $_POST['id']; $deleted = $this->loadModel($id); $deleted_batch_id = $deleted->batch_id; // Saving the id of the batch that is going to be deleted. if ($deleted->delete()) { //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, '13', $deleted_batch_id, ucfirst($deleted->name), NULL, NULL, NULL); // For SMS $sms_settings = SmsSettings::model()->findAll(); $to = ''; if ($sms_settings[0]->is_enabled == '1' and $sms_settings[5]->is_enabled == '1') { // Checking if SMS is enabled. $students = Students::model()->findAll("batch_id=:x", array(':x' => $deleted_batch_id)); //Selecting students of the batch foreach ($students as $student) { if ($student->phone1) { // Checking if phone number is provided $to = $student->phone1; } elseif ($student->phone2) { $to = $student->phone2; } if ($to != '') { // Sending SMS to each student $college = Configurations::model()->findByPk(1); $from = $college->config_value; $message = $deleted->name . ' is cancelled'; SmsSettings::model()->sendSms($to, $from, $message); } } } // End For SMS // Delete Exam and exam score $exam = Exams::model()->findAllByAttributes(array('exam_group_id' => $id)); //print_r($exam); foreach ($exam as $exam1) { $examscore = ExamScores::model()->findAllByAttributes(array('exam_id' => $exam1->id)); foreach ($examscore as $examscore1) { $examscore1->delete(); } $exam1->delete(); } // End Delete Exam and exam score echo json_encode(array('success' => true)); exit; } else { echo json_encode(array('success' => false)); exit; } }
public function actionDeactivate($id) { $model = Courses::model()->findByPk($id); $model->is_deleted = 1; if ($model->save()) { // Batch Deletion $batches = Batches::model()->findAllByAttributes(array('course_id' => $id)); //Selecting all batches under the course with id = $id foreach ($batches as $batch) { // Student Deletion $students = Students::model()->findAllByAttributes(array('batch_id' => $batch->id)); foreach ($students as $student) { //Making student user inactive if ($student->uid != NULL and $student->uid != 0) { $student_user = User::model()->findByAttributes(array('id' => $student->uid)); if ($student_user != NULL) { $student_user->saveAttributes(array('status' => '0')); } } //Making parent user inactive $parent = Guardians::model()->findByAttributes(array('ward_id' => $student->id)); if ($parent->uid != NULL and $parent->uid != 0) { $parent_user = User::model()->findByAttributes(array('id' => $parent->uid)); if ($parent_user != NULL) { $parent_user->saveAttributes(array('status' => '0')); } } $student->saveAttributes(array('is_active' => '0', 'is_deleted' => '1')); // Student Deleted } // Subject Association Deletion $subjects = Subjects::model()->findAllByAttributes(array('batch_id' => $batch->id)); foreach ($subjects as $subject) { EmployeesSubjects::model()->DeleteAllByAttributes(array('subject_id' => $subject->id)); $subject->delete(); } // Exam Group Deletion $examgroups = ExamGroups::model()->findAllByAttributes(array('batch_id' => $batch->id)); foreach ($examgroups as $examgroup) { // Exams Deletion $exams = Exams::model()->findAllByAttributes(array('exam_group_id' => $examgroup->id)); foreach ($exams as $exam) { //Exam Score Deletion $examscores = ExamScores::model()->DeleteAllByAttributes(array('exam_id' => $exam->id)); $exam->delete(); //Exam Deleted } $examgroup->delete(); //Exam Group Deleted } //Fee Collection Deletion $collections = FinanceFeeCollections::model()->findAllByAttributes(array('batch_id' => $batch->id)); foreach ($collections as $collection) { // Finance Fees Deletion $student_fees = FinanceFees::model()->DeleteAllByAttributes(array('fee_collection_id' => $collection->id)); $transaction = FinanceTransaction::model()->DeleteAllByAttributes(array('collection_id' => $collection->id)); $collection->delete(); // Fee Collection Deleted } //Fee Category Deletion $categories = FinanceFeeCategories::model()->findAllByAttributes(array('batch_id' => $batch->id)); foreach ($categories as $category) { // Fee Particular Deletion $particulars = FinanceFeeParticulars::model()->DeleteAllByAttributes(array('finance_fee_category_id' => $category->id)); $category->delete(); // Fee Category Deleted } //Timetable Entry Deletion $periods = TimetableEntries::model()->DeleteAllByAttributes(array('batch_id' => $batch->id)); //Class Timings Deletion $class_timings = ClassTimings::model()->DeleteAllByAttributes(array('batch_id' => $batch->id)); //Delete Weekdays $weekdays = Weekdays::model()->DeleteAllByAttributes(array('batch_id' => $batch->id)); $batch->is_active = 0; $batch->is_deleted = 1; $batch->employee_id = ' '; $batch->save(); // Batch Deleted } Yii::app()->user->setFlash('success', "Selected course is deleted!"); $this->redirect(array('managecourse')); } }
public function actionPdf() { $batch_name = Batches::model()->findByAttributes(array('id' => $_REQUEST['id'])); $exam = Exams::model()->findByAttributes(array('id' => $_REQUEST['examid'])); $examgroup = ExamGroups::model()->findByAttributes(array('id' => $exam->exam_group_id)); $subject = Subjects::model()->findByAttributes(array('id' => $exam->subject_id)); $filename = $batch_name->name . ' ' . $examgroup->name . ' ' . $subject->name . '.pdf'; # HTML2PDF has very similar syntax $html2pdf = Yii::app()->ePdf->HTML2PDF(); $html2pdf->WriteHTML($this->renderPartial('scorepdf', array(), true)); $html2pdf->Output($filename); }
echo CHtml::link('<span>' . Yii::t('examination', 'Change Batch') . '</span>', array($url), array('id' => 'add_exam-groups', 'class' => 'addbttn')); ?> </li> </ul> <div class="clear"></div> </div> <?php if ($exam_group_id == NULL) { // If $exam_group_id == NULL, list of exams will be displayed $criteria = new CDbCriteria(array('condition' => 'batch_id=' . $batch_id . ' AND is_published = 1')); $dataProvider = new CActiveDataProvider('ExamGroups', array('criteria' => $criteria)); $this->widget('zii.widgets.grid.CGridView', array('id' => 'exam-groups-grid', 'dataProvider' => $dataProvider, 'pager' => array('cssFile' => Yii::app()->baseUrl . '/css/formstyle.css'), 'cssFile' => Yii::app()->baseUrl . '/css/formstyle.css', 'htmlOptions' => array('class' => 'grid-view clear'), 'columns' => array('name', 'exam_type', array('class' => 'CLinkColumn', 'labelExpression' => '$data->is_published ? "View Schedule" : "Not scheduled"', 'urlExpression' => '$data->is_published ? ' . $scheduleUrlExp . ' : "#"', 'header' => 'Is Published', 'headerHtmlOptions' => array('style' => 'color:#FF6600')), array('class' => 'CLinkColumn', 'labelExpression' => '$data->result_published ? "View Results" : ($data->is_published ? "Enter Scores" : "No Results Published")', 'urlExpression' => '$data->result_published ? ' . $resultUrlExp . ' : ($data->is_published ? ' . $resultUrlExp . ' : "#")', 'header' => 'Result Published', 'headerHtmlOptions' => array('style' => 'color:#FF6600'))), 'afterAjaxUpdate' => 'js:function(id,data){$.bind_crud()}')); } else { //If $exam_group_id != NULL, details of the selected exam will be displayed //echo '<br/>Exam Group ID: '.$exam_group_id.'<br/>'; $checkgroup = Exams::model()->findByAttributes(array('exam_group_id' => $_REQUEST['exam_group_id'])); if ($checkgroup != NULL) { ?> <div > <div > <?php $model1 = new Exams('search'); $model1->unsetAttributes(); // clear any default values if (isset($_GET['exam_group_id'])) { $model1->exam_group_id = $_GET['exam_group_id']; } ?> <h3> <?php echo Yii::t('examination', 'Scheduled Subjects'); ?>
/** * Deletes a particular model. * If deletion is successful, the browser will be redirected to the 'admin' page. * @param integer $id the ID of the model to be deleted */ public function actionDelete($id) { if (Yii::app()->request->isPostRequest) { $model = ExamScores::model()->findByAttributes(array('id' => $id)); $student = Students::model()->findByAttributes(array('id' => $model->student_id)); $student_name = ucfirst($student->first_name) . ' ' . ucfirst($student->middle_name) . ' ' . ucfirst($student->last_name); $exam = Exams::model()->findByAttributes(array('id' => $model->exam_id)); $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_name = ucfirst($subject_name->name) . ' - ' . ucfirst($examgroup->name) . ' (' . ucfirst($batch->name) . '-' . ucfirst($batch->course123->course_name) . ')'; $goal_name = $student_name . ' for the exam ' . $exam_name; // we only allow deletion via POST request $this->loadModel($id)->delete(); //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, '22', $model->id, $goal_name, NULL, NULL, NULL); // we only allow deletion via POST request //$this->loadModel($id)->delete(); // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser if (!isset($_GET['ajax'])) { $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin')); } } else { throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.'); } }
public function actionAjax_delete() { $id = $_POST['id']; $subject = Subjects::model()->findByAttributes(array('elective_group_id' => $id)); $timetable = TimetableEntries::model()->deleteAllByAttributes(array('subject_id' => $subject->id)); $examgroup = Exams::model()->deleteAllByAttributes(array('subject_id' => $subject->id)); EmployeeElectiveSubjects::model()->deleteAllByAttributes(array('subject_id' => $subject->id)); $subject->delete(); $deleted = $this->loadModel($id); if ($deleted->delete()) { echo json_encode(array('success' => true)); exit; } else { echo json_encode(array('success' => false)); exit; } }
public function actionDeletenew() { $posts = ExamGroups::model()->findByAttributes(array('id' => $_REQUEST['id'])); $posts->delete(); $exam = Exams::model()->findAll("exam_group_id=:x", array(':x' => $_REQUEST['id'])); foreach ($exam as $exam_1) { $exam_1->delete(); } $this->redirect(array('examGroups/manage', 'id' => $_REQUEST['ret'])); }
} ?> </td> <td align="center"> <?php if ($batch->name != NULL) { $course = Courses::model()->findByAttributes(array('id' => $batch->course_id)); echo ucfirst($batch->name) . ' / ' . ucfirst($course->course_name); } else { echo '-'; } ?> </td> <td align="center"> <?php $recent_exams = Exams::model()->findAllByAttributes(array('exam_group_id' => $recent_exam_group->id)); if ($recent_exams != NULL) { if ($students > 0) { $total_maximum_marks = 0; $total_exam_average = 0; foreach ($recent_exams as $recent_exam) { $exam_student_total = 0; $total_maximum_marks = $total_maximum_marks + $recent_exam->maximum_marks; $scores = ExamScores::model()->findAllByAttributes(array('exam_id' => $recent_exam->id)); if ($scores != NULL) { foreach ($scores as $score) { $exam_student_total = $exam_student_total + $score->marks; } } $exam_average = $exam_student_total / $students; $total_exam_average = $total_exam_average + $exam_average;