information data merged to master
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -2,3 +2,5 @@
|
||||
php_errors.log
|
||||
/_image
|
||||
/_developer
|
||||
/jQuery
|
||||
/ckeditor
|
||||
|
||||
@@ -10,7 +10,7 @@ RewriteRule ^\/?(_developer)\/([a-zA-Z0-9\.\_]*) _developer/$2 [NC]
|
||||
RewriteRule ^\/?(_css\/)([a-zA-Z0-9_]+)\.css$ _css/$2.css [NC]
|
||||
RewriteRule ^\/?(_ajax\/)([a-zA-Z0-9_]+)\.php$ _ajax/$2.php [NC,L]
|
||||
|
||||
|
||||
RewriteCond %{REQUEST_URI} !^/ckeditor/?$
|
||||
RewriteRule ^([a-z_]+)\/?([0-9a-z_]*)\/?([0-9a-z_]*)$ index.php?page=$1&subpage=$2&id=$3 [NC,L]
|
||||
|
||||
|
||||
|
||||
@@ -152,6 +152,9 @@ class page {
|
||||
case 'money_update':
|
||||
# FRISSÍTÉS
|
||||
include('include_money_update.php');
|
||||
case 'settings':
|
||||
# BEÁLLÍTÁSOK
|
||||
include('include_settings.php');
|
||||
break;
|
||||
case 'delete_training_type':
|
||||
# EDZÉS TÍPUS TÖRLÉS
|
||||
@@ -220,6 +223,10 @@ class page {
|
||||
# napló, edzéslista
|
||||
include('include_diary.php');
|
||||
break;
|
||||
case 'information':
|
||||
# információk
|
||||
include('include_information.php');
|
||||
break;
|
||||
default:
|
||||
include('include_diary.php');
|
||||
break;
|
||||
|
||||
62
_class/class_setting.php
Normal file
62
_class/class_setting.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
class setting {
|
||||
private $set_id;
|
||||
private $set_name;
|
||||
private $set_setting_type_st_id; //id
|
||||
private $set_setting_type; //obj
|
||||
|
||||
public function set_setting_data_by_id($_id) {
|
||||
global $sql;
|
||||
$set_data_assoc_array = $sql->assoc_array("select * from setting where set_id = " . $_id);
|
||||
$set_data_array = $set_data_assoc_array[0];
|
||||
foreach ($set_data_array as $field => $value) {
|
||||
$function_name = "set_" . $field;
|
||||
$this->$function_name($value); //alapadatok beállítása
|
||||
|
||||
if ($field == 'set_setting_type_st_id') {
|
||||
$new_st = new setting_type();
|
||||
$new_st->set_setting_type_data_by_id($value);
|
||||
$this->set_set_setting_type($new_st);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function set_set_id($_item) {
|
||||
$this->set_id = $_item;
|
||||
}
|
||||
|
||||
public function set_set_name($_item) {
|
||||
$this->set_name = $_item;
|
||||
}
|
||||
|
||||
public function set_set_setting_type_st_id($_item) {
|
||||
$this->set_setting_type_st_id = $_item;
|
||||
}
|
||||
|
||||
public function set_set_setting_type($_item) {
|
||||
$this->set_setting_type = $_item;
|
||||
}
|
||||
|
||||
|
||||
public function get_set_id() {
|
||||
return $this->set_id;
|
||||
}
|
||||
|
||||
public function get_set_name() {
|
||||
return $this->set_name;
|
||||
}
|
||||
|
||||
public function get_set_setting_type_st_id() {
|
||||
return $this->set_setting_type_st_id;
|
||||
}
|
||||
|
||||
public function get_set_setting_type() {
|
||||
return $this->set_setting_type;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
46
_class/class_setting_type.php
Normal file
46
_class/class_setting_type.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
class setting_type {
|
||||
private $st_id;
|
||||
private $st_name;
|
||||
private $st_setting_data_type; //int, varchar, text, date
|
||||
|
||||
public function set_setting_type_data_by_id($_id) {
|
||||
global $sql;
|
||||
$st_data_assoc_array = $sql->assoc_array("select * from setting_type where st_id = " . $_id);
|
||||
$st_data_array = $st_data_assoc_array[0];
|
||||
foreach ($st_data_array as $field => $value) {
|
||||
$function_name = "set_" . $field;
|
||||
$this->$function_name($value); //alapadatok beállítása
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function set_st_id($_item) {
|
||||
$this->st_id = $_item;
|
||||
}
|
||||
|
||||
public function set_st_name($_item) {
|
||||
$this->st_name = $_item;
|
||||
}
|
||||
|
||||
public function set_st_setting_data_type($_item) {
|
||||
$this->st_setting_data_type = $_item;
|
||||
}
|
||||
|
||||
public function get_st_id() {
|
||||
return $this->st_id;
|
||||
}
|
||||
|
||||
public function get_st_name() {
|
||||
return $this->st_name;
|
||||
}
|
||||
|
||||
public function get_st_setting_data_type() {
|
||||
return $this->st_setting_data_type;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
100
_class/class_setting_value.php
Normal file
100
_class/class_setting_value.php
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
class setting_value {
|
||||
private $setv_id;
|
||||
private $setv_set_date;
|
||||
private $setv_setting_set_id; //id
|
||||
private $setv_setting; //obj
|
||||
private $setv_int;
|
||||
private $setv_varchar;
|
||||
private $setv_text;
|
||||
private $setv_date;
|
||||
|
||||
|
||||
public function set_setv_id($_item) {
|
||||
$this->setv_id = $_item;
|
||||
}
|
||||
|
||||
public function set_setv_set_date($_item) {
|
||||
$this->setv_set_date = $_item;
|
||||
}
|
||||
|
||||
public function set_setv_setting_set_id($_item) {
|
||||
$this->setv_setting_set_id = $_item;
|
||||
}
|
||||
|
||||
public function set_setv_setting($_item) {
|
||||
$this->setv_setting = $_item;
|
||||
}
|
||||
|
||||
public function set_setv_int($_item) {
|
||||
$this->setv_int = $_item;
|
||||
}
|
||||
|
||||
public function set_setv_varchar($_item) {
|
||||
$this->setv_varchar = $_item;
|
||||
}
|
||||
|
||||
public function set_setv_text($_item) {
|
||||
$this->setv_text = $_item;
|
||||
}
|
||||
|
||||
public function set_setv_date($_item) {
|
||||
$this->setv_date = $_item;
|
||||
}
|
||||
|
||||
public function get_setv_id() {
|
||||
return $this->setv_id;
|
||||
}
|
||||
|
||||
public function get_setv_set_date() {
|
||||
return $this->setv_set_date;
|
||||
}
|
||||
|
||||
public function get_setv_setting_set_id() {
|
||||
return $this->setv_setting_set_id;
|
||||
}
|
||||
|
||||
public function get_setv_setting() {
|
||||
return $this->setv_setting;
|
||||
}
|
||||
|
||||
public function get_setv_int() {
|
||||
return $this->setv_int;
|
||||
}
|
||||
|
||||
public function get_setv_varchar() {
|
||||
return $this->setv_varchar;
|
||||
}
|
||||
|
||||
public function get_setv_text() {
|
||||
return $this->setv_text;
|
||||
}
|
||||
|
||||
public function get_setv_date() {
|
||||
return $this->setv_date;
|
||||
}
|
||||
|
||||
public function set_setting_value_data_by_id($_id) {
|
||||
//SETTING ID ALAPJÁN KÉRI LE;
|
||||
//HA KELL, LEHET KÜLÖN FUNCTION-T ÍRNI HOGY ID ALAPJÁN KÉRJE
|
||||
global $sql;
|
||||
$set_data_assoc_array = $sql->assoc_array("select * from setting_value where setv_setting_set_id = " . $_id);
|
||||
$set_data_array = $set_data_assoc_array[0];
|
||||
foreach ($set_data_array as $field => $value) {
|
||||
$function_name = "set_" . $field;
|
||||
$this->$function_name($value); //alapadatok beállítása
|
||||
|
||||
if ($field == 'setv_setting_set_id') {
|
||||
$new_set = new setting();
|
||||
$new_set->set_setting_data_by_id($value);
|
||||
$this->set_setv_setting($new_set);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -444,8 +444,8 @@ table.log tr.delete:hover {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
.info {
|
||||
margin: 20px;
|
||||
}
|
||||
|
||||
}
|
||||
28
_include/include_information.php
Normal file
28
_include/include_information.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
# HA NINCS ID, AKKOR INFORMÁCIÓK
|
||||
|
||||
if ($this->is_id()) {
|
||||
# EMPTY
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
# INFORMÁCIÓK
|
||||
|
||||
$info_query = "SELECT setv_id FROM setting_value JOIN setting ON setv_setting_set_id = set_id WHERE set_name = 'Információk'";
|
||||
|
||||
$setv_id = $sql->single_variable($info_query);
|
||||
|
||||
$new_setval = new setting_value();
|
||||
$new_setval->set_setting_value_data_by_id($setv_id);
|
||||
|
||||
$smarty->assign('setting', $new_setval);
|
||||
|
||||
$smarty->display('information.tpl');
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
37
_include/include_settings.php
Normal file
37
_include/include_settings.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
# HA NINCS ID, AKKOR BEÁLLÍTÁSOK
|
||||
# HA VAN ID, AKKOR ADOTT BEÁLLÍTÁS
|
||||
if ($this->is_id()) {
|
||||
# ADOTT BEÁLLÍTÁS
|
||||
|
||||
$new_setting = new setting_value();
|
||||
$new_setting->set_setting_value_data_by_id($this->get_id());
|
||||
|
||||
$smarty->assign("setting", $new_setting);
|
||||
|
||||
$smarty->display("setting_data_edit.tpl");
|
||||
|
||||
}
|
||||
else {
|
||||
# BEÁLLÍTÁSOK
|
||||
|
||||
$settings_query = "SELECT * FROM setting ORDER BY set_name ASC";
|
||||
$settings_assoc_array = $sql->assoc_array($settings_query);
|
||||
|
||||
$settings = array();
|
||||
|
||||
foreach ($settings_assoc_array as $value) {
|
||||
$new_setting = new setting();
|
||||
$new_setting->set_setting_data_by_id($value['set_id']);
|
||||
$settings[] = $new_setting;
|
||||
}
|
||||
|
||||
$smarty->assign('settings',$settings);
|
||||
$smarty->display('settings.tpl');
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
//ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
|
||||
@@ -56,8 +56,8 @@ $days = array(
|
||||
|
||||
//SMARTY BEÁLLÍTÁSA
|
||||
//require('../Smarty/Smarty.class.php');
|
||||
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach.hu') require('../Smarty/Smarty.class.php');
|
||||
else $sql = require('Smarty/Smarty.class.php');
|
||||
require('../Smarty/Smarty.class.php');
|
||||
|
||||
|
||||
$smarty = new Smarty();
|
||||
|
||||
|
||||
@@ -281,6 +281,16 @@ if (isset($_POST['action'])) {
|
||||
money_expense::update_money_expense($_POST['mox_name'], $_POST['mox_date'], $_POST['mox_item'], $_POST['mox_sum'], $_POST['mox_moxc_id'], $_POST['mox_id']);
|
||||
log::register('update_mox', $_POST['mox_id']);
|
||||
header("Location: /admin/money_expense");
|
||||
case 'settings_data_edit':
|
||||
$sql->update_table('setting_value',
|
||||
array(
|
||||
'setv_'.$_POST['st_name'] => $_POST['set_val']
|
||||
),
|
||||
array(
|
||||
'setv_id' => $_POST['setv_id']
|
||||
)
|
||||
|
||||
);
|
||||
break;
|
||||
default:
|
||||
# code...
|
||||
|
||||
@@ -13,7 +13,8 @@ setlocale(LC_ALL, 'hu_HU');
|
||||
<style>
|
||||
|
||||
</style>
|
||||
<script src="/jquery-3.1.1.min.js"></script>
|
||||
<script src="/jQuery/jquery-3.1.1.min.js"></script>
|
||||
<script src="/ckeditor/ckeditor.js"></script>
|
||||
|
||||
|
||||
<meta charset="utf-8">
|
||||
|
||||
3
template/templates/information.tpl
Normal file
3
template/templates/information.tpl
Normal file
@@ -0,0 +1,3 @@
|
||||
<p class="info">
|
||||
{nl2br($setting->get_setv_text())}
|
||||
</p>
|
||||
26
template/templates/setting_data_edit.tpl
Normal file
26
template/templates/setting_data_edit.tpl
Normal file
@@ -0,0 +1,26 @@
|
||||
<div class="form_wrapper">
|
||||
<form method="post">
|
||||
<input type="hidden" name="action" value="settings_data_edit">
|
||||
<input type="hidden" name="set_id" value="{$setting->get_setv_setting_set_id()}">
|
||||
<input type="hidden" name="setv_id" value="{$setting->get_setv_id()}">
|
||||
<input type="hidden" name="st_name" value="{$setting->get_setv_setting()->get_set_setting_type()->get_st_setting_data_type()}">
|
||||
|
||||
|
||||
<div>
|
||||
<label for="set_val">{$setting->get_setv_setting()->get_set_name()}:</label>
|
||||
<div>
|
||||
{if $setting->get_setv_setting()->get_set_setting_type_st_id() == 1}
|
||||
<textarea name="set_val" id="set_val" rows="10">{$setting->get_setv_text()}</textarea>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div>
|
||||
<div>
|
||||
<input class="button black" type="submit" value="Mentés">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
11
template/templates/settings.tpl
Normal file
11
template/templates/settings.tpl
Normal file
@@ -0,0 +1,11 @@
|
||||
<div class="list">
|
||||
{foreach $settings as $setting}
|
||||
<a href="/admin/settings/{$setting->get_set_id()}">
|
||||
<div class="list_item">
|
||||
<img src="/_image/settings.png">
|
||||
{$setting->get_set_name()}
|
||||
</div>
|
||||
</a>
|
||||
{/foreach}
|
||||
|
||||
</div>
|
||||
Reference in New Issue
Block a user