public function definition() { global $CFG, $USER, $OUTPUT; $strrequired = get_string('required'); $mform =& $this->_form; //set default value $search = $this->_customdata['search']; if (isset($this->_customdata['coverage'])) { $coverage = $this->_customdata['coverage']; } else { $coverage = 'all'; } if (isset($this->_customdata['licence'])) { $licence = $this->_customdata['licence']; } else { $licence = 'all'; } if (isset($this->_customdata['subject'])) { $subject = $this->_customdata['subject']; } else { $subject = 'all'; } if (isset($this->_customdata['audience'])) { $audience = $this->_customdata['audience']; } else { $audience = 'all'; } if (isset($this->_customdata['language'])) { $language = $this->_customdata['language']; } else { $language = current_language(); } if (isset($this->_customdata['educationallevel'])) { $educationallevel = $this->_customdata['educationallevel']; } else { $educationallevel = 'all'; } if (isset($this->_customdata['downloadable'])) { $downloadable = $this->_customdata['downloadable']; } else { $downloadable = 0; } if (isset($this->_customdata['orderby'])) { $orderby = $this->_customdata['orderby']; } else { $orderby = 'newest'; } if (isset($this->_customdata['huburl'])) { $huburl = $this->_customdata['huburl']; } else { $huburl = HUB_MOODLEORGHUBURL; } $mform->addElement('header', 'site', get_string('search', 'block_community')); //add the course id (of the context) $mform->addElement('hidden', 'courseid', $this->_customdata['courseid']); $mform->addElement('hidden', 'executesearch', 1); //retrieve the hub list on the hub directory by web service $function = 'hubdirectory_get_hubs'; $params = array(); $serverurl = HUB_HUBDIRECTORYURL . "/local/hubdirectory/webservice/webservices.php"; require_once $CFG->dirroot . "/webservice/xmlrpc/lib.php"; $xmlrpcclient = new webservice_xmlrpc_client($serverurl, 'publichubdirectory'); try { $hubs = $xmlrpcclient->call($function, $params); } catch (Exception $e) { $hubs = array(); $error = $OUTPUT->notification(get_string('errorhublisting', 'block_community', $e->getMessage())); $mform->addElement('static', 'errorhub', '', $error); } //display list of registered on hub $registrationmanager = new registration_manager(); $registeredhubs = $registrationmanager->get_registered_on_hubs(); //retrieve some additional hubs that we will add to //the hub list got from the hub directory $additionalhubs = array(); foreach ($registeredhubs as $registeredhub) { $inthepubliclist = false; foreach ($hubs as $hub) { if ($hub['url'] == $registeredhub->huburl) { $inthepubliclist = true; $hub['registeredon'] = true; } } if (!$inthepubliclist) { $additionalhub = array(); $additionalhub['name'] = $registeredhub->hubname; $additionalhub['url'] = $registeredhub->huburl; $additionalhubs[] = $additionalhub; } } if (!empty($additionalhubs)) { $hubs = array_merge($hubs, $additionalhubs); } if (!empty($hubs)) { //TODO: sort hubs by trusted/prioritize //Public hub list $options = array(); $firsthub = false; foreach ($hubs as $hub) { if (array_key_exists('id', $hub)) { $params = array('hubid' => $hub['id'], 'filetype' => HUB_HUBSCREENSHOT_FILE_TYPE); $imgurl = new moodle_url(HUB_HUBDIRECTORYURL . "/local/hubdirectory/webservice/download.php", $params); $ascreenshothtml = html_writer::empty_tag('img', array('src' => $imgurl, 'alt' => $hub['name'])); $hubdescription = html_writer::tag('a', $hub['name'], array('class' => 'hublink clearfix', 'href' => $hub['url'], 'onclick' => 'this.target="_blank"')); $hubdescription .= html_writer::tag('span', $ascreenshothtml, array('class' => 'hubscreenshot')); $hubdescriptiontext = html_writer::tag('span', format_text($hub['description'], FORMAT_PLAIN), array('class' => 'hubdescription')); if (isset($hub['enrollablecourses'])) { //check needed to avoid warnings for Moodle version < 2011081700 $additionaldesc = get_string('enrollablecourses', 'block_community') . ': ' . $hub['enrollablecourses'] . ' - ' . get_string('downloadablecourses', 'block_community') . ': ' . $hub['downloadablecourses']; $hubdescriptiontext .= html_writer::tag('span', $additionaldesc, array('class' => 'hubadditionaldesc')); } if ($hub['trusted']) { $hubtrusted = get_string('hubtrusted', 'block_community'); $hubdescriptiontext .= html_writer::tag('span', $hubtrusted . ' ' . $OUTPUT->doc_link('trusted_hubs'), array('class' => 'trusted')); } $hubdescriptiontext = html_writer::tag('span', $hubdescriptiontext, array('class' => 'hubdescriptiontext')); $hubdescription = html_writer::tag('span', $hubdescription . $hubdescriptiontext, array('class' => $hub['trusted'] ? 'hubtrusted' : 'hubnottrusted')); } else { $hubdescription = html_writer::tag('a', $hub['name'], array('class' => 'hublink hubtrusted', 'href' => $hub['url'])); } if (empty($firsthub)) { $mform->addElement('radio', 'huburl', get_string('selecthub', 'block_community'), $hubdescription, $hub['url']); $mform->setDefault('huburl', $huburl); $firsthub = true; } else { $mform->addElement('radio', 'huburl', '', $hubdescription, $hub['url']); } } //display enrol/download select box if the USER has the download capability on the course if (has_capability('moodle/community:download', context_course::instance($this->_customdata['courseid']))) { $options = array(0 => get_string('enrollable', 'block_community'), 1 => get_string('downloadable', 'block_community')); $mform->addElement('select', 'downloadable', get_string('enroldownload', 'block_community'), $options); $mform->addHelpButton('downloadable', 'enroldownload', 'block_community'); } else { $mform->addElement('hidden', 'downloadable', 0); } $options = array(); $options['all'] = get_string('any'); $options[HUB_AUDIENCE_EDUCATORS] = get_string('audienceeducators', 'hub'); $options[HUB_AUDIENCE_STUDENTS] = get_string('audiencestudents', 'hub'); $options[HUB_AUDIENCE_ADMINS] = get_string('audienceadmins', 'hub'); $mform->addElement('select', 'audience', get_string('audience', 'block_community'), $options); $mform->setDefault('audience', $audience); unset($options); $mform->addHelpButton('audience', 'audience', 'block_community'); $options = array(); $options['all'] = get_string('any'); $options[HUB_EDULEVEL_PRIMARY] = get_string('edulevelprimary', 'hub'); $options[HUB_EDULEVEL_SECONDARY] = get_string('edulevelsecondary', 'hub'); $options[HUB_EDULEVEL_TERTIARY] = get_string('eduleveltertiary', 'hub'); $options[HUB_EDULEVEL_GOVERNMENT] = get_string('edulevelgovernment', 'hub'); $options[HUB_EDULEVEL_ASSOCIATION] = get_string('edulevelassociation', 'hub'); $options[HUB_EDULEVEL_CORPORATE] = get_string('edulevelcorporate', 'hub'); $options[HUB_EDULEVEL_OTHER] = get_string('edulevelother', 'hub'); $mform->addElement('select', 'educationallevel', get_string('educationallevel', 'block_community'), $options); $mform->setDefault('educationallevel', $educationallevel); unset($options); $mform->addHelpButton('educationallevel', 'educationallevel', 'block_community'); $publicationmanager = new course_publish_manager(); $options = $publicationmanager->get_sorted_subjects(); foreach ($options as $key => &$option) { $keylength = strlen($key); if ($keylength == 10) { $option = " " . $option; } else { if ($keylength == 12) { $option = " " . $option; } } } $options = array_merge(array('all' => get_string('any')), $options); $mform->addElement('select', 'subject', get_string('subject', 'block_community'), $options, array('id' => 'communitysubject')); $mform->setDefault('subject', $subject); unset($options); $mform->addHelpButton('subject', 'subject', 'block_community'); $this->init_javascript_enhancement('subject', 'smartselect', array('selectablecategories' => true, 'mode' => 'compact')); require_once $CFG->libdir . "/licenselib.php"; $licensemanager = new license_manager(); $licences = $licensemanager->get_licenses(); $options = array(); $options['all'] = get_string('any'); foreach ($licences as $license) { $options[$license->shortname] = get_string($license->shortname, 'license'); } $mform->addElement('select', 'licence', get_string('licence', 'block_community'), $options); unset($options); $mform->addHelpButton('licence', 'licence', 'block_community'); $mform->setDefault('licence', $licence); $languages = get_string_manager()->get_list_of_languages(); collatorlib::asort($languages); $languages = array_merge(array('all' => get_string('any')), $languages); $mform->addElement('select', 'language', get_string('language'), $languages); $mform->setDefault('language', $language); $mform->addHelpButton('language', 'language', 'block_community'); $mform->addElement('radio', 'orderby', get_string('orderby', 'block_community'), get_string('orderbynewest', 'block_community'), 'newest'); $mform->addElement('radio', 'orderby', null, get_string('orderbyeldest', 'block_community'), 'eldest'); $mform->addElement('radio', 'orderby', null, get_string('orderbyname', 'block_community'), 'fullname'); $mform->addElement('radio', 'orderby', null, get_string('orderbypublisher', 'block_community'), 'publisher'); $mform->addElement('radio', 'orderby', null, get_string('orderbyratingaverage', 'block_community'), 'ratingaverage'); $mform->setDefault('orderby', $orderby); $mform->setType('orderby', PARAM_ALPHA); $mform->addElement('text', 'search', get_string('keywords', 'block_community')); $mform->addHelpButton('search', 'keywords', 'block_community'); $mform->addElement('submit', 'submitbutton', get_string('search', 'block_community')); } }
public function definition() { global $CFG, $DB, $USER, $OUTPUT; $strrequired = get_string('required'); $mform =& $this->_form; $huburl = $this->_customdata['huburl']; $hubname = $this->_customdata['hubname']; $course = $this->_customdata['course']; $advertise = $this->_customdata['advertise']; $share = $this->_customdata['share']; $page = $this->_customdata['page']; $site = get_site(); //hidden parameters $mform->addElement('hidden', 'huburl', $huburl); $mform->addElement('hidden', 'hubname', $hubname); //check on the hub if the course has already been published $registrationmanager = new registration_manager(); $registeredhub = $registrationmanager->get_registeredhub($huburl); $publicationmanager = new course_publish_manager(); $publications = $publicationmanager->get_publications($registeredhub->huburl, $course->id, $advertise); if (!empty($publications)) { //get the last publication of this course $publication = array_pop($publications); $function = 'hub_get_courses'; $options = new stdClass(); $options->ids = array($publication->hubcourseid); $options->allsitecourses = 1; $params = array('search' => '', 'downloadable' => $share, 'enrollable' => !$share, 'options' => $options); $serverurl = $huburl . "/local/hub/webservice/webservices.php"; require_once $CFG->dirroot . "/webservice/xmlrpc/lib.php"; $xmlrpcclient = new webservice_xmlrpc_client($serverurl, $registeredhub->token); try { $result = $xmlrpcclient->call($function, $params); $publishedcourses = $result['courses']; } catch (Exception $e) { $error = $OUTPUT->notification(get_string('errorcourseinfo', 'hub', $e->getMessage())); $mform->addElement('static', 'errorhub', '', $error); } } if (!empty($publishedcourses)) { $publishedcourse = $publishedcourses[0]; $hubcourseid = $publishedcourse['id']; $defaultfullname = $publishedcourse['fullname']; $defaultshortname = $publishedcourse['shortname']; $defaultsummary = $publishedcourse['description']; $defaultlanguage = $publishedcourse['language']; $defaultpublishername = $publishedcourse['publishername']; $defaultpublisheremail = $publishedcourse['publisheremail']; $defaultcontributornames = $publishedcourse['contributornames']; $defaultcoverage = $publishedcourse['coverage']; $defaultcreatorname = $publishedcourse['creatorname']; $defaultlicenceshortname = $publishedcourse['licenceshortname']; $defaultsubject = $publishedcourse['subject']; $defaultaudience = $publishedcourse['audience']; $defaulteducationallevel = $publishedcourse['educationallevel']; $defaultcreatornotes = $publishedcourse['creatornotes']; $defaultcreatornotesformat = $publishedcourse['creatornotesformat']; $screenshotsnumber = $publishedcourse['screenshots']; $privacy = $publishedcourse['privacy']; if ($screenshotsnumber > 0 and !empty($privacy)) { $page->requires->yui_module('moodle-block_community-imagegallery', 'M.blocks_community.init_imagegallery', array(array('imageids' => array($hubcourseid), 'imagenumbers' => array($screenshotsnumber), 'huburl' => $huburl))); } } else { $defaultfullname = $course->fullname; $defaultshortname = $course->shortname; $defaultsummary = clean_param($course->summary, PARAM_TEXT); if (empty($course->lang)) { $language = get_site()->lang; if (empty($language)) { $defaultlanguage = current_language(); } else { $defaultlanguage = $language; } } else { $defaultlanguage = $course->lang; } $defaultpublishername = $USER->firstname . ' ' . $USER->lastname; $defaultpublisheremail = $USER->email; $defaultcontributornames = ''; $defaultcoverage = ''; $defaultcreatorname = $USER->firstname . ' ' . $USER->lastname; $defaultlicenceshortname = 'cc'; $defaultsubject = 'none'; $defaultaudience = HUB_AUDIENCE_STUDENTS; $defaulteducationallevel = HUB_EDULEVEL_TERTIARY; $defaultcreatornotes = ''; $defaultcreatornotesformat = FORMAT_HTML; $screenshotsnumber = 0; } //the input parameters $mform->addElement('header', 'moodle', get_string('publicationinfo', 'hub')); $mform->addElement('text', 'name', get_string('coursename', 'hub'), array('class' => 'metadatatext')); $mform->addRule('name', $strrequired, 'required', null, 'client'); $mform->setType('name', PARAM_TEXT); $mform->setDefault('name', $defaultfullname); $mform->addHelpButton('name', 'name', 'hub'); $mform->addElement('hidden', 'id', $this->_customdata['id']); if ($share) { $buttonlabel = get_string('shareon', 'hub', !empty($hubname) ? $hubname : $huburl); $mform->addElement('hidden', 'share', $share); $mform->addElement('text', 'demourl', get_string('demourl', 'hub'), array('class' => 'metadatatext')); $mform->setType('demourl', PARAM_URL); $mform->setDefault('demourl', new moodle_url("/course/view.php?id=" . $course->id)); $mform->addHelpButton('demourl', 'demourl', 'hub'); } if ($advertise) { if (empty($publishedcourses)) { $buttonlabel = get_string('advertiseon', 'hub', !empty($hubname) ? $hubname : $huburl); } else { $buttonlabel = get_string('readvertiseon', 'hub', !empty($hubname) ? $hubname : $huburl); } $mform->addElement('hidden', 'advertise', $advertise); $mform->addElement('hidden', 'courseurl', $CFG->wwwroot . "/course/view.php?id=" . $course->id); $mform->addElement('static', 'courseurlstring', get_string('courseurl', 'hub')); $mform->setDefault('courseurlstring', new moodle_url("/course/view.php?id=" . $course->id)); $mform->addHelpButton('courseurlstring', 'courseurl', 'hub'); } $mform->addElement('text', 'courseshortname', get_string('courseshortname', 'hub'), array('class' => 'metadatatext')); $mform->setDefault('courseshortname', $defaultshortname); $mform->addHelpButton('courseshortname', 'courseshortname', 'hub'); $mform->addElement('textarea', 'description', get_string('description'), array('rows' => 10, 'cols' => 57)); $mform->addRule('description', $strrequired, 'required', null, 'client'); $mform->setDefault('description', $defaultsummary); $mform->setType('description', PARAM_TEXT); $mform->addHelpButton('description', 'description', 'hub'); $languages = get_string_manager()->get_list_of_languages(); textlib_get_instance()->asort($languages); $mform->addElement('select', 'language', get_string('language'), $languages); $mform->setDefault('language', $defaultlanguage); $mform->addHelpButton('language', 'language', 'hub'); $mform->addElement('text', 'publishername', get_string('publishername', 'hub'), array('class' => 'metadatatext')); $mform->setDefault('publishername', $defaultpublishername); $mform->addRule('publishername', $strrequired, 'required', null, 'client'); $mform->addHelpButton('publishername', 'publishername', 'hub'); $mform->addElement('text', 'publisheremail', get_string('publisheremail', 'hub'), array('class' => 'metadatatext')); $mform->setDefault('publisheremail', $defaultpublisheremail); $mform->addRule('publisheremail', $strrequired, 'required', null, 'client'); $mform->addHelpButton('publisheremail', 'publisheremail', 'hub'); $mform->addElement('text', 'creatorname', get_string('creatorname', 'hub'), array('class' => 'metadatatext')); $mform->addRule('creatorname', $strrequired, 'required', null, 'client'); $mform->setType('creatorname', PARAM_TEXT); $mform->setDefault('creatorname', $defaultcreatorname); $mform->addHelpButton('creatorname', 'creatorname', 'hub'); $mform->addElement('text', 'contributornames', get_string('contributornames', 'hub'), array('class' => 'metadatatext')); $mform->setDefault('contributornames', $defaultcontributornames); $mform->addHelpButton('contributornames', 'contributornames', 'hub'); $mform->addElement('text', 'coverage', get_string('tags', 'hub'), array('class' => 'metadatatext')); $mform->setType('coverage', PARAM_TEXT); $mform->setDefault('coverage', $defaultcoverage); $mform->addHelpButton('coverage', 'tags', 'hub'); require_once $CFG->libdir . "/licenselib.php"; $licensemanager = new license_manager(); $licences = $licensemanager->get_licenses(); $options = array(); foreach ($licences as $license) { $options[$license->shortname] = get_string($license->shortname, 'license'); } $mform->addElement('select', 'licence', get_string('license'), $options); $mform->setDefault('licence', $defaultlicenceshortname); unset($options); $mform->addHelpButton('licence', 'licence', 'hub'); $options = $publicationmanager->get_sorted_subjects(); //prepare data for the smartselect foreach ($options as $key => &$option) { $keylength = strlen($key); if ($keylength == 10) { $option = " " . $option; } else { if ($keylength == 12) { $option = " " . $option; } } } $options = array('none' => get_string('none', 'hub')) + $options; $mform->addElement('select', 'subject', get_string('subject', 'hub'), $options); unset($options); $mform->addHelpButton('subject', 'subject', 'hub'); $mform->setDefault('subject', $defaultsubject); $mform->addRule('subject', $strrequired, 'required', null, 'client'); $this->init_javascript_enhancement('subject', 'smartselect', array('selectablecategories' => false, 'mode' => 'compact')); $options = array(); $options[HUB_AUDIENCE_EDUCATORS] = get_string('audienceeducators', 'hub'); $options[HUB_AUDIENCE_STUDENTS] = get_string('audiencestudents', 'hub'); $options[HUB_AUDIENCE_ADMINS] = get_string('audienceadmins', 'hub'); $mform->addElement('select', 'audience', get_string('audience', 'hub'), $options); $mform->setDefault('audience', $defaultaudience); unset($options); $mform->addHelpButton('audience', 'audience', 'hub'); $options = array(); $options[HUB_EDULEVEL_PRIMARY] = get_string('edulevelprimary', 'hub'); $options[HUB_EDULEVEL_SECONDARY] = get_string('edulevelsecondary', 'hub'); $options[HUB_EDULEVEL_TERTIARY] = get_string('eduleveltertiary', 'hub'); $options[HUB_EDULEVEL_GOVERNMENT] = get_string('edulevelgovernment', 'hub'); $options[HUB_EDULEVEL_ASSOCIATION] = get_string('edulevelassociation', 'hub'); $options[HUB_EDULEVEL_CORPORATE] = get_string('edulevelcorporate', 'hub'); $options[HUB_EDULEVEL_OTHER] = get_string('edulevelother', 'hub'); $mform->addElement('select', 'educationallevel', get_string('educationallevel', 'hub'), $options); $mform->setDefault('educationallevel', $defaulteducationallevel); unset($options); $mform->addHelpButton('educationallevel', 'educationallevel', 'hub'); $editoroptions = array('maxfiles' => 0, 'maxbytes' => 0, 'trusttext' => false, 'forcehttps' => false); $mform->addElement('editor', 'creatornotes', get_string('creatornotes', 'hub'), '', $editoroptions); $mform->addRule('creatornotes', $strrequired, 'required', null, 'client'); $mform->setType('creatornotes', PARAM_CLEANHTML); $mform->addHelpButton('creatornotes', 'creatornotes', 'hub'); if ($advertise) { if (!empty($screenshotsnumber)) { if (!empty($privacy)) { $baseurl = new moodle_url($huburl . '/local/hub/webservice/download.php', array('courseid' => $hubcourseid, 'filetype' => HUB_SCREENSHOT_FILE_TYPE)); $screenshothtml = html_writer::empty_tag('img', array('src' => $baseurl, 'alt' => $defaultfullname)); $screenshothtml = html_writer::tag('div', $screenshothtml, array('class' => 'coursescreenshot', 'id' => 'image-' . $hubcourseid)); } else { $screenshothtml = get_string('existingscreenshotnumber', 'hub', $screenshotsnumber); } $mform->addElement('static', 'existingscreenshots', get_string('existingscreenshots', 'hub'), $screenshothtml); $mform->addHelpButton('existingscreenshots', 'deletescreenshots', 'hub'); $mform->addElement('checkbox', 'deletescreenshots', '', ' ' . get_string('deletescreenshots', 'hub')); } $mform->addElement('hidden', 'existingscreenshotnumber', $screenshotsnumber); } $mform->addElement('filemanager', 'screenshots', get_string('addscreenshots', 'hub'), null, array('subdirs' => 0, 'maxbytes' => 1000000, 'maxfiles' => 3)); $mform->addHelpButton('screenshots', 'screenshots', 'hub'); $this->add_action_buttons(false, $buttonlabel); //set default value for creatornotes editor $data = new stdClass(); $data->creatornotes = array(); $data->creatornotes['text'] = $defaultcreatornotes; $data->creatornotes['format'] = $defaultcreatornotesformat; $this->set_data($data); }
public function definition() { global $CFG; $strrequired = get_string('required'); $mform =& $this->_form; //set default value $search = $this->_customdata['search']; if (isset($this->_customdata['coverage'])) { $coverage = $this->_customdata['coverage']; } else { $coverage = 'all'; } if (isset($this->_customdata['licence'])) { $licence = $this->_customdata['licence']; } else { $licence = 'all'; } if (isset($this->_customdata['subject'])) { $subject = $this->_customdata['subject']; } else { $subject = 'all'; } if (isset($this->_customdata['audience'])) { $audience = $this->_customdata['audience']; } else { $audience = 'all'; } if (isset($this->_customdata['language'])) { $language = $this->_customdata['language']; } else { $language = current_language(); } if (isset($this->_customdata['educationallevel'])) { $educationallevel = $this->_customdata['educationallevel']; } else { $educationallevel = 'all'; } if (isset($this->_customdata['visibility'])) { $visibility = $this->_customdata['visibility']; } else { $visibility = COURSEVISIBILITY_NOTVISIBLE; } if (isset($this->_customdata['downloadable'])) { $downloadable = $this->_customdata['downloadable']; } else { $downloadable = 1; } if (isset($this->_customdata['siteid'])) { $siteid = $this->_customdata['siteid']; } else { $siteid = 'all'; } if (isset($this->_customdata['lastmodified'])) { $lastmodified = $this->_customdata['lastmodified']; } else { $lastmodified = HUB_LASTMODIFIED_WEEK; } if (isset($this->_customdata['orderby'])) { $orderby = $this->_customdata['orderby']; } else { $orderby = 'newest'; } $mform->addElement('header', 'site', get_string('search', 'local_hub')); $options = array(0 => get_string('enrollable', 'local_hub'), 1 => get_string('downloadable', 'local_hub')); if (key_exists('adminform', $this->_customdata)) { $options = array('all' => get_string('any')) + $options; } $mform->addElement('select', 'downloadable', get_string('enroldownload', 'local_hub'), $options); $mform->addHelpButton('downloadable', 'enroldownload', 'local_hub'); $mform->setDefault('downloadable', $downloadable); //visible field //Note: doesn't matter if form html is hacked, index script does not return any invisible courses if (key_exists('adminform', $this->_customdata)) { $options = array(); $options[COURSEVISIBILITY_ALL] = get_string('visibilityall', 'local_hub'); $options[COURSEVISIBILITY_VISIBLE] = get_string('visibilityyes', 'local_hub'); $options[COURSEVISIBILITY_NOTVISIBLE] = get_string('visibilityno', 'local_hub'); $mform->addElement('select', 'visibility', get_string('visibility', 'local_hub'), $options); $mform->setDefault('visibility', $visibility); unset($options); $mform->addHelpButton('visibility', 'visibility', 'local_hub'); } $options = array(); $options['all'] = get_string('any'); $options[HUB_AUDIENCE_EDUCATORS] = get_string('audienceeducators', 'hub'); $options[HUB_AUDIENCE_STUDENTS] = get_string('audiencestudents', 'hub'); $options[HUB_AUDIENCE_ADMINS] = get_string('audienceadmins', 'hub'); $mform->addElement('select', 'audience', get_string('audience', 'local_hub'), $options); $mform->setDefault('audience', $audience); unset($options); $mform->addHelpButton('audience', 'audience', 'local_hub'); if (key_exists('adminform', $this->_customdata)) { $options = array(); $options['all'] = '-'; $options[HUB_LASTMODIFIED_WEEK] = get_string('periodweek', 'local_hub'); $options[HUB_LASTMODIFIED_FORTEENNIGHT] = get_string('periodforteennight', 'local_hub'); $options[HUB_LASTMODIFIED_MONTH] = get_string('periodmonth', 'local_hub'); $mform->addElement('select', 'lastmodified', get_string('lastmodified', 'local_hub'), $options); $mform->setDefault('lastmodified', $lastmodified); unset($options); $mform->addHelpButton('lastmodified', 'lastmodified', 'local_hub'); } $options = array(); $options['all'] = get_string('any'); $options[HUB_EDULEVEL_PRIMARY] = get_string('edulevelprimary', 'hub'); $options[HUB_EDULEVEL_SECONDARY] = get_string('edulevelsecondary', 'hub'); $options[HUB_EDULEVEL_TERTIARY] = get_string('eduleveltertiary', 'hub'); $options[HUB_EDULEVEL_GOVERNMENT] = get_string('edulevelgovernment', 'hub'); $options[HUB_EDULEVEL_ASSOCIATION] = get_string('edulevelassociation', 'hub'); $options[HUB_EDULEVEL_CORPORATE] = get_string('edulevelcorporate', 'hub'); $options[HUB_EDULEVEL_OTHER] = get_string('edulevelother', 'hub'); $mform->addElement('select', 'educationallevel', get_string('educationallevel', 'local_hub'), $options); $mform->setDefault('educationallevel', $educationallevel); unset($options); $mform->addHelpButton('educationallevel', 'educationallevel', 'local_hub'); require_once $CFG->dirroot . "/course/publish/lib.php"; $publicationmanager = new course_publish_manager(); $options = $publicationmanager->get_sorted_subjects(); foreach ($options as $key => &$option) { $keylength = strlen($key); if ($keylength == 10) { $option = " " . $option; } else { if ($keylength == 12) { $option = " " . $option; } } } $options = array_merge(array('all' => get_string('any')), $options); $mform->addElement('select', 'subject', get_string('subject', 'hub'), $options); $mform->setDefault('subject', $subject); unset($options); $mform->addHelpButton('subject', 'subject', 'local_hub'); $this->init_javascript_enhancement('subject', 'smartselect', array('selectablecategories' => true, 'mode' => 'compact')); require_once $CFG->libdir . "/licenselib.php"; $licensemanager = new license_manager(); $licences = $licensemanager->get_licenses(); $options = array(); $options['all'] = get_string('any'); foreach ($licences as $license) { $options[$license->shortname] = get_string($license->shortname, 'license'); } $mform->addElement('select', 'licence', get_string('license'), $options); unset($options); $mform->addHelpButton('licence', 'licence', 'local_hub'); $mform->setDefault('licence', $licence); //search for only language that exist in the course DB require_once $CFG->dirroot . "/local/hub/lib.php"; $hub = new local_hub(); $courseslanguages = $hub->get_courses_languages(); $alllanguages = get_string_manager()->get_list_of_languages(); $languages = array(); foreach ($courseslanguages as $languagecode => $lang) { if (isset($alllanguages[$languagecode])) { $languages[$languagecode] = $alllanguages[$languagecode]; } } asort($languages, SORT_LOCALE_STRING); $languages = array_merge(array('all' => get_string('any')), $languages); $mform->addElement('select', 'language', get_string('language'), $languages); $mform->setDefault('language', $language); $mform->addHelpButton('language', 'language', 'local_hub'); $mform->addElement('select', 'orderby', get_string('orderby', 'local_hub'), array('newest' => get_string('orderbynewest', 'local_hub'), 'eldest' => get_string('orderbyeldest', 'local_hub'), 'fullname' => get_string('orderbyname', 'local_hub'), 'publisher' => get_string('orderbypublisher', 'local_hub'), 'ratingaverage' => get_string('orderbyratingaverage', 'local_hub'))); $mform->setDefault('orderby', $orderby); $mform->setType('orderby', PARAM_ALPHA); $mform->addHelpButton('orderby', 'orderby', 'local_hub'); $mform->setAdvanced('audience'); $mform->setAdvanced('educationallevel'); $mform->setAdvanced('subject'); $mform->setAdvanced('licence'); $mform->setAdvanced('language'); $mform->setAdvanced('orderby'); if (key_exists('adminform', $this->_customdata)) { if ($hub->get_sites(array(), 0, 0, true) < 100) { // field not humanly usable over 100 sites. $sites = $hub->get_sites(); $siteids = array(); foreach ($sites as $site) { $siteids[$site->id] = $site->name; } asort($siteids, SORT_LOCALE_STRING); $siteids = array('all' => get_string('any')) + $siteids; $mform->addElement('select', 'siteid', get_string('site', 'local_hub'), $siteids); $mform->setDefault('siteid', $siteid); $mform->addHelpButton('siteid', 'site', 'local_hub'); } } $mform->addElement('text', 'search', get_string('keywords', 'local_hub')); $mform->setType('search', PARAM_ALPHANUMEXT); $mform->addHelpButton('search', 'keywords', 'local_hub'); $mform->setDefault('search', $search); $mform->addElement('submit', 'submitbutton', get_string('search', 'local_hub')); }
public function definition() { global $CFG; $strrequired = get_string('required'); //retrieve the publication $hub = new local_hub(); $course = $hub->get_course($this->_customdata['id']); $mform =& $this->_form; $mform->addElement('header', 'moodle', get_string('coursesettingsform', 'local_hub', $course->fullname)); $mform->addElement('hidden', 'id', $course->id); $mform->setType('id', PARAM_INT); $mform->addElement('checkbox', 'visible', get_string('coursevisibility', 'local_hub')); $mform->addHelpButton('visible', 'coursevisibility', 'local_hub'); $mform->setDefault('visible', $course->privacy); $mform->addElement('text', 'fullname', get_string('coursename', 'local_hub'), array('class' => 'coursesettingstextfield')); $mform->setType('fullname', PARAM_TEXT); $mform->addHelpButton('fullname', 'coursename', 'local_hub'); $mform->setDefault('fullname', $course->fullname); $mform->addRule('fullname', $strrequired, 'required', null, 'client'); if (!empty($course->courseurl)) { $mform->addElement('text', 'courseurl', get_string('courseurl', 'local_hub'), array('class' => 'coursesettingstextfield')); $mform->setType('courseurl', PARAM_URL); $mform->addHelpButton('courseurl', 'courseurl', 'local_hub'); $mform->setDefault('courseurl', $course->courseurl); $mform->addRule('courseurl', $strrequired, 'required', null, 'client'); } else { $mform->addElement('text', 'demourl', get_string('demourl', 'local_hub'), array('class' => 'coursesettingstextfield')); $mform->setType('demourl', PARAM_URL); $mform->addHelpButton('demourl', 'demourl', 'local_hub'); $mform->setDefault('demourl', $course->demourl); } $mform->addElement('textarea', 'description', get_string('coursedesc', 'local_hub'), array('rows' => 10, 'cols' => 56, 'class' => 'coursesettingstextarea')); $mform->addHelpButton('description', 'coursedesc', 'local_hub'); $mform->addRule('description', $strrequired, 'required', null, 'client'); $mform->setDefault('description', $course->description); $languages = get_string_manager()->get_list_of_languages(); asort($languages, SORT_LOCALE_STRING); $mform->addElement('select', 'language', get_string('courselang', 'local_hub'), $languages); $mform->setDefault('language', $course->language); $mform->addHelpButton('language', 'courselang', 'local_hub'); $mform->addElement('text', 'publishername', get_string('publishername', 'local_hub'), array('class' => 'coursesettingstextfield')); $mform->setType('publishername', PARAM_TEXT); $mform->setDefault('publishername', $course->publishername); $mform->addRule('publishername', $strrequired, 'required', null, 'client'); $mform->addHelpButton('publishername', 'publishername', 'local_hub'); $mform->addElement('text', 'publisheremail', get_string('publisheremail', 'local_hub'), array('class' => 'coursesettingstextfield')); $mform->setType('publisheremail', PARAM_EMAIL); $mform->setDefault('publisheremail', $course->publisheremail); $mform->addRule('publisheremail', $strrequired, 'required', null, 'client'); $mform->addHelpButton('publisheremail', 'publisheremail', 'local_hub'); $mform->addElement('text', 'creatorname', get_string('creatorname', 'local_hub'), array('class' => 'coursesettingstextfield')); $mform->addRule('creatorname', $strrequired, 'required', null, 'client'); $mform->setType('creatorname', PARAM_TEXT); $mform->setDefault('creatorname', $course->creatorname); $mform->addHelpButton('creatorname', 'creatorname', 'local_hub'); $mform->addElement('text', 'contributornames', get_string('contributornames', 'local_hub'), array('class' => 'coursesettingstextfield')); $mform->setType('contributornames', PARAM_TEXT); $mform->setDefault('contributornames', $course->contributornames); $mform->addHelpButton('contributornames', 'contributornames', 'local_hub'); $mform->addElement('text', 'coverage', get_string('tags', 'local_hub'), array('class' => 'coursesettingstextfield')); $mform->setType('coverage', PARAM_TEXT); $mform->setDefault('coverage', $course->coverage); $mform->addHelpButton('coverage', 'tags', 'local_hub'); require_once $CFG->libdir . "/licenselib.php"; $licensemanager = new license_manager(); $licences = $licensemanager->get_licenses(); $options = array(); foreach ($licences as $license) { $options[$license->shortname] = get_string($license->shortname, 'license'); } $mform->addElement('select', 'licence', get_string('licence', 'local_hub'), $options); $mform->setDefault('licence', $course->licenceshortname); unset($options); $mform->addHelpButton('licence', 'licence', 'local_hub'); require_once $CFG->dirroot . "/course/publish/lib.php"; $publicationmanager = new course_publish_manager(); $options = $publicationmanager->get_sorted_subjects(); //prepare data for the smartselect foreach ($options as $key => &$option) { $keylength = strlen($key); if ($keylength == 10) { $option = " " . $option; } else { if ($keylength == 12) { $option = " " . $option; } } } $options = array('none' => get_string('none', 'local_hub')) + $options; $mform->addElement('select', 'subject', get_string('subject', 'local_hub'), $options); unset($options); $mform->addHelpButton('subject', 'subject', 'local_hub'); $mform->setDefault('subject', $course->subject); $mform->addRule('subject', $strrequired, 'required', null, 'client'); $this->init_javascript_enhancement('subject', 'smartselect', array('selectablecategories' => false, 'mode' => 'compact')); $options = array(); $options[HUB_AUDIENCE_EDUCATORS] = get_string('audienceeducators', 'local_hub'); $options[HUB_AUDIENCE_STUDENTS] = get_string('audiencestudents', 'local_hub'); $options[HUB_AUDIENCE_ADMINS] = get_string('audienceadmins', 'local_hub'); $mform->addElement('select', 'audience', get_string('audience', 'local_hub'), $options); $mform->setDefault('audience', $course->audience); unset($options); $mform->addHelpButton('audience', 'audience', 'local_hub'); $options = array(); $options[HUB_EDULEVEL_PRIMARY] = get_string('edulevelprimary', 'local_hub'); $options[HUB_EDULEVEL_SECONDARY] = get_string('edulevelsecondary', 'local_hub'); $options[HUB_EDULEVEL_TERTIARY] = get_string('eduleveltertiary', 'local_hub'); $options[HUB_EDULEVEL_GOVERNMENT] = get_string('edulevelgovernment', 'local_hub'); $options[HUB_EDULEVEL_ASSOCIATION] = get_string('edulevelassociation', 'local_hub'); $options[HUB_EDULEVEL_CORPORATE] = get_string('edulevelcorporate', 'local_hub'); $options[HUB_EDULEVEL_OTHER] = get_string('edulevelother', 'local_hub'); $mform->addElement('select', 'educationallevel', get_string('educationallevel', 'local_hub'), $options); $mform->setDefault('educationallevel', $course->educationallevel); unset($options); $mform->addHelpButton('educationallevel', 'educationallevel', 'local_hub'); //setdefault is currently not supported making this required field not usable MDL-20988 $editoroptions = array('maxfiles' => 0, 'maxbytes' => 0, 'trusttext' => false, 'forcehttps' => false); $mform->addElement('editor', 'creatornotes', get_string('creatornotes', 'hub'), '', $editoroptions); $mform->setType('creatornotes', PARAM_CLEANHTML); $mform->addHelpButton('creatornotes', 'creatornotes', 'hub'); //set default value for creatornotes editor $data = new stdClass(); $data->creatornotes = array(); $data->creatornotes['text'] = $course->creatornotes; $data->creatornotes['format'] = $course->creatornotesformat; $this->set_data($data); //select screenshots to keep for ($screenshotnumber = 1; $screenshotnumber <= $course->screenshots; $screenshotnumber++) { $baseurl = new moodle_url($CFG->wwwroot . '/local/hub/webservice/download.php', array('courseid' => $course->id, 'filetype' => HUB_SCREENSHOT_FILE_TYPE, 'screenshotnumber' => $screenshotnumber, 'alwaysreload' => time())); $screenshothtml = html_writer::empty_tag('img', array('src' => $baseurl, 'alt' => $course->fullname)); $coursescreenshot = html_writer::tag('div', $screenshothtml, array('class' => '')); $mform->addElement('checkbox', 'screenshot_' . $screenshotnumber, get_string('keepscreenshot', 'local_hub'), $coursescreenshot); $mform->addHelpButton('screenshot_' . $screenshotnumber, 'keepscreenshot', 'local_hub'); $mform->setDefault('screenshot_' . $screenshotnumber, 1); } $mform->addElement('filemanager', 'addscreenshots', get_string('addscreenshots', 'local_hub'), null, array('subdirs' => 0, 'maxbytes' => 1000000, 'maxfiles' => MAXSCREENSHOTSNUMBER)); $mform->addHelpButton('addscreenshots', 'addscreenshots', 'local_hub'); $this->add_action_buttons(false, get_string('update')); }
public function definition() { global $CFG, $USER, $OUTPUT; $strrequired = get_string('required'); $mform =& $this->_form; //set default value $search = $this->_customdata['search']; if (isset($this->_customdata['coverage'])) { $coverage = $this->_customdata['coverage']; } else { $coverage = 'all'; } if (isset($this->_customdata['licence'])) { $licence = $this->_customdata['licence']; } else { $licence = 'all'; } if (isset($this->_customdata['subject'])) { $subject = $this->_customdata['subject']; } else { $subject = 'all'; } if (isset($this->_customdata['audience'])) { $audience = $this->_customdata['audience']; } else { $audience = 'all'; } if (isset($this->_customdata['language'])) { $language = $this->_customdata['language']; } else { $language = current_language(); } if (isset($this->_customdata['educationallevel'])) { $educationallevel = $this->_customdata['educationallevel']; } else { $educationallevel = 'all'; } if (isset($this->_customdata['downloadable'])) { $downloadable = $this->_customdata['downloadable']; } else { $downloadable = 1; } if (isset($this->_customdata['orderby'])) { $orderby = $this->_customdata['orderby']; } else { $orderby = 'newest'; } if (isset($this->_customdata['huburl'])) { $huburl = $this->_customdata['huburl']; } else { $huburl = HUB_MOODLEORGHUBURL; } $mform->addElement('header', 'site', get_string('search', 'block_community')); //add the course id (of the context) $mform->addElement('hidden', 'courseid', $this->_customdata['courseid']); $mform->setType('courseid', PARAM_INT); $mform->addElement('hidden', 'executesearch', 1); $mform->setType('executesearch', PARAM_INT); //retrieve the hub list on the hub directory by web service $function = 'hubdirectory_get_hubs'; $params = array(); $serverurl = HUB_HUBDIRECTORYURL . "/local/hubdirectory/webservice/webservices.php"; require_once $CFG->dirroot . "/webservice/xmlrpc/lib.php"; $xmlrpcclient = new webservice_xmlrpc_client($serverurl, 'publichubdirectory'); try { $hubs = $xmlrpcclient->call($function, $params); } catch (Exception $e) { $hubs = array(); $error = $OUTPUT->notification(get_string('errorhublisting', 'block_community', $e->getMessage())); $mform->addElement('static', 'errorhub', '', $error); } //display list of registered on hub $registrationmanager = new registration_manager(); $registeredhubs = $registrationmanager->get_registered_on_hubs(); //retrieve some additional hubs that we will add to //the hub list got from the hub directory $additionalhubs = array(); foreach ($registeredhubs as $registeredhub) { $inthepubliclist = false; foreach ($hubs as $hub) { if ($hub['url'] == $registeredhub->huburl) { $inthepubliclist = true; $hub['registeredon'] = true; } } if (!$inthepubliclist) { $additionalhub = array(); $additionalhub['name'] = $registeredhub->hubname; $additionalhub['url'] = $registeredhub->huburl; $additionalhubs[] = $additionalhub; } } if (!empty($additionalhubs)) { $hubs = array_merge($hubs, $additionalhubs); } if (!empty($hubs)) { $htmlhubs = array(); foreach ($hubs as $hub) { // Name can come from hub directory - need some cleaning. $hubname = clean_text($hub['name'], PARAM_TEXT); $smalllogohtml = ''; if (array_key_exists('id', $hub)) { // Retrieve hub logo + generate small logo. $params = array('hubid' => $hub['id'], 'filetype' => HUB_HUBSCREENSHOT_FILE_TYPE); $imgurl = new moodle_url(HUB_HUBDIRECTORYURL . "/local/hubdirectory/webservice/download.php", $params); $imgsize = getimagesize($imgurl->out(false)); if ($imgsize[0] > 1) { $ascreenshothtml = html_writer::empty_tag('img', array('src' => $imgurl, 'alt' => $hubname)); $smalllogohtml = html_writer::empty_tag('img', array('src' => $imgurl, 'alt' => $hubname, 'height' => 30, 'width' => 40)); } else { $ascreenshothtml = ''; } $hubimage = html_writer::tag('div', $ascreenshothtml, array('class' => 'hubimage')); // Statistics + trusted info. $hubstats = ''; if (isset($hub['enrollablecourses'])) { //check needed to avoid warnings for Moodle version < 2011081700 $additionaldesc = get_string('enrollablecourses', 'block_community') . ': ' . $hub['enrollablecourses'] . ' - ' . get_string('downloadablecourses', 'block_community') . ': ' . $hub['downloadablecourses']; $hubstats .= html_writer::tag('div', $additionaldesc); } if ($hub['trusted']) { $hubtrusted = get_string('hubtrusted', 'block_community'); $hubstats .= $OUTPUT->doc_link('trusted_hubs') . html_writer::tag('div', $hubtrusted); } $hubstats = html_writer::tag('div', $hubstats, array('class' => 'hubstats')); // hub name link + hub description. $hubnamelink = html_writer::link($hub['url'], html_writer::tag('h2', $hubname), array('class' => 'hubtitlelink')); // The description can come from the hub directory - need to clean. $hubdescription = clean_param($hub['description'], PARAM_TEXT); $hubdescriptiontext = html_writer::tag('div', format_text($hubdescription, FORMAT_PLAIN), array('class' => 'hubdescription')); $hubtext = html_writer::tag('div', $hubdescriptiontext . $hubstats, array('class' => 'hubtext')); $hubimgandtext = html_writer::tag('div', $hubimage . $hubtext, array('class' => 'hubimgandtext')); $hubfulldesc = html_writer::tag('div', $hubnamelink . $hubimgandtext, array('class' => 'hubmainhmtl')); } else { $hubfulldesc = html_writer::link($hub['url'], $hubname); } // Add hub to the hub items. $hubinfo = new stdClass(); $hubinfo->mainhtml = $hubfulldesc; $hubinfo->rowhtml = html_writer::tag('div', $smalllogohtml, array('class' => 'hubsmalllogo')) . $hubname; $hubitems[$hub['url']] = $hubinfo; } // Hub listing form element. $mform->addElement('listing', 'huburl', '', '', array('items' => $hubitems, 'showall' => get_string('showall', 'block_community'), 'hideall' => get_string('hideall', 'block_community'))); $mform->setDefault('huburl', $huburl); //display enrol/download select box if the USER has the download capability on the course if (has_capability('moodle/community:download', context_course::instance($this->_customdata['courseid']))) { $options = array(0 => get_string('enrollable', 'block_community'), 1 => get_string('downloadable', 'block_community')); $mform->addElement('select', 'downloadable', get_string('enroldownload', 'block_community'), $options); $mform->addHelpButton('downloadable', 'enroldownload', 'block_community'); $mform->setDefault('downloadable', $downloadable); } else { $mform->addElement('hidden', 'downloadable', 0); } $mform->setType('downloadable', PARAM_INT); $options = array(); $options['all'] = get_string('any'); $options[HUB_AUDIENCE_EDUCATORS] = get_string('audienceeducators', 'hub'); $options[HUB_AUDIENCE_STUDENTS] = get_string('audiencestudents', 'hub'); $options[HUB_AUDIENCE_ADMINS] = get_string('audienceadmins', 'hub'); $mform->addElement('select', 'audience', get_string('audience', 'block_community'), $options); $mform->setDefault('audience', $audience); unset($options); $mform->addHelpButton('audience', 'audience', 'block_community'); $options = array(); $options['all'] = get_string('any'); $options[HUB_EDULEVEL_PRIMARY] = get_string('edulevelprimary', 'hub'); $options[HUB_EDULEVEL_SECONDARY] = get_string('edulevelsecondary', 'hub'); $options[HUB_EDULEVEL_TERTIARY] = get_string('eduleveltertiary', 'hub'); $options[HUB_EDULEVEL_GOVERNMENT] = get_string('edulevelgovernment', 'hub'); $options[HUB_EDULEVEL_ASSOCIATION] = get_string('edulevelassociation', 'hub'); $options[HUB_EDULEVEL_CORPORATE] = get_string('edulevelcorporate', 'hub'); $options[HUB_EDULEVEL_OTHER] = get_string('edulevelother', 'hub'); $mform->addElement('select', 'educationallevel', get_string('educationallevel', 'block_community'), $options); $mform->setDefault('educationallevel', $educationallevel); unset($options); $mform->addHelpButton('educationallevel', 'educationallevel', 'block_community'); $publicationmanager = new course_publish_manager(); $options = $publicationmanager->get_sorted_subjects(); $mform->addElement('searchableselector', 'subject', get_string('subject', 'block_community'), $options, array('id' => 'communitysubject')); $mform->setDefault('subject', $subject); unset($options); $mform->addHelpButton('subject', 'subject', 'block_community'); require_once $CFG->libdir . "/licenselib.php"; $licensemanager = new license_manager(); $licences = $licensemanager->get_licenses(); $options = array(); $options['all'] = get_string('any'); foreach ($licences as $license) { $options[$license->shortname] = get_string($license->shortname, 'license'); } $mform->addElement('select', 'licence', get_string('licence', 'block_community'), $options); unset($options); $mform->addHelpButton('licence', 'licence', 'block_community'); $mform->setDefault('licence', $licence); $languages = get_string_manager()->get_list_of_languages(); core_collator::asort($languages); $languages = array_merge(array('all' => get_string('any')), $languages); $mform->addElement('select', 'language', get_string('language'), $languages); $mform->setDefault('language', $language); $mform->addHelpButton('language', 'language', 'block_community'); $mform->addElement('select', 'orderby', get_string('orderby', 'block_community'), array('newest' => get_string('orderbynewest', 'block_community'), 'eldest' => get_string('orderbyeldest', 'block_community'), 'fullname' => get_string('orderbyname', 'block_community'), 'publisher' => get_string('orderbypublisher', 'block_community'), 'ratingaverage' => get_string('orderbyratingaverage', 'block_community'))); $mform->setDefault('orderby', $orderby); $mform->addHelpButton('orderby', 'orderby', 'block_community'); $mform->setType('orderby', PARAM_ALPHA); $mform->setAdvanced('audience'); $mform->setAdvanced('educationallevel'); $mform->setAdvanced('subject'); $mform->setAdvanced('licence'); $mform->setAdvanced('language'); $mform->setAdvanced('orderby'); $mform->addElement('text', 'search', get_string('keywords', 'block_community'), array('size' => 30)); $mform->addHelpButton('search', 'keywords', 'block_community'); $mform->setType('search', PARAM_NOTAGS); $mform->addElement('submit', 'submitbutton', get_string('search', 'block_community')); } }