$notificationerror = $OUTPUT->doc_link('admin/environment/php_extension/xmlrpc', ''); $notificationerror .= get_string('xmlrpcdisabledpublish', 'hub'); echo $OUTPUT->header(); echo $OUTPUT->heading(get_string('publishcourse', 'hub', $course->shortname), 3, 'main'); echo $OUTPUT->notification($notificationerror); echo $OUTPUT->footer(); die; } if (has_capability('moodle/course:publish', get_context_instance(CONTEXT_COURSE, $id))) { $publicationmanager = new course_publish_manager(); $confirmmessage = ''; //update the courses status $updatestatusid = optional_param('updatestatusid', false, PARAM_INT); if (!empty($updatestatusid) and confirm_sesskey()) { //get the communication token from the publication $hub = $publicationmanager->get_registeredhub_by_publication($updatestatusid); if (empty($hub)) { $confirmmessage = $OUTPUT->notification(get_string('nocheckstatusfromunreghub', 'hub')); } else { //get all site courses registered on this hub $function = 'hub_get_courses'; $params = array('search' => '', 'downloadable' => 1, 'enrollable' => 1, 'options' => array('allsitecourses' => 1)); $serverurl = $hub->huburl . "/local/hub/webservice/webservices.php"; require_once $CFG->dirroot . "/webservice/xmlrpc/lib.php"; $xmlrpcclient = new webservice_xmlrpc_client($serverurl, $hub->token); $result = $xmlrpcclient->call($function, $params); $sitecourses = $result['courses']; //update status for all these course foreach ($sitecourses as $sitecourse) { //get the publication from the hub course id $publication = $publicationmanager->get_publication($sitecourse['id'], $hub->huburl);