public function listTags() { $db = new library(); $list = $db->getTagList(false); $taglist = ''; foreach ($list as $id => $tag) { $taglist .= "<li><a href=\"\">" . $tag['name'] . "</a></li>"; } return "<ul>{$taglist}</ul>"; }
/** * main -- main logic flow. * script checks for defined tables and then exports data and schema as demanded * * @return void */ public function main() { global $argv; $file = $this->getArgument('FILE'); $paramdir = $this->getArgument('DIRECTORY'); $dir = $paramdir ? $paramdir : BASEDIR; if ($file) { $book = new ebook($file); $book->file = $book->cleanupFile($file, $dir); $lib = new library(); $lib->insertBook($book); } else { echo "No ebook given.\n"; } }
/** * see html::wysiwyg(); */ public static function wysiwyg($options = []) { // tinymce library library::add('tinymce'); $options['class'] = $options['class'] ?? ''; $options['class'] .= ' wysiwyg'; layout::onload("tinymce.init({selector: 'textarea.wysiwyg', height: 500, plugins: ['advlist autolink lists link image charmap print preview hr anchor pagebreak','searchreplace wordcount visualblocks visualchars code fullscreen','insertdatetime media nonbreaking save table contextmenu directionality','emoticons template paste textcolor colorpicker textpattern imagetools'],toolbar1: 'insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image',toolbar2: 'print preview media | forecolor backcolor emoticons'});"); return html::textarea($options); }
/** * see html::calendar() */ public static function calendar($options = []) { // include js & css files if (empty($options['readonly'])) { layout::add_js('/numbers/media_submodules/numbers_frontend_components_calendar_numbers_media_js_base.js'); layout::add_css('/numbers/media_submodules/numbers_frontend_components_calendar_numbers_media_css_base.css'); } // font awesome icons library::add('fontawesome'); // widget parameters $type = $options['calendar_type'] ?? $options['type'] ?? 'date'; $widget_options = ['id' => $options['id'], 'type' => $type, 'format' => $options['calendar_format'] ?? format::get_date_format($type), 'date_week_start_day' => $options['calendar_date_week_start_day'] ?? 1, 'date_disable_week_days' => $options['calendar_date_disable_week_days'] ?? null, 'master_id' => $options['calendar_master_id'] ?? null, 'slave_id' => $options['calendar_slave_id'] ?? null]; $options['type'] = 'text'; // determine input size $placeholder = format::get_date_placeholder($widget_options['format']); $options['size'] = strlen($placeholder); // set placeholder if (!empty($options['placeholder']) && $options['placeholder'] == 'format::get_date_placeholder') { $options['placeholder'] = $placeholder; $options['title'] = ($options['title'] ?? '') . ' (' . $placeholder . ')'; } if (isset($options['calendar_icon']) && ($options['calendar_icon'] == 'left' || $options['calendar_icon'] == 'right')) { $position = $options['calendar_icon']; if (i18n::rtl()) { if ($position == 'left') { $position = 'right'; } else { $position = 'left'; } } $icon_type = $type == 'time' ? 'clock-o' : 'calendar'; unset($options['calendar_icon']); if (empty($options['readonly'])) { $icon_onclick = 'numbers_calendar_var_' . $options['id'] . '.show();'; } else { $icon_onclick = null; } $icon_value = html::span(['onclick' => $icon_onclick, 'class' => 'numbers_calendar_icon numbers_prevent_selection', 'value' => html::icon(['type' => $icon_type])]); $result = html::input_group(['value' => html::input($options), $position => $icon_value, 'dir' => 'ltr']); $div_id = $options['id'] . '_div_holder'; $result .= html::div(['id' => $div_id, 'class' => 'numbers_calendar_div_holder']); $widget_options['holder_div_id'] = $div_id; } else { $result = html::input($options); } // we do not render a widget if readonly if (empty($options['readonly'])) { layout::onload('numbers_calendar(' . json_encode($widget_options) . ');'); } return $result; }
/** * @see html::icon() */ public static function icon($options = []) { // if we are rendering image if (isset($options['file'])) { return numbers_frontend_html_class_base::icon($options); } else { if (isset($options['type'])) { library::add('fontawesome'); // generating class & rendering tag $options['class'] = array_add_token($options['class'] ?? [], 'fa fa-' . $options['type'], ' '); if (!empty($options['class_only'])) { return implode(' ', $options['class']); } else { $options['tag'] = $options['tag'] ?? 'i'; return html::tag($options); } } } }
/** * see html::select(); */ public static function select($options = []) { // we do not process readonly selects if (empty($options['readonly'])) { // include js & css files layout::add_js('/numbers/media_submodules/numbers_frontend_components_select_numbers_media_js_base.js', 10000); layout::add_css('/numbers/media_submodules/numbers_frontend_components_select_numbers_media_css_base.css', 10000); // font awesome icons library::add('fontawesome'); // id with name if (empty($options['id']) && !empty($options['name'])) { $options['id'] = $options['name']; } layout::onload('numbers_select(' . json_encode(['id' => $options['id']]) . ');'); } // must gain proper class from previous submodule $options['flag_call_previous_parent'] = true; return html::select($options); }
function run() { $lib = new library(); $arg = ""; $function = "index"; $controller = $lib->route; for ($i = 0; $i < count($lib->get_all_segment()); $i++) { if ($i == 2) { $controller = empty($lib->get_segment($i)) ? $controller : $lib->get_segment($i); } else { if ($i == 3) { $function = empty($lib->get_segment($i)) ? "index" : $lib->get_segment($i); } else { if ($i >= 4) { $arg .= empty($arg) ? $lib->get_segment($i) : "," . $lib->get_segment($i); } } } } include "app/class/" . $controller . ".php"; $run = new $controller(); return empty($arg) ? $run->{$function}() : $run->{$function}($arg); }
define('ROOT', dirname($_SERVER['SCRIPT_FILENAME'])); require ROOT . "/include/admin-init.php"; if (!is_login()) { die(html_jump('login.php')); } set_page_type('library', 'library_manage'); set_page_power(array(1)); set_title("图书管理"); $category = new library_category(); $category->get_id_list(); $all_user = new user_info(); $all_user->get_id_list(); library_option(); get_admin_header(); $library = new library(); $library->check_parameter(); $library->get_book(); ?> <div id="library"> <div class="manage"> <h2 align="center">图书管理</h2> <form name="tableform" action="library-action.php" method="post"> <table border="0" align="center" cellspacing="0"> <?php if (empty($library->list)) { echo "<tr class=\"title\"><td>没有搜索到相关图书</td></tr>\n"; } else { echo "<tr class=\"title\"><th>ID</th><th>图书名</th><th>图书馆<br>编号</th><th>ISBN</th><th>分类</th><th>所有者</th><th>借来时间</th><th>借阅者</th><th>借出时间</th><th>距到期</th><th>电子书</th><th>操作</th><th><a href=\"javascript:selectAll('select');\" title=\"全选\\取消全选\">选择</a></th></tr>\n"; $i = 0; foreach ($library->list as $v) {
function checkLogin($milogin, $password, $selLibrary) { $misusuarios = new users(); $usuario = $misusuarios->searchByLogin($milogin); if (is_null($usuario)) { return "Error1"; } elseif ($selLibrary == "") { return "Error3"; } else { if ($usuario->getPassword() == md5($password)) { $dataModelLib = new library(); $libraryName = $dataModelLib->searchByParam($selLibrary, "2"); $allRoles = $usuario->getRole(); $userRole = array($allRoles[0]->contenido); for ($i = 1; $i < count($allRoles); $i++) { array_push($userRole, $allRoles[$i]->contenido); } list($allAvailableLibrariesName, $allAvailableLibrariesDir) = getAllLibraries(); if ($allRoles[0]->contenido == "Administrator") { $_SESSION["optLibrary"] = $allAvailableLibrariesName; $_SESSION["optLibraryDir"] = $allAvailableLibrariesDir; } else { $allLibraryDir = $usuario->getLibDir(); $allLibrariesDir = array($allLibraryDir[0]->contenido); for ($i = 1; $i < count($allLibraryDir); $i++) { array_push($allLibrariesDir, $allLibraryDir[$i]->contenido); } $key = array_search($selLibrary, $allLibrariesDir); $keyName = array_search($allLibrariesDir[0], $allAvailableLibrariesDir); $allLibrariesName = array($allAvailableLibrariesName[$keyName]); for ($i = 1; $i < count($allLibrariesDir); $i++) { $keyName = array_search($allLibrariesDir[$i], $allAvailableLibrariesDir); array_push($allLibrariesName, $allAvailableLibrariesName[$keyName]); } switch (is_numeric($key)) { case true: $_SESSION["optLibrary"] = $allLibrariesName; $_SESSION["optLibraryDir"] = $allLibrariesDir; break; case false: return "Error2"; break; } } $_SESSION["library"] = $libraryName; //nome da biblioteca em uso $_SESSION["libraryDir"] = $selLibrary; //diretorio em uso, e´ a sigla da biblioteca $_SESSION["role"] = $allRoles[0]->contenido; //perfil do usuario $_SESSION["optRole"] = $userRole; //todos os perfils disponivel para o usuario $_SESSION["identified"] = "1"; $_SESSION["logged"] = $usuario->getuserName(); $_SESSION["mfn"] = $usuario->getuserId(); $_SESSION["centerCode"] = $usuario->getCenterCode(); $_SESSION["ticket"] = time(); //die; if ($_GET["lang"]) { $_SESSION["lang"] = $_GET["lang"]; } else { $_SESSION["lang"] = $usuario->getLang(); } return "OK"; } else { return "Error1"; } } }
<?php include "../Model/library.php"; $library = new library(); $library->deleteBook($_GET['bookID']); header("Location: ../View/librarian_home.php"); exit;
<html> <head> <!-- Hlavička s obsahem icony • responsivitou obsahu • Definovaným Title ze souboru config.php • Definovanou znakovou sadou utf-8 ze souboru config.php • Funkci PHP scandir css & Js vkládání z library.php • scripty na bootstrap a ckeditor --> <link href="/View/img/icona.png" rel="icon" type="image/png" /> <meta name="viewport" content="width=device-width, initial-scale=1"> <title><?php echo TITLE; ?> </title> <meta charset="<?php echo DBCHARSET; ?> "> <?php library::echo_head(); ?> <script src="//cdn.ckeditor.com/4.5.7/full/ckeditor.js"></script> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> </head>
public static function menu_show() { library::dbconnect(); global $db; $clanky = $db->prepare('SELECT * FROM menu'); $clanky->execute(); while ($row = $clanky->fetch(PDO::FETCH_ASSOC)) { echo '<li><a href="' . $row['menuname'] . '">' . $row['menuname'] . '</a></li>'; } }
<?php include 'Model/include/Head.php'; include 'Model/include/Menu.php'; ?> <body> <div class="container"> <div class="jumbotron"> <h1 class="text-center">EDIT z CMS</h1> </div> <div class="row"> <div class="col-sm-2"></div> <div class="col-sm-8"> <?php library::content_show(); ?> </div> <div class="col-sm-2"></div> </div> </div>
} elseif ($url_array[0] == "home") { include 'Model/template.php'; } elseif ($url_array[0] == MENU1) { $_SESSION['url'] = MENU1; include 'Model/Pages/content.php'; } elseif ($url_array[0] == MENU2) { $_SESSION['url'] = MENU2; include 'Model/Pages/content.php'; } elseif ($url_array[0] == MENU3) { $_SESSION['url'] = MENU3; include 'Model/Pages/content.php'; } elseif ($url_array[0] == "info") { include 'Model/Pages/info.php'; } elseif ($url_array[0] == "process") { include 'Controller/director.php'; } elseif ($url_array[0] == "register") { include 'Model/Pages/register.php'; } elseif ($url_array[0] == "down") { library::download(); header("location: /info"); } elseif ($url_array[0] == "comment") { if (isset($_SESSION['admin']) || isset($_SESSION['user'])) { $ID = $_SESSION['ID']; library::comment_write($_POST['edit'], $ID); header("location:javascript://history.go(-1)"); } else { library::wrong(); } } else { include 'error.php'; }
<?php include 'Model/include/Head.php'; ?> <body> <div class="container top_margin"> <div class="row"> <div class="col-md-2"> <ul class="nav nav-pills nav-stacked"> <li class="active"><a href="login">Home</a></li> <?php library::menu_show(); ?> </ul> </div> <div class="col-md-10"> <div class="center"> <b id="welcome">Welcome : <i> Vítej v Aplikaci: <?php echo $_SESSION['admin']; ?> </i></b>
<?php define('ROOT', dirname($_SERVER['SCRIPT_FILENAME'])); require ROOT . "/include/admin-init.php"; if (!is_login()) { die(html_jump('login.php')); } set_page_type('library', 'library_manage'); set_page_power(array(1)); set_title("编辑信息"); get_admin_header(); $category = new library_category(); $category->get_id_list(); $all_user = new user_info(); $all_user->get_id_list(); $library = new library(); $book = $library->get_now_book(); if (!is_array($book)) { } else { ?> <div id="library-edit"> <h2 align="center">图书信息编辑</h2> <?php if (isset($_GET['status'])) { if ($_GET['status'] == 'OK') { echo '<p class="status blue center">成功编辑图书信息</p>'; } else { echo '<p class="status red center">', $_GET['status'], '</p>'; } } ?>
</p> <p> <a href="../User/logout.php"> Logout </a> </p> </div> <br> <br> <br> <br> <br> <div class="book_details"> <table border="1"> <?php include "../Model/library.php"; include "../Model/student.php"; $library = new library(); if (isset($_SESSION["user_student"])) { $student = new student($_SESSION["user"]); } $book_loc = $_GET; if (isset($book_loc['checkout'])) { $library->burrow($book_loc['shelf'], $book_loc['book'], $library->shelf[$book_loc['shelf']]->books[$book_loc['book']]->copyID, $student); } if (isset($book_loc['return'])) { $library->returnbook($book_loc['shelf'], $book_loc['book'], $library->shelf[$book_loc['shelf']]->books[$book_loc['book']]->copyID, $student); } echo "<tr>"; echo "<td>"; echo "Book ID"; echo "</td>"; echo "<td>";
<div class="col-sm-2"></div> </div> <div class="clearfix"></div> <div class="row"> <div class="col-sm-2"></div> <div class="col-sm-8"> <div class=""> <?php library::comment_show(); ?> </div> </div> </div> <div class="col-sm-2"></div> </div> <div class="clearfix"></div> <hr> <hr> <div class="row">
/** * A funcao getAllLibraries() retorna dois arrays * o primeiro esta em $libraryName * o segundo esta em $libraryCode * @return array. */ function getAllLibraries() { //colocando todas as bibliotecas disponiveis na base na variavel collectionLibrary $dataModelLib = new library(); $allLibraryData = $dataModelLib->getAllLibraries(); $libraryName = array($allLibraryData[0][2]); $libraryCode = array($allLibraryData[0][1]); for ($i = 1; $i < count($allLibraryData); $i++) { array_push($libraryName, $allLibraryData[$i][2]); array_push($libraryCode, $allLibraryData[$i][1]); } //retorna dois arrays return array($libraryName, $libraryCode); }
<?php include "library.php"; $library = new library(); for ($i = 0; $i < $_POST['numcopies']; $i++) { $library->addBook($_POST['bookid'], $_POST['name'], $_POST['author']); } header("Location: ../View/librarian_home.php");
* @name director Přesměrování na INDEX z pole [1] přez /process/ ... * @param home Description pokud se v poli nachází /home: odkaž zpět na Index */ if ($url_array[1] == "home") { header("location: /"); } elseif ($url_array[1] == "register") { if ($_POST['password'] == $_POST['password_2']) { library::register($_POST['username'], $_POST['password'], $_POST['email']); } else { header("location: /register"); } } elseif ($url_array[1] == "login") { library::login($_POST['username'], $_POST['password']); } elseif ($url_array[1] == "logout") { library::logout(); header('location: /'); } elseif ($url_array[1] == "edit") { library::content_write($_POST['edit'], $_SESSION['url']); include 'Model/CMS.php'; } elseif ($url_array[1] == MENU1) { $_SESSION['url'] = MENU1; header("location:javascript://history.go(-1)"); } elseif ($url_array[1] == MENU2) { $_SESSION['url'] = MENU2; header("location:javascript://history.go(-1)"); } elseif ($url_array[1] == MENU3) { $_SESSION['url'] = MENU3; header("location:javascript://history.go(-1)"); } else { include 'error.php'; }