ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 $ilCtrl, $lng;
152 
153  $title = $this->getParentObject()->object->getTitle().' ('.$lng->txt('link_check').')';
154  if($last_access = $this->getLinkChecker()->getLastCheckTimestamp())
155  {
156  $title .= ', '.$lng->txt('last_change').': '.
158  }
159  $this->setTitle($title);
160 
161  $invalidLinks = $this->getLinkChecker()->getInvalidLinksFromDB();
162  if(!count($invalidLinks))
163  {
164  $this->setNoEntriesText($lng->txt('no_invalid_links'));
165  }
166  else
167  {
168  foreach($invalidLinks as $key => $invalidLink)
169  {
170  $invalidLinks[$key] = $this->getRowHandler()->formatInvalidLinkArray($invalidLink);
171  }
172  }
173 
174  $this->addColumn($lng->txt('title'), 'title', '20%');
175  $this->addColumn($lng->txt('url'), 'url', '80%');
176  $this->addColumn('', '', '10%');
177  $this->setLimit(32000);
178  $this->setEnableHeader(true);
179  $this->setData($invalidLinks);
180 
181  $this->setFormAction($ilCtrl->getFormAction($this->getParentObject(), $this->getParentCmd()));
182  $this->setRowTemplate('tpl.link_checker_table_row.html', 'Services/LinkChecker');
183  $this->setEnableTitle(true);
184  $this->setEnableNumInfo(false);
185 
186  $refreshButton = $this->getRefreshButton();
187  $this->addCommandButton($refreshButton['cmd'], $refreshButton['txt']);
188 
189  return $this;
190  }
191 }
192 ?>