downloadNotification.inc.php
2.83 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
/**
* Class handles the bulk download notification
*
* @author KnowledgeTree Team
* @package Bulk Downloads
*/
class KTDownloadNotification
{
/**
* The error returned
*
* @access public
* @var $error
*/
public $error;
/**
* The user for which the download notification is being generated
*
* @access private
* @var $code
*/
private $code;
/**
* Constructor function for the class
*
* @author KnowledgeTree Team
* @access public
* @return KTElectronicSignatures
*/
public function KTDownloadNotification($code)
{
$this->code = $code;
}
/**
* Returns the form displaying the download link (and option to cancel the download?)
*
* @author KnowledgeTree Team
* @access public
* @param string $head The heading for the form
* @param string $request_type Determines the actions for the buttons
* @return html
*/
public function getNotificationForm($head)
{
global $default;
// check for the download link
$link = DownloadQueue::getDownloadLink($this->code);
$text = 'Download Now';
$cancelAction = 'deleteDownload()';
$closeAction = 'deferDownload()';
$oTemplating =& KTTemplating::getSingleton();
$oTemplate = $oTemplating->loadTemplate('kt3/notifications/notification.BulkDownload');
$aTemplateData = array(
'head' => $head,
'downloadLink' => $link,
'downloadText' => $text,
'exportCode' => $this->code,
'cancelAction' => $cancelAction,
'closeAction' => $closeAction
);
return $oTemplate->render($aTemplateData);
}
/**
* Returns the error from the attempted signature
*
* @author KnowledgeTree Team
* @access public
* @return string
*/
public function getError()
{
return '<div class="error">'.$this->error.'</div>';
}
/**
* Displays a button for closing the panel
*
* @author KnowledgeTree Team
* @access public
* @param string $request_type Determines the action taken on close - close = redirect action | null = close panel action
* @param string $request Optional. Used within the close action.
* @return string
*/
public function getCloseButton($request_type, $request = null)
{
switch ($request_type){
case 'close':
$cancelAction = "window.location.href = '{$request}'";
break;
default:
$cancelAction = "panel_close()";
}
return '<div class="form_actions" style="margin-top: 30px;">
<a href="#" onclick="javascript: '.$cancelAction.'">'._kt('Close').'</a>
</div>';
}
}
?>