From 6adbcb80158728bab6c6d4ddc4a027dc5b625340 Mon Sep 17 00:00:00 2001 From: David Mudrak Date: Mon, 4 Jan 2010 18:26:56 +0000 Subject: [PATCH] workshop in reply to MDL-20204 - new output API --- mod/workshop/allocation.php | 2 +- mod/workshop/allocation/manual/lib.php | 4 +-- mod/workshop/allocation/manual/renderer.php | 20 +------------- mod/workshop/allocation/random/lib.php | 2 +- mod/workshop/assessment.php | 2 +- mod/workshop/pix/userplan/task-done.gif | Bin 0 -> 303 bytes mod/workshop/pix/userplan/task-fail.gif | Bin 0 -> 317 bytes mod/workshop/pix/userplan/task-info.gif | Bin 0 -> 79 bytes mod/workshop/pix/userplan/task-todo.gif | Bin 0 -> 58 bytes mod/workshop/renderer.php | 28 ++++---------------- mod/workshop/{styles.php => styles.css} | 11 ++++---- mod/workshop/submission.php | 2 +- mod/workshop/view.php | 2 +- 13 files changed, 19 insertions(+), 54 deletions(-) create mode 100644 mod/workshop/pix/userplan/task-done.gif create mode 100644 mod/workshop/pix/userplan/task-fail.gif create mode 100755 mod/workshop/pix/userplan/task-info.gif create mode 100644 mod/workshop/pix/userplan/task-todo.gif rename mod/workshop/{styles.php => styles.css} (96%) diff --git a/mod/workshop/allocation.php b/mod/workshop/allocation.php index 5ebf93870c..f746dde727 100644 --- a/mod/workshop/allocation.php +++ b/mod/workshop/allocation.php @@ -54,7 +54,7 @@ $initresult = $allocator->init(); // // Output starts here // -$wsoutput = $PAGE->theme->get_renderer('mod_workshop', $PAGE); +$wsoutput = $PAGE->get_renderer('mod_workshop'); echo $OUTPUT->header(); $allocators = workshop::installed_allocators(); diff --git a/mod/workshop/allocation/manual/lib.php b/mod/workshop/allocation/manual/lib.php index 9758b29e3b..70a73ad66c 100644 --- a/mod/workshop/allocation/manual/lib.php +++ b/mod/workshop/allocation/manual/lib.php @@ -322,8 +322,8 @@ class workshop_manual_allocator implements workshop_allocator { $pagingbarout = $OUTPUT->paging_bar($pagingbar); // we have all data, let us pass it to the renderers and return the output - $wsoutput = $PAGE->theme->get_renderer('mod_workshop', $PAGE); - $uioutput = $PAGE->theme->get_renderer('workshopallocation_manual', $PAGE); + $wsoutput = $PAGE->get_renderer('mod_workshop'); + $uioutput = $PAGE->get_renderer('workshopallocation_manual'); return $pagingbarout . $wsoutput->status_message($msg) . $uioutput->display_allocations($data) . $pagingbarout; } diff --git a/mod/workshop/allocation/manual/renderer.php b/mod/workshop/allocation/manual/renderer.php index 9714f9e629..711e6ef264 100644 --- a/mod/workshop/allocation/manual/renderer.php +++ b/mod/workshop/allocation/manual/renderer.php @@ -28,25 +28,7 @@ defined('MOODLE_INTERNAL') || die(); /** * Manual allocation renderer class */ -class moodle_workshopallocation_manual_renderer extends moodle_renderer_base { - - /** the underlying renderer to use */ - protected $output; - - /** the page we are doing output for */ - protected $page; - - /** - * Workshop renderer constructor - * - * @param mixed $page the page we are doing output for - * @param mixed $output lower-level renderer, typically moodle_core_renderer - * @return void - */ - public function __construct($page, $output) { - parent::__construct($page); - $this->output = $output; - } +class workshopallocation_manual_renderer extends plugin_renderer_base { /** * Display the table of all current allocations and widgets to modify them diff --git a/mod/workshop/allocation/random/lib.php b/mod/workshop/allocation/random/lib.php index efea09f4c8..be5d7da3ca 100644 --- a/mod/workshop/allocation/random/lib.php +++ b/mod/workshop/allocation/random/lib.php @@ -166,7 +166,7 @@ class workshop_random_allocator implements workshop_allocator { $out = ''; $out .= $OUTPUT->container_start('random-allocator'); - $wsoutput = $PAGE->theme->get_renderer('mod_workshop', $PAGE); + $wsoutput = $PAGE->get_renderer('mod_workshop'); $out .= $wsoutput->status_message($msg); // the nasty hack follows to bypass the sad fact that moodle quickforms do not allow to actually // return the HTML content, just to display it diff --git a/mod/workshop/assessment.php b/mod/workshop/assessment.php index 39c4e09abd..1e6fe9ddc5 100644 --- a/mod/workshop/assessment.php +++ b/mod/workshop/assessment.php @@ -113,7 +113,7 @@ if ($canoverridegrades) { echo $OUTPUT->header(); echo $OUTPUT->heading(get_string('assessedsubmission', 'workshop'), 2); -$wsoutput = $PAGE->theme->get_renderer('mod_workshop', $PAGE); // workshop renderer +$wsoutput = $PAGE->get_renderer('mod_workshop'); // workshop renderer $submission = $workshop->get_submission_by_id($submission->id); // reload so can be passed to the renderer echo $wsoutput->submission_full($submission, has_capability('mod/workshop:viewauthornames', $workshop->context)); diff --git a/mod/workshop/pix/userplan/task-done.gif b/mod/workshop/pix/userplan/task-done.gif new file mode 100644 index 0000000000000000000000000000000000000000..8f10daf91e4920f02c33111616426892a0d12671 GIT binary patch literal 303 zcmZ?wbhEHb6krfw_^QPK1dNP~OiWBHEG(?7tQ;I1JUl#tf`VdVV)F9xT3TA#+S+=0 zdiwhMCMG84=H@OgE?!<wjPH*em&ef##^yLTTvc<}7mvrnHsefjd`*RNmy|NjSBPZ?1B$->IT zpv9mAG6v))1~wmu&@2xfvDRZtie^UoOgqY>(A30d%Y5wQEF)DOrMy#27dq@2J1o8` rv`iCsQ9sIW)vDa$@S#Q?q7WShD2W zh7C8jZoRdA`<*>|9vnXW=){R<=g+^sdGo{L#~+_O`S|qd=NB)2e);m}_wT=d{`~*{ zpMe6P_>+Z|i$MnnfdJ$u2DT`NYgryTVy(xPOgiyGK)v_rsRD6_`e4w}hkgYbQf8}X5{#gwsT2f4V h4e~=;r!{BF-<&BB5$3sj-^-J2Lb^|P1u!sJ0{~=c7{UMm literal 0 HcmV?d00001 diff --git a/mod/workshop/pix/userplan/task-todo.gif b/mod/workshop/pix/userplan/task-todo.gif new file mode 100644 index 0000000000000000000000000000000000000000..f2b58c1ef8d0e025420c85207b63a11b1bd7c9ef GIT binary patch literal 58 zcmZ?wbhEHb6krfw_`t~U|Nnmm1_s5SEUa7%j0`$JHc(uEfq_Yor*G!6xBQFeY`N9F M`QD!mk|GS&0J4b@761SM literal 0 HcmV?d00001 diff --git a/mod/workshop/renderer.php b/mod/workshop/renderer.php index ffbfbb39f4..f80ea960fd 100644 --- a/mod/workshop/renderer.php +++ b/mod/workshop/renderer.php @@ -31,25 +31,7 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2009 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class moodle_mod_workshop_renderer extends moodle_renderer_base { - - /** the underlying renderer to use */ - protected $output; - - /** the page we are doing output for */ - protected $page; - - /** - * Workshop renderer constructor - * - * @param mixed $page the page we are doing output for - * @param mixed $output lower-level renderer, typically moodle_core_renderer - * @return void - */ - public function __construct($page, $output) { - parent::__construct($page); - $this->output = $output; - } +class mod_workshop_renderer extends plugin_renderer_base { /** * Returns html code for a status message @@ -269,7 +251,7 @@ class moodle_mod_workshop_renderer extends moodle_renderer_base { $type = $file->get_mimetype(); $type = mimeinfo_from_type("type", $type); $icon = new html_image(); - $icon->src = $this->output->old_icon_url(file_mimetype_icon($type)); + $icon->src = $this->output->pix_url(file_mimetype_icon($type)); $icon->set_classes('icon'); $icon->alt = $type; $image = $this->output->image($icon); @@ -331,7 +313,7 @@ class moodle_mod_workshop_renderer extends moodle_renderer_base { switch ($action->type) { case 'switchphase': $icon = new moodle_action_icon(); - $icon->image->src = $this->old_icon_url('i/marker'); + $icon->image->src = $this->pix_url('i/marker'); $icon->image->alt = get_string('switchphase', 'workshop'); $icon->link->url = $action->url; $actions .= $this->output->action_icon($icon); @@ -559,7 +541,7 @@ class moodle_mod_workshop_renderer extends moodle_renderer_base { if (!is_null($sortid)) { $iconasc = new moodle_action_icon(); - $iconasc->image->src = $this->old_icon_url('t/up'); + $iconasc->image->src = $this->pix_url('t/up'); $iconasc->image->alt = get_string('sortasc', 'workshop'); $iconasc->image->set_classes('sort asc'); $newurl = clone($PAGE->url); @@ -567,7 +549,7 @@ class moodle_mod_workshop_renderer extends moodle_renderer_base { $iconasc->link->url = new moodle_url($newurl); $icondesc = new moodle_action_icon(); - $icondesc->image->src = $this->old_icon_url('t/down'); + $icondesc->image->src = $this->pix_url('t/down'); $icondesc->image->alt = get_string('sortdesc', 'workshop'); $icondesc->image->set_classes('sort desc'); $newurl = clone($PAGE->url); diff --git a/mod/workshop/styles.php b/mod/workshop/styles.css similarity index 96% rename from mod/workshop/styles.php rename to mod/workshop/styles.css index 1a13b10d26..5a83715983 100644 --- a/mod/workshop/styles.php +++ b/mod/workshop/styles.css @@ -283,21 +283,21 @@ } .mod-workshop .userplan tr.phasetasks li { - background-image: url(../../pix/i/completion-auto-n.gif); + background-image: url([[pix:mod_workshop|userplan/task-todo]]); background-position: top left; background-repeat: no-repeat; } .mod-workshop .userplan tr.phasetasks li.completed { - background-image: url(../../pix/i/completion-auto-y.gif); + background-image: url([[pix:mod_workshop|userplan/task-done]]); } .mod-workshop .userplan tr.phasetasks li.fail { - background-image: url(../../pix/i/completion-auto-fail.gif); + background-image: url([[pix:mod_workshop|userplan/task-fail]]); } .mod-workshop .userplan tr.phasetasks li.info { - background-image: url(../../pix/i/info.gif); + background-image: url([[pix:mod_workshop|userplan/task-info]]); } .mod-workshop .userplan tr.phasetasks .tasks { @@ -422,12 +422,13 @@ .mod-workshop .grading-report del { color: red; font-size: 90% - text-decoration: + text-decoration: line-through; } .mod-workshop .grading-report ins { color: green; font-weight: bold; + text-decoration: underline; } .mod-workshop .grading-report th { diff --git a/mod/workshop/submission.php b/mod/workshop/submission.php index cadeeb4a09..621195df95 100644 --- a/mod/workshop/submission.php +++ b/mod/workshop/submission.php @@ -163,7 +163,7 @@ if ($edit and $ownsubmission) { // else display the submission if ($submission->id) { - $wsoutput = $PAGE->theme->get_renderer('mod_workshop', $PAGE); + $wsoutput = $PAGE->get_renderer('mod_workshop'); echo $wsoutput->submission_full($submission, true); } else { echo $OUTPUT->box(get_string('noyoursubmission', 'workshop')); diff --git a/mod/workshop/view.php b/mod/workshop/view.php index fbe071de8a..d0a787cc35 100644 --- a/mod/workshop/view.php +++ b/mod/workshop/view.php @@ -69,7 +69,7 @@ if ($PAGE->user_allowed_editing()) { $buttons[] = $OUTPUT->update_module_button($cm->id, 'workshop'); $PAGE->set_button(implode('', $buttons)); -$wsoutput = $PAGE->theme->get_renderer('mod_workshop', $PAGE); +$wsoutput = $PAGE->get_renderer('mod_workshop'); /// Output starts here -- 2.39.5