<?php
	class group_titleModel extends model{
		public $table="mod_group_title";
		public function __construct(&$base=null){
			parent::__construct($base);
		}
		
		public  function select($option=array(),&$rscount=false,$cache = 0, $expire = 60){
			$userid=M("login")->userid;
			$fuids=M("follow")->selectCols(array(
				"fields"=>"t_userid",
				"where"=>"userid=".$userid
			));
			 
			$data=parent::select($option,$rscount);
			if($data){
				foreach($data as $v){
					$uids[]=$v['userid'];
				}
				$us=M("user")->getUserByIds($uids); 
				foreach($data as $k=>$v){
					$v['nickname']=$us[$v['userid']]['nickname'];
					$v['user_head']=images_site($us[$v['userid']]['user_head']);
					$v['timeago']=timeago($v['dateline']);
					if($v['userid']==$userid){
						$v['isme']=1;
					}else{
						$v['isme']=0;
					}
					$v['isfollow']=0;
					if($fuids && in_array($v['userid'],$fuids)){
						$v['isfollow']=1;
					}	
					if($v['imgsdata']){
						$v['imgsdata']=explode(",",$v['imgsdata']);
						foreach($v['imgsdata'] as $kk=>$vv){
							$v['imgsdata'][$kk]=images_site($vv);
						}
					}else{
						$v['imgsdata']="";
					}
					
					$data[$k]=$v; 
				}
			}
			return $data;
		}
	}
?>