forked from AppStateESS/InternshipInventory
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChangeHistoryView.php
48 lines (34 loc) · 1.25 KB
/
ChangeHistoryView.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
44
45
46
47
48
<?php
namespace Intern;
class ChangeHistoryView {
private $internship;
public function __construct(Internship $internship)
{
$this->internship = $internship;
}
public function show()
{
$tpl = array();
$tpl['CHANGELOG_REPEAT'] = array();
$changes = ChangeHistoryFactory::getChangesForInternship($this->internship);
if(is_null($changes)){
return "";
}
foreach($changes as $change){
$changeFields = array();
$changeFields['RELATIVE_DATE'] = $change->getRelativeDate();
$changeFields['EXACT_DATE'] = $change->getFormattedDate();
$changeFields['USERNAME'] = $change->getUsername();
if($change->getFromStateFriendlyname() != $change->getToStateFriendlyName()){
$changeFields['FROM_STATE'] = $change->getFromStateFriendlyName();
$changeFields['TO_STATE'] = $change->getToStateFriendlyName();
}
$note = $change->getNote();
if(!is_null($note)){
$changeFields['NOTE'] = $note;
}
$tpl['changelog_repeat'][] = $changeFields;
}
return \PHPWS_Template::process($tpl, 'intern', 'changeHistory.tpl');
}
}