Changeset 1549 for trunk/include/functions_notification.inc.php
- Timestamp:
- Sep 19, 2006, 12:51:09 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions_notification.inc.php
r1432 r1549 128 128 list($count) = mysql_fetch_array(pwg_query($query)); 129 129 return $count; 130 130 131 131 break; 132 132 case 'info': … … 153 153 } 154 154 155 $query = 'SELECT distinct '.implode(', ', $fields).' 155 $query = 'SELECT distinct '.implode(', ', $fields).' 156 156 '.$query; 157 157 $result = pwg_query($query); 158 158 159 159 $infos = array(); 160 160 161 161 while ($row = mysql_fetch_array($result)) 162 162 { … … 346 346 347 347 /** 348 * Formats a news line and adds it to the array (e.g. '5 new elements') 349 */ 350 function add_news_line(&$news, $count, $format, $url='', $add_url=false) 351 { 352 if ($count > 0) 353 { 354 $line = sprintf($format, $count); 355 if ($add_url and !empty($url) ) 356 { 357 $line = '<a href="'.$url.'">'.$line.'</a>'; 358 } 359 array_push($news, $line); 360 } 361 } 362 363 /** 348 364 * What's new between two dates ? 349 365 * … … 355 371 * @param string start date (mysql datetime format) 356 372 * @param string end date (mysql datetime format) 373 * @param bool exclude_img_cats if true, no info about new images/categories 374 * @param bool add_url add html A link around news 357 375 * 358 376 * @return array of news 359 377 */ 360 function news($start, $end )378 function news($start, $end, $exclude_img_cats=false, $add_url=false) 361 379 { 362 380 $news = array(); 363 381 364 $nb_new_comments = nb_new_comments($start, $end); 365 if ($nb_new_comments > 0) 366 { 367 array_push($news, sprintf(l10n('%d new comments'), $nb_new_comments)); 368 } 369 370 $nb_new_elements = nb_new_elements($start, $end); 371 if ($nb_new_elements > 0) 372 { 373 array_push($news, sprintf(l10n('%d new elements'), $nb_new_elements)); 374 } 375 376 $nb_updated_categories = nb_updated_categories($start, $end); 377 if ($nb_updated_categories > 0) 378 { 379 array_push($news, sprintf(l10n('%d categories updated'), 380 $nb_updated_categories)); 381 } 382 382 if (!$exclude_img_cats) 383 { 384 $nb_new_elements = nb_new_elements($start, $end); 385 if ($nb_new_elements > 0) 386 { 387 array_push($news, sprintf(l10n('%d new elements'), $nb_new_elements)); 388 } 389 } 390 391 if (!$exclude_img_cats) 392 { 393 $nb_updated_categories = nb_updated_categories($start, $end); 394 if ($nb_updated_categories > 0) 395 { 396 array_push($news, sprintf(l10n('%d categories updated'), 397 $nb_updated_categories)); 398 } 399 } 400 401 add_news_line( $news, 402 nb_new_comments($start, $end), l10n('%d new comments'), 403 get_root_url().'comments.php', $add_url ); 404 383 405 if (is_admin()) 384 406 { 385 $nb_unvalidated_comments = nb_unvalidated_comments($end); 386 if ($nb_unvalidated_comments > 0) 387 { 388 array_push($news, sprintf(l10n('%d comments to validate'), 389 $nb_unvalidated_comments)); 390 } 391 392 $nb_new_users = nb_new_users($start, $end); 393 if ($nb_new_users > 0) 394 { 395 array_push($news, sprintf(l10n('%d new users'), $nb_new_users)); 396 } 397 398 $nb_waiting_elements = nb_waiting_elements(); 399 if ($nb_waiting_elements > 0) 400 { 401 array_push( 402 $news, 403 sprintf( 404 l10n('%d waiting elements'), 405 $nb_waiting_elements 406 ) 407 ); 408 } 407 add_news_line( $news, 408 nb_unvalidated_comments($end), l10n('%d comments to validate'), 409 get_root_url().'admin.php?page=comments', $add_url ); 410 411 add_news_line( $news, 412 nb_new_users($start, $end), l10n('%d new users'), 413 PHPWG_ROOT_PATH.'admin.php?page=user_list', $add_url ); 414 415 add_news_line( $news, 416 nb_waiting_elements(), l10n('%d waiting elements'), 417 PHPWG_ROOT_PATH.'admin.php?page=waiting', $add_url ); 409 418 } 410 419
Note: See TracChangeset
for help on using the changeset viewer.