Changeset 640 for trunk


Ignore:
Timestamp:
Dec 6, 2004, 11:28:32 PM (20 years ago)
Author:
plg
Message:
  • possibility to set an element as representant of its categories
Location:
trunk
Files:
3 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');
  • trunk/language/en_UK.iso-8859-1/admin.lang.php

    r635 r640  
    350350$lang['cat_dissociated'] = 'dissociated from';
    351351$lang['storage_category'] = 'storage category';
     352$lang['represents'] = 'represents';
     353$lang['doesnt_represent'] = 'doesn\'t represent';
    352354?>
  • trunk/template/default/admin/picture_modify.tpl

    r635 r640  
    106106
    107107</form>
     108
     109<form name="form2" method="post" action="{F_ACTION}" style="text-align:center;width:800px;">
     110
     111  <div style="clear:both;"></div>
     112
     113  <div style="height:auto;">
     114
     115    <div style="float:left;padding:10px;width:300px;">
     116      <span class="titreMenu">{L_REPRESENTS}</span><br />
     117      <select style="height:auto;width:280px" name="cat_elected[]" multiple="multiple" size="10">
     118        <!-- BEGIN elected_option -->
     119        <option class="{elected_option.CLASS}" {elected_option.SELECTED} value="{elected_option.VALUE}">{elected_option.OPTION}</option>
     120        <!-- END elected_option -->
     121      </select>
     122    </div>
     123
     124    <div style="float:left;padding-top:80px;padding-bottom:80px;text-align:center;width:160px;" >
     125      <input type="submit" value="&larr;" name="elect" style="font-size:15px;" class="bouton" /><br/>
     126      <input type="submit" value="&rarr;" name="dismiss" style="font-size:15px;" class="bouton" />
     127    </div>
     128
     129    <div style="float:right;padding:10px;width:300px;">
     130      <span class="titreMenu">{L_DOESNT_REPRESENT}</span><br />
     131      <select style="width:280px" name="cat_dismissed[]" multiple="multiple" size="10">
     132        <!-- BEGIN dismissed_option -->
     133        <option class="{dismissed_option.CLASS}" {dismissed_option.SELECTED} value="{dismissed_option.VALUE}">{dismissed_option.OPTION}</option>
     134        <!-- END dismissed_option -->
     135      </select>
     136    </div>
     137
     138  </div>
     139
     140  <div style="clear:both;"></div>
     141
     142  <input type="reset" name="reset" value="{L_RESET}" class="bouton" />
     143
     144</form>
Note: See TracChangeset for help on using the changeset viewer.