Ignore:
Timestamp:
Apr 16, 2005, 6:56:32 PM (19 years ago)
Author:
plg
Message:
  • elements batch management : element_set page becomes the frontend to element_set_global and element_set_unit, infos_images (after a long time of use) become deprecated : the more powerful element_set is used instead. Consequently, batch management concerns caddie but also "normal categories".
  • refactoring code in admin.php to include the sub-file (clearer)
  • caddie : function fill_caddie replaces the code in category.php and can be used in admin/element_set.php
  • caddie : caddie table is added in delete_elements function
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions.inc.php

    r762 r764  
    551551    if (!in_array($key, $rejects))
    552552    {
    553       if ($is_first)
    554       {
    555         $query_string.= '?';
    556         $is_first = false;
    557       }
    558       else
    559       {
    560         $query_string.= '&';
    561       }
     553      $query_string.= $is_first ? '?' : '&';
     554      $is_first = false;
    562555      $query_string.= $key.'='.$value;
    563556    }
     
    696689  }
    697690}
     691
     692/**
     693 * fill the current user caddie with given elements, if not already in
     694 * caddie
     695 *
     696 * @param array elements_id
     697 */
     698function fill_caddie($elements_id)
     699{
     700  global $user;
     701 
     702  include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
     703 
     704  $query = '
     705SELECT element_id
     706  FROM '.CADDIE_TABLE.'
     707  WHERE user_id = '.$user['id'].'
     708;';
     709  $in_caddie = array_from_query($query, 'element_id');
     710
     711  $caddiables = array_diff($elements_id, $in_caddie);
     712
     713  $datas = array();
     714
     715  foreach ($caddiables as $caddiable)
     716  {
     717    array_push($datas, array('element_id' => $caddiable,
     718                             'user_id' => $user['id']));
     719  }
     720
     721  if (count($caddiables) > 0)
     722  {
     723    mass_inserts(CADDIE_TABLE, array('element_id','user_id'), $datas);
     724  }
     725}
    698726?>
Note: See TracChangeset for help on using the changeset viewer.