From: David Mudrak Date: Mon, 4 Jan 2010 18:31:23 +0000 (+0000) Subject: MDL-21198 workshop: replacing old calls to action_icon() X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=0a5ddea5f928a217412a5184e059c49bc9170e8e;p=moodle.git MDL-21198 workshop: replacing old calls to action_icon() --- diff --git a/mod/workshop/allocation/manual/renderer.php b/mod/workshop/allocation/manual/renderer.php index 205be87737..10a9d8fd30 100644 --- a/mod/workshop/allocation/manual/renderer.php +++ b/mod/workshop/allocation/manual/renderer.php @@ -204,12 +204,6 @@ class workshopallocation_manual_renderer extends plugin_renderer_base { * @return html code to be displayed */ protected function remove_allocation_icon($link) { - $icon = new moodle_action_icon(); - $icon->image->src = $this->output->pix_url('i/cross_red_big'); - $icon->image->alt = 'X'; - $icon->link->url = $link; - - return $this->output->action_icon($icon); - + return $this->output->action_icon($link, 'X', 'i/cross_red_big'); } } diff --git a/mod/workshop/renderer.php b/mod/workshop/renderer.php index 872e11ef7d..dea7aaffa0 100644 --- a/mod/workshop/renderer.php +++ b/mod/workshop/renderer.php @@ -314,14 +314,11 @@ class mod_workshop_renderer extends plugin_renderer_base { $link->set_classes('title'); $o .= $this->output->link($link); + // dirty hack to guess if the current user is example manager or not if ($summary->example->weight == 1) { - // dirty hack to guess if the current user is example manager or not - $icon = new moodle_action_icon(); - $icon->image->src = $this->pix_url('i/edit'); - $icon->image->alt = get_string('edit'); - $icon->link->url = new moodle_url($CFG->wwwroot . '/mod/workshop/exsubmission.php', + $url = new moodle_url($CFG->wwwroot . '/mod/workshop/exsubmission.php', array('cmid' => $this->page->context->instanceid, 'id' => $summary->example->id, 'edit' => 'on')); - $o .= $this->output->action_icon($icon); + $o .= $this->output->action_icon($url, get_string('edit'), 'i/edit'); } $o .= $this->output->container_end(); @@ -399,11 +396,7 @@ class mod_workshop_renderer extends plugin_renderer_base { foreach ($phase->actions as $action) { switch ($action->type) { case 'switchphase': - $icon = new moodle_action_icon(); - $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); + $actions .= $this->output->action_icon($action->url, get_string('switchphase', 'workshop'), 'i/marker'); break; } } @@ -627,27 +620,15 @@ class mod_workshop_renderer extends plugin_renderer_base { $out = $this->output->output_tag('span', array('class'=>'text'), $text); if (!is_null($sortid)) { - $iconasc = new moodle_action_icon(); - $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); - $newurl->params(array('sortby' => $sortid, 'sorthow' => 'ASC')); - $iconasc->link->url = new moodle_url($newurl); - - $icondesc = new moodle_action_icon(); - $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); - $newurl->params(array('sortby' => $sortid, 'sorthow' => 'DESC')); - $icondesc->link->url = new moodle_url($newurl); - if ($sortby !== $sortid or $sorthow !== 'ASC') { - $out .= $this->output->action_icon($iconasc); + $url = new moodle_url($PAGE->url); + $url->params(array('sortby' => $sortid, 'sorthow' => 'ASC')); + $out .= $this->output->action_icon($url, get_string('sortasc', 'workshop'), 't/up', array('class' => 'sort asc')); } if ($sortby !== $sortid or $sorthow !== 'DESC') { - $out .= $this->output->action_icon($icondesc); + $url = new moodle_url($PAGE->url); + $url->params(array('sortby' => $sortid, 'sorthow' => 'DESC')); + $out .= $this->output->action_icon($url, get_string('sortdesc', 'workshop'), 't/down', array('class' => 'sort desc')); } } return $out;