@@ 347-421 (lines=75) @@ | ||
344 | } |
|
345 | } |
|
346 | ||
347 | public function attr_sort($forum_id = 0, $attribute_id = 0) |
|
348 | { |
|
349 | // load language |
|
350 | $this->user->add_lang_ext('abdev/qte', array('attributes', 'attributes_acp')); |
|
351 | ||
352 | $show_select = false; |
|
353 | ||
354 | $attributes = array(); |
|
355 | foreach ($this->attr as $attr) |
|
356 | { |
|
357 | if (empty($attr['attr_auths'])) |
|
358 | { |
|
359 | $attr_auths = array(array( |
|
360 | 'forums_ids' => array(), |
|
361 | 'groups_ids' => array(), |
|
362 | 'author' => false, |
|
363 | )); |
|
364 | } |
|
365 | else |
|
366 | { |
|
367 | $attr_auths = json_decode($attr['attr_auths'], true); |
|
368 | } |
|
369 | ||
370 | foreach ($attr_auths as $attr_auth) |
|
371 | { |
|
372 | $forum_ids = $attr_auth['forums_ids']; |
|
373 | ||
374 | if (is_array($forum_ids) && in_array($forum_id, $forum_ids)) |
|
375 | { |
|
376 | // show the selector ! |
|
377 | $show_select = true; |
|
378 | ||
379 | if (!isset($attributes[$attr['attr_id']])) |
|
380 | { |
|
381 | // parse the attribute name |
|
382 | $attribute_name = str_replace(array('%mod%', '%date%'), array($this->user->lang['QTE_KEY_USERNAME'], $this->user->lang['QTE_KEY_DATE']), $this->attr_lng_key($attr['attr_name'])); |
|
383 | ||
384 | $attributes[$attr['attr_id']] = array( |
|
385 | 'type' => $attr['attr_type'], |
|
386 | 'name' => $attribute_name, |
|
387 | 'desc' => $this->attr_lng_key($attr['attr_desc']), |
|
388 | 'colour' => $this->attr_colour($attr['attr_name'], $attr['attr_colour']), |
|
389 | ||
390 | 'select' => (!empty($attribute_id) && ($attr['attr_id'] == $attribute_id)) ? true : false, |
|
391 | ||
392 | 's_desc' => !empty($attr['attr_desc']) ? true : false, |
|
393 | ); |
|
394 | } |
|
395 | } |
|
396 | } |
|
397 | unset($attr_auth); |
|
398 | } |
|
399 | unset($attr); |
|
400 | ||
401 | foreach ($attributes as $attr_id => $attr_row) |
|
402 | { |
|
403 | $this->template->assign_block_vars('attributes', array( |
|
404 | 'QTE_ID' => $attr_id, |
|
405 | 'QTE_TYPE' => $attr_row['type'], |
|
406 | 'QTE_NAME' => $attr_row['name'], |
|
407 | 'QTE_DESC' => $attr_row['desc'], |
|
408 | 'QTE_COLOUR' => $attr_row['colour'], |
|
409 | ||
410 | 'IS_SELECTED' => $attr_row['select'], |
|
411 | ||
412 | 'S_QTE_DESC' => $attr_row['s_desc'], |
|
413 | )); |
|
414 | } |
|
415 | unset($attr_id, $attr_row); |
|
416 | ||
417 | if ($show_select) |
|
418 | { |
|
419 | $this->template->assign_var('S_QTE_SELECT', true); |
|
420 | } |
|
421 | } |
|
422 | ||
423 | public function attr_default($forum_id = 0, $attribute_id = 0) |
|
424 | { |
|
@@ 423-497 (lines=75) @@ | ||
420 | } |
|
421 | } |
|
422 | ||
423 | public function attr_default($forum_id = 0, $attribute_id = 0) |
|
424 | { |
|
425 | // load language |
|
426 | $this->user->add_lang_ext('abdev/qte', array('attributes', 'attributes_acp')); |
|
427 | ||
428 | $show_select = false; |
|
429 | ||
430 | $attributes = array(); |
|
431 | foreach ($this->attr as $attr) |
|
432 | { |
|
433 | if (empty($attr['attr_auths'])) |
|
434 | { |
|
435 | $attr_auths = array(array( |
|
436 | 'forums_ids' => array(), |
|
437 | 'groups_ids' => array(), |
|
438 | 'author' => false, |
|
439 | )); |
|
440 | } |
|
441 | else |
|
442 | { |
|
443 | $attr_auths = json_decode($attr['attr_auths'], true); |
|
444 | } |
|
445 | ||
446 | foreach ($attr_auths as $attr_auth) |
|
447 | { |
|
448 | $forum_ids = $attr_auth['forums_ids']; |
|
449 | ||
450 | if (is_array($forum_ids) && in_array($forum_id, $forum_ids)) |
|
451 | { |
|
452 | // show the selector ! |
|
453 | $show_select = true; |
|
454 | ||
455 | if (!isset($attributes[$attr['attr_id']])) |
|
456 | { |
|
457 | // parse the attribute name |
|
458 | $attribute_name = str_replace(array('%mod%', '%date%'), array($this->user->lang['QTE_KEY_USERNAME'], $this->user->lang['QTE_KEY_DATE']), $this->attr_lng_key($attr['attr_name'])); |
|
459 | ||
460 | $attributes[$attr['attr_id']] = array( |
|
461 | 'type' => $attr['attr_type'], |
|
462 | 'name' => $attribute_name, |
|
463 | 'desc' => $this->attr_lng_key($attr['attr_desc']), |
|
464 | 'colour' => $this->attr_colour($attr['attr_name'], $attr['attr_colour']), |
|
465 | ||
466 | 'select' => (!empty($attribute_id) && ($attr['attr_id'] == $attribute_id)) ? true : false, |
|
467 | ||
468 | 's_desc' => !empty($attr['attr_desc']) ? true : false, |
|
469 | ); |
|
470 | } |
|
471 | } |
|
472 | } |
|
473 | unset($attr_auth); |
|
474 | } |
|
475 | unset($attr); |
|
476 | ||
477 | foreach ($attributes as $attr_id => $attr_row) |
|
478 | { |
|
479 | $this->template->assign_block_vars('attributes', array( |
|
480 | 'QTE_ID' => $attr_id, |
|
481 | 'QTE_TYPE' => $attr_row['type'], |
|
482 | 'QTE_NAME' => $attr_row['name'], |
|
483 | 'QTE_DESC' => $attr_row['desc'], |
|
484 | 'QTE_COLOUR' => $attr_row['colour'], |
|
485 | ||
486 | 'IS_SELECTED' => $attr_row['select'], |
|
487 | ||
488 | 'S_QTE_DESC' => $attr_row['s_desc'], |
|
489 | )); |
|
490 | } |
|
491 | unset($attr_id, $attr_row); |
|
492 | ||
493 | if ($show_select) |
|
494 | { |
|
495 | $this->template->assign_var('S_QTE_SELECT', true); |
|
496 | } |
|
497 | } |
|
498 | ||
499 | public function attr_display($attribute_id = 0, $user_id = 0, $timestamp = 0) |
|
500 | { |