Changeset 764 for trunk/admin
- Timestamp:
- Apr 16, 2005, 6:56:32 PM (20 years ago)
- Location:
- trunk/admin
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/cat_list.php
r728 r764 452 452 453 453 'U_INFO_IMG' 454 => add_session_id($base_url.' infos_images&cat_id='.$category['id'])454 => add_session_id($base_url.'element_set&cat='.$category['id']) 455 455 )); 456 456 -
trunk/admin/element_set_global.php
r763 r764 73 73 74 74 // +-----------------------------------------------------------------------+ 75 // | caddie management |76 // +-----------------------------------------------------------------------+77 if (isset($_POST['submit_caddie']))78 {79 if (isset($_POST['caddie_action']))80 {81 switch ($_POST['caddie_action'])82 {83 case 'empty_all' :84 {85 $query = '86 DELETE FROM '.CADDIE_TABLE.'87 WHERE user_id = '.$user['id'].'88 ;';89 pwg_query($query);90 break;91 }92 case 'empty_selected' :93 {94 if (isset($_POST['selection']) and count($_POST['selection']) > 0)95 {96 $query = '97 DELETE98 FROM '.CADDIE_TABLE.'99 WHERE element_id IN ('.implode(',', $_POST['selection']).')100 AND user_id = '.$user['id'].'101 ;';102 pwg_query($query);103 }104 else105 {106 // TODO : add error107 }108 break;109 }110 }111 }112 else113 {114 // TODO : add error115 }116 }117 118 // +-----------------------------------------------------------------------+119 75 // | global mode form submission | 120 76 // +-----------------------------------------------------------------------+ … … 134 90 case 'all' : 135 91 { 136 $query = ' 137 SELECT element_id 138 FROM '.CADDIE_TABLE.' 139 WHERE user_id = '.$user['id'].' 140 ;'; 141 $result = pwg_query($query); 142 while ($row = mysql_fetch_array($result)) 143 { 144 array_push($collection, $row['element_id']); 145 } 92 $collection = $page['cat_elements_id']; 146 93 break; 147 94 } … … 182 129 if ($_POST['dissociate'] != 0) 183 130 { 184 // physical links must be broken, so we must first retrieve image_id131 // physical links must not be broken, so we must first retrieve image_id 185 132 // which create virtual links with the category to "dissociate from". 186 133 $query = ' … … 321 268 $template->assign_vars( 322 269 array( 270 'CATEGORY_TITLE'=>$page['title'], 271 323 272 'L_SUBMIT'=>$lang['submit'], 324 273 325 'U_ELEMENTS_LINE'=>$base_url.get_query_string_diff(array('display')), 326 'U_UNIT_MODE'=>add_session_id($base_url.'?page=element_set_unit'), 274 'U_COLS'=>$base_url.get_query_string_diff(array('cols')), 275 'U_DISPLAY'=>$base_url.get_query_string_diff(array('display')), 276 277 'U_UNIT_MODE' 278 => 279 $base_url 280 .get_query_string_diff(array('mode','display')) 281 .'&mode=unit', 327 282 328 283 'F_ACTION'=>$base_url.get_query_string_diff(array()), 329 284 ) 330 285 ); 286 287 // +-----------------------------------------------------------------------+ 288 // | caddie options | 289 // +-----------------------------------------------------------------------+ 290 291 if ('caddie' == $_GET['cat']) 292 { 293 $template->assign_block_vars('in_caddie', array()); 294 } 295 else 296 { 297 $template->assign_block_vars('not_in_caddie', array()); 298 } 299 331 300 // +-----------------------------------------------------------------------+ 332 301 // | global mode form | … … 361 330 )); 362 331 363 $query = ' 332 if (count($page['cat_elements_id']) > 0) 333 { 334 $query = ' 364 335 SELECT DISTINCT(category_id) AS id, c.name, uppercats, global_rank 365 336 FROM '.IMAGE_CATEGORY_TABLE.' AS ic, 366 '.CADDIE_TABLE.' AS caddie,367 337 '.CATEGORIES_TABLE.' AS c, 368 338 '.IMAGES_TABLE.' AS i 369 WHERE ic.image_id = caddie.element_id339 WHERE ic.image_id IN ('.implode(',', $page['cat_elements_id']).') 370 340 AND ic.category_id = c.id 371 341 AND ic.image_id = i.id 372 342 AND ic.category_id != i.storage_category_id 373 AND caddie.user_id = '.$user['id'].' 374 ;';375 display_select_cat_wrapper($query, array(), $blockname, true); 343 ;'; 344 display_select_cat_wrapper($query, array(), $blockname, true); 345 } 376 346 377 347 $blockname = 'remove_keyword_option'; … … 383 353 )); 384 354 385 $query = ' 386 SELECT element_id 387 FROM '.CADDIE_TABLE.' 388 WHERE user_id = '.$user['id'].' 389 ;'; 390 $keywords = get_elements_keywords(array_from_query($query, 'element_id')); 355 $keywords = get_elements_keywords($page['cat_elements_id']); 391 356 392 357 foreach ($keywords as $keyword) … … 428 393 // +-----------------------------------------------------------------------+ 429 394 430 $page['nb_image_line'] = !empty($_GET['display']) ? $_GET['display'] : 5; 431 432 $query = ' 433 SELECT element_id,path,tn_ext 434 FROM '.IMAGES_TABLE.' INNER JOIN '.CADDIE_TABLE.' ON id=element_id 435 WHERE user_id = '.$user['id'].' 395 $page['cols'] = !empty($_GET['cols']) ? intval($_GET['cols']) : 5; 396 $page['nb_images'] = !empty($_GET['display']) ? intval($_GET['display']) : 20; 397 398 if (count($page['cat_elements_id']) > 0) 399 { 400 $nav_bar = create_navigation_bar( 401 $base_url.get_query_string_diff(array('start')), 402 count($page['cat_elements_id']), 403 $page['start'], 404 $page['nb_images'], 405 ''); 406 $template->assign_vars(array('NAV_BAR' => $nav_bar)); 407 408 $query = ' 409 SELECT id,path,tn_ext 410 FROM '.IMAGES_TABLE.' 411 WHERE id IN ('.implode(',', $page['cat_elements_id']).') 436 412 '.$conf['order_by'].' 437 ;'; 438 //echo '<pre>'.$query.'</pre>'; 439 $result = pwg_query($query); 440 441 // template thumbnail initialization 442 if (mysql_num_rows($result) > 0) 443 { 444 $template->assign_block_vars('thumbnails', array()); 445 // first line 446 $template->assign_block_vars('thumbnails.line', array()); 447 // current row displayed 448 $row_number = 0; 449 } 450 451 while ($row = mysql_fetch_array($result)) 452 { 453 $src = get_thumbnail_src($row['path'], @$row['tn_ext']); 454 455 $template->assign_block_vars( 456 'thumbnails.line.thumbnail', 457 array( 458 'ID' => $row['element_id'], 459 'SRC' => $src, 460 'ALT' => 'TODO', 461 'TITLE' => 'TODO' 462 ) 463 ); 464 465 // create a new line ? 466 if (++$row_number == $page['nb_image_line']) 467 { 413 LIMIT '.$page['start'].', '.$page['nb_images'].' 414 ;'; 415 //echo '<pre>'.$query.'</pre>'; 416 $result = pwg_query($query); 417 418 // template thumbnail initialization 419 if (mysql_num_rows($result) > 0) 420 { 421 $template->assign_block_vars('thumbnails', array()); 422 // first line 423 $template->assign_block_vars('thumbnails.line', array()); 424 // current row displayed 425 $row_number = 0; 426 } 427 428 while ($row = mysql_fetch_array($result)) 429 { 430 $src = get_thumbnail_src($row['path'], @$row['tn_ext']); 431 432 $template->assign_block_vars( 433 'thumbnails.line.thumbnail', 434 array( 435 'ID' => $row['id'], 436 'SRC' => $src, 437 'ALT' => 'TODO', 438 'TITLE' => 'TODO' 439 ) 440 ); 441 442 // create a new line ? 443 if (++$row_number == $page['cols']) 444 { 468 445 $template->assign_block_vars('thumbnails.line', array()); 469 446 $row_number = 0; 447 } 470 448 } 471 449 } -
trunk/admin/element_set_unit.php
r763 r764 100 100 101 101 // +-----------------------------------------------------------------------+ 102 // | page information init |103 // +-----------------------------------------------------------------------+104 105 // $page['start'] contains the number of the first element in its106 // category. For exampe, $page['start'] = 12 means we must show elements #12107 // and $page['nb_images'] next elements108 if (!isset($_GET['start'])109 or !is_numeric($_GET['start'])110 or $_GET['start'] < 0)111 {112 $page['start'] = 0;113 }114 else115 {116 $page['start'] = $_GET['start'];117 }118 119 // $page['nb_images'] is the number of elements to show in the page120 $page['nb_images'] = !empty($_GET['display']) ? $_GET['display'] : 5;121 122 // $page['cat_nb_images'] is the total number of elements to show in the123 // category124 $query = '125 SELECT COUNT(*)126 FROM '.CADDIE_TABLE.'127 WHERE user_id = '.$user['id'].'128 ;';129 list($page['cat_nb_images']) = mysql_fetch_row(pwg_query($query));130 131 // +-----------------------------------------------------------------------+132 102 // | template init | 133 103 // +-----------------------------------------------------------------------+ … … 142 112 $template->assign_vars( 143 113 array( 114 'CATEGORY_TITLE'=>$page['title'], 115 144 116 'L_SUBMIT'=>$lang['submit'], 145 117 … … 148 120 149 121 'U_GLOBAL_MODE' 150 // =>$base_url.get_query_string_diff(array('mode','display','start')), 151 =>add_session_id($base_url.'?page=element_set_global'), 122 => 123 $base_url 124 .get_query_string_diff(array('mode','display')) 125 .'&mode=global', 152 126 153 127 'F_ACTION'=>$base_url.get_query_string_diff(array()), … … 159 133 // +-----------------------------------------------------------------------+ 160 134 161 $element_ids = array(); 162 163 $query = ' 164 SELECT element_id,path,tn_ext,name,date_creation,comment,keywords,author 165 FROM '.IMAGES_TABLE.' INNER JOIN '.CADDIE_TABLE.' ON id=element_id 166 WHERE user_id = '.$user['id'].' 135 $page['nb_images'] = !empty($_GET['display']) ? intval($_GET['display']) : 5; 136 137 138 if (count($page['cat_elements_id']) > 0) 139 { 140 $nav_bar = create_navigation_bar( 141 $base_url.get_query_string_diff(array('start')), 142 count($page['cat_elements_id']), 143 $page['start'], 144 $page['nb_images'], 145 ''); 146 $template->assign_vars(array('NAV_BAR' => $nav_bar)); 147 148 149 $element_ids = array(); 150 151 $query = ' 152 SELECT id,path,tn_ext,name,date_creation,comment,keywords,author 153 FROM '.IMAGES_TABLE.' 154 WHERE id IN ('.implode(',', $page['cat_elements_id']).') 167 155 '.$conf['order_by'].' 168 156 LIMIT '.$page['start'].', '.$page['nb_images'].' 169 157 ;'; 170 $result = pwg_query($query); 171 172 while ($row = mysql_fetch_array($result)) 173 { 174 // echo '<pre>'; print_r($row); echo '</pre>'; 175 array_push($element_ids, $row['element_id']); 176 177 $src = get_thumbnail_src($row['path'], @$row['tn_ext']); 178 179 // creation date 180 if (!empty($row['date_creation'])) 158 $result = pwg_query($query); 159 160 while ($row = mysql_fetch_array($result)) 181 161 { 182 list($year,$month,$day) = explode('-', $row['date_creation']); 162 // echo '<pre>'; print_r($row); echo '</pre>'; 163 array_push($element_ids, $row['id']); 164 165 $src = get_thumbnail_src($row['path'], @$row['tn_ext']); 166 167 // creation date 168 if (!empty($row['date_creation'])) 169 { 170 list($year,$month,$day) = explode('-', $row['date_creation']); 171 } 172 else 173 { 174 list($year,$month,$day) = array('','',''); 175 } 176 177 $template->assign_block_vars( 178 'element', 179 array( 180 'ID' => $row['id'], 181 'FILENAME' => $row['path'], 182 'TN_SRC' => $src, 183 'NAME' => @$row['name'], 184 'AUTHOR' => @$row['author'], 185 'COMMENT' => @$row['comment'], 186 'DATE_CREATION_YEAR' => $year, 187 'KEYWORDS' => @$row['keywords'] 188 ) 189 ); 190 191 get_day_list('element.date_creation_day', $day); 192 get_month_list('element.date_creation_month', $month); 183 193 } 184 else 185 { 186 list($year,$month,$day) = array('','',''); 187 } 188 189 $template->assign_block_vars( 190 'element', 191 array( 192 'ID' => $row['element_id'], 193 'FILENAME' => $row['path'], 194 'TN_SRC' => $src, 195 'NAME' => @$row['name'], 196 'AUTHOR' => @$row['author'], 197 'COMMENT' => @$row['comment'], 198 'DATE_CREATION_YEAR' => $year, 199 'KEYWORDS' => @$row['keywords'] 200 ) 201 ); 202 203 get_day_list('element.date_creation_day', $day); 204 get_month_list('element.date_creation_month', $month); 194 195 $template->assign_vars(array('IDS_LIST' => implode(',', $element_ids))); 205 196 } 206 207 $template->assign_vars(array('IDS_LIST' => implode(',', $element_ids)));208 209 $nav_bar = create_navigation_bar(210 $base_url.get_query_string_diff(array('start')),211 $page['cat_nb_images'],212 $page['start'],213 $page['nb_images'],214 '');215 $template->assign_vars(array('NAV_BAR' => $nav_bar));216 197 217 198 // +-----------------------------------------------------------------------+ -
trunk/admin/include/functions.php
r680 r764 297 297 $query = ' 298 298 DELETE FROM '.RATE_TABLE.' 299 WHERE element_id IN ( 300 '.wordwrap(implode(', ', $ids), 80, "\n").') 301 ;'; 302 pwg_query($query); 303 304 // destruction of the rates associated to this element 305 $query = ' 306 DELETE FROM '.CADDIE_TABLE.' 299 307 WHERE element_id IN ( 300 308 '.wordwrap(implode(', ', $ids), 80, "\n").')
Note: See TracChangeset
for help on using the changeset viewer.