Пример #1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Exams();
     $model_1 = new ExamGroups();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Exams'])) {
         //$model->attributes=$_POST['Exams'];
         if (isset($_REQUEST['exam_group_id'])) {
             $insert_id = $_REQUEST['exam_group_id'];
         } else {
             $model_1->attributes = $_POST['ExamGroups'];
             $model_1->batch_id = $_REQUEST['id'];
             $model_1->save();
             $insert_id = Yii::app()->db->getLastInsertID();
         }
         $posts = Subjects::model()->findAll("batch_id=:x AND no_exams=:y", array(':x' => $_REQUEST['id'], ':y' => 0));
         $list = $_POST['Exams'];
         $count = count($list['subject_id']);
         $j = 0;
         for ($i = 0; $i < $count; $i++) {
             if ($list['maximum_marks'][$i] != NULL and $list['minimum_marks'][$i] != NULL and $list['start_time'][$i] != NULL and $list['end_time'][$i] != NULL) {
                 $model = new Exams();
                 $model->exam_group_id = $insert_id;
                 $model->subject_id = $list['subject_id'][$i];
                 $model->maximum_marks = $list['maximum_marks'][$i];
                 $model->minimum_marks = $list['minimum_marks'][$i];
                 $model->start_time = $list['start_time'][$i];
                 $model->end_time = $list['end_time'][$i];
                 if ($model->start_time) {
                     $date1 = date('Y-m-d H:i', strtotime($model->start_time));
                     $model->start_time = $date1;
                 }
                 if ($model->end_time) {
                     $date2 = date('Y-m-d H:i', strtotime($model->end_time));
                     $model->end_time = $date2;
                 }
                 $model->grading_level_id = $list['grading_level_id'];
                 $model->weightage = $list['weightage'];
                 $model->event_id = $list['event_id'];
                 $model->created_at = $list['created_at'];
                 $model->updated_at = $list['updated_at'];
                 $model->save();
             }
         }
         $this->redirect(array('exams/create', 'id' => $_REQUEST['id'], 'exam_group_id' => $_REQUEST['exam_group_id']));
     }
     $this->render('create', array('model' => $model, 'model_1' => $model_1));
 }
Пример #2
0
            ?>
>
						<td>
							<?php 
            echo $student->admission_no;
            ?>
						</td>
						<td>
							<?php 
            echo CHtml::link(ucfirst($student->first_name) . '  ' . ucfirst($student->middle_name) . '  ' . ucfirst($student->last_name), array('/students/students/view', 'id' => $student->id));
            ?>
						</td>
						<?php 
            foreach ($list as $exam) {
                $score = ExamScores::model()->findByAttributes(array('student_id' => $student->id, 'exam_id' => $exam->id));
                $examgroup = ExamGroups::model()->findByAttributes(array('id' => $exam->exam_group_id));
                ?>
						
						<td>
						<?php 
                if ($score->marks != NULL or $score->remarks != NULL) {
                    ?>
							<!-- Mark and Remarks Column -->
							<table align="center" width="100%" style="border:none;width:auto; min-width:80px;">
								<tr>
									<td style="border:none;<?php 
                    if ($score->is_failed == 1) {
                        ?>
color:#F00;<?php 
                    }
                    ?>
 public function actionAjax_Create()
 {
     if (isset($_POST['ExamGroups'])) {
         $model = new ExamGroups();
         //set the submitted values
         $model->attributes = $_POST['ExamGroups'];
         $model->exam_date = date('Y-m-d', strtotime($model->exam_date));
         //return the JSON result to provide feedback.
         if ($model->save(false)) {
             //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, '11', $model->id, ucfirst($model->name), NULL, NULL, NULL);
             // Send SMS if saved
             $sms_settings = SmsSettings::model()->findAll();
             $to = '';
             // Send SMS only if, SMS is enabled and schedule is published
             if ($model->is_published == '1' and $sms_settings[0]->is_enabled == '1' and $sms_settings[5]->is_enabled == '1') {
                 $students = Students::model()->findAll("batch_id=:x and is_deleted=:y and is_active=:z", array(':x' => $model->batch_id, ':y' => 0, ':z' => 1));
                 //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 = $model->name . ' is scheduled';
                         SmsSettings::model()->sendSms($to, $from, $message);
                     }
                 }
             }
             echo json_encode(array('success' => true, 'id' => $model->primaryKey));
             exit;
         } else {
             echo json_encode(array('success' => false));
             exit;
         }
     }
 }
Пример #4
0
    foreach ($batches_id as $batch_id) {
        $batch = Batches::model()->findByAttributes(array('id' => $batch_id->batch_id, 'is_active' => 1, 'is_deleted' => 0));
        echo '<tr id="batchrow' . $batch->id . '">';
        /*echo '<td style="text-align:center; padding-left:10px; font-weight:bold;">'.CHtml::link($batch->name, array('/teachersportal/default/employeetimetable','id'=>$batch->id)).'</td>';*/
        echo '<td style="text-align:center; padding-left:10px; font-weight:bold;">' . $batch->coursename . '</td>';
        $teacher = Employees::model()->findByAttributes(array('id' => $batch->employee_id));
        echo '<td align="center">';
        if ($teacher) {
            echo $teacher->first_name . ' ' . $teacher->last_name;
        } else {
            echo '-';
        }
        // Count if any exam timetables are published in a batch.
        $exams_published = ExamGroups::model()->countByAttributes(array('batch_id' => $batch->id, 'is_published' => 1));
        // Count if any exam results are published in a batch.
        $result_published = ExamGroups::model()->countByAttributes(array('batch_id' => $batch->id, 'result_published' => 1));
        echo '<td align="center">';
        if ($exams_published > 0 or $result_published > 0) {
            echo CHtml::link(Yii::t('examination', 'View Examinations'), array('/teachersportal/default/allexam', 'bid' => $batch->id));
        } else {
            echo Yii::t('examination', 'No Exam Scheduled');
        }
        echo '</td>';
        echo '</tr>';
    }
    ?>
                </tbody>
            </table>
		</div>
	<?php 
}
Пример #5
0
 public function actionStudentexampdf()
 {
     $student_name = Students::model()->findByAttributes(array('id' => $_REQUEST['id']));
     $exam_name = ExamGroups::model()->findByAttributes(array('id' => $_REQUEST['exam_group_id']));
     $pdf_name = ucfirst($student_name->first_name) . ' ' . ucfirst($student_name->last_name) . ' ' . ucfirst($exam_name->name) . ' Assessment Report.pdf';
     # HTML2PDF has very similar syntax
     $html2pdf = Yii::app()->ePdf->HTML2PDF();
     $html2pdf->WriteHTML($this->renderPartial('studentexampdf', array(), true));
     $html2pdf->Output($pdf_name);
 }
Пример #6
0
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) {
                            echo '<td>' . $electname->name . '</td>';
Пример #7
0
                                </td>
                                <td align="center">
                                	<?php 
echo Yii::t('examination', 'Batch');
?>
                                </td>
                                <td align="center">
                                	<?php 
echo Yii::t('examination', 'Average');
?>
                                </td>
                            </tr>
                           
                           
								<?php 
$recent_exam_groups = ExamGroups::model()->findAllByAttributes(array(), array('order' => 'id DESC', 'limit' => 5));
if ($recent_exam_groups != NULL) {
    foreach ($recent_exam_groups as $recent_exam_group) {
        ?>
                                    	<tr>
                                    		<td align="center">
												<?php 
        if ($recent_exam_group->exam_date != NULL) {
            $settings = UserSettings::model()->findByAttributes(array('user_id' => Yii::app()->user->id));
            if ($settings != NULL) {
                $recent_exam_group->exam_date = date($settings->displaydate, strtotime($recent_exam_group->exam_date));
            }
            echo $recent_exam_group->exam_date;
        } else {
            echo '-';
        }
Пример #8
0
function old_1(id)
{
	var val = document.getElementById('min_mark').value;
	var i = 0;
	for(i=1;i<=id;i++)
	{
	    document.getElementById('min_mark_org'+i).value = val;
	}
}
</script>
<div class="formCon">

<div class="formConInner">

<?php 
$check = ExamGroups::model()->findByAttributes(array('id' => $_REQUEST['exam_group_id'], 'batch_id' => $_REQUEST['id']));
if ($check != NULL) {
    ?>
	<?php 
    if (isset($_REQUEST['id'])) {
        $posts = Subjects::model()->findAll("batch_id=:x AND no_exams=:y", array(':x' => $_REQUEST['id'], ':y' => 0));
    }
    ?>
    <?php 
    if ($posts != NULL) {
        ?>
  <?php 
        $form = $this->beginWidget('CActiveForm', array('id' => 'exams-form', 'enableAjaxValidation' => false));
        ?>
<table width="80%" border="0" cellspacing="0" cellpadding="0">
<?php 
Пример #9
0
                        <?php 
    $course = Courses::model()->findByAttributes(array('id' => $batch->course_id));
    if ($course != NULL) {
        echo $course->course_name;
    }
    ?>
                    &nbsp;&nbsp;&nbsp;&nbsp;
                    <strong> <?php 
    echo Yii::t('examination', 'Batch');
    ?>
: </strong><?php 
    echo $batch->name;
    ?>
                    <?php 
    if ($exam_group_id != NULL) {
        $exam = ExamGroups::model()->findByAttributes(array('id' => $exam_group_id, 'batch_id' => $batch_id));
        ?>
                    &nbsp;&nbsp;&nbsp;&nbsp;
                    <strong> <?php 
        echo Yii::t('examination', 'Exam');
        ?>
: </strong><?php 
        echo $exam->name;
    }
    ?>
              </div>
          </div> 
               
    <?php 
}
?>
Пример #10
0
        echo $batch->name;
    } else {
        echo '-';
    }
    ?>
								</td>
                            </tr>
                        </table>
					</div> <!-- END div class="tablebx" Student Information -->
                    <br /><br />
					<h3><?php 
    echo Yii::t('report', 'Assessment Report');
    ?>
</h3>
                    <?php 
    $examgroups = ExamGroups::model()->findAll('batch_id=:x', array(':x' => $batch->id));
    // Selecting exam groups in the batch of the student
    if ($examgroups != NULL) {
        $i = 1;
        foreach ($examgroups as $examgroup) {
            ?>
                        	<br />
							<span style="float:left;"><h4><?php 
            echo $i . '. ' . ucfirst($examgroup->name);
            $i++;
            ?>
</h4></span>
                            <span style="margin-left:490px; margin-top:200px;"><?php 
            echo CHtml::link('<img src="images/pdf-but.png" border="0" />', array('/report/default/studentexampdf', 'exam_group_id' => $examgroup->id, 'id' => $student), array('target' => "_blank"));
            ?>
</span>
Пример #11
0
 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'));
     }
 }
Пример #12
0
 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));
 }
Пример #13
0
    ?>
        	</li>
            <?php 
}
?>
            <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 
$result_published = ExamGroups::model()->countByAttributes(array('id' => $exam_group_id, 'result_published' => 1));
$is_teaching_subject = TimetableEntries::model()->countByAttributes(array('subject_id' => $subject_id->subject_id, 'employee_id' => $employee_id));
$score_flag = 0;
// If $score_flag == 0, form for editing scores will not be displayed. If $score_flag == 1, form will be displayed.
if ((Yii::app()->controller->action->id == 'classexam' or Yii::app()->controller->action->id == 'update') and $classteacher->id == $employee_id or Yii::app()->controller->action->id == 'update' and $_REQUEST['allexam'] == 1) {
    // Class teacher and subject teacher can edit scores for all subjects in their batch.
    $score_flag = 1;
}
if (Yii::app()->controller->action->id == 'allexam' and $is_teaching_subject <= 0) {
    $score_flag = 0;
}
/*echo 'Result Published: '.$result_published.'<br/>';
	echo 'Is Teaching Subject: '.$is_teaching_subject.'<br/>';
	echo 'Score Flag: '.$score_flag.'<br/>';*/
if ($score_flag == 1) {
    ?>
Пример #14
0
 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;
 }
 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);
 }
Пример #16
0
        } else {
            echo '-';
        }
        ?>
				</td>
            
            </tr>
            <tr>
            	<td><b><?php 
        echo Yii::t('report', 'Examination');
        ?>
</b></td>
                <td>:</td>
                <td>
                	<?php 
        $exam = ExamGroups::model()->findByAttributes(array('id' => $_REQUEST['exam_group_id']));
        if ($exam->name != NULL) {
            echo ucfirst($exam->name);
        } else {
            echo '-';
        }
        ?>
				</td>
            	<td><b><?php 
        echo Yii::t('report', 'Exam Date');
        ?>
</b></td>
                <td>:</td>
                <td>
                	<?php 
        if ($exam->name != NULL) {
 /**
  * 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.');
     }
 }
Пример #18
0
?>
</div>
    <br />
    <div class="tableinnerlist">
    <table width="60%" cellpadding="0" cellspacing="0" >
    <tr>
     <th><?php 
echo Yii::t('examination', 'Exam Name');
?>
</th>
     <th><?php 
echo Yii::t('examination', 'Action');
?>
</th>
    </tr> 
<?php 
$posts = ExamGroups::model()->findAll("batch_id=:x", array(':x' => $_REQUEST['id']));
foreach ($posts as $posts_1) {
    echo '<tr>';
    echo '<td>' . $posts_1->name . '</td>';
    echo '<td>' . CHtml::link(Yii::t('examination', 'Delete'), array('ExamGroups/deletenew', 'id' => $posts_1->id, 'ret' => $_REQUEST['id'])) . '</td>';
    echo '</tr>';
}
?>
 </table>
</div>

</div>
    </td>
  </tr>
</table>
 /**
  * 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 = ExamGroups::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Пример #20
0
 public function actionAjax_Create()
 {
     if (isset($_POST['ExamGroups'])) {
         $model = new ExamGroups();
         //set the submitted values
         $model->attributes = $_POST['ExamGroups'];
         if ($model->exam_date) {
             $model->exam_date = date('Y-m-d', strtotime($model->exam_date));
         }
         //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;
         }
     }
 }