<?php

class money_expense_category {
	private $moxc_id;
	private $moxc_name;
	private $moxc_deleted;

	public function set_moxc_id($_item) {
		$this->moxc_id = $_item;
	}

	public function set_moxc_name($_item) {
		$this->moxc_name = $_item;
	}

	public function set_moxc_deleted($_item) {
		$this->moxc_deleted = $_item;
	}

	public function get_moxc_id() {
		return $this->moxc_id;
	}

	public function get_moxc_name() {
		return $this->moxc_name;
	}

	public function get_moxc_deleted() {
		return $this->moxc_deleted;
	}

	public function set_moxc_data_by_id($_id) {
		global $sql;
		$set_data_assoc_array = $sql->assoc_array("select * from money_expense_category where moxc_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

		}

	}

	public static function create_money_expense_category($_name) {
		global $sql;

		return $sql->insert_into('money_expense_category', array('moxc_name' => $_name));
	}

	public static function update_money_expense_category($_name, $_id) {
		global $sql;

		$sql->update_table('money_expense_category', array('moxc_name' => $_name), array('moxc_id' => $_id));
	}

}


?>