本文整理汇总了PHP中JControllerForm::add方法的典型用法代码示例。如果您正苦于以下问题:PHP JControllerForm::add方法的具体用法?PHP JControllerForm::add怎么用?PHP JControllerForm::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JControllerForm
的用法示例。
在下文中一共展示了JControllerForm::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
/**
* Method to add a new record.
*
* @return boolean True if the article can be added, false if not.
* @since 1.6
*/
public function add()
{
if (!parent::add()) {
// Redirect to the return page.
$this->setRedirect($this->getReturnPage());
}
}
示例2: add
public function add()
{
$app = JFactory::getApplication();
$context = 'com_jbusinessdirectory.edit.billingdetails';
$result = parent::add();
if ($result) {
$this->setRedirect(JRoute::_('index.php?option=com_jbusinessdirectory&view=billingdetails' . $this->getRedirectToItemAppend(), false));
}
return $result;
}
示例3: add
/**
* Method to add a new record.
*
* @return mixed True if the record can be added, a error object if not.
*
* @since 1.6
*/
public function add()
{
if (!parent::add()) {
// Set the internal error and also the redirect error.
$this->setError(JText::_('COM_SIBDIET_ERROR_YOU_HAVE_ACTIVE_REQUEST'));
$this->setMessage($this->getError(), 'notice');
// Redirect to the return page.
$this->setRedirect($this->getReturnPage());
}
}
示例4: add
public function add()
{
$app = JFactory::getApplication();
// Parent Method
$result = parent::add();
if (JError::isError($result)) {
return $result;
}
// Additional Vars
$app->setUserState(CCK_COM . '.edit.template.mode', $app->input->getString('mode', ''));
}
示例5: add
public function add()
{
$app = JFactory::getApplication();
$context = 'com_jhotelreservation.edit.extraoption';
$result = parent::add();
if ($result) {
$sourceId = JRequest::getInt('sourceId');
$this->setRedirect(JRoute::_('index.php?option=com_jhotelreservation&view=extraoption&sourceId=' . $sourceId . $this->getRedirectToItemAppend(), false));
}
return $result;
}
示例6: add
/**
* Method to add a new menu item.
*
* @return mixed True if the record can be added, a JError object if not.
*
* @since 1.6
*/
public function add()
{
$app = JFactory::getApplication();
$context = 'com_menus.edit.item';
$result = parent::add();
if ($result) {
$app->setUserState($context . '.type', null);
$app->setUserState($context . '.link', null);
$menuType = $app->getUserStateFromRequest($this->context . '.filter.menutype', 'menutype', 'mainmenu', 'cmd');
$this->setRedirect(JRoute::_('index.php?option=com_menus&view=item&menutype=' . $menuType . $this->getRedirectToItemAppend(), false));
}
return $result;
}
示例7: add
public function add()
{
// Initialise variables.
$app = JFactory::getApplication();
$context = 'com_jhotelreservation.edit.room';
$result = parent::add();
if ($result) {
$hotelId = $app->getUserStateFromRequest('filter.hotel_id', 'hotel_id', '1', 'cmd');
//dmp("H: ".$hotelId);
$this->setRedirect(JRoute::_('index.php?option=com_jhotelreservation&view=room&hotel_id=' . $hotelId . $this->getRedirectToItemAppend(), false));
}
return $result;
}
示例8: add
public function add()
{
$db = JFactory::getDbo();
$query = "SELECT id FROM #__categories WHERE `extension`='com_smfaq' AND `published`!='-2'";
$db->setQuery($query);
$categoryCheck = $db->loadResult();
if (!$categoryCheck) {
$this->setError(JText::_('COM_SMFAQ_NO_CATEGORY_ERROR'), 'error');
$this->setMessage($this->getError(), 'error');
$this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list));
return;
}
parent::add();
}
示例9: add
/**
* Override parent add method.
*/
public function add()
{
// Initialise variables.
$app = JFactory::getApplication();
// Get the result of the parent method. If an error, just return it.
$result = parent::add();
if (JError::isError($result)) {
return $result;
}
// Look for the Extension ID.
$extensionId = JRequest::getInt('eid');
if (empty($extensionId)) {
$this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . '&layout=edit', false));
return JError::raiseWarning(500, JText::_('COM_MODULES_ERROR_INVALID_EXTENSION'));
}
$app->setUserState('com_modules.add.module.extension_id', $extensionId);
}
示例10: add
public function add()
{
$app = JFactory::getApplication();
// Parent Method
$result = parent::add();
if (JError::isError($result)) {
return $result;
}
// Additional Vars
$app->setUserState('com_cck.add.box.validation', $app->input->getInt('validation', 0));
$app->setUserState('com_cck.add.box.file', $app->input->getString('file', ''));
$app->setUserState('com_cck.add.box.function', $app->input->getString('function', ''));
$app->setUserState('com_cck.add.box.bx.id', $app->input->get('id', ''));
$app->setUserState('com_cck.add.box.bx.title', $app->input->getString('title', ''));
$app->setUserState('com_cck.add.box.bx.name', $app->input->get('name', ''));
$app->setUserState('com_cck.add.box.bx.type', $app->input->getString('type', ''));
$app->setUserState('com_cck.add.box.bx.params', $app->input->getString('params', ''));
}
示例11: add
/**
* Method to add widget to load form.
*
* @return void
*
* @since 3.0
*/
public function add()
{
$app = JFactory::getApplication();
$result = parent::add();
if ($result instanceof Exception) {
return $result;
}
$type = $app->input->get('wgtype', 0, 'string');
$title = $app->input->get('title', 0, 'string');
if (empty($type)) {
$this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . '&layout=edit', false));
return JError::raiseWarning(500, JText::_('COM_BT_SOCIALCONNECT_ERROR_INVALID_EXTENSION'));
}
$app->setUserState('com_bt_socialconnect.add.widget.wgtype', $type);
$app->setUserState('com_bt_socialconnect.add.widget.title', $title);
$app->setUserState('com_bt_socialconnect.add.widget.params', null);
$params = $app->input->get('params', array(), 'array');
$app->setUserState('com_bt_socialconnect.add.widget.params', $params);
}
示例12: add
/**
* Override parent add method.
*
* @return mixed True if the record can be added, a JError object if not.
*
* @since 1.6
*/
public function add()
{
$app = JFactory::getApplication();
// Get the result of the parent method. If an error, just return it.
$result = parent::add();
if ($result instanceof Exception) {
return $result;
}
// Look for the Extension ID.
$extensionId = $app->input->get('eid', 0, 'int');
if (empty($extensionId)) {
$this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . '&layout=edit', false));
return JError::raiseWarning(500, JText::_('COM_MODULES_ERROR_INVALID_EXTENSION'));
}
$app->setUserState('com_modules.add.module.extension_id', $extensionId);
$app->setUserState('com_modules.add.module.params', null);
// Parameters could be coming in for a new item, so let's set them.
$params = $app->input->get('params', array(), 'array');
$app->setUserState('com_modules.add.module.params', $params);
}
示例13: add
/**
* Override parent add method.
*
* @throws Exception
* @return mixed True if the record can be added, a JError object if not.
*
* @since 1.6
*/
public function add()
{
// Initialise variables.
$app = JFactory::getApplication();
// Get the result of the parent method. If an error, just return it.
$result = parent::add();
if ($result instanceof Exception) {
return $result;
}
// Look for the Extension ID.
$extensionId = $app->input->get('eid', 0, 'int');
if (empty($extensionId)) {
$this->setRedirect(JRoute::_(sprintf('index.php?option=%s&view=modules', RokSprocket_Helper::getRedirectionOption()), false));
throw new Exception(JText::_('COM_MODULES_ERROR_INVALID_EXTENSION', 500));
}
$app->setUserState('com_modules.add.module.extension_id', $extensionId);
$app->setUserState('com_modules.add.module.params', null);
// Parameters could be coming in for a new item, so let's set them.
$params = $app->input->get('params', array(), 'array');
$app->setUserState('com_modules.add.module.params', $params);
}
示例14: execute
public function execute($task = null)
{
$app = JFactory::getApplication();
$modelName = $app->input->get('model', 'Member');
// Required objects
$input = JFactory::getApplication()->input;
// Get the form data
$this->formData = new JRegistry($input->get('jform', '', 'array'));
//Get model class
$this->model = $this->getModel($modelName);
if ($task == 'deleteAvailibility') {
$member_daytime_id = $input->get('member_daytime_id');
$this->deleteAvailibility($member_daytime_id);
} else {
if ($task == 'delete') {
$member_id = $input->get('member_id');
$this->delete($member_id);
} else {
if ($task == 'add') {
parent::add();
} else {
if ($task == 'edit') {
parent::edit();
} else {
if ($task == 'apply') {
if ($this->formData['member_id'] == null) {
$result = EstivoleHelpersUser::registerUser($this->formData['profilestivole.firstname'] . ' ' . $this->formData['profilestivole.lastname'], $this->formData['username'], $this->formData['email'], 'est1val3', null, $this->formData);
} else {
$result = EstivoleHelpersUser::updateUser($this->formData['profilestivole.firstname'] . ' ' . $this->formData['profilestivole.lastname'], $this->formData['username'], $this->formData['email'], $this->formData);
}
if ($result->success) {
$app->enqueueMessage('Profil enregistré avec succès!');
$app->redirect('index.php?option=com_estivole&view=member&layout=edit&task=member.edit&controller=member&member_id=' . $result->member_id);
} else {
$app->enqueueMessage($result->message, 'error');
$app->redirect($_SERVER['HTTP_REFERER']);
}
} else {
if ($task == 'save') {
if ($this->formData['member_id'] == null) {
$result = EstivoleHelpersUser::registerUser($this->formData['profilestivole.firstname'] . ' ' . $this->formData['profilestivole.lastname'], $this->formData['username'], $this->formData['email'], 'est1val3', null, $this->formData);
} else {
$result = EstivoleHelpersUser::updateUser($this->formData['profilestivole.firstname'] . ' ' . $this->formData['profilestivole.lastname'], $this->formData['username'], $this->formData['email'], $this->formData);
}
if ($result->success) {
$app->enqueueMessage('Profil enregistré avec succès!');
$app->redirect('index.php?option=com_estivole&view=members');
} else {
$app->enqueueMessage($result->message, 'error');
$app->redirect($_SERVER['HTTP_REFERER']);
}
} else {
if ($task == 'cancel') {
parent::cancel();
} else {
$this->display();
}
}
}
}
}
}
}
}
示例15: add_test
/**
* Overwrite for method to add a new record for a test-recipient
*
* @since 1.0.1
*/
public function add_test()
{
// set state for test-recipient…
JFactory::getApplication()->setUserState('com_bwpostman.subscriber.new_test', '9');
parent::add();
}