community block MDL-19314 improve search community course form (heading, help icons, help text, remove "no search result" text on first display)

This commit is contained in:
jerome mouneyrac 2010-05-20 03:37:03 +00:00
parent 5a47767cc5
commit f1b4e19eea
4 changed files with 45 additions and 20 deletions

View File

@ -40,7 +40,7 @@ $PAGE->set_title(get_string('searchcourse', 'block_community'));
$PAGE->navbar->ignore_active(true);
$PAGE->navbar->add(get_string('searchcourse', 'block_community'));
$search = optional_param('search', '', PARAM_TEXT);
$search = optional_param('search', null, PARAM_TEXT);
$community = new community();
@ -83,9 +83,8 @@ $renderer = $PAGE->get_renderer('block_community');
//forms
$hubselectorform = new community_hub_search_form('', array('search' => $search));
$fromform = $hubselectorform->get_data();
$courses= null;
//Retrieve courses by web service
$courses = array();
if (!empty($fromform)) {
$downloadable = optional_param('downloadable', false, PARAM_INTEGER);
@ -120,7 +119,7 @@ if (!empty($fromform)) {
// OUTPUT
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('addcommunitycourse', 'block_community'), 3, 'main');
echo $OUTPUT->heading(get_string('searchcommunitycourse', 'block_community'), 3, 'main');
if (!empty($notificationmessage)) {
echo $notificationmessage;
}

View File

@ -53,25 +53,27 @@ class community_hub_search_form extends moodleform {
//Public hub list
$options = array();
$mform->addElement('static','huburlstring',get_string('selecthub', 'hub').':');
$mform->addElement('static','huburlstring',get_string('selecthub', 'block_community'));
$mform->addHelpButton('huburlstring', 'selecthub', 'block_community');
foreach ($hubs as $hub) {
$mform->addElement('radio','huburl',null,' '.$hub['name'], $hub['url']);
}
$options = array(0 => get_string('enrollable', 'block_community'),
1 => get_string('downloadable', 'block_community'));
$mform->addElement('select', 'downloadable', '',
$mform->addElement('select', 'downloadable', get_string('enroldownload', 'block_community'),
$options);
$mform->addHelpButton('downloadable', 'enroldownload', 'block_community');
$options = array();
$options['all'] = get_string('any');
$options[AUDIENCE_EDUCATORS] = get_string('audienceeducators', 'hub');
$options[AUDIENCE_STUDENTS] = get_string('audiencestudents', 'hub');
$options[AUDIENCE_ADMINS] = get_string('audienceadmins', 'hub');
$mform->addElement('select', 'audience', get_string('audience', 'hub'), $options);
$mform->addElement('select', 'audience', get_string('audience', 'block_community'), $options);
$mform->setDefault('audience', 'all');
unset($options);
$mform->addHelpButton('audience', 'audience', 'hub');
$mform->addHelpButton('audience', 'audience', 'block_community');
$options = array();
$options['all'] = get_string('any');
@ -82,10 +84,10 @@ class community_hub_search_form extends moodleform {
$options[EDULEVEL_ASSOCIATION] = get_string('edulevelassociation', 'hub');
$options[EDULEVEL_CORPORATE] = get_string('edulevelcorporate', 'hub');
$options[EDULEVEL_OTHER] = get_string('edulevelother', 'hub');
$mform->addElement('select', 'educationallevel', get_string('educationallevel', 'hub'), $options);
$mform->addElement('select', 'educationallevel', get_string('educationallevel', 'block_community'), $options);
$mform->setDefault('educationallevel', 'all');
unset($options);
$mform->addHelpButton('educationallevel', 'educationallevel', 'hub');
$mform->addHelpButton('educationallevel', 'educationallevel', 'block_community');
$options = get_string_manager()->load_component_strings('edufields', current_language());
foreach ($options as $key => &$option) {
@ -97,10 +99,10 @@ class community_hub_search_form extends moodleform {
}
}
$options = array_merge (array('all' => get_string('any')),$options);
$mform->addElement('select', 'subject', get_string('subject', 'hub'), $options, array('id'=>'communitysubject'));
$mform->addElement('select', 'subject', get_string('subject', 'block_community'), $options, array('id'=>'communitysubject'));
$mform->setDefault('subject', 'all');
unset($options);
$mform->addHelpButton('subject', 'subject', 'hub');
$mform->addHelpButton('subject', 'subject', 'block_community');
$this->init_javascript_enhancement('subject', 'smartselect', array('selectablecategories' => true, 'mode'=>'compact'));
require_once($CFG->dirroot."/lib/licenselib.php");
@ -111,10 +113,10 @@ class community_hub_search_form extends moodleform {
foreach ($licences as $license) {
$options[$license->shortname] = get_string($license->shortname, 'license');
}
$mform->addElement('select', 'licence', get_string('license'), $options);
$mform->addElement('select', 'licence', get_string('licence', 'block_community'), $options);
$mform->setDefault('licence', 'cc');
unset($options);
$mform->addHelpButton('licence', 'licence', 'hub');
$mform->addHelpButton('licence', 'licence', 'block_community');
$mform->setDefault('licence', 'all');
$languages = get_string_manager()->get_list_of_languages();
@ -122,9 +124,11 @@ class community_hub_search_form extends moodleform {
$languages = array_merge (array('all' => get_string('any')),$languages);
$mform->addElement('select', 'language',get_string('language'), $languages);
$mform->setDefault('language', 'all');
$mform->addHelpButton('language', 'language', 'block_community');
$mform->addElement('text','search' , get_string('search', 'block_community'));
$mform->addElement('text','search' , get_string('keywords', 'block_community'));
$mform->addHelpButton('search', 'keywords', 'block_community');
$this->add_action_buttons(false, get_string('search', 'block_community'));
}

View File

@ -24,23 +24,43 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['addtocommunityblock'] = 'Add to community block';
$string['addcommunitycourse'] = 'Add community course';
$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['audience'] = 'Designed for';
$string['audience_help'] = 'What kind of course are you looking for? As well as traditional courses intended for students, you might search for communities of Educators or Moodle Administrators';
$string['cannotselecttopsubject'] = 'Cannot select a top subject level';
$string['contributors'] = ' - Contributors: {$a}';
$string['coursedesc'] = 'Description';
$string['courselang'] = 'Language';
$string['coursename'] = 'Name';
$string['download'] = 'Download';
$string['downloadable'] = 'Downloadable';
$string['downloadable'] = 'courses I can download';
$string['downloadtemplate'] = 'Create course from template';
$string['enrollable'] = 'Enrollable';
$string['educationallevel'] = 'Educational level';
$string['educationallevel_help'] = 'What educational level are you searching for? In the case of communities of educators, this level describes the level they are teaching.';
$string['enroldownload'] = 'Find';
$string['enroldownload_help'] = 'Some courses listed in the selected hub are being advertised so that people can come and participate in them on the original site.
Others are course templates provided for you to download and use on your own Moodle site.';
$string['enrollable'] = 'courses I can enrol in';
$string['hub'] = 'hub';
$string['keywords'] = 'Keywords';
$string['keywords_help'] = 'You can search for courses containing specific text in the name, description and other fields of the database.';
$string['language'] = 'Language';
$string['language_help'] = 'You can search for courses written in a specific language.';
$string['licence'] = 'License';
$string['licence_help'] = 'You can search for courses that are licensed in a particular way.';
$string['mycommunities'] = 'My communities:';
$string['nocourse'] = 'No courses found';
$string['operation'] = 'Operation';
$string['pluginname'] = 'Community';
$string['search'] = 'Search';
$string['searchcourse'] = 'Search community course';
$string['searchcommunitycourse'] = 'Search community course';
$string['searchcourse'] = 'Search community course';
$string['selecthub'] = 'Select hub';
$string['selecthub_help'] = 'Select hub where to search the courses.';
$string['subject'] = 'Subject';
$string['subject_help'] = 'To narrow your search to courses about a particular subject, choose one from this list.';

View File

@ -53,7 +53,9 @@ class block_community_renderer extends plugin_renderer_base {
if (empty($courses)) {
$renderedhtml .= get_string('nocourse', 'block_community');
if (isset($courses)) {
$renderedhtml .= get_string('nocourse', 'block_community');
}
} else {
$table->width = '100%';
@ -109,7 +111,7 @@ class block_community_renderer extends plugin_renderer_base {
array('sesskey' => sesskey(), 'add' => 1, 'confirmed' => 1,
'coursefullname' => $course->fullname, 'courseurl' => $courseurl,
'coursedescription' => $course->description));
$addlinkhtml = html_writer::tag('a', get_string('add'), array('href' => $addurl));
$addlinkhtml = html_writer::tag('a', get_string('addtocommunityblock', 'block_community'), array('href' => $addurl));
} else {
// Add link TODO make it a button and send by post
$addurl = new moodle_url("/blocks/community/communitycourse.php",