Created
June 1, 2015 16:31
-
-
Save sajadtorkamani/4b629816a384a5a0fd3f to your computer and use it in GitHub Desktop.
Linking to videos example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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