From: <lra...@us...> - 2003-04-30 14:18:04
|
Update of /cvsroot/tikiwiki/tiki/lib/charts In directory sc8-pr-cvs1:/tmp/cvs-serv5930/lib/charts Modified Files: chartlib.php Log Message: More chart features Index: chartlib.php =================================================================== RCS file: /cvsroot/tikiwiki/tiki/lib/charts/chartlib.php,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- chartlib.php 30 Apr 2003 12:53:50 -0000 1.4 +++ chartlib.php 30 Apr 2003 14:17:30 -0000 1.5 @@ -65,6 +65,7 @@ } else { $res['voted']='n'; } + $res['perm'] = $this->getOne("select count(*) from tiki_charts_rankings where itemId=".$res['itemId']); $ret[]=$res; } return $ret; @@ -128,6 +129,30 @@ $query = "select * from tiki_chart_items where itemId='$itemId'"; $result = $this->query($query); $res = $result->fetchRow(DB_FETCHMODE_ASSOC); + $period = $this->get_last_period($res['chartId']); + if($period) { + // Permanency + $res['perm']=$this->getOne("select count(*) from tiki_charts_rankings where itemId=$itemId"); + // Current position + $res['position']= $this->getOne("select position from tiki_charts_rankings where itemId=$itemId and period=$period"); + // Last position + $res['lastPosition']= $this->getOne("select lastPosition from tiki_charts_rankings where itemId=$itemId and period=$period"); + // Best position + $res['best']= $this->getOne("select min(position) from tiki_charts_rankings where itemId=$itemId"); + if($res['lastPosition'] != 0) { + $res['dif']=$res['position']-$res['position']; + if($res['dif']==0) $res['dif']='-'; + } else { + $res['dif']='new'; + } + // Dif + } else { + $res['perm']=0; + $res['position']=0; + $res['lastPosition']=0; + $res['best']=0; + $res['dif']=0; + } return $res; } @@ -269,6 +294,10 @@ $cant = $this->getOne($query_cant); $ret = Array(); while($res = $result->fetchRow(DB_FETCHMODE_ASSOC)) { + $res['items'] = $this->getOne('select count(*) from tiki_chart_items where chartId='.$res['chartId']); + $query2="select distinct(period) from tiki_charts_rankings where chartId=".$res['chartId']; + $result2=$this->query($query2); + $res['periods']=$result2->numRows(); $ret[] = $res; } $retval = Array(); |