-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathajax_loadsectionoption.php
More file actions
28 lines (18 loc) · 996 Bytes
/
ajax_loadsectionoption.php
File metadata and controls
28 lines (18 loc) · 996 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php // $Id:,v 2.0 2012/05/20 16:10:00 Serafim Panov
require_once("../../config.php");
$id = required_param('id', PARAM_INT);
if (!$course = $DB->get_record("course", array( "id" => $id))) {
error("Course ID is incorrect");
}
require_course_login($course);
$currentcoursesections = $DB->get_records("course_sections", array("course" => $id));
$t = 0;
foreach ($currentcoursesections as $currentcoursesections_) {
if ($t <= $course->numsections) {
$sectionname = strip_tags(trim(str_replace(array("\r", "\n"), "", $currentcoursesections_->summary)));
if (empty($sectionname)) $sectionname = 'Section '.$currentcoursesections_->section;
if (strlen($sectionname) > 25) $sectionname = substr($sectionname, 0, 25)."...";
echo html_writer::tag('option', $sectionname, array('value'=>$currentcoursesections_->section));
}
$t++;
}