added camp leader view, camp list with kids
This commit is contained in:
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