array( 'NoAction' => 'select action', 'delete' => 'Delete', 'prune' => 'Prune', 'purge' => 'Purge' ), 'JobWindow' => array( 'NoAction' => 'select action', 'delete' => 'Delete' ) ); const NORMAL_VIEW = 'simple'; const DETAIL_VIEW = 'details'; public function onInit($param) { parent::onInit($param); if(empty($_SESSION['view' . $this->getParent()->ID]) && empty($_SESSION['limit' . $this->getParent()->ID])) { $_SESSION['view' . $this->getParent()->ID] = self::NORMAL_VIEW; $_SESSION['limit' . $this->getParent()->ID] = 'unlimited'; } } public function onLoad($param) { parent::onLoad($param); if(!$this->getPage()->IsPostBack) { $this->Limit->dataSource = array_combine($this->elementsLimits, $this->elementsLimits); $this->Limit->SelectedValue = $_SESSION['limit' . $this->getParent()->ID]; $this->Limit->dataBind(); $this->Simple->Checked = ($_SESSION['view' . $this->getParent()->ID] == self::NORMAL_VIEW); $this->Details->Checked = ($_SESSION['view' . $this->getParent()->ID] == self::DETAIL_VIEW); $actions = array_key_exists($this->getParent()->ID, $this->actions) ? $this->actions[$this->getParent()->ID] : array(); $this->Actions->dataSource = $actions; $this->Actions->dataBind(); } } public function switchView($sender, $param) { $_SESSION['view' . $this->getParent()->ID] = ($this->Simple->Checked === true) ? self::NORMAL_VIEW : self::DETAIL_VIEW; $_SESSION['limit' . $this->getParent()->ID] = $this->Limit->SelectedValue; $this->getParent()->prepareData(true); } public function action($sender, $param) { if(method_exists($this->getParent(), 'executeAction')) { $this->getParent()->executeAction($this->Actions->SelectedValue, $sender, $param); } } } ?>