File: D:/HostingSpaces/SBogers18/decoockpit.nl/wwwroot/kms/lib/form/types/field_type_blog_video.class.php
<?php
/**
* form_type_blog_video.class.php
* Created by Komma Mediadesign.
* Author: mike
* Date: 5/6/13
*/
class Field_Type_Blog_Video extends Form_Field
{
public function construct(){}
/*
* Return Input value
*/
public function createInput()
{
$output = '';
$content = array('type'=>'submit', 'name'=>'create_video', 'label'=>$this->_info['lang']['add_video']);
$btnUpload = new Button($content);
$btnUpload->addClasses(array('blue','no-margin-top','no-margin-right','video'));
$output .= '<input name="' . $this->_info['name'] . '" type="' . $this->_info['type'] . '" value="' . $this->_info['label'] . '" data-label="' . $this->_info['label'] . '" class="video_field reset_value"/>';
$output .= $btnUpload->display(FALSE);
$output .= '<div class="clear"></div>';
// Image list
$output .= $this->getList();
return $output;
}
/*
* Get images currently in the session
*/
private function getList()
{
$output = '';
if($videos = Session::get($this->_info['form_name'] . '_videos'))
{
if(is_array($videos))
{
if( ! is_array($videos[key($videos)])) $videos = array($videos);
$output .= '<ul class="item_images">';
foreach($videos as $key => $video)
{
$output .= '<li';
if($key % 2 != 0) $output .= ' class="last"';
$output .= '>';
// Image
$output .= '<img src="http://img.youtube.com/vi/'. $video['youtube_id'] . '/0.jpg" alt="'. SITE_NAME . ' - '. $this->_info['name'] . '" />';
// Actions
$output .= '<span class="btn insert_video_link" data-sc="'. $video['short_code'] . '">insert</span>';
$output .= '<span class="btn delete_video" data-url="'. LANG_ROOT . URL_PAGE . '/removeVideo/'. $this->_info['form_name'] . '_videos/'. $key. '/">delete</span>';
$output .= '<div class="clear"></div>';
/*if(empty($image['caption'])) $video['caption'] = 'bijschrift';
// Caption
$output .= '<span class="caption">';
$output .= '<textarea name="caption[]" data-label="bijschrift" class="reset_value">' . $image['caption'] .'</textarea>';
$output .= '</span>';
*/
$output .= '</li>';
}
$output .= '</ul>';
}
}
return $output;
}
}