Ignore:
Timestamp:
04/25/14 19:56:43 (5 years ago)
Author:
sarybe
Message:

[thumbnailtooltip] add dimensions and file size options

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/ThumbnailTooltip/include/class.inc.php

    r28210 r28262  
    3838      foreach($tpl_var as $cle=>$valeur) { 
    3939        $query = " 
    40                   SELECT name AS value1, hit AS value2, hit AS value3, comment AS value4, author AS value5, CONCAT('".l10n('Author').' : '."', author,'') AS value6, rating_score AS value7 
    41                   FROM ".IMAGES_TABLE." 
     40                  SELECT name, hit, comment, author, rating_score, CONCAT(width, 'x', height) AS dimensions, filesize FROM ".IMAGES_TABLE." 
    4241                  WHERE id = ".(int)$tpl_var[$cle]['id']." 
    4342                ;"; 
     
    4746        $details_param = array(); 
    4847           
    49         $details['tn_type1'] = $row['value1']; 
     48        $details['tn_type1'] = $row['name']; 
    5049 
    51         if (!empty($row['value2'])) { 
    52                   $details['tn_type2'] = $row['value2'].' '.strtolower(l10n('Visits')); 
     50        if (!empty($row['hit'])) { 
     51                  $details['tn_type2'] = $row['hit'].' '.strtolower(l10n('Visits')); 
     52                  $details['tn_type3'] = '('.$row['hit'].' '.strtolower(l10n('Visits')).')'; 
     53              if (!empty($row['rating_score'])) { $type8 = ', '.strtolower(l10n('Rating score')).' '.$row['rating_score']; } else { $type8 = ''; } 
     54                  $details['tn_type8'] = '('.$row['hit'].' '.strtolower(l10n('Visits')).$type8.')'; 
    5355        } 
    54         if (!empty($row['value3'])) { 
    55                   $details['tn_type3'] = '('.$row['value3'].' '.strtolower(l10n('Visits')).')'; 
    56             if (!empty($row['value7'])) { $type8 = ', '.strtolower(l10n('Rating score')).' '.$row['value7']; } else { $type8 = ''; } 
    57                   $details['tn_type8'] = '('.$row['value3'].' '.strtolower(l10n('Visits')).$type8.')'; 
     56        if (!empty($row['comment'])) { 
     57                  $details['tn_type4'] = $row['comment']; 
    5858        } 
    59         if (!empty($row['value4'])) { 
    60                   $details['tn_type4'] = $row['value4']; 
     59        if (!empty($row['author'])) { 
     60                  $details['tn_type5'] = $row['author']; 
    6161        } 
    62         if (!empty($row['value5'])) { 
    63                   $details['tn_type5'] = $row['value5']; 
     62        if (!empty($row['author'])) { 
     63                  $details['tn_type6'] = (preg_match('#(,|\/)#i', $row['author'])) ? str_replace(array('(',')'), '', ucfirst(l10n('author(s) : %s', $row['author']))) : l10n('Author').' : '.$row['author']; 
    6464        } 
    65         if (!empty($row['value6'])) { 
    66                   $details['tn_type6'] = $row['value6']; 
     65        if (!empty($row['rating_score'])) { 
     66                  $details['tn_type7'] = strtolower(l10n('Rating score')).' '.$row['rating_score']; 
    6767        } 
    68         if (!empty($row['value7'])) { 
    69                   $details['tn_type7'] = strtolower(l10n('Rating score')).' '.$row['value7']; 
     68        if (!empty($row['dimensions'])) { 
     69                  $details['tn_type9'] = l10n('Dimensions').' : '.$row['dimensions']; 
    7070        } 
     71                if (!empty($row['filesize'])) { 
     72                  if (($params['separator']=='1') && (!empty($details['tn_type9']))) { $details['tn_type9'].= ' - '; } elseif (($params['separator']!='1') && (!empty($details['tn_type9']))) { $details['tn_type9'].= ' '; } else { $details['tn_type9'] = ' '; }  
     73                  $details['tn_type9'].= l10n('Filesize').' : '.l10n('%d Kb', $row['filesize']);  
     74                } 
    7175                   
    7276        if ((!empty($details[$values['value1']])) && ($details[$values['value1']]!='none')) { $details_param[] = $details[$values['value1']]; } 
     
    97101        if ($params['display_author_cat']==true) { 
    98102      foreach($tpl_var as $cle=>$valeur) { 
    99         $query = "SELECT author FROM ".IMAGE_CATEGORY_TABLE." INNER JOIN ".IMAGES_TABLE." ON image_id = id WHERE category_id = ".(int)$tpl_var[$cle]['id']." LIMIT 1"; 
     103        $query = "SELECT author FROM ".IMAGE_CATEGORY_TABLE." INNER JOIN ".IMAGES_TABLE." ON image_id = id WHERE category_id = ".(int)$tpl_var[$cle]['id']." AND author<>'' GROUP BY author"; 
    100104            $result = pwg_query($query); 
    101105            $row = pwg_db_fetch_assoc($result); 
    102  
     106                 
     107                $auteur = ''; 
    103108            if (!empty($row['author'])) { 
    104               if (preg_match('#(,|\/)#i', $row['author'])) { $auteur = str_replace(array('(',')'), '', ucfirst(sprintf($lang['author(s) : %s'],$row['author']))); } else { $auteur = $lang['Author'].' : '.$row['author']; } 
     109                  do { 
     110                    $auteur .= $row['author'].', '; 
     111                  } while ($row = pwg_db_fetch_assoc($result)); 
     112                  $auteur = substr($auteur, 0, -2); 
     113              if (preg_match('#(,|\/)#i', $auteur )) { $auteur = str_replace(array('(',')'), '', ucfirst(sprintf($lang['author(s) : %s'], $auteur))); } else { $auteur = $lang['Author'].' : '.$auteur ; } 
    105114              if (!empty($tpl_var[$cle]['DESCRIPTION'])) { $tpl_var[$cle]['DESCRIPTION'] = $tpl_var[$cle]['DESCRIPTION'].'<br/>'.$auteur; } else { $tpl_var[$cle]['DESCRIPTION'] = $auteur; } 
    106115            } 
Note: See TracChangeset for help on using the changeset viewer.