Skip to content

Commit

Permalink
hub server MDL-19311 add some code to the index page to display the h…
Browse files Browse the repository at this point in the history
…ub course list in case the hub plugin is installed + improve community block search form (subject + language)
  • Loading branch information
mouneyrac committed May 14, 2010
1 parent f3287c1 commit abf63f9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
14 changes: 14 additions & 0 deletions blocks/community/forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ public function definition() {
$mform->addHelpButton('educationallevel', 'educationallevel', 'hub');

$options = get_string_manager()->load_component_strings('edufields', current_language());
foreach ($options as $key => &$option) {
$keylength = strlen ( $key );
if ( $keylength == 10) {
$option = "  " . $option;
} else if ( $keylength == 12) {
$option = "    " . $option;
}
}
$options['all'] = get_string('all', 'hub');
$mform->addElement('select', 'subject', get_string('subject', 'hub'), $options);
$mform->setDefault('subject', 'all');
Expand All @@ -109,6 +117,7 @@ public function definition() {
$mform->setDefault('licence', 'all');

$languages = get_string_manager()->get_list_of_languages();
asort($languages, SORT_LOCALE_STRING);
$languages['all'] = get_string('all', 'hub');
$mform->addElement('select', 'language',get_string('language'), $languages);
$mform->setDefault('language', 'all');
Expand All @@ -128,6 +137,11 @@ function validation($data, $files) {
$errors['huburl'] = get_string('nohubselected', 'hub');
}

if (!(strlen($this->_form->_submitValues['subject']) == 12 or $this->_form->_submitValues['subject'] == 'all')) {

$errors['subject'] = get_string('cannotselecttopsubject', 'block_community');
}

return $errors;
}

Expand Down
3 changes: 2 additions & 1 deletion blocks/community/lang/en/block_community.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@
*/

$string['addcommunitycourse'] = 'Add community course';
$string['additionalcoursedesc'] = '{$a->contributornames} {$a->coverage} - Creator: {$a->creatorname} - Publisher: {$a->publishername} - Subject: {$a->subject}
$string['additionalcoursedesc'] = '{$a->contributornames} - {$a->coverage} - Creator: {$a->creatorname} - Publisher: {$a->publishername} - Subject: {$a->subject}
- Audience: {$a->audience} - Educational level: {$a->educationallevel}';
$string['addcourse'] = 'Search';
$string['cannotselecttopsubject'] = 'Cannot select a top subject level';
$string['contributors'] = ' - Contributors: {$a}';
$string['coursedesc'] = 'Description';
$string['courselang'] = 'Language';
Expand Down
8 changes: 8 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@
add_to_log(SITEID, 'course', 'view', 'view.php?id='.SITEID, SITEID);
}

//Hack to display the hub server home page if ever the hub plugin is installed
if (get_config('local_hub', 'hubenabled') && file_exists($CFG->dirroot.'/local/hub/lib.php')) {
require_once($CFG->dirroot.'/local/hub/lib.php');
$hub = new local_hub();
$hub->display_homepage();
exit;
}

$PAGE->set_pagetype('site-index');
$PAGE->set_other_editing_capability('moodle/course:manageactivities');
$PAGE->set_docs_path('');
Expand Down

0 comments on commit abf63f9

Please sign in to comment.