[*] BO #PSFV-94 : Added AdminEmployeesController

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9536 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
lLefevre
2011-10-21 09:50:22 +00:00
parent 5d12e7f2ec
commit f0029f6465
5 changed files with 720 additions and 273 deletions
+28
View File
@@ -1790,6 +1790,34 @@ class AdminControllerCore extends Controller
}
}
/**
* Returns an array with selected shops and type (group or boutique shop)
*
* @param string $table
* @param int $id_object
*/
protected static function getAssoShop($table, $id_object = false)
{
$shopAsso = Shop::getAssoTables();
$groupShopAsso = GroupShop::getAssoTables();
if (isset($shopAsso[$table]) && $shopAsso[$table]['type'] == 'shop')
$type = 'shop';
else if (isset($groupShopAsso[$table]) && $groupShopAsso[$table]['type'] == 'group_shop')
$type = 'group_shop';
else
return;
$assos = array();
foreach ($_POST as $k => $row)
{
if (!preg_match('/^checkBox'.Tools::toCamelCase($type, true).'Asso_'.$table.'_([0-9]+)?_([0-9]+)$/Ui', $k, $res))
continue;
$id_asso_object = (!empty($res[1]) ? $res[1] : $id_object);
$assos[] = array('id_object' => (int)$id_asso_object, 'id_'.$type => (int)$res[2]);
}
return array($assos, $type);
}
/**
* Update the associations of shops
*