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


PHP Participant::where方法代码示例

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


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

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

示例2: updateDetails

 public function updateDetails()
 {
     if (Session::has('collId')) {
         $cId = Session::get('collId');
         $tmp = Participant::where('cId', $cId);
         $phone = Input::get('pPhone');
         $destination = getcwd() . "\\public\\img\\participants\\";
         if ($tmp) {
             $tmp->delete();
         }
         foreach (Input::get('pName') as $key => $name) {
             if (strlen($name) > 0) {
                 $p = new Participant();
                 $p->cId = $cId;
                 $p->pid = $key + 1;
                 $p->name = $name;
                 if (strlen($phone[$key]) > 0) {
                     $p->phone = $phone[$key];
                 }
                 $p->save();
             }
         }
         for ($i = 0; $i < sizeof(Input::file('image')); $i++) {
             if (Input::hasFile('image')) {
                 $file = Input::file('image');
                 $filename = "myfile" . $i . "." . $file[$i]->getClientOriginalExtension();
                 $flag = $file[$i]->move($destination, $filename);
             }
         }
         return Redirect::to('member');
     }
     return Redirect::to('reg');
 }
开发者ID:vishwasnavadak,项目名称:anandotsava.in,代码行数:33,代码来源:CollegeController.php

示例3: updateDetails

 public function updateDetails()
 {
     if (Session::has('sense')) {
         $cId = Session::get('sense')[1];
         $tmp = Participant::where('cId', $cId);
         $phone = Input::get('pPhone');
         if ($tmp) {
             $tmp->delete();
         }
         foreach (Input::get('pName') as $key => $name) {
             if (strlen($name) > 0) {
                 $p = new Participant();
                 $p->cId = $cId;
                 $p->pid = $key + 1;
                 $p->name = $name;
                 if (strlen($phone[$key]) > 0) {
                     $p->phone = $phone[$key];
                 }
                 $p->save();
             }
         }
         return Redirect::to('member/coll');
     }
     return Redirect::to('reg');
 }
开发者ID:bullbuxter,项目名称:anandotsava.in,代码行数:25,代码来源:CollegeController.php

示例4: table_content

 public function table_content()
 {
     $filter = $this->input->post('filter');
     $this->store_filter($filter);
     $participants = new Participant();
     $participants->include_related('student', 'fullname');
     $participants->include_related('student', 'email');
     $participants->include_related('course', 'name');
     $participants->include_related('course/period', 'name');
     $participants->include_related('group', 'name');
     if (isset($filter['student_fullname']) && trim($filter['student_fullname']) != '') {
         $participants->like_related('student', 'fullname', trim($filter['student_fullname']));
     }
     if (isset($filter['course']) && intval($filter['course']) > 0) {
         $participants->where_related('course', 'id', intval($filter['course']));
     }
     if (isset($filter['group']) && intval($filter['group']) > 0) {
         $participants->where_related('group', 'id', intval($filter['group']));
     }
     if (isset($filter['group_set'])) {
         if ($filter['group_set'] == 'none') {
             $participants->where('group_id', NULL);
         } else {
             if ($filter['group_set'] == 'assigned') {
                 $participants->group_start(' NOT', 'AND');
                 $participants->where('group_id', NULL);
                 $participants->group_end();
             }
         }
     }
     $order_by_direction = $filter['order_by_direction'] == 'desc' ? 'desc' : 'asc';
     if ($filter['order_by_field'] == 'student') {
         $participants->order_by_related_as_fullname('student', 'fullname', $order_by_direction);
         $participants->order_by_related('student', 'email', $order_by_direction);
     } elseif ($filter['order_by_field'] == 'course') {
         $participants->order_by_related('course/period', 'sorting', $order_by_direction);
         $participants->order_by_related_with_constant('course', 'name', $order_by_direction);
     } elseif ($filter['order_by_field'] == 'group') {
         $participants->order_by_related_with_constant('group', 'name', $order_by_direction);
     } elseif ($filter['order_by_field'] == 'status') {
         $participants->order_by('allowed', $order_by_direction);
     }
     $participants->get_paged_iterated(isset($filter['page']) ? intval($filter['page']) : 1, isset($filter['rows_per_page']) ? intval($filter['rows_per_page']) : 25);
     $this->parser->parse('backend/participants/table_content.tpl', array('participants' => $participants));
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:45,代码来源:participants.php

示例5: threadsWithNewMessages

 /**
  * Returns all threads with new messages
  *
  * @return array
  */
 public function threadsWithNewMessages()
 {
     $threadsWithNewMessages = [];
     $participants = Participant::where('user_id', $this->id)->lists('last_read', 'thread_id');
     if ($participants) {
         $threads = Thread::whereIn('id', array_keys($participants))->get();
         foreach ($threads as $thread) {
             if ($thread->updated_at > $participants[$thread->id]) {
                 $threadsWithNewMessages[] = $thread->id;
             }
         }
     }
     return $threadsWithNewMessages;
 }
开发者ID:spetross,项目名称:ugvoice,代码行数:19,代码来源:Messageable.php

示例6: event

 public function event($id)
 {
     //add security to avoid stealing of information
     $user = Auth::user();
     Excel::create('roster', function ($excel) use($id) {
         $excel->sheet('Sheetname', function ($sheet) use($id) {
             $event = Evento::find($id);
             $team = array();
             if ($event->children->count() > 0) {
                 foreach ($event->children as $e) {
                     foreach ($e->participants as $member) {
                         $team[] = $member;
                     }
                 }
             } else {
                 $team = Participant::where('event_id', '=', $id)->with('event')->get();
             }
             $sheet->setOrientation('landscape');
             $sheet->loadView('export.lacrosse.roster', ['members' => $team]);
         });
     })->download('xlsx');
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:22,代码来源:ExportController.php

示例7: index

 /**
  * Display a listing of the resource.
  * GET /player
  *
  * @return Response
  */
 public function index()
 {
     $user = Auth::user();
     $title = 'League Together - Club';
     $players = $user->players;
     $invites = [];
     //get player from follower
     foreach ($players as $player) {
         $member = Member::where('player_id', '=', $player->id)->where('accepted_on', '=', null)->where('declined_on', '=', null)->get();
         $participant = Participant::where('player_id', '=', $player->id)->where('accepted_on', '=', null)->where('declined_on', '=', null)->get();
         if ($member) {
             foreach ($member as $data) {
                 $invites[] = $data;
             }
         }
         if ($participant) {
             foreach ($participant as $data) {
                 $invites[] = $data;
             }
         }
     }
     return View::make('app.account.player.index')->with('page_title', $title)->with('players', $user->players)->with('invites', $invites)->withUser($user);
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:29,代码来源:PlayerController.php

示例8: doAnnouncement

 public function doAnnouncement($id)
 {
     global $club, $messageData, $messageSubject, $team, $sms, $user, $recipientMobile, $recipientEmail;
     $user = Auth::user();
     $club = $user->Clubs()->FirstOrFail();
     $event = Evento::where("id", "=", $id)->where("club_id", '=', $club->id)->FirstOrFail();
     $participants = Participant::where('event_id', '=', $event->id)->get();
     $messageData = Input::get('message');
     $messageSubject = Input::get('subject');
     $sms = substr($messageData, 0, 140) . " {$club->name} - Do not reply";
     $uuid = Uuid::generate();
     //get list of recepients
     $recipientUser = array();
     $recipientPlayer = array();
     $recipientContact = array();
     $recipientEmail = array();
     $recipientMobile = array();
     //do selection for children events
     if ($event->children->count() > 0) {
         foreach ($event->children as $e) {
             foreach ($e->participants as $member) {
                 //only members that accepted joined
                 if ($member->accepted_user) {
                     $user = User::find($member->accepted_user);
                     $player = Player::find($member->player_id);
                     $recipientUser[] = array('name' => $user->profile->firstname . " " . $user->profile->lastname, 'email' => $user->email, 'mobile' => $user->profile->mobile);
                     foreach ($player->contacts as $contact) {
                         $recipientContact[] = array('name' => $contact->firstname . " " . $contact->lastname, 'email' => $contact->email, 'mobile' => $contact->mobile);
                     }
                     //allow players with email and mobile
                     if ($player->mobile && $player->email) {
                         $recipientPlayer[] = array('name' => $player->firstname . " " . $player->lastname, 'email' => $player->email, 'mobile' => $player->mobile);
                     }
                 }
             }
         }
     } else {
         foreach ($participants as $member) {
             //only members that accepted joined
             if ($member->accepted_user) {
                 $user = User::find($member->accepted_user);
                 $player = Player::find($member->player_id);
                 $recipientUser[] = array('name' => $user->profile->firstname . " " . $user->profile->lastname, 'email' => $user->email, 'mobile' => $user->profile->mobile);
                 foreach ($player->contacts as $contact) {
                     $recipientContact[] = array('name' => $contact->firstname . " " . $contact->lastname, 'email' => $contact->email, 'mobile' => $contact->mobile);
                 }
                 //allow players with email and mobile
                 if ($player->mobile && $player->email) {
                     $recipientPlayer[] = array('name' => $player->firstname . " " . $player->lastname, 'email' => $player->email, 'mobile' => $player->mobile);
                 }
             }
         }
     }
     //send default function
     function sendmessage($destination)
     {
         global $club, $messageData, $messageSubject, $event, $sms, $user, $recipientMobile, $recipientEmail;
         foreach ($destination as $recipient) {
             //send email notification of acceptance queue
             $data = array('club' => $club, 'messageOriginal' => $messageData, 'subject' => $messageSubject, 'team' => $event);
             Mail::later(3, 'emails.announcement.default', $data, function ($message) use($recipient, $club, $messageSubject) {
                 $message->to($recipient['email'], $recipient['name'])->subject("{$messageSubject} | " . $club->name);
             });
             $recipientEmail[] = array('name' => $recipient['name'], 'email' => $recipient['email']);
             if (Input::get('sms')) {
                 $recipientMobile[] = array('name' => $recipient['name'], 'mobile' => $recipient['mobile']);
                 //queue sms
                 Queue::push(function ($job) use($recipient, $sms) {
                     Twilio::message($recipient['mobile'], $sms);
                     $job->delete();
                 });
             }
         }
     }
     // send to user
     sendmessage($recipientUser);
     //send to player
     if (Input::get('players')) {
         sendmessage($recipientPlayer);
     }
     //send to contacts
     if (Input::get('family')) {
         sendmessage($recipientContact);
     }
     //save message to database
     $announcement = new Announcement();
     $announcement->id = $uuid;
     $announcement->subject = $messageSubject;
     $announcement->message = $messageData;
     $announcement->sms = $sms;
     $announcement->to_email = serialize($recipientEmail);
     $announcement->to_sms = serialize($recipientMobile);
     $announcement->event_id = $event->id;
     $announcement->club_id = $club->id;
     $announcement->user_id = $user->id;
     //$status = $announcement->save();
     return array('success' => true, 'email' => $recipientEmail, 'mobile' => $recipientMobile);
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:98,代码来源:EventoController.php

示例9: mail_to_course

 public function mail_to_course($course_id)
 {
     $course = new Course();
     $course->include_related('period', 'name');
     $course->get_by_id((int) $course_id);
     if ($course->exists()) {
         $groups = new Group();
         $groups->where_related_course('id', $course->id);
         $groups->order_by_with_constant('name', 'asc');
         $groups->get_iterated();
         $groups_students = array();
         foreach ($groups as $group) {
             $groups_students[$group->id] = array('name' => $group->name, 'students' => array());
         }
         $groups_students[0] = array('name' => 'lang:admin_courses_mail_to_course_group_name_unassigned_students', 'students' => array());
         $participants = new Participant();
         $participants->where('allowed', 1);
         $participants->include_related('student');
         $participants->where_related_course('id', $course->id);
         $participants->order_by_related_as_fullname('student', 'fullname', 'asc');
         $participants->get_iterated();
         foreach ($participants as $participant) {
             $groups_students[(int) $participant->group_id]['students'][(int) $participant->student_id] = array('fullname' => $participant->student_fullname, 'email' => $participant->student_email);
         }
         $this->parser->assign('groups_students', $groups_students);
     }
     $this->_add_tinymce4();
     $this->parser->add_js_file('admin_courses/mail_form.js');
     $this->parser->add_css_file('admin_courses.css');
     $this->parser->parse('backend/courses/mail_to_course.tpl', array('course' => $course));
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:31,代码来源:courses.php

示例10: signup_to_course

 public function signup_to_course($course_id)
 {
     $this->output->set_content_type('application/json');
     $output = new stdClass();
     $output->status = FALSE;
     $output->message = '';
     $output->content = '';
     $this->_transaction_isolation();
     $this->db->trans_begin();
     $student = new Student();
     $student->get_by_id($this->usermanager->get_student_id());
     $course = new Course();
     $course->where('hide_in_lists', 0);
     $course->get_by_id($course_id);
     if ($course->exists()) {
         if ($course->is_subscription_allowed()) {
             if ($student->participant->where_related($course)->count() == 0) {
                 if ($course->auto_accept_students == 1) {
                     $participants = new Participant();
                     $participants->where_related_course($course);
                     $participants->where('allowed', 1);
                     $participants_count = $participants->count();
                     if ($participants_count >= (int) $course->capacity) {
                         $output->message = $this->lang->line('courses_message_course_is_full');
                         $output->status = FALSE;
                         $this->db->trans_rollback();
                     } else {
                         $participant = new Participant();
                         $participant->allowed = 1;
                         $participant->save(array($student, $course));
                         $this->db->trans_commit();
                         $output->message = sprintf($this->lang->line('courses_message_signed_up_for_course_approved'), $this->lang->text($course->name));
                         $this->parser->assign('course', $course);
                         $output->content = $this->parser->parse('frontend/courses/single_course.tpl', array(), TRUE);
                         $output->status = TRUE;
                         $this->_action_success();
                     }
                 } else {
                     $participant = new Participant();
                     $participant->allowed = 0;
                     $participant->save(array($student, $course));
                     $this->db->trans_commit();
                     $output->message = sprintf($this->lang->line('courses_message_signed_up_for_course'), $this->lang->text($course->name));
                     $this->parser->assign('course', $course);
                     $output->content = $this->parser->parse('frontend/courses/single_course.tpl', array(), TRUE);
                     $output->status = TRUE;
                     $this->_action_success();
                 }
             } else {
                 $output->message = $this->lang->line('courses_message_already_in_course_or_waiting_for_approwal');
                 $this->db->trans_rollback();
             }
         } else {
             $output->message = $this->lang->line('courses_message_subscription_disallowed');
             $this->db->trans_rollback();
         }
     } else {
         $output->message = $this->lang->line('courses_message_course_not_found');
         $this->db->trans_rollback();
     }
     $this->output->set_output(json_encode($output));
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:62,代码来源:courses.php

示例11: remove_points_iteration

 private function remove_points_iteration($task_set, $points_to_remove, $task_set_id, $task_set_course_id, $task_set_group_id, &$error_code = 0, &$students = NULL)
 {
     $this->_transaction_isolation();
     $this->db->trans_begin();
     if (!is_null($task_set->upload_end_time)) {
         $timestamp_end = strtotime($task_set->upload_end_time);
         if (time() > $timestamp_end) {
             $participants = new Participant();
             $participants->select('*');
             $participants->select_subquery('(SELECT `solutions`.`id` FROM `solutions` WHERE `solutions`.`task_set_id` = ' . $task_set_id . ' AND `solutions`.`student_id` = `${parent}`.`student_id`)', 'solution_id');
             $participants->where_related_course('id', $task_set_course_id);
             if ($task_set->group->exists() && !is_null($task_set_group_id)) {
                 $participants->where_related_group('id', $task_set_group_id);
             }
             $participants->where('allowed', 1);
             $participants->get_iterated();
             $notify_students = array(0);
             foreach ($participants as $participant) {
                 if (is_null($participant->solution_id) && !is_null($participant->student_id)) {
                     $solution = new Solution();
                     $solution->task_set_id = $task_set_id;
                     $solution->student_id = $participant->student_id;
                     $solution->teacher_id = $this->usermanager->get_teacher_id();
                     $solution->points = -$points_to_remove;
                     $solution->revalidate = 0;
                     if ($solution->save()) {
                         $notify_students[] = $participant->student_id;
                     }
                 }
             }
             if ($this->db->trans_status()) {
                 $this->db->trans_commit();
                 $students = new Student();
                 $students->where_in('id', $notify_students);
                 $students->get();
                 //$result->mail_sent = $this->_send_multiple_emails($students, 'lang:admin_solutions_remove_points_notification_subject', 'file:emails/backend/solutions/remove_points_notify.tpl', array('task_set' => $task_set, 'points_to_remove' => $points_to_remove));
                 return TRUE;
             } else {
                 $this->db->trans_rollback();
                 //$result->message = $this->lang->line('admin_solutions_remove_points_error_unknown');
                 $error_code = 1;
                 return FALSE;
             }
         } else {
             $this->db->trans_rollback();
             //$result->message = $this->lang->line('admin_solutions_remove_points_error_task_set_upload_limit_not_reached');
             $error_code = 2;
             return FALSE;
         }
     } else {
         $this->db->trans_rollback();
         //$result->message = $this->lang->line('admin_solutions_remove_points_error_task_set_upload_not_limited');
         $error_code = 3;
         return FALSE;
     }
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:56,代码来源:solutions.php

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

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


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