Changeset 1051
- Timestamp:
- Feb 23, 2006, 3:30:19 AM (18 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/category.php
r1050 r1051 301 301 'special_cat', 302 302 array( 303 'URL' => PHPWG_ROOT_PATH.'category.php?ca t=calendar',303 'URL' => PHPWG_ROOT_PATH.'category.php?calendar=m-c', 304 304 'TITLE' => $lang['calendar_hint'], 305 305 'NAME' => $lang['calendar'] … … 401 401 ); 402 402 } 403 404 if ($page['cat_nb_images']>0 and 405 ( !isset($page['cat']) 406 or ($page['cat'] != 'most_visited' and $page['cat'] != 'best_rated') ) 407 ) 408 { 409 // image order 410 $template->assign_block_vars( 'preferred_image_order', array() ); 411 412 $order_idx = isset($_COOKIE['pwg_image_order']) ? 413 $_COOKIE['pwg_image_order'] : 0; 414 415 $orders = get_category_preferred_image_orders(); 416 for ( $i = 0; $i < count($orders); $i++) 417 { 418 if ($orders[$i][2]) 419 { 420 $url = PHPWG_ROOT_PATH.'category.php' 421 .get_query_string_diff(array('image_order')); 422 $url .= '&image_order='.$i; 423 $template->assign_block_vars( 'preferred_image_order.order', array( 424 'DISPLAY' => $orders[$i][0], 425 'URL' => $url, 426 'SELECTED_OPTION' => ($order_idx==$i ? 'SELECTED' : '' ), 427 ) ); 428 } 429 } 430 } 431 403 432 if ( isset ( $page['cat'] ) ) 404 433 { … … 423 452 ); 424 453 } 425 if ($page['cat_nb_images']>0 and426 $page['cat'] != 'most_visited' and $page['cat'] != 'best_rated')427 {428 // image order429 $template->assign_block_vars( 'preferred_image_order', array() );430 431 $order_idx = isset($_COOKIE['pwg_image_order']) ?432 $_COOKIE['pwg_image_order'] : 0;433 434 $orders = get_category_preferred_image_orders();435 for ( $i = 0; $i < count($orders); $i++)436 {437 if ($orders[$i][2])438 {439 $url = PHPWG_ROOT_PATH.'category.php'440 .get_query_string_diff(array('image_order'));441 $url .= '&image_order='.$i;442 $template->assign_block_vars( 'preferred_image_order.order', array(443 'DISPLAY' => $orders[$i][0],444 'URL' => $url,445 'SELECTED_OPTION' => ($order_idx==$i ? 'SELECTED' : '' ),446 ) );447 }448 }449 }450 454 } 451 455 //------------------------------------------------------------ log informations -
trunk/include/calendar_monthly.class.php
r1050 r1051 127 127 } 128 128 } 129 $res = " AND $this->date_field BETWEEN '$b' AND '$e '" . $res;129 $res = " AND $this->date_field BETWEEN '$b' AND '$e 23:59:59'" . $res; 130 130 } 131 131 else … … 236 236 $url_base = $this->url_base.'c-'.$requested[0].'-'.$month; 237 237 238 $nav_bar = '<span class="calCalHead"><a href="'.$url_base.'">'.$lang['month'][$month].'</a>'; 238 $nav_bar = '<span class="calCalHead"><a href="'.$url_base.'">'; 239 $nav_bar .= $lang['month'][$month].'</a>'; 239 240 $nav_bar .= ' ('.$month_data['nb_images'].')'; 240 241 $nav_bar .= '</span><br>'; 241 242 242 243 $url_base .= '-'; 243 $nav_bar .= $this->get_nav_bar_from_items( $url_base, $month_data['children'], $requested[1], 'calCal', false ); 244 $nav_bar .= $this->get_nav_bar_from_items( $url_base, 245 $month_data['children'], $requested[1], 'calCal', false ); 244 246 245 247 $template->assign_block_vars( 'calendar.calbar', … … 279 281 $query.= $this->inner_sql; 280 282 $query.= $this->get_date_where($requested); 283 $query.= ' 284 ORDER BY RAND() 285 LIMIT 0,1'; 281 286 282 287 $row = mysql_fetch_array(pwg_query($query)); … … 306 311 307 312 } 308 309 313 ?> -
trunk/include/calendar_weekly.class.php
r1050 r1051 73 73 { 74 74 $y = $requested[0]; 75 $res = " AND $this->date_field BETWEEN '$y-01-01' AND '$y-12-31 '";75 $res = " AND $this->date_field BETWEEN '$y-01-01' AND '$y-12-31 23:59:59'"; 76 76 } 77 77 -
trunk/include/functions_calendar.inc.php
r1050 r1051 232 232 $query .= $calendar->inner_sql; 233 233 $query .= $calendar->get_date_where($requested); 234 if ( isset($page['super_order_by']) ) 235 { 236 $query .= ' 237 '.$conf['order_by']; 238 } 239 else 240 { 241 $order_by = str_replace( 242 'ORDER BY ', 243 'ORDER BY '.$calendar->date_field.',', $conf['order_by'] 244 ); 245 $query .= $order_by; 246 } 234 247 235 248 $page['items'] = array_from_query($query, 'id'); -
trunk/include/section_init.inc.php
r1047 r1051 53 53 or $_GET['cat'] == 'best_rated' 54 54 or $_GET['cat'] == 'recent_pics' 55 or $_GET['cat'] == 'recent_cats' 56 or $_GET['cat'] == 'calendar') 55 or $_GET['cat'] == 'recent_cats') 57 56 { 58 57 $page['cat'] = $_GET['cat']; … … 98 97 $page['nb_image_page'] = $user['nb_image_page']; 99 98 99 if (isset($_COOKIE['pwg_image_order']) 100 and is_numeric($_COOKIE['pwg_image_order']) 101 and $_COOKIE['pwg_image_order'] > 0) 102 { 103 $orders = get_category_preferred_image_orders(); 104 105 $conf['order_by'] = str_replace( 106 'ORDER BY ', 107 'ORDER BY '.$orders[ $_COOKIE['pwg_image_order'] ][1].',', 108 $conf['order_by'] 109 ); 110 $page['super_order_by'] = true; 111 } 112 100 113 if (isset($page['cat'])) 101 114 { 102 if ($page['cat'] != 'most_visited' and $page['cat'] != 'best_rated') 103 { 104 if (isset($_COOKIE['pwg_image_order']) 105 and is_numeric($_COOKIE['pwg_image_order']) 106 and $_COOKIE['pwg_image_order'] > 0) 107 { 108 $orders = get_category_preferred_image_orders(); 109 110 $conf['order_by'] = str_replace( 111 'ORDER BY ', 112 'ORDER BY '.$orders[ $_COOKIE['pwg_image_order'] ][1].',', 113 $conf['order_by'] 114 ); 115 } 116 } 117 115 118 116 // +-----------------------------------------------------------------------+ 119 117 // | category | … … 121 119 if (is_numeric($page['cat'])) 122 120 { 123 $query = '124 SELECT image_id125 FROM '.IMAGE_CATEGORY_TABLE.'126 INNER JOIN '.IMAGES_TABLE.' ON id = image_id127 WHERE category_id = '.$page['cat'].'128 '.$conf['order_by'].'129 ;';130 131 121 $result = get_cat_info($page['cat']); 132 122 133 123 $page = array_merge( 134 124 $page, … … 143 133 'cat_id_uppercat' => $result['id_uppercat'], 144 134 'uppercats' => $result['uppercats'], 145 135 146 136 'title' => get_cat_display_name($result['name'], '', false), 147 'items' => array_from_query($query, 'image_id'), 148 'thumbnails_include' => 137 ) 138 ); 139 if ( !isset($_GET['calendar']) ) 140 { 141 $query = ' 142 SELECT image_id 143 FROM '.IMAGE_CATEGORY_TABLE.' 144 INNER JOIN '.IMAGES_TABLE.' ON id = image_id 145 WHERE category_id = '.$page['cat'].' 146 '.$conf['order_by'].' 147 ;'; 148 $page['items'] = array_from_query($query, 'image_id'); 149 $page['thumbnails_include'] = 149 150 $result['nb_images'] > 0 150 151 ? 'include/category_default.inc.php' 151 : 'include/category_subcats.inc.php', 152 ) 153 ); 152 : 'include/category_subcats.inc.php'; 153 }//otherwise the calendar will requery all subitems 154 154 } 155 155 // special section … … 256 256 else if ($page['cat'] == 'most_visited') 257 257 { 258 $page['super_order_by'] = true; 259 $conf['order_by'] = ' ORDER BY hit DESC, file ASC'; 258 260 $query = ' 259 261 SELECT DISTINCT(id) … … 261 263 INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id 262 264 WHERE hit > 0 263 AND '.$forbidden. '264 ORDER BY hit DESC, file ASC265 AND '.$forbidden. 266 $conf['order_by'].' 265 267 LIMIT 0, '.$conf['top_number'].' 266 268 ;'; … … 276 278 } 277 279 // +-----------------------------------------------------------------------+ 278 // | calendar section |279 // +-----------------------------------------------------------------------+280 else if ($page['cat'] == 'calendar')281 {282 $page['cat_nb_images'] = 0;283 $page['title'] = $lang['calendar'];284 if (isset($_GET['year'])285 and preg_match('/^\d+$/', $_GET['year']))286 {287 $page['calendar_year'] = (int)$_GET['year'];288 }289 if (isset($_GET['month'])290 and preg_match('/^(\d+)\.(\d{2})$/', $_GET['month'], $matches))291 {292 $page['calendar_year'] = (int)$matches[1];293 $page['calendar_month'] = (int)$matches[2];294 }295 if (isset($_GET['day'])296 and preg_match('/^(\d+)\.(\d{2})\.(\d{2})$/',297 $_GET['day'],298 $matches))299 {300 $page['calendar_year'] = (int)$matches[1];301 $page['calendar_month'] = (int)$matches[2];302 $page['calendar_day'] = (int)$matches[3];303 }304 if (isset($page['calendar_year']))305 {306 $page['title'] .= ' (';307 if (isset($page['calendar_day']))308 {309 if ($page['calendar_year'] >= 1970)310 {311 $unixdate = mktime(312 0,313 0,314 0,315 $page['calendar_month'],316 $page['calendar_day'],317 $page['calendar_year']318 );319 $page['title'].= $lang['day'][date("w", $unixdate)];320 }321 $page['title'].= ' '.$page['calendar_day'].', ';322 }323 if (isset($page['calendar_month']))324 {325 $page['title'] .= $lang['month'][$page['calendar_month']].' ';326 }327 $page['title'] .= $page['calendar_year'];328 $page['title'] .= ')';329 }330 331 $page['where'] = 'WHERE '.$conf['calendar_datefield'].' IS NOT NULL';332 if (isset($forbidden))333 {334 $page['where'].= ' AND '.$forbidden;335 }336 337 $page['thumbnails_include'] = 'include/category_calendar.inc.php';338 }339 // +-----------------------------------------------------------------------+340 280 // | best rated section | 341 281 // +-----------------------------------------------------------------------+ 342 282 else if ($page['cat'] == 'best_rated') 343 283 { 284 $page['super_order_by'] = true; 285 $conf['order_by'] = ' ORDER BY average_rate DESC, id ASC'; 286 344 287 $query =' 345 288 SELECT DISTINCT(id) … … 347 290 INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id 348 291 WHERE average_rate IS NOT NULL 349 AND '.$forbidden. '350 ORDER BY average_rate DESC, id ASC292 AND '.$forbidden. 293 $conf['order_by'].' 351 294 LIMIT 0, '.$conf['top_number'].' 352 295 ;'; -
trunk/picture.php
r1046 r1051 363 363 } 364 364 365 $url_up = PHPWG_ROOT_PATH.'category.php?cat='.$page['cat']; 365 $url_up = PHPWG_ROOT_PATH.'category.php?'; 366 if ( isset($page['cat']) ) 367 { 368 $url_up .= 'cat='.$page['cat']; 369 } 370 elseif ( isset($_GET['calendar']) ) 371 { 372 $url_up .= 'calendar='.$_GET['calendar']; 373 } 366 374 367 375 $url_up_start = floor( $page['current_rank'] / $user['nb_image_page'] ); … … 374 382 if ( $page['cat'] == 'search' ) 375 383 { 376 $url_up.= "&search=".$_GET['search'];384 $url_up.= '&search='.$_GET['search']; 377 385 } 378 386 if ( $page['cat'] == 'list' ) 379 387 { 380 $url_up.= "&list=".$_GET['list'];388 $url_up.= '&list='.$_GET['list']; 381 389 } 382 390 … … 778 786 if (!empty($picture['current']['date_creation'])) 779 787 { 780 $infos['INFO_CREATION_DATE'] = 781 // FIXME because of search engine partial rewrite, giving the author 782 // name threw GET is not supported anymore. This feature should come 783 // back later, with a better design (calendar view). 784 // '<a href="'. 785 // PHPWG_ROOT_PATH.'category.php?cat=search'. 786 // '&search=date_creation:'.$picture['current']['date_creation'] 787 // .'">'.format_date($picture['current']['date_creation']).'</a>'; 788 format_date($picture['current']['date_creation']); 788 $val = format_date($picture['current']['date_creation']); 789 if ( $conf['calendar_datefield'] == 'date_creation' ) 790 { 791 $infos['INFO_CREATION_DATE'] = '<a href="'. 792 PHPWG_ROOT_PATH.'category.php?calendar=c-'. 793 $picture['current']['date_creation'].'">'.$val.'</a>'; 794 } 795 else 796 { 797 $infos['INFO_CREATION_DATE'] = $val; 798 } 789 799 } 790 800 else … … 794 804 795 805 // date of availability 796 $infos['INFO_AVAILABILITY_DATE'] = 797 // FIXME because of search engine partial rewrite, giving the author 798 // name threw GET is not supported anymore. This feature should come 799 // back later, with a better design (calendar view). 800 // 801 // '<a href="'. 802 // PHPWG_ROOT_PATH.'category.php?cat=search'. 803 // '&search=date_available:'. 804 // substr($picture['current']['date_available'], 0, 10) 805 // .'">'. 806 // format_date($picture['current']['date_available'], 'mysql_datetime'). 807 // '</a>'; 808 format_date($picture['current']['date_available'], 'mysql_datetime'); 806 $val = format_date($picture['current']['date_available'], 'mysql_datetime'); 807 if ( $conf['calendar_datefield'] == 'date_available' ) 808 { 809 $infos['INFO_AVAILABILITY_DATE'] = '<a href="'. 810 PHPWG_ROOT_PATH.'category.php?calendar=c-'. 811 substr($picture['current']['date_available'],0,10).'">'.$val.'</a>'; 812 } 813 else 814 { 815 $infos['INFO_AVAILABILITY_DATE'] = $val; 816 } 809 817 810 818 // size in pixels -
trunk/template/yoga/category.tpl
r1050 r1051 132 132 133 133 <!-- BEGIN calendar_view --> 134 <li><a href="{calendar_view.URL}" title="{lang:calendar }"><img src="{themeconf:icon_dir}/calendar.png" class="button" alt="{lang:calendar}"></a></li>134 <li><a href="{calendar_view.URL}" title="{lang:calendar_hint}"><img src="{themeconf:icon_dir}/calendar.png" class="button" alt="{lang:calendar}"></a></li> 135 135 <!-- END calendar_view --> 136 136 <!-- BEGIN normal_view --> … … 144 144 145 145 <!-- BEGIN calendar --> 146 <div class="navigationBar">{calendar.YEARS_NAV_BAR}</div>147 <div class="navigationBar">{calendar.MONTHS_NAV_BAR}</div>148 <!-- END calendar -->149 150 <!-- BEGIN calendar -->151 152 146 <!-- BEGIN styles --> 153 147 <div class="calendarStyles">Style: {calendar.styles.BAR}</div>
Note: See TracChangeset
for help on using the changeset viewer.