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