Мне удалось автоматически сгенерировать замечания при суммировании баллов студентов. Примечания хранятся в базе данных, но я не могу найти способ отобразить их в отчете студента.
примечание в базе данных
Лист студенческого отчета
Это моя модель
public function add1($ss){
$tot = $ss['total'];
$grade = "";
$remark = "";
switch ($tot) {
case $tot < 40:
$grade = "FT";
$remark = "FURTHER TRAINING";
break;
case $tot < 45 AND $tot > 39:
$grade = "E8";
$remark = "PASS";
break;
case $tot < 50 AND $tot > 44:
$grade = "D7";
$remark = "PASS";
break;
case $tot < 60 AND $tot > 49:
$grade = "C6";
$remark = "CREDIT";
break;
case $tot < 65 AND $tot > 59:
$grade = "C5";
$remark = "CREDIT";
break;
case $tot < 70 AND $tot > 64:
$grade = "C4";
$remark = "CREDIT";
break;
case $tot < 80 AND $tot > 69:
$grade = "B3";
$remark = "GOOD";
break;
case $tot < 90 AND $tot > 79:
$grade = "B2";
$remark = "V.GOOD";
break;
case $tot > 89:
$grade = "A1";
$remark = "EXCELLENT";
break;
default:
$grade = "N/A";
$remark = "N/A";
}
//var_dump($grade); die();
$data = ['student_id'=>$ss['student_id'], 'class_id'=>$ss['class_id'], 'section_id'=>$ss['section_id'], 'subject_id'=>$ss['subject_id'], 'ca1'=>$ss['ca1'],
'ca2'=>$ss['ca2'], 'ca3'=>$ss['ca3'], 'ca4'=>$ss['ca4'], 'ca5'=>$ss['ca5'], 'ca6'=>$ss['ca6'], 'exam'=>$ss['exam'], 'total'=>$ss['total'], 'grade'=> $grade, 'remark'=> $remark];
$this->db->query('INSERT INTO scores_primary (student_id, class_id, section_id, subject_id, ca1, ca2, ca3, ca4, ca5, ca6, exam, tot_score, grade, remark) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $data);
if($this->db->affected_rows() > 0){
return $this->db->insert_id();
}
else{
return FALSE;
}
}
Контроллер
function assigngrade() {
$this->load->database('default');
if (!$this->rbac->hasPrivilege('exam', 'can_view')) {
access_denied();
}
$this->session->set_userdata('top_menu', 'Examinations');
$this->session->set_userdata('sub_menu', 'admin/primary/assigngrade');
$data['title'] = 'Assign Grade with Class and Subject wise';
//$teacher = $this->teacher_model->get();
//$teacher = $this->staff_model->getStaffbyrole(2);
//$data['teacherlist'] = $teacher;
$subject = $this->subject_model->get();
$data['subjectlist'] = $subject;
$class = $this->class_model->get();
$data['classlist'] = $class;
$userdata = $this->customlib->getUserData();
$this->form_validation->set_rules('class_id', 'Class Id', 'required');
// if(($userdata["role_id"] == 2) && ($userdata["class_teacher"] == "yes")){
// $data["classlist"] = $this->customlib->getclassteacher($userdata["id"]);
// }
$this->load->view('layout/header', $data);
$this->load->view('admin/grades/assignGrade', $data);
$this->load->view('layout/footer', $data);
//$s['session_id'] = $this->setting_model->getCurrentSession();
// $dt = $this->classsection_model->getDetailbyClassSection($class_id, $section_id);
if ($this->input->server('REQUEST_METHOD') == 'POST') {
$class_id = $this->input->post('class_id');
$section_id = $this->input->post('section_id');
$student_id = $this->input->post('pstudent_id');
//Switch on class_id for parameters
switch ($class_id) {
case intval($class_id) > 14:
$s = array(
'student_id' => $student_id,
'class_id' => $class_id,
'section_id' => $section_id,
'subject_id' => $_POST['psubject_id'],
'ca1' => floatval($_POST['ca1']),
'ca2' => floatval($_POST['ca2']),
'ca3' => floatval($_POST['ca3']),
'ca4' => floatval($_POST['tca']),
'ca5' => 0.0,
'ca6' => 0.0,
'exam' => $_POST['exam'],
'total' => array_sum([floatval($_POST['ca1']), floatval($_POST['ca2']), floatval($_POST['ca3']), floatval($_POST['exam'])]),
);
Просмотр
<?php
if (!empty($subjectScores)){
$display = '';
$condis = '';
$class_id = $student['class_id'];
switch ($class_id) {
case $class_id > 14:
$display = '<theader><th class="col-md-4 btn-info">Subject</th><th class="col-md-1">CA1</th><th class="col-md-1">CA2</th><th class="col-md-1">CA3</th><th class="col-md-1">TCA</th><th class="col-md-1">EXAM</th><th class="col-md-1">TOTAL</th><th class="col-md-1">GRADE</th><th class="col-md-1">REMARK</th></theader>';
foreach ($subjectScores as $key => $value) {
$condis .= '<tr>' . '<td class="btn-warning" style="border-radius: 5px; margin-top: 3px;">'. $value['subject'] . '</td>' . '<td>' . $value['ca1'] . '</td>' . '<td>' . $value['ca2'] . '</td>' . '<td>' . $value['ca3'] . '</td>' . '<td>' . $value['ca4'] . '</td>'. '<td>' .
$value['exam'] . '</td>' . '<td>' . $value['score'] . '</td>' . '<td>' . $value['grade'] . '</td>' . '<td>' . $value['remark'] . '</td></tr>';
}
break;
Как отобразитьсгенерированные замечания конкретного учащегося в поле зрения?