Ejemplo n.º 1
0
 public function view_carousel(gallery $gallery, array $options = array())
 {
     $o = html_writer::start_tag('div', array('class' => 'jcarousel-wrapper'));
     $o .= html_writer::start_tag('div', array('class' => 'jcarousel type_' . $gallery->type(true), 'data-jcarousel' => 'true', 'data-wrap' => 'circular'));
     $o .= html_writer::start_tag('ul');
     foreach ($gallery->get_items_by_type() as $item) {
         if (!$item->display) {
             continue;
         }
         $itemhtml = html_writer::empty_tag('img', array('src' => $item->get_image_url_by_type('thumbnail')));
         $attribs = $this->linkattribs($gallery, $item);
         if (!empty($options['filter'])) {
             $attribs['href'] = new moodle_url('/mod/mediagallery/view.php', array('g' => $gallery->id));
         } else {
             $attribs['href'] = $item->get_image_url_by_type('lowres');
         }
         if ($gallery->get_display_settings()->galleryfocus == mcbase::TYPE_AUDIO) {
             $itemhtml .= $this->embed_html($item);
         }
         $o .= html_writer::tag('li', html_writer::tag('a', $itemhtml, $attribs));
     }
     $o .= html_writer::end_tag('ul');
     $o .= html_writer::end_tag('div');
     $o .= html_writer::tag('a', '‹', array('data-jcarousel-control' => 'true', 'data-target' => '-=1', 'href' => '#', 'class' => 'jcarousel-control-prev'));
     $o .= html_writer::tag('a', '›', array('data-jcarousel-control' => 'true', 'data-target' => '+=1', 'href' => '#', 'class' => 'jcarousel-control-next'));
     $o .= html_writer::tag('p', '', array('data-jcarouselpagination' => 'true', 'class' => 'jcarousel-pagination'));
     $o .= html_writer::end_tag('div');
     // For whatever reason, including the JS earlier doesn't work.
     $o .= html_writer::tag('script', '', array('type' => 'text/javascript', 'src' => new moodle_url('/theme/jquery.php/mod_mediagallery/jcarousel/jquery.jcarousel.v2.js')));
     return $o;
 }