ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilWikiPagesTableGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5include_once("Services/Table/classes/class.ilTable2GUI.php");
6
7define("IL_WIKI_ALL_PAGES", "all");
8define("IL_WIKI_NEW_PAGES", "new");
9define("IL_WIKI_POPULAR_PAGES", "popular");
10define("IL_WIKI_WHAT_LINKS_HERE", "what_links");
11define("IL_WIKI_ORPHANED_PAGES", "orphaned");
12
22{
23 public function __construct(
24 $a_parent_obj,
25 $a_parent_cmd = "",
26 $a_wiki_id,
27 $a_mode = IL_WIKI_ALL_PAGES,
28 $a_page_id = 0
29 ) {
30 global $DIC;
31
32 $this->ctrl = $DIC->ctrl();
33 $this->lng = $DIC->language();
34 $ilCtrl = $DIC->ctrl();
35 $lng = $DIC->language();
36
37 parent::__construct($a_parent_obj, $a_parent_cmd);
38 $this->pg_list_mode = $a_mode;
39 $this->wiki_id = $a_wiki_id;
40 $this->page_id = $a_page_id;
41
42 switch ($this->pg_list_mode) {
44 $this->addColumn($lng->txt("created"), "created", "33%");
45 $this->addColumn($lng->txt("wiki_page"), "title", "33%");
46 $this->addColumn($lng->txt("wiki_created_by"), "user_sort", "34%");
47 $this->setRowTemplate(
48 "tpl.table_row_wiki_new_page.html",
49 "Modules/Wiki"
50 );
51 break;
52
54 $this->addColumn($lng->txt("wiki_page"), "title", "50%");
55 $this->addColumn($lng->txt("wiki_page_hits"), "cnt", "50%");
56 $this->setRowTemplate(
57 "tpl.table_row_wiki_popular_page.html",
58 "Modules/Wiki"
59 );
60 break;
61
63 $this->addColumn($lng->txt("wiki_page"), "title", "100%");
64 $this->setRowTemplate(
65 "tpl.table_row_wiki_orphaned_page.html",
66 "Modules/Wiki"
67 );
68 break;
69
70 default:
71 $this->addColumn($lng->txt("wiki_page"), "title", "33%");
72 $this->addColumn($lng->txt("wiki_last_changed"), "date", "33%");
73 $this->addColumn($lng->txt("wiki_last_changed_by"), "user_sort", "34%");
74 $this->setRowTemplate(
75 "tpl.table_row_wiki_page.html",
76 "Modules/Wiki"
77 );
78 break;
79 }
80 $this->setEnableHeader(true);
81 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
82 $this->getPages();
83
84 $this->setShowRowsSelector(true);
85
86 switch ($this->pg_list_mode) {
88 $this->setTitle(sprintf(
89 $lng->txt("wiki_what_links_to_page"),
90 ilWikiPage::lookupTitle($this->page_id)
91 ));
92 break;
93
94 default:
95 $this->setTitle($lng->txt("wiki_" . $a_mode . "_pages"));
96 break;
97 }
98 }
99
103 public function getPages()
104 {
105 include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
106
107 $pages = array();
108 $this->setDefaultOrderField("title");
109
110 switch ($this->pg_list_mode) {
112 $pages = ilWikiPage::getLinksToPage($this->wiki_id, $this->page_id);
113 break;
114
116 $pages = ilWikiPage::getAllWikiPages($this->wiki_id);
117 break;
118
120 $this->setDefaultOrderField("created");
121 $this->setDefaultOrderDirection("desc");
122 $pages = ilWikiPage::getNewWikiPages($this->wiki_id);
123 break;
124
126 $this->setDefaultOrderField("cnt");
127 $this->setDefaultOrderDirection("desc");
128 $pages = ilWikiPage::getPopularPages($this->wiki_id);
129 break;
130
132 $pages = ilWikiPage::getOrphanedPages($this->wiki_id);
133 break;
134 }
135
136 if ($pages) {
137 // enable sorting
138 include_once("./Services/User/classes/class.ilUserUtil.php");
139 foreach (array_keys($pages) as $idx) {
140 $pages[$idx]["user_sort"] = ilUserUtil::getNamePresentation($pages[$idx]["user"], false, false);
141 }
142 }
143
144 $this->setData($pages);
145 }
146
147 public function numericOrdering($a_field)
148 {
149 if ($a_field == "cnt") {
150 return true;
151 }
152 return false;
153 }
154
159 protected function fillRow($a_set)
160 {
163
164 if ($this->pg_list_mode == IL_WIKI_NEW_PAGES) {
165 $this->tpl->setVariable("TXT_PAGE_TITLE", $a_set["title"]);
166 $this->tpl->setVariable(
167 "DATE",
169 );
170 } elseif ($this->pg_list_mode == IL_WIKI_POPULAR_PAGES) {
171 $this->tpl->setVariable("TXT_PAGE_TITLE", $a_set["title"]);
172 $this->tpl->setVariable("HITS", $a_set["cnt"]);
173 } else {
174 $this->tpl->setVariable("TXT_PAGE_TITLE", $a_set["title"]);
175 $this->tpl->setVariable(
176 "DATE",
178 );
179 }
180 $this->tpl->setVariable(
181 "HREF_PAGE",
182 ilObjWikiGUI::getGotoLink($_GET["ref_id"], $a_set["title"])
183 );
184
185 // user name
186 include_once("./Services/User/classes/class.ilUserUtil.php");
187 $this->tpl->setVariable(
188 "TXT_USER",
190 $a_set["user"],
191 true,
192 true,
193 $ilCtrl->getLinkTarget($this->getParentObject(), $this->getParentCmd())
194 )
195 );
196 }
197}
sprintf('%.4f', $callTime)
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_DATETIME
const IL_WIKI_ALL_PAGES
const IL_WIKI_POPULAR_PAGES
const IL_WIKI_NEW_PAGES
const IL_WIKI_ORPHANED_PAGES
const IL_WIKI_WHAT_LINKS_HERE
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date @access public.
@classDescription Date and time handling
static getGotoLink($a_ref_id, $a_page="")
Get goto link.
Class ilTable2GUI.
setEnableHeader($a_enableheader)
Set Enable Header.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
static getOrphanedPages($a_wiki_id)
Get orphaned pages of wiki.
static getAllWikiPages($a_wiki_id)
Get all pages of wiki.
static getLinksToPage($a_wiki_id, $a_page_id)
Get links to a page.
static lookupTitle($a_page_id)
Checks whether a page with given title exists.
static getNewWikiPages($a_wiki_id)
Get all pages of wiki.
static getPopularPages($a_wiki_id)
Get popular pages of wiki.
TableGUI class for wiki pages table.
fillRow($a_set)
Standard Version of Fill Row.
getPages()
Get pages for list.
__construct( $a_parent_obj, $a_parent_cmd="", $a_wiki_id, $a_mode=IL_WIKI_ALL_PAGES, $a_page_id=0)
numericOrdering($a_field)
Should this field be sorted numeric?
global $ilCtrl
Definition: ilias.php:18
global $DIC
Definition: saml.php:7