| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- namespace ThurData\Servers\KerioEmail\Core\UI\Widget\Buttons;
- use \ThurData\Servers\KerioEmail\Core\UI\Builder\BaseContainer;
- use \ThurData\Servers\KerioEmail\Core\UI\Interfaces\AjaxElementInterface;
- use \ThurData\Servers\KerioEmail\Core\UI\Widget\Modals\ExampleModal;
- use \ThurData\Servers\KerioEmail\Core\UI\ResponseTemplates;
- /**
- * base button controller
- *
- * @autor ThurData <info@thurdata.ch>
- */
- class ButtonModal extends BaseContainer implements AjaxElementInterface
- {
- protected $id = 'ButtonModal';
- protected $class = ['lu-btn lu-btn--sm lu-btn--link lu-btn--icon lu-btn--plain lu-btn--default'];
- protected $icon = 'lu-zmdi lu-zmdi-plus';
- protected $title = 'ButtonModal';
- protected $htmlAttributes = [
- 'href' => 'javascript:;',
- 'data-toggle' => 'lu-tooltip',
- ];
- protected $modal = null;
- public function returnAjaxData()
- {
- $returnHtml = $this->modal->getHtml();
- $returnTemplate = $this->mainContainer->getVueComponents();
- return (new ResponseTemplates\RawDataJsonResponse(['htmlData' => $returnHtml, 'template' => $returnTemplate,
- 'registrations' => self::getVueComponentsRegistrations()]))->setCallBackFunction($this->callBackFunction)->setRefreshTargetIds($this->refreshActionIds);
- }
- public function initContent()
- {
- $this->initLoadModalAction(new ExampleModal());
- }
- public function setModal($modal)
- {
- $modal->setMainContainer($this->mainContainer);
- $this->modal = $modal;
- if ($modal instanceof \ThurData\Servers\KerioEmail\Core\UI\Interfaces\AjaxElementInterface)
- {
- $this->mainContainer->addAjaxElement($this->modal->runInitContentProcess());
- }
- }
- protected function initLoadModalAction($modal)
- {
- $this->htmlAttributes['@click'] = 'loadModal($event, \'' . $this->id . '\', \'' . $this->getNamespace() . '\', \'' . $this->getIndex() . '\', null, true)';
- $this->setModal($modal);
- }
- }
|