示例#1
0
 /**
  * Displays a clip outline in a table row
  *
  * @param mod_opencast_event $sc_clip         a SWITCHcast clip object
  * @param bool                $with_actions    display action buttons
  * @param bool                $is_template     use row as template
  * @param string              $allowed_actions comma separated list of allowed actions, used if $with_actions is true
  * @param bool                $with_owner      display owner column
  * @param bool                $with_uploader   display uploader column
  * @param bool                $with_recordingstation
  * @param bool                $with_playbuttons
  */
 function display_clip_outline(mod_opencast_event $sc_clip, $with_actions = true, $is_template = false, $allowed_actions = 'all', $with_owner = false, $with_uploader = false, $with_recordingstation = true, $with_playbuttons = true)
 {
     global $CFG, $DB, $cm;
     $title = $sc_clip->getTitle();
     if ($title == '') {
         $title = get_string('untitled_clip', 'opencast');
     }
     $subtitle = $sc_clip->getSubtitle();
     $title = html_writer::tag('span', $title, ['class' => 'title']);
     $title .= html_writer::tag('div', $subtitle, ['class' => 'subtitle']);
     $owner = $sc_clip->getOwner();
     if ($owner == '') {
         $owner = get_string('no_owner', 'opencast');
     } else {
         $owner_moodle_id = mod_opencast_user::getMoodleUserIdFromExtId($owner);
         if ($owner_moodle_user = $DB->get_record('user', ['id' => $owner_moodle_id])) {
             $owner = $owner_moodle_user->lastname . ', ' . $owner_moodle_user->firstname;
         } else {
             $owner = get_string('owner_not_in_moodle', 'opencast');
         }
     }
     $uploader = '';
     if ($with_uploader) {
         $uploaded_clip = $DB->get_record('opencast_uploadedclip', ['ext_id' => $sc_clip->getExtId()]);
         if ($uploaded_clip) {
             if ($uploader_moodle_user = $DB->get_record('user', ['id' => $uploaded_clip->userid])) {
                 $uploader = $uploader_moodle_user->lastname . ', ' . $uploader_moodle_user->firstname;
             }
         }
     }
     if ($is_template) {
         $extraclass = $this->series->getIvt() ? 'with-owner' : 'without-owner';
         echo html_writer::start_tag('tr', ['class' => 'opencast-clip-template-row ' . $extraclass]);
     } else {
         echo html_writer::start_tag('tr');
     }
     echo html_writer::start_tag('td');
     echo html_writer::start_tag('div', ['class' => 'cliplabel', 'title' => $subtitle]);
     echo html_writer::empty_tag('img', ['src' => $sc_clip->getCover()]);
     echo html_writer::tag('h3', $title);
     if ($with_playbuttons) {
         echo html_writer::start_tag('div', ['class' => 'linkbar']);
         //            echo html_writer::tag('span', $sc_clip->getLinkBox());
         if ($is_template) {
             echo html_writer::tag('a', '', ['href' => '#opencast-inactive', 'title' => get_string('annotations', 'opencast'), 'class' => 'annotate', 'target' => '_blank']);
         } else {
             if ($this->series->getAllowAnnotations()) {
                 echo html_writer::tag('a', '', ['href' => $sc_clip->getAnnotationLink(), 'title' => get_string('annotations', 'opencast'), 'class' => 'annotate', 'target' => '_blank']);
             }
         }
         echo html_writer::tag('a', '', ['href' => $sc_clip->getLinkFlash(), 'title' => get_string('flash', 'opencast'), 'class' => 'flash', 'target' => '_blank']);
         //        echo html_writer::tag('span', $sc_clip->getLinkMp4());
         echo html_writer::tag('a', '', ['href' => $sc_clip->getLinkMov(), 'title' => get_string('mov', 'opencast'), 'class' => 'mov', 'target' => '_blank']);
         //            echo html_writer::tag('a', '', [
         //                            'href'  => $sc_clip->getLinkM4v(), 'title' => get_string('m4v', 'opencast'),
         //                            'class' => 'm4v', 'target' => '_blank'
         //                    ]);
         //        echo html_writer::tag('span', $sc_clip->getSubtitle());
         echo html_writer::end_tag('div');
     }
     echo html_writer::end_tag('div');
     echo html_writer::end_tag('td');
     echo html_writer::start_tag('td', ['class' => 'opencast-presenter']);
     echo html_writer::tag('span', $sc_clip->getPresenter());
     echo html_writer::end_tag('td');
     echo html_writer::start_tag('td', ['class' => 'opencast-location']);
     echo html_writer::tag('span', $sc_clip->getLocation());
     echo html_writer::end_tag('td');
     if ($with_recordingstation) {
         echo html_writer::start_tag('td', ['class' => 'opencast-recordingstation']);
         echo html_writer::tag('span', $sc_clip->getRecordingStation());
         echo html_writer::end_tag('td');
     }
     echo html_writer::start_tag('td', ['class' => 'opencast-recordingdate']);
     echo html_writer::tag('span', $sc_clip->getRecordingDate());
     echo html_writer::end_tag('td');
     if ($is_template || $with_owner) {
         echo html_writer::start_tag('td', ['class' => 'opencast-owner']);
         echo html_writer::tag('span', $owner);
         echo html_writer::end_tag('td');
     }
     if ($with_uploader) {
         echo html_writer::start_tag('td', ['class' => 'opencast-uploader']);
         echo html_writer::tag('span', $uploader);
         echo html_writer::end_tag('td');
     }
     $allowed_actions = explode(',', $allowed_actions);
     if ($with_actions && count($allowed_actions)) {
         echo html_writer::start_tag('td', ['class' => 'opencast-actions']);
         echo html_writer::start_tag('div', ['class' => 'opencast-hidden-actions']);
         if (in_array('editdetails', $allowed_actions) || in_array('all', $allowed_actions)) {
             echo html_writer::tag('a', get_string('editdetails', 'opencast'), ['href' => $CFG->wwwroot . '/mod/opencast/event_editdetails.php?id=' . $cm->id . '&clip_ext_id=' . $sc_clip->getExtId(), 'class' => 'button opencast-editdetails']);
         }
         if (in_array('invite', $allowed_actions) || in_array('all', $allowed_actions)) {
             echo html_writer::tag('a', get_string('editmembers', 'opencast'), ['href' => $CFG->wwwroot . '/mod/opencast/event_members.php?id=' . $cm->id . '&clip_identifier=' . $sc_clip->getExtId(), 'class' => 'button opencast-clipmembers']);
         }
         if (in_array('delete', $allowed_actions) || in_array('all', $allowed_actions)) {
             echo html_writer::tag('a', get_string('delete_clip', 'opencast'), ['href' => $CFG->wwwroot . '/mod/opencast/event_delete.php?id=' . $cm->id . '&clip_ext_id=' . $sc_clip->getExtId(), 'class' => 'button opencast-deleteclip']);
         }
         echo html_writer::end_tag('div');
         echo html_writer::end_tag('td');
     }
     echo html_writer::end_tag('tr');
 }