本文整理汇总了PHP中CMediusers::loadListWithPerms方法的典型用法代码示例。如果您正苦于以下问题:PHP CMediusers::loadListWithPerms方法的具体用法?PHP CMediusers::loadListWithPerms怎么用?PHP CMediusers::loadListWithPerms使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMediusers
的用法示例。
在下文中一共展示了CMediusers::loadListWithPerms方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CMediusers
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
*/
CCanDo::checkRead();
$user_connected = CMediusers::get();
$user_id = CValue::get("user_id");
if (!$user_id) {
$user_id = $user_connected->_id;
}
$account_id = CValue::getOrSession("account_id");
//user
$user = new CMediusers();
$user->load($user_id);
//CSourcePOP account
$account = new CSourcePOP();
//getting the list of user with the good rights
$listUsers = $user->loadListWithPerms(PERM_EDIT);
$where = array();
$where["source_pop.is_private"] = "= '0'";
$where["source_pop.object_class"] = "= 'CMediusers'";
$where["users_mediboard.function_id"] = "= '{$user->function_id}'";
$where["users_mediboard.user_id"] = CSQLDataSource::prepareIn(array_keys($listUsers));
$ljoin = array();
$ljoin["users_mediboard"] = "source_pop.object_id = users_mediboard.user_id AND source_pop.object_class = 'CMediusers'";
//all accounts linked to a mediuser
//all accounts from an unique mediuser are grouped, in order to have the mediusers list
/** @var CSourcePOP[] $accounts_available */
$accounts_available = $account->loadList($where, null, null, null, $ljoin);
//getting user list
$users = array();
foreach ($accounts_available as $_account) {
$userPop = $_account->loadRefMetaObject();
示例2: loadPraticiensCompta
/**
* Charge les praticiens à la compta desquels l'utilisateur courant a accès
*
* @param ref $prat_id Si définit, retourne un tableau avec seulement ce praticien
*
* @todo Définir verbalement la stratégie
* @return CMediusers[]
*/
static function loadPraticiensCompta($prat_id = null)
{
// Cas du praticien unique
if ($prat_id) {
$prat = new CMediusers();
$prat->load($prat_id);
$prat->loadRefFunction();
return array($prat->_id => $prat);
}
// Cas standard
$user = CMediusers::get();
$is_admin = in_array(CUser::$types[$user->_user_type], array("Administrator"));
$is_secretaire = in_array(CUser::$types[$user->_user_type], array("Secrétaire"));
$is_directeur = in_array(CUser::$types[$user->_user_type], array("Directeur"));
$function = $user->loadRefFunction();
$praticiens = array();
// Liste des praticiens du cabinet
if ($is_admin || $is_secretaire || $is_directeur || $function->compta_partagee) {
$function_id = null;
if (!CAppUI::conf("cabinet Comptabilite show_compta_tiers") && $user->_user_username != "admin") {
$function_id = $user->function_id;
}
if ($is_admin) {
$praticiens = CConsultation::loadPraticiens(PERM_EDIT, $function_id);
} else {
$praticiens = CConsultation::loadPraticiens(PERM_EDIT, $user->function_id);
// On ajoute les praticiens qui ont délégués leurs compta
$where = array();
$where[] = "users_mediboard.compta_deleguee = '1' || users_mediboard.user_id " . CSQLDataSource::prepareIn(array_keys($praticiens));
// Filters on users values
$where["users_mediboard.actif"] = "= '1'";
$where["functions_mediboard.group_id"] = "= '" . CGroups::loadCurrent()->_id . "'";
$ljoin["users"] = "users.user_id = users_mediboard.user_id";
$ljoin["functions_mediboard"] = "functions_mediboard.function_id = users_mediboard.function_id";
$order = "users.user_last_name, users.user_first_name";
$mediuser = new CMediusers();
/** @var CMediusers[] $mediusers */
$mediusers = $mediuser->loadListWithPerms(PERM_EDIT, $where, $order, null, null, $ljoin);
// Associate already loaded function
foreach ($mediusers as $_mediuser) {
$_mediuser->loadRefFunction();
}
$praticiens = $mediusers;
}
} elseif ($user->isPraticien() && !$user->compta_deleguee) {
return array($user->_id => $user);
}
return $praticiens;
}