Changeset 16688 for extensions/UserCollections/include/events.inc.php
- Timestamp:
- Jul 13, 2012, 12:09:19 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/UserCollections/include/events.inc.php
r16625 r16688 216 216 function user_collections_applymenu($menu_ref_arr) 217 217 { 218 global $template, $conf, $UserCollection; 218 $max = 6; 219 220 global $template, $conf, $user, $UserCollection; 219 221 $menu = &$menu_ref_arr[0]; 220 222 221 223 if (($block = $menu->get_block('mbUserCollection')) != null) 222 224 { 223 if (($col_id = get_current_collection_id(false)) !== false) 224 { 225 if (empty($UserCollection)) 226 { 227 $UserCollection = new UserCollection($col_id); 228 } 229 230 $data = array( 231 'current' => array( 232 'NAME' => $UserCollection->getParam('name'), 233 'NB_IMAGES' => $UserCollection->getParam('nb_images'), 234 ), 235 'links' => array(), 236 ); 237 238 if ($data['current']['NB_IMAGES'] > 0) 239 { 240 $data['links'] = array( 241 array( 242 'URL' => USER_COLLEC_PUBLIC.'edit/'.$UserCollection->getParam('col_id'), 243 'NAME' => l10n('Display collection'), 244 ), 245 array( 246 'URL' => USER_COLLEC_PUBLIC.'&action=clear&col_id='.$UserCollection->getParam('col_id'), 247 'NAME' => l10n('Clear collection'), 248 ), 249 ); 250 } 225 $query = ' 226 SELECT * 227 FROM '.COLLECTIONS_TABLE.' 228 WHERE user_id = '.$user['id'].' 229 ORDER BY 230 active DESC, 231 date_creation DESC 232 ;'; 233 $collections = array_values(hash_from_query($query, 'id')); 234 235 $data['collections'] = array(); 236 for ($i=0; $i<$max && $i<count($collections); $i++) 237 { 238 $collections[$i]['U_EDIT'] = USER_COLLEC_PUBLIC.'edit/'.$collections[$i]['id']; 239 array_push($data['collections'], $collections[$i]); 240 } 241 242 $data['NB_COL'] = count($collections); 243 if ($data['NB_COL'] > $max) 244 { 245 $data['MORE'] = count($collections)-$max; 251 246 } 252 247 253 248 $data['U_LIST'] = USER_COLLEC_PUBLIC; 249 $data['U_CREATE'] = USER_COLLEC_PUBLIC.'&action=new&col_id=0&redirect=true'; 254 250 255 251 $template->set_template_dir(USER_COLLEC_PATH . 'template/'); 256 $block->set_title( l10n('Collections'));252 $block->set_title('<a href="'.USER_COLLEC_PUBLIC.'">'.l10n('Collections').'</a>'); 257 253 $block->template = 'menublock_user_collec.tpl'; 258 254 $block->data = $data;
Note: See TracChangeset
for help on using the changeset viewer.