Ignore:
Timestamp:
Feb 11, 2012, 6:38:34 AM (12 years ago)
Author:
rvelices
Message:

rv_gmaps compatible with core version 2.4

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/rv_gmaps/trunk/mapl.php

    r8666 r13092  
    4949  $where_sql = rvm_bounds_to_sql( $page['box'] );
    5050
    51 $img_fields = ' i.id,i.tn_ext,i.name,i.path,i.lat,i.lon';
     51$img_fields = ' i.id';
    5252
    5353$was_flat = @$page['flat'];
    5454$page['flat']=true;
    5555rvm_build_section_items($img_fields, $where_sql, RVM_BUILD_HASH, $order_by);
     56$page['items']=array_keys($page['items']);
    5657if (!$was_flat) unset($page['flat']);
    5758
     
    6162{
    6263/* GENERATE THE CATEGORY LIST *************************************************/
    63 $where_sql = 'i.id IN ('.implode(',', array_keys($page['items']) ).')';
     64$where_sql = 'i.id IN ('.implode(',', $page['items'] ).')';
    6465$where_sql .= get_sql_condition_FandF(
    6566        array( 'forbidden_categories' => 'category_id' ),
     
    9596
    9697/* GENERATE THE TAG LIST ******************************************************/
    97 $tags = get_common_tags( array_keys($page['items']), $conf['content_tag_cloud_items_number'], null);
     98$tags = get_common_tags( $page['items'], $conf['content_tag_cloud_items_number'], null);
    9899$tags = add_level_to_tags($tags);
    99100function counter_compare($a, $b)
     
    145146  );
    146147
    147 foreach ($page['items'] as $img)
    148 {
    149   $img['file'] = basename( $img['path'] );
    150   $thumbnail_url = get_thumbnail_url($img);
     148$pictures = array();
     149if (count($page['items']) > 0)
     150{
     151  $rank_of = array_flip($page['items']);
     152
     153  $query = '
     154SELECT *
     155  FROM '.IMAGES_TABLE.'
     156  WHERE id IN ('.implode(',', $page['items']).')
     157;';
     158  $result = pwg_query($query);
     159  while ($row = pwg_db_fetch_assoc($result))
     160  {
     161    $row['rank'] = $rank_of[ $row['id'] ];
     162    $pictures[] = $row;
     163  }
     164  usort($pictures, 'rank_compare');
     165  unset($rank_of);
     166}
     167
     168foreach ($pictures as $img)
     169{
    151170  $page_url = duplicate_picture_url(
    152171        array(
     
    157176        array('start')
    158177      );
    159   if (!empty( $img['name'] ) )
    160     $title = $img['name'];
    161   else
    162     $title = str_replace('_', ' ', get_filename_wo_extension($img['file']));
    163 
    164   $template->append(
    165     'thumbnails',
    166     array(
    167       'TN_SRC'       => $thumbnail_url,
    168       'URL'  => $page_url,
    169       'TN_ALT'   => $img['file'],
    170       'TN_TITLE'   => $title,
    171       )
    172     );
    173 }
     178  $name = render_element_name($img);
     179  $desc = render_element_description($img);
     180
     181  $tpl_thumbnails_var[] = array_merge( $img, array(
     182                'NAME' => $name,
     183    'TN_ALT' => htmlspecialchars(strip_tags($name)),
     184    'TN_TITLE' => get_thumbnail_title($img, $name, $desc),
     185    'URL' => $page_url,
     186    'DESCRIPTION' => $desc,
     187    'src_image' => new SrcImage($img),
     188    ) );
     189}
     190$template->assign( array(
     191  'derivative_params' => ImageStdParams::get_by_type(IMG_THUMB),
     192  'SHOW_THUMBNAIL_CAPTION' => false,
     193        'thumbnails' => $tpl_thumbnails_var,
     194    ) );
     195$template->set_filename('index_thumbnails', 'thumbnails.tpl');
     196$template->assign_var_from_handle('THUMBNAILS', 'index_thumbnails');
    174197
    175198$title = $page['title'];
Note: See TracChangeset for help on using the changeset viewer.