return html_writer::span(join('', $actions), 'course-item-actions item-actions');
}
+ /**
+ * Renders html to display a course search form
+ *
+ * @param string $value default value to populate the search field
+ * @param string $format display format - 'plain' (default), 'short' or 'navbar'
+ * @return string
+ */
+ public function course_search_form($value = '', $format = 'plain') {
+ static $count = 0;
+ $formid = 'coursesearch';
+ if ((++$count) > 1) {
+ $formid .= $count;
+ }
+
+ switch ($format) {
+ case 'navbar' :
+ $formid = 'coursesearchnavbar';
+ $inputid = 'navsearchbox';
+ $inputsize = 20;
+ break;
+ case 'short' :
+ $inputid = 'shortsearchbox';
+ $inputsize = 12;
+ break;
+ default :
+ $inputid = 'coursesearchbox';
+ $inputsize = 30;
+ }
+
+ $strsearchcourses = get_string("searchcourses");
+ $searchurl = new moodle_url('/course/management.php');
+
+ $output = html_writer::start_tag('form', array('id' => $formid, 'action' => $searchurl, 'method' => 'get'));
+ $output .= html_writer::start_tag('fieldset', array('class' => 'coursesearchbox invisiblefieldset'));
+ $output .= html_writer::tag('label', $strsearchcourses.': ', array('for' => $inputid));
+ $output .= html_writer::empty_tag('input', array('type' => 'text', 'id' => $inputid,
+ 'size' => $inputsize, 'name' => 'search', 'value' => s($value)));
+ $output .= html_writer::empty_tag('input', array('type' => 'submit',
+ 'value' => get_string('go')));
+ $output .= html_writer::end_tag('fieldset');
+ $output .= html_writer::end_tag('form');
+
+ return $output;
+ }
+
/**
* Creates access hidden skip to links for the displayed sections.
*
* @param string $tagcontents The raw contents of the XML element
*/
protected function process_group_tag($tagcontents) {
- global $DB;
+ global $DB, $CFG;
// Get configs.
$truncatecoursecodes = $this->get_config('truncatecoursecodes');
$createnewcourses = $this->get_config('createnewcourses');
$createnewcategories = $this->get_config('createnewcategories');
+ if ($createnewcourses) {
+ require_once("$CFG->dirroot/course/lib.php");
+ }
// Process tag contents.
$group = new stdClass();
if (preg_match('{<sourcedid>.*?<id>(.+?)</id>.*?</sourcedid>}is', $tagcontents, $matches)) {
*
* A NULL value will delete the entry.
*
+ * NOTE: this function is called from lib/db/upgrade.php
+ *
* @param string $name the key to set
* @param string $value the value to set (without magic quotes)
* @param string $plugin (optional) the plugin scope, default null
* If called with 2 parameters it will return a string single
* value or false if the value is not found.
*
+ * NOTE: this function is called from lib/db/upgrade.php
+ *
* @static string|false $siteidentifier The site identifier is not cached. We use this static cache so
* that we need only fetch it once per request.
* @param string $plugin full component name
/**
* Removes a key from global configuration.
*
+ * NOTE: this function is called from lib/db/upgrade.php
+ *
* @param string $name the key to set
* @param string $plugin (optional) the plugin scope
* @return boolean whether the operation succeeded.