-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNews.php
More file actions
93 lines (73 loc) · 1.63 KB
/
Copy pathNews.php
File metadata and controls
93 lines (73 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
class News{
private $_id;
private $_header;
private $_date;
private $_author;
private $_text;
/*************************************************
*
* use data array ( coming from database) to set News object parameters
*
*
***************************************************/
public function hydrate(array $data)
{
if (isset($data['id']))
{
$this->_id = $data['id'];
}
if (isset($data['header']))
{
$this->setHeader($data['header']);
}
if (isset($data['newsDate']))
{
$this->setDate($data['newsDate']);
}
if (isset($data['author']))
{
$this->setAuthor($data['author']);
}
if (isset($data['text']))
{
$this->_text = $data['text'];
}
}
public function getHeader(){
return $this->_header;
}
public function getDate(){
return $this->_date;
}
public function getAuthor(){
return $this->_author;
}
public function getText(){
return $this->_text;
}
public function setHeader($header){
$this->_header = $header;
}
public function setDate($date){
$this->_date = $date;
}
public function setAuthor($author){
$this->_author = $author;
}
public function setText($text){
$this->_text = $text;
}
/*************************************************
*
* return html code to display the news
*
************************************************/
public function getHTML(){
$html = '<tr><td><div id="'.$this->_id.'" class="item" ><H2>'. $this->_header . '</H2>';
$html .= ' Date :' . $this->_date. '<br/>';
$html .= ' Author :' . $this->_author . '<br/>';
$html .= '' . $this->_text .'</div></td></tr>';
return $html;
}
}