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


PHP Course::get_by_id方法代码示例

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


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

示例1: render

 public function render()
 {
     $course = new Course();
     $course->include_related('period');
     $course->get_by_id((int) @$this->config['course_id']);
     $this->parser->assign('course', $course);
     if ($course->exists()) {
         $solutions = new Solution();
         $solutions->select_func('COUNT', '@id', 'count');
         $solutions->where('revalidate', 1);
         $solutions->where_related('task_set', 'id', '${parent}.id');
         $solutions->where_related('student/participant/course', 'id', $course->id);
         $solutions->where_related('student/participant', 'allowed', 1);
         $task_sets = new Task_set();
         $task_sets->select('*');
         $task_sets->select_subquery($solutions, 'solutions_count');
         $task_sets->where_related($course);
         $task_sets->where_related('solution', 'revalidate', 1);
         $task_sets->where_related('solution/student/participant/course', 'id', $course->id);
         $task_sets->where_related('solution/student/participant', 'allowed', 1);
         $task_sets->group_by('id');
         $task_sets->order_by_with_overlay('name', 'ASC');
         $task_sets->get_iterated();
         $this->parser->assign('task_sets', $task_sets);
     }
     $this->parser->parse('widgets/admin/unevaluated_solutions/main.tpl');
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:27,代码来源:unevaluated_solutions.php

示例2: render

 public function render()
 {
     if (isset($this->config['course_id'])) {
         $course = new Course();
         $course->include_related('period');
         $course->get_by_id((int) $this->config['course_id']);
         $this->parser->assign('course', $course);
         if ($course->exists()) {
             $task_sets = new Task_set();
             $task_sets->where_related($course);
             $task_sets->where('published', 1);
             $task_sets->where('content_type', 'task_set');
             $task_sets_count = $task_sets->count();
             $this->parser->assign('task_sets_count', $task_sets_count);
             $task_sets->where_related($course);
             $task_sets->where('published', 1);
             $task_sets->where('content_type', 'project');
             $projects_count = $task_sets->count();
             $this->parser->assign('projects_count', $projects_count);
             $groups = new Group();
             $groups->where_related($course);
             $groups_count = $groups->count();
             $this->parser->assign('groups_count', $groups_count);
             $students = new Student();
             $students->where_related('participant/course', 'id', $course->id);
             $students->where_related('participant', 'allowed', 1);
             $students_count = $students->count();
             $this->parser->assign('students_count', $students_count);
             $task_set_permissions = new Task_set_permission();
             $task_set_permissions->select_func('COUNT', '*', 'count');
             $task_set_permissions->where('enabled', 1);
             $task_set_permissions->where_related('task_set', 'id', '${parent}.id');
             $now = date('Y-m-d H:i:s');
             $plus_two_weeks = date('Y-m-d H:i:s', strtotime($now . ' + 2 weeks'));
             $minus_one_week = date('Y-m-d H:i:s', strtotime($now . ' - 1 week'));
             $task_sets->select('id, name, upload_end_time AS min_upload_end_time, upload_end_time AS max_upload_end_time');
             $task_sets->where_related($course);
             $task_sets->where('published', 1);
             $task_sets->where_subquery('0', $task_set_permissions);
             $task_sets->where('upload_end_time >=', $minus_one_week);
             $task_sets->where('upload_end_time <=', $plus_two_weeks);
             $task_sets_2 = new Task_set();
             $task_sets_2->select('id, name');
             $task_sets_2->where_related($course);
             $task_sets_2->where('published', 1);
             $task_sets_2->select_min('task_set_permissions.upload_end_time', 'min_upload_end_time');
             $task_sets_2->select_max('task_set_permissions.upload_end_time', 'max_upload_end_time');
             $task_sets_2->where_related('task_set_permission', 'enabled', 1);
             $task_sets_2->having('(MAX(`task_set_permissions`.`upload_end_time`) >= ' . $this->db->escape($minus_one_week) . ' AND MAX(`task_set_permissions`.`upload_end_time`) <= ' . $this->db->escape($plus_two_weeks) . ')');
             $task_sets_2->or_having('(MIN(`task_set_permissions`.`upload_end_time`) >= ' . $this->db->escape($minus_one_week) . ' AND MIN(`task_set_permissions`.`upload_end_time`) <= ' . $this->db->escape($plus_two_weeks) . ')');
             $task_sets_2->group_by('id');
             $task_sets->union_iterated($task_sets_2, FALSE, 'min_upload_end_time DESC, max_upload_end_time DESC', isset($this->config['number_of_task_sets']) ? (int) $this->config['number_of_task_sets'] : 5);
             $this->parser->assign('task_sets', $task_sets);
         }
     }
     $this->parser->parse('widgets/admin/course_overview/main.tpl');
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:57,代码来源:course_overview.php

示例3: inject_unused_task_set_types

 private function inject_unused_task_set_types($course_id)
 {
     $course = new Course();
     $course->get_by_id(intval($course_id));
     $course->task_set_type->get();
     $course_task_set_types = $course->task_set_type->all_to_single_array('id');
     $task_set_types = new Task_set_type();
     $task_set_types->where_not_in('id', count($course_task_set_types) > 0 ? $course_task_set_types : array(0));
     $query = $task_set_types->order_by('name', 'asc')->get_raw();
     $data = array(NULL => '');
     if ($query->num_rows() > 0) {
         foreach ($query->result() as $row) {
             $data[(int) $row->id] = $row->name;
         }
     }
     $this->parser->assign('task_set_types', $data);
     $query->free_result();
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:18,代码来源:courses.php

示例4: 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

示例5: header

}
//$student_subjects = Grade::get_by_sql("SELECT * FROM " . T_STUDENT_GRADES . " WHERE ".C_GRADE_STUDENT_ID."=".$student->id);
$future_subjects = Subject::get_by_sql("SELECT * FROM " . T_SUBJECTS . " WHERE " . C_SUBJECT_COURSE_ID . "=" . $student->course_id . " AND " . C_SUBJECT_SEMESTER . " = " . $future_sem . " ORDER BY {$sidx} {$sord} LIMIT {$start} , {$limit}");
// $student_current_subjects = array();
// foreach($student_subjects as $student_subject)
// {
//     array_push($student_current_subjects, Subject::get_by_id($student_subject->subject_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>";
if (count($future_subjects) > 0) {
    foreach ($future_subjects as $final_subject) {
        $s .= "<row id='" . $final_subject->id . "'>";
        $s .= "<cell>" . $final_subject->id . "</cell>";
        $s .= "<cell>" . $final_subject->code . "</cell>";
        $s .= "<cell>" . $final_subject->description . "</cell>";
        $s .= "<cell>" . $final_subject->units . "</cell>";
        $subject_code = $final_subject->prereq_subject_id == 0 ? "NONE" : Subject::get_by_id($final_subject->prereq_subject_id)->code;
        $s .= "<cell>" . $subject_code . "</cell>";
        $s .= "<cell>" . Course::get_by_id($final_subject->course_id)->code . "</cell>";
        $s .= "<cell>" . $final_subject->semester . "</cell>";
        $s .= "<cell>" . $final_subject->year . "</cell>";
        $s .= "</row>";
    }
}
$s .= "</rows>";
echo $s;
开发者ID:NemOry,项目名称:OnlineSubjectEvaluationSystem,代码行数:31,代码来源:student_evaluated_subjects_xml.php

示例6: list_import_lamsfet_sets

function list_import_lamsfet_sets(&$sets, $set_types, $courses_terms, $excercise_groups)
{
    echo 'Starting task_sets import (' . count($sets) . ') [';
    if (count($sets)) {
        foreach ($sets as $id => $set) {
            $task_set_type_id = $set_types[$set->set_type_id]->_list_id;
            $task_set_type = new Task_set_type();
            $task_set_type->get_by_id(intval($task_set_type_id));
            $course_id = $courses_terms[$set->course_term_id]->_list_id;
            $course = new Course();
            $course->get_by_id(intval($course_id));
            $group_id = !is_null($set->excercise_group_id) ? $excercise_groups[$set->excercise_group_id]->_list_id : NULL;
            $group = new Group();
            if (!is_null($group_id)) {
                $group->get_by_id(intval($group_id));
            }
            $task_set = new Task_set();
            $task_set->name = $set->name;
            if (!is_null($set->comment)) {
                $task_set->instructions = nl2br($set->comment);
            }
            if (!empty($set->date_from)) {
                $task_set->publish_start_time = $set->date_from;
            }
            if (!empty($set->submit_to)) {
                $task_set->upload_end_time = $set->submit_to;
            }
            $task_set->published = 1;
            $task_set->save(array($task_set_type, $group, $course));
            $sets[$id]->_list_id = $task_set->id;
            echo '.';
        }
    }
    echo '] ... done' . "\n";
}
开发者ID:andrejjursa,项目名称:list-lms,代码行数:35,代码来源:lamsfet_helper.php

示例7: get_course

 /**
  * Returns the course object this object is associated with.
  * Lazy loaded from the value returned by get_c_id().
  * @return \Model\Course
  */
 public function get_course()
 {
     if ($this->course && $this->course->get_id() == $this->c_id) {
         return $this->course;
     }
     $this->course = Course::get_by_id($this->c_id);
     return $this->course;
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:13,代码来源:course_description.class.php

示例8: run_comparation

 public function run_comparation()
 {
     $task_sets_setup_data = $this->input->post('task_sets_setup');
     $solutions_data = $this->input->post('solutions');
     $moss_setup_data = $this->input->post('moss_setup');
     $moss_base_files_data = $this->input->post('moss_base_files');
     $course = new Course();
     $course->get_by_id((int) $task_sets_setup_data['course']);
     $task_set = new Task_set();
     $task_set->where_related($course);
     $task_set->get_by_id(isset($task_sets_setup_data['task_set']) ? (int) $task_sets_setup_data['task_set'] : 0);
     $this->config->load('moss');
     $languages = $this->config->item('moss_langs_for_list');
     asort($languages);
     $this->parser->assign(array('course' => $course, 'task_set' => $task_set, 'languages' => $languages));
     $this->parser->assign('moss_enabled', $this->is_moss_user_id_set());
     if ($course->exists() && $task_set->exists()) {
         $this->load->library('form_validation');
         $this->form_validation->set_rules('solutions', 'lang:admin_moss_list_solutions_form_field_solution_selection', 'callback__selected_solutions');
         $this->form_validation->set_rules('moss_setup[l]', 'lang:admin_moss_list_solutions_form_field_language', 'required');
         $this->form_validation->set_rules('moss_setup[m]', 'lang:admin_moss_list_solutions_form_field_sensitivity', 'required|integer|greater_than[1]');
         $this->form_validation->set_rules('moss_setup[n]', 'lang:admin_moss_list_solutions_form_field_matching_files', 'required|integer|greater_than[1]');
         $this->form_validation->set_message('_selected_solutions', $this->lang->line('admin_moss_list_solutions_validation_callback_selected_solutions'));
         if ($this->form_validation->run() && $this->is_moss_user_id_set()) {
             $solutions = new Solution();
             $solutions->include_related('student');
             $solutions->where_related($task_set);
             $solutions->order_by_related_as_fullname('student', 'fullname', 'asc');
             $solutions->get_iterated();
             $this->parser->assign('solutions', $solutions);
             $tasks = new Task();
             $tasks->where_related($task_set);
             $tasks->get_iterated();
             $base_files_list = array();
             foreach ($tasks as $task) {
                 $base_files_list[$task->id] = array('task_id' => $task->id, 'task_name' => $this->lang->get_overlay_with_default('tasks', $task->id, 'name', $task->name), 'files' => $this->construct_base_files_for_task($task->id));
             }
             $this->parser->assign('base_files_list', $base_files_list);
             $path = $this->get_random_hash_folder($course->id, $task_set->id);
             $path_source = $path . '/source';
             $path_base = $path . '/base';
             @mkdir($path_source, DIR_WRITE_MODE, TRUE);
             @mkdir($path_base, DIR_WRITE_MODE, TRUE);
             $all_extracted = TRUE;
             $moss_langs_extensions = $this->config->item('moss_langs_file_extensions');
             if (isset($moss_langs_extensions[$moss_setup_data['l']])) {
                 $file_extensions = $moss_langs_extensions[$moss_setup_data['l']];
             } else {
                 $all_extracted = FALSE;
             }
             foreach ($solutions_data as $id => $config) {
                 if (!$all_extracted) {
                     break;
                 }
                 if (isset($config['selected']) && $config['selected'] == 1) {
                     set_time_limit(120);
                     $version = isset($config['version']) ? $config['version'] : 0;
                     $student = isset($config['student']) ? $config['student'] : 0;
                     $file = $task_set->get_student_files($student, $version);
                     if (count($file) == 1) {
                         $file = $file[$version];
                         $subdir = '/' . normalize($file['file_name']) . '_sid-' . $file['student_id'] . '_ver-' . $file['version'];
                         $extract_path = $path_source . $subdir;
                         @mkdir($extract_path, DIR_WRITE_MODE, TRUE);
                         $status = $task_set->extract_student_zip_to_folder($file['file'], $extract_path, $file_extensions);
                         $all_extracted = $all_extracted && $status;
                     }
                 }
             }
             if (is_array($moss_base_files_data) && count($moss_base_files_data)) {
                 foreach ($moss_base_files_data as $task_id => $path_array) {
                     if (!$all_extracted) {
                         break;
                     }
                     if (is_array($path_array) && count($path_array)) {
                         foreach ($path_array as $path_hash => $file_path) {
                             if (!$all_extracted) {
                                 break;
                             }
                             if (preg_match('/\\.zip(?P<indexNumberBox>\\[(?P<zipIndexNumber>[0-9]+)\\])$/', $file_path, $matches)) {
                                 $zipfile = mb_substr($file_path, 0, mb_strlen($file_path) - mb_strlen($matches['indexNumberBox']));
                                 $zipindex = (int) $matches['zipIndexNumber'];
                                 $zip = new ZipArchive();
                                 if ($zip->open($zipfile)) {
                                     set_time_limit(120);
                                     @mkdir($path_base . '/' . $task_id . '/' . $path_hash, DIR_WRITE_MODE, TRUE);
                                     if (!$zip->extractTo($path_base . '/' . $task_id . '/' . $path_hash, $zip->getNameIndex($zipindex))) {
                                         $all_extracted = FALSE;
                                     }
                                     $zip->close();
                                 } else {
                                     $all_extracted = FALSE;
                                 }
                             } else {
                                 set_time_limit(120);
                                 @mkdir($path_base . '/' . $task_id . '/' . $path_hash, DIR_WRITE_MODE, TRUE);
                                 $path_info = pathinfo($file_path);
                                 if (!copy($file_path, $path_base . '/' . $task_id . '/' . $path_hash . '/' . $path_info['basename'])) {
                                     $all_extracted = FALSE;
                                 }
//.........这里部分代码省略.........
开发者ID:andrejjursa,项目名称:list-lms,代码行数:101,代码来源:moss.php

示例9: import_single_line

 public function import_single_line()
 {
     $this->output->set_content_type('application/json');
     $firstname = $this->input->post('firstname');
     $lastname = $this->input->post('lastname');
     $fullname = $this->input->post('fullname');
     $email = $this->input->post('email');
     $options = $this->input->post('options');
     $this->parser->assign('firstname', $firstname);
     $this->parser->assign('lastname', $lastname);
     $this->parser->assign('fullname', $fullname);
     $this->parser->assign('email', $email);
     if ((trim($firstname) != '' && trim($lastname) != '' || trim($fullname) != '') && trim($email) != '') {
         $student_fullname = trim($fullname) != '' ? trim($fullname) : trim($firstname) . ' ' . trim($lastname);
         $this->_transaction_isolation();
         $this->db->trans_begin();
         $student = new Student();
         $student->where('email', trim($email));
         $student->get();
         if ($student->exists()) {
             if ($student->fullname != $student_fullname) {
                 $student->fullname = $student_fullname;
                 $student->save();
                 $this->db->trans_commit();
             } else {
                 $this->db->trans_rollback();
             }
             $this->parser->assign('error_message', 'lang:admin_students_csv_import_error_message_student_exists');
         } else {
             $this->load->library('form_validation');
             if ($this->form_validation->valid_email(trim($email))) {
                 $student->email = trim($email);
                 $student->fullname = $student_fullname;
                 $password = '';
                 if ($options['password_type'] == 'default') {
                     $password = $this->config->item('student_import_default_password');
                 } elseif ($options['password_type'] == 'random') {
                     $password = md5(base64_encode(rand(0, 99999999999) . time() . $student->fullname . $student->email) . $this->config->item('encryption_key'));
                     $password = substr($password, 0, rand(6, 20));
                 }
                 $student->password = $password != '' ? sha1($password) : '';
                 $student->language = $this->config->item('language');
                 if ($student->save()) {
                     $this->parser->assign('password', $password);
                     $this->db->trans_commit();
                     $this->parser->assign('success_message', 'lang:admin_students_csv_import_successfully_imported');
                     if ((bool) $options['send_mail']) {
                         if ($password == '') {
                             $this->_transaction_isolation();
                             $this->db->trans_begin();
                             $student->generate_random_password_token();
                             $this->db->trans_commit();
                         }
                         $this->_init_language_for_student($student);
                         $this->load->library('email');
                         $this->email->from_system();
                         $this->email->to($student->email);
                         $this->email->subject($this->lang->line('admin_students_csv_import_email_subject'));
                         $this->email->build_message_body('file:emails/backend/students/csv_import_email.tpl', array('student' => $student, 'password' => $password));
                         $sent = $this->email->send();
                         $this->_init_language_for_teacher();
                         if ($sent) {
                             $this->parser->assign('email_success_message', 'lang:admin_students_csv_import_email_sent_successfully');
                         } else {
                             $this->parser->assign('email_error_message', 'lang:admin_students_csv_import_email_sent_failed');
                         }
                     }
                 } else {
                     $this->db->trans_rollback();
                     $this->parser->assign('error_message', 'lang:admin_students_csv_import_error_message_student_save_error');
                 }
             } else {
                 $this->db->trans_rollback();
                 $this->parser->assign('error_message', 'lang:admin_students_csv_import_error_message_student_email_invalid');
             }
         }
         if ($student->exists()) {
             $this->parser->assign('student_id', $student->id);
             if (intval($options['assign_to_course']) > 0) {
                 $this->_transaction_isolation();
                 $this->db->trans_begin();
                 $course = new Course();
                 $course->get_by_id(intval($options['assign_to_course']));
                 if ($course->exists()) {
                     $participant = new Participant();
                     $participant->where_related('student', 'id', $student->id);
                     $participant->where_related('course', 'id', $course->id);
                     $participant->get();
                     if (!$participant->exists()) {
                         $participant->allowed = 0;
                         if ($participant->save(array('student' => $student, 'course' => $course))) {
                             $this->db->trans_commit();
                             $this->parser->assign('course_assignment_success_message', 'lang:admin_students_csv_import_successfully_added_course_participation');
                             $this->db->trans_begin();
                             $course = new Course();
                             $course->get_by_id(intval($options['assign_to_course']));
                             $participant->allowed = 1;
                             $participant->save();
                             $participants = new Participant();
                             $participants->where_related($course);
//.........这里部分代码省略.........
开发者ID:andrejjursa,项目名称:list-lms,代码行数:101,代码来源:students.php

示例10: run_comparation

 public function run_comparation()
 {
     $task_sets_setup_data = $this->input->post('task_sets_setup');
     $solutions_data = $this->input->post('solutions');
     $comparator_setup_data = $this->input->post('comparator_setup');
     $course = new Course();
     $course->get_by_id((int) $task_sets_setup_data['course']);
     $task_set = new Task_set();
     $task_set->where_related($course);
     $task_set->get_by_id(isset($task_sets_setup_data['task_set']) ? (int) $task_sets_setup_data['task_set'] : 0);
     $this->parser->assign(array('course' => $course, 'task_set' => $task_set));
     if ($course->exists() && $task_set->exists()) {
         $this->load->library('form_validation');
         $this->form_validation->set_rules('solutions', 'lang:admin_comparator_list_solutions_form_field_solution_selection', 'callback__selected_solutions');
         $this->form_validation->set_rules('comparator_setup[threshold]', 'lang:admin_comparator_list_solutions_form_field_threshold', 'required|numeric|greater_than_equal[0]|less_than_equal[1]');
         $this->form_validation->set_rules('comparator_setup[min_tree_size]', 'lang:admin_comparator_list_solutions_form_field_min_tree_size', 'required|integer|greater_than_equal[1]');
         $this->form_validation->set_rules('comparator_setup[max_cutted_tree_size]', 'lang:admin_comparator_list_solutions_form_field_max_cutted_tree_size', 'required|integer|greater_than_field_or_equal[comparator_setup[min_tree_size]]');
         $this->form_validation->set_rules('comparator_setup[branching_factor]', 'lang:admin_comparator_list_solutions_form_field_branching_factor', 'required|integer|greater_than_equal[1]');
         $this->form_validation->set_rules('comparator_setup[min_similarity]', 'lang:admin_comparator_list_solutions_form_field_minimum_similarity', 'required|numeric|greater_than_equal[0]|less_than_equal[1]');
         $this->form_validation->set_rules('comparator_setup[timeout]', 'lang:admin_comparator_list_solutions_form_field_timeout', 'required|integer|greater_than_equal[1]');
         $this->form_validation->set_message('_selected_solutions', $this->lang->line('admin_comparator_list_solutions_validation_callback_selected_solutions'));
         if ($this->form_validation->run()) {
             $solutions = new Solution();
             $solutions->include_related('student');
             $solutions->where_related($task_set);
             $solutions->order_by_related_as_fullname('student', 'fullname', 'asc');
             $solutions->get_iterated();
             $this->parser->assign('solutions', $solutions);
             $path = $this->get_random_hash_folder($course->id, $task_set->id);
             $path_source = $path . '/source';
             $path_output = $path . '/output';
             @mkdir($path_source, DIR_WRITE_MODE, TRUE);
             @mkdir($path_output, DIR_WRITE_MODE, TRUE);
             $all_extracted = TRUE;
             foreach ($solutions_data as $id => $config) {
                 if (isset($config['selected']) && $config['selected'] == 1) {
                     set_time_limit(120);
                     $version = isset($config['version']) ? $config['version'] : 0;
                     $student = isset($config['student']) ? $config['student'] : 0;
                     $file = $task_set->get_student_files($student, $version);
                     if (count($file) == 1) {
                         $file = $file[$version];
                         $subdir = '/' . normalize($file['file_name']) . '_sid-' . $file['student_id'] . '_ver-' . $file['version'];
                         $extract_path = $path_source . $subdir;
                         @mkdir($extract_path, DIR_WRITE_MODE, TRUE);
                         $status = $task_set->extract_student_zip_to_folder($file['file'], $extract_path, array('java'));
                         $all_extracted = $all_extracted && $status;
                     }
                 }
             }
             if (!$all_extracted) {
                 unlink_recursive($path, TRUE);
             }
             $this->parser->assign('all_extracted', $all_extracted);
             $this->parser->assign('path', $path);
             $this->parser->assign('comparator_config', array('t' => $comparator_setup_data['threshold'], 'm' => $comparator_setup_data['min_tree_size'], 'cut' => $comparator_setup_data['max_cutted_tree_size'], 'bf' => $comparator_setup_data['branching_factor'], 'mp' => $comparator_setup_data['min_similarity'], 'timeout' => $comparator_setup_data['timeout'] * 60000));
             $this->parser->parse('backend/comparator/run_comparation.tpl');
         } else {
             $this->list_solutions();
         }
     } else {
         $this->list_solutions();
     }
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:64,代码来源:comparator.php

示例11: header

}
$students = Student::get_by_sql("SELECT * FROM " . T_STUDENTS . " ORDER BY {$sidx} {$sord} LIMIT {$start} , {$limit}");
if (isset($_GET['searchString']) && isset($_GET['searchField'])) {
    $searchString = $_GET['searchString'];
    $searchField = $_GET['searchField'];
    $students = Student::get_by_sql("SELECT * FROM " . T_STUDENTS . " WHERE " . $searchField . " LIKE '%" . $searchString . "%' ORDER BY {$sidx} {$sord} LIMIT {$start} , {$limit}");
} else {
    $students = Student::get_by_sql("SELECT * FROM " . T_STUDENTS . " 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 ($students as $student) {
    $s .= "<row id='" . $student->id . "'>";
    $s .= "<cell></cell>";
    $s .= "<cell>" . $student->id . "</cell>";
    $s .= "<cell>" . $student->student_id . "</cell>";
    $s .= "<cell>" . $student->password . "</cell>";
    $s .= "<cell>" . $student->first_name . "</cell>";
    $s .= "<cell>" . $student->middle_name . "</cell>";
    $s .= "<cell>" . $student->last_name . "</cell>";
    $s .= "<cell>" . Course::get_by_id($student->course_id)->code . "</cell>";
    $s .= "<cell>" . $student->semester . "</cell>";
    $s .= "<cell>" . $student->year . "</cell>";
    $s .= "</row>";
}
$s .= "</rows>";
echo $s;
开发者ID:NemOry,项目名称:OnlineSubjectEvaluationSystem,代码行数:31,代码来源:students_xml.php

示例12: get_task_set_group_rooms

 public function get_task_set_group_rooms($course_id, $group_id, $selected_id = NULL, $task_set_id = NULL)
 {
     $course = new Course();
     $course->get_by_id($course_id);
     $course->group->get_by_id($group_id);
     $query = $course->group->room->order_by('name', 'asc')->get_raw();
     $rooms = array('' => '');
     $days = get_days();
     include APPPATH . 'third_party/Smarty/plugins/modifier.is_time.php';
     if ($query->num_rows() > 0) {
         foreach ($query->result() as $row) {
             $rooms[$row->id] = $this->lang->text($row->name) . ' (' . $days[$row->time_day] . ': ' . smarty_modifier_is_time($row->time_begin) . ' - ' . smarty_modifier_is_time($row->time_end) . ')';
         }
     }
     $query->free_result();
     $task_set = new Task_set();
     $task_set->where_related_course('id', $course_id)->get_by_id($task_set_id);
     $this->parser->parse('backend/task_sets/task_set_group_rooms_options.tpl', array('rooms' => $rooms, 'task_set' => $task_set, 'selected_id' => $selected_id));
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:19,代码来源:task_sets.php

示例13: switch_prefered_course

 public function switch_prefered_course($course_id, $current_url)
 {
     $this->usermanager->teacher_login_protected_redirect();
     $this->_transaction_isolation();
     $this->db->trans_begin();
     $teacher = new Teacher();
     $teacher->get_by_id($this->usermanager->get_teacher_id());
     if ($teacher->exists()) {
         $course = new Course();
         $course->get_by_id($course_id);
         if ($teacher->save(array('prefered_course' => $course))) {
             $this->db->trans_commit();
             $this->usermanager->refresh_teacher_userdata();
             $this->messages->add_message('lang:admin_teachers_prefered_course_quickchange_success', Messages::MESSAGE_TYPE_DEFAULT);
             $this->load->library('filter');
             $this->filter->set_all_filters_course($teacher->prefered_course_id);
         } else {
             $this->db->trans_rollback();
             $this->messages->add_message('lang:admin_teachers_prefered_course_quickchange_failed', Messages::MESSAGE_TYPE_ERROR);
         }
     } else {
         $this->db->trans_rollback();
         $this->messages->add_message('lang:admin_teachers_prefered_course_quickchange_failed', Messages::MESSAGE_TYPE_ERROR);
     }
     redirect(decode_from_url($current_url));
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:26,代码来源:teachers.php

示例14: redirect_to

<?php

require_once "../includes/initialize.php";
global $session;
if (!$session->is_logged_in()) {
    redirect_to("index.php");
}
if ($_POST['oper'] == 'add') {
    $course = new Course();
    $course->code = $_POST['code'];
    $course->description = $_POST['description'];
    $course->curriculum_id = $_POST['curriculum_id'];
    $course->create();
} else {
    if ($_POST['oper'] == 'edit') {
        $course = Course::get_by_id($_POST['id']);
        $course->code = $_POST['code'];
        $course->description = $_POST['description'];
        $course->curriculum_id = $_POST['curriculum_id'];
        $course->update();
    } else {
        if ($_POST['oper'] == 'del') {
            Course::get_by_id($_POST['id'])->delete();
        }
    }
}
开发者ID:NemOry,项目名称:OnlineSubjectEvaluationSystem,代码行数:26,代码来源:update_course.php

示例15: get_valuation_table_data

 private function get_valuation_table_data($course_id, $group_id = NULL, $condensed = FALSE)
 {
     $table_data = array('header' => array(), 'content' => array());
     $course = new Course();
     $course->get_by_id(intval($course_id));
     $group = new Group();
     $group->get_by_id((int) $group_id);
     if ($course->exists()) {
         $students = new Student();
         $students->select('id, fullname, email');
         $students->include_related('participant/group', array('id', 'name'));
         $students->where_related('participant/course', 'id', $course->id);
         $students->where_related('participant', 'allowed', 1);
         $students->order_by_as_fullname('fullname');
         if ($group->exists()) {
             $students->where_related('participant/group', 'id', (int) $group_id);
         }
         $students->get_iterated();
         $task_sets_out_of_group_ids = array(0);
         $task_sets_data = array();
         $task_sets_ids = array();
         $projects_ids = array();
         if ($group->exists()) {
             $students_filter = new Student();
             $students_filter->select('id');
             $students_filter->where_related('participant/course', 'id', $course->id);
             $students_filter->where_related('participant', 'allowed', 1);
             $students_filter->where_related('participant/group', 'id', (int) $group->id);
             $solutions_filter = new Solution();
             $solutions_filter->select('id');
             $solutions_filter->where_in_subquery('student_id', $students_filter);
             $task_sets_out_of_group = new Task_set();
             $task_sets_out_of_group->select('id');
             $task_sets_out_of_group->where_in_subquery('id', $solutions_filter);
             $task_sets_out_of_group->where('published', 1);
             $task_sets_out_of_group->get();
             $task_sets_out_of_group_ids = $task_sets_out_of_group->all_to_single_array('id');
             $task_sets_out_of_group_ids[] = 0;
         }
         $content_type_task_set = new Task_set();
         $content_type_task_set->select('id, name, content_type, group_id, task_set_type_id');
         $content_type_task_set->include_related('task_set_type', 'name');
         $content_type_task_set->include_related('group', 'name');
         $content_type_task_set->where('content_type', 'task_set');
         $content_type_task_set->where('published', 1);
         $content_type_task_set->where_related_course($course);
         $content_type_task_set->order_by_related_with_constant('task_set_type', 'name', 'asc');
         $content_type_task_set->order_by('task_set_type_id', 'asc');
         $content_type_task_set->order_by('publish_start_time', 'asc');
         if ($group->exists()) {
             $content_type_task_set->group_start();
             $content_type_task_set->group_start('', 'OR ');
             $content_type_task_set->group_start();
             $content_type_task_set->or_where('group_id', NULL);
             $content_type_task_set->or_where('group_id', (int) $group_id);
             $content_type_task_set->group_end();
             $content_type_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)');
             $content_type_task_set->group_end();
             $content_type_task_set->group_start('', 'OR ');
             $content_type_task_set->where_related('task_set_permission', 'group_id', (int) $group_id);
             $content_type_task_set->where_related('task_set_permission', 'enabled', 1);
             $content_type_task_set->group_end();
             $content_type_task_set->or_where_in('id', $task_sets_out_of_group_ids);
             $content_type_task_set->group_end();
         }
         $content_type_task_set->get();
         $header_items = array();
         if ($content_type_task_set->result_count() > 0) {
             $last_task_set_type_id = NULL;
             foreach ($content_type_task_set->all as $task_set) {
                 $permissions = new Task_set_permission();
                 $permissions->select('id, group_id');
                 $permissions->include_related('group', 'name');
                 $permissions->where_related_task_set($task_set);
                 $permissions->where('enabled', 1);
                 $permissions->get_iterated();
                 if ($permissions->result_count() > 0) {
                     $group_ids = array();
                     $group_names = array();
                     foreach ($permissions as $permission) {
                         $group_ids[] = $permission->group_id;
                         $group_names[] = $this->lang->text($permission->group_name);
                     }
                     $task_sets_data[$task_set->id] = array('group_id' => $group_ids, 'group_name' => $group_names);
                 } else {
                     $task_sets_data[$task_set->id] = array('group_id' => array($task_set->group_id), 'group_name' => $this->lang->text($task_set->group_name));
                 }
                 if ($task_set->task_set_type_id !== $last_task_set_type_id) {
                     $last_task_set_type_id = $task_set->task_set_type_id;
                     $header_items[] = array('type' => 'task_set_type', 'id' => $task_set->task_set_type_id, 'name' => $this->lang->text($task_set->task_set_type_name), 'title' => '');
                 }
                 if (!$condensed) {
                     $header_items[] = array('type' => 'task_set', 'id' => $task_set->id, 'name' => $this->lang->get_overlay_with_default('task_sets', $task_set->id, 'name', $task_set->name), 'title' => is_array($task_sets_data[$task_set->id]['group_name']) ? implode(', ', $task_sets_data[$task_set->id]['group_name']) : $task_sets_data[$task_set->id]['group_name']);
                 }
                 $task_sets_ids[] = $task_set->id;
             }
         }
         $table_data['header']['content_type_task_set'] = array('content_type_name' => $this->lang->line('admin_solutions_valuation_tables_header_content_type_task_sets'), 'items' => $header_items);
         $content_type_project = new Task_set();
         $content_type_project->where('content_type', 'project');
//.........这里部分代码省略.........
开发者ID:andrejjursa,项目名称:list-lms,代码行数:101,代码来源:solutions.php


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