示例#1
0
     $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);
             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();
示例#2
0
     }
 }
 // PUBLISH ACTION
 //publish the course information
 $function = 'hub_register_courses';
 $params = array('courses' => array($courseinfo));
 try {
     $courseids = $xmlrpcclient->call($function, $params);
 } catch (Exception $e) {
     throw new moodle_exception('errorcoursepublish', 'hub', new moodle_url('/course/view.php', array('id' => $id)), $e->getMessage());
 }
 if (count($courseids) != 1) {
     throw new moodle_exception('errorcoursewronglypublished', 'hub');
 }
 //save the record into the published course table
 $publication = $publicationmanager->get_publication($courseids[0], $huburl);
 if (empty($publication)) {
     //if never been published or if we share, we need to save this new publication record
     $publicationmanager->add_course_publication($registeredhub->huburl, $course->id, !$share, $courseids[0]);
 } else {
     //if we update the enrollable course publication we update the publication record
     $publicationmanager->update_enrollable_course_publication($publication->id);
 }
 // SEND FILES
 $curl = new curl();
 // send screenshots
 if (!empty($fromform->screenshots)) {
     if (!empty($fromform->deletescreenshots) or $share) {
         $screenshotnumber = 0;
     } else {
         $screenshotnumber = $fromform->existingscreenshotnumber;