<?php

class money_income_category {
	private $mic_id;
	private $mic_name;
	private $mic_deleted;

	public function set_mic_id($_item) {
		$this->mic_id = $_item;
	}

	public function set_mic_name($_item) {
		$this->mic_name = $_item;
	}

	public function set_mic_deleted($_item) {
		$this->mic_deleted = $_item;
	}

	public function get_mic_id() {
		return $this->mic_id;
	}

	public function get_mic_name() {
		return $this->mic_name;
	}

	public function get_mic_deleted() {
		return $this->mic_deleted;
	}

	public function set_mic_data_by_id($_id) {
		global $sql;
		$set_data_assoc_array = $sql->assoc_array("select * from money_income_category where mic_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_income_category($_name) {
		global $sql;

		return $sql->insert_into('money_income_category', array('mic_name' => $_name));
	}

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

		$sql->update_table('money_income_category', array('mic_name' => $_name), array('mic_id' => $_id));
	}

}


?>
