public function defAction() { $count = ormObjects::getCountTrashObjects(); $max_count = uiTable::getMaxCount(); if (uiTable::getCurPage() != 1) { $niz = empty($start_pos) ? uiTable::getCurPage() * $max_count - $max_count : 0; $objects = ormObjects::getTrashObjects($niz, $max_count); } else { $objects = ormObjects::getTrashObjects($max_count); } if (user::issetRight('object_del') && !empty($objects)) { ui::newButton(lang::get('BTN_NEW_CLEAК_TRASH'), 'javascript:clearTrash();'); } $table = new uiTable($objects, $count); $table->addColumn('name', lang::get('TRASH_TABLE_1'), 400); $table->addColumn('class', lang::get('TRASH_TABLE_2')); $table->addColumn('date', lang::get('TRASH_TABLE_3'), 0, false, false, 'viewDateTime'); $table->addColumn('user', lang::get('TRASH_TABLE_4'), 200); $table->addRight('object_restore', 'restore', multi, 'restoreObj(this)', lang::get('TRASH_TABLE_RESTORE')); $table->addRight('object_del', 'drop', multi); $table->setDelMessage(lang::get('TRASH_DEL_TITLE'), lang::get('TRASH_DEL_MSG')); $table->setMultiDelMessage(lang::get('TRASH_DEL_TITLE2'), lang::get('TRASH_DEL_MSG2')); $table->emptyText(lang::get('TRASH_EMPTY_MSG')); $html = ' <script type="text/javascript" src="/css_mpanel/restore_objects.js"></script> <input id="clearTrashTitle" type="hidden" value="' . lang::get('TRASH_DEL_TITLE3') . '"> <input id="clearTrashText" type="hidden" value="' . lang::get('TRASH_DEL_MSG3') . '"> '; return $html . $table->getHTML(); }
public function view() { if (user::issetRight('delete')) { ui::newButton(lang::get('BTN_CLEAR_JORNAL'), 'javascript:clearJornal();'); } ui::addLeftButton('Системный журнал', 'system_view'); ui::addLeftButton('Журнал БД', 'db_view'); function getState($val) { if ($val == info) { return 'info'; } else { if ($val == error) { return 'error'; } else { if ($val == warning) { return 'warning'; } } } } function getEditUser($val, $obj) { if (user::issetRight('user_upd', 'users')) { return '<a href="' . system::au() . '/users/user_upd/' . $obj['rev_user_id'] . '" target="_blank">' . $val . '</a>'; } else { return $val; } } $count = db::q('SELECT count(rev_id) count FROM <<revue>>, <<objects>> WHERE rev_obj_id = o_id;', value); $max_count = uiTable::getMaxCount(); if (uiTable::getCurPage() != 1) { $niz = empty($start_pos) ? uiTable::getCurPage() * $max_count - $max_count : 0; $limit = ' LIMIT ' . $niz . ', ' . $max_count; } else { $limit = ' LIMIT ' . $max_count; } $mas = db::q('SELECT rev_state, rev_user, rev_user_id, rev_datetime, concat(rev_message, " <b>", o_name, "</b>") rev_msg, rev_ip FROM <<revue>>, <<objects>> WHERE rev_obj_id = o_id ORDER BY rev_datetime DESC ' . $limit, records); /* Сделать фильтры: - важность - пользователь - тип данных - периуд времени - IP */ $table = new uiTable($mas, $count); $table->addColumn('rev_state', 'Важность', 0, false, false, 'getState'); $table->addColumn('rev_user', 'Пользователь', 0, false, false, 'getEditUser'); $table->addColumn('rev_msg', 'Действие', 400); $table->addColumn('rev_datetime', 'Дата / Время', 0, false, false, 'viewDateTime2'); $table->addColumn('rev_ip', 'IP'); $table->emptyText('В журнале нет записей!'); return $table->getHTML(); }
public function view() { if (user::issetRight('delete')) { ui::newButton(lang::get('BTN_CLEAR_JORNAL'), 'javascript:clearJornal();'); } ui::addLeftButton('Системный журнал', 'system_view'); ui::addLeftButton('Журнал БД', 'db_view'); function removeQuotes($val, $obj) { return substr($val, 1, strlen($val) - 2); } function rqDateTime($val, $obj) { return date('d.m.Y H:i:s', $val); } function sortByTime($a, $b) { if ($a[1] == $b[1]) { return 0; } return $a[1] > $b[1] ? -1 : 1; } $mas = array(); $system_file = ROOT_DIR . '/revue.log'; if (file_exists($system_file)) { // Читаем файл, формируем массив $tmp_mas = array(); $file = file($system_file); while (list($key, $val) = each($file)) { $tmp = explode(Chr(9), $val); if (!empty($tmp[1])) { $tmp[1] = strtotime(removeQuotes($tmp[1], $tmp[1])); $tmp_mas[] = $tmp; } } // Сортиуем массив по времени usort($tmp_mas, 'sortByTime'); // Выбераем часть массива в соотвествии с постраничной навигацией $count = count($tmp_mas); $max_count = uiTable::getMaxCount(); if (uiTable::getCurPage() != 1) { $niz = empty($start_pos) ? uiTable::getCurPage() * $max_count - $max_count : 0; $mas = array_slice($tmp_mas, $niz, $max_count); } else { $mas = array_slice($tmp_mas, 0, $max_count); } } else { $count = 0; } $table = new uiTable($mas, $count); $table->emptyText('В системном журнале нет записей!'); $table->addColumn('2', 'Важность', 0, false, false, 'removeQuotes'); $table->addColumn('3', 'Пользователь', 0, false, false, 'removeQuotes'); $table->addColumn('4', 'Действие', 400); $table->addColumn('1', 'Дата / Время', 0, false, false, 'rqDateTime'); $table->addColumn('0', 'IP'); return $table->getHTML(); }
public function defAction() { function getUserName($val, $obj) { $name = $val . ' (' . $obj['c_email'] . ')'; if (!empty($obj['c_user_id']) && user::issetRight('user_upd', 'users')) { $url = system::au() . '/users/user_upd/' . $obj['c_user_id']; $name = '<a href="' . $url . '" target="_blank">' . $name . '</a>'; } return $name; } function getCommentText($val, $obj) { return strip_tags($val); } $count = db::q('SELECT count(c_id) count FROM <<comments>>;', value); $max_count = uiTable::getMaxCount(); if (uiTable::getCurPage() != 1) { $niz = empty($start_pos) ? uiTable::getCurPage() * $max_count - $max_count : 0; $limit = 'LIMIT ' . $niz . ', ' . $max_count; } else { $limit = 'LIMIT ' . $max_count; } $sql = 'SELECT c_id id, c_active active, c_text, c_username, c_publ_date, c_email, c_user_id FROM <<comments>> ORDER BY c_publ_date DESC ' . $limit . ';'; $mas = db::q($sql, records); $table = new uiTable($mas, $count); $table->addColumn('c_text', 'Текст', 500, 0, 1, 'getCommentText'); $table->addColumn('c_username', 'Пользователь', 200, 0, 0, 'getUserName'); $table->addColumn('c_publ_date', 'Дата создания', 200, 0, 1, 'viewDateTime'); $table->defaultRight('comment_upd'); $table->addRight('comment_upd', 'edit', single); $table->addRight('comment_act', 'active', multi); $table->addRight('comment_del', 'drop', multi); return $table->getHTML(); }