Ignore:
Timestamp:
Aug 23, 2012, 11:01:02 AM (12 years ago)
Author:
mistic100
Message:

add a tab on element edition page to edit video properties

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/gvideo/include/gvideo.inc.php

    r17488 r17626  
    6868}
    6969
    70 /**
    71  * add message and link on edition page
    72  */
    73 function gvideo_photo_edit()
    74 {
    75   global $page, $template, $conf;
    76  
    77   if ($page['page'] != 'photo') return;
    78  
    79   $query = '
    80 SELECT *
    81   FROM '.GVIDEO_TABLE.'
    82   WHERE picture_id = '.$_GET['image_id'].'
    83 ;';
    84   $result = pwg_query($query);
    85  
    86   if (!pwg_db_num_rows($result)) return;
    87    
    88   $video = pwg_db_fetch_assoc($result);
    89    
    90   array_push($page['warnings'], l10n('This element is a video added with "Embedded Video"'));
    91  
    92   if (function_exists('imagecreatetruecolor'))
    93   {
    94     if (isset($_GET['add_film_frame']))
    95     {
    96       include_once(GVIDEO_PATH . '/include/functions.inc.php');
    97       include_once(PHPWG_ROOT_PATH . 'admin/include/functions_upload.inc.php');
    98      
    99       $image_infos = pwg_db_fetch_assoc(pwg_query('SELECT path, file FROM '.IMAGES_TABLE.' WHERE id = '.$_GET['image_id'].';'));
    100       $thumb_source = $conf['data_location'].$image_infos['file'];
    101      
    102       add_film_frame($image_infos['path'], $thumb_source);
    103       add_uploaded_file($thumb_source, $image_infos['file'], null, null, $_GET['image_id']);
    104       $template->assign('TN_UPDATE', true);
    105     }
    106    
    107     $admin_photo_base_url = get_root_url().'admin.php?page=photo-'.$_GET['image_id'];
    108     $admin_url_start = $admin_photo_base_url.'-properties';
    109     $admin_url_start.= isset($_GET['cat_id']) ? '&cat_id='.$_GET['cat_id'] : '';
    110    
    111     $template->assign('U_ADD_FILM_FRAME', $admin_url_start.'&add_film_frame=1');
    112     $template->set_prefilter('picture_modify', 'gvideo_photo_edit_prefilter');
    113   }
    114 }
    115 
    116 function gvideo_photo_edit_prefilter($content)
    117 {
    118   $search[0] = '{if !url_is_remote($PATH)}';
    119   $replace[0] = '<li><a href="{$U_ADD_FILM_FRAME}" id="refresh_video">{\'Add film effect\'|@translate}</a></li>'.$search[0];
    120  
    121   $search[1] = '{$TN_SRC}';
    122   $replace[1] = $search[1].'{if $TN_UPDATE}?'.time().'{/if}';
    123  
    124   return str_replace($search, $replace, $content);
    125 }
    126 
    12770?>
Note: See TracChangeset for help on using the changeset viewer.