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


PHP Course::get方法代码示例

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


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

示例1: displayBody

    function displayBody()
    {
        parent::displayBody();
        $translator = new Translator();
        $course = new Course();
        $data = $course->get(array('id' => $this->id));
        foreach ($data as $key => $val) {
            $data[$key] = htmlspecialchars($val, ENT_QUOTES);
        }
        echo <<<EOF
<h2  class="page-header">{$data[name]}</h2>
<h4>{$data[category_name]}</h4>
<div class="col-lg-8">
    <ul class="list-group category-list" index="{$this->id}/">

EOF;
        $root = $_SERVER['DOCUMENT_ROOT'] . '/../files/courses/' . $this->id;
        $this->put_list($root);
        echo <<<EOF
    </ul>
    <div class="row">
\t
\t<a href="#"  data-toggle="toggler" parent-id="{$this->id}/" title="{$translator->addfile}" type="file">
\t\t\t<span class="glyphicon glyphicon-file"></span> </a>
\t\t\t<a href="#"  data-toggle="toggler" parent-id="{$this->id}/" title="{$translator->addfolder}" type="folder">
\t\t\t<span class="glyphicon glyphicon-folder-open"></span> </a>
\t
    </div>

</div>
EOF;
    }
开发者ID:jedaika,项目名称:Trainings,代码行数:32,代码来源:admin_manager.php

示例2: approve

 function approve($id, $data = null)
 {
     $training = new Training();
     $course_obj = new Course();
     $request = $this->get(array('id' => $id));
     $course = $course_obj->get(array('id' => $request['course_id']));
     $data['course_id'] = $request['course_id'];
     $data['start'] = $request['planned_date'];
     $date = new DateTime($data['start']);
     if ($course['duration'] > 8) {
         $date->add(new DateInterval('P' . ceil($course['duration'] / 8) . 'DT' . $course['duration'] % 8 . 'H'));
     } else {
         $date->add(new DateInterval('PT' . $course['duration'] . 'H'));
     }
     $data['finish'] = $date->format('Y-m-d H:i');
     $data['user_id'] = $request['user_id'];
     $data['status_id'] = Training::CREATED;
     if ($course['format_id'] == Course::ONLINE || $course['format_id'] == Course::WEBCAST) {
         $data['course_hash'] = md5($data['user_id'] . $data['course_id'] . $data['start']);
     }
     $data['tries'] = 0;
     if ($course['exam'] == 't') {
         $data['exam_hash'] = md5($data['user_id'] . $data['course_id'] . $data['start'] . $data['tries']);
     }
     $data['request_id'] = $id;
     $data['active'] = 'true';
     $training->add($data);
     $this->disable($id);
 }
开发者ID:jedaika,项目名称:Trainings,代码行数:29,代码来源:request.php

示例3: index

 public function index()
 {
     $this->_initialize_student_menu();
     $this->_select_student_menu_pagetag('groups');
     $this->parser->add_css_file('frontend_groups.css');
     $cache_id = $this->usermanager->get_student_cache_id();
     if (!$this->_is_cache_enabled() || !$this->parser->isCached($this->parser->find_view('frontend/groups/index.tpl'), $cache_id)) {
         $student = new Student();
         $student->get_by_id($this->usermanager->get_student_id());
         $course = new Course();
         $course->where_related_active_for_student($student);
         $course->where_related('participant/student', $student);
         $course->where_related_participant('allowed', 1);
         $course->get();
         $can_change_group = FALSE;
         if ($course->exists()) {
             if (is_null($course->groups_change_deadline) || date('U', strtotime($course->groups_change_deadline)) >= time()) {
                 $can_change_group = TRUE;
             }
         }
         smarty_inject_days();
         $this->parser->assign(array('course' => $course, 'can_change_group' => $can_change_group));
     }
     $this->parser->parse('frontend/groups/index.tpl', array(), FALSE, $this->_is_cache_enabled(), $cache_id);
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:25,代码来源:groups.php

示例4: process

 public function process($get, $post)
 {
     $this->pageData["Title"] = "Home";
     // Select all of the courses that this user is already added or ignored
     $query = new Query('action');
     $result = $query->select('*', array(array('session_id', '=', $_COOKIE['sessionId'])));
     $idsAlreadyAdded = array();
     foreach ($result as $action) {
         array_push($idsAlreadyAdded, $action->get('course_id'));
     }
     // Generate all of the courses (for testing)
     $allCourses = array();
     $query = new Query('courses');
     $result = $query->select('*', '', array('number', 'ASC'), 20, false);
     while ($row = mysqli_fetch_array($result)) {
         try {
             $course = new Course();
             $course->findById($row['id']);
             if (!in_array($course->get('id'), $idsAlreadyAdded)) {
                 // Check that this course has not been added by the user yet
                 array_push($allCourses, array('id' => $course->get('id'), 'name' => ucwords(strtolower($course->get('name'))), 'department_id' => $course->get('department_id'), 'number' => $course->get('number'), 'description' => strlen($course->get('description')) == 0 ? 'No description' : $course->get('description')));
             }
         } catch (Exception $e) {
         }
     }
     $this->pageData['allCourses'] = $allCourses;
     // Select all of the courses that this user is already added
     $query = new Query('action');
     $result = $query->select('*', array(array('session_id', '=', $_COOKIE['sessionId']), array('choice', '=', 0)));
     $idsAlreadyAdded = array();
     foreach ($result as $action) {
         array_push($idsAlreadyAdded, $action->get('course_id'));
     }
     // Get all of the courses in this user's session
     $usersCourses = array();
     foreach ($idsAlreadyAdded as $courseId) {
         try {
             $course = new Course();
             $course->findById($courseId);
             array_push($usersCourses, array('id' => $course->get('id'), 'name' => ucwords(strtolower($course->get('name'))), 'department_id' => $course->get('department_id'), 'number' => $course->get('number')));
         } catch (Exception $e) {
         }
     }
     $this->pageData['usersCourses'] = $usersCourses;
 }
开发者ID:bennyty,项目名称:suggestr,代码行数:45,代码来源:Home_.php

示例5: displayBody

    function displayBody()
    {
        parent::displayBody();
        $translator = new Translator();
        $request = new Request();
        try {
            $id = array_shift($this->param);
            $course = new Course();
            $c_data = $course->get(array('id' => $id));
            $data['course_id'] = $id;
            $data['user_id'] = $_SESSION['user_id'];
            $data['active'] = true;
            $data['planned_date'] = $_GET['planned_date'] != '' ? $_GET['planned_date'] : date('Y-m-d H:i:s', time());
            $r_id = $request->add($data);
            if ($c_data['need_approve'] == 'f') {
                $request->approve($r_id);
                echo <<<EOF
<div class="container">
   <div class="page-header">
        <h1>{$translator->Request_updated}</h1>
      </div>
   <p class="lead">{$translator->Request_updated_Desc}</p>
      <p >{$translator->Error_Backcourses}</p>
</div>
<script type="text/javascript">
window.location.href='/mycourses';
</script>

EOF;
            } else {
                echo <<<EOF
<div class="container">
   <div class="page-header">
        <h1>{$translator->Request_updated}</h1>
      </div>
   <p class="lead">{$translator->Request_need_approve_Desc}</p>
      <p >{$translator->Error_Backcourses}</p>
</div>

EOF;
            }
        } catch (Exception $e) {
            echo <<<EOF
<div class="container">
   <div class="page-header">
        <h1>{$translator->Request_error}</h1>
      </div>
   <p class="lead">{$translator->Request_error_Desc}</p>
      <p >{$translator->Error_Backcourses}</p>
</div>

EOF;
        }
    }
开发者ID:jedaika,项目名称:Trainings,代码行数:54,代码来源:enroll.php

示例6: showExportDataCourse

 public function showExportDataCourse()
 {
     $listCourse = Course::get();
     $listCourseSort = [];
     $size = count($listCourse);
     for ($i = 0; $i < $size; $i++) {
         $course = array('id' => $listCourse[$i]->id, 'name' => $listCourse[$i]->name, 'desc' => $listCourse[$i]->desc, 'subject' => Subject::where('id_course', $listCourse[$i]->id)->count(), 'word' => Word::where('id_course', $listCourse[$i]->id)->count());
         array_push($listCourseSort, $course);
     }
     $list['listCourse'] = $listCourse;
     $list['listCourseSort'] = $listCourseSort;
     return View::make('data.list-course', $list);
 }
开发者ID:nguyensonghao,项目名称:api,代码行数:13,代码来源:WordController.php

示例7: checkEditor

 function checkEditor($id)
 {
     if ((User::EDITOR & intval($_SESSION['role_id'])) > 0) {
         // check permision
         return;
     }
     try {
         $course = new Course();
         $result = @$course->get(array('id' => $id, 'author_id' => $_SESSION['user_id']));
         if (isset($result) && (User::EDITOR_SIMPLE & intval($_SESSION['role_id'])) > 0) {
             return;
         }
     } catch (Exception $e) {
         throw new NoAccessException('No access');
         // return authorization error
     }
 }
开发者ID:jedaika,项目名称:Trainings,代码行数:17,代码来源:security.php

示例8: search

 public function search()
 {
     $query = $this->input->get('q', TRUE);
     $courses = new Course();
     $courses->limit(10);
     $courses->like('number', $query);
     $courses->get();
     $arr = array();
     foreach ($courses as $course) {
         $arr_course = array();
         $arr_course['value'] = $course->number . ': ' . $course->title;
         $arr_course['data'] = $course->id;
         array_push($arr, $arr_course);
     }
     $arr_wrapper = array();
     $arr_wrapper['suggestions'] = $arr;
     echo json_encode($arr_wrapper);
 }
开发者ID:frosoco,项目名称:frosoco-local,代码行数:18,代码来源:courses.php

示例9: adduser

 function adduser($id, $user_id)
 {
     $training = new Training();
     $course_obj = new Course();
     $plan = $this->get(array('id' => $id));
     $course = $course_obj->get(array('id' => $plan['course_id']));
     $data['course_id'] = $plan['course_id'];
     $data['start'] = $plan['start'];
     $data['finish'] = $plan['finish'];
     $data['user_id'] = $user_id;
     $data['status_id'] = Training::CREATED;
     if ($course['format_id'] == Course::ONLINE) {
         $data['course_hash'] = md5($data['user_id'] . $data['course_id'] . $data['start']);
     }
     $data['tries'] = 0;
     if ($course['exam'] == 't') {
         $data['exam_hash'] = md5($data['user_id'] . $data['course_id'] . $data['start'] . $data['tries']);
     }
     $data['plan_id'] = $id;
     $training->add($data);
 }
开发者ID:jedaika,项目名称:Trainings,代码行数:21,代码来源:plan.php

示例10: displayBody

    function displayBody()
    {
        parent::displayBody();
        $translator = new Translator();
        $course = new Course();
        $training = new Training();
        $t_data = $training->get(array('course_hash' => $this->course_hash, 'user_id' => $_SESSION['user_id']));
        $c_data = $course->get(array('id' => $t_data['course_id']));
        foreach ($c_data as $key => $val) {
            $c_data[$key] = htmlspecialchars($val, ENT_QUOTES);
        }
        echo <<<EOF
<div class="container-fluid">
<div class="col-lg-10 col-lg-offset-1" id="window">
\t<div class="row" >
\t<div class="col-xs-10">
\t    <h4>{$c_data[category_name]}</h4>
\t    <h2>{$c_data[name]}</h2>
\t</div>
\t<div class="col-xs-2 text-right" id="top_buttons">
\t    <a href="#" id="fullscreen"><span class="glyphicon glyphicon-fullscreen"></span></a>
\t    <a href="#" id="inscreen" class="collapse"><span class="glyphicon glyphicon-remove"></span></a>
\t</div>
\t</div>
\t<div class="embed-responsive embed-responsive-16by9" id="fullscreen_media">
\t  <iframe class="embed-responsive-item" src="/learn/{$this->course_hash}/index.html" id="iframe"></iframe>
\t</div>
\t<nav id="bottom_buttons">
\t  <ul class="pager">
\t    <li class="previous"><a href="#" id="back"><span aria-hidden="true">&larr;</span> {$translator->Back}</a></li>
\t    <li class="top"><a href="#" id="top">{$translator->Top}</a>|
\t\t<a href="/mycourses/finish/{$t_data[id]}" onclick='return confirm("{$translator->AreYouSure}");'>{$translator->Finish}</a></li>
\t    <li class="next"><a href="#" id="next">{$translator->Next} <span aria-hidden="true">&rarr;</span></a></li>
\t  </ul>
\t</nav>
</div>
</div> <!-- /container -->

EOF;
    }
开发者ID:jedaika,项目名称:Trainings,代码行数:40,代码来源:learn.php

示例11: getClassNameById

 function getClassNameById($id)
 {
     $result = new Course();
     $result->findById($id);
     return $result->get('name');
 }
开发者ID:bennyty,项目名称:suggestr,代码行数:6,代码来源:suggestions.php

示例12: Training

 function end_course($id)
 {
     $training = new Training();
     $course = new Course();
     try {
         $t_data = $training->get(array('id' => $id, 'user_id' => $_SESSION['user_id']));
         $c_data = $course->get(array('id' => $t_data['course_id']));
         if ($c_data['exam'] == 't') {
             $status = Training::EXAM;
         } else {
             $status = Training::FINISHED;
         }
         $training->update($id, array('status_id' => $status, 'finished' => date('Y-m-d H:i', time())));
         header('Location: /mycourses');
         exit;
     } catch (Exception $e) {
         echo $e;
     }
 }
开发者ID:jedaika,项目名称:Trainings,代码行数:19,代码来源:mycourses.php

示例13: edit

    function edit($create = null)
    {
        $translator = new Translator();
        $course = new Course();
        if ($create) {
            $func = 'add';
            $category_id = array_shift($this->param);
        } else {
            $func = 'save';
            $data = $course->get(array('id' => array_shift($this->param)));
            foreach ($data as $key => $val) {
                $data[$key] = htmlspecialchars($val, ENT_QUOTES);
            }
            $category_id = $data['category_id'];
        }
        $categories = Course::getCategoriesForSelect($category_id);
        foreach ($course->formats as $key => $val) {
            $formats .= "<option value=\"{$key}\"" . ($data['format_id'] == $key ? ' selected' : '') . ">" . htmlspecialchars($val, ENT_QUOTES) . "</option>" . NL;
        }
        foreach ($course->languages as $key => $val) {
            $languages .= "<option value=\"{$key}\"" . ($data['language'] == $key ? ' selected' : '') . ">" . htmlspecialchars($val, ENT_QUOTES) . "</option>" . NL;
        }
        if ($data['active'] == 't') {
            $active = 'checked';
        }
        if ($data['exam'] == 't') {
            $exam = 'checked';
        }
        if ($data['need_approve'] == 't') {
            $need_approve = 'checked';
        }
        $maxsize = ini_get('post_max_size');
        if (!isset($create) && file_exists(__DIR__ . '/../../../files/courses/' . $id)) {
            $download = "<a href=\"/admin_course/download/{$data[id]}\" target=\"_blank\">{$translator->Download_Archive}</a>\n\t\t<a href=\"/admin_manager/list/{$data[id]}\">{$translator->File_Manager}</a>";
            $question = new Question();
            $q_cnt = $question->getCount(array('course_id' => $data['id']));
            if ($q_cnt) {
                $q_cnt = "<span class=\"badge\">{$q_cnt}</span>";
            } else {
                $q_cnt = '';
            }
            $questions = "<div><a href=\"/admin_questions/{$data[id]}\">{$translator->Questions_Link} {$q_cnt}</a></div>";
        }
        echo <<<EOF
<div class="container">
<div class="col-xs-12 col-sm-8 col-md-6 col-sm-offset-2 col-md-offset-3">
    <form role="form" action="/admin_course/{$func}/{$data[id]}" method="post" enctype="multipart/form-data">
\t<h2>{$translator->edit}</h2>
\t    <div class="form-group">
\t\t<input type="text" name="name" id="name" class="form-control input-lg" 
\t\tplaceholder="{$translator->Name}" tabindex="1" required value="{$data[name]}">
\t    </div>
\t    <div class="form-group">
\t\t<label for="category_id">{$translator->Category}:</label>
\t\t    <select class="form-control" id="category_id" name="category_id">
\t\t    {$categories}
\t\t</select>
\t    </div>
\t    <div class="form-group">
\t\t<label for="format_id">{$translator->Format}:</label>
\t\t    <select class="form-control" id="format_id" name="format_id">
\t\t    {$formats}
\t\t</select>
\t    </div>
\t    <div class="form-group">
\t\t<label for="data">{$translator->Prerequisites}:</label> {$translator->Prerequisites_Desc}
\t\t<textarea  name="prerequisites" id="prerequisites" class="form-control" rows="4">{$data[prerequisites]}</textarea>
\t    </div>
<!-- TODO>
 Add needed courses select-box
\t    <div class="form-group">Courses</div>
<!-->
\t    <div class="form-group">
\t\t<label for="language">{$translator->Language}:</label>
\t\t    <select class="form-control" id="language" name="language">
\t\t    {$languages}
\t\t</select>
\t    </div>
\t    <div class="form-group">
\t\t<label for="describe">{$translator->Describe}:</label> {$translator->Describe_Desc}
\t\t<textarea  name="describe" id="describe" class="form-control" rows="5">{$data[describe]}</textarea>
\t    </div>
\t    <div class="form-group">
\t\t<label for="skills">{$translator->Skills}:</label> {$translator->Skills_Desc}
\t\t<textarea  name="skills" id="skills" class="form-control" rows="5">{$data[skills]}</textarea>
\t    </div>
\t    <div class="form-group">
\t\t<input type="number" name="duration" id="duration" class="form-control" min="1"
\t\tplaceholder="{$translator->Duration}" tabindex="1" required value="{$data[duration]}">
\t\t<span class="help-block">{$translator->Duration_Desc}</span>
\t    </div>
\t    <div class="form-group">
\t\t<label for="equipment">{$translator->Equipment}:</label> {$translator->Equipment_Desc}
\t\t<textarea  name="equipment" id="equipment" class="form-control" rows="5">{$data[equipment]}</textarea>
\t    </div>
\t    <div class="form-group">
\t\t<input type="number" name="min" id="min" class="form-control" min="1"
\t\tplaceholder="{$translator->Min}" tabindex="1" value="{$data[min]}">
\t\t<span class="help-block">{$translator->Min_Desc}</span>
\t    </div>
//.........这里部分代码省略.........
开发者ID:jedaika,项目名称:Trainings,代码行数:101,代码来源:admin_course.php

示例14: get_task_set_by_id

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

示例15: validate_course_id

/**
 * Returns null if $value is not a valid or existent course_id; returns the $value otheriwse. XXX NOTE, a bug prior to php 5.2.6 causes epic php failure if callbacks return false. null returned as workaround
 * @param unknown_type $value
 * @return mixed
 */
function validate_course_id($value)
{
    $course_id = filter_var($value, FILTER_VALIDATE_INT, array('min_range' => 1));
    if (false === $course_id || !Course::get($course_id)) {
        return;
    } else {
        return $course_id;
    }
}
开发者ID:nadeemshafique,项目名称:entrada-1x,代码行数:14,代码来源:functions.inc.php


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