Ignore:
Timestamp:
Dec 6, 2004, 11:28:32 PM (19 years ago)
Author:
plg
Message:
  • possibility to set an element as representant of its categories
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/picture_modify.php

    r635 r640  
    112112  pwg_query($query);
    113113  update_category($_POST['cat_associated']);
     114}
     115// elect the element to represent the given categories
     116if (isset($_POST['elect'])
     117    and isset($_POST['cat_dismissed'])
     118    and count($_POST['cat_dismissed']) > 0)
     119{
     120  $datas = array();
     121  foreach ($_POST['cat_dismissed'] as $category_id)
     122  {
     123    array_push($datas,
     124               array('id' => $category_id,
     125                     'representative_picture_id' => $_GET['image_id']));
     126  }
     127  $fields = array('primary' => array('id'),
     128                  'update' => array('representative_picture_id'));
     129  mass_updates(CATEGORIES_TABLE, $fields, $datas);
     130}
     131// dismiss the element as representant of the given categories
     132if (isset($_POST['dismiss'])
     133    and isset($_POST['cat_elected'])
     134    and count($_POST['cat_elected']) > 0)
     135{
     136  set_random_representant($_POST['cat_elected']);
    114137}
    115138
     
    184207  'L_PATH'=>$lang['path'],
    185208  'L_STORAGE_CATEGORY'=>$lang['storage_category'],
     209  'L_REPRESENTS'=>$lang['represents'],
     210  'L_DOESNT_REPRESENT'=>$lang['doesnt_represent'],
    186211 
    187212  'F_ACTION'=>add_session_id(PHPWG_ROOT_PATH.'admin.php?'.$_SERVER['QUERY_STRING'])
     
    220245;';
    221246display_select_cat_wrapper($query,array(),'dissociated_option');
     247// representing
     248$query = '
     249SELECT id,name,uppercats,global_rank
     250  FROM '.CATEGORIES_TABLE.'
     251  WHERE representative_picture_id = '.$_GET['image_id'].'
     252;';
     253display_select_cat_wrapper($query,array(),'elected_option');
     254
     255$query = '
     256SELECT id,name,uppercats,global_rank
     257  FROM '.CATEGORIES_TABLE.'
     258  WHERE id IN ('.implode(',', $associateds).')
     259    AND representative_picture_id != '.$_GET['image_id'].'
     260;';
     261display_select_cat_wrapper($query,array(),'dismissed_option');
    222262//----------------------------------------------------------- sending html code
    223263$template->assign_var_from_handle('ADMIN_CONTENT', 'picture_modify');
Note: See TracChangeset for help on using the changeset viewer.