/[pliva-si]/multi.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /multi.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.9 - (hide annotations)
Wed Nov 7 12:09:58 2001 UTC (22 years, 4 months ago) by dpavlin
Branch: MAIN
Changes since 1.8: +1 -0 lines
mnogo toga

1 dpavlin 1.1 <?php
2 dpavlin 1.4
3     $max_title_len=20; // max. length of titles in drop-down
4    
5 dpavlin 1.1 require("Smarty.class.php");
6     require("conn.inc");
7    
8     $smarty = new Smarty;
9    
10     $smarty->assign( array ( Title=>"PLIVA Ljubljana" ) );
11    
12     include("find_html_file.inc");
13    
14     if (! isset($p)) {
15     $p=0;
16     $section="domov";
17     } else {
18     // fetch current page
19 dpavlin 1.7 $sql="select id,menu_num,name,html,path,type from multi where $visible_is_true and id=$p";
20 dpavlin 1.1 $sth = $dbh->prepare("$sql");
21     $sth->execute();
22 dpavlin 1.8 if (! $row=$sth->fetchrow_hash()) {
23     $sth = $dbh->prepare("select min(num) as menu_num from menu");
24     $sth->execute();
25     $row2=$sth->fetchrow_hash();
26     $row = array(id=>0,menu_num=>$row2[menu_num],name=>"Can't find page",html=>'',path=>'',type=>'');
27     }
28 dpavlin 1.1
29     $title.=" : $row[name]";
30 dpavlin 1.9 $smarty->assign("mtext",$row[name]);
31 dpavlin 1.7 if ($row[type]=="h" && find_html_file("multi",$row[html])) {
32 dpavlin 1.1 $main=join('',file(find_html_file("multi",$row[html])));
33 dpavlin 1.3 } elseif ($row[type]=="p") {
34 dpavlin 1.7 if (find_html_file("",$row[path])) {
35     $main=join('',file(find_html_file("",$row[path])));
36 dpavlin 1.5 // fix entities from MS programs
37     include("fix_msshit.inc");
38     $main=fix_msshit($main);
39 dpavlin 1.3 } else {
40     $main="<b>can't find $row[path] for id $p</b>";
41     }
42 dpavlin 1.2 // try to load translation (html fix-up or something)
43     $fix_up="./fix_up/".str_replace("/","_",dirname($row[path])).".inc";
44 dpavlin 1.3
45     # $main.="<!-- trying to use fixup $fix_up -->"; ## DEBUG
46 dpavlin 1.2 if (file_exists($fix_up)) {
47     include($fix_up);
48 dpavlin 1.3 # $main.="<!-- fixup: $fix_up -->"; ## DEBUG
49 dpavlin 1.2 }
50 dpavlin 1.1 } else {
51     $main="<b>can't find multi page for id $p</b>";
52     }
53    
54     // fetch section
55     $sql="select section,item from menu where num=$row[menu_num]";
56     $sth = $dbh->prepare("$sql");
57     $sth->execute();
58     $menu_row=$sth->fetchrow_hash();
59     $section=$menu_row[section];
60     $title=" : $menu_row[item] $title";
61     $title=str_replace("\\n"," ",$title); // nuke nl chars
62    
63     // fetch all pages in this multi-page
64 dpavlin 1.7 $sql="select id,name from multi where $visible_is_true and menu_num=$row[menu_num] order by menu_num,num";
65 dpavlin 1.1 $sth = $dbh->prepare("$sql");
66     $sth->execute();
67    
68     $multi_page_url=array();
69     $multi_page_options=array();
70     $multi_page_id=array();
71     $max=0;
72     while ($row=$sth->fetchrow_hash()) {
73     array_push($multi_page_url,"$PHP_SELF?p=$row[id]");
74     array_push($multi_page_id,$row[id]);
75 dpavlin 1.4 $drop_title=$row[name];
76     if (strlen($drop_title) > $max_title_len) $drop_title=substr($drop_title,0,$max_title_len)."...";
77     $multi_page_options[$row[id]]=$drop_title;
78 dpavlin 1.1 if ($row[id] == $p) {
79     $current=$max;
80     $curr_id=$row[id];
81     }
82     $max++;
83     }
84     $smarty->assign(array(
85     "multi_page_show" => 1,
86     "multi_page_current"=>($current+1),
87     "multi_page_max"=>$max,
88     "multi_page_prev"=>$multi_page_url[$current-1],
89     "multi_page_next"=>$multi_page_url[$current+1],
90     "multi_page_options"=>$multi_page_options,
91     "multi_page_curr_id"=>$curr_id
92     ));
93     }
94    
95     require("inc/section.php");
96     include("common.inc");
97    
98     $smarty->assign(array(section=>$section,
99     mpic=>$mpic,
100     Section_title=>$title,
101     rnd=>$rnd,
102     MAIN=>$main,
103     ));
104    
105     $smarty->display("index.tpl");
106     ?>

  ViewVC Help
Powered by ViewVC 1.1.26