本文整理汇总了PHP中Course类的典型用法代码示例。如果您正苦于以下问题:PHP Course类的具体用法?PHP Course怎么用?PHP Course使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Course类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInitData
public function getInitData($req)
{
$data = array();
$employees = new Employee();
$data['numberOfEmployees'] = $employees->Count("1 = 1");
$company = new CompanyStructure();
$data['numberOfCompanyStuctures'] = $company->Count("1 = 1");
$user = new User();
$data['numberOfUsers'] = $user->Count("1 = 1");
$project = new Project();
$data['numberOfProjects'] = $project->Count("status = 'Active'");
$attendance = new Attendance();
$data['numberOfAttendanceLastWeek'] = $attendance->Count("in_time > '" . date("Y-m-d H:i:s", strtotime("-1 week")) . "'");
if (empty($data['numberOfAttendanceLastWeek'])) {
$data['numberOfAttendanceLastWeek'] = 0;
}
$empLeave = new EmployeeLeave();
$data['numberOfLeaves'] = $empLeave->Count("date_start > '" . date("Y-m-d") . "'");
$timeEntry = new EmployeeTimeEntry();
$data['numberOfAttendanceLastWeek'] = $timeEntry->Count("in_time > '" . date("Y-m-d H:i:s", strtotime("-1 week")) . "'");
$candidate = new Candidate();
$data['numberOfCandidates'] = $candidate->Count("1 = 1");
$job = new Job();
$data['numberOfJobs'] = $job->Count("status = 'Active'");
$course = new Course();
$data['numberOfCourses'] = $course->Count("1 = 1");
return new IceResponse(IceResponse::SUCCESS, $data);
}
示例2: create_course
/**
* @brief create course
* @param type $public_code
* @param type $lang
* @param type $title
* @param string $description
* @param array $departments
* @param type $vis
* @param type $prof
* @param type $password
* @return boolean
*/
function create_course($public_code, $lang, $title, $description, $departments, $vis, $prof, $password = '') {
$code = strtoupper(new_code($departments[0]));
if (!create_course_dirs($code)) {
return false;
}
if (!$public_code) {
$public_code = $code;
}
$q = Database::get()->query("INSERT INTO course
SET code = ?s,
lang = ?s,
title = ?s,
keywords = '',
description = ?s,
visible = ?d,
prof_names = ?s,
public_code = ?s,
created = " . DBHelper::timeAfter() . ",
password = ?s,
glossary_expand = 0,
glossary_index = 1", $code, $lang, $title, $description, $vis, $prof, $public_code, $password);
if ($q) {
$course_id = $q->lastInsertID;
} else {
return false;
}
require_once 'include/lib/course.class.php';
$course = new Course();
$course->refresh($course_id, $departments);
return array($code, $course_id);
}
示例3: grab
function grab()
{
//提交表单
$grab = new Course($_POST['username']);
$url = "http://jw.gdufs.edu.cn/" . $_POST['type'] . "&xh=" . $_POST['username'] . "&xm=" . urlencode($_POST['name']);
$course = explode(",", $_POST['course']);
$input = $_POST['input'];
$tempReg = "/=>|&/";
$arr = preg_split($tempReg, $input);
$from = array();
for ($i = 0; $i < count($arr); $i += 2) {
$form[$arr[$i]] = $arr[$i + 1];
}
$form['ddl_ywyl'] = "";
//有无余量
$form['ddl_kcgs'] = "";
//课程归属
$form['ddl_sksj'] = "";
//上课时间
$form['ddl_xqbs'] = 2;
//1:北校区,2:南校区
$form['Button1'] = "提交";
for ($i = 0; $i < count($course); $i++) {
$form[$course[$i]] = "on";
}
$res = my_iconv($grab->submitForm($url, $form));
echo json_encode($res);
}
示例4: 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);
}
示例5: newEntry
public function newEntry($scholar_no, $course_code, $course_dep, $classes_attended, $classes_total)
{
if (!loggedIn() || privilege() == NULL || privilege() == 'admin') {
return 0;
}
$c = new Course();
if (!$c->appointError(Session::get('teacher_id'), $course_code, $course_dep)) {
unset($c);
return 0;
}
$this->_connect();
$scholar_no = $this->_db->real_escape_string(escape($scholar_no));
$course_code = $this->_db->real_escape_string(escape($course_code));
$classes_attended = $this->_db->real_escape_string(escape($classes_attended));
$classes_total = $this->_db->real_escape_string(escape($classes_total));
$percentage = $classes_attended * 100 / $classes_total;
$check = $this->getEntry($scholar_no, $course_code);
if (empty($check)) {
$query = "INSERT INTO attendance_data (scholar_no, course_code, classes_attended, classes_total, percentage) VALUES ('" . $scholar_no . "','" . $course_code . "','" . $classes_attended . "','" . $classes_total . "','" . $percentage . "')";
} else {
$query = "UPDATE attendance_data SET classes_attended = '" . $classes_attended . "', classes_total = '" . $classes_total . "', percentage = '" . $percentage . "' WHERE scholar_no='" . $scholar_no . "' AND course_code='" . $course_code . "' AND timestamp>='" . Session::get('semester_timestamp') . "'";
}
$result = $this->_db->query($query);
if ($this->_db->error != '') {
die('Database error!');
}
if ($this->_db->affected_rows) {
return 1;
} else {
return 0;
}
}
示例6: getList
public function getList($order = "didascalia")
{
$order = trim(filter_var($order, FILTER_SANITIZE_STRING));
//interrogazione tabella
$sql = "SELECT * FROM upload ORDER BY {$order}";
$auth = $this->connector->query($sql);
$list = array();
// controllo sul risultato dell'interrogazione
if (mysql_num_rows($auth) > 0) {
$doc = new Document();
$doc->setConnector($this->connector);
$course = new Course();
$course->setConnector($this->connector);
while ($res = $this->connector->getObjectResult($auth)) {
$doc = new Document($res->id, $res->path, $res->tipo, $res->didascalia);
//Calcolo le informazioni di servizio
if ($res->tipo == 1) {
$doc->course_name = "TUTTI";
} else {
$doc->course_name = $course->getById($res->tipo)->name;
}
$list[] = $doc;
}
}
return $list;
}
示例7: 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');
}
示例8: get_student_courses
public function get_student_courses($order = null)
{
LoadHelper::model('course');
$student_list = array();
//connect to database
$this->db->connect();
//query
$sql = "SELECT s.id,s.first_name,s.last_name,s.email,s.contact_no,c.id as course_id,c.course_name ";
$sql .= " FROM students s JOIN courses c on s.course_id=c.id";
if (isset($order)) {
$sql = $sql . " ORDER BY " . $order;
}
//fetchquery
$result = $this->db->fetchquery($sql);
while ($row = $result->fetch_assoc()) {
$student = new Students();
$student->set_id($row['id']);
$student->set_first_name($row['first_name']);
$student->set_last_name($row['last_name']);
$student->set_email($row['email']);
$student->set_contact_no($row['contact_no']);
$course = new Course();
$course->set_id($row['course_id']);
$course->set_course_name($row['course_name']);
$student->set_course($course);
array_push($student_list, $student);
}
$this->db->close();
return $student_list;
}
示例9: 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;
}
示例10: map_data
private function map_data()
{
$Course = new Course();
$Course->set_course_name($_POST['course_name']);
$Course->set_status($_POST['status']);
return $Course;
}
示例11: displayDisciplinesOfSyllabus
public function displayDisciplinesOfSyllabus($syllabusId, $courseId)
{
$syllabusDisciplines = $this->getSyllabusDisciplines($syllabusId);
$course = new Course();
$foundCourse = $course->getCourseById($courseId);
$data = array('syllabusDisciplines' => $syllabusDisciplines, 'syllabusId' => $syllabusId, 'course' => $foundCourse);
loadTemplateSafelyByGroup("secretario", 'syllabus/course_syllabus_disciplines', $data);
}
示例12: getCoursesByCategory
public function getCoursesByCategory()
{
$conn = new Course($this->_config);
$result = $conn->getCourseBy($this->_data['target'], $this->_data['value']);
$encodedResult = $this->utf8_converter($result);
$courses = json_encode($encodedResult);
echo $courses;
}
示例13: testListCoursesShouldReturnAnIterator
public function testListCoursesShouldReturnAnIterator()
{
$stub = $this->getClientStub();
$stub->expects($this->once())->method('request')->with($this->equalTo('GET'), $this->equalTo('/courses/all'))->willReturn([]);
$provider = new Course($stub);
$data = $provider->listCourses();
$this->assertEquals([], $data);
}
示例14: delete
function delete(Course $obj)
{
$output = array('code' => '000', 'message' => 'Something gone wrong. Please try again', 'type' => 'danger');
if ($obj->delete($_REQUEST['id'])) {
$output = array('code' => '200', 'message' => 'Course deleted successfully.', 'type' => 'success');
}
return $output;
}
示例15: specific_definition
protected function specific_definition($mform)
{
global $CFG;
global $COURSE;
$Course = new Course();
$course_notification_setting = $Course->get_registration($COURSE->id);
// Fields for editing HTML block title and contents.
$mform->addElement('header', 'configheader', get_string('blocksettings', 'block'));
$attributes = array();
$attributes['disabled'] = 'disabled';
$attributes['group'] = 'moodle_notifications_settings';
if ($CFG->block_moodle_notifications_email_channel == 1) {
$mform->addElement('checkbox', 'notify_by_email', get_string('notify_by_email', 'block_moodle_notifications'));
} else {
$mform->addElement('advcheckbox', 'notify_by_email', get_string('notify_by_email', 'block_moodle_notifications'), null, $attributes);
}
if (isset($course_notification_setting->notify_by_email) and $course_notification_setting->notify_by_email == 1) {
$mform->setDefault('notify_by_email', 1);
}
if ($CFG->block_moodle_notifications_sms_channel == 1 and class_exists('SMS')) {
$mform->addElement('checkbox', 'notify_by_sms', get_string('notify_by_sms', 'block_moodle_notifications'));
} else {
$mform->addElement('advcheckbox', 'notify_by_sms', get_string('notify_by_sms', 'block_moodle_notifications'), null, $attributes);
}
if (isset($course_notification_setting->notify_by_sms) and $course_notification_setting->notify_by_sms == 1) {
$mform->setDefault('notify_by_sms', 1);
}
if ($CFG->block_moodle_notifications_rss_channel == 1) {
$mform->addElement('checkbox', 'notify_by_rss', get_string('notify_by_rss', 'block_moodle_notifications'));
} else {
$mform->addElement('advcheckbox', 'notify_by_rss', get_string('notify_by_rss', 'block_moodle_notifications'), null, $attributes);
}
if (isset($course_notification_setting->notify_by_rss) and $course_notification_setting->notify_by_rss == 1) {
$mform->setDefault('notify_by_rss', 1);
}
if ($CFG->block_moodle_notifications_email_channel == 1 or $CFG->block_moodle_notifications_sms_channel == 1) {
$options = array();
for ($i = 1; $i < 25; ++$i) {
$options[$i] = $i;
}
$mform->addElement('select', 'notification_frequency', get_string('notification_frequency', 'block_moodle_notifications'), $options);
$mform->setDefault('notification_frequency', $course_notification_setting->notification_frequency / 3600);
}
$mform->addElement('html', '<br /><div class="qheader">' . get_string('course_configuration_presets_comment', 'block_moodle_notifications') . '</div>');
$mform->addElement('checkbox', 'email_notification_preset', get_string('email_notification_preset', 'block_moodle_notifications'));
if (isset($course_notification_setting->email_notification_preset) and $course_notification_setting->email_notification_preset == 1) {
$mform->setDefault('email_notification_preset', 1);
} else {
$mform->setDefault('email_notification_preset', 0);
}
$mform->addElement('checkbox', 'sms_notification_preset', get_string('sms_notification_preset', 'block_moodle_notifications'));
if (isset($course_notification_setting->sms_notification_preset) and $course_notification_setting->sms_notification_preset == 1) {
$mform->setDefault('sms_notification_preset', 1);
} else {
$mform->setDefault('sms_notification_preset', 0);
}
}