/** * Constructor * * @param mod_opencast_series $a_obj_scast SWITCHcast channel the clip belongs to * @param string $clip_identifier clip ID as SWITCHcast * @param bool $isempty * @param int $opencast_id */ public function __construct(mod_opencast_series $a_obj_scast, $clip_identifier, $isempty = false, $opencast_id = 0) { if (!$isempty) { $this->series = $a_obj_scast; $this->opencast_id = $opencast_id; // $this->obj_id = $a_obj_scast->obj_id; $this->channel_ext_id = $a_obj_scast->getExtId(); $this->sys_account = $a_obj_scast->getSysAccount(); $this->members = []; $this->setExtId($clip_identifier); $this->setChannelEditLink($a_obj_scast->getEditLink()); $this->fetch(); } }
/** * Given an object containing all the necessary data, * (defined by the form in mod_form.php) this function * will update an existing instance with new data. * * @param object $opencast Moodle {opencast} table DB record * * @return bool true if everything went well */ function opencast_update_instance($opencast) { global $DB; $opencast->id = $opencast->instance; $opencast->timemodified = time(); $scast = new mod_opencast_series(); $scast->fetch($opencast->id); //$scast->setCourseId(); // $scast->setLicense($opencast->license); // $scast->setDepartment($opencast->department); $scast->setAllowAnnotations($opencast->allow_annotations == OPENCAST_ANNOTATIONS); $scast->setIvt($opencast->is_ivt); if (!isset($opencast->inviting) || $opencast->is_ivt == false) { $opencast->inviting = false; } $scast->setInvitingPossible($opencast->inviting); // Existing channel $scast->setExtId($opencast->ext_id); $mod_opencast_update = $scast->update(); $opencast->ext_id = $scast->getExtId(); if (empty($opencast->timerestrict)) { $opencast->timeopen = 0; $opencast->timeclose = 0; } $moodle_update = $DB->update_record('opencast', $opencast); return $mod_opencast_update && $moodle_update; }