Ignore:
Timestamp:
02/19/14 23:32:26 (5 years ago)
Author:
ddtddt
Message:

[extensions] - see_photos_by_user - new function menu / show

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/see_photos_by_user/main.inc.php

    r27392 r27428  
    1515load_language('plugin.lang', SPBA_PATH); 
    1616 
     17global $conf; 
     18$showSPBU = $conf['see_photos_by_user_show']; 
     19 
     20if ($showSPBU == 1 OR $showSPBU == 3) 
     21{ 
    1722add_event_handler('blockmanager_apply' , 'add_link_SPBA'); 
     23} 
    1824function add_link_SPBA($menu_ref_arr) 
    1925 { 
     
    5662 
    5763 
     64 
     65if ($showSPBU == 2 OR $showSPBU == 3 OR $showSPBU == 4) 
     66{ 
     67add_event_handler('blockmanager_register_blocks', 'register_users_menubar_blocks'); 
     68add_event_handler('blockmanager_apply', 'users_apply'); 
     69} 
     70function register_users_menubar_blocks( $menu_ref_arr ) 
     71{ 
     72  $menu = & $menu_ref_arr[0]; 
     73  if ($menu->get_id() != 'menubar') 
     74    return; 
     75  $menu->register_block( new RegisteredBlock( 'mbUsers','Users',('See photos by user'))); 
     76} 
     77 
     78function users_apply($menu_ref_arr) 
     79{ 
     80global $template, $conf, $user; 
     81$menu = & $menu_ref_arr[0]; 
     82load_language('plugin.lang', SPBA_PATH); 
     83load_language('lang', PHPWG_ROOT_PATH.'local/', array('no_fallback'=>true, 'local'=>true)); 
     84 
     85$userslistemenu1 = pwg_query(' 
     86SELECT UT.id, UT.username, COUNT(DISTINCT(IT.id)) AS PBU, IT.id 
     87 FROM ' . USERS_TABLE . ' as UT 
     88 INNER JOIN '.IMAGES_TABLE.' AS IT ON IT.added_by = UT.id 
     89 INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON IT.id = ic.image_id 
     90  '.get_sql_condition_FandF 
     91  ( 
     92    array 
     93      ( 
     94        'forbidden_categories' => 'category_id', 
     95        'visible_categories' => 'category_id', 
     96        'visible_images' => 'id' 
     97      ), 
     98    'WHERE' 
     99  ).' 
     100 GROUP BY IT.added_by 
     101 HAVING PBU >'.$conf['see_photos_by_user_nbphotos'].' 
     102 ORDER BY '.$conf['see_photos_by_user_order'].' 
     103 LIMIT '.$conf['see_photos_by_user_limit'].';'); 
     104 
     105if (pwg_db_num_rows($userslistemenu1)) {         
     106 while ($userslistemenu = pwg_db_fetch_assoc($userslistemenu1)) 
     107        { 
     108    $items = array( 
     109      'USERSSPBYL' => $userslistemenu['username'], 
     110          'USERSSPBYLC' => $userslistemenu['PBU'], 
     111                ); 
     112                 
     113        $template->append('userslistemenu1', $items); 
     114        } 
     115} 
     116$linkusersliste = get_root_url().'index.php?/user-'; 
     117$template->assign('USERSSPBY', $linkusersliste); 
     118    
     119 if (($block = $menu->get_block( 'mbUsers' )) != null) { 
     120 $template->set_template_dir(SPBA_PATH); 
     121 $block->template = 'menubar_users.tpl';} 
     122} 
     123 
    58124add_event_handler('get_admin_plugin_menu_links', 'SPBA_admin_menu'); 
    59125function SPBA_admin_menu($menu) 
Note: See TracChangeset for help on using the changeset viewer.