Exemple #1
0
     $cid = mysql_clean(post('cid'));
     $obj->make_default_category($cid);
     $name = post('name');
     if (error()) {
         echo json_encode(array('err' => error()));
     } else {
         echo json_encodE(array('success' => 'yes', "msg" => array("<strong>{$name}</strong> has been set as default")));
     }
     break;
 case "edit_category":
     $cid = mysql_clean(post('cid'));
     $category = $obj->get_category($cid);
     if ($category) {
         assign('c', $category);
         $template = Fetch('blocks/edit-category.html');
         echo json_encode(array('success' => 'yes', 'template' => $template, 'title' => loading_pointer(array('place' => 'save-category')) . ' ' . $category['category_name']));
     } else {
         echo json_encode(array('err' => array('Unable to fetch category details')));
     }
     break;
 case "save_category":
     $type = $_POST['type'];
     assign('type', $type);
     $category = $obj->update_category($_POST);
     if (error()) {
         echo json_encode(array('err' => error('single')));
     } else {
         echo json_encode(array('success' => 'yes', 'msg' => array('Category has been updated successfully')));
     }
     break;
 case "update_order":
/**
 * function used to create a video block menu
 * that is displayed on each video
 * 
 * @param ARRAY $video
 * @return ARRAY $menu
 */
function get_video_menu($video)
{
    global $cbvid;
    $builtin_playlists = $cbvid->builtin_playlists;
    $videoid = $video['videoid'];
    $menu = array();
    if (userid()) {
        $watch_later_pid = $builtin_playlists['watch_later']['playlist_id'];
        $menu['user'] = array(array('title' => 'Watch later ' . loading_pointer(array('place' => 'playlist-' . $videoid . '-' . $watch_later_pid)), 'onclick' => "add_to_playlist('{$watch_later_pid}','{$videoid}','v')", 'href' => 'javascript:void(0);'));
    }
    if (has_access('video_moderation', true)) {
        $activate_video = array('title' => 'Activate', 'href' => 'javascript:void(0);', 'onclick' => "video_action('{$videoid}','activate');");
        $deactivate_video = array('title' => 'Deactivate', 'href' => 'javascript:void(0);', 'onclick' => "video_action('{$videoid}','deactivate');");
        if ($video['active'] == 'yes') {
            $activate_video['li_style'] = 'display:none';
        } else {
            $deactivate_video['li_style'] = 'display:none';
        }
        $menu['admin'] = array('edit' => array('title' => 'Edit video', 'href' => 'admin_area/edit_video.php?video=' . $videoid), 'activate' => $activate_video, 'deactivate' => $deactivate_video);
    }
    return $menu;
}