/** * Update #__hotel_data tables with Lite data */ public function build() { $build = CHPanelHelperData::buildDataObject(); if (!$build) { JFactory::getApplication()->enqueueMessage(JText::_('COM_CHPANEL_BUILD_ERROR'), 'warning'); } else { JFactory::getApplication()->enqueueMessage(JText::_('COM_CHPANEL_BUILD_OK')); } $this->setRedirect('index.php?option=com_chpanel&view=panel'); }
/** * Save task */ function save($key = null, $urlVar = null) { $app = JFactory::getApplication(); $model = $this->getModel(); $apply = 'index.php?option=com_chpanel&view=translation&id=' . JRequest::getInt('id') . '&lang=' . JRequest::getCmd('lang'); $save = $model->save(); if (!$save) { $errors = $model->getErrors(); foreach ($errors as $error) { $app->enqueueMessage($error, 'warning'); } $this->setRedirect($apply); return false; } // rebuild data object CHPanelHelperData::buildDataObject(); JFactory::getApplication()->setUserState('com_chpanel.translation.data', null); if (JRequest::getWord('task') == 'save') { $this->setRedirect('index.php?option=com_chpanel&view=hotels', JText::_('JLIB_APPLICATION_SAVE_SUCCESS')); } else { $this->setRedirect($apply, JText::_('JLIB_APPLICATION_SAVE_SUCCESS')); } }
/** * Rebuild data on publish */ public function publish() { parent::publish(); CHPanelHelperData::buildDataObject(); }
/** * Rebuild data on save */ protected function postSaveHook() { CHPanelHelperData::buildDataObject(); }