ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilLinkCheckerTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once 'Services/Table/classes/class.ilTable2GUI.php';
5 
14 {
23  private $linkChecker = null;
24 
33  private $rowHandler = null;
34 
43  private $refreshButton = array('txt' => null, 'cmd' => null);
44 
53  public function __construct(ilObjectGUI $parentGUIObject, $parentStdCmd)
54  {
55  parent::__construct($parentGUIObject, $parentStdCmd);
56  }
57 
67  {
68  $this->linkChecker = $linkChecker;
69 
70  return $this;
71  }
72 
80  public function getLinkChecker()
81  {
82  return $this->linkChecker;
83  }
84 
94  {
95  $this->rowHandler = $rowHandler;
96 
97  return $this;
98  }
99 
107  public function getRowHandler()
108  {
109  return $this->rowHandler;
110  }
111 
121  public function setRefreshButton($txt, $cmd)
122  {
123  $this->refreshButton['txt'] = $txt;
124  $this->refreshButton['cmd'] = $cmd;
125 
126  return $this;
127  }
128 
136  public function getRefreshButton()
137  {
138  return $this->refreshButton;
139  }
140 
149  public function prepareHTML()
150  {
151  global $DIC;
152 
153  $ilCtrl = $DIC['ilCtrl'];
154  $lng = $DIC['lng'];
155 
156  // #11002
157  $lng->loadLanguageModule("webr");
158 
159  $title = $this->getParentObject()->object->getTitle() . ' (' . $lng->txt('invalid_links_tbl') . ')';
160  if ($last_access = $this->getLinkChecker()->getLastCheckTimestamp()) {
161  $title .= ', ' . $lng->txt('last_change') . ': ' .
163  }
164  $this->setTitle($title);
165 
166  $invalidLinks = $this->getLinkChecker()->getInvalidLinksFromDB();
167  if (!count($invalidLinks)) {
168  #$this->setNoEntriesText($lng->txt('no_invalid_links'));
169  } else {
170  foreach ($invalidLinks as $key => $invalidLink) {
171  $invalidLinks[$key] = $this->getRowHandler()->formatInvalidLinkArray($invalidLink);
172  }
173  }
174 
175  $this->addColumn($lng->txt('title'), 'title', '20%');
176  $this->addColumn($lng->txt('url'), 'url', '80%');
177  $this->addColumn('', '', '10%');
178  $this->setLimit(32000);
179  $this->setEnableHeader(true);
180  $this->setData($invalidLinks);
181 
182  $this->setFormAction($ilCtrl->getFormAction($this->getParentObject(), $this->getParentCmd()));
183  $this->setRowTemplate('tpl.link_checker_table_row.html', 'Services/LinkChecker');
184  $this->setEnableTitle(true);
185  $this->setEnableNumInfo(false);
186 
187  $refreshButton = $this->getRefreshButton();
188  $this->addCommandButton($refreshButton['cmd'], $refreshButton['txt']);
189 
190  return $this;
191  }
192 }
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
global $DIC
Definition: saml.php:7
setEnableNumInfo($a_val)
Set enable num info.
getRefreshButton()
get refresh button attributes
class for checking external links in page objects Normally used in Cron jobs, but should be extensibl...
const IL_CAL_UNIX
getParentCmd()
Get parent command.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
getParentObject()
Get parent object.
setRowHandler(ilLinkCheckerGUIRowHandling $rowHandler)
Set the row handler.
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
class ilLinkCheckerTableGUI
setLinkChecker(ilLinkChecker $linkChecker)
Set the link checker instance.
Class ilTable2GUI.
getRowHandler()
Get the row handler.
Class ilObjectGUI Basic methods of all Output classes.
Date and time handling
interface ilLinkCheckerGUIRowHandling
getLinkChecker()
Gget the link checker instance.
$txt
Definition: error.php:11
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setRefreshButton($txt, $cmd)
Set refresh button attributes.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
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.
setEnableHeader($a_enableheader)
Set Enable Header.
setEnableTitle($a_enabletitle)
Set Enable Title.
$key
Definition: croninfo.php:18
setLimit($a_limit=0, $a_default_limit=0)
__construct(ilObjectGUI $parentGUIObject, $parentStdCmd)
Constructor.
prepareHTML()
Call this before using getHTML()