本文整理汇总了PHP中Admin::canAdmin方法的典型用法代码示例。如果您正苦于以下问题:PHP Admin::canAdmin方法的具体用法?PHP Admin::canAdmin怎么用?PHP Admin::canAdmin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Admin
的用法示例。
在下文中一共展示了Admin::canAdmin方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeAction
public function beforeAction()
{
_currentUser()->assertCredential('group:[current_user]');
if (!Admin::canAdmin()) {
return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.noRights'), 'back' => CopixUrl::get()));
}
}
示例2: processDefault
public function processDefault()
{
_classInclude('sysutils|admin');
if (!Admin::canAdmin()) {
return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.noRights'), 'back' => CopixUrl::get()));
}
echo "Récupération des classeurs de classe sans casier\n";
echo "----------------------------------------------------------------------\n\n";
// Récupération des classeurs de classe sans casier
$sql = 'SELECT DISTINCT module_classeur.id' . ' FROM kernel_mod_enabled, module_classeur' . ' LEFT JOIN module_classeur_dossier ON (module_classeur_dossier.module_classeur_id = module_classeur.id)' . ' WHERE module_classeur.id = kernel_mod_enabled.module_id' . ' AND kernel_mod_enabled.module_type = "MOD_CLASSEUR"' . ' AND kernel_mod_enabled.node_type = "BU_CLASSE"' . ' AND (module_classeur_dossier.id IS NULL' . ' OR module_classeur_dossier.id NOT IN (SELECT id FROM module_classeur_dossier WHERE casier = 1 AND module_classeur_id = module_classeur.id))';
$results = _doQuery($sql);
$dossierDAO = _ioDAO('classeur|classeurdossier');
_classInclude('classeur|classeurService');
echo count($results) . " casiers à créer.\n";
foreach ($results as $result) {
$casier = _record('classeur|classeurdossier');
$casier->classeur_id = $result->id;
$casier->parent_id = 0;
$casier->nom = CopixI18N::get('classeur|classeur.casierNom');
$casier->nb_dossiers = 0;
$casier->nb_fichiers = 0;
$casier->taille = 0;
$casier->cle = classeurService::createKey();
$casier->casier = 1;
$casier->date_creation = date('Y-m-d H:i:s');
$dossierDAO->insert($casier);
echo "Casier du classeur {$result->id} créé avec succès !\n";
}
echo "\n\nFin de la tâche";
return _arNone();
}
示例3: home
/**
* Accueil des stats
*
* @author Christophe Beyer <cbeyer@cap-tic.fr>
* @since 2007/03/19
*/
public function home()
{
if (!Admin::canAdmin()) {
return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.noRights'), 'back' => CopixUrl::get()));
}
$tpl = new CopixTpl();
$tpl->assign('TITLE_PAGE', CopixI18N::get('sysutils|admin.menu.stats'));
$tpl->assign('MENU', Admin::getMenu('stats'));
$tplStats = new CopixTpl();
$modules = Kernel::getAllModules();
$tab = array();
foreach ($modules as $mod_val) {
$arModulesPath = CopixConfig::instance()->arModulesPath;
foreach ($arModulesPath as $modulePath) {
$class_file = $modulePath . $mod_val . '/' . COPIX_CLASSES_DIR . 'kernel' . $mod_val . '.class.php';
if (!file_exists($class_file)) {
continue;
}
$module_class =& CopixClassesFactory::Create($mod_val . '|Kernel' . $mod_val);
//print_r($module_class);
if (!is_callable(array($module_class, 'getStatsRoot'))) {
continue;
}
//$classeModule = CopixClassesFactory::create("$label|Kernel$label");
$tab[$mod_val]['module_nom'] = Kernel::Code2Name('mod_' . $mod_val);
$tab[$mod_val]['stats'] = $module_class->getStatsRoot();
}
}
//print_r($tab);
$tplStats->assign('tab', $tab);
$tpl->assign('MAIN', $tplStats->fetch('sysutils|stats.modules.tpl'));
return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl);
}
示例4: clear
/**
* Efface le cache de Copix (dossiers et BDD)
*
* @author Christophe Beyer <cbeyer@cap-tic.fr>
* @since 2006/12/05
*/
public function clear()
{
if (!Admin::canAdmin()) {
return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.noRights'), 'back' => CopixUrl::get()));
}
CacheServices::clearCache();
CacheServices::clearConfDB();
return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('sysutils||'));
}
示例5: view
/**
* Affiche la matrice des droits de visibilité entre utilisateurs
*
* @author Frédéric Mossmann <fmossmann@cap-tic.fr>
* @since 2006/12/07
*/
public function view()
{
CopixHTMLHeader::addCSSLink(_resource("styles/module_sysutils.css"));
if (!Admin::canAdmin()) {
return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.noRights'), 'back' => CopixUrl::get()));
}
$user_types = array('USER_VIL', 'USER_ENS', 'USER_ADM', 'USER_RES', 'USER_ELE', 'USER_EXT');
$visibility_matrice = array();
foreach ($user_types as $src) {
foreach ($user_types as $dst) {
$visibility_matrice[$src][$dst] = Kernel::getUserTypeVisibility($dst, $src);
}
}
$tplUserVisibility = new CopixTpl();
$tpl = new CopixTpl();
$tpl->assign('TITLE_PAGE', CopixI18N::get('sysutils|admin.moduleDescription'));
$tplUserVisibility->assign('visibility', $visibility_matrice);
$tplUserVisibility->assign('user_types', $user_types);
$tpl->assign('MAIN', $tplUserVisibility->fetch('sysutils|uservisibility.tpl'));
return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl);
}
示例6: processDoCreateAccounts
public function processDoCreateAccounts()
{
$comptes_service =& CopixClassesFactory::Create('comptes|ComptesService');
if (!Admin::canAdmin()) {
return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.noRights'), 'back' => CopixUrl::get()));
}
$limit = $this->getRequest('limit', 5);
$password = $this->getRequest('password', '123456');
$ppo = new CopixPPO();
// dbuser : id_dbuser login_dbuser password_dbuser email_dbuser enabled_dbuser
// kernel_link_bu2user : user_id bu_type bu_id
$sql_params = array();
$sql = '
SELECT
E.idEleve, E.nom, E.prenom1 AS prenom,
KLB2U.*
FROM
kernel_bu_eleve E
LEFT JOIN
kernel_link_bu2user KLB2U ON E.idEleve=KLB2U.bu_id AND KLB2U.bu_type="USER_ELE"
WHERE bu_type IS NULL';
$ppo->user_ele = CopixDB::getConnection()->doQuery($sql, $sql_params);
$sql = '
SELECT
P.numero, P.nom, P.prenom1 AS prenom, P.civilite, P.id_sexe,
PE.role,
KLB2U.*
FROM
kernel_bu_personnel_entite PE, kernel_bu_personnel P
LEFT JOIN
kernel_link_bu2user KLB2U ON P.numero=KLB2U.bu_id AND KLB2U.bu_type="USER_ENS"
WHERE PE.type_ref="ECOLE" AND (PE.role=1 OR PE.role=2) AND PE.id_per=P.numero
AND bu_type IS NULL';
$ppo->user_ens = CopixDB::getConnection()->doQuery($sql, $sql_params);
$sql = '
SELECT
P.numero, P.nom, P.prenom1 AS prenom, P.civilite, P.id_sexe,
PE.role,
KLB2U.*
FROM
kernel_bu_personnel_entite PE, kernel_bu_personnel P
LEFT JOIN
kernel_link_bu2user KLB2U ON P.numero=KLB2U.bu_id AND KLB2U.bu_type="USER_VIL"
WHERE PE.type_ref="VILLE" AND PE.role=4 AND PE.id_per=P.numero
AND bu_type IS NULL';
$ppo->user_vil = CopixDB::getConnection()->doQuery($sql, $sql_params);
$sql = '
SELECT
R.numero, R.nom, R.prenom1 AS prenom, R.civilite, R.id_sexe,
KLB2U.*
FROM
kernel_bu_responsable R
LEFT JOIN
kernel_link_bu2user KLB2U ON R.numero=KLB2U.bu_id AND KLB2U.bu_type="USER_RES"
WHERE bu_type IS NULL';
$ppo->user_res = CopixDB::getConnection()->doQuery($sql, $sql_params);
$fusible = $limit;
echo "<pre>";
foreach ($ppo->user_ele as $eleve) {
if ($fusible-- <= 0) {
break;
}
$user_infos = Kernel::getUserInfo('USER_ELE', $eleve->idEleve);
$login = $comptes_service->createLogin($user_infos);
$user_new = CopixDAOFactory::createRecord("kernel|kernel_copixuser");
$user_new->login_dbuser = $login;
$user_new->password_dbuser = md5($password);
$user_new->email_dbuser = '';
$user_new->enabled_dbuser = 1;
_dao("kernel|kernel_copixuser")->insert($user_new);
$bu_new = _record("kernel|kernel_bu2user2");
$bu_new->user_id = $user_new->id_dbuser;
$bu_new->bu_type = 'USER_ELE';
$bu_new->bu_id = $eleve->idEleve;
_dao("kernel|kernel_bu2user2")->insert($bu_new);
echo $eleve->nom . ";" . $eleve->prenom . ";" . $login . ";" . $password . "\n";
}
foreach ($ppo->user_ens as $ens) {
if ($fusible-- <= 0) {
break;
}
$user_infos = Kernel::getUserInfo('USER_ENS', $ens->numero);
$login = $comptes_service->createLogin($user_infos);
$user_new = CopixDAOFactory::createRecord("kernel|kernel_copixuser");
$user_new->login_dbuser = $login;
$user_new->password_dbuser = md5($password);
$user_new->email_dbuser = '';
$user_new->enabled_dbuser = 1;
_dao("kernel|kernel_copixuser")->insert($user_new);
$bu_new = _record("kernel|kernel_bu2user2");
$bu_new->user_id = $user_new->id_dbuser;
$bu_new->bu_type = 'USER_ENS';
$bu_new->bu_id = $ens->numero;
_dao("kernel|kernel_bu2user2")->insert($bu_new);
echo $ens->nom . ";" . $ens->prenom . ";" . $login . ";" . $password . "\n";
}
foreach ($ppo->user_vil as $vil) {
if ($fusible-- <= 0) {
break;
}
//.........这里部分代码省略.........
示例7: processCerise
public function processCerise()
{
$magic = $this->getRequest('hackme', '');
$rne = $this->getRequest('rne', '');
if ($magic != 'assurdiato' && !Admin::canAdmin()) {
return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.noRights'), 'back' => CopixUrl::get()));
}
// ECOLES
$params = array();
$sql = "\n SELECT\n kernel_bu_ecole.numero AS id,\n kernel_bu_ecole.RNE AS rne,\n kernel_bu_ecole.type,\n kernel_bu_ecole.nom,\n kernel_bu_ville.nom AS ville_nom\n FROM kernel_bu_ecole\n LEFT JOIN kernel_bu_ville\n ON kernel_bu_ecole.id_ville=kernel_bu_ville.id_vi";
if ($rne) {
$sql .= " WHERE rne=:rne";
$params[':rne'] = $rne;
}
$sql .= " ORDER BY id";
$ecolesList = _doQuery($sql, $params);
// echo "<pre>"; print_r($ecolesList);
// CLASSES
$params = array();
$sql = "\n SELECT\n kernel_bu_ecole_classe.id,\n kernel_bu_ecole_classe.ecole,\n kernel_bu_ecole_classe.nom\n FROM kernel_bu_ecole_classe\n JOIN kernel_bu_annee_scolaire\n ON kernel_bu_ecole_classe.annee_scol=kernel_bu_annee_scolaire.id_as\n JOIN kernel_bu_ecole ON kernel_bu_ecole_classe.ecole=kernel_bu_ecole.numero\n WHERE kernel_bu_annee_scolaire.current=1\n AND kernel_bu_ecole_classe.is_validee=1\n AND kernel_bu_ecole_classe.is_supprimee=0";
if ($rne) {
$sql .= " AND kernel_bu_ecole.rne=:rne";
$params[':rne'] = $rne;
}
$sql .= "\tORDER BY id";
$classesList = _doQuery($sql, $params);
// echo "<pre>"; print_r($classesList);
$in_classe = array();
foreach ($classesList as $classe) {
$in_classe[] = $classe->id;
}
$in_classe = implode(",", $in_classe);
// echo "<pre>"; print_r($in_classe);
// kernel_bu_ecole_classe : id ecole nom annee_scol is_validee is_supprimee
// kernel_bu_annee_scolaire : id_as annee_scolaire dateDebut dateFin current
// ENSEIGNANTS
// LIEN ENSEIGNANTS-CLASSE
if ($in_classe == "") {
$enseignantsRoleList = array();
} else {
$sql = "\n SELECT\n kernel_bu_personnel.numero AS id,\n kernel_bu_personnel.nom,\n kernel_bu_personnel.nom_jf,\n kernel_bu_personnel.prenom1 AS prenom,\n kernel_bu_personnel.civilite,\n kernel_bu_personnel.mel AS email,\n kernel_bu_personnel_entite.reference AS id_classe,\n dbuser.id_dbuser AS user_id,\n dbuser.login_dbuser AS user_login\n -- ,dbuser.password_dbuser\n -- ,kernel_bu_personnel_entite.reference\n FROM kernel_bu_personnel\n JOIN kernel_bu_personnel_entite\n ON kernel_bu_personnel.numero=kernel_bu_personnel_entite.id_per\n LEFT JOIN kernel_link_bu2user ON kernel_link_bu2user.bu_type='USER_ENS' AND kernel_link_bu2user.bu_id=kernel_bu_personnel.numero\n LEFT JOIN dbuser ON kernel_link_bu2user.user_id=dbuser.id_dbuser\n WHERE kernel_bu_personnel_entite.type_ref='CLASSE' AND kernel_bu_personnel_entite.role=1\n AND kernel_bu_personnel_entite.reference IN (" . $in_classe . ")\n ";
$enseignantsRoleList = _doQuery($sql);
}
// echo "<pre>"; print_r($enseignantsRoleList);
$enseignantsList = array();
$linkEnseignantsClasseList = array();
foreach ($enseignantsRoleList as $ensrole) {
$new_role = new CopixPPO();
$new_role->id_enseignant = $ensrole->id;
$new_role->id_classe = $ensrole->id_classe;
$linkEnseignantsClasseList[] = $new_role;
if (!isset($enseignantsList[$ensrole->id])) {
unset($ensrole->id_classe);
$enseignantsList[$ensrole->id] = $ensrole;
}
}
// LIEN ENSEIGNANTS-ECOLE (directeur)
if ($in_classe == "") {
$directeursRoleList = array();
} else {
$params = array();
$sql = "\n SELECT\n kernel_bu_personnel.numero AS id_enseignant,\n kernel_bu_personnel.nom,\n kernel_bu_personnel.nom_jf,\n kernel_bu_personnel.prenom1 AS prenom,\n kernel_bu_personnel.civilite,\n kernel_bu_personnel.mel AS email,\n kernel_bu_personnel_entite.reference AS id_ecole,\n\n kernel_bu_personnel_entite.role,\n\n dbuser.id_dbuser AS user_id,\n dbuser.login_dbuser AS user_login\n -- ,dbuser.password_dbuser\n -- ,kernel_bu_personnel_entite.reference\n\n FROM kernel_bu_personnel\n JOIN kernel_bu_personnel_entite\n ON kernel_bu_personnel.numero=kernel_bu_personnel_entite.id_per\n JOIN kernel_bu_ecole\n ON kernel_bu_ecole.numero=kernel_bu_personnel_entite.reference AND kernel_bu_personnel_entite.type_ref='ECOLE' -- AND kernel_bu_personnel_entite.role=2\n\n LEFT JOIN kernel_link_bu2user ON kernel_link_bu2user.bu_type='USER_ENS' AND kernel_link_bu2user.bu_id=kernel_bu_personnel.numero\n LEFT JOIN dbuser ON kernel_link_bu2user.user_id=dbuser.id_dbuser\n ";
if ($rne) {
$sql .= " WHERE rne=:rne";
$params[':rne'] = $rne;
}
$directeursRoleList = _doQuery($sql, $params);
}
// id_per reference type_ref role
$linkEnseignantsEcoleList = array();
foreach ($directeursRoleList as $ensrole) {
$new_role = new CopixPPO();
$new_role->id_enseignant = $ensrole->id_enseignant;
$new_role->id_ecole = $ensrole->id_ecole;
$new_role->role = $ensrole->role;
$new_role->nom = $ensrole->nom;
$new_role->nom_jf = $ensrole->nom_jf;
$new_role->prenom = $ensrole->prenom;
$new_role->civilite = $ensrole->civilite;
$new_role->email = $ensrole->email;
$new_role->user_id = $ensrole->user_id;
$new_role->user_login = $ensrole->user_login;
$linkEnseignantsEcoleList[] = $new_role;
}
// echo "<pre>"; print_r($directeursRoleList);
// echo "<pre>"; print_r($linkEnseignantsEcoleList);
// kernel_bu_personnel : numero nom nom_jf prenom1 civilite id_sexe date_nais cle_privee profession tel_dom tel_gsm tel_pro mel num_rue num_seq adresse1 adresse2 code_postal commune id_ville pays challenge dateChallenge
// kernel_bu_personnel_entite : id_per reference type_ref role (type_ref=ECOLE/CLASSE)
// kernel_bu_personnel_role : id_role nom_role nom_role_pluriel perimetre priorite (id_role=1 ENS; id_role=2 DIR)
// kernel_link_bu2user : user_id bu_type bu_id
// dbuser : id_dbuser login_dbuser password_dbuser email_dbuser enabled_dbuser
// ELEVES
// kernel_bu_eleve : idEleve numero INE nom nom_jf prenom1 prenom2 prenom3 civilite id_sexe pays_nais nationalite dep_nais com_nais date_nais annee_france num_rue num_seq adresse1 adresse2 code_postal commune id_ville pays hors_scol id_directeur observations flag adresse_tmp date_tmp ele_last_update
// kernel_bu_eleve_admission : numero eleve etablissement annee_scol id_niveau etat_eleve date date_effet code_radiation previsionnel
// kernel_bu_eleve_affectation : id eleve annee_scol classe niveau dateDebut current previsionnel_cl
if ($in_classe == "") {
$eleveList = array();
} else {
$sql = "\n SELECT\n kernel_bu_eleve.idEleve AS id_eleve,\n kernel_bu_eleve.nom AS nom_eleve,\n kernel_bu_eleve.prenom1 AS prenom_eleve,\n kernel_bu_eleve.id_sexe AS id_sexe_eleve,\n kernel_bu_eleve.date_nais AS date_nais_eleve,\n\n kernel_bu_sexe.sexe AS sexe_eleve,\n\n kernel_bu_eleve_affectation.classe AS id_classe_eleve,\n kernel_bu_eleve_affectation.niveau AS niveau_eleve,\n\n kernel_bu_classe_niveau.niveau_court AS niveau_court_eleve,\n kernel_bu_classe_niveau.niveau AS niveau_long_eleve,\n\n dbuser_eleve.id_dbuser AS id_dbuser_eleve,\n dbuser_eleve.login_dbuser AS login_dbuser_eleve,\n dbuser_eleve.password_dbuser AS password_dbuser_eleve,\n\n kernel_bu_responsable.numero AS id_resp,\n kernel_bu_responsable.nom AS nom_resp,\n kernel_bu_responsable.prenom1 AS prenom_resp,\n kernel_bu_responsable.mel AS email_resp,\n\n dbuser_resp.id_dbuser AS id_dbuser_resp,\n dbuser_resp.login_dbuser AS login_dbuser_resp,\n dbuser_resp.password_dbuser AS password_dbuser_resp\n\n FROM kernel_bu_eleve\n\n JOIN kernel_bu_sexe\n ON kernel_bu_sexe.id_s=kernel_bu_eleve.id_sexe\n\n JOIN kernel_bu_eleve_affectation\n ON kernel_bu_eleve.idEleve=kernel_bu_eleve_affectation.eleve\n\n JOIN kernel_bu_annee_scolaire\n ON kernel_bu_eleve_affectation.annee_scol=kernel_bu_annee_scolaire.id_as\n\n JOIN kernel_bu_classe_niveau\n ON kernel_bu_classe_niveau.id_n=kernel_bu_eleve_affectation.niveau\n\n LEFT JOIN kernel_link_bu2user kernel_link_bu2user_eleve ON kernel_link_bu2user_eleve.bu_type='USER_ELE' AND kernel_link_bu2user_eleve.bu_id=kernel_bu_eleve.idEleve\n LEFT JOIN dbuser dbuser_eleve ON kernel_link_bu2user_eleve.user_id=dbuser_eleve.id_dbuser\n\n LEFT JOIN kernel_bu_responsables\n ON kernel_bu_responsables.id_beneficiaire=kernel_bu_eleve.idEleve\n AND kernel_bu_responsables.type_beneficiaire='eleve'\n AND kernel_bu_responsables.type='responsable'\n\n LEFT JOIN kernel_bu_responsable\n ON kernel_bu_responsable.numero=kernel_bu_responsables.id_responsable\n\n LEFT JOIN kernel_link_bu2user kernel_link_bu2user_resp ON kernel_link_bu2user_resp.bu_type='USER_RES' AND kernel_link_bu2user_resp.bu_id=kernel_bu_responsable.numero\n LEFT JOIN dbuser dbuser_resp ON kernel_link_bu2user_resp.user_id=dbuser_resp.id_dbuser\n\n\n WHERE kernel_bu_annee_scolaire.current=1\n AND kernel_bu_eleve_affectation.current=1\n AND kernel_bu_eleve_affectation.classe IN (" . $in_classe . ")\n ";
$eleveList = _doQuery($sql);
//.........这里部分代码省略.........