This commit is contained in:
moanos [he/him] 2019-11-12 12:17:21 +01:00
parent f82ac6c77a
commit 830fc14d62
27 changed files with 1041 additions and 0 deletions

View File

@ -0,0 +1,14 @@
<?php
//database settings
define ("DB_USER", "sampleuser");
define ("DB_HOST", "localhost");
define ("DB_PW", "samplepassword");
define ("DB_DATABASE", "moanos_gartensia");
//database tables:
define ("TABLE_USER", "lib_user");
define("MODULE_PATH", $_SERVER['DOCUMENT_ROOT']);
?>

View File

@ -0,0 +1,45 @@
<?php
require_once(__dir__."/config.inc.php");
$aData[TABLE_USER] = array(
'user_ID' => array(
'type' => 'INT',
'size' => 11,
'unique' => 'TRUE',
'standard' => 'NOT NULL',
'extra' => 'AUTO_INCREMENT PRIMARY KEY'
),
'name' => array(
'type' => 'VARCHAR',
'size' => 255,
'standard' => 'NOT NULL'
),
'email' => array(
'type' => 'VARCHAR',
'size' => 255,
'standard' => 'NOT NULL'
),
'signal' => array(
'type' => 'VARCHAR',
'size' => 255,
'standard' => 'NOT NULL'
),
'sms' => array(
'type' => 'VARCHAR',
'size' => 255,
'standard' => 'NOT NULL'
),
'telegram' => array(
'type' => 'VARCHAR',
'size' => 255,
'standard' => 'NOT NULL'
),
'threema' => array(
'type' => 'VARCHAR',
'size' => 255,
'standard' => 'NOT NULL'
)
);

191
static/form.php Normal file
View File

@ -0,0 +1,191 @@
<?php
class Data{
function __construct(){
$this->link_database();
$this->em_check_database();
$this->read_variables();
date_default_timezone_set($this->settings['timezone']);
}
function read_variables() {
//reads all GET and POST variables into the object, addslashing both
if (count($_POST)) {
foreach ($_POST as $key => $val){
$key=addslashes("r_".$key);
if (is_array($val)) {
for ($z=0;$z<count($val);$z++) {
$val[$z]=addslashes($val[$z]);
}
}
else {
$val=addslashes($val);
}
$this->$key=$val;
}
}
if (count($_GET)) {
foreach ($_GET as $key => $val){
$key=addslashes("r_".$key);
if (is_array($val)) {
for ($z=0;$z<count($val);$z++) {
$val[$z]=addslashes($val[$z]);
}
}
else {
$val=addslashes($val);
}
$this->$key=$val;
}
}
}//end of function read variables
function link_database() {
$this->databaselink = new mysqli(DB_HOST,DB_USER,DB_PW,DB_DATABASE);
$this->databaselink->set_charset('utf8');
if ($this->databaselink->connect_errno) {
return "Datenbank nicht erreichbar: (" . $this->databaselink->connect_errno . ") " . $this->databaselink->connect_error;
}
else{
$this->databasename=DB_DATABASE;
$this->databaselink->query("SET SQL_MODE = '';");
return True;
}
}
function store_data($sTable,$aFields,$sKey_ID,$mID) {
//updates or inserts data
//returns ID or -1 if fails
$i=0; $returnID = 0;
if(($mID>0) or ($mID!="") or ($mID != null)) {
//search for it
$aCheckFields=array($sKey_ID=>$mID);
$aRow=$this->select_row($sTable,$aCheckFields);
$returnID=$aRow[$sKey_ID];
}
if(($returnID>0) or ($returnID!="")) {
$sQuery="update ".$sTable." set ";
foreach($aFields as $key=>$value) {
$sQuery.=$key."='".$value."'";
$i++;
if($i<count($aFields)) {
$sQuery.=",";
}
}
$sQuery.=" where ".$sKey_ID."='".$mID."'";
$mDataset_ID=$returnID;
}
else {
$sKeys = ""; $sValues = "";
$sQuery="insert into ".$sTable." (";
foreach($aFields as $sKey=>$value) {
$sKeys.=$sKey;
$sValues.="'".$value."'";
$i++;
if($i<count($aFields)) {
$sKeys.=",";
$sValues.=",";
}
}
$sQuery.=$sKeys.") values (".$sValues.")";
}
$this->last_query[]=$sQuery;
if ($pResult = $this->databaselink->query($sQuery)) {
if(($returnID>0) or ($returnID!="")) {
return $returnID;
}
else {
return $this->databaselink->insert_id;
}
}
else {
return -1;
}
}
function save_user($aUser){
/*
args:
Array $aUser
Array of user information which will be saved.
e.g. array(
'forename' => String $forname,
'surname' => String $surname,
'email' => String $email,
'UID' => String $UID,
'language' => String $language,
'admin' => Bool $admin,
'password' => String md5(str_rev($password)), #deprecated, do not use!
'password_hash' => password_hash(String $password, PASSWORD_DEFAULT)
);
returns:
None
Function will save user Information given in $aUser. If user exists it will
overwrite existing data but not delete not-specified data
*/
$aFields = $aUser;
if ((isset($this->r_user_ID))and ($this->r_user_ID != "")){
$this->ID=$this->store_data(TABLE_USER, $aFields, 'user_ID' , $this->r_user_ID);
}
else{
$this->ID=$this->store_data(TABLE_USER, $aFields, NULL , NULL);
}
}
}
//end of class
session_start();
include ("config/config.inc.php");
$oObject = new Data;
$oObject->output = "";
switch ($oObject->r_ac){
case 'save'
$aUser = array();
if(isset($oObject->r_user_ID)){
$aUser['user_ID'] = $oObject->r_user_ID;
}
if(isset($oObject->r_name)){
$aUser['name'] = $oObject->r_forename;
}
if(isset($oObject->r_email)){
$aUser['email'] = $oObject->r_email;
}
if(isset($oObject->r_email)){
$aUser['signal'] = $oObject->r_email;
}
if(isset($oObject->r_email)){
$aUser['sms'] = $oObject->r_email;
}
if(isset($oObject->r_email)){
$aUser['telegram'] = $oObject->r_email;
}
if(isset($oObject->r_email)){
$aUser['threema'] = $oObject->r_email;
}
$oObject->save_user($aUser);
$oObject->output += "Erfolgreich gespeichert";
break;
default:
$oObject->get_view("views/user_form.php");
}
function output($oObject){
echo $oObject->get_view("views/head.php");
echo $oObject->get_view("views/body.php");
}
output($oObject);
}
?>

View File

@ -0,0 +1,37 @@
<?php
$table = "<table border='0' cellspacing='0' >";
$table .=
'<tr>
<th>'.$this->oLang->texts['TITLE'].'</th>
<th>'.$this->oLang->texts['AUTHOR'].'</th>
<th>'.$this->oLang->texts['LOCATION'].'</th>
<th>'.$this->oLang->texts['STATUS_AVAILABLE'].'</th>
<th>'.$this->oLang->texts['TOTAL'].'</th>
</tr>';
foreach ($this->aBook as $title => $aResult){
//var_dump($aResult);
if($aResult['available']==0){
$sClass = 'lent';
}
else{
$sClass = 'available';
}
$table .=
'<tr class= "'.$sClass.'">
<td>'.$aResult['title'].'</td>
<td>'.$aResult['author'].'</td>
<td>'.$aResult['location'].'</td>
<td>'.$aResult['available'].'</td>
<td>'.$aResult['number'].'</td>';
}
$table .="</table>";
echo $table;
?>

View File

@ -0,0 +1,62 @@
<?php
/*
Adds Button to add book
*/
$form = '<form action="';
$form .= htmlspecialchars($_SERVER["PHP_SELF"]);
$form.= '" method="post">
<input type = hidden name="ac" value = "book_new">
<input type="submit" value="'.$this->oLang->texts['NEW_BOOK'].'">
</form>';
echo $form;
/*
Adds a table of all itemized books
*/
$table = "<table border='0' cellspacing='0' >";
$table .=
"<tr>
<th>".$this->oLang->texts['BOOK_ID']."</th>
<th>".$this->oLang->texts['TITLE']."</th>
<th>".$this->oLang->texts['AUTHOR']."</th>
<th>".$this->oLang->texts['LOCATION']."</th>
<th>".$this->oLang->texts['STATUS']."</th>";
$table .='
<th>'.$this->oLang->texts['BUTTON_CHANGE'].'</th>
<th>'.$this->oLang->texts['BUTTON_DELETE'].'</th>
</tr>';
foreach ($this->aBook as $book_ID => $aResult)
{
if($aResult['lent'] == 0){
$sClass= "available";
$sStatus= $this->oLang->texts['STATUS_AVAILABLE'];
}
else{
$sClass = "lent";
$sStatus = $this->oLang->texts['STATUS_LENT'];
}
$table .=
'<tr class= "'.$sClass.'">
<td>'.$aResult['book_ID'].'</td>
<td>'.$aResult['title'].'</td>
<td>'.$aResult['author'].'</td>
<td>'.$aResult['location'].'</td>
<td>'.$sStatus.'</td>
<td> <a href="index.php?ac=book_change&book_ID='.$aResult['book_ID'].'" > '.$this->oLang->texts['BUTTON_CHANGE'].' </a> </td>
<td> <a href="index.php?ac=book_delete&book_ID='.$aResult['book_ID'].'" > '.$this->oLang->texts['BUTTON_DELETE'].' </a> </td>
</tr>';
}
$table .="</table>";
echo $table;
?>

View File

@ -0,0 +1,35 @@
<?php
$table = "<table border='0' cellspacing='0' >";
$table .=
'<tr>
<th>'.$this->oLang->texts['TITLE'].'</th>
<th>'.$this->oLang->texts['AUTHOR'].'</th>
<th>'.$this->oLang->texts['LOCATION'].'</th>
<th>'.$this->oLang->texts['AVAILABLE'].'</th>
<th>'.$this->oLang->texts['TOTAL'].'</th>';
foreach ($this->aBook as $title => $aResult){
if($aResult['available']==0){
$sClass = 'lend';
}
else{
$sClass = 'available';
}
$table .=
'<tr class= "'.$sClass.'">
<td>'.$aResult['title'].'</td>
<td>'.$aResult['author'].'</td>
<td>'.$aResult['location'].'</td>
<td>'.$aResult['available'].'</td>
<td>'.$aResult['number'].'</td>';
}
$table .="</table>";
echo $table;
?>

View File

@ -0,0 +1,66 @@
<?php
$table = "<table border='1'>";
$table .=
'<tr>
<th>'.$this->oLang->texts['LOAN_ID'].'</th>
<th>'.$this->oLang->texts['LENT_ON'].'</th>
<th>'.$this->oLang->texts['RETURNED_ON'].'</th>
<th>'.$this->oLang->texts['TITLE_MATERIAL'].'</th>
<th>'.$this->oLang->texts['ID'].'</th>
<th>'.$this->oLang->texts['FORENAME'].'</th>
<th>'.$this->oLang->texts['SURNAME'].'</th>
<th>'.$this->oLang->texts['USER_ID'].'</th>';
if ($_SESSION['admin']==1){
$table .= '
<th>'.$this->oLang->texts['BUTTON_CHANGE'].'</th>
<th>'.$this->oLang->texts['BUTTON_RETURN'].'</th>';
}
$table .= "</tr>";
foreach ($this->aLoan as $loan_ID => $aResult)
{
$table .=
'<tr>
<td>'.$aResult['loan_ID'].'</td>
<td>'.$aResult['pickup_date'].'</td>
<td>';
if($aResult['return_date'] == 0000-00-00){
$table .= $this->oLang->texts['STATUS_LENT'];
}
else{
$table.= $aResult['return_date'];
}
$table .= '</td>
<td>'.$this->all_book[$aResult['ID']]['title'].$this->all_material[$aResult['ID']]['name'].'</td>
<td>'.$aResult['ID'].'</td>
<td>'.$this->all_user[$aResult['user_ID']]['forename'].'</td>
<td>'.$this->all_user[$aResult['user_ID']]['surname'].'</td>
<td>'.$aResult['user_ID'].'</td>';
if($_SESSION['admin']==1){
$table .=
'<td> <a href="index.php?ac=loan_change&loan_ID='.$aResult['loan_ID'].'" >'.$this->oLang->texts['BUTTON_CHANGE'].' </<> </td>
';
if ($aResult['return_date']==000-00-00){
$table .='
<td> <a href="index.php?ac=loan_return&loan_ID='.$aResult["loan_ID"].'&ID='.$aResult["ID"].'" >'.$this->oLang->texts['BUTTON_RETURN'].' </<> </td>';
}
else{
$table .='
<td>'.$this->oLang->texts['ALREADY_RETURNED'].'</td>';
}
$table .='</tr>';
}
}
$table = $table."</table>";
echo $table;
$form ='
<form action="'.htmlspecialchars($_SERVER["PHP_SELF"]).'" method="post">
<input type = hidden name="ac" value = "loan_new">
<input type="submit" value='.$this->oLang->texts['NEW_LOAN'].'>
</form>';
echo $form;
?>

View File

@ -0,0 +1,33 @@
<?php
$table = "<table border='0' cellspacing='0' >";
$table .=
"<tr>
<th>".$this->oLang->texts['NAME']."</th>
<th>".$this->oLang->texts['LOCATION']."</th>
<th>".$this->oLang->texts['STATUS_AVAILABLE']."</th>
<th>".$this->oLang->texts['TOTAL']."</th>";
foreach ($this->aMaterial as $title => $aResult){
if($aResult['available']==0){
$sClass = 'lent';
}
else{
$sClass = 'available';
}
$table .=
'<tr class= "'.$sClass.'">
<td>'.$aResult['name'].'</td>
<td>'.$aResult['location'].'</td>
<td>'.$aResult['available'].'</td>
<td>'.$aResult['number'].'</td>';
}
$table .="</table>";
echo $table;
?>

View File

@ -0,0 +1,55 @@
<?php
$table = "<table border='0' cellspacing='0' >";
$table .=
'<tr>
<th>'.$this->oLang->texts['MATERIAL_ID'].'</th>
<th>'.$this->oLang->texts['NAME'].'</th>
<th>'.$this->oLang->texts['LOCATION'].'</th>
<th>'.$this->oLang->texts['STATUS'].'</th>';
$table .='
<th>'.$this->oLang->texts['BUTTON_CHANGE'].'</th>
<th>'.$this->oLang->texts['BUTTON_DELETE'].'</th>';
$table .='</tr>';
foreach ($this->aMaterial as $material_ID => $aResult)
{
if($aResult['lent'] == 0){
$sClass= "available";
$sStatus= $this->oLang->texts['STATUS_AVAILABLE'];
}
else{
$sClass = "lent";
$sStatus = $this->oLang->texts['STATUS_LENT'];
}
$table .=
'<tr class= "'.$sClass.'">
<td>'.$aResult['material_ID'].'</td>
<td>'.$aResult['name'].'</td>
<td>'.$aResult['location'].'</td>
<td>'.$sStatus;
$table .=
'</td>
<td> <a href="index.php?ac=material_change&material_ID='.$aResult['material_ID'].'" >'.$this->oLang->texts['BUTTON_CHANGE'].' </a> </td>
<td> <a href="index.php?ac=material_delete&material_ID='.$aResult['material_ID'].'" >'.$this->oLang->texts['BUTTON_DELETE'].'</a> </td>
</tr>';
}
$table .="</table>";
echo $table;
$form = '<form action="';
$form .= htmlspecialchars($_SERVER["PHP_SELF"]);
$form.= '" method="post">
<input type = hidden name="ac" value = "material_new">
<input type="submit" value="'.$this->oLang->texts['NEW_MATERIAL'].'">
</form>';
echo $form;
?>

View File

@ -0,0 +1,64 @@
<?php
$form ='
<form action="'.htmlspecialchars($_SERVER["PHP_SELF"]).'" method="post">
<input type = hidden name="ac" value = "presence_new">
<input type="submit" value='.$this->oLang->texts['NEW_PRESENCE'].'>
</form>';
echo $form;
$table = "<table border='1'>";
$table .=
'<tr>
<th>'.$this->oLang->texts['FORENAME'].'</th>
<th>'.$this->oLang->texts['SURNAME'].'</th>
<th>'.$this->oLang->texts['CHECKIN_AT'].'</th>
<th>'.$this->oLang->texts['CHECKOUT_AT'].'</th>';
if ($_SESSION['admin']==1){
$table .= '
<th>'.$this->oLang->texts['BUTTON_CHANGE'].'</th>
<th>'.$this->oLang->texts['BUTTON_CHECKOUT'].'</th>
<th>'.$this->oLang->texts['BUTTON_DELETE'].'</th>';
}
$table .= "</tr>";
foreach ($this->aPresence as $presence_ID => $aResult){
if(isset($this->all_user[$aResult['UID']]['forename'])){
$table .=
'<tr>
<td>'.$this->all_user[$aResult['UID']]['forename'].'</td>
<td>'.$this->all_user[$aResult['UID']]['surname'].'</td>
<td>'.$aResult['checkin_time'].'</td>
<td>';
if($aResult['checkout_time'] == "0000-00-00 00:00:00"){
$table .= $this->oLang->texts['STATUS_PRESENT'];
}
else{
$table.= $aResult['checkout_time'];
}
$table .= '</td>';
if($_SESSION['admin']==1){
$table .=
'<td> <a href="index.php?ac=presence_change&presence_ID='.$aResult['presence_ID'].'" >'.$this->oLang->texts['BUTTON_CHANGE'].' </<> </td>
';
if ($aResult['checkout_time'] == "0000-00-00 00:00:00"){
$table .='
<td> <a href="index.php?ac=presence_checkout&UID='.$aResult["UID"].'" >'.$this->oLang->texts['BUTTON_CHECKOUT'].' </<> </td>';
}
else{
$table .='
<td>'.$this->oLang->texts['ALREADY_CHECKED_OUT'].'</td>';
}
$table .=
'<td> <a href="index.php?ac=presence_delete&presence_ID='.$aResult['presence_ID'].'" >'.$this->oLang->texts['BUTTON_DELETE'].' </<> </td>
</tr>';
}
}
}
$table = $table."</table>";
echo $table;
?>

62
static/views/all_user.php Normal file
View File

@ -0,0 +1,62 @@
<?php
/*
Outputs button that redirects to the "Add User" Page
*/
if ($_SESSION['admin']==1){
$form ='
<form action="'.htmlspecialchars($_SERVER["PHP_SELF"]).'" method="post">
<input type = hidden name="ac" value = "user_new">
<input type="submit" value="'.$this->oLang->texts['BUTTON_ADD_USER'].'">
</form>';
echo $form;
}
/*
Creates Table that shows all lends
*/
$table = "<table border='1'>";
$table .=
'<tr>
<th>'.$this->oLang->texts['USER_ID'].'</th>
<th>'.$this->oLang->texts['SURNAME'].'</th>
<th>'.$this->oLang->texts['FORENAME'].'</th>
<th>'.$this->oLang->texts['EMAIL'].'</th>
<th>'.$this->oLang->texts['UID'].'</th>
';
if ($_SESSION['admin']==1) {
$table .=
'<th>'.$this->oLang->texts['BUTTON_CHANGE'].'</th>
<th>'.$this->oLang->texts['BUTTON_DELETE'].'</th>';
if (($_SESSION['admin']==1) or ($this->r_user_ID = $_SESSION['user_ID'])){
$table .= '<th>'.$this->oLang->texts['BUTTON_SHOW_LOANS'].'</th>';
}
}
$table .= '</tr>';
foreach ($this->aUser as $user_ID => $aResult)
{
$table .=
'<tr>
<td>'.$aResult['user_ID'].'</td>
<td>'.$aResult['forename'].'</td>
<td>'.$aResult['surname'].'</td>
<td>'.$aResult['email'].'</td>
<td>'.$aResult['UID'].'</td>';
if ($_SESSION['admin']==1){
$table .=
'<td> <a href="index.php?ac=user_change&user_ID='.$aResult['user_ID'].'" >'.$this->oLang->texts['BUTTON_CHANGE'].' </<> </td>
<td> <a href="index.php?ac=user_delete&user_ID='.$aResult['user_ID'].'" >'.$this->oLang->texts['BUTTON_DELETE'].' </<> </td>';
if (($_SESSION['admin']==1) or ($this->r_user_ID = $_SESSION['user_ID'])){
$table .='
<td> <a href="index.php?ac=loan_show&user_ID='.$aResult['user_ID'].'" > '.$this->oLang->texts['BUTTON_SHOW_LOANS'].' </<> </td>';
}
}
$table .= '</tr>';
}
$table = $table."</table>";
echo $table;
?>

13
static/views/body.php Normal file
View File

@ -0,0 +1,13 @@
<body>
<?php
if ((isset($this->error)) and ($this->error != "")){
echo "<div id=error>";
echo $this->error;
echo "</div>";
}
echo "<div id=content>";
echo $this->output;
echo "</div>";
?>

View File

@ -0,0 +1,34 @@
<?php
$form = '<form action="'.$_SERVER["PHP_SELF"].'" method="post">
<input type = hidden name="ac" value = "book_save">'.
$this->oLang->texts['BOOK_ID'].': <input type="text" name="book_ID" value="';
if(isset($this->aRow['book_ID']))
{
$form .= $this->aRow['book_ID'];
}
$form .= '"> <br>';
if(!isset($this->aRow['book_ID'])){
$form .=
$this->oLang->texts['NUMBER'].': <input type="text" name="number"> <br>';
}
$form .= $this->oLang->texts['TITLE'].': <input type="text" name="title" value="';
if(isset($this->aRow['title'])){
$form .= $this->aRow['title'];
}
$form .= '"><br>'.
$this->oLang->texts['AUTHOR'].': <input type="text" name="author" value="';
if(isset($this->aRow['author'])){
$form .= $this->aRow['author'];
}
$form .= '"> <br>';
$form .= $this->oLang->texts['LOCATION'].': <input type="text" name="location" value="';
if(isset($this->aRow['location'])){
$form .= $this->aRow['location'];
}
$form .= '"> <br>
<input type="submit" value="'.$this->oLang->texts['BUTTON_SEND'].'">
<input type="reset" value="'.$this->oLang->texts['BUTTON_RESET'].'">
</form>';
echo $form;
?>

View File

@ -0,0 +1,3 @@
<?php
echo '<h1>'.$this->oLang->texts['CHANGED_LANGUAGE_TO'].': '.$_SESSION['language'].'</h1>';
?>

View File

@ -0,0 +1,20 @@
<?php
echo '<table>
<th>'.$this->oLang->texts['W_DAY'].'</th>
<th>'.$this->oLang->texts['W_START'].'</th>
<th>'.$this->oLang->texts['W_END'].'</th>
<th>'.$this->oLang->texts['W_NOTICE'].'</th>';
foreach($this->settings['opening_days'] as $day){
echo '<tr>
<td>'.constant(strtoupper($day)).'</td>
<td>'.$this->aOpen[$day]["start"].'</td>
<td>'.$this->aOpen[$day]["end"].'</td>
<td>'.$this->aOpen[$day]["notice"].'</td>
</tr>';
}
echo '</table>';
?>

22
static/views/footer.php Normal file
View File

@ -0,0 +1,22 @@
<?php
$footer ='
<div id= footer>
<div>
<a id=logo class=logo href="'.$this->oLang->library_info['FOOTER_LINK_1'].'" title="'.$this->oLang->library_info['FOOTER_LINK_1_TITLE'].'">
<span class="fs_logo"></span>
</a>
<a href="'.$this->oLang->library_info['FOOTER_LINK_2'].'" title="'.$this->oLang->library_info['FOOTER_LINK_2_TITLE'].'" >
<span class="forum_logo"></span>
</a>
<span class="link_list">
<h1>'.$this->oLang->texts['LINKS'].': </h1>
<ul>
<li><a href="'.$this->oLang->library_info['CONTACT_LINK'].'" title="'.$this->oLang->texts['CONTACT'].'" >'.$this->oLang->texts['CONTACT'].'</a></li>
<li><a href="'.$this->oLang->library_info['PRIVACY_LINK'].'" title="'.$this->oLang->texts['PRIVACY'].'">'.$this->oLang->texts['PRIVACY'].'</a></li>
</ul>
</span>
</div>
</div>';
echo $footer;
?>

15
static/views/head.php Normal file
View File

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="author" content="Sam">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<link rel="SHORTCUT ICON" type="image/x-icon" href="images/favicon.ico">
<?php
echo ' <link REL="stylesheet" TYPE="text/css" HREF="css/styles.css">
<title>Address collection</title>
';
?>
</head>

47
static/views/header.php Normal file
View File

@ -0,0 +1,47 @@
<?php
$header = '
<div id="header">
<div class="side-description">
<a class="logo" href="./index.php" title="'.$this->oLang->texts['HOME'].'">
<img src="images/logo_library.png" border=0 />
</a>
<h1>'.$this->oLang->library_info['LIBRARY_NAME'].'</h1>
<p>'.$this->oLang->library_info['LIBRARY_DESCRIPTION'].'</p>
</div>';
if ($this->settings['enable_status'] == 1){
$oPresence = new Presence;
$status = $oPresence->get_status();
$header .=
'<div class="status">
<h1>'.$this->oLang->texts['CURRENT_STATUS'].'</h1>';
if($status){
$header.= $this->oLang->texts['OPEN'];
}
else{
$header.= $this->oLang->texts['CLOSE'];
}
}
$header.='<br><br>
<div class="language">
<form action="'.$_SERVER["PHP_SELF"].'" method="post">
<input type = hidden name="ac" value = "language_change">'.
$this->oLang->texts['LANGUAGE'].':<input type="radio" id="english" name="language" value="english"';
if ($_SESSION['language']=='english'){
$header .= 'checked';
}
$header.= '>
<label for="english">'.$this->oLang->texts['ENGLISH'].' </label>
<input type="radio" id="german" name="language" value="german"';
if (($_SESSION['language']=="german") or (!isset($_SESSION['language']))){
$header .= ' checked';
}
$header.= '>
<label for id ="german">'.$this->oLang->texts['GERMAN'].'</label><br>
<input type="submit" value="'.$this->oLang->texts['CHANGE_LANGUAGE'].'">
</form>
</div>
</div>
</div>';
echo $header;
?>

View File

@ -0,0 +1,45 @@
<?php
$form = '<form action="'.htmlspecialchars($_SERVER["PHP_SELF"]).'" method="post">
<input type = hidden name="ac" value = "loan_save">';
if(isset($this->r_loan_ID)){
$form .='<input type = hidden name="loan_ID" value = "'.$this->r_loan_ID.'">';
}
$form .=
$this->oLang->texts['USER_ID'].': <input type="text" name="user_ID" value="';
if(isset($this->aLoan['user_ID'])){
$form .= $this->aLoan['user_ID'];
}
$form .= '"> <br>'.
$this->oLang->texts['TYPE'].': <input type="radio" id="book" name="type" value="book"';
if ($this->aLoan['type']== "book"){
$form .= 'checked';
}
$form .= '>
<label for="book">'.$this->oLang->texts['BOOK'].'</label>
<input type="radio" id="material" name="type" value="material"';
if ($this->aLoan['type']=="material"){
$form .= 'checked';
}
$form .= '>
<label for id ="material">'.$this->oLang->texts['MATERIAL'].'</label><br>'.
$this->oLang->texts['ID'].': <input type="text" name="ID" value="';
if(isset($this->aLoan['ID'])){
$form .= $this->aLoan['ID'];
}
$form .= '"> <br>'.
$this->oLang->texts['LENT_ON'].': <input type="text" name="pickup_date" value="';
if(isset($this->aLoan['pickup_date'])){
$form .= $this->aLoan['pickup_date'];
}
$form .= '"> <br>'.
$this->oLang->texts['RETURNED_ON'].': <input type="text" name="return_date" value="';
if(isset($this->aLoan['return_date'])){
$form .= $this->aLoan['return_date'];
}
$form .= '"> <br>
<input type="submit" value="'.$this->oLang->texts['BUTTON_SEND'].'">
<input type="reset" value="'.$this->oLang->texts['BUTTON_RESET'].'">
</form>';
echo $form;

View File

@ -0,0 +1,18 @@
<?php
$login = '
<br><h1>'.$this->oLang->texts['PLEASE_LOG_IN'].' :</h1><br>
<form action="'.htmlspecialchars($_SERVER["PHP_SELF"]).'" method="post">
<input type = hidden name="ac" value = "strt">
<label for ="user_info">'.$this->oLang->texts['USER_ID_OR_EMAIL'].': </label><br>
<input id="user_info" type="text" name="login_user_info"><br><br>
<label for ="pw"> '.$this->oLang->texts['PASSWORD'].' </label><br>
<input id="pw" type="password" name="login_password"><br>
<input type="submit" value="'.$this->oLang->texts['BUTTON_SEND'].'">
<input type="reset" value="'.$this->oLang->texts['BUTTON_RESET'].'">
</form>';
echo $login;

View File

@ -0,0 +1,7 @@
<?php
echo
'<h1>'.$this->oLang->texts['TODAYS_MAIL_STATS'].'</h1><br>'.
$this->oLang->texts['TOTAL_MAILS'].': '.$this->mail_stats['total'].'<br>'.
$this->oLang->texts['SUCCESSFUL_MAILS'].': '.$this->mail_stats['successful'].'<br>'.
$this->oLang->texts['FAILED_MAILS'].': '.$this->mail_stats['failed'].'<br>';
?>

View File

@ -0,0 +1,28 @@
<?php
$form .= '<form action="'.$_SERVER["PHP_SELF"].'" method="post">
<input type = hidden name="ac" value = "material_save">
'.$this->oLang->texts['MATERIAL_ID'].': <input type="text" name="material_ID" value="';
if(isset($this->aRow['material_ID'])){
$form .= $this->aRow['material_ID'];
}
$form .= '"> <br>';
if(!isset($this->aRow['material_ID'])){
$form .= $this->oLang->texts['NUMBER'].': <input type=\"text\" name="number"> <br>';
}
$form .= $this->oLang->texts['NAME'].' : <input type="text" name="name" value=';
if(isset($this->aRow['name'])){
$form .= $this->aRow['name'];
}
$form .= '><br>'.
$this->oLang->texts['LOCATION'].': <input type="text" name="location" value=';
if(isset($this->aRow['location'])){
$form .= $this->aRow['location'];
}
$form .= '> <br>
<input type="submit" value='.$this->oLang->texts['BUTTON_SEND'].'>
<input type="reset" value='.$this->oLang->texts['BUTTON_RESET'].'>
</form>';
echo $form;
?>

View File

@ -0,0 +1,29 @@
<?php
$navigation ='
<ul>
<li><a href="index.php">'.$this->oLang->texts['HOME'].'</a></li>
<li><a href="index.php?ac=book_show">'.$this->oLang->texts['ALL_BOOKS'].'</a></li>
<li><a href="index.php?ac=material_show">'.$this->oLang->texts['ALL_MATERIAL'].'</a></li>
<li><a href="index.php?ac=open_show">'.$this->oLang->texts['OPENING_HOURS'].'</a></li>';
if ($_SESSION['admin'] ==1){
$navigation .= '
<li><a href="index.php?ac=user_show">'.$this->oLang->texts['ALL_USER'].'</a></li>
<li><a href="index.php?ac=user_search">'.$this->oLang->texts['SEARCH_USER'].'</a></li>
<li><a href="index.php?ac=user_new">'.$this->oLang->texts['NEW_USER'].'</a></li>
<li><a href="index.php?ac=open_change">'.$this->oLang->texts['CHANGE_OPENING_HOURS'].'</a></li>
<li><a href="index.php?ac=loan_show">'.$this->oLang->texts['ALL_LOAN'].'</a></li>
<li><a href="index.php?ac=loan_new">'.$this->oLang->texts['NEW_LOAN'].'</a></li>
<li><a href="index.php?ac=book_show_itemized">'.$this->oLang->texts['SHOW_BOOKS_ITEMIZED'].'</a></li>
<li><a href="index.php?ac=material_show_itemized">'.$this->oLang->texts['SHOW_MATERIAL_ITEMIZED'].'</a></li>
<li><a href="index.php?ac=presence_show_all">'.$this->oLang->texts['SHOW_PRESENCE'].'</a></li>
';
}
$navigation .= '
<li><a href="index.php?ac=user_self">'.$this->oLang->texts['MY_PROFIL'].'</a></li>
<li><a href="index.php?ac=loan_self">'.$this->oLang->texts['MY_LOANS'].'</a></li>
<li><a href="index.php?ac=logo">'.$this->oLang->texts['LOGOUT'].'</a></li>
</ul>';
echo $navigation;
?>

View File

@ -0,0 +1,38 @@
<?php
$open_form ='
<form action="'.htmlspecialchars($_SERVER["PHP_SELF"]).'" method="post">
<input type = hidden name="ac" value = "open_save">
<table>
<th>'.$this->oLang->texts['W_DAY'].'</th>
<th>'.$this->oLang->texts['W_START'].'</th>
<th>'.$this->oLang->texts['W_END'].'</th>
<th>'.$this->oLang->texts['W_NOTICE'].'</th>';
foreach($this->settings['opening_days'] as $day){
$open_form .= '<tr>
<td>'.$this->oLang->texts[strtoupper($day)].'</td>
<td><input type="text" name="'.$day.'_s" value="';
if (isset($this->aOpen[$day]["start"])){
$open_form.= $this->aOpen[$day]["start"];
}
$open_form .= '"></td>
<td><input type="text" name="'.$day.'_e" value="';
if (isset($this->aOpen[$day]["end"])){
$open_form.= $this->aOpen[$day]["end"];
}
$open_form .= '"></td>
<td><input type="text" name="'.$day.'_n" value="';
if (isset($this->aOpen[$day]["notice"])){
$open_form.= $this->aOpen[$day]["notice"];
}
$open_form .='"></td>
</tr>';
}
$open_form .= '</table>
<input type="submit" value="'.$this->oLang->texts['BUTTON_SEND'].'">
</form>';
echo $open_form;
?>

View File

@ -0,0 +1,31 @@
<?php
$form = '<form action="'.htmlspecialchars($_SERVER["PHP_SELF"]).'" method="post">
<input type = hidden name="ac" value = "presence_save">
<input type = hidden name="presence_ID" value = "';
if(isset($this->r_presence_ID))
{
$form .= $this->r_presence_ID;
}
$form .= '">'.
$this->oLang->texts['UID'].': <input type="text" name="UID" value="';
if(isset($this->aRow['UID'])){
$form .= $this->aRow['UID'];
}
$form .='"><br>'.
$this->oLang->texts['CHECKIN_AT'].': <input type="text" name="checkin_time" value="';
if(isset($this->aRow['checkin_time'])){
$form .= $this->aRow['checkin_time'];
}
$form .= '"> <br>'.
$this->oLang->texts['CHECKOUT_AT'].': <input type="text" name="checkout_time" value="';
if(isset($this->aRow['checkout_time'])){
$form .= $this->aRow['checkout_time'];
}
$form .= '"> <br>';
$form .= '
<input type="submit" value="'.$this->oLang->texts['BUTTON_SEND'].'">
<input type="reset" value="'.$this->oLang->texts['BUTTON_RESET'].'">
</form>';
echo $form;
?>

10
static/views/start.php Normal file
View File

@ -0,0 +1,10 @@
<?php
$start = $this->oLang->texts['WELCOME'];
if ($_SESSION['admin']==0){
$start .= $this->oLang->texts['USER_INSTRUCTION'];
}
else{
$start .= $this->oLang->texts['ADMIN_INSTRUCTION'];
}
echo $start;
?>

View File

@ -0,0 +1,17 @@
<?php
$form = '<form action="'.htmlspecialchars($_SERVER["PHP_SELF"]).'" method="post">';
$form .='
<input type = hidden name="ac" value = "user_save">
<input type = hidden name="user_ID" value = "">';
$form .= 'Name: <input type="text" name="name" value=""><br>'.
$form .= 'E-Mail: <input type="text" name="email" value=""><br>'.
$form .= 'Signal: <input type="text" name="signal" value=""><br>'.
$form .= 'SMS: <input type="text" name="sms" value=""><br>'.
$form .= 'Telegram: <input type="text" name="telegram" value=""><br>'.
$form .= 'Threema: <input type="text" name="threema" value=""><br>'.
$form .= '
<input type="submit" value="'.$this->oLang->texts['BUTTON_SEND'].'">
<input type="reset" value="'.$this->oLang->texts['BUTTON_RESET'].'";
</form>';
echo $form;
?>