示例#1
0
 function set_icon_html($first, $last, &$lastitem)
 {
     global $CFG;
     $category = $this->item;
     $this->icons['edit'] = $this->image_icon(get_string('editthiscategory'), "{$CFG->wwwroot}/question/category.php?" . $this->parentlist->pageurl->get_query_string(array('edit' => $category->id)), 'edit');
     parent::set_icon_html($first, $last, $lastitem);
     $toplevel = $this->parentlist->parentitem === null;
     //this is a top level item
     if ($this->parentlist->nextlist !== null && $last && $toplevel && count($this->parentlist->items) > 1) {
         $this->icons['down'] = $this->image_icon(get_string('shareincontext', 'question', print_context_name($this->parentlist->nextlist->context)), $this->parentlist->pageurl->out_action(array('movedowncontext' => $this->id, 'tocontext' => $this->parentlist->nextlist->context->id)), 'down');
     }
     if ($this->parentlist->lastlist !== null && $first && $toplevel && count($this->parentlist->items) > 1) {
         $this->icons['up'] = $this->image_icon(get_string('shareincontext', 'question', print_context_name($this->parentlist->lastlist->context)), $this->parentlist->pageurl->out_action(array('moveupcontext' => $this->id, 'tocontext' => $this->parentlist->lastlist->context->id)), 'up');
     }
 }
示例#2
0
 public function set_icon_html($first, $last, $lastitem){
     global $CFG;
     $category = $this->item;
     $url = new moodle_url('/question/category.php', ($this->parentlist->pageurl->params() + array('edit'=>$category->id)));
     $this->icons['edit']= $this->image_icon(get_string('editthiscategory', 'question'), $url, 'edit');
     parent::set_icon_html($first, $last, $lastitem);
     $toplevel = ($this->parentlist->parentitem === null);//this is a top level item
     if (($this->parentlist->nextlist !== null) && $last && $toplevel && (count($this->parentlist->items)>1)){
         $url = new moodle_url($this->parentlist->pageurl, array('movedowncontext'=>$this->id, 'tocontext'=>$this->parentlist->nextlist->context->id, 'sesskey'=>sesskey()));
         $this->icons['down'] = $this->image_icon(
             get_string('shareincontext', 'question', print_context_name($this->parentlist->nextlist->context)), $url, 'down');
     }
     if (($this->parentlist->lastlist !== null) && $first && $toplevel && (count($this->parentlist->items)>1)){
         $url = new moodle_url($this->parentlist->pageurl, array('moveupcontext'=>$this->id, 'tocontext'=>$this->parentlist->lastlist->context->id, 'sesskey'=>sesskey()));
         $this->icons['up'] = $this->image_icon(
             get_string('shareincontext', 'question', print_context_name($this->parentlist->lastlist->context)), $url, 'up');
     }
 }