ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilWikiRecentChangesTableGUI.php
Go to the documentation of this file.
1 <?php
2 
20 
27 {
28  protected int $requested_ref_id;
29  protected int $wiki_id = 0;
30  protected Translations $ot;
31  protected \ILIAS\Wiki\Page\PageManager $pm;
32 
33  public function __construct(
34  object $a_parent_obj,
35  string $a_parent_cmd,
36  int $a_wiki_id
37  ) {
38  global $DIC;
39 
40  $service = $DIC->wiki()->internal();
41  $gui = $service->gui();
42  $domain = $service->domain();
43  $this->ctrl = $gui->ctrl();
44  $this->lng = $domain->lng();
45  $this->requested_ref_id = $gui
46  ->request()
47  ->getRefId();
48  $this->pm = $domain->page()->page($this->requested_ref_id);
49  $this->ot = $domain->wiki()->translation($this->requested_ref_id);
50 
51  parent::__construct($a_parent_obj, $a_parent_cmd);
52  $this->wiki_id = $a_wiki_id;
53 
54  $this->addColumn($this->lng->txt("wiki_last_changed"));
55  $this->addColumn($this->lng->txt("wiki_page"));
56  if ($this->ot->getContentTranslationActivated()) {
57  $this->addColumn($this->lng->txt("language"));
58  }
59  $this->addColumn($this->lng->txt("wiki_last_changed_by"));
60  $this->setEnableHeader(true);
61  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
62  $this->setRowTemplate(
63  "tpl.table_row_recent_changes.html",
64  "components/ILIAS/Wiki"
65  );
66  $this->getRecentChanges();
67 
68  $this->setShowRowsSelector(true);
69 
70  $this->setTitle($this->lng->txt("wiki_recent_changes"));
71  }
72 
73  public function getRecentChanges(): void
74  {
75  $changes = [];
76  foreach ($this->pm->getRecentChanges() as $pi) {
77  $changes[] = [
78  "date" => $pi->getLastChange(),
79  "user" => $pi->getLastChangedUser(),
80  "id" => $pi->getId(),
81  "title" => $pi->getTitle(),
82  "lang" => $pi->getLanguage(),
83  "nr" => $pi->getOldNr()
84  ];
85  }
86  $this->setDefaultOrderField("date");
87  $this->setDefaultOrderDirection("desc");
88  $this->setData($changes);
89  }
90 
91  protected function fillRow(array $a_set): void
92  {
93  $ilCtrl = $this->ctrl;
94 
95  if ($this->ot->getContentTranslationActivated()) {
96  $l = $a_set["lang"];
97  if ($l === "-") {
98  $l = $this->ot->getBaseLanguage();
99  }
100  $this->tpl->setCurrentBlock("lang");
101  $this->tpl->setVariable("LANG", $this->lng->txt("meta_l_" . $l));
102  $this->tpl->parseCurrentBlock();
103  }
104 
105  $title = $a_set["title"];
106  $this->tpl->setVariable("TXT_PAGE_TITLE", $title);
107  $this->tpl->setVariable(
108  "DATE",
110  );
111  $ilCtrl->setParameterByClass("ilwikipagegui", "wpg_id", $a_set["id"]);
112  $ilCtrl->setParameterByClass("ilwikipagegui", "transl", $a_set["lang"]);
113  $ilCtrl->setParameterByClass("ilwikipagegui", "old_nr", $a_set["nr"] ?? "");
114  $this->tpl->setVariable(
115  "HREF_PAGE",
116  $ilCtrl->getLinkTargetByClass("ilwikipagegui", "preview")
117  );
118 
119  // user name
120  $this->tpl->setVariable(
121  "TXT_USER",
123  $a_set["user"],
124  true,
125  true,
126  $ilCtrl->getLinkTarget($this->getParentObject(), $this->getParentCmd())
127  )
128  );
129  }
130 }
setData(array $a_data)
const IL_CAL_DATETIME
setFormAction(string $a_form_action, bool $a_multipart=false)
Class handles translation mode for an object.
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
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='ilpublicuserprofilegui')
Default behaviour is:
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
global $DIC
Definition: shib_login.php:26
setDefaultOrderDirection(string $a_defaultorderdirection)
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
__construct(Container $dic, ilPlugin $plugin)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
__construct(object $a_parent_obj, string $a_parent_cmd, int $a_wiki_id)
TableGUI class for recent changes in wiki.
$service
Definition: ltiservices.php:40
setEnableHeader(bool $a_enableheader)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...