当前位置: 首页>>代码示例>>PHP>>正文


PHP Student::get_by_id方法代码示例

本文整理汇总了PHP中Student::get_by_id方法的典型用法代码示例。如果您正苦于以下问题:PHP Student::get_by_id方法的具体用法?PHP Student::get_by_id怎么用?PHP Student::get_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Student的用法示例。


在下文中一共展示了Student::get_by_id方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: batch_save_solutions

 public function batch_save_solutions($task_set_id)
 {
     $this->_transaction_isolation();
     $this->db->trans_begin();
     $task_set = new Task_set();
     $task_set->get_by_id($task_set_id);
     if ($task_set->exists()) {
         $data = $this->input->post('batch_valuation');
         $saved_count = 0;
         $save_status = TRUE;
         if (is_array($data) && count($data) > 0) {
             foreach ($data as $student_id => $solution_data) {
                 $student = new Student();
                 $student->get_by_id($student_id);
                 $task_set_check = new Task_set();
                 $task_set_check->where_related('course/participant/student', 'id', intval($student_id));
                 $task_set_check->where_related('course/participant', 'allowed', 1);
                 $task_set_check->group_start();
                 $task_set_check->or_group_start();
                 $task_set_check->group_start();
                 $task_set_check->or_where('group_id', NULL);
                 $task_set_check->or_where('`course_participants`.`group_id` = `task_sets`.`group_id`');
                 $task_set_check->group_end();
                 $task_set_check->where_subquery(0, '(SELECT COUNT(`tsp`.`id`) AS `count` FROM `task_set_permissions` tsp WHERE `tsp`.`task_set_id` = `task_sets`.`id` AND `tsp`.`enabled` = 1)');
                 $task_set_check->group_end();
                 $task_set_check->or_where_related('task_set_permission', '`group_id` = `course_participants`.`group_id`');
                 $task_set_check->or_where_related('solution', 'student_id', $student->id);
                 $task_set_check->group_end();
                 $task_set_check->get_by_id($task_set_id);
                 if ($student->exists() && $task_set_check->exists() && array_key_exists('points', $solution_data) && is_numeric($solution_data['points'])) {
                     $solution = new Solution();
                     $solution->where_related_student('id', $student->id);
                     $solution->where_related_task_set('id', $task_set->id);
                     $solution->get();
                     if (is_null($solution->points) || floatval($solution->points) !== floatval($solution_data['points']) || $solution->not_considered != intval(@$solution_data['not_considered'])) {
                         $solution->teacher_id = $this->usermanager->get_teacher_id();
                         $solution->points = floatval($solution_data['points']);
                         $solution->revalidate = 0;
                         $solution->not_considered = intval(@$solution_data['not_considered']);
                         $save_status = $save_status & $solution->save(array($task_set, $student));
                         $saved_count++;
                     }
                 }
             }
         }
         if ($this->db->trans_status() && $save_status && $saved_count > 0) {
             $this->db->trans_commit();
             $this->messages->add_message('lang:admin_solutions_batch_valuation_success_message_save_ok', Messages::MESSAGE_TYPE_SUCCESS);
             $this->_action_success();
         } else {
             $this->db->trans_rollback();
             $this->messages->add_message('lang:admin_solutions_batch_valuation_error_message_save_failed', Messages::MESSAGE_TYPE_ERROR);
         }
     } else {
         $this->db->trans_rollback();
         $this->messages->add_message('lang:admin_solutions_batch_valuation_error_message_save_failed', Messages::MESSAGE_TYPE_ERROR);
     }
     redirect(create_internal_url('admin_solutions/batch_valuation_list/' . $task_set_id));
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:59,代码来源:solutions.php

示例2: select_group

 public function select_group()
 {
     $group_id = $this->input->post('group_id');
     $this->_transaction_isolation();
     $this->db->trans_begin();
     $group = new Group();
     $group->get_by_id($group_id);
     if ($group->exists()) {
         $course = $group->course->get();
         if (is_null($course->groups_change_deadline) || date('U', strtotime($course->groups_change_deadline)) >= time()) {
             $student = new Student();
             $student->get_by_id($this->usermanager->get_student_id());
             if ($student->is_related_to('active_course', $course->id)) {
                 $participant = new Participant();
                 $participant->where_related($student);
                 $participant->where_related($course);
                 $participant->where('allowed', 1);
                 $participant->get();
                 if ($participant->exists()) {
                     if (!$participant->is_related_to($group)) {
                         $participant->save($group);
                         $participant->where_related($course);
                         $participant->where_related($group);
                         $participant->where('allowed', 1);
                         $participants_count = $participant->count();
                         $room = new Room();
                         $room->where_related($group)->order_by('capacity', 'asc')->limit(1)->get();
                         if ($participants_count > intval($room->capacity)) {
                             $this->db->trans_rollback();
                             $this->messages->add_message('lang:groups_message_group_is_full', Messages::MESSAGE_TYPE_ERROR);
                         } else {
                             $this->db->trans_commit();
                             $this->messages->add_message(sprintf($this->lang->line('groups_message_group_changed'), $this->lang->text($group->name)), Messages::MESSAGE_TYPE_SUCCESS);
                             $this->_action_success();
                             $this->output->set_internal_value('course_id', $participant->course_id);
                         }
                     } else {
                         $this->db->trans_rollback();
                         $this->messages->add_message('lang:groups_message_you_are_in_group', Messages::MESSAGE_TYPE_ERROR);
                     }
                 } else {
                     $this->db->trans_rollback();
                     $this->messages->add_message('lang:groups_message_cant_found_participant_record', Messages::MESSAGE_TYPE_ERROR);
                 }
             } else {
                 $this->db->trans_rollback();
                 $this->messages->add_message('lang:groups_message_cant_change_group_of_inactive_course', Messages::MESSAGE_TYPE_ERROR);
             }
         } else {
             $this->db->trans_rollback();
             $this->messages->add_message('lang:groups_message_groups_switching_disabled', Messages::MESSAGE_TYPE_ERROR);
         }
     } else {
         $this->db->trans_rollback();
         $this->messages->add_message('lang:groups_message_group_not_found', Messages::MESSAGE_TYPE_ERROR);
     }
     redirect(create_internal_url('groups'));
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:58,代码来源:groups.php

示例3: header

}
if ($page > $total_pages) {
    $page = $total_pages;
}
$start = $limit * $page - $limit;
if ($start < 0) {
    $start = 0;
}
if (!$sidx) {
    $sidx = 1;
}
$grades = Grade::get_by_sql("SELECT * FROM " . T_STUDENT_GRADES . $where . " ORDER BY {$sidx} {$sord} LIMIT {$start} , {$limit}");
header("Content-type: text/xml;charset=utf-8");
$s = "<?xml version='1.0' encoding='utf-8'?>";
$s .= "<rows>";
$s .= "<page>" . $page . "</page>";
$s .= "<total>" . $total_pages . "</total>";
$s .= "<records>" . $count . "</records>";
foreach ($grades as $grade) {
    $student = Student::get_by_id($grade->student_id);
    $s .= "<row id='" . $grade->id . "'>";
    $s .= "<cell></cell>";
    $s .= "<cell>" . $grade->id . "</cell>";
    $s .= "<cell>" . $grade->grade . "</cell>";
    $s .= "<cell>" . $grade->subject_id . "</cell>";
    $s .= "<cell>" . $student->id . "</cell>";
    $s .= "<cell>" . $student->get_full_name() . "</cell>";
    $s .= "</row>";
}
$s .= "</rows>";
echo $s;
开发者ID:NemOry,项目名称:OnlineSubjectEvaluationSystem,代码行数:31,代码来源:teacherstudents_xml.php

示例4: strtotime

        $discovery->referrals = $_POST['e_referrals'];
        $discovery->others = $_POST['e_others'];
        $discovery->update();
        //----------------------------------------------------------------------------------------------------------------------------------//
        $enrollmentDetail = EnrollmentDetail::get_by_id($student->enrollment_detail_id);
        $enrollmentDetail->status = $_POST['f_status'];
        $enrollmentDetail->program = $_POST['f_program'];
        $enrollmentDetail->schedule = $_POST['f_schedule'];
        $enrollmentDetail->payment = $_POST['f_payment'];
        $enrollmentDetail->studentcontactnumber = $_POST['f_studentcontactnumber'];
        $enrollmentDetail->update();
        //----------------------------------------------------------------------------------------------------------------------------------//
        $appointmentDetail = AppointmentDetail::get_by_id($student->appointment_detail_id);
        $appointmentDetail->visitschedule = strtotime($_POST['g_visitschedule']);
        $appointmentDetail->visitpurpose = $_POST['g_visitpurpose'];
        $appointmentDetail->officer = $_POST['g_officer'];
        $appointmentDetail->update();
        //----------------------------------------------------------------------------------------------------------------------------------//
    } else {
        if ($_POST['oper'] == 'del') {
            $student = Student::get_by_id($_POST['id']);
            $student->delete();
            AppointmentDetail::get_by_id($student->appointment_detail_id)->delete();
            EnrollmentDetail::get_by_id($student->enrollment_detail_id)->delete();
            StiDiscovery::get_by_id($student->sti_discovery_id)->delete();
            SchoolConsidered::get_by_id($student->school_considered_id)->delete();
            SchoolLastAttended::get_by_id($student->school_last_attended_id)->delete();
            PersonalInformation::get_by_id($student->personal_information_id)->delete();
        }
    }
}
开发者ID:NemOry,项目名称:OnlineStudentInformationSystem,代码行数:31,代码来源:students_manipulate.php

示例5:

?>
</h2>
        <h2>Subjects and Grades of <?php 
echo Student::get_by_id($student_id)->get_full_name();
?>
</h2>
        <h2>Course <?php 
echo Course::get_by_id(Student::get_by_id($student_id)->course_id)->code;
?>
</h2>
        <h2>Semester <?php 
echo Student::get_by_id($student_id)->semester;
?>
</h2>
        <h2>Year <?php 
echo Student::get_by_id($student_id)->year;
?>
</h2>
    </header>

    <section id="main_section">

        <section id="main_content">

          <a href="#" id="btn-message" style="color:white; background: #3182c1; border:none;">Send Message to Admins</a>
          <a href="logout.php" style="color:white; background: #3182c1; border:none;">Logout</a>

          <div id="tabs">
              <ul>
                  <li><a href="student_grades_subjects2.php?student_id=<?php 
echo $student_id;
开发者ID:NemOry,项目名称:OnlineSubjectEvaluationSystem,代码行数:31,代码来源:student_infos2.php

示例6: add_participant

 public function add_participant()
 {
     $this->load->library('form_validation');
     $this->form_validation->set_rules('participant[course]', 'lang:admin_participants_form_field_course', 'required');
     $this->form_validation->set_rules('participant[students][]', 'lang:admin_participants_form_field_students', 'required');
     if ($this->form_validation->run()) {
         $this->_transaction_isolation();
         $this->db->trans_begin();
         $process_ok = TRUE;
         $participant_data = $this->input->post('participant');
         $course = new Course();
         $course->get_by_id(intval($participant_data['course']));
         $group = new Group();
         $group->get_by_id(intval(@$participant_data['group']));
         if (!$course->exists()) {
             $this->db->trans_rollback();
             $this->messages->add_message('lang:admin_participants_message_course_not_exists', Messages::MESSAGE_TYPE_ERROR);
             $process_ok = FALSE;
         }
         if ($process_ok && $course->exists()) {
             if ($group->exists() && !$group->is_related_to($course)) {
                 $this->db->trans_rollback();
                 $this->messages->add_message('lang:admin_participants_message_group_not_belongs_to_course', Messages::MESSAGE_TYPE_ERROR);
                 $process_ok = FALSE;
             }
         }
         $disapproved = 0;
         $added = 0;
         if ($process_ok) {
             foreach ($participant_data['students'] as $student_id) {
                 $student = new Student();
                 $student->where_related('participant/course', 'id', $course->id);
                 $student->get_by_id($student_id);
                 if ($student->exists()) {
                     continue;
                 }
                 $student->get_by_id($student_id);
                 $participant = new Participant();
                 $participant->allowed = intval(@$participant_data['allowed']);
                 $participant->save(array($student, $course, $group));
                 $added++;
                 if ($participant->allowed == 1) {
                     $disallowe_participant = FALSE;
                     if ($course->participant->where('allowed', 1)->count() > intval($course->capacity)) {
                         $disallowe_participant = TRUE;
                     }
                     if ($group->exists()) {
                         $group_for_test = new Group();
                         $rooms = $group_for_test->room;
                         $rooms->select_min('capacity');
                         $rooms->where('group_id', '${parent}.id', FALSE);
                         $group_for_test->select_subquery($rooms, 'group_capacity');
                         $group_for_test->include_related_count('participant');
                         $group_for_test->where_related_participant('allowed', 1);
                         $group_for_test->get_by_id(intval($group->id));
                         if ($group_for_test->exists()) {
                             if (intval($group_for_test->participant_count) > intval($group_for_test->group_capacity)) {
                                 $disallowe_participant = TRUE;
                             }
                         }
                     }
                     if ($disallowe_participant) {
                         $participant->allowed = 0;
                         $participant->save();
                         $disapproved++;
                     }
                 }
             }
         }
         if ($this->db->trans_status() && $process_ok) {
             $this->db->trans_commit();
             $info_approved = intval(@$participant_data['allowed']) == 1 ? $added - $disapproved : 0;
             $info_disappoved = intval(@$participant_data['allowed']) == 1 ? $disapproved : $added;
             $message = sprintf($this->lang->line('admin_participants_message_addition_successfull'), $info_approved, $info_disappoved);
             $this->messages->add_message($message, Messages::MESSAGE_TYPE_SUCCESS);
             $this->_action_success();
         } else {
             $this->db->trans_rollback();
             $this->messages->add_message('lang:admin_participants_messages_error_in_addition_transaction', Messages::MESSAGE_TYPE_ERROR);
         }
         redirect(create_internal_url('admin_participants/add_participant_form'));
     } else {
         $this->add_participant_form();
     }
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:85,代码来源:participants.php

示例7: get_task_set

 private function get_task_set($task_set_id, &$course, &$student)
 {
     $student = new Student();
     $student->get_by_id($this->usermanager->get_student_id());
     $course = new Course();
     $course->where_related('active_for_student', 'id', $student->id);
     $course->where_related('participant', 'student_id', $student->id);
     $course->where_related('participant', 'allowed', 1);
     $course->include_related('period', 'name');
     $course->get();
     $task_set = new Task_set();
     if ($course->exists()) {
         $task_set->where('published', 1);
         $task_set->where_related_course($course);
         $task_set->include_related('solution');
         $task_set->add_join_condition('`solutions`.`student_id` = ?', array($student->id));
         $task_set->include_related('solution/teacher', 'fullname');
         $task_set->include_related_count('task', 'total_tasks');
         $task_set->where('content_type', 'project');
         $task_set->include_related('project_selection');
         $task_set->add_join_condition('`project_selections`.`student_id` = ? AND `project_selections`.`task_set_id` = `task_sets`.`id`', array($student->id));
         $task_set->include_related('project_selection/task');
         $task_set->order_by('publish_start_time', 'asc');
         $task_set->order_by('upload_end_time', 'asc');
         $task_set->order_by_with_overlay('name', 'asc');
         $task_set->get_by_id((int) $task_set_id);
     }
     return $task_set;
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:29,代码来源:projects.php

示例8:

    <header id="main_header">
        <h1>Subject Evaluation System</h1>
        <h2>Subjects and Grades of <?php 
echo Student::get_by_id($_GET['student_id'])->get_full_name();
?>
</h2>
        <h2>Course <?php 
echo Course::get_by_id(Student::get_by_id($_GET['student_id'])->course_id)->code;
?>
</h2>
        <h2>Semester <?php 
echo Student::get_by_id($_GET['student_id'])->semester;
?>
</h2>
        <h2>Year Level <?php 
echo Student::get_by_id($_GET['student_id'])->year;
?>
</h2>
    </header>

    <section id="main_section">

        <section id="main_content">

          <a href="logout.php" style="color:white;">Logout</a>
          
          <div id="tabs">
              <ul>

                  <?php 
$student_grades_subjects_enabled = false;
开发者ID:NemOry,项目名称:OnlineSubjectEvaluationSystem,代码行数:31,代码来源:student_infos.php

示例9: log_in_as_student

 public function log_in_as_student()
 {
     $uri_data = $this->uri->ruri_to_assoc(3);
     if (isset($uri_data['student_id'])) {
         $student = new Student();
         $student->get_by_id((int) $uri_data['student_id']);
         if ($this->usermanager->force_student_login($student)) {
             $this->messages->add_message('lang:students_force_loged_in', Messages::MESSAGE_TYPE_SUCCESS);
             redirect(create_internal_url('/'));
         }
     }
     $this->messages->add_message('lang:admin_students_failed_to_force_login', Messages::MESSAGE_TYPE_ERROR);
     redirect(create_internal_url('admin_students'));
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:14,代码来源:students.php

示例10: select_project

 public function select_project($task_set_id, $task_id, $student_id)
 {
     $output = new stdClass();
     $output->message = '';
     $output->status = FALSE;
     $this->_transaction_isolation();
     $this->db->trans_begin();
     $task_set = new Task_set();
     $task_set->where('content_type', 'project');
     $task_set->get_by_id((int) $task_set_id);
     $task = new Task();
     $task->get_by_id((int) $task_id);
     $student = new Student();
     $student->get_by_id((int) $student_id);
     $course = new Course();
     $course->where_related_task_set($task_set);
     $course->get();
     $participant = new Participant();
     $participant->where_related_course($course);
     $participant->where_related($student);
     $participant->where('allowed', 1);
     $participant->get();
     $project_selection = new Project_selection();
     $project_selection->where_related_student($student);
     $project_selection->where_related_task_set($task_set);
     $project_selection->get();
     if ($task_set->exists() && $task->exists() && $task_set->is_related_to($task) && $student->exists() && $course->exists() && $participant->exists()) {
         if ($task_set->get_student_files_count($student->id) == 0) {
             $all_project_selections = new Project_selection();
             $all_project_selections->where_related_task_set($task_set);
             $all_project_selections->where_related_task($task);
             $currently_selected = $all_project_selections->count();
             $jf_task = $task_set->task->include_join_fields()->get_by_id($task_id);
             $maximum_selections = (int) $jf_task->join_max_projects_selections;
             if ($project_selection->exists()) {
                 if (!$project_selection->is_related_to($task)) {
                     if ($currently_selected < $maximum_selections) {
                         $project_selection->save($task);
                         $output->status = TRUE;
                         $output->message = $this->lang->line('admin_task_sets_project_selection_success');
                     } else {
                         $output->message = $this->lang->line('admin_task_sets_project_selection_no_room');
                     }
                 } else {
                     $output->message = $this->lang->line('admin_task_sets_project_selection_already_selected');
                 }
             } else {
                 if ($currently_selected < $maximum_selections) {
                     $project_selection->save(array('student' => $student, 'task_set' => $task_set, 'task' => $task));
                     $output->status = TRUE;
                     $output->message = $this->lang->line('admin_task_sets_project_selection_success');
                 } else {
                     $output->message = $this->lang->line('admin_task_sets_project_selection_no_room');
                 }
             }
         } else {
             $output->message = $this->lang->line('admin_task_sets_project_selection_already_submited_solutions');
         }
     } else {
         $output->message = $this->lang->line('admin_task_sets_project_selection_cant_find_data');
     }
     if ($output->status) {
         $this->db->trans_commit();
         $this->_action_success();
     } else {
         $this->db->trans_rollback();
     }
     $this->output->set_content_type('application/json');
     $this->output->set_output(json_encode($output));
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:70,代码来源:task_sets.php

示例11: mysql_query

if (!$sidx) {
    $sidx = 1;
}
$result = mysql_query("SELECT DISTINCT " . C_EVALUATED_STUDENT_ID . " FROM " . T_EVALUATED_SUBJECTS);
$distinct_ids = array();
while ($row = mysql_fetch_array($result)) {
    array_push($distinct_ids, $row['student_id']);
}
header("Content-type: text/xml;charset=utf-8");
$s = "<?xml version='1.0' encoding='utf-8'?>";
$s .= "<rows>";
$s .= "<page>" . $page . "</page>";
$s .= "<total>" . $total_pages . "</total>";
$s .= "<records>" . $count . "</records>";
foreach ($distinct_ids as $id) {
    $this_student = Student::get_by_id($id);
    $s .= "<row id='" . $this_student->id . "'>";
    $s .= "<cell></cell>";
    $s .= "<cell>" . $this_student->id . "</cell>";
    $s .= "<cell>" . $this_student->student_id . "</cell>";
    $s .= "<cell>" . $this_student->password . "</cell>";
    $s .= "<cell>" . $this_student->first_name . "</cell>";
    $s .= "<cell>" . $this_student->middle_name . "</cell>";
    $s .= "<cell>" . $this_student->last_name . "</cell>";
    $s .= "<cell>" . Course::get_by_id($this_student->course_id)->code . "</cell>";
    $s .= "<cell>" . $this_student->semester . "</cell>";
    $s .= "<cell>" . $this_student->year . "</cell>";
    $s .= "</row>";
}
$s .= "</rows>";
echo $s;
开发者ID:NemOry,项目名称:OnlineSubjectEvaluationSystem,代码行数:31,代码来源:evaluated_students_xml.php

示例12: get_task_set_by_id

 private function get_task_set_by_id(&$course, &$group, &$student, $task_set_id)
 {
     $student = new Student();
     $student->get_by_id($this->usermanager->get_student_id());
     $course = new Course();
     $course->where_related('active_for_student', 'id', $student->id);
     $course->where_related('participant', 'student_id', $student->id);
     $course->where_related('participant', 'allowed', 1);
     $course->include_related('period', 'name');
     $course->get();
     $task_set = new Task_set();
     $task_set2 = new Task_set();
     $group = new Group();
     if ($course->exists()) {
         $group->where_related_participant('student_id', $student->id);
         $group->where_related_participant('course_id', $course->id);
         $group->get();
         $task_set->select('`task_sets`.*, `rooms`.`time_day` AS `pb_time_day`, `rooms`.`time_begin` AS `pb_time_begin`, `rooms`.`id` AS `pb_room_id`, `task_sets`.`publish_start_time` AS `pb_publish_start_time`, `task_sets`.`upload_end_time` AS `pb_upload_end_time`');
         $task_set->where('published', 1);
         $task_set->where_related_course($course);
         $task_set->include_related('solution');
         $task_set->add_join_condition('`solutions`.`student_id` = ?', array($student->id));
         $task_set->where_subquery(0, '(SELECT COUNT(`tsp`.`id`) AS `count` FROM `task_set_permissions` tsp WHERE `tsp`.`task_set_id` = `task_sets`.`id` AND `tsp`.`enabled` = 1)');
         $task_set->group_start();
         $task_set->or_where('group_id', NULL);
         $task_set->or_where('group_id', $group->id);
         $task_set->group_end();
         $task_set->include_related('room', '*', TRUE, TRUE);
         $task_set->include_related_count('task', 'total_tasks');
         $task_set->include_related('task_set_type');
         $task_set->select_subquery('(SELECT SUM(`points_total`) AS `points` FROM `task_task_set_rel` WHERE `task_set_id` = `${parent}`.`id` AND `task_task_set_rel`.`bonus_task` = 0)', 'total_points');
         $task_set->where('id', $task_set_id);
         $task_set->include_related('course', 'test_scoring_deadline');
         $task_set->where('content_type', 'task_set');
         $task_set2->select('`task_sets`.*, `task_set_permission_rooms`.`time_day` AS `pb_time_day`, `task_set_permission_rooms`.`time_begin` AS `pb_time_begin`, `task_set_permission_rooms`.`id` AS `pb_room_id`, `task_set_permissions`.`publish_start_time` AS `pb_publish_start_time`, `task_set_permissions`.`upload_end_time` AS `pb_upload_end_time`');
         $task_set2->where('published', 1);
         $task_set2->where_related_course($course);
         $task_set2->where_related('task_set_permission', 'group_id', $group->id);
         $task_set2->where_related('task_set_permission', 'enabled', 1);
         $task_set2->include_related('solution');
         $task_set2->add_join_condition('`solutions`.`student_id` = ?', array($student->id));
         $task_set2->include_related('task_set_permission/room', '*', 'room', TRUE);
         $task_set2->include_related_count('task', 'total_tasks');
         $task_set2->include_related('task_set_type');
         $task_set2->select_subquery('(SELECT SUM(`points_total`) AS `points` FROM `task_task_set_rel` WHERE `task_set_id` = `${parent}`.`id` AND `task_task_set_rel`.`bonus_task` = 0)', 'total_points');
         $task_set2->where('id', $task_set_id);
         $task_set2->include_related('course', 'test_scoring_deadline');
         $task_set2->where('content_type', 'task_set');
         $task_set3 = new Task_set();
         $task_set3->select('`task_sets`.*, NULL AS `pb_time_day`, NULL AS `pb_time_begin`, NULL AS `pb_room_id`, NULL AS `pb_publish_start_time`, "0000-00-00 00:00:00" AS `pb_upload_end_time`', FALSE);
         $task_set3->where('published', 1);
         $task_set3->where_related_course($course);
         $task_set3->include_related('solution');
         $task_set3->add_join_condition('`solutions`.`student_id` = ?', array($student->id));
         $task_set3->where_related('solution', 'student_id', $student->id);
         $task_set3->include_related('room', '*', TRUE, TRUE);
         $task_set3->include_related_count('task', 'total_tasks');
         $task_set3->include_related('task_set_type');
         $task_set3->select_subquery('(SELECT SUM(`points_total`) AS `points` FROM `task_task_set_rel` WHERE `task_set_id` = `${parent}`.`id` AND `task_task_set_rel`.`bonus_task` = 0)', 'total_points');
         $task_set3->where('id', $task_set_id);
         $task_set3->include_related('course', 'test_scoring_deadline');
         $task_set3->where('content_type', 'task_set');
         $task_set2->union(array($task_set, $task_set3), FALSE, '', 1, 0, 'id');
     }
     return $task_set2;
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:66,代码来源:tasks.php

示例13: evaluate_test_result

 public function evaluate_test_result($task_set_id, $student_id, $version, $test_type, $token)
 {
     $task_set = new Task_set();
     $task_set->include_related('course', 'test_scoring_deadline');
     $task_set->get_by_id((int) $task_set_id);
     $student = new Student();
     $student->get_by_id((int) $student_id);
     $output = new stdClass();
     $output->result = FALSE;
     $output->message = '';
     $output->points_new = 0;
     $output->points_before = 0;
     $this->load->model('test_score');
     if ($task_set->exists() && $student->exists()) {
         if ($task_set->course_test_scoring_deadline >= date('Y-m-d H:i:s') && $task_set->enable_tests_scoring > 0) {
             $results = $this->test_score->get_data_for_student($student->id, $token, $test_type);
             $this->_transaction_isolation();
             $this->db->trans_start();
             $tests = new Test();
             $tests->where_related('task/task_set', 'id', $task_set->id);
             $tests->where('type', $test_type);
             $tests->where('enable_scoring >', 0);
             $tests->group_by('task_id');
             $tests->where('task_task_task_set_rel.bonus_task', 0);
             $tests->get_iterated();
             //$output->debug = $tests->check_last_query(array('', ''), TRUE);
             $test_count = $tests->result_count();
             $min_results = $task_set->test_min_needed > $test_count ? $test_count : $task_set->test_min_needed;
             $course = new Course();
             $course->where_related_task_set('id', $task_set->id);
             $course->get();
             $min_points_limit = -$course->default_points_to_remove;
             if ($test_count > 0) {
                 $total_score = 0;
                 $score_array = array();
                 $bonus_tasks_array = array();
                 $score_percentage = array();
                 $bonus_tasks_percentage = array();
                 if (count($results)) {
                     foreach ($results as $task_id => $score) {
                         $this->db->select('*');
                         $this->db->where('task_set_id', $task_set->id);
                         $this->db->where('task_id', (int) $task_id);
                         $query = $this->db->get('task_task_set_rel');
                         if ($query->num_rows() > 0) {
                             $task_rel = $query->row_object();
                             $min = $task_rel->test_min_points;
                             $max = $task_rel->test_max_points;
                             $diff = abs($max - $min);
                             $score_percent = (double) $score / 100;
                             $sub_score = round(10 * ($min + $diff * $score_percent)) / 10;
                             if ($task_rel->bonus_task == 0) {
                                 $score_array[$task_id] = $sub_score;
                                 $score_percentage[$task_id] = $score;
                             } else {
                                 $bonus_tasks_array[$task_id] = $sub_score;
                                 $bonus_tasks_percentage[$task_id] = $score;
                             }
                         }
                         $query->free_result();
                     }
                 }
                 $max_results = $task_set->test_max_allowed < count($score_array) ? $task_set->test_max_allowed : count($score_array);
                 arsort($score_array, SORT_NUMERIC);
                 $i = 0;
                 foreach ($score_array as $task_id => $points) {
                     if ($i < $max_results) {
                         $total_score += $points;
                         $i++;
                     } else {
                         break;
                     }
                 }
                 $total_score = $total_score < $min_points_limit ? $min_points_limit : $total_score;
                 arsort($bonus_tasks_array, SORT_NUMERIC);
                 $total_score += array_sum($bonus_tasks_array);
                 if (count($score_array) >= $min_results) {
                     $tasks = new Task();
                     $tasks->where_related_task_set('id', $task_set_id);
                     $tasks->order_by('`task_task_set_rel`.`sorting`', 'asc');
                     $tasks->get_iterated();
                     //$output->debug = $tasks->check_last_query(array('', ''), TRUE);
                     $output->evaluation = $this->parser->parse('backend/tests/evaluation_table.tpl', array('tasks' => $tasks, 'real_points' => $score_array, 'bonus_points' => $bonus_tasks_array, 'real_percentage' => $score_percentage, 'bonus_percentage' => $bonus_tasks_percentage, 'max_results' => $max_results), TRUE);
                     $solution = new Solution();
                     $solution->where('task_set_id', $task_set->id);
                     $solution->where('student_id', $student->id);
                     $solution->get();
                     $save_solution = FALSE;
                     $solution_not_considered = FALSE;
                     $output->points_new = $total_score;
                     if ($solution->exists()) {
                         if ($solution->not_considered == 0) {
                             $output->points_before = $solution->points;
                             if ($solution->points < $total_score || is_null($solution->points)) {
                                 $solution->points = $total_score;
                                 $solution->comment = '';
                                 $solution->teacher_id = NULL;
                                 $solution->best_version = (int) $version;
                                 $solution->revalidate = 0;
                                 $save_solution = TRUE;
//.........这里部分代码省略.........
开发者ID:andrejjursa,项目名称:list-lms,代码行数:101,代码来源:tests.php

示例14: trim

}
$course_id = Course::get_by_sql("SELECT * FROM " . T_COURSES . " WHERE " . C_COURSE_CODE . "='" . trim($_POST['course_code']) . "'")[0]->id;
if ($_POST['oper'] == 'add') {
    $student = new Student();
    $student->student_id = $_POST['student_id'];
    $student->password = $_POST['password'];
    $student->first_name = $_POST['first_name'];
    $student->middle_name = $_POST['middle_name'];
    $student->last_name = $_POST['last_name'];
    $student->course_id = $course_id;
    $student->semester = $_POST['semester'];
    $student->year = $_POST['year'];
    $student->create();
} else {
    if ($_POST['oper'] == 'edit') {
        $student = Student::get_by_id($_POST['id']);
        $student->student_id = $_POST['student_id'];
        $student->password = $_POST['password'];
        $student->first_name = $_POST['first_name'];
        $student->middle_name = $_POST['middle_name'];
        $student->last_name = $_POST['last_name'];
        $student->course_id = $course_id;
        $student->semester = $_POST['semester'];
        $student->year = $_POST['year'];
        $student->update();
    } else {
        if ($_POST['oper'] == 'del') {
            Student::get_by_id($_POST['id'])->delete();
        }
    }
}
开发者ID:NemOry,项目名称:OnlineSubjectEvaluationSystem,代码行数:31,代码来源:update_student.php

示例15: ceil

    $total_pages = ceil($count / $limit);
} else {
    $total_pages = 0;
}
if ($page > $total_pages) {
    $page = $total_pages;
}
$start = $limit * $page - $limit;
if ($start < 0) {
    $start = 0;
}
if (!$sidx) {
    $sidx = 1;
}
$messages = Message::get_by_sql("SELECT * FROM " . T_MESSAGES . " ORDER BY {$sidx} {$sord} LIMIT {$start} , {$limit}");
header("Content-type: text/xml;charset=utf-8");
$s = "<?xml version='1.0' encoding='utf-8'?>";
$s .= "<rows>";
$s .= "<page>" . $page . "</page>";
$s .= "<total>" . $total_pages . "</total>";
$s .= "<records>" . $count . "</records>";
foreach ($messages as $message) {
    $s .= "<row id='" . $message->id . "'>";
    $s .= "<cell></cell>";
    $s .= "<cell>" . $message->id . "</cell>";
    $s .= "<cell>" . $message->message . "</cell>";
    $s .= "<cell>" . Student::get_by_id($message->student_id)->student_id . "</cell>";
    $s .= "</row>";
}
$s .= "</rows>";
echo $s;
开发者ID:NemOry,项目名称:OnlineSubjectEvaluationSystem,代码行数:31,代码来源:messages_xml.php


注:本文中的Student::get_by_id方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。