Refactor && Typo && Use plain objects as function parameters instead of ids

This commit is contained in:
Nicolas Le Goff
2014-02-06 12:42:47 +01:00
parent c98fe4c23d
commit 2ec4ffdbcc
39 changed files with 909 additions and 692 deletions

View File

@@ -406,7 +406,7 @@ class collection implements cache_cacheableInterface
$stmt->execute([':base_id' => $this->get_base_id()]);
$stmt->closeCursor();
$this->app['manipulator.registration']->deleteRegistrationsOnCollection($this->get_base_id());
$this->app['manipulator.registration']->deleteRegistrationsOnCollection($this);
$this->get_databox()->delete_data_from_cache(databox::CACHE_COLLECTIONS);
@@ -534,7 +534,7 @@ class collection implements cache_cacheableInterface
$stmt->execute($params);
$stmt->closeCursor();
$this->app['manipulator.registration']->deleteRegistrationsOnCollection($this->get_base_id());
$this->app['manipulator.registration']->deleteRegistrationsOnCollection($this);
phrasea::reset_baseDatas($app['phraseanet.appbox']);
@@ -748,17 +748,19 @@ class collection implements cache_cacheableInterface
*/
public function isRegistrationEnabled()
{
if ($xml = simplexml_load_string($this->get_prefs())) {
$element = $xml->xpath('/baseprefs/caninscript');
if (false === $xml = simplexml_load_string($this->get_prefs())) {
return false;
}
if (count($element) === 0) {
return $this->databox->isRegistrationEnabled();
}
$element = $xml->xpath('/baseprefs/caninscript');
foreach ($element as $caninscript) {
if (false !== (Boolean) (string) $caninscript) {
return true;
}
if (count($element) === 0) {
return $this->databox->isRegistrationEnabled();
}
foreach ($element as $caninscript) {
if (false !== (Boolean) (string) $caninscript) {
return true;
}
}
@@ -774,12 +776,12 @@ class collection implements cache_cacheableInterface
*/
public function getTermsOfUse()
{
if ($xml = simplexml_load_string($this->get_prefs())) {
foreach ($xml->xpath('/baseprefs/cgu') as $sbpcgu) {
return $sbpcgu->saveXML();
}
if (false === $xml = simplexml_load_string($this->get_prefs())) {
return;
}
return null;
foreach ($xml->xpath('/baseprefs/cgu') as $sbpcgu) {
return $sbpcgu->saveXML();
}
}
}