/
Listing 5-5.php
43 lines (33 loc) · 1.29 KB
/
Listing 5-5.php
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
<?php
require_once('include/Dashlets/Dashlet.php');
class TeamNoticesDashlet extends Dashlet
{
public $isRefreshable = false;
public $hasScript = true;
public function __construct(
$id
)
{
parent::Dashlet($id);
if(empty($def['title']))
$this->title = translate('LBL_MODULE_NAME', 'TeamNotices');
}
public function displayScript()
{
}
public function display()
{
$data = array();
require_once('include/Sugar_Smarty.php');
$ss = new Sugar_Smarty();
require_once('modules/TeamNotices/TeamNotice.php');
$focus = new TeamNotice();
$today = db_convert("'".gmdate($GLOBALS['timedate']->dbDayFormat)."'", 'date');
$query = $focus->create_list_query("date_start",$focus->table_name.".date_start <= $today and ".$focus->table_name.".date_end >= $today and ".$focus->table_name.'.status=\'Visible\'');
if ( $result = $focus->db->query($query) )
while ( $row = $focus->db->fetchByAssoc($result) )
$data[] = $row;
$ss->assign("data", $data);
return parent::display() . $ss->fetch('modules/TeamNotices/Dashlets/TeamNoticesDashlet/TeamNoticesDashlet.tpl');
}
}