Skip to content
Snippets Groups Projects
Select Git revision
  • 4b39424ef869c41da93d19b3b2937a662e87a4af
  • master default protected
  • hsh_3.10
3 results

renderer.php

Blame
  • renderer.php 8.06 KiB
    <?php
    
    // This file is part of Moodle - http://moodle.org/
    //
    // Moodle is free software: you can redistribute it and/or modify
    // it under the terms of the GNU General Public License as published by
    // the Free Software Foundation, either version 3 of the License, or
    // (at your option) any later version.
    //
    // Moodle is distributed in the hope that it will be useful,
    // but WITHOUT ANY WARRANTY; without even the implied warranty of
    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    // GNU General Public License for more details.
    //
    // You should have received a copy of the GNU General Public License
    // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
    
    /**
     * @package mod
     * @subpackage adobeconnect
     * @author Akinsaya Delamarre (adelamarre@remote-learner.net)
     * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
     */
    
    
    class mod_adobeconnect_renderer extends plugin_renderer_base {
    
        /**
         * Returns HTML to display the meeting details
         * @param object $meetingdetail
         * @param int  $cmid
         * @param int $groupid
         * @return string
         */
        public function display_meeting_detail ($meetingdetail, $cmid, $groupid = 0) {
            global $CFG;
    
            $target = new moodle_url('/mod/adobeconnect/view.php');
    
            $attributes = array('method'=>'POST', 'target'=>$target);
    
            $html = html_writer::start_tag('form', $attributes);
    
            // Display the main field set
            $param = array('class'=>'aconfldset');
            $html .= html_writer::start_tag('div', $param);
    
            $table = new html_table();
            $table->attributes['class'] = 'generaltable';
    
            // meeting details
            $meet_array = array(array('<b>' . get_string('meetingstart', 'adobeconnect') . ':</b>', $meetingdetail->starttime));
            array_push($meet_array, array('<b>' . get_string('meetingend', 'adobeconnect') . ':</b>', $meetingdetail->endtime));
            array_push($meet_array, array('<b>' . get_string('meeturl', 'adobeconnect') . ':</b>', $meetingdetail->url));
            // Join meeting button
            $param = array('id' => $cmid, 'sesskey' => sesskey(), 'groupid' => 0);
            $target = new moodle_url('/mod/adobeconnect/join.php', $param);
    
            $param = array('type'=>'button',
                           'value'=>get_string('joinmeeting','adobeconnect'),
                           'name'=>'btnname',
                           'onclick' => 'window.open(\''.$target->out(false).'\', \'btnname\', \'menubar=0,location=0,scrollbars=0,resizable=0,width=900,height=900\', 0);',
            );
            $meetingbutton = html_writer::empty_tag('input', $param);
            array_push($meet_array,array('',$meetingbutton));
            
            $table->data = $meet_array;
            $html .= '<center>' . html_writer::table($table) . '</center>';     
            $html .= html_writer::end_tag('div');
            $html .= html_writer::end_tag('form');
    
    	
            return $html;
        }
    
        function display_meeting_recording($recordings, $cmid, $groupid, $adobesession) {
            global $CFG, $USER,$COURSE;
    
            $html       = '';
            $protocol   = 'http://';
            $port       = ''; // Include the port number only if it is a port other than 80
    
            if (!empty($CFG->adobeconnect_port) and (80 != $CFG->adobeconnect_port)) {
                $port = ':' . $CFG->adobeconnect_port;
            }
    
            if (isset($CFG->adobeconnect_https) and (!empty($CFG->adobeconnect_https))) {
                $protocol = 'https://';
            }
    
            $context = context_module::instance($cmid);
            $user_is_host = has_capability('mod/adobeconnect:meetinghost', $context);
            // Display the meeting name field and value
            $param = array('id' => 'aconfldset2', 'class' => 'aconfldset');
            $html .= html_writer::start_tag('div', $param);
            $html .= html_writer::tag('h5', get_string('recordinghdr', 'adobeconnect'), $param);
            $param = array('class' => 'aconrecording');
            $html .= html_writer::start_tag('div', $param);
    
            $table = new html_table();
            $table->tablealign = 'center';
            $table->width = '60%';
            $table->head = array(get_string('name'), get_string('starttime','adobeconnect'), get_string('duration','adobeconnect'));
            if ($user_is_host) {
                array_push($table->head, get_string('action','adobeconnect'));
                array_push($table->head, '');
            }
            foreach ($recordings as $key => $recordinggrp) {
                if (!empty($recordinggrp)) {
                    foreach($recordinggrp as $recording_scoid => $recording) {
                        // recording url
                        $url = $CFG->wwwroot . '/mod/adobeconnect/joinrecording.php?id=' . $cmid . '&recording='. $recording_scoid . '&groupid='. $groupid . '&sesskey=' . $USER->sesskey;
                        // recording name
                        $name = '<img src="' . $CFG->wwwroot .'/pix/e/insert_edit_video.svg" height="24" width="24"/>&nbsp;&nbsp;';
                        $name .= html_writer::link($url, format_string($recording->name), array('target' => '_blank','title'=>get_string('record_play','adobeconnect')));
                        // start date
                        $startdate = format_string($recording->startdate);
                        $time = strtotime($startdate);
                        $startdate = date("d.m.Y H:i:s", $time);
                        // duration
                        $duration = format_string($recording->duration);
                        $duration = gmdate("H:i:s", $duration);
                        // create initial row
                        $row = array ($name,$startdate,$duration);
                        // Display convert button if user has role meeting host in course
                        // Moodle users with role meeting host can convert recordings on their local Windows PCs
                        $action = '';
                        if ($user_is_host) {
                            // Konvertieren
                            $converturl = $url . '&convert=true';
                            $param = array('target' => '_blank','title'=>get_string('record_convert','adobeconnect'));
                            $action = html_writer::link($converturl,get_string('record_convert','adobeconnect'),$param);
                            $editurl = $url . '&edit=true';
                            $editparam = array('target' => '_blank','title'=>get_string('record_edit','adobeconnect'));                        
                            $editaction = html_writer::link($editurl,get_string('record_edit','adobeconnect'),$editparam);                        
                            array_push($row, $action . '&nbsp;&nbsp;|&nbsp;&nbsp;' . $editaction);
                            // Löschen
                            $delurl = "/mod/adobeconnect/delrecording.php?id=$cmid&recording=$recording_scoid";
                            $a = $recording->name;
                            $confirmdel = get_string('confirm_record_delete','adobeconnect',$a);
                            $param = array('onclick' => "return confirm('$confirmdel')", 'title'=>get_string('record_delete','adobeconnect'));
                            $del = html_writer::link($CFG->wwwroot . $delurl, '<img alt="' . get_string('record_delete','adobeconnect') . '" src="' . $CFG->wwwroot  .'/pix/t/delete.svg" />', $param);
                            array_push($row, $del);
                            // Help
                            $param = array('target' => '_blank','title'=>get_string('record_convert_help','adobeconnect'));
                            $help = html_writer::link($CFG->wwwroot . "/help.php?component=adobeconnect&identifier=convert_recording&lang=$COURSE->lang", '<img alt="' . get_string('record_convert_help','adobeconnect') . '" src="' . $CFG->wwwroot  .'/pix/help.svg" />', $param);
                            array_push($row, $help);
                        }
                        $table->data[] = $row;
                    }
                }
            }
            $html .= html_writer::table($table);
            $html .= html_writer::end_tag('div');
    
            return $html;
            //$html .= html_writer::link($url, get_string('removemychoice','choice'));
        }
    }