Skip to content
Snippets Groups Projects
Commit 0922bedb authored by Tobias Baden's avatar Tobias Baden
Browse files

Updated the course search

- Fixed Warnings
- Added Placeholder
- Added Placeholder Settings
- Added Placeholder Strings
- Added help Icon (without function atm)
- Updated Version Number
parent 561f5754
Branches
Tags
No related merge requests found
......@@ -25,7 +25,7 @@ class block_hshcourselist extends block_base {
}
public function get_content() {
global $CFG, $DB;
global $CFG, $DB, $OUTPUT;
$this->page->requires->js('/blocks/hshcourselist/javascript/jquery-3.2.0.min.js');
$this->page->requires->js('/blocks/hshcourselist/javascript/listselect.js');
......@@ -39,6 +39,12 @@ class block_hshcourselist extends block_base {
$context_block = context_block::instance($this->instance->id);
$search = optional_param('hshcoursesearch', '', PARAM_TEXT);
$hshcoursesubmit = optional_param('hshcoursesubmit', false, PARAM_TEXT);
// set placeholder
if($this->config->placeholder) {
$placeholder = $this->config->placeholder;
} else {
$placeholder = "";
}
$list_contents = '';
$anchor = html_writer::tag('a', '', array('name' => 'hshcourselistanchor'));
......@@ -56,12 +62,20 @@ class block_hshcourselist extends block_base {
'name' => 'hshcourselistsearch',
'id' => 'hshcourselistsearch',
'class' => 'form-control',
'value' => $search
'value' => $search,
'placeholder' => $placeholder
);
$input = html_writer::empty_tag('input', $inputattrs);
$questionattrs = array(
'src' => $OUTPUT->image_url('help', 'moodle'),
'class' => 'hshcoursehelpclass',
'id' => 'hshcoursehelpid'
);
$question = html_writer::empty_tag('img', $questionattrs);
$progressattrs = array(
'src' => $this->page->theme->pix_url('i/loading_small', 'moodle'),
'src' => $OUTPUT->image_url('i/loading_small', 'moodle'),
'class' => 'hshcourseprogress',
'id' => 'hshcourseprogress',
'alt' => get_string('loading', 'block_hshcourselist')
......@@ -76,7 +90,7 @@ class block_hshcourselist extends block_base {
'action' => new moodle_url('/')
);
$form = html_writer::tag('form', $idSearchinglabel.$ordercheckbox.$input.$progress, $formattrs);
$form = html_writer::tag('form', $idSearchinglabel.$ordercheckbox.$input.$question.$progress, $formattrs);
if (!empty($hshcoursesubmit)) {
$courses = self::get_courses($search, $context_block, $this->globalconf->splitterms,
$this->globalconf->restrictcontext, $this->page->context,
......@@ -104,6 +118,17 @@ class block_hshcourselist extends block_base {
}
}
if(!isset($this->config->orderbysemester)) {
$orderbysemester = false;
} else {
$orderbysemester = $this->config->orderbysemester;
}
if(!isset($this->config->displaymode)) {
$displaymode = 2;
} else {
$displaymode = $this->config->displaymode;
}
$list = html_writer::tag('ul', $list_contents, array('id' => 'hshcourselistul'));
$this->content->text = $anchor.$form.$list;
$jsmodule = array(
......@@ -119,8 +144,8 @@ class block_hshcourselist extends block_base {
Notice: Trying to get property of non-object in C:\Dev\xampp\htdocs\moodle\blocks\hshcourselist\block_hshcourselist.php on line 118 (123)
*/
'displaymode' => $this->config->displaymode,
'orderbysemester' => $this->config->orderbysemester,
'displaymode' => $displaymode,
'orderbysemester' => $orderbysemester,
'contextid' => $this->page->context->id
);
$this->page->requires->js_call_amd('block_hshcourselist/jmodule', 'init', array($jsdata));
......
......@@ -11,6 +11,12 @@ class block_hshcourselist_edit_form extends block_edit_form {
$mform->setDefault('config_title', get_string('default_blocktitle', 'block_hshcourselist'));
$mform->setType('config_title', PARAM_TEXT);
//Placeholder Text
$mform->addElement('header', 'placeholdersettings',get_string('placeholder_settings', 'block_hshcourselist'));
$mform->addElement('text', 'config_placeholder', get_string('placeholder', 'block_hshcourselist'));
$mform->setDefault('config_placeholder', "");
$mform->setType('config_placeholder', PARAM_TEXT);
// Displaysettings
$mform->addElement('header', 'displaysettings', get_string('blocksettings_display', 'block_hshcourselist'));
$selectoptions = array(0 => get_string('displayZero', 'block_hshcourselist'),
......
......@@ -28,3 +28,6 @@ $string['orderbysemester'] = 'Order by semester';
$string['loading'] = 'LOADING...';
$string['idSearchingLabel'] = ">> Es wird nur nach Kurs-ID's gesucht. <<";
$string['placeholder'] = "Placeholder for the searching field";
$string['placeholder_settings'] = "Placeholder settings";
\ No newline at end of file
......@@ -14,6 +14,15 @@
color: white;
}
#hshcoursehelpid, .hshcoursehelpclass {
margin-top: -61px;
margin-left: 98%;
}
#hshcourselistsearch {
width: 97% !important;
}
/*
* Aus Bootstrap 4 (Einheitliches Design wird "erzwungen", auch in Bootstrap 3 Themes)
*/
......
<?php
$plugin->component = 'block_hshcourselist';
$plugin->version = 2018081001; // YYYYMMDDHH
$plugin->version = 2018082401; // YYYYMMDDHH
$plugin->requires = 2016112900; // YYYYMMDDHH
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment