1 |
dpavlin |
1.1 |
<?php |
2 |
|
|
|
3 |
|
|
$corp_dbh = new DBI("corp","dpavlin",""); |
4 |
|
|
|
5 |
|
|
$sql_where="where $visible_is_true"; |
6 |
|
|
|
7 |
|
|
if (file_exists(find_html_file("/data/corp_html/news",$more))) { |
8 |
|
|
|
9 |
|
|
$main=join('',file(find_html_file("/data/corp_html/news",$more))); |
10 |
|
|
$back_url=$GLOBALS[HTTP_REFERER]; |
11 |
|
|
|
12 |
|
|
} else { |
13 |
|
|
if (isset($id)) { |
14 |
|
|
$sql_where.=" and id=$id "; |
15 |
|
|
} |
16 |
|
|
|
17 |
|
|
$smarty->assign("mtext","Sporoèila za javnost"); |
18 |
|
|
|
19 |
|
|
if (isset($type)) { |
20 |
|
|
if ($type == "n") { |
21 |
|
|
$sql_where .= " and (type='n' or type='i')"; |
22 |
|
|
$title.=" : News"; |
23 |
|
|
} elseif ($type == "e") { |
24 |
|
|
$sql_where .= " and type='e'"; |
25 |
|
|
$title.=" : Events"; |
26 |
|
|
} elseif ($type == "c") { |
27 |
|
|
$sql_where .= " and type='c'"; |
28 |
|
|
$title.=" : Community"; |
29 |
|
|
} |
30 |
|
|
} |
31 |
|
|
|
32 |
|
|
if (! isset($show) && !isset($start)) { |
33 |
|
|
$sql_limit="limit 10"; |
34 |
|
|
} elseif (isset($start)) { |
35 |
|
|
$sql_limit="limit 10,$start"; |
36 |
|
|
} |
37 |
|
|
|
38 |
|
|
|
39 |
|
|
$num_selected=0; |
40 |
|
|
$sql="select |
41 |
|
|
id,upper(title) as title,town_date,body,more,pdf, |
42 |
|
|
(date-now()::date) as comming,type,title as title_lc |
43 |
|
|
from news $sql_where order by priority desc,date desc $sql_limit"; |
44 |
|
|
# print "$sql"; |
45 |
|
|
$sth = $corp_dbh->prepare("$sql"); |
46 |
|
|
$sth->execute(); |
47 |
|
|
while ($row=$sth->fetchrow_hash()) { |
48 |
|
|
if ($row[pdf]) $row[url]="http://www.pliva.hr/pdf/".$row[pdf]; |
49 |
|
|
$data[]=$row; |
50 |
|
|
$num_selected++; |
51 |
|
|
} |
52 |
|
|
|
53 |
|
|
if ($num_selected == 10) { |
54 |
|
|
$tmp="$PHP_SELF?start=".($start+10); |
55 |
|
|
if ($days) $tmp.="&days=$days"; |
56 |
|
|
$smarty->assign(array( |
57 |
|
|
"multi_page_show" => 1, |
58 |
|
|
"multi_page_next" => $tmp |
59 |
|
|
)); |
60 |
|
|
} |
61 |
|
|
if ($start && $start >= 10) { |
62 |
|
|
$tmp="$PHP_SELF?start=".($start-10); |
63 |
|
|
if ($days) $tmp.="&days=$days"; |
64 |
|
|
$smarty->assign(array( |
65 |
|
|
"multi_page_show" => 1, |
66 |
|
|
"multi_page_prev" => $tmp |
67 |
|
|
)); |
68 |
|
|
} |
69 |
|
|
|
70 |
|
|
if (isset($id) && $num_selected == 1) { |
71 |
|
|
if ($data[0][type] == "n") { |
72 |
|
|
$title.=" : News : ".$data[0][title_lc]; |
73 |
|
|
} elseif ($data[0][type] == "e") { |
74 |
|
|
$title.=" : Event : ".$data[0][title_lc]; |
75 |
|
|
} elseif ($data[0][type] == "c") { |
76 |
|
|
$title.=" : Community : ".$data[0][title_lc]; |
77 |
|
|
} elseif ($data[0][type] == "r") { |
78 |
|
|
$title.=" : Result : ".$data[0][title_lc]; |
79 |
|
|
} elseif ($data[0][type] == "i") { |
80 |
|
|
$title.=" : Investors News : ".$data[0][title_lc]; |
81 |
|
|
} elseif ($data[0][type] == "a") { |
82 |
|
|
$title.=" : Annual Report : ".$data[0][title_lc]; |
83 |
|
|
} elseif ($data[0][type] == "p") { |
84 |
|
|
$title.=" : Presentations : ".$data[0][title_lc]; |
85 |
|
|
} |
86 |
|
|
} |
87 |
|
|
|
88 |
|
|
|
89 |
|
|
if (isset($days) && $num_selected == 0) { |
90 |
|
|
$warning = "There are no news for last $days days."; |
91 |
|
|
} elseif ($main == "" && $num_selected == 0) { |
92 |
|
|
$warning = "This news item is no longer available"; |
93 |
|
|
} |
94 |
|
|
|
95 |
|
|
$smarty->assign(array( |
96 |
|
|
data=>$data, |
97 |
|
|
warning=>$warning |
98 |
|
|
)); |
99 |
|
|
|
100 |
|
|
$smarty->assign("m_session","p=corp_news&m=o_nas&"); |
101 |
|
|
$smarty->assign("m_session_urlend","&p=corp_news&m=o_nas&"); |
102 |
|
|
$smarty->assign("m_form_session",'<input type="hidden" name="p" value="corp_news"><input type="hidden" name="m" value="o_nas">'); |
103 |
|
|
|
104 |
|
|
$main=$smarty->fetch("novosti.tpl"); |
105 |
|
|
|
106 |
|
|
if (isset($id) && find_html_file("/data/corp_html/news",$data[0][more])) { |
107 |
|
|
$main=join('',file(find_html_file("/data/corp_html/news",$data[0][more]))); |
108 |
|
|
} |
109 |
|
|
|
110 |
|
|
} |
111 |
|
|
|
112 |
|
|
$smarty->assign( array(back_url=>$back_url) ); |
113 |
|
|
|
114 |
|
|
?> |