*/ class admin_plugin_watchcycle extends AdminPlugin { /** * @return int sort number in admin menu */ public function getMenuSort() { return 1; } /** * @return bool true if only access for superuser, false is for superusers and moderators */ public function forAdminOnly() { return false; } /** * Should carry out any processing required by the plugin. */ public function handle() { } /** * Render HTML output, e.g. helpful text and a form */ public function html() { global $ID; /* @var Input */ global $INPUT; /** @var \helper_plugin_watchcycle_db $dbHelper */ $dbHelper = plugin_load('helper', 'watchcycle_db'); echo '

' . $this->getLang('menu') . '

'; echo '
'; $form = new Form(); $filter_input = new InputElement('text', 'filter'); $filter_input->attr('placeholder', $this->getLang('search page')); $form->addElement($filter_input); $form->addButton('', $this->getLang('btn filter')); $form->addHTML(''); echo $form->toHTML(); echo ''; echo ''; $headers = ['page', 'maintainer', 'cycle', 'current', 'uptodate']; foreach ($headers as $header) { $lang = $this->getLang("h $header"); $param = [ 'do' => 'admin', 'page' => 'watchcycle', 'sortby' => $header, ]; $icon = ''; if ($INPUT->str('sortby') == $header) { if ($INPUT->int('desc') == 0) { $param['desc'] = 1; $icon = '↑'; } else { $param['desc'] = 0; $icon = '↓'; } } $href = wl($ID, $param); echo ''; } $rows = $dbHelper->getAll($headers); foreach ($rows as $row) { echo ''; echo ''; echo ''; echo ''; echo ''; $icon = $row['uptodate'] == 1 ? '✓' : '✕'; echo ''; echo ''; } echo ''; echo '
' . $icon . ' ' . $lang . '
' . $row['page'] . '' . $row['maintainer'] . '' . $row['cycle'] . '' . $row['current'] . '' . $icon . '
'; echo '
'; } }