/[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.7 - (show annotations)
Wed Nov 7 14:24:02 2001 UTC (22 years, 4 months ago) by dpavlin
Branch: MAIN
Changes since 1.6: +10 -0 lines
zaposleni

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

  ViewVC Help
Powered by ViewVC 1.1.26