-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathWindowButton.php
47 lines (39 loc) · 980 Bytes
/
WindowButton.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
<?php
namespace Gridito;
use Nette\Application\Responses\TextResponse;
/**
* Window button
*
* @author Jan Marek
* @license MIT
*/
class WindowButton extends BaseButton
{
/**
* Handle click signal
* @param string $token security token
* @param mixed $uniqueId primary key
*/
public function handleClick($token, $uniqueId = null) {
ob_start();
parent::handleClick($token, $uniqueId);
$output = ob_get_clean();
if ($this->getPresenter()->isAjax()) {
$this->getPresenter()->sendResponse(new TextResponse($output));
} else {
$this->getGrid()->getTemplate()->windowLabel = $this->getLabel();
$this->getGrid()->getTemplate()->windowOutput = $output;
}
}
/**
* Create button element
* @param mixed $row row
* @return \Nette\Web\Html
*/
public function createButton($row = null) {
$el = parent::createButton($row);
$el->class[] = 'gridito-window-button';
$el->data('gridito-window-title', $this->getLabel());
return $el;
}
}