Skip to content

Instantly share code, notes, and snippets.

@sajadtorkamani
Created June 1, 2015 16:31
Show Gist options
  • Save sajadtorkamani/4b629816a384a5a0fd3f to your computer and use it in GitHub Desktop.
Save sajadtorkamani/4b629816a384a5a0fd3f to your computer and use it in GitHub Desktop.
Linking to videos example
<?php
/**
* Module Title
*
* Module description
*
* @author Andrew Womersley
* @category Module
* @package STAN
* @link //stan:4000/stan/api/modules
*/
$heading = $this->view->text->resource_heading2;
$Items = $this->view->data('video_links',array(
'order'=>'sadord ASC',
'getGroups'=>false,
'getFile'=>false
));
if(count($Items) && is_array($Items)){
$this->flags['title'] = 'Downloads';
print("<ul class='icon col-sm-5'>");
print("<h4>".$heading."</h4>");
foreach($Items as $item){
$host = $item->host;
$video_id = $item->video_id;
$url = "https://";
$url .= $host;
$url .= ".com/";
if($host === "youtube")
{
$url .= "watch?v=";
$url .= $video_id;
}
if($host === "vimeo")
{
$url .= $video_id;
}
print("<li>
<i class='fa fa-video-camera'></i>
<a href='".$url."'>".$item->title."</a>
<span>".$item->duration." - ".ucfirst($item->host)."</span>
</li>");
}
print("</ul>");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment