Révision 13c3c9b4
Ajouté par Assos Assos il y a environ 9 ans
drupal7/sites/all/modules/advanced_forum/includes/theme.inc | ||
---|---|---|
5 | 5 |
* Holds theme functions and template preprocesses. |
6 | 6 |
* Other style related functions are in style.inc |
7 | 7 |
*/ |
8 |
// THEME FUNCTIONS **********************************************************/ |
|
9 | 8 |
|
10 | 9 |
/** |
11 | 10 |
* Theme function to display a link, optionally buttonized. |
... | ... | |
29 | 28 |
$options['attributes']['class'][] = "af-button-$button_class"; |
30 | 29 |
} |
31 | 30 |
$options['html'] = TRUE; |
31 |
// @codingStandardsIgnoreStart |
|
32 | 32 |
$l = l('<span>' . $text . '</span>', $path, $options); |
33 |
// @codingStandardsIgnoreEnd |
|
33 | 34 |
} |
34 | 35 |
else { |
35 | 36 |
// Standard link: just send it through l(). |
... | ... | |
56 | 57 |
'text' => t('New @node_type', array('@node_type' => $item['name'])), |
57 | 58 |
'path' => $item['href'], |
58 | 59 |
'options' => NULL, |
59 |
'button_class' => 'large' |
|
60 |
));
|
|
60 |
'button_class' => 'large',
|
|
61 |
)); |
|
61 | 62 |
$output .= '</div>'; |
62 | 63 |
} |
63 | 64 |
} |
... | ... | |
101 | 102 |
'text' => $reply_link['title'], |
102 | 103 |
'path' => $reply_link['href'], |
103 | 104 |
'options' => $reply_link['options'], |
104 |
'button_class' => 'large' |
|
105 |
'button_class' => 'large',
|
|
105 | 106 |
)); |
106 | 107 |
$output .= '</div>'; |
107 | 108 |
return $output; |
... | ... | |
120 | 121 |
/** |
121 | 122 |
* Theme function to a formatted list of subforums. |
122 | 123 |
* |
123 |
* @param $subforum_list
|
|
124 |
* @param array $variables
|
|
124 | 125 |
* Array of subforums. |
125 |
* @return |
|
126 |
* |
|
127 |
* @return string |
|
126 | 128 |
* Formatted list of subforums. |
127 | 129 |
*/ |
128 | 130 |
function theme_advanced_forum_subforum_list(&$variables) { |
... | ... | |
149 | 151 |
/** |
150 | 152 |
* Theme function to a formatted list of subcontainers. |
151 | 153 |
* |
152 |
* @param $subcontainer_list
|
|
154 |
* @param array $variables
|
|
153 | 155 |
* Array of subcontainers. |
154 |
* @return |
|
156 |
* |
|
157 |
* @return string |
|
155 | 158 |
* Formatted list of subcontainers. |
156 | 159 |
*/ |
157 | 160 |
function theme_advanced_forum_subcontainer_list(&$variables) { |
... | ... | |
211 | 214 |
*/ |
212 | 215 |
function advanced_forum_preprocess_forum_submitted(&$variables) { |
213 | 216 |
advanced_forum_add_template_suggestions("submitted", $variables); |
214 |
// Avoid E_ALL warning |
|
217 |
// Avoid E_ALL warning.
|
|
215 | 218 |
$variables['topic_link'] = ''; |
216 | 219 |
|
217 | 220 |
if (isset($variables['topic']->node_title)) { |
218 | 221 |
$nid = $variables['topic']->nid; |
219 | 222 |
|
220 |
// Make a fake node object to avoid the node load |
|
223 |
// Make a fake node object to avoid the node load.
|
|
221 | 224 |
$node = new stdClass(); |
222 | 225 |
$node->nid = $nid; |
223 | 226 |
$node->type = $variables['topic']->type; |
224 | 227 |
|
225 |
// Find the page of the first unread comment, if any |
|
228 |
// Find the page of the first unread comment, if any.
|
|
226 | 229 |
$comment_count = db_query('SELECT COUNT(cid) FROM {comment} WHERE nid = :nid', array(':nid' => $nid))->fetchField(); |
227 | 230 |
$new_replies = advanced_forum_reply_num_new($nid); |
228 | 231 |
$query = advanced_forum_page_first_new($comment_count, $new_replies, $node); |
229 | 232 |
|
230 |
// Format the node title with a link |
|
233 |
// Format the node title with a link.
|
|
231 | 234 |
$title_length = variable_get('advanced_forum_topic_title_length', 15); |
232 | 235 |
if ($title_length == 0) { |
233 | 236 |
$short_topic_title = $variables['topic']->node_title; |
... | ... | |
261 | 264 |
} |
262 | 265 |
} |
263 | 266 |
|
267 |
/** |
|
268 |
* Preprocess forum topic pager. |
|
269 |
*/ |
|
264 | 270 |
function advanced_forum_preprocess_advanced_forum_topic_pager(&$variables) { |
265 | 271 |
$pagecount = $variables['pagecount']; |
266 | 272 |
$topic = $variables['topic']; |
267 | 273 |
|
268 | 274 |
// Get the information to assemble the pager. This returns an object with |
269 | 275 |
// the following properties: |
270 |
// initial_pages: Array of linked numbers for first set of pages |
|
271 |
// last_page_text: Linked text "Last page" (translatable) |
|
272 |
// last_page_number: Linked number pointing to the last page. |
|
276 |
// - initial_pages: Array of linked numbers for first set of pages
|
|
277 |
// - last_page_text: Linked text "Last page" (translatable)
|
|
278 |
// - last_page_number: Linked number pointing to the last page.
|
|
273 | 279 |
$topic_pager = advanced_forum_create_topic_pager($pagecount, $topic); |
274 | 280 |
|
275 |
|
|
276 | 281 |
$variables['last_page_text'] = ''; |
277 | 282 |
|
278 | 283 |
if (!empty($topic_pager->initial_pages)) { |
... | ... | |
290 | 295 |
} |
291 | 296 |
|
292 | 297 |
/** |
293 |
* Preprocess variables for advanced-forum.naked.post-edited.tpl.php |
|
294 |
* |
|
298 |
* Preprocess variables for advanced-forum.naked.post-edited.tpl.php. |
|
295 | 299 |
*/ |
296 | 300 |
function advanced_forum_preprocess_advanced_forum_post_edited(&$variables) { |
297 | 301 |
$editor = user_load($variables['who']); |
... | ... | |
301 | 305 |
$variables['edited_reason'] = empty($variables['why']) ? '' : $variables['why']; |
302 | 306 |
} |
303 | 307 |
|
308 |
/** |
|
309 |
* Preprocess forum shadow topic. |
|
310 |
*/ |
|
304 | 311 |
function advanced_forum_preprocess_advanced_forum_shadow_topic(&$variables) { |
305 | 312 |
$nid = $variables['nid']; |
306 | 313 |
|
307 | 314 |
$variables['new_forum_url'] = url("node/$nid"); |
308 |
// compatibility variable
|
|
315 |
// Compatibility variable.
|
|
309 | 316 |
$variables['new_forum_link'] = l(t('View topic'), "node/$nid"); |
310 | 317 |
} |
311 | 318 |
|
... | ... | |
331 | 338 |
$authenticated_users = advanced_forum_statistics_online_users(); |
332 | 339 |
$variables['online_users'] = implode(', ', $authenticated_users); |
333 | 340 |
$variables['current_users'] = advanced_forum_session_count(FALSE); |
334 |
$variables['current_guests'] = 0; // for backwards compatibility |
|
341 |
// For backwards compatibility. |
|
342 |
$variables['current_guests'] = 0; |
|
335 | 343 |
$variables['current_total'] = $variables['current_users'] + $variables['current_guests']; |
336 | 344 |
|
337 | 345 |
$latest_users = advanced_forum_statistics_latest_users(); |
... | ... | |
348 | 356 |
|
349 | 357 |
/* * * JUST TOPIC LIST PAGES ************************************************* */ |
350 | 358 |
|
359 |
/** |
|
360 |
* Preprocess views forum topic list. |
|
361 |
*/ |
|
351 | 362 |
function advanced_forum_preprocess_views_view_forum_topic_list__advanced_forum_topic_list(&$variables) { |
352 | 363 |
_advanced_forum_add_files(); |
353 |
// debug |
|
354 | 364 |
die("advanced_forum_preprocess_views_view_forum_topic_list__advanced_forum_topic_list"); |
355 | 365 |
advanced_forum_add_template_suggestions("topic_list_view", $variables); |
356 | 366 |
// Set a variable for displaying the topic legend. |
357 | 367 |
$variables['topic_legend'] = theme('advanced_forum_topic_legend'); |
358 | 368 |
} |
359 | 369 |
|
370 |
/** |
|
371 |
* Preprocess views forum topic list. |
|
372 |
*/ |
|
360 | 373 |
function advanced_forum_preprocess_views_view__advanced_forum_topic_list(&$variables) { |
361 | 374 |
_advanced_forum_add_files(); |
362 | 375 |
advanced_forum_add_template_suggestions("topic_list_outer_view", $variables); |
... | ... | |
410 | 423 |
} |
411 | 424 |
|
412 | 425 |
/* * * TOPIC PAGES *********************************************************** */ |
413 |
|
|
426 |
/** |
|
427 |
* Preprocess forum search topic. |
|
428 |
*/ |
|
414 | 429 |
function advanced_forum_preprocess_advanced_forum_search_topic(&$variables) { |
415 | 430 |
advanced_forum_add_template_suggestions("search_topic", $variables); |
416 | 431 |
|
417 | 432 |
$variables['path'] = url('node/' . $variables['node']->nid . '/search'); |
418 | 433 |
} |
419 | 434 |
|
435 |
/** |
|
436 |
* Preprocess views forum search topic. |
|
437 |
*/ |
|
420 | 438 |
function advanced_forum_preprocess_views_view_fields__advanced_forum_search_topic(&$variables) { |
421 | 439 |
_advanced_forum_add_files(); |
422 | 440 |
advanced_forum_add_template_suggestions("search_result", $variables); |
... | ... | |
430 | 448 |
|
431 | 449 |
$node = $variables['node']; |
432 | 450 |
|
433 |
|
|
434 |
// Reply link / button |
|
451 |
// Reply link/button. |
|
435 | 452 |
$variables['reply_link'] = theme('advanced_forum_reply_link', array('node' => $node)); |
436 | 453 |
|
437 | 454 |
// Total posts, including first post. |
... | ... | |
450 | 467 |
// Link to last post in topic. |
451 | 468 |
$variables['last_post_link'] = advanced_forum_last_post_link($node); |
452 | 469 |
|
453 |
// Pager |
|
454 |
if (isset($variables['node']->comment_count)) |
|
470 |
// Pager.
|
|
471 |
if (isset($variables['node']->comment_count)) {
|
|
455 | 472 |
pager_default_initialize($variables['node']->comment_count, variable_get('comment_default_per_page_' . $variables['node']->type, 50)); |
456 |
|
|
473 |
} |
|
457 | 474 |
|
458 | 475 |
$variables['pager'] = theme('pager'); |
459 | 476 |
} |
... | ... | |
505 | 522 |
} |
506 | 523 |
} |
507 | 524 |
|
525 |
/** |
|
526 |
* Preprocess comment wrapper. |
|
527 |
*/ |
|
508 | 528 |
function advanced_forum_preprocess_comment_wrapper(&$variables) { |
509 | 529 |
$variables['reply_link'] = ''; |
510 | 530 |
if (advanced_forum_is_styled($variables['node'], FALSE, 'comment-wrapper')) { |
... | ... | |
516 | 536 |
|
517 | 537 |
if ($form_on_seperate_page || $comments_locked) { |
518 | 538 |
// If the post is locked or the comment form is on a seperate page, |
519 |
// build the reply/locked link / button |
|
539 |
// build the reply/locked link / button.
|
|
520 | 540 |
$variables['reply_link'] = theme('advanced_forum_reply_link', array('node' => $variables['node'])); |
521 | 541 |
} |
522 | 542 |
} |
... | ... | |
533 | 553 |
} |
534 | 554 |
|
535 | 555 |
/* * * ORGANIC GROUPS ******************************************************** */ |
536 |
|
|
556 |
/** |
|
557 |
* Preprocess view forum group list. |
|
558 |
*/ |
|
537 | 559 |
function advanced_forum_preprocess_views_view__advanced_forum_group_topic_list(&$variables) { |
538 | 560 |
_advanced_forum_add_files(); |
539 | 561 |
advanced_forum_add_template_suggestions("group_topic_list_outer_view", $variables); |
540 | 562 |
|
541 | 563 |
// Set a variable for displaying the topic legend. |
542 | 564 |
$variables['topic_legend'] = theme('advanced_forum_topic_legend'); |
543 |
} |
|
565 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules