<?php


/**
* TÁBORBA JELENTKEZŐ GYEREK OSZTÁLY
*/
class camp_kid
{
    private $ck_id;
    private $ck_owner_id; //camp_user_id
    private $ck_owner; //camp_user ojektum
    private $ck_original_id; //camp_kid ojektum
    private $ck_original; //camp_kid ojektum
    private $ck_name;
    private $ck_birth_year;
    private $ck_ss_number;
    private $ck_email;
    private $ck_mobile;
    private $ck_badminton_history;
    private $ck_sport_history;
    private $ck_food_info;
    private $ck_hygiene_info;
    private $ck_health_info;
    private $ck_pharma_info;
    private $ck_other_info;
    private $ck_deleted;


    /**
     * Gets the value of ck_id.
     *
     * @return mixed
     */
    public function get_ck_id()
    {
        return $this->ck_id;
    }

    /**
     * Sets the value of ck_id.
     *
     * @param mixed $ck_id the ck id
     *
     * @return self
     */
    private function set_ck_id($ck_id)
    {
        $this->ck_id = $ck_id;

        return $this;
    }

    /**
     * Gets the value of ck_name.
     *
     * @return mixed
     */
    public function get_ck_name()
    {
        return $this->ck_name;
    }

    /**
     * Sets the value of ck_name.
     *
     * @param mixed $ck_name the ck name
     *
     * @return self
     */
    private function set_ck_name($ck_name)
    {
        $this->ck_name = $ck_name;

        return $this;
    }

    /**
     * Gets the value of ck_birth_year.
     *
     * @return mixed
     */
    public function get_ck_birth_year()
    {
        return $this->ck_birth_year;
    }

    /**
     * Sets the value of ck_birth_year.
     *
     * @param mixed $ck_birth_year the ck birth year
     *
     * @return self
     */
    private function set_ck_birth_year($ck_birth_year)
    {
        $this->ck_birth_year = $ck_birth_year;

        return $this;
    }

    /**
     * Gets the value of ck_ss_number.
     *
     * @return mixed
     */
    public function get_ck_ss_number()
    {
        return $this->ck_ss_number;
    }

    /**
     * Sets the value of ck_ss_number.
     *
     * @param mixed $ck_ss_number the ck ss number
     *
     * @return self
     */
    private function set_ck_ss_number($ck_ss_number)
    {
        $this->ck_ss_number = $ck_ss_number;

        return $this;
    }

    /**
     * Gets the value of ck_email.
     *
     * @return mixed
     */
    public function get_ck_email()
    {
        return $this->ck_email;
    }

    /**
     * Sets the value of ck_email.
     *
     * @param mixed $ck_email the ck email
     *
     * @return self
     */
    private function set_ck_email($ck_email)
    {
        $this->ck_email = $ck_email;

        return $this;
    }

    /**
     * Gets the value of ck_mobile.
     *
     * @return mixed
     */
    public function get_ck_mobile()
    {
        return $this->ck_mobile;
    }

    /**
     * Sets the value of ck_mobile.
     *
     * @param mixed $ck_mobile the ck mobile
     *
     * @return self
     */
    private function set_ck_mobile($ck_mobile)
    {
        $this->ck_mobile = $ck_mobile;

        return $this;
    }

    /**
     * Gets the value of ck_badminton_history.
     *
     * @return mixed
     */
    public function get_ck_badminton_history()
    {
        return $this->ck_badminton_history;
    }

    /**
     * Sets the value of ck_badminton_history.
     *
     * @param mixed $ck_badminton_history the ck badminton history
     *
     * @return self
     */
    private function set_ck_badminton_history($ck_badminton_history)
    {
        $this->ck_badminton_history = $ck_badminton_history;

        return $this;
    }

    /**
     * Gets the value of ck_sport_history.
     *
     * @return mixed
     */
    public function get_ck_sport_history()
    {
        return $this->ck_sport_history;
    }

    /**
     * Sets the value of ck_sport_history.
     *
     * @param mixed $ck_sport_history the ck sport history
     *
     * @return self
     */
    private function set_ck_sport_history($ck_sport_history)
    {
        $this->ck_sport_history = $ck_sport_history;

        return $this;
    }

    /**
     * Gets the value of ck_food_info.
     *
     * @return mixed
     */
    public function get_ck_food_info()
    {
        return $this->ck_food_info;
    }

    /**
     * Sets the value of ck_food_info.
     *
     * @param mixed $ck_food_info the ck food _info
     *
     * @return self
     */
    private function set_ck_food_info($ck_food_info)
    {
        $this->ck_food_info = $ck_food_info;

        return $this;
    }

    /**
     * Gets the value of ck_hygiene_info.
     *
     * @return mixed
     */
    public function get_ck_hygiene_info()
    {
        return $this->ck_hygiene_info;
    }

    /**
     * Sets the value of ck_hygiene_info.
     *
     * @param mixed $ck_hygiene_info the ck hygiene _info
     *
     * @return self
     */
    private function set_ck_hygiene_info($ck_hygiene_info)
    {
        $this->ck_hygiene_info = $ck_hygiene_info;

        return $this;
    }

    /**
     * Gets the value of ck_health_info.
     *
     * @return mixed
     */
    public function get_ck_health_info()
    {
        return $this->ck_health_info;
    }

    /**
     * Sets the value of ck_health_info.
     *
     * @param mixed $ck_health_info the ck health _info
     *
     * @return self
     */
    private function set_ck_health_info($ck_health_info)
    {
        $this->ck_health_info = $ck_health_info;

        return $this;
    }

    /**
     * Gets the value of ck_pharma_info.
     *
     * @return mixed
     */
    public function get_ck_pharma_info()
    {
        return $this->ck_pharma_info;
    }

    /**
     * Sets the value of ck_pharma_info.
     *
     * @param mixed $ck_pharma_info the ck pharma _info
     *
     * @return self
     */
    private function set_ck_pharma_info($ck_pharma_info)
    {
        $this->ck_pharma_info = $ck_pharma_info;

        return $this;
    }

    /**
     * Gets the value of ck_other_info.
     *
     * @return mixed
     */
    public function get_ck_other_info()
    {
        return $this->ck_other_info;
    }

    /**
     * Sets the value of ck_other_info.
     *
     * @param mixed $ck_other_info the ck other _info
     *
     * @return self
     */
    private function set_ck_other_info($ck_other_info)
    {
        $this->ck_other_info = $ck_other_info;

        return $this;
    }

    /**
     * Gets the value of ck_deleted.
     *
     * @return mixed
     */
    public function get_ck_deleted()
    {
        return $this->ck_deleted;
    }

    /**
     * Sets the value of ck_deleted.
     *
     * @param mixed $ck_deleted the ck deleted
     *
     * @return self
     */
    private function set_ck_deleted($ck_deleted)
    {
        $this->ck_deleted = $ck_deleted;

        return $this;
    }

    public function get_ck_owner_id()
    {
        return $this->ck_id;
    }

    private function set_ck_owner_id($ck_id)
    {
        $this->ck_owner_id = $ck_id;

        return $this;
    }

    public function get_ck_owner()
    {
        return $this->ck_id;
    }

    private function set_ck_owner($ck_id)
    {
        $this->ck_owner = $ck_id;

        return $this;
    }

    public function get_ck_original()
    {
        return $this->ck_id;
    }

    private function set_ck_original($ck_id)
    {
        $this->ck_original = $ck_id;

        return $this;
    }

    public function get_ck_original_id()
    {
        return $this->ck_id;
    }

    private function set_ck_original_id($ck_id)
    {
        $this->ck_original = $ck_id;

        return $this;
    }

    public function set_ck_data_by_id($_id) {
        global $sql;
        $ck_data_assoc_array = $sql->assoc_array("select * from camp_kid where ck_id = " . $_id);
        $ck_data_array = $ck_data_assoc_array[0];
        foreach ($ck_data_array as $field => $value) {
            $function_name = "set_" . $field;
            $this->$function_name($value);

            if ($field == 'ck_owner_id') {
                $new_camp_user = new camp_user();
                $new_camp_user->set_user_data_by_id($value);
                $this->set_ck_owner($new_camp_user);
            }
            if ($field == 'ck_original_id' && !empty($value)) {
                $new_camp_kid = new camp_kid();
                $new_camp_kid->set_ck_data_by_id($value);
                $this->set_ck_original($new_camp_kid);
            }
        }
    }

    private static function empty_to_null($str) {
        return ($str == ""?"null":$str);
    }

    public static function create_camp_kid($_name, $_birth_year, $_ss_number, $_email, $_mobile, $_info, $_original_id, $_owner_id) {
        global $sql;
        return $sql->insert_into('camp_kid', array(
            'ck_name' => $_name,
            'ck_birth_year' => $_birth_year,
            'ck_ss_number' => $_ss_number,
            'ck_email' => $_email,
            'ck_mobile' => $_mobile,
            'ck_original_id' => $_original_id,
            'ck_owner_id' => $_owner_id,
            'ck_sport_history' => self::empty_to_null($_info['ck_sport_history']),
            'ck_badminton_history' => self::empty_to_null($_info['ck_badminton_history']),
            'ck_food_info' => self::empty_to_null($_info['ck_food_info']),
            'ck_hygiene_info' => self::empty_to_null($_info['ck_hygiene_info']),
            'ck_health_info' => self::empty_to_null($_info['ck_health_info']),
            'ck_pharma_info' => self::empty_to_null($_info['ck_pharma_info']),
            'ck_other_info' => self::empty_to_null($_info['ck_other_info']),

            ));
    }
}


?>
