本文整理汇总了PHP中Kernel::isAdminFonctionnel方法的典型用法代码示例。如果您正苦于以下问题:PHP Kernel::isAdminFonctionnel方法的具体用法?PHP Kernel::isAdminFonctionnel怎么用?PHP Kernel::isAdminFonctionnel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kernel
的用法示例。
在下文中一共展示了Kernel::isAdminFonctionnel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: home
public function home()
{
if (!Kernel::isAdmin()) {
return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.noRights'), 'back' => CopixUrl::get()));
}
$tplHome = new CopixTpl();
$tpl = new CopixTpl();
$tpl->assign('TITLE_PAGE', CopixI18N::get('sysutils|admin.moduleDescription'));
$tpl->assign('MENU', Admin::getMenu('sysutils'));
$tplHome->assign('superadmin', Kernel::isSuperAdmin());
$tplHome->assign('adminfonctionnel', Kernel::isAdminFonctionnel());
$tpl->assign('MAIN', $tplHome->fetch('sysutils|home.tpl'));
return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl);
}
示例2: processDefault
/**
* Admins
*
* Affiche la liste des administrateurs
*
* @package Comptes
* @author Frédéric Mossmann <fmossmann@cap-tic.fr>
*/
public function processDefault()
{
if (!Kernel::isAdmin()) {
return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('||'));
}
$roles = _request('role');
$new_admin = _request('new_admins');
if ($roles) {
$sql = "\n SELECT dbuser.*, kernel_link_bu2user.*\n FROM dbuser\n JOIN kernel_link_bu2user ON dbuser.id_dbuser=kernel_link_bu2user.user_id\n WHERE dbuser.id_dbuser IN (" . implode(',', array_keys($roles)) . ")\n ";
$admins_mod = _doQuery($sql);
foreach ($admins_mod as $admins_mod_item) {
$sql = "\n DELETE FROM kernel_link_user2node\n WHERE node_type='ROOT' AND node_id=0\n AND user_type=:bu_type AND user_id=:bu_id\n ";
_doQuery($sql, array(':bu_type' => $admins_mod_item->bu_type, ':bu_id' => $admins_mod_item->bu_id));
$sql = "\n DELETE FROM dbgroup_users\n WHERE id_dbgroup=:id_dbgroup AND userhandler_dbgroup=:userhandler_dbgroup AND user_dbgroup=:user_dbgroup";
$params = array(':id_dbgroup' => 1, ':userhandler_dbgroup' => 'auth|dbuserhandler', ':user_dbgroup' => $admins_mod_item->id_dbuser);
_doQuery($sql, $params);
if ($roles[$admins_mod_item->id_dbuser]) {
$sql = "\n INSERT INTO kernel_link_user2node\n ( user_type, user_id, node_type, node_id, droit)\n VALUES\n (:user_type, :user_id, :node_type, :node_id, :droit)\n ";
$params = array(':user_type' => $admins_mod_item->bu_type, ':user_id' => $admins_mod_item->bu_id, ':node_type' => 'ROOT', ':node_id' => 0, ':droit' => $roles[$admins_mod_item->id_dbuser]);
_doQuery($sql, $params);
$sql = "\n INSERT INTO dbgroup_users\n ( id_dbgroup, userhandler_dbgroup, user_dbgroup)\n VALUES\n (:id_dbgroup, :userhandler_dbgroup, :user_dbgroup)\n ";
$params = array(':id_dbgroup' => 1, ':userhandler_dbgroup' => 'auth|dbuserhandler', ':user_dbgroup' => $admins_mod_item->id_dbuser);
_doQuery($sql, $params);
}
}
}
if ($new_admin) {
$new_admin_array = split(',', $new_admin);
$new_admin_array_clean = array_map('trim', $new_admin_array);
$sql_newadmins = "OR dbuser.login_dbuser IN (";
$first = true;
foreach ($new_admin_array_clean as $new_admin_array_item) {
$sql_newadmins .= (!$first ? ", " : "") . "'" . addslashes($new_admin_array_item) . "'";
$first = false;
}
$sql_newadmins .= ")";
} else {
$sql_newadmins = '';
}
$sql = "\n SELECT dbuser.*, kernel_link_bu2user.*, kernel_link_user2node.*\n FROM dbuser\n JOIN kernel_link_bu2user ON dbuser.id_dbuser=kernel_link_bu2user.user_id\n LEFT JOIN kernel_link_user2node ON kernel_link_bu2user.bu_type=kernel_link_user2node.user_type AND kernel_link_bu2user.bu_id=kernel_link_user2node.user_id AND kernel_link_user2node.node_type='ROOT' AND kernel_link_user2node.node_id=0\n WHERE (node_type='ROOT' AND node_id=0)\n " . $sql_newadmins . "\n ORDER BY kernel_link_user2node.droit DESC,dbuser.login_dbuser\n ";
$admins = _doQuery($sql);
foreach ($admins as &$admin) {
$admin->user_infos = Kernel::getUserInfo($admin->bu_type, $admin->bu_id);
}
/*
dbuser : id_dbuser login_dbuser password_dbuser email_dbuser enabled_dbuser
kernel_link_bu2user : user_id bu_type bu_id
kernel_link_user2node : user_type user_id node_type node_id droit debut fin
*/
$tpl = new CopixTpl();
$tplListe = new CopixTpl();
$tplListe->assign("admins", $admins);
$tplListe->assign("user_id", _currentUser()->getExtra('user_id'));
$tplListe->assign("admin_fonctionnel", Kernel::isAdminFonctionnel());
$main = $tplListe->fetch("admins-list.tpl");
$tpl->assign('TITLE_PAGE', CopixI18N::get('comptes.moduleDescription') . " » " . CopixI18N::get('comptes.title.admins'));
$tpl->assign('MAIN', $main);
$tpl->assign('MENU', $this->menu);
return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl);
}