Changeset 7482 for extensions/GMaps/gmaps_pip.class.inc.php
- Timestamp:
- Oct 29, 2010, 4:16:18 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/GMaps/gmaps_pip.class.inc.php
r7479 r7482 103 103 global $page, $prefixeTable, $template, $user, $conf; 104 104 105 if($page['section']=='categories' )105 if($page['section']=='categories' or $page['section']=='tags') 106 106 { 107 107 if(isset($page['category'])) … … 109 109 $this->category['id']=$page['category']['id']; 110 110 $this->buildMapList($page['category']['id'], 'C'); 111 $sqlCatRestrict="AND FIND_IN_SET(".$page['category']['id'].", pct.uppercats)!=0";112 }113 else114 {115 $this->category['id']=0;116 $this->buildMapList(0, 'C');117 $sqlCatRestrict="";118 }119 120 if(count($this->maps)>0)121 {122 $scripts=array();123 111 124 112 // check if there is picture with gps tag in the selected category … … 132 120 AND (paut.tagId = 'magic.GPS.LatitudeNum' OR paut.tagId = 'magic.GPS.LongitudeNum') 133 121 AND pic.image_id IS NOT NULL 134 $sqlCatRestrict122 AND FIND_IN_SET(".$page['category']['id'].", pct.uppercats)!=0 135 123 GROUP BY paut.tagId"; 124 } 125 elseif(isset($page['items'])) 126 { 127 if(count($page['items'])==0) return(false); 128 // 'tags' 129 $sql="SELECT paut.tagId, MAX(CAST(pait.value AS DECIMAL(20,17))) AS maxValue, MIN(CAST(pait.value AS DECIMAL(20,17))) AS minValue 130 FROM ".$prefixeTable."amd_images_tags pait 131 LEFT JOIN ".$prefixeTable."amd_used_tags paut ON pait.numId = paut.numId 132 WHERE (paut.tagId = 'magic.GPS.LatitudeNum' OR paut.tagId = 'magic.GPS.LongitudeNum') 133 AND pait.imageId IN (".implode(',', $page['items']).") 134 GROUP BY paut.tagId"; 135 $this->category['id']=0; 136 $this->buildMapList(0, 'C'); 137 } 138 else 139 { 140 // 'home' 141 $this->category['id']=0; 142 $this->buildMapList(0, 'C'); 143 // check if there is picture with gps tag in the selected category 144 $sql="SELECT paut.tagId, MAX(CAST(pait.value AS DECIMAL(20,17))) AS maxValue, MIN(CAST(pait.value AS DECIMAL(20,17))) AS minValue 145 FROM (((".USER_CACHE_CATEGORIES_TABLE." pucc 146 LEFT JOIN ".CATEGORIES_TABLE." pct ON pucc.cat_id = pct.id) 147 LEFT JOIN ".IMAGE_CATEGORY_TABLE." pic ON pic.category_id = pucc.cat_id) 148 LEFT JOIN ".$prefixeTable."amd_images_tags pait ON pait.imageId = pic.image_id) 149 LEFT JOIN ".$prefixeTable."amd_used_tags paut ON pait.numId = paut.numId 150 WHERE pucc.user_id = '".$user['id']."' 151 AND (paut.tagId = 'magic.GPS.LatitudeNum' OR paut.tagId = 'magic.GPS.LongitudeNum') 152 AND pic.image_id IS NOT NULL 153 GROUP BY paut.tagId"; 154 } 155 156 if(count($this->maps)>0) 157 { 158 $scripts=array(); 136 159 137 160 $result=pwg_query($sql); … … 256 279 257 280 if($this->picture['geolocated']==false and $this->picture['forceDisplay']==false) return(false); 258 259 281 if(isset($this->picture['content']['MP']) and count($this->picture['content']['MP'])>0) 260 282 { … … 340 362 public function preparePictureMaps($jpegMD) 341 363 { 342 global $template, $page ;364 global $template, $page, $user; 343 365 344 366 $isGeolocated=true; 345 367 346 368 if(is_null($jpegMD->getTag('magic.GPS.LatitudeNum')) or 347 is_null($jpegMD->getTag('magic.GPS.LongitudeNum')) or 348 $page['section']!='categories') $isGeolocated=false; 369 is_null($jpegMD->getTag('magic.GPS.LongitudeNum'))) $isGeolocated=false; 349 370 350 371 … … 355 376 else 356 377 { 357 $this->buildMapList(0, 'P'); 378 $sql="SELECT GROUP_CONCAT(pict.category_id) 379 FROM ".IMAGE_CATEGORY_TABLE." pict 380 WHERE pict.image_id=".$page['image_id']; 381 if($user['forbidden_categories']!='') $sql.=" AND pict.category_id NOT IN (".$user['forbidden_categories'].")"; 382 383 $result=pwg_query($sql); 384 if($result) 385 { 386 while($row=pwg_db_fetch_row($result)) 387 { 388 $cats=explode(',', $row[0]); 389 } 390 } 391 392 $cats[]=0; 393 $i=0; 394 while(count($this->maps)==0 and $i<count($cats)) 395 { 396 $this->buildMapList($cats[$i], 'P'); 397 $i++; 398 } 358 399 } 359 400
Note: See TracChangeset
for help on using the changeset viewer.