示例#1
0
 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;
     }
     foreach ($files as $file) {
         if ($file->is_valid_image()) {
             $screenshotnumber = $screenshotnumber + 1;
             $params = array();
             $params['filetype'] = HUB_SCREENSHOT_FILE_TYPE;