[30631] | 1 | <?php |
---|
| 2 | |
---|
| 3 | //Ajout du prefiltre |
---|
[30702] | 4 | add_event_handler('loc_begin_picture', 'add_info_photo_pre', 05); |
---|
[30631] | 5 | |
---|
| 6 | function add_info_photo_pre() { |
---|
| 7 | global $template; |
---|
| 8 | $template->set_prefilter('picture', 'add_info_photo_preT'); |
---|
| 9 | } |
---|
| 10 | |
---|
| 11 | function add_info_photo_preT($content, &$smarty) { |
---|
| 12 | |
---|
| 13 | global $conf; |
---|
[30637] | 14 | |
---|
| 15 | $search = '/(<dl id="standard" class="imageInfoTable">).*({if isset\(\$metadata\)})/is'; |
---|
[30631] | 16 | |
---|
[30637] | 17 | $repla='<dl id="standard" class="imageInfoTable">{strip} |
---|
[30631] | 18 | {foreach from=$add_info_photos item=addinfophotos} |
---|
| 19 | {if $addinfophotos.AIPID == 1 and isset($INFO_AUTHOR)} |
---|
| 20 | <div id="Author" class="imageInfo"> |
---|
| 21 | <dt>{\'Author\'|@translate}</dt> |
---|
| 22 | <dd>{$INFO_AUTHOR}</dd> |
---|
| 23 | </div> |
---|
| 24 | {else if $addinfophotos.AIPID == 2 and isset($INFO_CREATION_DATE)} |
---|
| 25 | <div id="datecreate" class="imageInfo"> |
---|
| 26 | <dt>{\'Created on\'|@translate}</dt> |
---|
| 27 | <dd>{$INFO_CREATION_DATE}</dd> |
---|
| 28 | </div> |
---|
| 29 | {else if $addinfophotos.AIPID == 3 and isset($INFO_CREATION_DATE)} |
---|
| 30 | <div id="datepost" class="imageInfo"> |
---|
| 31 | <dt>{\'Posted on\'|@translate}</dt> |
---|
| 32 | <dd>{$INFO_POSTED_DATE}</dd> |
---|
| 33 | </div> |
---|
| 34 | {else if $addinfophotos.AIPID == 4 and isset($INFO_DIMENSIONS)} |
---|
| 35 | <div id="Dimensions" class="imageInfo"> |
---|
| 36 | <dt>{\'Dimensions\'|@translate}</dt> |
---|
| 37 | <dd>{$INFO_DIMENSIONS}</dd> |
---|
| 38 | </div> |
---|
| 39 | {else if $addinfophotos.AIPID == 5} |
---|
| 40 | <div id="File" class="imageInfo"> |
---|
| 41 | <dt>{\'File\'|@translate}</dt> |
---|
| 42 | <dd>{$INFO_FILE}</dd> |
---|
| 43 | </div> |
---|
| 44 | {else if $addinfophotos.AIPID == 6 and isset($INFO_FILESIZE)} |
---|
| 45 | <div id="Filesize" class="imageInfo"> |
---|
| 46 | <dt>{\'Filesize\'|@translate}</dt> |
---|
| 47 | <dd>{$INFO_FILESIZE}</dd> |
---|
| 48 | </div> |
---|
[30642] | 49 | {else if $addinfophotos.AIPID == 7 and isset($related_tags)} |
---|
[30703] | 50 | <div id="Tags" class="imageInfo"> |
---|
[30631] | 51 | <dt>{\'Tags\'|@translate}</dt> |
---|
| 52 | <dd> |
---|
| 53 | {foreach from=$related_tags item=tag name=tag_loop}{if !$smarty.foreach.tag_loop.first}, {/if}<a href="{$tag.URL}">{$tag.name}</a>{/foreach} |
---|
| 54 | </dd> |
---|
| 55 | </div> |
---|
| 56 | {else if $addinfophotos.AIPID == 8 and isset($related_categories)} |
---|
| 57 | <div id="Categories" class="imageInfo"> |
---|
| 58 | <dt>{\'Albums\'|@translate}</dt> |
---|
| 59 | <dd> |
---|
| 60 | <ul> |
---|
| 61 | {foreach from=$related_categories item=cat} |
---|
| 62 | <li>{$cat}</li> |
---|
| 63 | {/foreach} |
---|
| 64 | </ul> |
---|
| 65 | </dd> |
---|
| 66 | </div> |
---|
| 67 | {else if $addinfophotos.AIPID == 9} |
---|
| 68 | <div id="Visits" class="imageInfo"> |
---|
| 69 | <dt>{\'Visits\'|@translate}</dt> |
---|
| 70 | <dd>{$INFO_VISITS}</dd> |
---|
| 71 | </div> |
---|
| 72 | {else if $addinfophotos.AIPID == 10 and isset($rate_summary)} |
---|
| 73 | <div id="Average" class="imageInfo"> |
---|
| 74 | <dt>{\'Rating score\'|@translate}</dt> |
---|
| 75 | <dd> |
---|
| 76 | {if $rate_summary.count} |
---|
| 77 | <span id="ratingScore">{$rate_summary.score}</span> <span id="ratingCount">({$rate_summary.count|@translate_dec:\'%d rate\':\'%d rates\'})</span> |
---|
| 78 | {else} |
---|
| 79 | <span id="ratingScore">{\'no rate\'|@translate}</span> <span id="ratingCount"></span> |
---|
| 80 | {/if} |
---|
| 81 | </dd> |
---|
| 82 | </div> |
---|
| 83 | {if isset($rating)} |
---|
| 84 | <div id="rating" class="imageInfo"> |
---|
| 85 | <dt> |
---|
| 86 | <span id="updateRate">{if isset($rating.USER_RATE)}{\'Update your rating\'|@translate}{else}{\'Rate this photo\'|@translate}{/if}</span> |
---|
| 87 | </dt> |
---|
| 88 | <dd> |
---|
| 89 | <form action="{$rating.F_ACTION}" method="post" id="rateForm" style="margin:0;"> |
---|
| 90 | <div> |
---|
| 91 | {foreach from=$rating.marks item=mark name=rate_loop} |
---|
| 92 | {if isset($rating.USER_RATE) && $mark==$rating.USER_RATE} |
---|
| 93 | <input type="button" name="rate" value="{$mark}" class="rateButtonSelected" title="{$mark}"> |
---|
| 94 | {else} |
---|
| 95 | <input type="submit" name="rate" value="{$mark}" class="rateButton" title="{$mark}"> |
---|
| 96 | {/if} |
---|
| 97 | {/foreach} |
---|
| 98 | {strip}{combine_script id=\'core.scripts\' load=\'async\' path=\'themes/default/js/scripts.js\'} |
---|
| 99 | {combine_script id=\'rating\' load=\'async\' require=\'core.scripts\' path=\'themes/default/js/rating.js\'} |
---|
| 100 | {footer_script} |
---|
| 101 | var _pwgRatingAutoQueue = _pwgRatingAutoQueue||[]; |
---|
| 102 | _pwgRatingAutoQueue.push( {ldelim}rootUrl: \'{$ROOT_URL}\', image_id: {$current.id}, |
---|
| 103 | onSuccess : function(rating) {ldelim} |
---|
| 104 | var e = document.getElementById("updateRate"); |
---|
| 105 | if (e) e.innerHTML = "{\'Update your rating\'|@translate|@escape:\'javascript\'}"; |
---|
| 106 | e = document.getElementById("ratingScore"); |
---|
| 107 | if (e) e.innerHTML = rating.score; |
---|
| 108 | e = document.getElementById("ratingCount"); |
---|
| 109 | if (e) {ldelim} |
---|
| 110 | if (rating.count == 1) {ldelim} |
---|
| 111 | e.innerHTML = "({\'%d rate\'|@translate|@escape:\'javascript\'})".replace( "%d", rating.count); |
---|
| 112 | } else {ldelim} |
---|
| 113 | e.innerHTML = "({\'%d rates\'|@translate|@escape:\'javascript\'})".replace( "%d", rating.count); |
---|
| 114 | } |
---|
| 115 | {rdelim} |
---|
| 116 | {rdelim}{rdelim} ); |
---|
| 117 | {/footer_script} |
---|
| 118 | {/strip} |
---|
| 119 | </div> |
---|
| 120 | </form> |
---|
| 121 | </dd> |
---|
| 122 | </div> |
---|
| 123 | {/if} |
---|
| 124 | {else if $addinfophotos.AIPID == 11 and $display_info.privacy_level and isset($available_permission_levels)} |
---|
| 125 | <div id="Privacy" class="imageInfo"> |
---|
| 126 | <dt>{\'Who can see this photo?\'|@translate}</dt> |
---|
| 127 | <dd> |
---|
| 128 | <div> |
---|
| 129 | <a id="privacyLevelLink" href>{$available_permission_levels[$current.level]}</a> |
---|
| 130 | </div> |
---|
| 131 | {combine_script id=\'core.scripts\' load=\'async\' path=\'themes/default/js/scripts.js\'} |
---|
| 132 | {footer_script require=\'jquery\'}{strip} |
---|
| 133 | function setPrivacyLevel(id, level){ |
---|
| 134 | (new PwgWS(\'{$ROOT_URL}\')).callService( |
---|
| 135 | "pwg.images.setPrivacyLevel", { image_id:id, level:level}, |
---|
| 136 | { |
---|
| 137 | method: "POST", |
---|
| 138 | onFailure: function(num, text) { alert(num + " " + text); }, |
---|
| 139 | onSuccess: function(result) { |
---|
| 140 | jQuery(\'#privacyLevelBox .switchCheck\').css(\'visibility\',\'hidden\'); |
---|
| 141 | jQuery(\'#switchLevel\'+level).prev(\'.switchCheck\').css(\'visibility\',\'visible\'); |
---|
| 142 | jQuery(\'#privacyLevelLink\').text(jQuery(\'#switchLevel\'+level).text()); |
---|
| 143 | } |
---|
| 144 | } |
---|
| 145 | ); |
---|
| 146 | } |
---|
| 147 | (SwitchBox=window.SwitchBox||[]).push("#privacyLevelLink", "#privacyLevelBox"); |
---|
| 148 | {/strip}{/footer_script} |
---|
| 149 | <div id="privacyLevelBox" class="switchBox" style="display:none"> |
---|
| 150 | {foreach from=$available_permission_levels item=label key=level} |
---|
| 151 | <span class="switchCheck"{if $level != $current.level} style="visibility:hidden"{/if}>✔ </span> |
---|
| 152 | <a id="switchLevel{$level}" href="javascript:setPrivacyLevel({$current.id},{$level})">{$label}</a><br> |
---|
| 153 | {/foreach} |
---|
| 154 | </div> |
---|
| 155 | </dd> |
---|
| 156 | </div> |
---|
| 157 | {else if $addinfophotos.AIPDATA} |
---|
[30702] | 158 | <div id="add_info" class="imageInfo"> |
---|
| 159 | <dt class="label">{$addinfophotos.AIPWORDING}</dt> |
---|
[30631] | 160 | <dd class="value">{$addinfophotos.AIPDATA}</dd> |
---|
| 161 | </div> |
---|
| 162 | {/if} |
---|
| 163 | {/foreach} |
---|
| 164 | {/strip} |
---|
[30637] | 165 | </dl> |
---|
| 166 | {if isset($metadata)} |
---|
[30631] | 167 | '; |
---|
[30637] | 168 | |
---|
| 169 | return preg_replace($search, $repla , $content); |
---|
[30631] | 170 | |
---|
| 171 | } |
---|
| 172 | |
---|
| 173 | add_event_handler('loc_begin_picture', 'add_InfoT'); |
---|
| 174 | |
---|
| 175 | function add_InfoT() { |
---|
| 176 | global $conf, $page, $template; |
---|
| 177 | |
---|
| 178 | if (!empty($page['image_id'])) { |
---|
| 179 | $PAED = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'ExtendedDescription';")); |
---|
| 180 | if ($PAED['state'] == 'active') |
---|
| 181 | add_event_handler('AP_render_content', 'get_user_language_desc'); |
---|
| 182 | |
---|
| 183 | $tab_add_info_one_photo = tab_add_info_by_photo_show(); |
---|
| 184 | |
---|
| 185 | if (pwg_db_num_rows($tab_add_info_one_photo)) { |
---|
| 186 | while ($info_photos = pwg_db_fetch_assoc($tab_add_info_one_photo)) { |
---|
| 187 | |
---|
[30702] | 188 | $d = data_info_photos($page['image_id'], $info_photos['id_prop_pho']); |
---|
[30631] | 189 | $row = pwg_db_fetch_assoc($d); |
---|
| 190 | |
---|
| 191 | $items = array( |
---|
[30702] | 192 | 'AIPID' => $info_photos['id_prop_pho'], |
---|
| 193 | 'AIPORDER' => $info_photos['orderprop'], |
---|
| 194 | 'AIPWORDING' => trigger_change('AP_render_content', $info_photos['wording']), |
---|
[30631] | 195 | 'AIPDATA' => trigger_change('AP_render_content', $row['data']), |
---|
| 196 | ); |
---|
| 197 | |
---|
| 198 | $template->append('add_info_photos', $items); |
---|
| 199 | } |
---|
| 200 | } |
---|
| 201 | |
---|
| 202 | $template->assign( |
---|
| 203 | array( |
---|
| 204 | 'A' => 'a' |
---|
| 205 | )); |
---|
| 206 | } |
---|
| 207 | } |
---|
| 208 | |
---|
| 209 | ?> |
---|