<?php


abstract class BaseTbluser extends BaseObject  implements Persistent {


	
	protected static $peer;

	
	protected $us_id;

	
	protected $us_username;

	
	protected $us_password;

	
	protected $us_firstname;

	
	protected $us_lastname;

	
	protected $us_sex;

	
	protected $us_email;

	
	protected $us_phone;

	
	protected $us_aclgroup;

	
	protected $us_school;

	
	protected $us_province;

	
	protected $us_lastvisited;

	
	protected $us_registerdate;

	
	protected $us_rating;

	
	protected $us_download;

	
	protected $us_avatar;

	
	protected $us_status;

	
	protected $us_key;

	
	protected $us_company;

	
	protected $us_score;

	
	protected $us_pointplus;

	
	protected $us_checked;

	
	protected $us_checkinfo;

	
	protected $us_idmd5;

	
	protected $us_homepage;

	
	protected $us_money;

	
	protected $singleTblblogcheckinfo;

	
	protected $alreadyInSave = false;

	
	protected $alreadyInValidation = false;

	
	public function __construct()
	{
		parent::__construct();
		$this->applyDefaultValues();
	}

	
	public function applyDefaultValues()
	{
		$this->us_sex = 0;
		$this->us_rating = 0;
		$this->us_download = 0;
		$this->us_status = 0;
		$this->us_key = 0;
		$this->us_company = 0;
		$this->us_score = 0;
		$this->us_pointplus = 5;
		$this->us_checked = 0;
		$this->us_money = 0;
	}

	
	public function getUsId()
	{
		return $this->us_id;
	}

	
	public function getUsUsername()
	{
		return $this->us_username;
	}

	
	public function getUsPassword()
	{
		return $this->us_password;
	}

	
	public function getUsFirstname()
	{
		return $this->us_firstname;
	}

	
	public function getUsLastname()
	{
		return $this->us_lastname;
	}

	
	public function getUsSex()
	{
		return $this->us_sex;
	}

	
	public function getUsEmail()
	{
		return $this->us_email;
	}

	
	public function getUsPhone()
	{
		return $this->us_phone;
	}

	
	public function getUsAclgroup()
	{
		return $this->us_aclgroup;
	}

	
	public function getUsSchool()
	{
		return $this->us_school;
	}

	
	public function getUsProvince()
	{
		return $this->us_province;
	}

	
	public function getUsLastvisited($format = 'Y-m-d H:i:s')
	{
		if ($this->us_lastvisited === null) {
			return null;
		}


		if ($this->us_lastvisited === '0000-00-00 00:00:00') {
									return null;
		} else {
			try {
				$dt = new DateTime($this->us_lastvisited);
			} catch (Exception $x) {
				throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->us_lastvisited, true), $x);
			}
		}

		if ($format === null) {
						return $dt;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $dt->format('U'));
		} else {
			return $dt->format($format);
		}
	}

	
	public function getUsRegisterdate($format = 'Y-m-d H:i:s')
	{
		if ($this->us_registerdate === null) {
			return null;
		}


		if ($this->us_registerdate === '0000-00-00 00:00:00') {
									return null;
		} else {
			try {
				$dt = new DateTime($this->us_registerdate);
			} catch (Exception $x) {
				throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->us_registerdate, true), $x);
			}
		}

		if ($format === null) {
						return $dt;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $dt->format('U'));
		} else {
			return $dt->format($format);
		}
	}

	
	public function getUsRating()
	{
		return $this->us_rating;
	}

	
	public function getUsDownload()
	{
		return $this->us_download;
	}

	
	public function getUsAvatar()
	{
		return $this->us_avatar;
	}

	
	public function getUsStatus()
	{
		return $this->us_status;
	}

	
	public function getUsKey()
	{
		return $this->us_key;
	}

	
	public function getUsCompany()
	{
		return $this->us_company;
	}

	
	public function getUsScore()
	{
		return $this->us_score;
	}

	
	public function getUsPointplus()
	{
		return $this->us_pointplus;
	}

	
	public function getUsChecked()
	{
		return $this->us_checked;
	}

	
	public function getUsCheckinfo()
	{
		return $this->us_checkinfo;
	}

	
	public function getUsIdmd5()
	{
		return $this->us_idmd5;
	}

	
	public function getUsHomepage()
	{
		return $this->us_homepage;
	}

	
	public function getUsMoney()
	{
		return $this->us_money;
	}

	
	public function setUsId($v)
	{
		if ($v !== null) {
			$v = (int) $v;
		}

		if ($this->us_id !== $v) {
			$this->us_id = $v;
			$this->modifiedColumns[] = TbluserPeer::US_ID;
		}

		return $this;
	} 
	
	public function setUsUsername($v)
	{
		if ($v !== null) {
			$v = (string) $v;
		}

		if ($this->us_username !== $v) {
			$this->us_username = $v;
			$this->modifiedColumns[] = TbluserPeer::US_USERNAME;
		}

		return $this;
	} 
	
	public function setUsPassword($v)
	{
		if ($v !== null) {
			$v = (string) $v;
		}

		if ($this->us_password !== $v) {
			$this->us_password = $v;
			$this->modifiedColumns[] = TbluserPeer::US_PASSWORD;
		}

		return $this;
	} 
	
	public function setUsFirstname($v)
	{
		if ($v !== null) {
			$v = (string) $v;
		}

		if ($this->us_firstname !== $v) {
			$this->us_firstname = $v;
			$this->modifiedColumns[] = TbluserPeer::US_FIRSTNAME;
		}

		return $this;
	} 
	
	public function setUsLastname($v)
	{
		if ($v !== null) {
			$v = (string) $v;
		}

		if ($this->us_lastname !== $v) {
			$this->us_lastname = $v;
			$this->modifiedColumns[] = TbluserPeer::US_LASTNAME;
		}

		return $this;
	} 
	
	public function setUsSex($v)
	{
		if ($v !== null) {
			$v = (int) $v;
		}

		if ($this->us_sex !== $v || $v === 0) {
			$this->us_sex = $v;
			$this->modifiedColumns[] = TbluserPeer::US_SEX;
		}

		return $this;
	} 
	
	public function setUsEmail($v)
	{
		if ($v !== null) {
			$v = (string) $v;
		}

		if ($this->us_email !== $v) {
			$this->us_email = $v;
			$this->modifiedColumns[] = TbluserPeer::US_EMAIL;
		}

		return $this;
	} 
	
	public function setUsPhone($v)
	{
		if ($v !== null) {
			$v = (string) $v;
		}

		if ($this->us_phone !== $v) {
			$this->us_phone = $v;
			$this->modifiedColumns[] = TbluserPeer::US_PHONE;
		}

		return $this;
	} 
	
	public function setUsAclgroup($v)
	{
		if ($v !== null) {
			$v = (int) $v;
		}

		if ($this->us_aclgroup !== $v) {
			$this->us_aclgroup = $v;
			$this->modifiedColumns[] = TbluserPeer::US_ACLGROUP;
		}

		return $this;
	} 
	
	public function setUsSchool($v)
	{
		if ($v !== null) {
			$v = (string) $v;
		}

		if ($this->us_school !== $v) {
			$this->us_school = $v;
			$this->modifiedColumns[] = TbluserPeer::US_SCHOOL;
		}

		return $this;
	} 
	
	public function setUsProvince($v)
	{
		if ($v !== null) {
			$v = (string) $v;
		}

		if ($this->us_province !== $v) {
			$this->us_province = $v;
			$this->modifiedColumns[] = TbluserPeer::US_PROVINCE;
		}

		return $this;
	} 
	
	public function setUsLastvisited($v)
	{
						if ($v === null || $v === '') {
			$dt = null;
		} elseif ($v instanceof DateTime) {
			$dt = $v;
		} else {
									try {
				if (is_numeric($v)) { 					$dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
															$dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
				} else {
					$dt = new DateTime($v);
				}
			} catch (Exception $x) {
				throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
			}
		}

		if ( $this->us_lastvisited !== null || $dt !== null ) {
			
			$currNorm = ($this->us_lastvisited !== null && $tmpDt = new DateTime($this->us_lastvisited)) ? $tmpDt->format('Y-m-d H:i:s') : null;
			$newNorm = ($dt !== null) ? $dt->format('Y-m-d H:i:s') : null;

			if ( ($currNorm !== $newNorm) 					)
			{
				$this->us_lastvisited = ($dt ? $dt->format('Y-m-d H:i:s') : null);
				$this->modifiedColumns[] = TbluserPeer::US_LASTVISITED;
			}
		} 
		return $this;
	} 
	
	public function setUsRegisterdate($v)
	{
						if ($v === null || $v === '') {
			$dt = null;
		} elseif ($v instanceof DateTime) {
			$dt = $v;
		} else {
									try {
				if (is_numeric($v)) { 					$dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
															$dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
				} else {
					$dt = new DateTime($v);
				}
			} catch (Exception $x) {
				throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
			}
		}

		if ( $this->us_registerdate !== null || $dt !== null ) {
			
			$currNorm = ($this->us_registerdate !== null && $tmpDt = new DateTime($this->us_registerdate)) ? $tmpDt->format('Y-m-d H:i:s') : null;
			$newNorm = ($dt !== null) ? $dt->format('Y-m-d H:i:s') : null;

			if ( ($currNorm !== $newNorm) 					)
			{
				$this->us_registerdate = ($dt ? $dt->format('Y-m-d H:i:s') : null);
				$this->modifiedColumns[] = TbluserPeer::US_REGISTERDATE;
			}
		} 
		return $this;
	} 
	
	public function setUsRating($v)
	{
		if ($v !== null) {
			$v = (int) $v;
		}

		if ($this->us_rating !== $v || $v === 0) {
			$this->us_rating = $v;
			$this->modifiedColumns[] = TbluserPeer::US_RATING;
		}

		return $this;
	} 
	
	public function setUsDownload($v)
	{
		if ($v !== null) {
			$v = (int) $v;
		}

		if ($this->us_download !== $v || $v === 0) {
			$this->us_download = $v;
			$this->modifiedColumns[] = TbluserPeer::US_DOWNLOAD;
		}

		return $this;
	} 
	
	public function setUsAvatar($v)
	{
		if ($v !== null) {
			$v = (string) $v;
		}

		if ($this->us_avatar !== $v) {
			$this->us_avatar = $v;
			$this->modifiedColumns[] = TbluserPeer::US_AVATAR;
		}

		return $this;
	} 
	
	public function setUsStatus($v)
	{
		if ($v !== null) {
			$v = (int) $v;
		}

		if ($this->us_status !== $v || $v === 0) {
			$this->us_status = $v;
			$this->modifiedColumns[] = TbluserPeer::US_STATUS;
		}

		return $this;
	} 
	
	public function setUsKey($v)
	{
		if ($v !== null) {
			$v = (int) $v;
		}

		if ($this->us_key !== $v || $v === 0) {
			$this->us_key = $v;
			$this->modifiedColumns[] = TbluserPeer::US_KEY;
		}

		return $this;
	} 
	
	public function setUsCompany($v)
	{
		if ($v !== null) {
			$v = (int) $v;
		}

		if ($this->us_company !== $v || $v === 0) {
			$this->us_company = $v;
			$this->modifiedColumns[] = TbluserPeer::US_COMPANY;
		}

		return $this;
	} 
	
	public function setUsScore($v)
	{
		if ($v !== null) {
			$v = (int) $v;
		}

		if ($this->us_score !== $v || $v === 0) {
			$this->us_score = $v;
			$this->modifiedColumns[] = TbluserPeer::US_SCORE;
		}

		return $this;
	} 
	
	public function setUsPointplus($v)
	{
		if ($v !== null) {
			$v = (int) $v;
		}

		if ($this->us_pointplus !== $v || $v === 5) {
			$this->us_pointplus = $v;
			$this->modifiedColumns[] = TbluserPeer::US_POINTPLUS;
		}

		return $this;
	} 
	
	public function setUsChecked($v)
	{
		if ($v !== null) {
			$v = (int) $v;
		}

		if ($this->us_checked !== $v || $v === 0) {
			$this->us_checked = $v;
			$this->modifiedColumns[] = TbluserPeer::US_CHECKED;
		}

		return $this;
	} 
	
	public function setUsCheckinfo($v)
	{
		if ($v !== null) {
			$v = (int) $v;
		}

		if ($this->us_checkinfo !== $v) {
			$this->us_checkinfo = $v;
			$this->modifiedColumns[] = TbluserPeer::US_CHECKINFO;
		}

		return $this;
	} 
	
	public function setUsIdmd5($v)
	{
		if ($v !== null) {
			$v = (string) $v;
		}

		if ($this->us_idmd5 !== $v) {
			$this->us_idmd5 = $v;
			$this->modifiedColumns[] = TbluserPeer::US_IDMD5;
		}

		return $this;
	} 
	
	public function setUsHomepage($v)
	{
		if ($v !== null) {
			$v = (string) $v;
		}

		if ($this->us_homepage !== $v) {
			$this->us_homepage = $v;
			$this->modifiedColumns[] = TbluserPeer::US_HOMEPAGE;
		}

		return $this;
	} 
	
	public function setUsMoney($v)
	{
		if ($v !== null) {
			$v = (int) $v;
		}

		if ($this->us_money !== $v || $v === 0) {
			$this->us_money = $v;
			$this->modifiedColumns[] = TbluserPeer::US_MONEY;
		}

		return $this;
	} 
	
	public function hasOnlyDefaultValues()
	{
						if (array_diff($this->modifiedColumns, array(TbluserPeer::US_SEX,TbluserPeer::US_RATING,TbluserPeer::US_DOWNLOAD,TbluserPeer::US_STATUS,TbluserPeer::US_KEY,TbluserPeer::US_COMPANY,TbluserPeer::US_SCORE,TbluserPeer::US_POINTPLUS,TbluserPeer::US_CHECKED,TbluserPeer::US_MONEY))) {
				return false;
			}

			if ($this->us_sex !== 0) {
				return false;
			}

			if ($this->us_rating !== 0) {
				return false;
			}

			if ($this->us_download !== 0) {
				return false;
			}

			if ($this->us_status !== 0) {
				return false;
			}

			if ($this->us_key !== 0) {
				return false;
			}

			if ($this->us_company !== 0) {
				return false;
			}

			if ($this->us_score !== 0) {
				return false;
			}

			if ($this->us_pointplus !== 5) {
				return false;
			}

			if ($this->us_checked !== 0) {
				return false;
			}

			if ($this->us_money !== 0) {
				return false;
			}

				return true;
	} 
	
	public function hydrate($row, $startcol = 0, $rehydrate = false)
	{
		try {

			$this->us_id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
			$this->us_username = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
			$this->us_password = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
			$this->us_firstname = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
			$this->us_lastname = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
			$this->us_sex = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null;
			$this->us_email = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
			$this->us_phone = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
			$this->us_aclgroup = ($row[$startcol + 8] !== null) ? (int) $row[$startcol + 8] : null;
			$this->us_school = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
			$this->us_province = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null;
			$this->us_lastvisited = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null;
			$this->us_registerdate = ($row[$startcol + 12] !== null) ? (string) $row[$startcol + 12] : null;
			$this->us_rating = ($row[$startcol + 13] !== null) ? (int) $row[$startcol + 13] : null;
			$this->us_download = ($row[$startcol + 14] !== null) ? (int) $row[$startcol + 14] : null;
			$this->us_avatar = ($row[$startcol + 15] !== null) ? (string) $row[$startcol + 15] : null;
			$this->us_status = ($row[$startcol + 16] !== null) ? (int) $row[$startcol + 16] : null;
			$this->us_key = ($row[$startcol + 17] !== null) ? (int) $row[$startcol + 17] : null;
			$this->us_company = ($row[$startcol + 18] !== null) ? (int) $row[$startcol + 18] : null;
			$this->us_score = ($row[$startcol + 19] !== null) ? (int) $row[$startcol + 19] : null;
			$this->us_pointplus = ($row[$startcol + 20] !== null) ? (int) $row[$startcol + 20] : null;
			$this->us_checked = ($row[$startcol + 21] !== null) ? (int) $row[$startcol + 21] : null;
			$this->us_checkinfo = ($row[$startcol + 22] !== null) ? (int) $row[$startcol + 22] : null;
			$this->us_idmd5 = ($row[$startcol + 23] !== null) ? (string) $row[$startcol + 23] : null;
			$this->us_homepage = ($row[$startcol + 24] !== null) ? (string) $row[$startcol + 24] : null;
			$this->us_money = ($row[$startcol + 25] !== null) ? (int) $row[$startcol + 25] : null;
			$this->resetModified();

			$this->setNew(false);

			if ($rehydrate) {
				$this->ensureConsistency();
			}

						return $startcol + 26; 
		} catch (Exception $e) {
			throw new PropelException("Error populating Tbluser object", $e);
		}
	}

	
	public function ensureConsistency()
	{

	} 
	
	public function reload($deep = false, PropelPDO $con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("Cannot reload a deleted object.");
		}

		if ($this->isNew()) {
			throw new PropelException("Cannot reload an unsaved object.");
		}

		if ($con === null) {
			$con = Propel::getConnection(TbluserPeer::DATABASE_NAME, Propel::CONNECTION_READ);
		}

				
		$stmt = TbluserPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
		$row = $stmt->fetch(PDO::FETCH_NUM);
		$stmt->closeCursor();
		if (!$row) {
			throw new PropelException('Cannot find matching row in the database to reload object values.');
		}
		$this->hydrate($row, 0, true); 
		if ($deep) {  
			$this->singleTblblogcheckinfo = null;

		} 	}

	
	public function delete(PropelPDO $con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("This object has already been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(TbluserPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
		}
		
		$con->beginTransaction();
		try {
			TbluserPeer::doDelete($this, $con);
			$this->setDeleted(true);
			$con->commit();
		} catch (PropelException $e) {
			$con->rollBack();
			throw $e;
		}
	}

	
	public function save(PropelPDO $con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("You cannot save an object that has been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(TbluserPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
		}
		
		$con->beginTransaction();
		try {
			$affectedRows = $this->doSave($con);
			$con->commit();
			TbluserPeer::addInstanceToPool($this);
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollBack();
			throw $e;
		}
	}

	
	protected function doSave(PropelPDO $con)
	{
		$affectedRows = 0; 		if (!$this->alreadyInSave) {
			$this->alreadyInSave = true;

			if ($this->isNew() ) {
				$this->modifiedColumns[] = TbluserPeer::US_ID;
			}

						if ($this->isModified()) {
				if ($this->isNew()) {
					$pk = TbluserPeer::doInsert($this, $con);
					$affectedRows += 1; 										 										 
					$this->setUsId($pk);  
					$this->setNew(false);
				} else {
					$affectedRows += TbluserPeer::doUpdate($this, $con);
				}

				$this->resetModified(); 			}

			if ($this->singleTblblogcheckinfo !== null) {
				if (!$this->singleTblblogcheckinfo->isDeleted()) {
						$affectedRows += $this->singleTblblogcheckinfo->save($con);
				}
			}

			$this->alreadyInSave = false;

		}
		return $affectedRows;
	} 
	
	protected $validationFailures = array();

	
	public function getValidationFailures()
	{
		return $this->validationFailures;
	}

	
	public function validate($columns = null)
	{
		$res = $this->doValidate($columns);
		if ($res === true) {
			$this->validationFailures = array();
			return true;
		} else {
			$this->validationFailures = $res;
			return false;
		}
	}

	
	protected function doValidate($columns = null)
	{
		if (!$this->alreadyInValidation) {
			$this->alreadyInValidation = true;
			$retval = null;

			$failureMap = array();


			if (($retval = TbluserPeer::doValidate($this, $columns)) !== true) {
				$failureMap = array_merge($failureMap, $retval);
			}


				if ($this->singleTblblogcheckinfo !== null) {
					if (!$this->singleTblblogcheckinfo->validate($columns)) {
						$failureMap = array_merge($failureMap, $this->singleTblblogcheckinfo->getValidationFailures());
					}
				}


			$this->alreadyInValidation = false;
		}

		return (!empty($failureMap) ? $failureMap : true);
	}

	
	public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = TbluserPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		$field = $this->getByPosition($pos);
		return $field;
	}

	
	public function getByPosition($pos)
	{
		switch($pos) {
			case 0:
				return $this->getUsId();
				break;
			case 1:
				return $this->getUsUsername();
				break;
			case 2:
				return $this->getUsPassword();
				break;
			case 3:
				return $this->getUsFirstname();
				break;
			case 4:
				return $this->getUsLastname();
				break;
			case 5:
				return $this->getUsSex();
				break;
			case 6:
				return $this->getUsEmail();
				break;
			case 7:
				return $this->getUsPhone();
				break;
			case 8:
				return $this->getUsAclgroup();
				break;
			case 9:
				return $this->getUsSchool();
				break;
			case 10:
				return $this->getUsProvince();
				break;
			case 11:
				return $this->getUsLastvisited();
				break;
			case 12:
				return $this->getUsRegisterdate();
				break;
			case 13:
				return $this->getUsRating();
				break;
			case 14:
				return $this->getUsDownload();
				break;
			case 15:
				return $this->getUsAvatar();
				break;
			case 16:
				return $this->getUsStatus();
				break;
			case 17:
				return $this->getUsKey();
				break;
			case 18:
				return $this->getUsCompany();
				break;
			case 19:
				return $this->getUsScore();
				break;
			case 20:
				return $this->getUsPointplus();
				break;
			case 21:
				return $this->getUsChecked();
				break;
			case 22:
				return $this->getUsCheckinfo();
				break;
			case 23:
				return $this->getUsIdmd5();
				break;
			case 24:
				return $this->getUsHomepage();
				break;
			case 25:
				return $this->getUsMoney();
				break;
			default:
				return null;
				break;
		} 	}

	
	public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true)
	{
		$keys = TbluserPeer::getFieldNames($keyType);
		$result = array(
			$keys[0] => $this->getUsId(),
			$keys[1] => $this->getUsUsername(),
			$keys[2] => $this->getUsPassword(),
			$keys[3] => $this->getUsFirstname(),
			$keys[4] => $this->getUsLastname(),
			$keys[5] => $this->getUsSex(),
			$keys[6] => $this->getUsEmail(),
			$keys[7] => $this->getUsPhone(),
			$keys[8] => $this->getUsAclgroup(),
			$keys[9] => $this->getUsSchool(),
			$keys[10] => $this->getUsProvince(),
			$keys[11] => $this->getUsLastvisited(),
			$keys[12] => $this->getUsRegisterdate(),
			$keys[13] => $this->getUsRating(),
			$keys[14] => $this->getUsDownload(),
			$keys[15] => $this->getUsAvatar(),
			$keys[16] => $this->getUsStatus(),
			$keys[17] => $this->getUsKey(),
			$keys[18] => $this->getUsCompany(),
			$keys[19] => $this->getUsScore(),
			$keys[20] => $this->getUsPointplus(),
			$keys[21] => $this->getUsChecked(),
			$keys[22] => $this->getUsCheckinfo(),
			$keys[23] => $this->getUsIdmd5(),
			$keys[24] => $this->getUsHomepage(),
			$keys[25] => $this->getUsMoney(),
		);
		return $result;
	}

	
	public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = TbluserPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->setByPosition($pos, $value);
	}

	
	public function setByPosition($pos, $value)
	{
		switch($pos) {
			case 0:
				$this->setUsId($value);
				break;
			case 1:
				$this->setUsUsername($value);
				break;
			case 2:
				$this->setUsPassword($value);
				break;
			case 3:
				$this->setUsFirstname($value);
				break;
			case 4:
				$this->setUsLastname($value);
				break;
			case 5:
				$this->setUsSex($value);
				break;
			case 6:
				$this->setUsEmail($value);
				break;
			case 7:
				$this->setUsPhone($value);
				break;
			case 8:
				$this->setUsAclgroup($value);
				break;
			case 9:
				$this->setUsSchool($value);
				break;
			case 10:
				$this->setUsProvince($value);
				break;
			case 11:
				$this->setUsLastvisited($value);
				break;
			case 12:
				$this->setUsRegisterdate($value);
				break;
			case 13:
				$this->setUsRating($value);
				break;
			case 14:
				$this->setUsDownload($value);
				break;
			case 15:
				$this->setUsAvatar($value);
				break;
			case 16:
				$this->setUsStatus($value);
				break;
			case 17:
				$this->setUsKey($value);
				break;
			case 18:
				$this->setUsCompany($value);
				break;
			case 19:
				$this->setUsScore($value);
				break;
			case 20:
				$this->setUsPointplus($value);
				break;
			case 21:
				$this->setUsChecked($value);
				break;
			case 22:
				$this->setUsCheckinfo($value);
				break;
			case 23:
				$this->setUsIdmd5($value);
				break;
			case 24:
				$this->setUsHomepage($value);
				break;
			case 25:
				$this->setUsMoney($value);
				break;
		} 	}

	
	public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = TbluserPeer::getFieldNames($keyType);

		if (array_key_exists($keys[0], $arr)) $this->setUsId($arr[$keys[0]]);
		if (array_key_exists($keys[1], $arr)) $this->setUsUsername($arr[$keys[1]]);
		if (array_key_exists($keys[2], $arr)) $this->setUsPassword($arr[$keys[2]]);
		if (array_key_exists($keys[3], $arr)) $this->setUsFirstname($arr[$keys[3]]);
		if (array_key_exists($keys[4], $arr)) $this->setUsLastname($arr[$keys[4]]);
		if (array_key_exists($keys[5], $arr)) $this->setUsSex($arr[$keys[5]]);
		if (array_key_exists($keys[6], $arr)) $this->setUsEmail($arr[$keys[6]]);
		if (array_key_exists($keys[7], $arr)) $this->setUsPhone($arr[$keys[7]]);
		if (array_key_exists($keys[8], $arr)) $this->setUsAclgroup($arr[$keys[8]]);
		if (array_key_exists($keys[9], $arr)) $this->setUsSchool($arr[$keys[9]]);
		if (array_key_exists($keys[10], $arr)) $this->setUsProvince($arr[$keys[10]]);
		if (array_key_exists($keys[11], $arr)) $this->setUsLastvisited($arr[$keys[11]]);
		if (array_key_exists($keys[12], $arr)) $this->setUsRegisterdate($arr[$keys[12]]);
		if (array_key_exists($keys[13], $arr)) $this->setUsRating($arr[$keys[13]]);
		if (array_key_exists($keys[14], $arr)) $this->setUsDownload($arr[$keys[14]]);
		if (array_key_exists($keys[15], $arr)) $this->setUsAvatar($arr[$keys[15]]);
		if (array_key_exists($keys[16], $arr)) $this->setUsStatus($arr[$keys[16]]);
		if (array_key_exists($keys[17], $arr)) $this->setUsKey($arr[$keys[17]]);
		if (array_key_exists($keys[18], $arr)) $this->setUsCompany($arr[$keys[18]]);
		if (array_key_exists($keys[19], $arr)) $this->setUsScore($arr[$keys[19]]);
		if (array_key_exists($keys[20], $arr)) $this->setUsPointplus($arr[$keys[20]]);
		if (array_key_exists($keys[21], $arr)) $this->setUsChecked($arr[$keys[21]]);
		if (array_key_exists($keys[22], $arr)) $this->setUsCheckinfo($arr[$keys[22]]);
		if (array_key_exists($keys[23], $arr)) $this->setUsIdmd5($arr[$keys[23]]);
		if (array_key_exists($keys[24], $arr)) $this->setUsHomepage($arr[$keys[24]]);
		if (array_key_exists($keys[25], $arr)) $this->setUsMoney($arr[$keys[25]]);
	}

	
	public function buildCriteria()
	{
		$criteria = new Criteria(TbluserPeer::DATABASE_NAME);

		if ($this->isColumnModified(TbluserPeer::US_ID)) $criteria->add(TbluserPeer::US_ID, $this->us_id);
		if ($this->isColumnModified(TbluserPeer::US_USERNAME)) $criteria->add(TbluserPeer::US_USERNAME, $this->us_username);
		if ($this->isColumnModified(TbluserPeer::US_PASSWORD)) $criteria->add(TbluserPeer::US_PASSWORD, $this->us_password);
		if ($this->isColumnModified(TbluserPeer::US_FIRSTNAME)) $criteria->add(TbluserPeer::US_FIRSTNAME, $this->us_firstname);
		if ($this->isColumnModified(TbluserPeer::US_LASTNAME)) $criteria->add(TbluserPeer::US_LASTNAME, $this->us_lastname);
		if ($this->isColumnModified(TbluserPeer::US_SEX)) $criteria->add(TbluserPeer::US_SEX, $this->us_sex);
		if ($this->isColumnModified(TbluserPeer::US_EMAIL)) $criteria->add(TbluserPeer::US_EMAIL, $this->us_email);
		if ($this->isColumnModified(TbluserPeer::US_PHONE)) $criteria->add(TbluserPeer::US_PHONE, $this->us_phone);
		if ($this->isColumnModified(TbluserPeer::US_ACLGROUP)) $criteria->add(TbluserPeer::US_ACLGROUP, $this->us_aclgroup);
		if ($this->isColumnModified(TbluserPeer::US_SCHOOL)) $criteria->add(TbluserPeer::US_SCHOOL, $this->us_school);
		if ($this->isColumnModified(TbluserPeer::US_PROVINCE)) $criteria->add(TbluserPeer::US_PROVINCE, $this->us_province);
		if ($this->isColumnModified(TbluserPeer::US_LASTVISITED)) $criteria->add(TbluserPeer::US_LASTVISITED, $this->us_lastvisited);
		if ($this->isColumnModified(TbluserPeer::US_REGISTERDATE)) $criteria->add(TbluserPeer::US_REGISTERDATE, $this->us_registerdate);
		if ($this->isColumnModified(TbluserPeer::US_RATING)) $criteria->add(TbluserPeer::US_RATING, $this->us_rating);
		if ($this->isColumnModified(TbluserPeer::US_DOWNLOAD)) $criteria->add(TbluserPeer::US_DOWNLOAD, $this->us_download);
		if ($this->isColumnModified(TbluserPeer::US_AVATAR)) $criteria->add(TbluserPeer::US_AVATAR, $this->us_avatar);
		if ($this->isColumnModified(TbluserPeer::US_STATUS)) $criteria->add(TbluserPeer::US_STATUS, $this->us_status);
		if ($this->isColumnModified(TbluserPeer::US_KEY)) $criteria->add(TbluserPeer::US_KEY, $this->us_key);
		if ($this->isColumnModified(TbluserPeer::US_COMPANY)) $criteria->add(TbluserPeer::US_COMPANY, $this->us_company);
		if ($this->isColumnModified(TbluserPeer::US_SCORE)) $criteria->add(TbluserPeer::US_SCORE, $this->us_score);
		if ($this->isColumnModified(TbluserPeer::US_POINTPLUS)) $criteria->add(TbluserPeer::US_POINTPLUS, $this->us_pointplus);
		if ($this->isColumnModified(TbluserPeer::US_CHECKED)) $criteria->add(TbluserPeer::US_CHECKED, $this->us_checked);
		if ($this->isColumnModified(TbluserPeer::US_CHECKINFO)) $criteria->add(TbluserPeer::US_CHECKINFO, $this->us_checkinfo);
		if ($this->isColumnModified(TbluserPeer::US_IDMD5)) $criteria->add(TbluserPeer::US_IDMD5, $this->us_idmd5);
		if ($this->isColumnModified(TbluserPeer::US_HOMEPAGE)) $criteria->add(TbluserPeer::US_HOMEPAGE, $this->us_homepage);
		if ($this->isColumnModified(TbluserPeer::US_MONEY)) $criteria->add(TbluserPeer::US_MONEY, $this->us_money);

		return $criteria;
	}

	
	public function buildPkeyCriteria()
	{
		$criteria = new Criteria(TbluserPeer::DATABASE_NAME);

		$criteria->add(TbluserPeer::US_ID, $this->us_id);

		return $criteria;
	}

	
	public function getPrimaryKey()
	{
		return $this->getUsId();
	}

	
	public function setPrimaryKey($key)
	{
		$this->setUsId($key);
	}

	
	public function copyInto($copyObj, $deepCopy = false)
	{

		$copyObj->setUsUsername($this->us_username);

		$copyObj->setUsPassword($this->us_password);

		$copyObj->setUsFirstname($this->us_firstname);

		$copyObj->setUsLastname($this->us_lastname);

		$copyObj->setUsSex($this->us_sex);

		$copyObj->setUsEmail($this->us_email);

		$copyObj->setUsPhone($this->us_phone);

		$copyObj->setUsAclgroup($this->us_aclgroup);

		$copyObj->setUsSchool($this->us_school);

		$copyObj->setUsProvince($this->us_province);

		$copyObj->setUsLastvisited($this->us_lastvisited);

		$copyObj->setUsRegisterdate($this->us_registerdate);

		$copyObj->setUsRating($this->us_rating);

		$copyObj->setUsDownload($this->us_download);

		$copyObj->setUsAvatar($this->us_avatar);

		$copyObj->setUsStatus($this->us_status);

		$copyObj->setUsKey($this->us_key);

		$copyObj->setUsCompany($this->us_company);

		$copyObj->setUsScore($this->us_score);

		$copyObj->setUsPointplus($this->us_pointplus);

		$copyObj->setUsChecked($this->us_checked);

		$copyObj->setUsCheckinfo($this->us_checkinfo);

		$copyObj->setUsIdmd5($this->us_idmd5);

		$copyObj->setUsHomepage($this->us_homepage);

		$copyObj->setUsMoney($this->us_money);


		if ($deepCopy) {
									$copyObj->setNew(false);

			$relObj = $this->getTblblogcheckinfo();
			if ($relObj) {
				$copyObj->setTblblogcheckinfo($relObj->copy($deepCopy));
			}

		} 

		$copyObj->setNew(true);

		$copyObj->setUsId(NULL); 
	}

	
	public function copy($deepCopy = false)
	{
				$clazz = get_class($this);
		$copyObj = new $clazz();
		$this->copyInto($copyObj, $deepCopy);
		return $copyObj;
	}

	
	public function getPeer()
	{
		if (self::$peer === null) {
			self::$peer = new TbluserPeer();
		}
		return self::$peer;
	}

	
	public function getTblblogcheckinfo(PropelPDO $con = null)
	{

		if ($this->singleTblblogcheckinfo === null && !$this->isNew()) {
			$this->singleTblblogcheckinfo = TblblogcheckinfoPeer::retrieveByPK($this->us_id, $con);
		}

		return $this->singleTblblogcheckinfo;
	}

	
	public function setTblblogcheckinfo(Tblblogcheckinfo $v)
	{
		$this->singleTblblogcheckinfo = $v;

				if ($v->getTbluser() === null) {
			$v->setTbluser($this);
		}

		return $this;
	}

	
	public function clearAllReferences($deep = false)
	{
		if ($deep) {
			if ($this->singleTblblogcheckinfo) {
				$this->singleTblblogcheckinfo->clearAllReferences($deep);
			}
		} 
		$this->singleTblblogcheckinfo = null;
	}

} 