<?php
//图片轮播验证类
class RecommendshopCheck extends Check{
	
	public function addCheck(Model &$_model) {
		if (self::isNullString($_POST['title'])) {
			$this->_message[] = '名称不得为空！';
			$this->_flag = false;
		}
		if (self::checkStrLength($_POST['title'], 2, 'min')) {
			$this->_message[] = '名称不得小于2位！';
			$this->_flag = false;
		}
		if (self::checkStrLength($_POST['title'], 50, 'max')) {
			$this->_message[] = '名称不得大于50位！';
			$this->_flag = false;
		}		
		
		if (self::isNullString($_POST['url'])) {
			$this->_message[] = '链接地址不得为空！';
			$this->_flag = false;
		}
		if (self::isNullString($_POST['site_logo'])) {
			$this->_message[] = '图片不得为空！';
			$this->_flag = false;
		}
		if (self::isNullString($_POST['info'])) {
			$this->_message[] = '描述不得为空！';
			$this->_flag = false;
		}
		if (self::checkStrLength($_POST['info'], 200, 'max')) {
			$this->_message[] = '名称不得大于200位！';
			$this->_flag = false;
		}
		
		return $this->_flag;
	}
	
	public function updateCheck(Model &$_model) {
		if (self::isNullString($_POST['title'])) {
			$this->_message[] = '名称不得为空！';
			$this->_flag = false;
		}
		if (self::checkStrLength($_POST['title'], 2, 'min')) {
			$this->_message[] = '名称不得小于2位！';
			$this->_flag = false;
		}
		if (self::checkStrLength($_POST['title'], 50, 'max')) {
			$this->_message[] = '名称不得大于50位！';
			$this->_flag = false;
		}		
		
		if (self::isNullString($_POST['url'])) {
			$this->_message[] = '链接地址不得为空！';
			$this->_flag = false;
		}
		if (self::isNullString($_POST['site_logo'])) {
			$this->_message[] = '图片不得为空！';
			$this->_flag = false;
		}
		if (self::isNullString($_POST['info'])) {
			$this->_message[] = '描述不得为空！';
			$this->_flag = false;
		}
		if (self::checkStrLength($_POST['info'], 200, 'max')) {
			$this->_message[] = '名称不得大于200位！';
			$this->_flag = false;
		}			
		return $this->_flag;
	}
}
?>