Changeset 760 for trunk/admin


Ignore:
Timestamp:
Mar 26, 2005, 11:35:07 PM (19 years ago)
Author:
plg
Message:
  • "add to caddie" link is visible only when categories contains elements. Only admin users can see this link
  • elements batch management : impossible to create a link between category and element that already exists
  • logical separation of category name under thumbnail and element name
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/element_set_global.php

    r755 r760  
    9292  {
    9393    $datas = array();
     94
     95    $query = '
     96SELECT image_id
     97  FROM '.IMAGE_CATEGORY_TABLE.'
     98  WHERE category_id = '.$_POST['associate'].'
     99;';
     100    $associated = array_from_query($query, 'image_id');
     101
     102    $associable = array_diff($collection, $associated);
    94103   
    95     foreach ($collection as $item)
     104    foreach ($associable as $item)
    96105    {
    97106      array_push($datas,
     
    100109    }
    101110 
    102     // TODO : inserting an existing PK will fail
    103     mass_inserts(IMAGE_CATEGORY_TABLE, array('image_id', 'category_id'), $datas);
     111    mass_inserts(IMAGE_CATEGORY_TABLE,
     112                 array('image_id', 'category_id'),
     113                 $datas);
    104114    update_category(array($_POST['associate']));
    105115  }
Note: See TracChangeset for help on using the changeset viewer.