dirroot. '/theme/edumy/ccn/user_handler/ccn_user_handler.php');
require_once($CFG->dirroot. '/theme/edumy/ccn/course_handler/ccn_course_handler.php');
require_once($CFG->dirroot. '/theme/edumy/ccn/general_handler/ccn_video_handler.php');
require_once($CFG->dirroot. '/theme/edumy/ccn/block_handler/ccn_block_handler.php');
class block_cocoon_course_intro extends block_base {
public function init() { $this->title = get_string('cocoon_course_intro', 'block_cocoon_course_intro'); }
public function specialization() {
global $CFG;
include($CFG->dirroot . '/theme/edumy/ccn/block_handler/specialization.php');
}
public function get_content() {
global $CFG, $DB, $COURSE, $PAGE;
$courseid = $COURSE->id;
$context = context_course::instance($courseid);
require_once($CFG->libdir . '/behat/lib.php');
require_once($CFG->libdir . '/filelib.php');
// initialize fetch
if(!empty($this->config->user)){
$ccnUserHandler = new ccnUserHandler();
$ccnUser = $ccnUserHandler->ccnGetUserDetails($this->config->user);
}
if(!empty($this->config->video_url)) {
$ccnVideoHandler = new ccnVideoHandler();
$ccnVideo = $ccnVideoHandler->ccnVideoEmbedHandler($this->config->video_url);
}
$ccnCourseHandler = new ccnCourseHandler();
$ccnCourse = $ccnCourseHandler->ccnGetCourseDetails($COURSE->id);
if ($this->content !== null) {
return $this->content;
}
$this->content = new stdClass;
// initialize overrides
if(!empty($this->config->teacher)){$this->content->teacher = $this->config->teacher;}
if(!empty($this->config->accent)){$this->content->accent = $this->config->accent;}
if(!empty($this->config->video)){$this->content->video = $this->config->video;}
if(!empty($this->config->video_url)){$this->content->video_url = $this->config->video_url;} else {$this->content->video_url = '';}
if(!empty($this->config->style)){$this->content->style = $this->config->style;}
if(!empty($this->config->show_teacher)){$this->content->show_teacher = $this->config->show_teacher;}
$fs = get_file_storage();
$files = $fs->get_area_files($this->context->id, 'block_cocoon_course_intro', 'content');
foreach ($files as $file) {
$filename = $file->get_filename();
if ($filename <> '.') {
$url = moodle_url::make_pluginfile_url($file->get_contextid(), $file->get_component(), $file->get_filearea(), null, $file->get_filepath(), $filename);
$this->content->image = '';
}
}
// map data
if(!empty($this->config->teacher)){
$renderName = '