Tidied up controller class

This commit is contained in:
Christian Wolf 2019-06-05 16:04:30 +02:00
parent fc85e6b322
commit 60abc189ec

View File

@ -8,36 +8,10 @@ defined('_JEXEC') or die;
class ClubsControllerUser extends AbstractClubsController
{
private function checkUserName($username, $obj = null)
{
$id = -1;
if(!is_null($obj))
$id = $obj->getId();
return ClubsUser::isUserNameFree($username, $id);
}
protected function getSingleBaseName()
{
return 'user';
}
protected function getDataMapping()
{
return array(
'user'=>array('required'=>true, 'name'=>'Benutzername', 'filter'=>'cmd'),
'pwd'=>array('required'=>false, 'name'=>'Passwort', 'filter'=>'string', 'setter'=>'setPassword'),
'pwdConfirm'=>array('required'=>false, 'name'=>'Passwortwiederholung', 'filter'=>'string', 'setter'=>null),
'name'=>array('required'=>true, 'name'=>'Bürgerlicher Name', 'filter'=>'string'),
'address'=>array('required'=>true, 'name'=>'Adresse', 'filter'=>'string'),
'city'=>array('required'=>true, 'name'=>'Stadt', 'filter'=>'string'),
'mail'=>array('required'=>true, 'name'=>'E-Mail', 'filter'=>'string'),
'phone'=>array('required'=>false, 'name'=>'Telefonnummer', 'filter'=>'string'),
'mobile'=>array('required'=>false, 'name'=>'Handynummer', 'filter'=>'string')
);
}
protected function rawDataIsValid($values)
{
@ -79,35 +53,6 @@ class ClubsControllerUser extends AbstractClubsController
return true;
}
/**
* {@inheritDoc}
* @see AbstractClubsController::filterPrePacking()
*/
protected function filterPrePacking(&$values)
{
parent::filterPrePacking($values);
unset($values['pwd']);
unset($values['pwdConfirm']);
}
/**
* {@inheritDoc}
* @see AbstractClubsController::applyData()
*/
public function applyData($obj, $values)
{
// TODO Auto-generated method stub
$mapping = $this->getDataMapping();
if(strlen($values['pwd']) == 0)
{
unset($values['pwd']);
unset($mapping['pwd']);
}
$this->applyDataToObject($obj, $values, $mapping);
}
protected function getFactory()
{
return new CommonClubsModelFactoryUser();