<?php

class flinkModel extends Model{
		function __construct(){
			parent:: __construct();
			$this->tabName = TAB_PREFIX."flink";
			$this->fieldList=$this->get_fields($this->tabName,'list');

		}
		function chech_form(){
			$result = true;

			if(!validate::required($_POST['webName'])){
					$this->messList[] = "网站名称不能为空";
					$result = false;
			}
			if(!validate::required($_POST['webUrl'])){
					$this->messList[] = "网站网址不能为空";
					$result = false;
			}
			if(!validate::isNumber($_POST['ordering'])){
					$this->messList[] = "排序必须为数字";
					$result = false;
			}
			return $result;
		}

		function valorder(){
			$result = true;
			foreach($_POST['order'] as $key =>$val){

					if(!validate::isNumber($val)){
					$this->messList[] = "ID为".$key."的排序不为数字.";
					$result=false;
					}
			}
			return $result;

		}

		function ordering(){
			$result = true;
			foreach($_POST['order'] as $key=>$val){
				$result = $this->mod(array('id'=>$key,'ordering'=>$val));

			}
			return $result;

		}


}
?>