0
|
1 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
|
2 <?xml-stylesheet type="text/xsl" href="modx.prosilver.en.xsl"?>
|
|
3 <!--For security purposes, please check: http://www.phpbb.com/mods/ for the
|
|
4 latest version of this MOD. Although MODs are checked before being
|
|
5 allowed in the MODs Database there is no guarantee that there are no
|
|
6 security problems within the MOD. No support will be given for MODs not
|
|
7 found within the MODs Database which can be found at
|
|
8 http://www.phpbb.com/mods/-->
|
|
9 <mod xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.phpbb.com/mods/xml/modx-1.2.1.xsd">
|
|
10
|
|
11 <header>
|
|
12 <license>http://opensource.org/licenses/gpl-license.php GNU General Public License v2</license>
|
|
13 <title lang="en-gb">User Rank Progression Bar</title>
|
|
14 <description lang="en-gb">This MOD will show a progress bar for each user, showing how far they have progressed towards the next rank in a rank set.</description>
|
|
15 <author-notes lang="en-gb"><![CDATA[This mod behaves in the same way as Smix's Rank Progress Bar mod, but has been rewritten for efficiency, additional features and compatibility with other mods. Thanks to Smix for writing the original and to youngjediknight for first pointing me to it.
|
|
16
|
|
17 If you don't want the progress bar to appear in all of the locations below (e.g. you just want it in a topic but not in PMs, profile view or members list) then just ignore the changes to the relevant template (.html) file.
|
|
18
|
|
19 Note: If you are also installing my "Multi-Race Rank Themes" MOD then install the other mod first and then this mod. Because the additional parameter to the get_user_rank function is optional for the Multi-Race Rank Themes mod it must be the last parameter in the list.]]></author-notes>
|
|
20 <author-group>
|
|
21 <author>
|
|
22 <realname>IBBoard</realname>
|
|
23 <email>phpbb@ibboard.co.uk</email>
|
|
24 <username>IBBoard</username>
|
|
25 <homepage>http://www.ibboard.co.uk</homepage>
|
|
26 </author>
|
|
27 </author-group>
|
|
28 <link-group>
|
|
29 <link type="contrib" href="contrib/SpecialAndNormalRanksIntegration.xml" lang="en-gb">Special and Normal Ranks MOD integration</link>
|
|
30 </link-group>
|
1
|
31 <mod-version>0.2</mod-version>
|
0
|
32 <installation>
|
|
33 <level>intermediate</level>
|
|
34 <time>600</time>
|
|
35 <target-version>3.0.5</target-version>
|
|
36 </installation>
|
|
37 <history>
|
|
38 <entry>
|
1
|
39 <date>2009-06-15</date>
|
|
40 <rev-version>0.2</rev-version>
|
|
41 <changelog lang="en-gb">
|
|
42 <change>Add: Add templating for Memberlist, profiles and PMs</change>
|
|
43 <change>Fix: Add missing lang value</change>
|
|
44 <change>Fix: Add extra checks to progress calculation to handle pre-existing values and the final rank in a scheme</change>
|
|
45 </changelog>
|
|
46 </entry>
|
|
47 <entry>
|
0
|
48 <date>2009-06-03</date>
|
|
49 <rev-version>0.1</rev-version>
|
|
50 <changelog lang="en-gb">
|
|
51 <change>Initial release - just puts progress bar on viewtopic page</change>
|
|
52 </changelog>
|
|
53 </entry>
|
|
54 </history>
|
|
55 </header>
|
|
56 <action-group>
|
|
57 <open src="includes/functions_display.php">
|
|
58 <edit>
|
|
59 <find><![CDATA[* @param string &$rank_img_src the rank image source is stored here after execution]]></find>
|
|
60 <action type="after-add"><![CDATA[* @param int &$percent_complete the percentage of the way a user is to the next rank, where -1 means "not applicable"]]></action>
|
|
61 </edit>
|
|
62 <edit>
|
|
63 <find><![CDATA[function get_user_rank($user_rank, $user_posts, &$rank_title, &$rank_img, &$rank_img_src)]]></find>
|
|
64 <inline-edit>
|
|
65 <inline-find>, &$rank_img_src</inline-find>
|
|
66 <inline-action type="after-add">, &$percent_complete</inline-action>
|
|
67 </inline-edit>
|
|
68 </edit>
|
|
69 <edit>
|
|
70 <find><![CDATA[ if (!empty($user_rank))]]></find>
|
1
|
71 <action type="before-add"><![CDATA[ if (!is_int($percent_complete) || $percent_complete < 0 || $percent_complete > 100)
|
0
|
72 {
|
|
73 $percent_complete = -1;
|
|
74 }]]></action>
|
|
75 </edit>
|
|
76 <edit>
|
|
77 <find><![CDATA[ else if ($user_posts !== false)
|
|
78 {]]></find>
|
|
79 <action type="after-add"><![CDATA[ $next_rank_post_count = -1;]]></action>
|
|
80 </edit>
|
|
81 <edit>
|
|
82 <find><![CDATA[ if ($user_posts >= $rank['rank_min'])]]></find>
|
|
83 <action type="before-add"><![CDATA[ if ($user_posts < $rank['rank_min'])
|
|
84 {
|
|
85 $next_rank_post_count = $rank['rank_min'];
|
|
86 }
|
|
87 else
|
|
88 ]]>
|
|
89 </action>
|
|
90 </edit>
|
|
91 <edit>
|
|
92 <find><![CDATA[ $rank_title = $rank['rank_title'];]]></find>
|
1
|
93 <action type="before-add"><![CDATA[ if ($percent_complete == -1 && $next_rank_post_count > -1)
|
0
|
94 {
|
|
95 $rank_difference = $next_rank_post_count - $rank['rank_min'];
|
|
96 $user_progress = $user_posts - $rank['rank_min'];
|
|
97 $percent_complete = round(($user_progress / $rank_difference) * 100);
|
|
98 }
|
|
99 ]]>
|
|
100 </action>
|
|
101 </edit>
|
|
102 </open>
|
|
103 <open src="includes/ucp/ucp_pm_viewmessage.php">
|
|
104 <edit>
|
2
|
105 <find><![CDATA[ 'RANK_IMG' => $user_info['rank_image'],]]></find>
|
|
106 <action type="after-add"><![CDATA[]]></action>
|
|
107 </edit>
|
|
108 <edit>
|
0
|
109 <find><![CDATA[get_user_rank($user_row['user_rank'], $user_row['user_posts'], $user_row['rank_title'], $user_row['rank_image'], $user_row['rank_image_src']);]]></find>
|
|
110 <inline-edit>
|
|
111 <inline-find>, $user_row['rank_image_src']</inline-find>
|
|
112 <inline-action type="after-add">, $user_row['percentage_progress']</inline-action>
|
|
113 </inline-edit>
|
|
114 </edit>
|
|
115 </open>
|
|
116 <open src="language/en/common.php">
|
|
117 <edit>
|
|
118 <find><![CDATA[?>]]></find>
|
|
119 <action type="before-add"><![CDATA[$lang = array_merge($lang, array(
|
1
|
120 'PERCENTAGE_PROGRESS' => '%s%%',
|
|
121 'PROGRESS_TO_NEXT_RANK' => 'Progress to next rank:'
|
0
|
122 ));
|
|
123 ]]></action>
|
|
124 </edit>
|
|
125 </open>
|
|
126 <open src="memberlist.php">
|
|
127 <edit>
|
|
128 <find><![CDATA[ get_user_rank($row['user_rank'], $row['user_posts'], $rank_title, $rank_img, $rank_img_src);]]></find>
|
|
129 <inline-edit>
|
|
130 <inline-find>$rank_img_src</inline-find>
|
|
131 <inline-action type="after-add"><![CDATA[, $percentage_progress]]></inline-action>
|
|
132 </inline-edit>
|
|
133 </edit>
|
|
134 <edit>
|
|
135 <find><![CDATA[ get_user_rank($data['user_rank'], (($user_id == ANONYMOUS) ? false : $data['user_posts']), $rank_title, $rank_img, $rank_img_src);]]></find>
|
|
136 <inline-edit>
|
|
137 <inline-find>$rank_img_src</inline-find>
|
|
138 <inline-action type="after-add"><![CDATA[, $percentage_progress]]></inline-action>
|
|
139 </inline-edit>
|
|
140 </edit>
|
1
|
141 <edit>
|
|
142 <find><![CDATA[ 'RANK_IMG_SRC' => $rank_img_src,]]></find>
|
|
143 <action type="after-add"><![CDATA[ 'PERCENTAGE_PROGRESS_NUM' => $percentage_progress,
|
|
144 'PERCENTAGE_PROGRESS' => sprintf($user->lang['PERCENTAGE_PROGRESS'], $percentage_progress),]]></action>
|
|
145 </edit>
|
|
146 </open>
|
|
147 <open src="styles/prosilver/template/memberlist_body.html">
|
|
148 <edit>
|
|
149 <find><![CDATA[<!-- IF memberrow.RANK_IMG --><span class="rank-img">{memberrow.RANK_IMG}</span><!-- ELSE --><span class="rank-img">{memberrow.RANK_TITLE}</span><!-- ENDIF -->]]></find>
|
|
150 <inline-action>
|
|
151 <inline-find><![CDATA[<!-- ENDIF -->]]></inline-find>
|
|
152 <inline-action type="after-add"><![CDATA[<!-- IF memberrow.PERCENTAGE_PROGRESS_NUM > -1 --><div class="rank_progress_bar" title="{L_PROGRESS_TO_NEXT_RANK}"><span style="width:{memberrow.PERCENTAGE_PROGRESS_NUM}%" class="bar"></span><span>{memberrow.PERCENTAGE_PROGRESS}</span></div><!-- ENDIF -->]]></action>
|
|
153 </inline-action>
|
|
154 </edit>
|
0
|
155 </open>
|
2
|
156 <open src="styles/prosilver/template/memberlist_view.html">
|
|
157 <edit>
|
|
158 <find><![CDATA[<!-- IF RANK_IMG --><dd style="text-align: center;">{RANK_IMG}</dd><!-- ENDIF -->]]></find>
|
|
159 <action type="after-add"><![CDATA[<!-- IF PERCENTAGE_PROGRESS_NUM > -1 --><dd>{L_PROGRESS_TO_NEXT_RANK}<div class="rank_progress_bar"><span style="width:{PERCENTAGE_PROGRESS_NUM}%" class="bar"></span><span>{PERCENTAGE_PROGRESS}</span></div></dd><!-- ENDIF -->]]></action>
|
|
160 </edit>
|
|
161 <edit>
|
|
162 <find><![CDATA[<!-- IF RANK_IMG --><dt><!-- IF RANK_TITLE --> <!-- ELSE -->{L_RANK}:<!-- ENDIF --></dt> <dd>{RANK_IMG}</dd><!-- ENDIF -->]]></find>
|
|
163 <action type="after-add"><![CDATA[<!-- IF PERCENTAGE_PROGRESS_NUM > -1 --><dt>{L_PROGRESS_TO_NEXT_RANK}</dt><dd><div class="rank_progress_bar"><span style="width:{PERCENTAGE_PROGRESS_NUM}%" class="bar"></span><span>{PERCENTAGE_PROGRESS}</span></div></dd><!-- ENDIF -->]]></action>
|
|
164 </edit>
|
|
165 </open>
|
|
166 <open src="styles/prosilver/template/ucp_pm_viewmessage.html">
|
|
167 <edit>
|
|
168 <find><![CDATA[ <!-- IF RANK_IMG --><dd>{RANK_IMG}</dd><!-- ENDIF -->]]></find>
|
|
169 <action type="after-add"><![CDATA[ <!-- IF PERCENTAGE_PROGRESS_NUM > -1 --><dd>{L_PROGRESS_TO_NEXT_RANK}<div class="rank_progress_bar"><span style="width:{PERCENTAGE_PROGRESS_NUM}%" class="bar"></span><span>{PERCENTAGE_PROGRESS}</span></div></dd><!-- ENDIF -->]]></action>
|
|
170 </edit>
|
|
171 </open>
|
0
|
172 <open src="styles/prosilver/template/viewtopic_body.html">
|
|
173 <edit>
|
|
174 <find><![CDATA[ <!-- IF postrow.RANK_TITLE or postrow.RANK_IMG --><dd>{postrow.RANK_TITLE}<!-- IF postrow.RANK_TITLE and postrow.RANK_IMG --><br /><!-- ENDIF -->{postrow.RANK_IMG}</dd><!-- ENDIF -->]]></find>
|
|
175 <action type="after-add"><![CDATA[ <!-- IF postrow.PERCENTAGE_PROGRESS_NUM > -1 --><dd>{L_PROGRESS_TO_NEXT_RANK}<div class="rank_progress_bar"><span style="width:{postrow.PERCENTAGE_PROGRESS_NUM}%" class="bar"></span><span>{postrow.PERCENTAGE_PROGRESS}</span></div></dd><!-- ENDIF -->]]>
|
|
176 </action>
|
|
177 </edit>
|
|
178 </open>
|
|
179 <open src="styles/prosilver/themes/common.css">
|
|
180 <edit>
|
|
181 <find><![CDATA[.clear {]]></find>
|
1
|
182 <action type="before-add"><![CDATA[.rank_progress_bar {
|
|
183 border: 1px solid #b4bac0;
|
|
184 margin-right: 1em;
|
|
185 position: relative;
|
|
186 clear:right
|
|
187 }
|
|
188 .rank_progress_bar span {
|
|
189 z-index:2;
|
|
190 position:relative
|
|
191 }
|
|
192 .rank_progress_bar .bar {
|
|
193 background-color: #fff;
|
|
194 border-right: 1px solid #b4bac0;
|
|
195 display:block;
|
|
196 height: 100%;
|
|
197 z-index:1;
|
|
198 position:absolute;
|
|
199 top: 0;
|
|
200 left: 0
|
|
201 }]]></action>
|
0
|
202 </edit>
|
|
203 </open>
|
|
204 <open src="viewtopic.php">
|
|
205 <edit>
|
|
206 <find><![CDATA[get_user_rank($row['user_rank'], false, $user_cache[$poster_id]['rank_title'], $user_cache[$poster_id]['rank_image'], $user_cache[$poster_id]['rank_image_src']);]]></find>
|
|
207 <inline-edit>
|
|
208 <inline-find>$user_cache[$poster_id]['rank_image_src']</inline-find>
|
|
209 <inline-action type="after-add"><![CDATA[, $user_cache[$poster_id]['percentage_progress']]]></inline-action>
|
|
210 </inline-edit>
|
|
211 </edit>
|
|
212 <edit>
|
|
213 <find><![CDATA[get_user_rank($row['user_rank'], $row['user_posts'], $user_cache[$poster_id]['rank_title'], $user_cache[$poster_id]['rank_image'], $user_cache[$poster_id]['rank_image_src']);]]></find>
|
|
214 <inline-edit>
|
|
215 <inline-find>$user_cache[$poster_id]['rank_image_src']</inline-find>
|
|
216 <inline-action type="after-add"><![CDATA[, $user_cache[$poster_id]['percentage_progress']]]></inline-action>
|
|
217 </inline-edit>
|
|
218 </edit>
|
|
219 <edit>
|
|
220 <find><![CDATA[ 'joined' => '',]]></find>
|
|
221 <action type="before-add"><![CDATA[
|
|
222 'percentage_progress' => -1,]]></action>
|
|
223 </edit>
|
|
224 <edit>
|
|
225 <find><![CDATA[ 'joined' => $user->format_date($row['user_regdate']),]]></find>
|
|
226 <action type="before-add"><![CDATA[
|
|
227 'percentage_progress' => -1,]]></action>
|
|
228 </edit>
|
|
229 <edit>
|
|
230 <find><![CDATA[ 'RANK_IMG_SRC' => $user_cache[$poster_id]['rank_image_src'],]]></find>
|
|
231 <action type="after-add"><![CDATA[
|
|
232 'PERCENTAGE_PROGRESS_NUM' => $user_cache[$poster_id]['percentage_progress'],
|
|
233 'PERCENTAGE_PROGRESS' => sprintf($user->lang['PERCENTAGE_PROGRESS'], $user_cache[$poster_id]['percentage_progress']),]]></action>
|
|
234 </edit>
|
|
235 </open>
|
|
236 </action-group>
|
|
237 </mod>
|