//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); if (!empty($publication)) { $publication->status = $sitecourse['privacy']; $publication->timechecked = time(); $publicationmanager->update_publication($publication); } else { $msgparams = new stdClass(); $msgparams->id = $sitecourse['id']; $msgparams->hubname = html_writer::tag('a', $hub->hubname, array('href' => $hub->huburl)); $confirmmessage .= $OUTPUT->notification(get_string('detectednotexistingpublication', 'hub', $msgparams)); } } } } //if the site os registered on no hub display an error page $registrationmanager = new registration_manager(); $registeredhubs = $registrationmanager->get_registered_on_hubs(); if (empty($registeredhubs)) { echo $OUTPUT->header(); echo $OUTPUT->heading(get_string('publishon', 'hub'), 3, 'main');