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(); } } } } } } } }