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

Contents of /sections/novosti.inc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.10 - (show annotations)
Wed Nov 21 09:16:47 2001 UTC (17 years, 11 months ago) by dpavlin
Branch: MAIN
CVS Tags: HEAD
Changes since 1.9: +3 -3 lines
prijevodi

1 <?
2
3 include("news_sif.inc");
4
5 $sql_where="where $visible_is_true";
6
7 $smarty->assign("m_session","&m=o_nas&");
8 $smarty->assign("m_session_urlend","&m=o_nas&");
9 $smarty->assign("m_form_session",'<input type="hidden" name="m" value="o_nas">');
10
11 if (file_exists(find_html_file("more",$more))) {
12
13 $main=join('',file(find_html_file("more",$more)));
14 $back_url=$GLOBALS[HTTP_REFERER];
15
16 } else {
17 if (isset($id)) {
18 $sql_where.=" and id=$id ";
19 }
20
21 if (isset($type)) {
22 if ($type == "n") {
23 $sql_where .= " and substr(type,1,1)='n'";
24 $title.=" : Novosti";
25 } elseif ($type == "e") {
26 $sql_where .= " and substr(type,1,1)='e'";
27 $title.=" : Dogotki";
28 } elseif (strlen($type) == 3) {
29 $sql_where .= " and type='$type'";
30 if (substr($type,0,2) == "mp" || $type=="mcx" || $type=="mix") $title.=" : Publikacije";
31 if ($type=="mp_") {
32 $title.=" : PLIVA Magazin";
33 $smarty->assign("mtext","PLIVA Magazin");
34 } elseif ($type=="mpx") {
35 $title.=" : Pharna Info";
36 $smarty->assign("mtext","Pharma Info");
37 } elseif ($type=="mcx") {
38 $title.=" : Medicus";
39 $smarty->assign("mtext","Medicus");
40 } elseif ($type=="mix") {
41 $title.=" : Medinfo bulletin";
42 $smarty->assign("mtext","Medinfo bulletin");
43 }
44 }
45 }
46
47 if (! isset($show) && !isset($start)) {
48 $sql_limit="limit 10";
49 } elseif (isset($start)) {
50 $sql_limit="limit 10,$start";
51 }
52
53
54 if (isset($days)) {
55 if ($days != 0) {
56 $sql_where.=" and date(now())-date(date) > 0 and date(now())-date(date) < $days";
57 $title.=" : Pregled novic zadnjega $days dni";
58 }
59 $smarty->assign("days",$days);
60 $smarty->assign("last_days",array(14,30,160,240,365));
61 $smarty->assign("last_desc",array("zadnjih 14 dneh","meseca","¹tirih mesecev","¹estih mesecev","enega leta"));
62 }
63
64 $num_selected=0;
65 $sql="select
66 id,upper(title) as title,town_date,body,more,pdf,
67 (date-now()::date) as comming,type,title as title_lc
68 from news $sql_where order by priority desc,date desc $sql_limit";
69 # print "$sql";
70 $sth = $dbh->prepare("$sql");
71 $sth->execute();
72 while ($row=$sth->fetchrow_hash()) {
73 if ($row[pdf]) $row[url]="blob/".$row[pdf];
74 $data[]=$row;
75 $num_selected++;
76 }
77
78 if ($num_selected == 10) {
79 $tmp="$PHP_SELF?start=".($start+10);
80 if ($days) $tmp.="&days=$days";
81 $smarty->assign(array(
82 "multi_page_show" => 1,
83 "multi_page_next" => $tmp
84 ));
85 }
86 if ($start && $start >= 10) {
87 $tmp="$PHP_SELF?start=".($start-10);
88 if ($days) $tmp.="&days=$days";
89 $smarty->assign(array(
90 "multi_page_show" => 1,
91 "multi_page_prev" => $tmp
92 ));
93 }
94
95 if (isset($id) && $num_selected == 1) {
96 $title.=" : ".$news_sif[$data[0][type]];
97 $title.=" : ".$data[0][title_lc];
98 }
99
100
101 if (isset($days) && $num_selected == 0) {
102 $warning = "Ni novic v zadnjih $days dneh.";
103 } elseif ($main == "" && $num_selected == 0) {
104 $warning = "Podatki niso veæ dostopni.";
105 }
106
107 $smarty->assign(array(
108 data=>$data,
109 warning=>$warning
110 ));
111
112
113 if (isset($id) && find_html_file("more",$data[0][more])) {
114 $main=join('',file(find_html_file("more",$data[0][more])));
115 } else {
116 if (! isset($p)) $p="novosti";
117 $logo="p/${p}_".$data[0][type].".jpg";
118 if (file_exists($logo)) {
119 $smarty->assign("logo",$logo);
120 }
121 $main=$smarty->fetch("$p.tpl");
122 }
123
124
125 }
126
127 $smarty->assign( array(back_url=>$back_url) );
128
129
130 ?>

  ViewVC Help
Powered by ViewVC 1.1.26