Updated : functions_templates.php
Updated : functions_collections.php
This commit is contained in:
parent
829f713142
commit
f93d14345a
2 changed files with 181 additions and 2 deletions
|
@ -78,6 +78,16 @@ function confirm_collection_type ( $type ) {
|
|||
return $cbcollection->types;
|
||||
}
|
||||
|
||||
/**
|
||||
* This will get only avatar collections
|
||||
*
|
||||
* @global OBJECT $db
|
||||
* @global OBJECT $cbcollection
|
||||
* @param STRING $cond
|
||||
* @param INT $limit
|
||||
* @param STRING $order
|
||||
* @return MIX
|
||||
*/
|
||||
function get_avatar_collections( $cond=null, $limit=null, $order=null ) {
|
||||
global $db, $cbcollection;
|
||||
|
||||
|
@ -93,6 +103,15 @@ function get_avatar_collections( $cond=null, $limit=null, $order=null ) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This will be select object from items table
|
||||
*
|
||||
* @global OBJECT $db
|
||||
* @global OBJECT $cbcollection
|
||||
* @param INT $cid
|
||||
* @param INT $oid
|
||||
* @return MIX
|
||||
*/
|
||||
function get_collection_item ( $cid, $oid ) {
|
||||
global $db, $cbcollection;
|
||||
$result = $db->select( tbl( $cbcollection->items ),'*', " collection_id = '".$cid."' AND object_id = '".$oid."' " );
|
||||
|
@ -102,4 +121,50 @@ function get_collection_item ( $cid, $oid ) {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets photo manager orders
|
||||
*
|
||||
* @return ARRAY
|
||||
*/
|
||||
function get_collection_manager_orders() {
|
||||
return object_manager_orders('collection');
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds photo manager order
|
||||
*
|
||||
* @param STRING $title Title of order
|
||||
* @param STRING $order mySQL order
|
||||
* @param STRING $id Optional
|
||||
* @return MIX
|
||||
*/
|
||||
function add_collection_manager_order( $title, $order, $id = false ) {
|
||||
return add_object_manager_order( $title, $order, 'collection', $id );
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays photo manager order
|
||||
*
|
||||
* @param STRING $display
|
||||
* @return MIX
|
||||
*/
|
||||
function display_collection_manger_orders( $display='unselected' ) {
|
||||
return display_manager_orders('collection',$display);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays current photo manager order
|
||||
*
|
||||
* @return STRING
|
||||
*/
|
||||
function current_collection_order () {
|
||||
return current_object_order('collection');
|
||||
}
|
||||
|
||||
function collection_links( $collection, $type = 'vc' ) {
|
||||
global $cbcollection;
|
||||
|
||||
return $cbcollection->collection_links( $collection, $type );
|
||||
}
|
||||
?>
|
|
@ -681,12 +681,13 @@ function cbMenu($params = NULL) {
|
|||
$menu = get_menu($name);
|
||||
$params['show_icons'] = $params['show_icons'] ? $params['show_icons'] : 'yes';
|
||||
if ($menu) {
|
||||
|
||||
foreach ($menu as $item) {
|
||||
$continue = true;
|
||||
if ($item['section'] && !isSectionEnabled($item['section'])) {
|
||||
$continue = false;
|
||||
}
|
||||
|
||||
|
||||
if ($continue == true) {
|
||||
$selected = current_page(array('page' => $item['section']));
|
||||
$icon = '';
|
||||
|
@ -706,7 +707,7 @@ function cbMenu($params = NULL) {
|
|||
$output .= "</li>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($params['assign']) {
|
||||
assign($params['assign'], $output);
|
||||
} else {
|
||||
|
@ -1226,4 +1227,117 @@ function rmdir_recurse($path) {
|
|||
rmdir($path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get manager order for provided $type
|
||||
*
|
||||
* @todo Add alias function for different objects
|
||||
* @global OBJECT $Cbucket
|
||||
* @param STRING $type
|
||||
* @return MIX
|
||||
*/
|
||||
function object_manager_orders ( $type='video' ) {
|
||||
global $Cbucket;
|
||||
$orders = $Cbucket->manager_orders[ $type ];
|
||||
if ( $orders ) {
|
||||
$orders = apply_filters( $orders, 'manager_orders' );
|
||||
return $orders;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new order for object
|
||||
*
|
||||
* @todo Add alias function for different objects
|
||||
* @global OBJECT $Cbucket
|
||||
* @param STRING $title
|
||||
* @param STRING $order
|
||||
* @param STRING $type
|
||||
* @param STRING $id
|
||||
* @return MIX
|
||||
*/
|
||||
function add_object_manager_order ( $title, $order, $type = 'video' ) {
|
||||
global $Cbucket;
|
||||
|
||||
if ( !$title || !$order || !$type ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$order_array = array(
|
||||
'title' => $title,
|
||||
'order' => $order,
|
||||
'id' => $type.'-'.SEO( strtolower($title) ).'-'.time()
|
||||
);
|
||||
|
||||
$Cbucket->manager_orders[ trim($type) ][] = $order_array;
|
||||
return $Cbucket->manager_orders;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the current order title
|
||||
*
|
||||
* @todo Add alias function for different objects
|
||||
* @param STRING $type
|
||||
* @return MIX
|
||||
*/
|
||||
function current_object_order( $type = 'video' ) {
|
||||
$current = $_GET['omo'] ? mysql_clean( $_GET['omo'] ) : (int)0;
|
||||
$orders = object_manager_orders( $type );
|
||||
|
||||
if ( !$orders[$current] ) {
|
||||
$current = 0;
|
||||
}
|
||||
|
||||
if ( $orders[$current] ) {
|
||||
return $orders[$current]['title'];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the list of orders for current object. You have option to only
|
||||
* display unselected orders excluding the current order. Set $display to
|
||||
* 'all' to add all orders, adding CSS .active class to current one
|
||||
*
|
||||
* @todo Add alias function for different objects
|
||||
* @param STRING $type
|
||||
* @param STRING $display
|
||||
* @return MIX
|
||||
*/
|
||||
function display_manager_orders( $type = 'video', $display = 'unselected' ) {
|
||||
$orders = object_manager_orders( $type );
|
||||
$current_order = $_GET['omo'] ? mysql_clean( $_GET['omo'] ) : (int)0;
|
||||
|
||||
if ( !$orders[$current_order] ) {
|
||||
$current_order = 0;
|
||||
}
|
||||
|
||||
$total_order = count( $orders );
|
||||
if ( $_SERVER['QUERY_STRING'] ) {
|
||||
$query_string = queryString(null,'omo');
|
||||
}
|
||||
|
||||
if ( $orders ) {
|
||||
foreach ( $orders as $key => $order ) {
|
||||
if ( $key == $current_order && $display == 'unselected' && $total_order >= 2 ) {
|
||||
continue; // skip the selected one
|
||||
}
|
||||
|
||||
$active = '';
|
||||
|
||||
if ( $key == $current_order ) {
|
||||
$active = ' class="active"';
|
||||
}
|
||||
$output .= '<li'.$active.'>';
|
||||
$output .= '<a href="'.($query_string ? $query_string : '?').'omo='.$key.'" id="'.$order['id'].'" data-order="'.$key.'" data-type="'.$type.'">'.$order['title'].'</a>';
|
||||
$output .= '</li>';
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
?>
|
Loading…
Add table
Reference in a new issue