/**
  * 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));
 }
Ejemplo n.º 2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Exams::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['ExamQuestionId' => $this->ExamQuestionId, 'Question' => $this->Question, 'ExamId' => $this->ExamId]);
     return $dataProvider;
 }
Ejemplo n.º 3
0
 public function examupdateget($dash, $id)
 {
     if (Exams::find($id)) {
         $theme = Theme::uses('dashboard')->layout('default');
         $view = array('name' => 'Dashboard Assessment Update', 'id' => $id);
         $theme->breadcrumb()->add([['label' => 'Dashboard', 'url' => Setting::get('system.dashurl')], ['label' => 'Exams', 'url' => Setting::get('system.dashurl') . '/exams'], ['label' => $id, 'url' => Setting::get('system.dashurl') . '/exam/' . $id]]);
         return $theme->scope('exam.update', $view)->render();
     }
     $theme = Theme::uses('dashboard')->layout('default');
     $view = array('name' => 'Dashboard Assessment Update', 'id' => $id);
     $theme->breadcrumb()->add([['label' => 'Dashboard', 'url' => Setting::get('system.dashurl')], ['label' => 'Exams', 'url' => Setting::get('system.dashurl') . '/exams'], ['label' => $id, 'url' => Setting::get('system.dashurl') . '/exam/' . $id]]);
     return $theme->scope('exam.create', $view)->render();
 }
Ejemplo n.º 4
0
 Route::get('assessments', array('before' => 'teacher', 'uses' => 'DashboardController@assessments'));
 Route::get('/', array('as' => 'dashboard', 'before' => 'teacher', 'uses' => 'DashboardController@dash'));
 Route::get('tutorial/edit/{id?}', 'TutorialsController@index')->where('id', '[0-9]+')->before('teacher');
 Route::get('tutorial/{mode}/{id}', array('before' => 'teacher', 'uses' => 'TutorialsController@modder'));
 Route::get('tutorial/update/{id}/{attachmentname}/{mode}', array('before' => 'teacher', 'uses' => 'TutorialsController@attachmentHandler'));
 Route::get('assessment/{id}', array('before' => 'teacher', 'uses' => 'HttpController@assessmentupdateget'));
 Route::get('/assessment-{aid}/exam-{eid}/markup', array('before' => 'teacher', 'uses' => 'ExamController@markExam'));
 Route::get('/exam/edit/{id}', array('before' => 'teacher', 'uses' => 'HttpController@examupdateget'));
 Route::get('/exam/view/{id}', array('before' => 'teacher', function ($dash, $id) {
     if (Exams::find($id)) {
         return View::make('dashboard.exams.view')->with('id', $id);
     }
     return View::make('dashboard.exams.create')->with('id', 0);
 }));
 Route::get('/exam/delete/{id}', array('before' => 'admin', function ($dash, $id) {
     $exam = Exams::findOrFail($id);
     $examdata = DB::select(DB::raw('SELECT exams FROM tutorials'));
     $examdata = objectToArray($examdata);
     $pass = [];
     foreach ($examdata as $exam) {
         if ($exam["exams"] != NULL) {
             $exam = unserialize($exam["exams"]);
             if ((int) $exam["id"] !== (int) $id) {
                 $pass[] = true;
             } elseif ((int) $exam["id"] == (int) $id) {
                 $pass[] = false;
             }
         }
     }
     if (in_array(false, $pass, true)) {
     } else {
Ejemplo n.º 5
0
                        <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) {
 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);
 }
Ejemplo n.º 7
0
        {{$breadcrumbs}}
            </div>

            <!--TODO: Editing Template  -->
                <div class="box span12">
                    <div class="box-header well">
                        <h2><i class="icon-info-sign"></i>Create a New Exam</h2>
                    </div>
                    <div class="box-content" style="display: block;">
                        <div class="container-fluid">
                        <div class="row-fluid">
                            <div class="span12">

                           <?php 
$examid = $id;
$exam = Exams::find($id);
echo "<fieldset>";
echo "<div class='container-fluid'><div class='row-fluid'><div class='span6'>";
echo Form::label('id', 'ID', array('class' => 'pull-left', 'style' => 'margin:20px;'));
echo Form::text('id', 0, array('class' => 'pull-right disabled uneditable-input', 'style' => 'margin:20px;', 'disabled'));
echo Form::label('related_tutorial', 'Related Tutorial', array('class' => 'pull-left', 'style' => 'clear:left;margin:10px'));
$tutorialid = Session::get('tutorialid', 1);
$tutoriallist = array();
// $tutorial = Tutorials::where('id','=',$tutorialid);
// var_dump($tutorial);
if ($tutorialid !== NULL) {
    $tutorial = Tutorials::findOrFail($tutorialid);
    $tutoriallist[$tutorial->id] = $tutorial->name;
    $teacher = User::findOrFail($tutorial->createdby);
    echo Form::select('related_tutorial', $tutoriallist, Session::get('tutorialid'), array('class' => 'pull-right uneditable-input', 'style' => 'clear:right;margin:5px;height:30px;'));
}
Ejemplo n.º 8
0
 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));
     }
 }
Ejemplo n.º 9
0
</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;
                    }
                    ?>
Ejemplo n.º 10
0
</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>
Ejemplo n.º 11
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));
 }
Ejemplo n.º 12
0
							<?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>
Ejemplo n.º 13
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;
 }
Ejemplo n.º 14
0
        <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');
        ?>
</h3>
          <?php 
        $this->widget('zii.widgets.grid.CGridView', array('id' => 'exams-grid', 'dataProvider' => $model->search(), 'pager' => array('cssFile' => Yii::app()->baseUrl . '/css/formstyle.css'), 'cssFile' => Yii::app()->baseUrl . '/css/formstyle.css', 'columns' => array(array('name' => 'subject_id', 'value' => array($model, 'subjectname')), 'start_time', 'end_time', 'maximum_marks', 'minimum_marks', array('class' => 'CLinkColumn', 'labelExpression' => array($model, 'scorelabel'), 'urlExpression' => $scoreUrlExp, 'header' => 'Score', 'headerHtmlOptions' => array('style' => 'color:#FF6600')))));
        echo '</div></div>';
    } else {
        ?>
Ejemplo n.º 15
0
 }
 ?>
                                     </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;
Ejemplo n.º 16
0
     
   
   <?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;
Ejemplo n.º 17
0
                            <?php 
if ($errors->first()) {
    echo "<div class='alert alert-error alert-block fade in'>";
    echo '<button type="button" class="close" data-dismiss="alert">×</button>';
    echo $errors->first();
    echo "</div>";
}
echo Form::open(array('url' => '/exam/edit/' . $id, 'method' => 'post', 'class' => 'form-horizontal'));
echo "<fieldset>";
echo Form::label('id', 'id', array('class' => 'pull-left', 'style' => 'clear:left;padding:15px;'));
echo Form::text('id', $id, array('disabled' => '', 'class' => 'disabled pull-right', 'style' => 'margin:10px;'));
echo Form::label('title', 'Title', array('class' => 'pull-left', 'style' => 'clear:left;margin:15px;'));
echo Form::text("title", $exam->title, array('placeholder' => 'Title of the Tutorial', 'class' => 'pull-right', 'style' => 'clear:right;margin:10px;'));
echo Form::label('subject', 'Subject', array('class' => 'pull-left', 'style' => 'clear:left;margin:15px;'));
$subject = Subject::find(Exams::find($id)->subjectid);
$subjectlist[$subject->id] = $subject->subjectname;
echo Form::select('subject', $subjectlist, $subject->id, array('class' => 'pull-right', 'style' => 'clear:right;margin:10px;'));
echo '<div class="control-group" style="clear:left;">';
echo "<div id='exams'>";
$hash = $exam->hash;
$examdata_encoded = File::get(app_path() . '/files/exam-' . $id . '/' . $hash . '.json');
Session::put('questiondata_key', 1);
$examdata = json_decode($examdata_encoded);
$examdata = objectToArray($examdata);
foreach ($examdata['questiondata']['questions'] as $question) {
    $qc = Session::get('questiondata_key', 1);
    $checked1 = '';
    $checked2 = '';
    $checked3 = '';
    $checked4 = '';
Ejemplo n.º 18
0
                                    <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;
                        }
                        ?>
Ejemplo n.º 19
0
<?php

$examid = Session::get('examid');
$exam = Exams::find($examid);
Session::put('halt_tutorial_except', $id);
$tohash = 'tutorial-' . $id;
$encrypted = Crypt::encrypt($tohash);
?>
<!doctype html>
<html>
    <head>
        <title>{{ Setting::get('system.schoolname') }}</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        @stylesheets('bootstrap')
        @stylesheets('grans')
    </head>
    <body>
        {{ $header }}
        <div class='container-fluid'>
            <div class='row-fluid'>
                <div class="span12 offset1">
                    <?php 
echo Form::open(array('url' => '/tutorial-' . $id . '/exam-' . $examid . '/' . $encrypted . '/', 'method' => 'post', 'class' => 'form-horizontal'));
echo "<fieldset>";
echo "<div class='container-fluid'><div class='row-fluid'><div class='span6'>";
echo Form::label('id', 'ID', array('class' => 'pull-left', 'style' => 'margin:20px;'));
echo Form::text('id', 0, array('class' => 'pull-right disabled uneditable-input', 'style' => 'margin:20px;', 'disabled'));
echo Form::label('related_tutorial', 'Related Tutorial', array('class' => 'pull-left', 'style' => 'clear:left;margin:10px'));
$tutorialid = Session::get('tutorialid', 1);
$tutoriallist = array();
// $tutorial = Tutorials::where('id','=',$tutorialid);
Ejemplo n.º 20
0
echo '</div>';
echo Form::label('published', 'Published', array('class' => 'pull-left', 'style' => 'clear:left;margin:15px;'));
if ($tutorial->published === 1) {
    $checked = 'checked="checked"';
} else {
    $checked = '';
}
echo '<div style="margin:20px;position:relative;padding-top:10px;"><input 
                            data-no-uniform="true" type="checkbox" ' . $checked . ' name="published" id="published" class="iphone-toggle"></div>';
echo Form::label('attachment', 'Attachment', array('class' => 'pull-left', 'style' => 'clear:left;margin:15px;'));
echo Form::file('attachment[]', array('class' => "pull-right", 'style' => 'clear:right;margin:20px;padding-top:10px;', 'multiple' => 'true'));
echo "<br>";
echo "<br>";
$checkexams = DB::select(DB::raw('SELECT COUNT(`id`) as `exists` FROM `exams` WHERE `subjectid` = ' . $tutorial->subjectid . ''));
if (!$checkexams) {
    $possibleexams = Exams::where('subjectid', '=', $tutorial->subjectid)->get();
    $exams = array();
    foreach ($possibleexams as $possibleexam) {
        $exams[$possibleexam->id] = $possibleexam->title;
        $possibleexamid = $possibleexam->id;
    }
} else {
    $exams[0] = "No Matched Exams found. Please create a Exam before attaching it.";
    $possibleexamid = 0;
}
$exame = $tutorial->exams;
$exame = unserialize($exame);
echo Form::label('examstruth', 'Enable Exam', array('class' => 'pull-left', 'style' => 'clear:left;margin:15px;'));
if ($exame['true'] == true) {
    $checked = 'checked="checked"';
} else {
Ejemplo n.º 21
0
  <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) {
Ejemplo n.º 22
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'));
     }
 }
 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;
     }
 }
Ejemplo n.º 24
0
} else {
    echo '<i>' . Yii::t('examination', 'No Such Exam Scheduled') . '</i>';
}
?>
    </div>
    </div>
   
    
    <?php 
$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> Scheduled Subjects</h3>
          <?php 
    $this->widget('zii.widgets.grid.CGridView', array('id' => 'exams-grid', 'dataProvider' => $model1->search(), 'pager' => array('cssFile' => Yii::app()->baseUrl . '/css/formstyle.css'), 'cssFile' => Yii::app()->baseUrl . '/css/formstyle.css', 'columns' => array(array('name' => 'subject_id', 'value' => array($model, 'subjectname')), 'start_time', 'end_time', 'maximum_marks', 'minimum_marks', array('class' => 'CButtonColumn', 'buttons' => array('update' => array('label' => 'update', 'url' => 'Yii::app()->createUrl("examination/exams/update", array("sid"=>$data->id,"exam_group_id"=>$data->exam_group_id,"id"=>$_REQUEST["id"]))')), 'template' => '{update} {delete}', 'afterDelete' => 'function(){window.location.reload();}'), array('class' => 'CButtonColumn', 'buttons' => array('add' => array('label' => 'Exam Score', 'url' => 'Yii::app()->createUrl("examination/examScores/create", array("examid"=>$data->id,"id"=>$_REQUEST["id"]))')), 'template' => '{add}', 'header' => 'Manage', 'htmlOptions' => array('style' => 'width:17%'), 'headerHtmlOptions' => array('style' => 'color:#FF6600')))));
    echo '</div></div>';
} else {
    echo '<div class="notifications nt_red"><i>' . Yii::t('examination', 'Nothing Scheduled') . '</i></div>';
}
?>
Ejemplo n.º 25
0
 /**
  * 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;
 }
Ejemplo n.º 26
0
    <?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');
        ?>
</h3>
				  <?php 
        $this->widget('zii.widgets.grid.CGridView', array('id' => 'exams-grid', 'dataProvider' => $model1->search(), 'pager' => array('cssFile' => Yii::app()->baseUrl . '/css/formstyle.css'), 'cssFile' => Yii::app()->baseUrl . '/css/formstyle.css', 'columns' => array(array('name' => 'subject_id', 'value' => array($model1, 'subjectname')), 'start_time', 'end_time', 'maximum_marks', 'minimum_marks')));
        echo '</div></div>';
    } else {
        echo '<div class="notifications nt_red"><i>' . Yii::t('examination', 'Nothing Scheduled') . '</i></div>';
Ejemplo n.º 27
0
 /**
  * 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']));
 }
Ejemplo n.º 30
0
                         <div class="clearfix visible-sm visible-xs"></div>
                         <div  class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
                         <h4>Table of Failed Questions and Answers by Student</h4>
                         <table id="questionfail" class="table table-striped table-bordered bootstrap-datatable datatable"> 
                         <thead>
                             <tr>
                                 <th>Question No</th>
                                 <th>Question</th>
                                 <th>Answer(s)</th>
                             </tr>
                         </thead>
                         <tbody>
                         <?php 
 $examdata = unserialize(Tutorials::find($assessment->tutorialid)->exams);
 $wronganswers = File::get(app_path() . '/files/assessment/' . $assessment->id . '/exam-' . $examdata['id'] . '/questionfailed.json');
 $examy = Exams::findOrFail($examdata['id']);
 $hash = $examy->hash;
 $wronganswers = json_decode($wronganswers, true);
 if (isset($wronganswers['questions'])) {
     foreach ($wronganswers['questions'] as $key => $value) {
         echo "<tr><td>" . $key . "</td>" . "<td>" . $value . "</td>";
         echo "<td>";
         $examdata_encoded = File::get(app_path() . '/files/exam-' . $examy->id . '/' . $hash . '.json');
         $examdata = json_decode($examdata_encoded, true);
         foreach ($wronganswers['questions_fail'][$key][0] as $answerr) {
             if ($answerr != 0) {
                 echo "<b>" . $answerr . "</b>. ";
                 echo $examdata['questiondata']['question'][$key]['checkboxdata'][$answerr] . "<br>";
             }
         }
         echo "</td>";