forked from janmarek/gridito
-
Notifications
You must be signed in to change notification settings - Fork 1
/
WindowButton.php
47 lines (39 loc) · 963 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 security token
* @param mixed 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
* @return \Nette\Web\Html
*/
protected function createButton($row = null) {
$el = parent::createButton($row);
$el->class[] = "gridito-window-button";
$el->data("gridito-window-title", $this->getLabel());
return $el;
}
}