Added : Fully working videos manager in admin area

This commit is contained in:
Arslan Hassan 2012-07-18 22:07:06 +00:00
parent 13646433bd
commit 98b6e537fc
5 changed files with 151 additions and 90 deletions

View file

@ -70,6 +70,7 @@
<tr> <tr>
<td width="30" align="center" valign="middle"><img src="{$imageurl}/arrow_return.png" width="25" height="25"></td> <td width="30" align="center" valign="middle"><img src="{$imageurl}/arrow_return.png" width="25" height="25"></td>
<td height="50" style="padding-left:15px"> <td height="50" style="padding-left:15px">
<input type="submit" name="activate_selected" value="Activate" class="button"/> <input type="submit" name="activate_selected" value="Activate" class="button"/>
<input type="submit" name="deactivate_selected" value="Deactivate" class="button" /> <input type="submit" name="deactivate_selected" value="Deactivate" class="button" />
<input type="submit" name="make_featured_selected" value="Make Featured" class="button"/> <input type="submit" name="make_featured_selected" value="Make Featured" class="button"/>

View file

@ -10,8 +10,14 @@ Manage all your videos here, change categories , delete and edit. Read more
<label class="btn check-all"><input type="checkbox"></label> <label class="btn check-all"><input type="checkbox"></label>
</div> </div>
<div class="btn-group"> <div class="btn-group">
<a class="btn" onclick="return false;">First Button</a> <a class="btn" onclick="$('#action-mode').val('activate');$('#video-manager').submit();">Activate</a>
<a class="btn" onclick="return false;">Second Button</a> <a class="btn" onclick="$('#action-mode').val('deactivate');$('#video-manager').submit();">Deactivate</a>
<a class="btn" onclick="$('#action-mode').val('featured');$('#video-manager').submit();">Make Featured</a>
<a class="btn" onclick="$('#action-mode').val('unfeatured');$('#video-manager').submit();">Remove Featured</a>
<a class="btn btn-danger" onclick="cb_confirm('Confirm Remove?','Are you sure you want to remove selected videos?',function(){
$('#action-mode').val('delete');
$('#video-manager').submit();
})">Delete</a>
</div> </div>
</div> </div>
@ -22,30 +28,111 @@ Manage all your videos here, change categories , delete and edit. Read more
<i class="icon-search icon-white"></i> <i class="icon-search icon-white"></i>
Search Search
</button> </button>
<a class="btn" data-toggle="modal" data-target="#advance-search">Advance Search</a> <a class="btn" data-toggle="modal" data-target="#advance-search-modal">Advance Search</a>
</form> </form>
</div> </div>
</div> </div>
</div> </div>
<div class="modal hide fade" id="advance-search-modal">
<div class="modal hide" id="myModal">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button> <button type="button" class="close" data-dismiss="modal">×</button>
<h3>{lang code='Advance Search'}</h3> <h3>{lang code='Advance Search'}</h3>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<p>One fine body…</p> <form class="form form-horizontal" id="advance_search">
<div class="control-group">
<label class="control-label" for="search-title">Title</label>
<div class="controls">
<input type="text" name="title" class="input-xlarge" id="search-title" value="{'title'|get_form_val:true}">
</div>
</div>
<div class="control-group">
<label class="control-label" for="videokey">Video Key</label>
<div class="controls">
<input type="text" name="videokey" class="input-xlarge" id="videokey" value="{'videokey'|get_form_val:true}">
</div>
</div>
<div class="control-group">
<label class="control-label" for="videoid">Video Key</label>
<div class="controls">
<input type="text" name="videoid" class="input-xlarge" id="videoid" value="{'videoid'|get_form_val:true}">
</div>
</div>
<div class="control-group">
<label class="control-label" for="videoid">Filename</label>
<div class="controls">
<input type="text" name="filename" class="input-xlarge" id="filename" value="{'filename'|get_form_val:true}">
</div>
</div>
<div class="control-group">
<label class="control-label" for="tags">Tags</label>
<div class="controls">
<input type="text" name="tags" class="input-xlarge" id="tags" value="{'tags'|get_form_val:true}">
</div>
</div>
<div class="control-group">
<label class="control-label" for="active">Active</label>
<div class="controls">
<select name="active" class="input-xlarge">
<option value="">--</option>
<option value="yes" {if get('active')=='yes'}selected="selected" {/if}>Yes</option>
<option value="no" {if get('active')=='no'}selected="selected" {/if}>No</option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="featured">Featured</label>
<div class="controls">
<select name="featured" class="input-xlarge">
<option value="">--</option>
<option value="yes" {if get('featured')=='yes'}selected="selected" {/if}>Yes</option>
<option value="no" {if get('featured')=='no'}selected="selected" {/if}>No</option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="status">Status</label>
<div class="controls">
<select name="status" class="input-xlarge">
<option value="">--</option>
<option value="Successful" {if get('status')=='Successful'}selected="selected" {/if}>Successful</option>
<option value="Failed" {if get('status')=='Failed'}selected="selected" {/if}>Failed</option>
<option value="Processing" {if get('status')=='Processing'}selected="selected" {/if}>Processing</option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="category">Category</label>
<div class="controls category-list">
{$formObj->createField($cat_array)}
</div>
</div>
<input type="hidden" name="search" value="do" />
</form>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<a href="#" class="btn" data-dismiss="modal">{lang code='Cancel'}</a> <a href="#" class="btn" data-dismiss="modal">{lang code='Cancel'}</a>
<a href="#" class="btn btn-primary">{lang code='Seach'}</a> <a href="javascript:void(0);" class="btn btn-primary" onclick="$('#advance_search').submit();">{lang code='Search'}</a>
</div> </div>
</div> </div>
<form name="my-form-name" method="post" id="my-form-id">
<form name="video-manager" method="post" id="video-manager">
<input type="hidden" value="" name="action_mode" id="action-mode" />
<table id="my-item-list-good-id" class="table table-striped list-block {if !$videos}display-none{/if}"> <table id="my-item-list-good-id" class="table table-striped list-block {if !$videos}display-none{/if}">
<thead> <thead>
<tr> <tr>
@ -79,7 +166,6 @@ Manage all your videos here, change categories , delete and edit. Read more
&nbsp;&nbsp;<a class="icon icon-user" rel="tooltip" title="This video is {$video.broadcast}"></a> &nbsp;&nbsp;<a class="icon icon-user" rel="tooltip" title="This video is {$video.broadcast}"></a>
{/if} {/if}
<div class="height5"></div> <div class="height5"></div>
{if $video.active=='yes'} {if $video.active=='yes'}
@ -135,67 +221,10 @@ Manage all your videos here, change categories , delete and edit. Read more
</table> </table>
</form> </form>
</div> {if !$profiles}
<div class="alert">{lang code='There are no videos....'}</div>
{/if}
<img src="{$imageurl}/dot.gif" class="sarch_button" onclick="toggle_search('searchdiv')" />
<div class="search_box" id="searchdiv" {if $smarty.cookies.show_searchdiv_search!='show'} style="display:none"{/if}> <form id="video_search" name="video_search" method="get" action="video_manager.php" class="video_search">
<table width="400" border="0" cellpadding="2" cellspacing="2">
<tr>
<td width="106" align="right"><label for="title">Video title</label></td>
<td width="280"><input name="title" type="text" class="input" id="title" value="{'title'|get_form_val:true}" //></td>
</tr>
<tr>
<td align="right"><label for="videokey">Video key</label></td>
<td><input name="videokey" type="text" class="input" id="videokey" value="{'videokey'|get_form_val:true}" //></td>
</tr>
<tr>
<td align="right"><label for="videoid">Video id</label></td>
<td><input name="videoid" type="text" class="input" id="videoid" value="{'videoid'|get_form_val:true}" //></td>
</tr>
<tr>
<td align="right"><label for="tags">Video tags</label></td>
<td><input name="tags" type="text" class="input" id="tags" value="{'tags'|get_form_val:true}" /></td>
</tr>
<tr>
<td align="right">Featured</td>
<td><label for="featured"></label>
<select name="featured" id="featured" class="input">
<option value="" ></option>
<option value="yes" {if $smarty.get.featured=='yes'} selected="selected"{/if}>Yes</option>
<option value="no" {if $smarty.get.featured=='no'} selected="selected"{/if}>No</option>
</select></td>
</tr>
<tr>
<td align="right">Active</td>
<td><select name="active" id="active" class="input">
<option value="" ></option>
<option value="yes" {if $smarty.get.active=='yes'} selected="selected"{/if}>Yes</option>
<option value="no" {if $smarty.get.active=='no'} selected="selected"{/if}>No</option>
</select></td>
</tr>
<tr>
<td align="right">Conversion Status</td>
<td><select name="status" id="status" class="input">
<option value="" ></option>
<option value="Successful" {if $smarty.get.status=='Successful'} selected="selected"{/if}>Successful</option>
<option value="Processing" {if $smarty.get.status=='Processing'} selected="selected"{/if}>Processing</option>
<option value="Failed" {if $smarty.get.status=='Failed'} selected="selected"{/if}>Failed</option>
</select></td>
</tr>
<tr>
<td align="right">Userid</td>
<td><input name="userid" type="text" class="input" id="userid" value="{'userid'|get_form_val:true}" /></td>
</tr>
<tr>
<td align="right" valign="top">Category</td>
<td>
{$formObj->createField($cat_array)}
</td>
</tr>
</table>
<br />
<input type="submit" name="search" id="search" value="Search Form" class="button"/>
</form>
</div> </div>
<!-- DIsplaying Videos Ends--> <!-- DIsplaying Videos Ends-->

View file

@ -215,3 +215,5 @@ border-width: 1px 0px; margin-bottom: 10px; }
.input-order{width: 30px} .input-order{width: 30px}
.list-block tbody input[type=checkbox]{margin: 0px 10px} .list-block tbody input[type=checkbox]{margin: 0px 10px}
.category-list label{display: inline-block}

View file

@ -23,14 +23,14 @@ if(isset($_GET['make_unfeature'])){
} }
//Using Multple Action //Using Multple Action
if(isset($_POST['make_featured_selected'])){ if($_POST['action_mode']=='featured'){
for($id=0;$id<=count($_POST['check_video']);$id++){ for($id=0;$id<=count($_POST['check_video']);$id++){
$cbvid->action('feature',$_POST['check_video'][$id]); $cbvid->action('feature',$_POST['check_video'][$id]);
} }
$eh->flush(); $eh->flush();
e("Selected videos have been set as featured","m"); e("Selected videos have been set as featured","m");
} }
if(isset($_POST['make_unfeatured_selected'])){ if($_POST['action_mode']=='unfeatured'){
for($id=0;$id<=count($_POST['check_video']);$id++){ for($id=0;$id<=count($_POST['check_video']);$id++){
$cbvid->action('unfeature',$_POST['check_video'][$id]); $cbvid->action('unfeature',$_POST['check_video'][$id]);
} }
@ -50,14 +50,14 @@ if(isset($_GET['deactivate'])){
} }
//Using Multple Action //Using Multple Action
if(isset($_POST['activate_selected'])){ if($_POST['action_mode']=='activate'){
for($id=0;$id<=count($_POST['check_video']);$id++){ for($id=0;$id<=count($_POST['check_video']);$id++){
$cbvid->action('activate',$_POST['check_video'][$id]); $cbvid->action('activate',$_POST['check_video'][$id]);
} }
$eh->flush(); $eh->flush();
e("Selected Videos Have Been Activated","m"); e("Selected Videos Have Been Activated","m");
} }
if(isset($_POST['deactivate_selected'])){ if($_POST['action_mode']=='deactivate'){
for($id=0;$id<=count($_POST['check_video']);$id++){ for($id=0;$id<=count($_POST['check_video']);$id++){
$cbvid->action('deactivate',$_POST['check_video'][$id]); $cbvid->action('deactivate',$_POST['check_video'][$id]);
} }
@ -73,7 +73,7 @@ if(isset($_GET['delete_video'])){
} }
//Deleting Multiple Videos //Deleting Multiple Videos
if(isset($_POST['delete_selected'])) if($_POST['action_mode']=='delete')
{ {
for($id=0;$id<=count($_POST['check_video']);$id++) for($id=0;$id<=count($_POST['check_video']);$id++)
{ {
@ -104,6 +104,7 @@ if(isset($_POST['delete_selected']))
'featured' => $_GET['featured'], 'featured' => $_GET['featured'],
'active' => $_GET['active'], 'active' => $_GET['active'],
'status' => $_GET['status'], 'status' => $_GET['status'],
'filename' => $_GET['filename']
); );
} }
@ -135,7 +136,10 @@ if(isset($_POST['delete_selected']))
$cat_array = array(lang('vdo_cat'), $cat_array = array(lang('vdo_cat'),
'type'=> 'checkbox', 'type'=> 'checkbox',
'name'=> 'category[]', 'name'=> 'category[]',
'sep' => '<div></div>',
'id'=> 'category', 'id'=> 'category',
'class' => 'checkbox',
'indent' => str_repeat('-',2).' ',
'value'=> array('category',$cats_array), 'value'=> array('category',$cats_array),
'hint_1'=> lang('vdo_cat_msg'), 'hint_1'=> lang('vdo_cat_msg'),
'display_function' => 'convert_to_categories'); 'display_function' => 'convert_to_categories');

View file

@ -260,7 +260,9 @@ class formObj
if($count>0) if($count>0)
echo $field['sep']; echo $field['sep'];
echo '<label><input name="'.$field_name.'" type="checkbox" value="'.$key.'" '.$field_id.' '.$checked.' '.$field['extra_tags'].'>'.$value.'</label>' ;
$class = $field['class'];
echo '<label class="'.$class.'"><input name="'.$field_name.'" type="checkbox" value="'.$key.'" '.$field_id.' '.$checked.' '.$field['extra_tags'].'>'.$value.'</label>' ;
} }
} }
@ -287,6 +289,8 @@ class formObj
foreach($values as $val) foreach($values as $val)
$Values[] = "|".$val."|"; $Values[] = "|".$val."|";
$class = $field['class'];
if($cats) if($cats)
{ {
$output = ""; $output = "";
@ -297,7 +301,10 @@ class formObj
$checked = 'checked'; $checked = 'checked';
echo "<div class='uploadCategoryCheckBlock' style='position:relative'>"; echo "<div class='uploadCategoryCheckBlock' style='position:relative'>";
echo $field['sep']; echo $field['sep'];
echo '<label><input name="'.$fieldName.'" type="checkbox" value="'.$cat['category_id'].'" '.$field_id.'
echo '<label class="'.$class.'"><input name="'.$fieldName.'" type="checkbox" value="'.$cat['category_id'].'" '.$field_id.'
'.$checked.' '.$field['extra_tags'].'>'.$cat['category_name'].'</label>'; '.$checked.' '.$field['extra_tags'].'>'.$cat['category_name'].'</label>';
if($cat['children']) if($cat['children'])
{ {
@ -336,9 +343,24 @@ class formObj
$values = $field['value'][1][0]; $values = $field['value'][1][0];
$newVals = array(); $newVals = array();
$class = $field['class'];
if(!empty($values)) if(!empty($values))
foreach($values as $val) foreach($values as $val)
$newVals[] = '|'.$val.'|'; $newVals[] = '|'.$val.'|';
$newcats = array();
foreach($cats as $c)
{
if(!$c['parent_id'] || $in['children_indent'])
{
$newcats[] = $c;
}
}
$cats = $newcats;
if($cats) if($cats)
{ {
foreach($cats as $cat) foreach($cats as $cat)
@ -347,13 +369,16 @@ class formObj
//checking value //checking value
if(in_array('|'.$cat['category_id'].'|',$newVals)) if(in_array('|'.$cat['category_id'].'|',$newVals))
$checked = 'checked'; $checked = 'checked';
echo $field['sep']; echo $field['sep'];
echo '<label><input name="'.$field_name.'" type="checkbox" value="'.$cat['category_id'].'" '.$field_id.' echo '<label class="'.$class.'"><input name="'.$field_name.'" type="checkbox" value="'.$cat['category_id'].'" '.$field_id.''
'.$checked.' '.$field['extra_tags'].'>'.$cat['category_name'].'</label>' ; .$checked.' '.$field['extra_tags'].'>'.$cat['category_name'].'</label>
' ;
if($cat['children']) if($cat['children'])
{ {
$childField = $field; $childField = $field;
$childField['sep'] = $field['sep'].str_repeat('&nbsp;',5); $childField['sep'] = $field['sep'].$field['indent'];
$this->listCategoryCheckBox(array('categories'=>$cat['children'],'field'=>$childField,'children_indent'=>true),$multi); $this->listCategoryCheckBox(array('categories'=>$cat['children'],'field'=>$childField,'children_indent'=>true),$multi);
} }
} }