added camp leader view, camp list with kids
This commit is contained in:
@@ -229,6 +229,19 @@ class camp
|
||||
return $sql->num_of_rows("select * from camp join camp_apply on capp_camp_id = camp_id where capp_status = 5 AND camp_id = " . $this->get_camp_id());
|
||||
}
|
||||
|
||||
public function get_camp_applies() {
|
||||
//visszaadja az elfogadott jelentkezéseket ABC sorrendben
|
||||
global $sql;
|
||||
$apply_assoc_array = $sql->assoc_array("SELECT * FROM camp_apply JOIN camp_kid ON ck_id = capp_camp_kid_ck_id WHERE capp_status = 3 AND capp_camp_id = " . $this->get_camp_id() . " ORDER BY ck_name ASC;");
|
||||
$apply_array = array();
|
||||
foreach ($apply_assoc_array as $apply) {
|
||||
$new_apply = new camp_apply();
|
||||
$new_apply->set_capp_data_by_id($apply['capp_id']);
|
||||
$apply_array[] = $new_apply;
|
||||
}
|
||||
return $apply_array;
|
||||
}
|
||||
|
||||
|
||||
public function set_camp_data_by_id($_camp_id) {
|
||||
global $sql;
|
||||
|
||||
@@ -19,6 +19,7 @@ class log {
|
||||
if (get_class($user) == 'user') $function_name = 'get_ua_id';
|
||||
elseif(get_class($user) == 'user_kid') $function_name = 'get_uk_id';
|
||||
elseif(get_class($user) == 'camp_user') $function_name = 'get_cu_id';
|
||||
elseif(get_class($user) == 'user_camp_leader') $function_name = 'get_ucl_id';
|
||||
}
|
||||
|
||||
$sql->insert_into('log', array(
|
||||
|
||||
@@ -108,6 +108,21 @@ class login {
|
||||
return null;
|
||||
}
|
||||
|
||||
public function check_camp_leader_login($_user_name, $_user_password) {
|
||||
global $sql;
|
||||
$check_query =
|
||||
"
|
||||
SELECT ucl_id FROM user_camp_leader WHERE
|
||||
(ucl_name = '" . $_user_name . "' AND
|
||||
ucl_password = '" . md5($_user_password ) . "') AND ucl_deleted = 0";
|
||||
|
||||
//echo $check_query;
|
||||
|
||||
if ($sql->num_of_rows($check_query)) return $sql->single_variable($check_query);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function login_user($_user_id, $_cookie_name, $_user_type) {
|
||||
//beállítja a belépett user adatait cookieba (ha még nincs)
|
||||
global $sql;
|
||||
@@ -126,6 +141,9 @@ class login {
|
||||
elseif ($_user_type == 4) {
|
||||
$user_login = new camp_user();
|
||||
}
|
||||
elseif ($_user_type == 5) {
|
||||
$user_login = new user_camp_leader();
|
||||
}
|
||||
$user_login->set_user_data_by_id($_user_id);
|
||||
$user_login->update_login_time();
|
||||
setcookie($_cookie_name, $_user_id, time()+60*60*168, '/');
|
||||
|
||||
@@ -43,6 +43,11 @@ class page {
|
||||
$menu_assoc_array = $sql->assoc_array($menus_query);
|
||||
$smarty->assign('menus', $menu_assoc_array);
|
||||
}
|
||||
elseif ($this->get_page() == 'taborvezeto') {
|
||||
$menus_query = "SELECT * FROM subpage WHERE spage_page_id = 5;";
|
||||
$menu_assoc_array = $sql->assoc_array($menus_query);
|
||||
$smarty->assign('menus', $menu_assoc_array);
|
||||
}
|
||||
|
||||
$smarty->assign('page', $this->get_page());
|
||||
$smarty->display('nav.tpl');
|
||||
@@ -206,6 +211,14 @@ class page {
|
||||
# TÁBORI JELENTKEZŐ ADATAINAK MEGTEKINTÉSE
|
||||
include('include_apply.php');
|
||||
break;
|
||||
case 'camp_user':
|
||||
# táborvezetők
|
||||
include('include_user_camp_leader.php');
|
||||
break;
|
||||
case 'camp_details':
|
||||
# turnusok
|
||||
include('include_camp_details.php');
|
||||
break;
|
||||
case 'delete_training_type':
|
||||
# EDZÉS TÍPUS TÖRLÉS
|
||||
include('include_delete_training_type.php');
|
||||
@@ -258,6 +271,10 @@ class page {
|
||||
# TÁBORI PÓLÓ TÖRLÉS
|
||||
include('include_delete_camp_shirt.php');
|
||||
break;
|
||||
case 'delete_camp_leader':
|
||||
# TÁBORVEZETŐ TÖRLÉS
|
||||
include('include_delete_camp_leader.php');
|
||||
break;
|
||||
case 'logout':
|
||||
# kijelentkezés
|
||||
$from = "admin";
|
||||
@@ -364,7 +381,7 @@ class page {
|
||||
break;
|
||||
case 'move_next':
|
||||
# továbblépés mentés nélkül
|
||||
include('include_move_next.php');
|
||||
include('include_move_next.php');
|
||||
break;
|
||||
case 'logout':
|
||||
# kijelentkezés
|
||||
@@ -380,6 +397,27 @@ class page {
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'taborvezeto':
|
||||
# TÁBORVEZETŐI NÉZET
|
||||
switch ($this->get_subpage()) {
|
||||
case 'taborok':
|
||||
# turnusok
|
||||
include('include_camp_details.php');
|
||||
break;
|
||||
case 'jelentkezes':
|
||||
# turnusok
|
||||
include('include_apply.php');
|
||||
break;
|
||||
case 'logout':
|
||||
# kijelentkezés
|
||||
$from = "taborvezeto";
|
||||
include('include_logout.php');
|
||||
break;
|
||||
default:
|
||||
include('include_camp_details.php');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
193
_class/class_user_camp_leader.php
Normal file
193
_class/class_user_camp_leader.php
Normal file
@@ -0,0 +1,193 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* táborvezető
|
||||
*/
|
||||
class user_camp_leader
|
||||
{
|
||||
private $ucl_id;
|
||||
private $ucl_name;
|
||||
private $ucl_password;
|
||||
private $ucl_last_login;
|
||||
private $ucl_deleted;
|
||||
private $logged_in;
|
||||
|
||||
|
||||
/**
|
||||
* gets the value of ucl_id.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_ucl_id()
|
||||
{
|
||||
return $this->ucl_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the value of ucl_id.
|
||||
*
|
||||
* @param mixed $ucl_id the ucl id
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
private function set_ucl_id($ucl_id)
|
||||
{
|
||||
$this->ucl_id = $ucl_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the value of ucl_name.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_ucl_name()
|
||||
{
|
||||
return $this->ucl_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the value of ucl_name.
|
||||
*
|
||||
* @param mixed $ucl_name the ucl name
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
private function set_ucl_name($ucl_name)
|
||||
{
|
||||
$this->ucl_name = $ucl_name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the value of ucl_password.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_ucl_password()
|
||||
{
|
||||
return $this->ucl_password;
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the value of ucl_password.
|
||||
*
|
||||
* @param mixed $ucl_password the ucl password
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
private function set_ucl_password($ucl_password)
|
||||
{
|
||||
$this->ucl_password = $ucl_password;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the value of ucl_last_login.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_ucl_last_login()
|
||||
{
|
||||
return $this->ucl_last_login;
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the value of ucl_last_login.
|
||||
*
|
||||
* @param mixed $ucl_last_login the ucl last login
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
private function set_ucl_last_login($ucl_last_login)
|
||||
{
|
||||
$this->ucl_last_login = $ucl_last_login;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the value of ucl_deleted.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_ucl_deleted()
|
||||
{
|
||||
return $this->ucl_deleted;
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the value of ucl_deleted.
|
||||
*
|
||||
* @param mixed $ucl_deleted the ucl deleted
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
private function set_ucl_deleted($ucl_deleted)
|
||||
{
|
||||
$this->ucl_deleted = $ucl_deleted;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function update_login_time($_ucl_id = null) {
|
||||
global $sql;
|
||||
//az adott user_id-n updateli a login_time-ot
|
||||
$sql->update_table('user_camp_leader', array('ucl_last_login' => date('Y-m-d')), array('ucl_id' => (empty($_ucl_id)?$this->get_ucl_id():$_ucl_id)));
|
||||
}
|
||||
|
||||
public function is_logged_in() {
|
||||
//leellenőrzi cookie alapján h be vagyunk-e jelentkezve
|
||||
//JAVÍTVA: adja vissza az adattag igazságértékét
|
||||
return $this->logged_in;
|
||||
}
|
||||
|
||||
public function set_login($_login) {
|
||||
//bool-t kap paraméterül
|
||||
$this->logged_in = $_login;
|
||||
}
|
||||
|
||||
public function set_user_data_by_id($_user_id) {
|
||||
global $sql;
|
||||
$ucl_assoc_array = $sql->assoc_array("select * from user_camp_leader where ucl_id = " . $_user_id);
|
||||
$ucl_array = $ucl_assoc_array[0];
|
||||
//alapadatok
|
||||
foreach ($ucl_array as $field => $value) {
|
||||
$function_name = "set_" . $field;
|
||||
$this->$function_name($value);
|
||||
$this->set_login(true);
|
||||
}
|
||||
}
|
||||
|
||||
public static function create_camp_leader($_name, $_password) {
|
||||
global $sql;
|
||||
return $sql->insert_into('user_camp_leader', array(
|
||||
'ucl_name' => $_name,
|
||||
'ucl_password' => md5($_password)
|
||||
));
|
||||
}
|
||||
|
||||
public static function update_camp_leader($_name, $_password, $_ucl_id) {
|
||||
global $sql;
|
||||
if ($_password) {
|
||||
$sql->update_table('user_camp_leader', array(
|
||||
'ucl_name' => $_name,
|
||||
'ucl_password' => md5($_password)
|
||||
), array(
|
||||
'ucl_id' => $_ucl_id
|
||||
));
|
||||
}
|
||||
else {
|
||||
$sql->update_table('user_camp_leader', array(
|
||||
'ucl_name' => $_name
|
||||
), array(
|
||||
'ucl_id' => $_ucl_id
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user