コード例 #1
0
 /**
  * Renderers actions for individual course actions.
  *
  * @param coursecat $category The currently selected category.
  * @param course_in_list $course The course to renderer actions for.
  * @return string
  */
 public function course_listitem_actions(coursecat $category, course_in_list $course)
 {
     $actions = \core_course\management\helper::get_course_listitem_actions($category, $course);
     if (empty($actions)) {
         return '';
     }
     $actionshtml = array();
     foreach ($actions as $action) {
         $action['attributes']['role'] = 'button';
         $actionshtml[] = $this->output->action_icon($action['url'], $action['icon'], null, $action['attributes']);
     }
     return html_writer::span(join('', $actionshtml), 'course-item-actions item-actions');
 }
コード例 #2
0
        ));

        if ($course instanceof stdClass) {
            require_once($CFG->libdir. '/coursecatlib.php');
            $course = new course_in_list($course);
        }
        $content .= html_writer::start_tag('div', array('class' => 'info'));
            
        // course name
        $coursename = $chelper->get_course_formatted_name($course);
        $coursenamelink = html_writer::link(new moodle_url('/course/view.php', array('id' => $course->id)),
                                            $coursename, array('class' => $course->visible ? '' : 'dimmed'));
        $content .= html_writer::tag($nametag, $coursenamelink, array('class' => 'coursename'));        
        $category = coursecat::get($course->category);
         //echo  $renderer->course_listitem_actions($category,$course);
        $actions = \core_course\management\helper::get_course_listitem_actions($category, $course);
        if (empty($actions)) {
            return '';
        }
        $actionshtml = array();
        $actionshtml[] = html_writer::link(new moodle_url('/local/mass_enroll/mass_enroll.php',array('id'=>$course->id)),html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('t/groups'), 'title' => 'Bulk enroll', 'alt' => 'Bulk enroll', 'class' => 'iconsmall'))); 
        $actionshtml[] = html_writer::link(new moodle_url('/local/costcenter/course_enrol.php',array('id'=>$course->id,'enrolid'=>$DB->get_field('enrol','id',array('enrol'=>'manual','courseid'=>$course->id)))),html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('t/enrolusers'), 'title' => get_string('enrolusers','enrol'), 'alt' => get_string('enrolusers','enrol'), 'class' => 'iconsmall'))); 
        foreach ($actions as $action) {
            $action['attributes']['role'] = 'button';
            if($action['icon']->attributes['title']=== 'Edit' || $action['icon']->attributes['title']=== 'Delete')
            $actionshtml[] = $output->action_icon($action['url'], $action['icon'], null, $action['attributes']);
        }
         
         $content .= html_writer::span(join('', $actionshtml), 'course-item-actions item-actions');         
         $content .= "<ul id='courseview-info'>
         <li>".get_string('pluginname','local_costcenter').": ". $DB->get_field('local_costcenter','fullname',array('id'=>$course->costcenter))."</li>