Ignore:
Timestamp:
Jan 2, 2009, 9:57:56 PM (15 years ago)
Author:
nikrou
Message:

task:0000902: button to remove all favorites

File:
1 edited

Legend:

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

    r2773 r3037  
    374374    check_user_favorites();
    375375
    376     $query = '
     376    $page = array_merge(
     377      $page,
     378      array(
     379        'title' => l10n('favorites')
     380            )
     381    );
     382
     383    if (!empty($_GET['action']) && ($_GET['action'] == 'remove_all_from_favorites'))
     384    {
     385      $query = '
     386DELETE FROM '.FAVORITES_TABLE.'
     387  WHERE user_id = '.$user['id'].'
     388;';
     389      pwg_query($query);
     390    }
     391    else
     392    {
     393      $query = '
    377394SELECT image_id
    378395  FROM '.FAVORITES_TABLE.'
     
    389406  '.$conf['order_by'].'
    390407;';
    391 
    392     $page = array_merge(
    393       $page,
    394       array(
    395         'title' => l10n('favorites'),
    396         'items' => array_from_query($query, 'image_id'),
    397         )
    398       );
     408      $page = array_merge(
     409        $page,
     410        array(
     411          'items' => array_from_query($query, 'image_id'),
     412         )
     413      );
     414
     415      if (count($page['items'])>0)
     416      {
     417        $template->assign(
     418          'favorite',
     419          array(
     420            'FAVORITE_IMG'  =>
     421            get_root_url().get_themeconf('icon_dir').'/del_all_favorites.png',
     422            'FAVORITE_HINT' => l10n('del_all_favorites_hint'),
     423            'U_FAVORITE'    => add_url_params(
     424              'index.php?/favorites',
     425              array('action'=>'remove_all_from_favorites')
     426               ),
     427             )
     428           );
     429      }
     430    }
    399431  }
    400432// +-----------------------------------------------------------------------+
Note: See TracChangeset for help on using the changeset viewer.