-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaction.changelog.php
More file actions
57 lines (52 loc) · 1.76 KB
/
Copy pathaction.changelog.php
File metadata and controls
57 lines (52 loc) · 1.76 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
<?php
/*
This file is part of CMS Made Simple module: Tourney.
Copyright (C) 2014-2016 Tom Phane <tpgww@onepost.net>
Refer to licence and other details at the top of file Tourney.module.php
More info at http://dev.cmsmadesimple.org/projects/tourney
*/
if (isset($params['close']))
{
$newparms = $this->GetEditParms($params,'resultstab');
$this->Redirect($id,'addedit_comp',$returnid,$newparms);
}
$tplvars = array();
$pref = cms_db_prefix();
$sql = 'SELECT * FROM '.$pref.'module_tmt_history WHERE bracket_id=? ORDER BY changewhen DESC';
$data = $db->GetArray($sql,array($params['bracket_id']));
if ($data)
{
$changes = array();
$rowclass = 'row1';
foreach ($data as $line)
{
$one = new stdClass();
$one->rowclass = $rowclass;
$one->who = $line['changer'];//TODO format
$one->when = substr($line['changewhen'],0,-3);//strip seconds from timestamp
$one->from = $line['olddata'];
$one->to = $line['newdata'];
$changes[] = $one;
($rowclass=='row1'?$rowclass='row2':$rowclass='row1');
}
$tplvars += array(
'changes' => $changes,
'changer' => $this->Lang('title_changer'),
'changewhen' => $this->Lang('title_changewhen'),
'olddata' => $this->Lang('title_olddata'),
'newdata' => $this->Lang('title_newdata')
);
}
else
$tplvars['nochanges'] = $this->Lang('nochanges');
$sql = 'SELECT name FROM '.$pref.'module_tmt_brackets WHERE bracket_id=?';
$name = $db->GetOne($sql,array($params['bracket_id']));
$tplvars += array(
'start_form' => $this->CreateFormStart($id,'changelog',$returnid),
'end_form' => $this->CreateFormEnd(),
'hidden' => $this->GetHiddenParms($id,$params,'resultstab'),
'title' => $this->Lang('title_changelog',$name),
'close' => $this->CreateInputSubmit($id, 'close', $this->Lang('close'))
);
tmtTemplate::Process($this,'changelog.tpl',$tplvars);
?>