ILIAS  trunk Revision v13.0_alpha-52-g21c366bbdd4
AuthorBlockGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
27
29{
30 public function __construct(
31 protected InternalDomainService $domain,
32 protected InternalGUIService $gui,
33 protected LinkBuilder $link_builder
34 ) {
35 }
36
37 public function render(
38 bool $show_inactive = false
39 ): string {
40 $obj_id = \ilObject::_lookupObjId($this->gui->standardRequest()->getRefId());
41 $posting_list = $this->domain->postingList(
42 $obj_id,
43 $show_inactive
44 );
45 $authors = $posting_list->getAuthors();
46
47 // filter out deleted users
48 $authors = array_filter($authors, function ($id) {
49 return \ilObject::_lookupType($id) == "usr";
50 });
51
52 if (count($authors) > 1) {
53 $list = array();
54 foreach ($authors as $user_id) {
55 if ($user_id) {
56 $url = $this->link_builder->forAuthor($user_id);
57
59 if (str_starts_with($base_name, "[")) {
61 $sort = $name;
62 } else {
65 true,
66 false,
67 "",
68 false,
69 true,
70 false
71 );
73 $sort = $name_arr["lastname"] . " " . $name_arr["firstname"];
74 }
75
76 $idx = trim(strip_tags((string) $sort)) . "///" . $user_id;
77 $list[$idx] = array($name, $url);
78 }
79 }
80 ksort($list);
81
82 $wtpl = new \ilTemplate("tpl.blog_list_navigation_authors.html", true, true, "components/ILIAS/Blog");
83
84 $wtpl->setCurrentBlock("author");
85 foreach ($list as $author) {
86 $wtpl->setVariable("TXT_AUTHOR", $author[0]);
87 $wtpl->setVariable("URL_AUTHOR", $author[1]);
88 $wtpl->parseCurrentBlock();
89 }
90
91 return $wtpl->get();
92 }
93 return "";
94 }
95}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
render(bool $show_inactive=false)
__construct(protected InternalDomainService $domain, protected InternalGUIService $gui, protected LinkBuilder $link_builder)
static _lookupName(int $a_user_id)
Class ilObject Basic functions for all objects.
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path=null)
Default behaviour is: