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


PHP Course::all方法代码示例

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


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

示例1: _init

 protected static function _init()
 {
     $session = Registry::get("session");
     if (!self::$_classroom) {
         if (!$session->get('StudentService:$classroom')) {
             $enrollment = \Enrollment::first(array("user_id = ?" => self::$_student->user_id), array("classroom_id"));
             $c = \Classroom::first(array("id = ?" => $enrollment->classroom_id), array("grade_id", "section", "year", "id", "created"));
             $g = \Grade::first(array("id = ?" => $c->grade_id), array("title", "id"));
             $classroom = array("id" => $c->id, "grade" => $g->title, "grade_id" => $g->id, "section" => $c->section, "year" => $c->year, "created" => $c->created);
             $classroom = ArrayMethods::toObject($classroom);
             $session->set('StudentService:$classroom', $classroom);
         }
         self::$_classroom = $session->get('StudentService:$classroom');
     }
     if (!self::$_courses) {
         if (!$session->get('StudentService:$courses')) {
             $courses = \Course::all(array("grade_id = ?" => self::$_classroom->grade_id));
             $subject = array();
             foreach ($courses as $c) {
                 $subject[$c->id] = $c;
             }
             $session->set('StudentService:$courses', $subject);
         }
         self::$_courses = $session->get('StudentService:$courses');
     }
 }
开发者ID:SwiftSchool,项目名称:School,代码行数:26,代码来源:student.php

示例2: profile

 public function profile($id)
 {
     $user = User::with('gender', 'course', 'userType')->where('StudentID', $id)->first();
     $courses = Course::all()->lists('CourseAbbr', 'CourseID');
     $genders = Gender::all()->lists('Gender', 'GenderID');
     return View::make('validated.profile.edit', compact('user', 'courses', 'genders'));
 }
开发者ID:NoName1771,项目名称:QCPU-Social-Web-App,代码行数:7,代码来源:UserController.php

示例3: sandbox

 public static function sandbox()
 {
     // Testaa koodiasi täällä
     // echo 'Hello World!';
     // View::make('helloworld.html');
     $tali = Course::find(2);
     $courses = Course::all();
     Kint::dump($tali);
     Kint::dump($courses);
 }
开发者ID:neodyymi,项目名称:Tsoha-Bootstrap,代码行数:10,代码来源:hello_world_controller.php

示例4: manage

 /**
  * @before _secure, _school
  */
 public function manage($grade_id)
 {
     $grade = \Grade::first(array("id = ?" => $grade_id), array("title", "id", "organization_id"));
     if (!$grade || $grade->organization_id != $this->organization->id) {
         self::redirect("/school");
     }
     $this->setSEO(array("title" => "School | Manage Subjects (Courses)"));
     $view = $this->getActionView();
     $courses = Course::all(array("grade_id = ?" => $grade_id));
     $view->set("courses", $courses);
     $view->set("grade", $grade);
 }
开发者ID:SwiftSchool,项目名称:School,代码行数:15,代码来源:subject.php

示例5: update

 /**
  * Checks if round is ready to be saved. If not, displays round edit page with information already inputted. If yes, attempts to update selected round and related scores.
  *
  * @param int $id Id of selected round.
  */
 public static function update($id)
 {
     $player = self::get_user_logged_in();
     if (!$player) {
         View::make('player/login.html', array('error' => 'Vain kirjautuneet käyttäjät voivat muokata ratoja.'));
     }
     $params = $_POST;
     $players = Player::all();
     $course = Course::find($params['course']);
     $courses = Course::all();
     $played = $params['played'];
     $round = Round::find($id);
     $holes = Hole::find_by_course($course->id);
     $scores = Score::find_by_round($id);
     $numberOfPlayers = sizeof($scores);
     if ($params['course'] != $params['course_orig']) {
         // If course selection has changed we need to display edit page again with new information.
         $playerScores = array();
         $numberOfHoles = Hole::count_holes($params['course_orig']);
         for ($i = 1; $i <= $numberOfPlayers; $i++) {
             $holeScores = array();
             for ($j = 1; $j <= $numberOfHoles; $j++) {
                 $holeScores[] = $params['p' . $i . '_h' . $j];
             }
             $playerScores[] = array('player' => Player::find($params['player_' . $i]), 'holes' => $holeScores);
         }
         View::make('round/edit.html', array('numberOfPlayers' => $numberOfPlayers, 'players' => $players, 'course' => $course, 'holes' => $holes, 'courses' => $courses, 'playerScores' => $playerScores, 'round' => $round, 'scores' => $scores, 'played' => $played));
     } else {
         $attributes = array('courseId' => $params['course'], 'played' => $params['played']);
         $playerScores = array();
         $numberOfHoles = Hole::count_holes($params['course_orig']);
         $round = new Round(array_merge(array("id" => $round->id), $attributes));
         $errors = $round->errors();
         if (count($errors) == 0) {
             $round->update();
             for ($i = 1; $i <= $numberOfPlayers; $i++) {
                 $holeScores = array();
                 $scoreId = $params['score_' . $i];
                 for ($j = 1; $j <= $numberOfHoles; $j++) {
                     $hole = Hole::find_by_course_and_holenumber($params['course_orig'], $j);
                     $holeScores[] = array('throws' => $params['p' . $i . '_h' . $j], 'holeId' => $hole->id, 'holenumber' => $j);
                 }
                 $score = new Score(array('id' => $scoreId, 'playerId' => $params['player_' . $i], 'roundId' => $round->id, 'scores' => $holeScores));
                 $score->update();
             }
             Redirect::to('/round/' . $round->id, array('message' => 'Kierrosta muokattu.'));
         } else {
             View::make('round/new.html', array('errors' => $errors, 'attributes' => $attributes));
         }
     }
 }
开发者ID:neodyymi,项目名称:Tsoha-Bootstrap,代码行数:56,代码来源:round_controller.php

示例6: show

 public static function show($gameid)
 {
     $game = Game::find_format_gamedate($gameid);
     $games = array($game);
     View::make('game/show.html', array('games' => $games, 'courses' => Course::all()));
 }
开发者ID:rryanburton,项目名称:Tsoha-Bootstrap,代码行数:6,代码来源:game_controller.php

示例7: _findStudents

 private function _findStudents()
 {
     $session = Registry::get("session");
     if (RequestMethods::post("action") == "findStudents") {
         $exam = RequestMethods::post("exam");
         preg_match("/(.*);(.*)/", $exam, $matches);
         $exam_type = $matches[1];
         $exam_year = $matches[2];
         $classroom_id = RequestMethods::post("classroom_id");
         $grade_id = RequestMethods::post("grade");
         $enrollments = Enrollment::all(array("classroom_id = ?" => $classroom_id));
         $exams = Exam::all(array("grade_id = ?" => $grade_id, "type = ?" => $exam_type), array("id", "grade_id", "course_id"));
         $courses = Course::all(array("organization_id = ?" => $this->organization->id), array("title", "id"));
         $arr = array();
         foreach ($courses as $c) {
             $arr["{$c->id}"] = $c->title;
         }
         $courses = array();
         foreach ($exams as $e) {
             $courses[] = array("title" => $arr["{$e->course_id}"], "id" => $e->course_id);
         }
         $courses = ArrayMethods::toObject($courses);
         $session->set('Exams\\Result:$exams', $exams);
         $session->set('Exams\\Result:$grade_id', $grade_id);
         return array("courses" => $courses, "exams" => $exams, "enrollments" => $enrollments);
     }
     return false;
 }
开发者ID:SwiftSchool,项目名称:School,代码行数:28,代码来源:exams.php

示例8: index

 public function index()
 {
     $courses = Course::all();
     $menu = 'project';
     return View::make('courses.index', compact('courses', 'menu'));
 }
开发者ID:emanmks,项目名称:oneschool,代码行数:6,代码来源:CoursesController.php

示例9: index

 public static function index()
 {
     $courses = Course::all();
     View::make('course/index.html', array('courses' => $courses));
 }
开发者ID:rryanburton,项目名称:Tsoha-Bootstrap,代码行数:5,代码来源:course_controller.php

示例10: list_courses

 public static function list_courses()
 {
     $courses = Course::all();
     View::make('course/list.html', array('courses' => $courses));
 }
开发者ID:virtalas,项目名称:disc-golf-stats,代码行数:5,代码来源:course_controller.php

示例11: update

 /**
  * Attempts to update an edited users information.
  *
  * @param int $id Id of edited user.
  */
 public static function update($id)
 {
     $params = $_POST;
     if (!is_numeric($params['courseid'])) {
         $params['courseid'] = null;
     }
     $attributes = array('id' => $id, 'name' => $params['name'], 'courseId' => $params['courseid'], 'username' => $params['username'], 'password' => $params['new_password'], 'verify' => $params['password_verify'], 'newPassword' => strlen($params['new_password']) != 0);
     $player = new Player($attributes);
     $errors = $player->errors();
     if (Player::authenticate(self::get_user_logged_in()->username, $params['password']) == null) {
         $player = Player::find($id);
         $courses = Course::all();
         View::make('player/edit.html', array('errors' => $errors, 'attributes' => $attributes, 'player' => $player, 'courses' => $courses, 'error' => 'Väärä salasana tämänhetkiselle käyttäjälle.'));
     }
     if (count($errors) == 0) {
         $player->update();
         Redirect::to('/player', array('message' => 'Käyttäjän tietoja muutettu.'));
     } else {
         $player = Player::find($id);
         $courses = Course::all();
         View::make('player/edit.html', array('errors' => $errors, 'attributes' => $attributes, 'player' => $player, 'courses' => $courses));
     }
 }
开发者ID:neodyymi,项目名称:Tsoha-Bootstrap,代码行数:28,代码来源:player_controller.php

示例12: getMasterList

 public function getMasterList()
 {
     $sql = "SELECT sm.*, cr.id AS course_id, cr.code AS course\n\t\t\t\tFROM student_master AS sm \n\t\t\t\tINNER JOIN course AS cr\n\t\t\t\tON sm.course_id = cr.id\n\t\t\t\tORDER BY last_name ASC";
     $master = DB::select($sql);
     $course = Course::all();
     return View::make('admin.master_list')->with('master', $master)->with('course', $course);
 }
开发者ID:patocjurel,项目名称:capstone-project,代码行数:7,代码来源:AdminController.php

示例13: getSummaryEmploymentStatus

 public function getSummaryEmploymentStatus()
 {
     // $test = $_GET['test'];
     // if($test == 1)
     // 	return '1';
     // else
     // 	return '2';
     $academic_years = array();
     $data = array();
     $program = array();
     $from = $_GET['from'];
     $to = $_GET['to'];
     $department = $_GET['department'];
     $emp_status = $_GET['emp_status'];
     $acad_in = 0;
     for ($i = $from; $i <= $to; $i++) {
         $academic_years[$acad_in] = $i;
         $acad_in++;
     }
     if ($department == 0) {
         $courses = Course::all();
         $i = 0;
         foreach ($courses as $crs) {
             $crs_id = $crs->id;
             $temp_data = array();
             $index = 0;
             for ($j = $from; $j <= $to; $j++) {
                 $sql = "SELECT tr.choice_id, COUNT(tr.choice_id) AS 'count'\n\t\t\t\t\t\t\tFROM alumni_tracer AS tr\n\t\t\t\t\t\t\tINNER JOIN alumni AS al\n\t\t\t\t\t\t\tON al.id = tr.alumni_id\n\t\t\t\t\t\t\tWHERE al.year_graduated = ? \n\t\t\t\t\t\t\tAND tr.choice_id = ? \n\t\t\t\t\t\t\tAND al.course_id = ?";
                 $result = DB::select($sql, array($j, $emp_status, $crs_id));
                 if ($result[0]->choice_id == null) {
                     $temp_data[$index] = 0;
                 } else {
                     $temp_data[$index] = $result[0]->count;
                 }
                 $index++;
             }
             $program[$i] = $crs->code;
             $data[$i] = $temp_data;
             $i++;
         }
     } else {
         $courses = DB::select("SELECT * FROM course WHERE dept_id = ?", array($department));
         $i = 0;
         foreach ($courses as $crs) {
             $crs_id = $crs->id;
             $temp_data = array();
             $index = 0;
             for ($j = $from; $j <= $to; $j++) {
                 $sql = "SELECT tr.choice_id, COUNT(tr.choice_id) AS 'count'\n\t\t\t\t\t\t\tFROM alumni_tracer AS tr\n\t\t\t\t\t\t\tINNER JOIN alumni AS al\n\t\t\t\t\t\t\tON al.id = tr.alumni_id\n\t\t\t\t\t\t\tWHERE al.year_graduated = ? \n\t\t\t\t\t\t\tAND tr.choice_id = ? \n\t\t\t\t\t\t\tAND al.course_id = ?";
                 $result = DB::select($sql, array($j, $emp_status, $crs_id));
                 if ($result[0]->choice_id == null) {
                     $temp_data[$index] = 0;
                 } else {
                     $temp_data[$index] = $result[0]->count;
                 }
                 $index++;
             }
             $program[$i] = $crs->code;
             $data[$i] = $temp_data;
             $i++;
         }
     }
     return View::make('analytics.summary_employment')->with('academic_years', $academic_years)->with('program', $program)->with('data', $data);
     // return json_encode($academic_years);
 }
开发者ID:patocjurel,项目名称:capstone-project,代码行数:65,代码来源:AnalyticsController.php

示例14: display_score_card_pictures_by_year

 public static function display_score_card_pictures_by_year($year)
 {
     $full_path = getcwd();
     $path = str_replace("/disc-golf-stats/app/controllers", "", $full_path);
     $path = str_replace("/xamppfiles", "", $path);
     $echo = ImageDisplayer::display($path . "/score_cards", $year);
     View::make('game/score_card_images.html', array('current_year' => $year, 'images' => $echo, 'players' => Player::all(), 'courses' => Course::all(), 'game_years' => Game::game_years()));
 }
开发者ID:virtalas,项目名称:disc-golf-stats,代码行数:8,代码来源:game_controller.php

示例15: filters

 public function filters($offset = 0)
 {
     $string = '%' . $this->input->post('curso') . '%';
     $c = $this->input->post('level_id');
     $div = $this->input->post('division_id');
     $condiciones = '';
     $valores = array();
     if ($string != '%%') {
         $condiciones .= " course LIKE ?";
         $valores['curso'] = $string;
     }
     if ($div > 0) {
         if ($condiciones != '') {
             $condiciones .= " AND ";
         }
         $condiciones .= " division_id = ?";
         $valores['div'] = $div;
     }
     if ($c > 0) {
         if ($condiciones != '') {
             $condiciones .= " AND ";
         }
         $condiciones .= " level_id = ?";
         $valores['nivel'] = $c;
     }
     $this->session->set_userdata('filtros_cursos', $valores);
     $conditions = array_merge(array($condiciones), $valores);
     $config['base_url'] = site_url('cursos/index');
     $config['total_rows'] = Course::count(array('joins' => array('level', 'division'), 'conditions' => $conditions));
     $config['per_page'] = '10';
     $config['num_links'] = '10';
     $config['first_link'] = '&larr; primero';
     $config['last_link'] = 'último &rarr;';
     $this->load->library('pagination', $config);
     $cursos = Course::all(array('joins' => array('level', 'division'), 'conditions' => $conditions, 'limit' => $config['per_page'], 'offset' => $offset));
     $this->table->set_heading('Curso', 'División', 'Nivel', 'Acciones');
     foreach ($cursos as $curso) {
         $this->table->add_row($curso->course, $curso->division->division, $curso->level->descripcion, anchor('cursos/editar/' . $curso->id, img('static/img/icon/pencil.png'), 'class="tipwe" title="Editar"') . ' ' . anchor('cursos/eliminar/' . $curso->id, img('static/img/icon/trash.png'), 'class="tipwe eliminar" title="Eliminar"'));
     }
     echo $this->table->generate();
     echo '<div class="pagination">';
     echo $this->pagination->create_links();
     echo '</div>';
 }
开发者ID:ricardocasares,项目名称:Cobros,代码行数:44,代码来源:cursos.php


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