Refactor Appbox

This commit is contained in:
Romain Neutron
2012-02-21 16:16:25 +01:00
parent dbd0b0c437
commit ec4ec4931d
6 changed files with 17 additions and 17 deletions

View File

@@ -32,7 +32,7 @@ class Prod extends Helper
);
$bases = $fields = $dates = array();
$appbox = \appbox::get_instance();
$appbox = \appbox::get_instance($this->core);
$session = $appbox->get_session();
$user = $this->getCore()->getAuthenticatedUser();

View File

@@ -481,7 +481,7 @@ class Edit extends RecordHelper
*/
public function execute(Request $request)
{
$appbox = \appbox::get_instance();
$appbox = \appbox::get_instance($this->core);
if ($request->get('act_option') == 'SAVEGRP' && $request->get('newrepresent'))
{
try

View File

@@ -107,7 +107,7 @@ class Helper extends \Alchemy\Phrasea\Helper\Helper
$this->selection = new \set_selection();
$appbox = \appbox::get_instance();
$appbox = \appbox::get_instance($core);
$usr_id = $appbox->get_session()->get_usr_id();
if (trim($Request->get('ssel')) !== '')

View File

@@ -98,7 +98,7 @@ class MoveCollection extends RecordHelper
*/
public function execute(Request $request)
{
$appbox = \appbox::get_instance();
$appbox = \appbox::get_instance($this->core);
$user = $this->getCore()->getAuthenticatedUser();
$baseId = $request->get('base_id');

View File

@@ -63,7 +63,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper
public function delete_users()
{
$appbox = \appbox::get_instance();
$appbox = \appbox::get_instance($this->core);
foreach ($this->users as $usr_id)
{
$user = \User_Adapter::getInstance($usr_id, $appbox);
@@ -92,7 +92,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper
public function get_users_rights()
{
$user = $this->getCore()->getAuthenticatedUser();
$appbox = \appbox::get_instance();
$appbox = \appbox::get_instance($this->core);
$list = array_keys($user->ACL()->get_granted_base(array('canadmin')));
@@ -393,7 +393,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper
public function apply_rights()
{
$appbox = \appbox::get_instance();
$appbox = \appbox::get_instance($this->core);
$session = $appbox->get_session();
$request = \http_request::getInstance();
$ACL = \User_Adapter::getInstance($session->get_usr_id(), $appbox)->ACL();
@@ -543,14 +543,14 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper
$users = $this->users;
$user = \User_adapter::getInstance(array_pop($users), \appbox::get_instance());
$user = \User_adapter::getInstance(array_pop($users), \appbox::get_instance($this->core));
if ($user->is_template() || $user->is_special())
{
return $this;
}
$appbox = \appbox::get_instance();
$appbox = \appbox::get_instance($this->core);
$session = $appbox->get_session();
$request = \http_request::getInstance();
@@ -592,7 +592,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper
public function apply_template()
{
$appbox = \appbox::get_instance();
$appbox = \appbox::get_instance($this->core);
$session = $appbox->get_session();
$template = \User_adapter::getInstance($this->request->get('template'), $appbox);
@@ -627,7 +627,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper
foreach ($this->users as $usr_id)
{
$user = \User_Adapter::getInstance($usr_id, \appbox::get_instance());
$user = \User_Adapter::getInstance($usr_id, \appbox::get_instance($this->core));
if ($this->request->get('quota'))
$user->ACL()->set_quotas_on_base($this->base_id, $this->request->get('droits'), $this->request->get('restes'));
else
@@ -650,7 +650,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper
{
foreach ($this->users as $usr_id)
{
$user = \User_Adapter::getInstance($usr_id, \appbox::get_instance());
$user = \User_Adapter::getInstance($usr_id, \appbox::get_instance($this->core));
$user->ACL()->set_masks_on_base($this->base_id, $vand_and, $vand_or, $vxor_and, $vxor_or);
}
@@ -670,7 +670,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper
foreach ($this->users as $usr_id)
{
$user = \User_Adapter::getInstance($usr_id, \appbox::get_instance());
$user = \User_Adapter::getInstance($usr_id, \appbox::get_instance($this->core));
$user->ACL()->set_limits($this->base_id, $activate, $dmin, $dmax);
}

View File

@@ -42,7 +42,7 @@ class Manage extends \Alchemy\Phrasea\Helper\Helper
public function export()
{
$request = $this->request;
$appbox = \appbox::get_instance();
$appbox = \appbox::get_instance($this->core);
$session = $appbox->get_session();
$offset_start = (int) $request->get('offset_start');
@@ -80,7 +80,7 @@ class Manage extends \Alchemy\Phrasea\Helper\Helper
public function search()
{
$request = $this->request;
$appbox = \appbox::get_instance();
$appbox = \appbox::get_instance($this->core);
$offset_start = (int) $this->request->get('offset_start');
$offset_start = $offset_start < 0 ? 0 : $offset_start;
@@ -165,7 +165,7 @@ class Manage extends \Alchemy\Phrasea\Helper\Helper
throw new \Exception_InvalidArgument(_('Invalid mail address'));
}
$appbox = \appbox::get_instance();
$appbox = \appbox::get_instance($this->core);
$conn = $appbox->get_connection();
$sql = 'SELECT usr_id FROM usr WHERE usr_mail = :email';
@@ -197,7 +197,7 @@ class Manage extends \Alchemy\Phrasea\Helper\Helper
throw new \Exception_InvalidArgument(_('Invalid template name'));
}
$appbox = \appbox::get_instance();
$appbox = \appbox::get_instance($this->core);
$user = $this->getCore()->getAuthenticatedUser();
$created_user = \User_Adapter::create($appbox, $name, \random::generatePassword(16), null, false, false);