Commit 593b01ee authored by Côme Chilliet's avatar Côme Chilliet
Browse files

Get rid of a few things useless thanks to PHP >= 5.3 late static binding

parent dc295480
......@@ -47,7 +47,7 @@ class country extends department
static function getAttributesInfo ()
{
$attributesInfo = parent::getDepartmentAttributesInfo(_('country'), static::$namingAttr);
$attributesInfo = parent::getDepartmentAttributesInfo(_('country'));
unset($attributesInfo['location']);
unset($attributesInfo['properties']['attrs'][3]); // category
/* Country c attribut cannot contain any underscore */
......
......@@ -48,7 +48,7 @@ class dcObject extends department
static function getAttributesInfo ()
{
$attributesInfo = parent::getDepartmentAttributesInfo(_('domain component'), static::$namingAttr);
$attributesInfo = parent::getDepartmentAttributesInfo(_('domain component'));
unset($attributesInfo['location']);
unset($attributesInfo['properties']['attrs'][3]); // category
return $attributesInfo;
......
......@@ -54,9 +54,9 @@ class department extends simplePlugin
static function getAttributesInfo()
{
return static::getDepartmentAttributesInfo(_('department'), static::$namingAttr);
return static::getDepartmentAttributesInfo(_('department'));
}
static function getDepartmentAttributesInfo($name, $namingAttr)
static function getDepartmentAttributesInfo($name)
{
$attributesInfo = array(
'properties' => array(
......@@ -65,7 +65,7 @@ class department extends simplePlugin
new BaseSelectorAttribute(''),
new StringAttribute(
sprintf(_('Name of %s'), $name), sprintf(_('A name for this %s'), $name),
$namingAttr, TRUE,
static::$namingAttr, TRUE,
'', '', '/^[a-z0-9\._-]+$/i'
),
new TextAreaAttribute(
......@@ -113,7 +113,7 @@ class department extends simplePlugin
)
),
);
if ($namingAttr != 'ou') {
if (static::$namingAttr != 'ou') {
$attributesInfo['properties']['attrs'][] = new HiddenAttribute('ou');
}
return $attributesInfo;
......@@ -155,13 +155,7 @@ class department extends simplePlugin
$this->attributesAccess['businessCategory']->setChoices($categoriesList);
}
$this->attributesAccess[$this->getNamingAttr()]->setUnique(TRUE);
}
function getNamingAttr()
{
$class = get_class($this);
return $class::$namingAttr;
$this->attributesAccess[static::$namingAttr]->setUnique(TRUE);
}
/* Check values */
......@@ -170,7 +164,7 @@ class department extends simplePlugin
/* Call common method to give check the hook */
$message = parent::check();
$namingAttr = $this->getNamingAttr();
$namingAttr = static::$namingAttr;
if (tests::is_department_name_reserved($this->$namingAttr, $this->base)) {
$message[] = msgPool::reserved(_("Name"));
......@@ -195,8 +189,8 @@ class department extends simplePlugin
function prepare_save()
{
if ($this->getNamingAttr() != 'ou') {
$this->attributesAccess['ou']->setValue($this->attributesAccess[$this->getNamingAttr()]->getValue());
if (static::$namingAttr != 'ou') {
$this->attributesAccess['ou']->setValue($this->attributesAccess[static::$namingAttr]->getValue());
}
return parent::prepare_save();
}
......
......@@ -48,7 +48,7 @@ class domain extends department
static function getAttributesInfo ()
{
$attributesInfo = parent::getDepartmentAttributesInfo(_('domain'), static::$namingAttr);
$attributesInfo = parent::getDepartmentAttributesInfo(_('domain'));
unset($attributesInfo['location']);
unset($attributesInfo['properties']['attrs'][3]); // category
return $attributesInfo;
......
......@@ -48,7 +48,7 @@ class locality extends department
static function getAttributesInfo ()
{
$attributesInfo = parent::getDepartmentAttributesInfo(_('locality'), static::$namingAttr);
$attributesInfo = parent::getDepartmentAttributesInfo(_('locality'));
unset($attributesInfo['location']);
unset($attributesInfo['properties']['attrs'][3]); // category
return $attributesInfo;
......
......@@ -48,7 +48,7 @@ class organization extends department
static function getAttributesInfo ()
{
return parent::getDepartmentAttributesInfo(_('organization'), static::$namingAttr);
return parent::getDepartmentAttributesInfo(_('organization'));
}
}
?>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment