<?php
/*
* @package LabCMS
* @copyright (c) 2006 Alexander Levin aka Loki (loki_angel@mail.ru)
* @support http://labcms.ru
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/

class  forum_forum_entity extends Entity
{
	public function __construct($data=null)
	{
		$this->_data['id']=&$this->_data['forum_id'];
		parent::__construct($data);
	}

	public function __set($k, $v)
	{
		parent::__set($k, $v);
		if ($k=='last_user') {
			$this->_data['last_user_id']=is_object($v)?$this->_data['last_user']->id:null;
		}

		if ($k=='total_themes') {
			$this->_data['total_pages']=ceil($v/config::get('forum_themes_at_page'));
		}
	}
}