示例#1
0
     $publication->timepublished = $timepublished;
     if (empty($publication->hubname)) {
         $publication->hubname = $huburl;
     }
     $publication->id = $publicationid;
     if ($confirm) {
         //unpublish the publication by web service
         $registeredhub = $registrationmanager->get_registeredhub($huburl);
         $function = 'hub_unregister_courses';
         $params = array('courseids' => array($publication->hubcourseid));
         $serverurl = $huburl . "/local/hub/webservice/webservices.php";
         require_once $CFG->dirroot . "/webservice/xmlrpc/lib.php";
         $xmlrpcclient = new webservice_xmlrpc_client($serverurl, $registeredhub->token);
         $result = $xmlrpcclient->call($function, $params);
         //delete the publication from the database
         $publicationmanager->delete_publication($publicationid);
         //display confirmation message
         $confirmmessage = $OUTPUT->notification(get_string('courseunpublished', 'hub', $publication), 'notifysuccess');
     } else {
         //display confirmation page for unpublishing
         echo $OUTPUT->header();
         echo $OUTPUT->heading(get_string('unpublishcourse', 'hub', $course->shortname), 3, 'main');
         echo $renderer->confirmunpublishing($publication);
         echo $OUTPUT->footer();
         die;
     }
 }
 //check if a course was published
 if (optional_param('published', 0, PARAM_TEXT)) {
     $confirmmessage = $OUTPUT->notification(get_string('coursepublished', 'hub', empty($hubname) ? $huburl : $hubname), 'notifysuccess');
 }