Skip to content

Commit

Permalink
moodle33 update
Browse files Browse the repository at this point in the history
  • Loading branch information
prowebat committed Jul 5, 2017
1 parent 5799345 commit 24642e8
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 9 deletions.
14 changes: 8 additions & 6 deletions block_exaport.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,24 @@ function get_content() {
$this->content->icons = array();
$this->content->footer = '';

$icon = '<img src="'.$OUTPUT->pix_url('resume', 'block_exaport').'" class="icon" alt="" />';
$output = block_exaport_get_renderer();

$icon = '<img src="'.$output->image_url('resume', 'block_exaport').'" class="icon" alt="" />';
$this->content->items[] = '<a title="'.block_exaport_get_string('resume_my').'" href="'.$CFG->wwwroot.'/blocks/exaport/resume.php?courseid='.$COURSE->id.'">'.$icon.block_exaport_get_string('resume_my').'</a>';

$icon = '<img src="'.$OUTPUT->pix_url('my_portfolio', 'block_exaport').'" class="icon" alt="" />';
$icon = '<img src="'.$output->image_url('my_portfolio', 'block_exaport').'" class="icon" alt="" />';
$this->content->items[] = '<a title="'.block_exaport_get_string('myportfoliotitle').'" href="'.$CFG->wwwroot.'/blocks/exaport/view_items.php?courseid='.$COURSE->id.'">'.$icon.block_exaport_get_string('myportfolio').'</a>';

$icon = '<img src="'.$OUTPUT->pix_url('myviews', 'block_exaport').'" class="icon" alt="" />';
$icon = '<img src="'.$output->image_url('myviews', 'block_exaport').'" class="icon" alt="" />';
$this->content->items[] = '<a title="'.block_exaport_get_string('views').'" href="'.$CFG->wwwroot.'/blocks/exaport/views_list.php?courseid='.$COURSE->id.'">'.$icon.block_exaport_get_string('views').'</a>';

$icon = '<img src="'.$OUTPUT->pix_url('shared_views', 'block_exaport').'" class="icon" alt="" />';
$icon = '<img src="'.$output->image_url('shared_views', 'block_exaport').'" class="icon" alt="" />';
$this->content->items[] = '<a title="'.block_exaport_get_string('shared_views').'" href="'.$CFG->wwwroot.'/blocks/exaport/shared_views.php?courseid='.$COURSE->id.'">'.$icon.block_exaport_get_string('shared_views').'</a>';

$icon = '<img src="'.$OUTPUT->pix_url('shared_categories', 'block_exaport').'" class="icon" alt="" />';
$icon = '<img src="'.$output->image_url('shared_categories', 'block_exaport').'" class="icon" alt="" />';
$this->content->items[] = '<a title="'.block_exaport_get_string('shared_categories').'" href="'.$CFG->wwwroot.'/blocks/exaport/shared_categories.php?courseid='.$COURSE->id.'">'.$icon.block_exaport_get_string('shared_categories').'</a>';

$icon = '<img src="'.$OUTPUT->pix_url('importexport', 'block_exaport').'" class="icon" alt="" />';
$icon = '<img src="'.$output->image_url('importexport', 'block_exaport').'" class="icon" alt="" />';
$this->content->items[] = '<a title="'.block_exaport_get_string('importexport').'" href="'.$CFG->wwwroot.'/blocks/exaport/importexport.php?courseid='.$COURSE->id.'">'.$icon.block_exaport_get_string('importexport').'</a>';

return $this->content;
Expand Down
5 changes: 3 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Version 4.6
v4.6.0
* bugfixes
* moodle3.3 update

Version 4.5.1
v4.5.1
* bugfixes

2016-09-21 Version 4.5.0:
Expand Down
4 changes: 3 additions & 1 deletion item_thumb.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
exit;
}

$output = block_exaport_get_renderer();

switch ($item->type) {
case "file":
// thumbnail of file
Expand All @@ -69,7 +71,7 @@

// needed for pix_url
$PAGE->set_context(context_system::instance());
$icon = $OUTPUT->pix_url(file_file_icon($file, 90));
$icon = $output->image_url(file_file_icon($file, 90));

header('Location: '.$icon);
break;
Expand Down
10 changes: 10 additions & 0 deletions lib/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ function block_exaport_get_item_comment_file($commentid) {
}
}

/**
* wrote own function, so eclipse knows which type the output renderer is
* @return block_exaport_renderer
*/
function block_exaport_get_renderer() {
global $PAGE;

return $PAGE->get_renderer('block_exaport');
}

function block_exaport_add_to_log($courseid, $module, $action, $url = '', $info = '', $cm = 0, $user = 0) {
if (!function_exists('get_log_manager')) {
// old style
Expand Down
36 changes: 36 additions & 0 deletions renderer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
// This file is part of Exabis Eportfolio
//
// (c) 2016 GTN - Global Training Network GmbH <office@gtn-solutions.com>
//
// Exabis Eportfolio 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.
//
// This script 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 can find the GNU General Public License at <http://www.gnu.org/licenses/>.
//
// This copyright notice MUST APPEAR in all copies of the script!

defined('MOODLE_INTERNAL') || die;
require_once __DIR__.'/inc.php';

use block_exaport\globals as g;

class block_exaport_renderer extends plugin_renderer_base {
/**
* in moodle33 pix_url was renamed to image_url
*/
public function image_url($imagename, $component = 'moodle') {
if (method_exists(get_parent_class($this), 'image_url')) {
return call_user_func_array(['parent', 'image_url'], func_get_args());
} else {
return call_user_func_array(['parent', 'pix_url'], func_get_args());
}
}
}

0 comments on commit 24642e8

Please sign in to comment.