Ignore:
Timestamp:
Apr 14, 2014, 5:18:27 PM (11 years ago)
Author:
sarybe
Message:

[thumbnailTooltip] Add author in categories. Modify 4 variables in languages files. Need help for translation. Thanks in advance

File:
1 edited

Legend:

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

    r27645 r28174  
    1414  function initialize_event_handler() {
    1515    add_event_handler('loc_end_index_thumbnails', array($this, 'thumbnail_tooltip_affich'), 50, 2);
     16    add_event_handler('loc_end_index_category_thumbnails', array($this, 'Author_Description_affich'), 50, 2);
    1617  }
    1718
     
    9293    return $tpl_var;
    9394  }
     95 
     96 
     97  function Author_Description_affich($tpl_var) {
     98    global $user;
     99
     100        $query = 'SELECT param, value, comment FROM ' . CONFIG_TABLE . ' WHERE param="thumbnail_tooltip";';
     101        $row = pwg_db_fetch_assoc( pwg_query($query) );
     102 
     103    $params = unserialize($row['value']);
     104        $values = array('DISPLAY_AUTHOR_CAT' => $params['display_author_cat']);
     105       
     106        if ($params['display_author_cat']==true) {
     107      foreach($tpl_var as $cle=>$valeur) {
     108        $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";
     109            $result = pwg_query($query);
     110            $row = pwg_db_fetch_assoc($result);
     111            $auteur = '';
     112            if (!empty($row['author'])) {
     113              if (preg_match('#(,|\/)#i', $row['author'])) { $s = 's'; } else { $s = ''; }
     114              if (!empty($tpl_var[$cle]['DESCRIPTION'])) { $tpl_var[$cle]['DESCRIPTION'] = $tpl_var[$cle]['DESCRIPTION'].'<br/>Auteur'.$s.' : '.$row['author']; } else { $tpl_var[$cle]['DESCRIPTION'] = 'Auteur'.$s.' : '.$row['author']; }
     115            }
     116      }
     117    }
     118    return $tpl_var;
     119  }
    94120}
    95121?>
Note: See TracChangeset for help on using the changeset viewer.