return($row[0]);
}
-function month_a($year,$month,$month_last=0)
+function num2greg($num)
{
- global $tb_obsah;
+ $r="";
+ $vals=array(1=>"I",5=>"V",10=>"X",50=>"L",100=>"C",500=>"D",1000=>"M");
+ krsort($vals,SORT_NUMERIC);
+ foreach($vals as $val=>$sym) {
+ while ($num<0 && $num+$val<-$num) {
+ $r=substr($r,0,-1).$sym.substr($r,-1,1);
+ $num+=$val;
+ }
+ while (10*$num>=8*$val+(substr($val,0,1)=="1")) {
+ $r=$r.$sym;
+ $num-=$val;
+ }
+ }
+ return($r);
+}
+
+function month_a($year,$month,$month_last=0,$sequential=0)
+{
+ global $tb_obsah,$obsah_year_base;
- if (!$month_last)
- $month_last=db_item("select month_last from $tb_obsah where year='$year' and month='$month'");
+ if (!$month_last || !$sequential)
+ list($month_last,$sequential)=db_row("select month_last,sequential from $tb_obsah where year='$year' and month='$month'");
$month_full=sprintf("%02d".($month==$month_last ? "" : "-%02d"),$month,$month_last);
$r=array("year"=>$year,"month"=>$month,"month_last"=>$month_last,"month_full"=>$month_full,
- "name"=>"$month".($month==$month_last ? "" : "-$month_last")."/$year",
+ "name"=>"$month" .($month==$month_last ? "" : "-$month_last")."/$year",
"img" =>"img/eap-$year-${month_full}.jpeg",
"icon"=>"img/eap-$year-${month_full}s.jpeg",
);
+ $r["name_full"]=$r["name"]
+ ." ($sequential".($month==$month_last ? "" : "-".($sequential+$month_last-$month)).")"
+ ." - ".num2greg($year-$obsah_year_base+1).". roèník";
return($r);
}
{
if (isset($year) && isset($month)) {
$month_a=month_a($year,$month);
- return("Èíslo ".$month_a["name"]);
+ return("Èíslo ".$month_a["name_full"]);
}
else if (isset($year))
return("Roèník $year");
);
}
-function title_icons_table_month($year,$month,$month_last)
+function title_icons_table_month($year,$month,$month_last,$sequential)
{
- $month_a=month_a($year,$month,$month_last);
+ $month_a=month_a($year,$month,$month_last,$sequential);
print("<a href=\"title.php?year=$year&month=$month\">"
- .img($month_a["icon"],"titulní stránka ".$month_a["name"])."</a><br />"
+ .img($month_a["icon"],"titulní stránka ".$month_a["name_full"])."</a><br />"
."<a href=\"obsah.php?year=$year&month=$month\">obsah ".$month_a["name"]."</a>"
);
}
.(isset($year) ? "</a>" : "")
."</h2>\n");
- $result=db_query("select year,month,month_last from $tb_obsah"
+ $result=db_query("select year,month,month_last,sequential from $tb_obsah"
.(isset($year) || isset($month) ? " where" : "")
.(isset($year ) ? " year=$year" : "")
.(isset($year) && isset($month) ? " and" : "")
print("<td align=\"center\""
.($row["month_last"]!=$row["month"] ? " colspan=\"".($row["month_last"]+1-$row["month"])."\"" : "")
.">");
- title_icons_table_month($year,$row["month"]+1,$row["month_last"]+1);
+ title_icons_table_month($year,$row["month"]+1,$row["month_last"]+1,$row["sequential"]);
print("</td>\n");
$month=$row["month_last"];
}