/** * Getting The end javascript * * @return string */ protected function _getEndJs() { $js = parent::_getEndJs(); $js .= "pageJs"; $js .= ".setCallbackId('getData', '" . $this->_getDataBtn->getUniqueID() . "')"; $js .= ".setHTMLID('resultDivId', 'statics-div');"; return $js; }
/** * Getting The end javascript * * @return string */ protected function _getEndJs() { $js = parent::_getEndJs(); $class = trim($this->_focusEntity); if ($class === '' || !isset($this->Request['id'])) { die('System Error: no id or class passed in'); } if (trim($this->Request['id']) === 'new') { $entity = new $class(); } else { if (!($entity = $class::get($this->Request['id'])) instanceof $class) { die('invalid item!'); } } $js .= "pageJs.setHTMLID('itemDiv', 'item-div')"; $js .= ".setItem(" . (trim($entity->getId()) === '' ? '{}' : json_encode($entity->getJson())) . ")"; $js .= ".setCallbackId('saveItem', '" . $this->_saveItemBtn->getUniqueID() . "');"; return $js; }
/** * Getting The end javascript * * @return string */ protected function _getEndJs() { $js = parent::_getEndJs(); $js .= "pageJs.setCallbackId('getItems', '" . $this->_getItemsBtn->getUniqueID() . "')"; $js .= ".setCallbackId('deleteItems', '" . $this->_delItemsBtn->getUniqueID() . "')"; $js .= ".setCallbackId('saveItem', '" . $this->_saveItemsBtn->getUniqueID() . "')"; $js .= ".setHTMLIds('item-list', 'searchPanel', 'total-found-count');"; $js .= "if(pageJs.init) {pageJs.init();}"; $js .= "pageJs.getSearchCriteria();"; //$js .= ".getResults(true, " . $this->pageSize . ")"; return $js; }
public function onLoad($param) { $cssFile = $this->publishAsset(self::CSS_FILE); $jsFile = $this->publishAsset(self::JS_FILE); $closeImg = $this->publishAsset(self::CLOSE_IMG); $csm = $this->getPage()->getClientScript(); $this->startTime = new TTextBox(); $this->startTime->setID('startTime'); $this->addedControl($this->startTime); $this->endTime = new TTextBox(); $this->endTime->setID('endTime'); $this->addedControl($this->endTime); $plannerType = ""; if ($this->getPlannerType() == 'Access') { $this->pinCode = new TCheckBox(); $this->pinCode->setID('pinCode'); $this->addedControl($this->pinCode); $this->exitingOnly = new TCheckBox(); $this->exitingOnly->setID('exitingOnly'); $this->addedControl($this->exitingOnly); $plannerType .= 'pinCode : $(\'' . $this->pinCode->getClientID() . '\'),'; $plannerType .= 'exitingOnly : $(\'' . $this->exitingOnly->getClientID() . '\'),'; } else { $this->unlocking = new TCheckBox(); $this->unlocking->setID('unlocking'); $this->addedControl($this->unlocking); $this->supOpenTooLongAlarm = new TCheckBox(); $this->supOpenTooLongAlarm->setID('supOpenTooLongAlarm'); $this->addedControl($this->supOpenTooLongAlarm); $this->supWithoutPermAlarm = new TCheckBox(); $this->supWithoutPermAlarm->setID('supWithoutPermAlarm'); $this->addedControl($this->supWithoutPermAlarm); $this->checkOnlyCompanyID = new TCheckBox(); $this->checkOnlyCompanyID->setID('checkOnlyCompanyID'); $this->addedControl($this->checkOnlyCompanyID); $plannerType .= 'unlocking : $(\'' . $this->unlocking->getClientID() . '\'),'; $plannerType .= 'supOpenTooLongAlarm : $(\'' . $this->supOpenTooLongAlarm->getClientID() . '\'),'; $plannerType .= 'supWithoutPermAlarm : $(\'' . $this->supWithoutPermAlarm->getClientID() . '\'),'; $plannerType .= 'checkOnlyCompanyID : $(\'' . $this->checkOnlyCompanyID->getClientID() . '\'),'; } $this->specialRelayPlan = new TCheckBox(); $this->specialRelayPlan->setID('specialRelayPlan'); $this->addedControl($this->specialRelayPlan); $plannerType .= 'specialRelayPlan : $(\'' . $this->specialRelayPlan->getClientID() . '\'),'; $script = 'var wp = new XWeekPlanner("' . $this->getClientID() . '", {startDate : "' . $this->getStartDate() . '", allowItemEdit : "' . $this->getAllowInlineEdit() . '", allowItemDelete : 1, allowItemSelect : 1, allowItemMove : 1, allowItemResize : 1, deleteConfirmMessage: \'' . Prado::localize('Are you sure you want to delete this item?') . '\', headerDateFormat : \'d.m\', startHour : 0, endHour : 23, onitemclick : \'\', readOnly : 0, startTime : $(\'' . $this->startTime->getClientID() . '\'), endTime :$(\'' . $this->endTime->getClientID() . '\'), ' . $plannerType . ' levelId : 0 });'; if (!$this->getPage()->getIsCallback()) { if (!$csm->isEndScriptRegistered('xweekplanner/config')) { $csm->registerEndScript('xweekplanner/config', $script); } } $csm->registerPradoScript('ajax'); if (!$csm->isStyleSheetFileRegistered('xweekplanner')) { $csm->registerStyleSheetFile('xweekplanner', $cssFile); } if (!$csm->isScriptFileRegistered('xweekplanner')) { $csm->registerScriptFile('xweekplanner', $jsFile); } $t1 = new TCallback(); $t1->setID('callbackweekSchedulerLoadAppointments'); $t1->attachEventHandler("OnCallBack", array($this, "OnLoadAppointments")); $this->Page->getControls()->add($t1); $t1 = new TCallback(); $t1->setID('callbackweekSchedulerSaveAppointment'); $t1->attachEventHandler("OnCallBack", array($this, "OnSaveAppointment")); $this->Page->getControls()->add($t1); $t1 = new TCallback(); $t1->setID('callbackweekSchedulerDeleteAppointment'); $t1->attachEventHandler("OnCallBack", array($this, "OnDeleteAppointment")); $this->Page->getControls()->add($t1); $t1 = new TCallback(); $t1->setID('callbackweekSchedulerSelectAppointment'); $t1->attachEventHandler("OnCallBack", array($this, "OnSelectAppointment")); $this->Page->getControls()->add($t1); }
/** * Registers the javascript code for initializing the active control. * @param THtmlWriter the renderer. */ public function render($writer) { parent::render($writer); $this->getActiveControl()->registerCallbackClientScript($this->getClientClassName(), $this->getTriggerOptions()); if ($this->getStartTimerOnLoad()) { $id = $this->getClientID(); $code = "Prado.WebUI.TTimeTriggeredCallback.start('{$id}');"; $cs = $this->getPage()->getClientScript(); $cs->registerEndScript("{$id}:start", $code); } }