public function processDefault() { $this->matrix =& enic::get('matrix'); $ppo = new CopixPPO(); $ppo->matrix = $this->matrix->display(); return _arPPO($ppo, 'matrix.tpl'); }
/** * Affiche les infos d'une classe (enseignant et �l�ves) * * @author Christophe Beyer <*****@*****.**> * @since 2006/01/18 * @param integer $rClasse Recordset de la classe */ public function _createContent(&$toReturn) { $tpl = new CopixTpl(); $annuaireService =& CopixClassesFactory::Create('annuaire|AnnuaireService'); $rClasse = $this->getParam('rClasse') ? $this->getParam('rClasse') : NULL; if ($rClasse) { $classe = $rClasse['id']; $enseignants = $annuaireService->getEnseignantInClasse($classe); $eleves = $annuaireService->getElevesInClasse($classe); $rClasse["eleves"] = $eleves; $rClasse["enseignants"] = $enseignants; $matrix =& enic::get('matrixCache'); $matrix->display(); $droit = $matrix->classe($classe)->_right->USER_ENS->voir; if (!$droit) { $rClasse["enseignants"] = 'NONE'; } $canWrite = $matrix->classe($classe)->_right->USER_ENS->communiquer; $tpl->assign('canWriteUSER_ENS', $canWrite); $droit = $matrix->classe($classe)->_right->USER_ELE->voir; if (!$droit) { $rClasse["eleves"] = 'NONE'; } $canWrite = $matrix->classe($classe)->_right->USER_ELE->communiquer; $tpl->assign('canWriteUSER_ELE', $canWrite); $tpl->assign('classe', $rClasse); $toReturn = $tpl->fetch('infosclasse.tpl'); } return true; }
/** * Save an image in enicImage's files repository * @param string $pathToFile path to the image to save * @param boolean $keep_original_image keep the original image (default value: true) * @return string image unique id */ public function add($pathToFile, $keep_original_image = true) { $imageClass = new externalImageUpload($pathToFile); $imageClass->file_new_name_body = enic::get('helpers')->uniqueId(); $imageClass->process($this->getImageDirectory($imageClass->file_new_name_body)); if (!$imageClass->processed) { throw new Exception('Error occured in upload process'); } if (!$keep_original_image) { $imageClass->clean(); } return $imageClass->file_dst_name_body . '|' . $imageClass->file_dst_name_ext; }
public function wysiwyg($iIdDom, $iType = 'simple') { $this->addFile('js/ckeditor/ckeditor.js'); $this->addFile('js/ckeditor/adapters/jquery.js'); $this->addFileByTheme('js/ckeditor.js'); $css =& enic::get('css'); switch ($iType) { case 'full': $toolbarName = 'full'; break; case 'simple': default: $toolbarName = 'IconitoBasic'; } $js = '$("' . $iIdDom . '").ckeditor({toolbar: "' . $toolbarName . '"})'; $this->addJs($js); }
public function beforeProcess(&$action) { $user =& enic::get('user'); //if user not connected : return true if ($user->chartValid) { return true; } //array of authorized module $authMod = array('charte', 'auth', 'kernel'); if (in_array($action->file->module, $authMod)) { return true; } $action->useObj = 'charte|Charte'; $action->useMeth = $action->file->module == 'default' ? 'Valid' : 'processValid'; $action->file->module = 'charte'; $action->file->type = 'module'; $action->file->fileName = 'Charte'; }
/** * Affiche les infos d'une �cole (coordonn�es, directeur, classes...) * * @author Christophe Beyer <*****@*****.**> * @since 2006/01/18 * @param integer $rEcole Recordset de l'�cole */ public function _createContent(&$toReturn) { $tpl = new CopixTpl(); $annuaireService =& CopixClassesFactory::Create('annuaire|AnnuaireService'); $rEcole = $this->getParam('rEcole') ? $this->getParam('rEcole') : NULL; if ($rEcole) { //print_r($rEcole); $ecole = $rEcole['id']; // BOOST 2.5s if ($this->getParam('classes')) { $classes = $this->getParam('classes'); } else { $classes = $annuaireService->getClassesInEcole($ecole, array('droit' => 'VOIR')); } $matrix =& enic::get('matrixCache'); $droit = $matrix->ecole($ecole)->_right->USER_DIR->voir; if ($droit) { $rEcole['directeur'] = $annuaireService->getDirecteurInEcole($ecole); $canWrite = $matrix->ecole($ecole)->_right->USER_DIR->communiquer; $tpl->assign('canWriteUSER_DIR', $canWrite); } //$droit = $matrix->ecole($ecole)->_right->USER_ADM->voir; $droit = 1; if ($droit) { $rEcole['administratif'] = $annuaireService->getAdministratifInEcole($ecole); $canWrite = $matrix->ecole($ecole)->_right->USER_DIR->communiquer; $tpl->assign('canWriteUSER_ADM', $canWrite); } $tpl->assign('canWriteUSER_ENS', $matrix->ecole($ecole)->_right->USER_ENS->communiquer); //$rEcole['directeur'] = $annuaireService->checkVisibility( $rEcole['directeur'] ); //$rEcole['administratif'] = $annuaireService->checkVisibility( $rEcole['administratif'] ); $tpl->assign('ecole', $rEcole); $tpl->assign('classes', $classes); // BOOST 1s if (CopixConfig::exists('|can_annuaire_menu') && !CopixConfig::get('|can_annuaire_menu')) { $tpl->assign('displayComboEcoles', false); } else { $tpl->assign('displayComboEcoles', true); } $tpl->assign('comboecoles', CopixZone::process('annuaire|comboecolesinville', array('droit' => 'VOIR', 'ville' => $rEcole['ALL']->vil_id_vi, 'value' => $ecole, 'fieldName' => 'ecole', 'attribs' => 'CLASS="annu_combo_popup" ONCHANGE="if (this.value) this.form.submit();"'))); $toReturn = $tpl->fetch('infosecole.tpl'); } return true; }
public function __construct() { //pre-load enic classes enic::to_load('matrix'); //load enic classes in current object : $this->user =& enic::get('user'); $this->options =& enic::get('options'); $this->matrix =& enic::get('matrixCache'); $this->model =& enic::get('model'); $this->db =& enic::get('model'); $this->js =& enic::get('javascript'); $this->css =& enic::get('css'); $this->session =& enic::get('session'); $this->flash =& enic::get('flash'); $this->html =& enic::get('html'); $this->helpers =& enic::get('helpers'); //define properties : $this->module = $this->helpers->module; $this->actiongroup = $this->helpers->actiongroup; $this->action = $this->helpers->action; }
/** * Detail d'une ecole * * @author Christophe Beyer <*****@*****.**> * @since 2008/09/03 * @param object $rEcole Recordset de l'ecole * @param object $rFiche Recordset de la fiche ecole */ public function _createContent(&$toReturn) { $tpl = new CopixTpl(); $rEcole = $this->getParam('rEcole'); $rFiche = $this->getParam('rFiche'); $arClasses = AnnuaireService::getClassesInEcole($rEcole->numero, array('forceCanViewEns' => true, 'withNiveaux' => true)); usort($arClasses, array("ZoneFiche", "_usortClasses")); //var_dump($arClasses); $canModify = FichesEcolesService::canMakeInFicheEcole($rEcole->numero, 'MODIFY'); $blog = getNodeBlog('BU_ECOLE', $rEcole->numero, array('is_public' => 1)); //var_dump($blog); $arClassesBlogs = false; if ($blog) { $rEcole->blog = $blog; } else { // Si pas de blog, on regarde s'il y a des blogs publics de classes $arClassesBlogs = AnnuaireService::getClassesInEcole($rEcole->numero, array('onlyWithBlog' => true, 'onlyWithBlogIsPublic' => 1, 'enseignant' => false)); } //Kernel::deb($arClassesBlogs); $rEcole->directeur = AnnuaireService::getDirecteurInEcole($rEcole->numero); //var_dump($rEcole); $matrix =& enic::get('matrixCache'); $nodeVocabularyCatalogDAO = _ioDAO('kernel|kernel_i18n_node_vocabularycatalog'); $vocabularyCatalog = $nodeVocabularyCatalogDAO->getCatalogForNode('BU_ECOLE', $rEcole->numero); $tpl->assign('rEcole', $rEcole); $tpl->assign('rFiche', $rFiche); $tpl->assign('arClasses', $arClasses); $tpl->assign('arClassesBlogs', $arClassesBlogs); $tpl->assign('canModify', $canModify); $_right = $matrix->ecole($rEcole->numero)->_right; $tpl->assign('canViewDir', $_right->USER_DIR->voir); $tpl->assign('canWriteDir', $_right->USER_DIR->communiquer); $tpl->assign('canViewEns', $_right->USER_ENS->voir); $tpl->assign('canWriteEns', $_right->USER_ENS->communiquer); $tpl->assign('id_vc', $vocabularyCatalog->id_vc); $toReturn = $tpl->fetch('fiche.tpl'); return true; }
public function __construct() { //test the user connexion, desactivate for public access //_currentUser()->assertCredential ('group:[current_user]'); //pre-load enic classes enic::to_load('matrix'); //load enic classes in current object : $this->user =& enic::get('user'); $this->options =& enic::get('options'); $this->matrix =& enic::get('matrixCache'); $this->model =& enic::get('model'); $this->db =& enic::get('model'); $this->js =& enic::get('javascript'); $this->css =& enic::get('css'); $this->session =& enic::get('session'); $this->flash =& enic::get('flash'); $this->html =& enic::get('html'); $this->helpers =& enic::get('helpers'); //define properties : $this->module = $this->helpers->module; $this->actiongroup = $this->helpers->actiongroup; $this->action = $this->helpers->action; }
public function __construct() { $this->accountService = enic::get('helpers')->service('soapserver|accountservice'); $this->kernelAPI = enic::get('helpers')->service('kernel|kernel_api'); }
public function exists($iName) { //get storage $storageObject = enic::get($this->storage); $name = $this->buildId($iName); return $storageObject->exists($name); }
private function buildHtml() { //$this->html = '<script charset="utf-8" src="' . $this->source . '"></script>'; $js = enic::get('javascript'); $js->addFile($this->source); $this->html .= '<script type="text/javascript">' . PHP_EOL . $this->javascript . PHP_EOL . '</script>'; }
public function __construct() { $this->feed =& enic::get('zend'); enic::to_load('image'); parent::__construct(); }
/** * Retourne les agents de ville d'une ville * * @author Christophe Beyer <*****@*****.**> * @since 2006/02/13 * @param integer $ville id de la ville * @param array $options Tableau d'options : [droit] pour n'avoir que les agents sur lesquels on a ce droit * @return array Tableau avec les agents */ public function getAgentsInVille($ville, $options = array()) { $matrix =& enic::get('matrixCache'); $agents = array(); $result = Kernel::getNodeChilds('BU_VILLE', $ville); foreach ($result as $key => $value) { //print_r($value); if ($value['type'] == 'USER_VIL') { if (isset($options['droit']) && $options['droit']) { $droit = $matrix->ville($ville)->_right->USER_VIL->{$options}['droit']; //Kernel::myDebug("droit=".$droit); if (!$droit) { continue; } } if ($nodeInfo = Kernel::getUserInfo($value["type"], $value["id"])) { //var_dump($nodeInfo); $login = isset($nodeInfo['login']) ? $nodeInfo['login'] : ''; $age = array('type' => $nodeInfo['type'], 'id' => $nodeInfo['id'], 'login' => $login, 'nom' => $nodeInfo['nom'], 'prenom' => $nodeInfo['prenom'], 'sexe' => $nodeInfo['sexe']); $agents[] = $age; } } } usort($agents, array('AnnuaireService', 'usort_nom')); return $agents; }
public function __construct() { $this->db =& enic::get('model'); }
private function processLocalTest() { $this->myservice = enic::get('helpers')->service('soapserver|soapserverservice'); $class = new soapClassModel(); $class->name = 'Vasi Tavue'; $class->accountId = 1; $class->classId = 6; $class->level = 7; $class->type = 8; $class->year = 2011; $date = new DateTime('2012-08-31'); $class->validityDate = $date->format("Y-m-d H:i:s"); $directeur = new soapDirectorModel(); $directeur->name = "jeanClaude"; $directeur->surname = "leCompte"; $directeur->mail = "*****@*****.**"; $directeur->gender = 1; $directeur->password = md5(123456); $directeur->phone = '0123456742'; $adress = new soapAddressModel(); $adress->address = "4 rue des cochons"; $adress->additionalAddress = ""; $adress->city = "Larochelle"; $adress->postalCode = "76788"; $school = new soapSchoolModel(); $school->name = "DesChamps"; $school->address = $adress; $school->director = $directeur; $school->rne = 123456789; $school->siret = '1234567898'; $account = new soapAccountModel(); $account->id = 1; $account->school = $school; var_dump($this->myservice->accountService->create(1, 2, 3)); try { $j = $this->myservice->createAccount($account); $i = $this->myservice->createClass($class); $k = $this->myservice->validateClass($class); } catch (Exception $e) { echo $e; } return _arNone(); }
public function loadTrue() { //matrix : $matrix =& enic::get('matrix'); foreach ($matrix->villes->_other->_right as $key => $right) { foreach ($right as $keyi => $righti) { $matrix->villes->_other->_right->{$key}->{$keyi} = true; } } }
public function isOwner($iIdQuiz) { //get users infos : $user =& enic::get('user'); //protect id $id = $iIdQuiz * 1; $id_owner = $this->db->query('SELECT id_owner FROM module_quiz_quiz WHERE id = ' . $id)->toInt(); $idUser = $user->id; return $idUser == $id_owner; }
public function __construct() { parent::__construct(); $this->db =& enic::get('model'); }
/** * Affiche une discussion d'un cahier de correspondance * * @author Christophe Beyer <*****@*****.**> * @since 2005/11/16 * @param integer $id Id de la discussion * @param integer $eleve (option) Id de l'élève * @param integer $print (option, 0 par défaut) Si 1, affiche la discussion au format imprimable * @param string $go (option) Si vaut "new", redirige sur le premier message non lu de la discussion */ public function getTopic() { $dao = CopixDAOFactory::create("carnet_topics"); $kernel_service =& CopixClassesFactory::Create('kernel|kernel'); $carnet_service =& CopixClassesFactory::Create('carnet|CarnetService'); $id = $this->getRequest('id', null); $eleve = $this->getRequest('eleve', null); $print = $this->getRequest('print', 0); $go = $this->getRequest('go', null); $session = Kernel::getSessionBU(); $criticErrors = array(); if ($go == "new") { $daoTracking = CopixDAOFactory::create("carnet|carnet_tracking2"); if ($eleve && $eleve != 'CLASSE') { $idEleves = array($eleve); } else { $to = $dao->getElevesForTopic($id); $idEleves = array(); foreach ($to as $item) { $idEleves[] = $item->eleve; } } //print_r($idEleves); //die(); $unread = $daoTracking->getFirstUnreadMessage($id, $session['user_id'], $idEleves); //_dump($unread[0]); if ($unread[0]->id) { // Il est déjà passé dans le topic $urlReturn = CopixUrl::get('|getTopic', array('id' => $id, 'eleve' => $eleve)) . '#m' . $unread[0]->id; } else { // Jamais passé, on le renvoie au début du topic $urlReturn = CopixUrl::get('|getTopic', array('id' => $id, 'eleve' => $eleve)); } //die($urlReturn); return new CopixActionReturn(COPIX_AR_REDIRECT, $urlReturn); } $topic = $dao->get($id); $classe = $topic->classe; $ppo = new CopixPPO(); if (!$topic) { $criticErrors[] = CopixI18N::get('carnet|carnet.error.noTopic'); } $matrix =& enic::get('matrixCache'); $ppo->canView_USER_RES = $matrix->classe($classe)->_right->USER_RES->voir; $ppo->canView_USER_ENS = $matrix->classe($classe)->_right->USER_ENS->voir; $ppo->canView_USER_ELE = $matrix->classe($classe)->_right->USER_ELE->voir; //_dump($canWrite_USER_RES); $mondroit = $carnet_service->getUserDroitInCarnet(array("classe" => $classe, "eleve" => $eleve)); //print_r("mondroit=$mondroit"); if (!$mondroit) { $criticErrors[] = CopixI18N::get('kernel|kernel.error.noRights'); } if ($criticErrors) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => implode('<br/>', $criticErrors), 'back' => CopixUrl::get('carnet||getCarnet', array()))); } if (0) { } else { // print_r2($topic); // 1. Infos sur le topic $userInfo = $kernel_service->getUserInfo("ID", $topic->createur); $topic->createur_nom = $userInfo["prenom"] . " " . $userInfo["nom"]; $topic->createur_infos = $userInfo; $to = $dao->getElevesForTopic($topic->id); while (list($k, ) = each($to)) { $userInfo = $kernel_service->getUserInfo("USER_ELE", $to[$k]->eleve); $to[$k]->eleve_infos = $userInfo["prenom"] . " " . $userInfo["nom"]; } $topic->eleves = $to; $topic->nb_eleves = count($to); // Avatar de l'auteur $avatar = Prefs::get('prefs', 'avatar', $topic->createur); $topic->avatar = $avatar ? CopixConfig::get('prefs|avatar_path') . $avatar : ''; //print_r2($topic); // 2. Les messages if ($eleve && $eleve != 'CLASSE') { // Filtrage sur un élève $list = $dao->getListCarnetsMessagesForTopicAndEleve($id, $eleve); $idEleves = array($eleve); } else { // Tous les élèves de la classe $eleves = $carnet_service->getUserElevesInClasse($topic->classe); $list = $dao->getListCarnetsMessagesForTopicAndEleves($id, $eleves); //print_r($list); $idEleves = array(); foreach ($to as $item) { $idEleves[] = $item->eleve; } } //print_r($idEleves); while (list($k, ) = each($list)) { $userInfo = $kernel_service->getUserInfo("ID", $list[$k]->auteur); $list[$k]->auteur_nom = $userInfo["prenom"] . " " . $userInfo["nom"]; $list[$k]->auteur_infos = $userInfo; $userInfo = $kernel_service->getUserInfo("USER_ELE", $list[$k]->eleve); $list[$k]->eleve_nom = $userInfo["prenom"] . " " . $userInfo["nom"]; $list[$k]->eleve_infos = $userInfo; // Avatar de l'expéditeur $avatar = Prefs::get('prefs', 'avatar', $list[$k]->auteur); $list[$k]->avatar = $avatar ? CopixConfig::get('prefs|avatar_path') . $avatar : ''; } $canWriteClasse = $carnet_service->canMakeInCarnet('WRITE_CLASSE', NULL); $canPrintTopic = $carnet_service->canMakeInCarnet('PRINT_TOPIC', NULL); // On enregistre sa lecture (tracking) $carnet_service->userReadTopic($id, $session['user_id'], $idEleves); CopixHTMLHeader::addCSSLink(_resource("styles/module_carnet.css")); if ($print) { CopixHTMLHeader::addCSSLink(_resource("styles/module_carnet_print.css"), array('media' => 'print')); } $tpl = new CopixTpl(); $tpl->assign('TITLE_PAGE', $topic->titre); //$tpl->assign ('MENU', '<a href="'.CopixUrl::get ('carnet||getCarnet', array("classe"=>$classe, "eleve"=>$eleve)).'">'.CopixI18N::get ('carnet|carnet.backCarnet').'</a>'); //print_r($list); //print_r($topic); $tplListe = new CopixTpl(); $tplListe->assign('ppo', $ppo); $tplListe->assign('topic', $topic); $tplListe->assign('eleve', $eleve); $tplListe->assign('canWriteClasse', $canWriteClasse); $tplListe->assign('canPrintTopic', $canPrintTopic); $tplListe->assign('list', $list); $tplListe->assign('session', Kernel::getSessionBU()); $tplListe->assign('linkClasse', CopixUrl::get('carnet||getTopic', array('id' => $topic->id))); if ($print) { $result = $tplListe->fetch("gettopicprint.tpl"); } else { $result = $tplListe->fetch("gettopic.tpl"); } $tpl->assign("MAIN", $result); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); } }
/** * Affichage de l'annuaire en version popup * * Affiche les discussions d'un forum et les informations sur les discussions (titre, dernier message...), avec un lien pour lire chaque discussion. * * @author Christophe Beyer <*****@*****.**> * @since 2006/01/18 */ public function getPopup() { if (!Kernel::is_connected()) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('annuaire|annuaire.error.noLogged'), 'back' => CopixUrl::get('||'))); } CopixHTMLHeader::addJSLink(_resource("js/iconito/module_annuaire_popup.js")); CopixHTMLHeader::addJSLink(_resource("js/jquery/jquery.tablesorter.min.js")); CopixHTMLHeader::addJSLink(_resource("js/jquery/jquery.metadata.js")); CopixHTMLHeader::addCSSLink(_resource("js/jquery/css/jquery.tablesorter.css")); $grville = _request('grville') ? _request('grville') : NULL; $ville = _request('ville') ? _request('ville') : NULL; $ecole = _request('ecole') ? _request('ecole') : NULL; $classe = _request('classe') ? _request('classe') : NULL; $field = _request('field') ? _request('field') : ''; $profils = _request('profils') ? _request('profils') : array(); $profil = $this->getRequest('profil'); // Si on force sur un profil unique a afficher $ALL = CopixConfig::get('annuaire|annu_combo_all'); $annuaireService =& CopixClassesFactory::Create('annuaire|AnnuaireService'); // Annuaire par défaut, on regarde sa session if (!$classe && !$ecole && !$ville) { $home = $annuaireService->getAnnuaireHome(); //print_r($home); switch ($home['type']) { case 'BU_GRVILLE': $grville = $home['id']; $ville = $ALL; $ecole = $ALL; $classe = $ALL; break; case 'BU_VILLE': $info = Kernel::getNodeInfo($home['type'], $home['id']); if ($info) { $grville = $info['ALL']->vil_id_grville; } $ville = $home['id']; $ecole = $ALL; $classe = $ALL; break; case 'BU_ECOLE': $info = Kernel::getNodeInfo($home['type'], $home['id']); if ($info) { $grville = $info['ALL']->vil_id_grville; $ville = $info['ALL']->eco_id_ville; } $ecole = $home['id']; $classe = $ALL; break; case 'BU_CLASSE': $info = Kernel::getNodeInfo($home['type'], $home['id']); //_dump($info); if ($info) { $grville = $info['parent']['ALL']->vil_id_grville; $ville = $info['parent']['ALL']->eco_id_ville; $ecole = $info['parent']['id']; } $classe = $home['id']; //echo "grville=$grville / ville=$ville / ecole=$ecole / classe=$classe"; break; } } $comboEcoles = $comboClasses = true; // On force les valeurs des combos if ($profil) { switch ($profil) { case 'USER_VIL': $comboEcoles = $comboClasses = false; $ecole = $classe = $ALL; break; } } $matrix =& enic::get('matrixCache'); $helper =& enic::get('matrixHelpers'); $right = _request('right', 'voir'); // voir ou communiquer $iCan = 'communiquer' == $right ? 'iCanTalkToThisType' : 'iCanSeeThisType'; $tplListe = new CopixTpl(); $visib = array('USER_ELE' => $helper->{$iCan}('USER_ELE'), 'USER_ENS' => $helper->{$iCan}('USER_ENS') || $helper->{$iCan}('USER_DIR'), 'USER_RES' => $helper->{$iCan}('USER_RES'), 'USER_EXT' => $helper->{$iCan}('USER_EXT'), 'USER_ADM' => $helper->{$iCan}('USER_ADM'), 'USER_VIL' => $helper->{$iCan}('USER_VIL')); //_dump($visib); $debug = false; $start = microtime(true); $tplListe->assign('combogrvilles', CopixZone::process('annuaire|combogrvilles', array('droit' => $right, 'value' => $grville, 'fieldName' => 'grville', 'attribs' => 'class="annu_combo_popup" ONCHANGE="change_grville(this,this.form);"', 'linesSup' => array()))); if ($debug) { echo "combogrvilles " . date("H:i:s") . " " . (microtime(true) - $start) . "<br />"; } $start = microtime(true); $tplListe->assign('combovilles', CopixZone::process('annuaire|combovilles', array('droit' => $right, 'grville' => $grville, 'value' => $ville, 'fieldName' => 'ville', 'attribs' => 'class="annu_combo_popup" ONCHANGE="change_ville(this,this.form);"', 'linesSup' => array(0 => array('value' => $ALL, 'libelle' => CopixI18N::get('annuaire|annuaire.comboAllVilles')))))); if ($debug) { echo "combovilles " . date("H:i:s") . " " . (microtime(true) - $start) . "<br />"; } $start = microtime(true); if ($ville == $ALL && $comboEcoles) { $tplListe->assign('comboecoles', CopixZone::process('annuaire|comboecolesingrville', array('droit' => $right, 'grville' => $grville, 'value' => $ecole, 'fieldName' => 'ecole', 'attribs' => 'class="annu_combo_popup" ONCHANGE="change_ecole(this,this.form);"', 'linesSup' => array(0 => array('value' => $ALL, 'libelle' => CopixI18N::get('annuaire|annuaire.comboAllEcoles')))))); if ($debug) { echo "comboecolesingrville " . date("H:i:s") . " " . (microtime(true) - $start) . "<br />"; } } elseif ($comboEcoles) { $tplListe->assign('comboecoles', CopixZone::process('annuaire|comboecolesinville', array('droit' => $right, 'ville' => $ville, 'value' => $ecole, 'fieldName' => 'ecole', 'attribs' => 'class="annu_combo_popup" ONCHANGE="change_ecole(this,this.form);"', 'linesSup' => array(0 => array('value' => $ALL, 'libelle' => CopixI18N::get('annuaire|annuaire.comboAllEcoles')))))); if ($debug) { echo "comboecolesinville " . date("H:i:s") . " " . (microtime(true) - $start) . "<br />"; } } $start = microtime(true); if ($ville == $ALL && $ecole == $ALL && $comboClasses) { $tplListe->assign('comboclasses', CopixZone::process('annuaire|comboclassesingrville', array('droit' => $right, 'grville' => $grville, 'value' => $classe, 'fieldName' => 'classe', 'attribs' => 'class="annu_combo_popup" ONCHANGE="change_classe(this,this.form);"', 'linesSup' => array(0 => array('value' => $ALL, 'libelle' => CopixI18N::get('annuaire|annuaire.comboAllClasses')))))); if ($debug) { echo "comboclassesingrville " . date("H:i:s") . " " . (microtime(true) - $start) . "<br />"; } } elseif ($ecole == $ALL && $comboClasses) { $tplListe->assign('comboclasses', CopixZone::process('annuaire|comboclassesinville', array('droit' => $right, 'ville' => $ville, 'value' => $classe, 'fieldName' => 'classe', 'attribs' => 'class="annu_combo_popup" ONCHANGE="change_classe(this,this.form);"', 'linesSup' => array(0 => array('value' => $ALL, 'libelle' => CopixI18N::get('annuaire|annuaire.comboAllClasses')))))); if ($debug) { echo "comboclassesinville " . date("H:i:s") . " " . (microtime(true) - $start) . "<br />"; } } elseif ($ecole && $comboClasses) { $tplListe->assign('comboclasses', CopixZone::process('annuaire|comboclassesinecole', array('droit' => $right, 'ecole' => $ecole, 'value' => $classe, 'fieldName' => 'classe', 'attribs' => 'class="annu_combo_popup" ONCHANGE="change_classe(this,this.form);"', 'linesSup' => array(0 => array('value' => $ALL, 'libelle' => CopixI18N::get('annuaire|annuaire.comboAllClasses')))))); if ($debug) { echo "comboclassesinecole " . date("H:i:s") . " " . (microtime(true) - $start) . "<br />"; } } elseif ($comboClasses) { $tplListe->assign('comboclasses', CopixZone::process('annuaire|comboempty', array('fieldName' => 'classe', 'attribs' => 'class="annu_combo_popup" ONCHANGE="change_classe(this,this.form);"'))); if ($debug) { echo "comboempty " . date("H:i:s") . " " . (microtime(true) - $start) . "<br />"; } } if ($ville_as_array = Kernel::getKernelLimits('ville_as_array')) { // Limitation par URL, on verifie les parametres if ($ville && $ville != $ALL && !in_array($ville, $ville_as_array)) { $ville = 0; } if ($ecole && $ecole != $ALL && ($rEcole = Kernel::getNodeInfo('BU_ECOLE', $ecole, false)) && !in_array($rEcole['ALL']->vil_id_grville, $ville_as_array)) { $ecole = 0; } if ($classe && $classe != $ALL && ($rClasse = Kernel::getNodeInfo('BU_CLASSE', $classe, false)) && !in_array($rClasse['ALL']->eco_id_ville, $ville_as_array)) { $classe = 0; } } //kernel::myDebug ("grville=$grville / ville=$ville / ecole=$ecole / classe=$classe"); //kernel::myDebug ($profils); if ($classe && $classe !== $ALL) { // Une classe précise $visib['USER_ELE'] = $matrix->classe($classe)->_right->USER_ELE->{$right}; $visib['USER_ENS'] = $matrix->classe($classe)->_right->USER_ENS->{$right} || $matrix->classe($classe)->_right->USER_DIR->{$right}; $visib['USER_RES'] = $matrix->classe($classe)->_right->USER_RES->{$right}; $visib['USER_ADM'] = $matrix->classe($classe)->_right->USER_ADM->{$right}; $visib['USER_EXT'] = $matrix->classe($classe)->_right->USER_EXT->{$right}; $visib['USER_VIL'] = $matrix->classe($classe)->_right->USER_VIL->{$right}; } elseif ($ecole && $classe == $ALL && $ecole !== $ALL) { // Une école $visib['USER_ELE'] = $matrix->ecole($ecole)->_right->USER_ELE->{$right}; $visib['USER_ENS'] = $matrix->ecole($ecole)->_right->USER_ENS->{$right} || $matrix->ecole($ecole)->_right->USER_DIR->{$right}; $visib['USER_RES'] = $matrix->ecole($ecole)->_right->USER_RES->{$right}; $visib['USER_ADM'] = $matrix->ecole($ecole)->_right->USER_ADM->{$right}; $visib['USER_EXT'] = $matrix->ecole($ecole)->_right->USER_EXT->{$right}; $visib['USER_VIL'] = $matrix->ecole($ecole)->_right->USER_VIL->{$right}; } elseif ($ville && $classe == $ALL && $ecole == $ALL && $ville !== $ALL) { // Une ville $visib['USER_ELE'] = $matrix->ville($ville)->_right->USER_ELE->{$right}; $visib['USER_ENS'] = $matrix->ville($ville)->_right->USER_ENS->{$right} || $matrix->ville($ville)->_right->USER_DIR->{$right}; $visib['USER_RES'] = $matrix->ville($ville)->_right->USER_RES->{$right}; $visib['USER_ADM'] = $matrix->ville($ville)->_right->USER_ADM->{$right}; $visib['USER_EXT'] = $matrix->ville($ville)->_right->USER_EXT->{$right}; $visib['USER_VIL'] = $matrix->ville($ville)->_right->USER_VIL->{$right}; } elseif ($grville && $classe == $ALL && $ecole == $ALL && $ville == $ALL) { // Un groupe de villes $visib['USER_ELE'] = $matrix->grville($grville)->_right->USER_ELE->{$right}; $visib['USER_ENS'] = $matrix->grville($grville)->_right->USER_ENS->{$right} || $matrix->grville($grville)->_right->USER_DIR->{$right}; $visib['USER_RES'] = $matrix->grville($grville)->_right->USER_RES->{$right}; $visib['USER_ADM'] = $matrix->grville($grville)->_right->USER_ADM->{$right}; $visib['USER_EXT'] = $matrix->grville($grville)->_right->USER_EXT->{$right}; $visib['USER_VIL'] = $matrix->grville($grville)->_right->USER_VIL->{$right}; } //_dump($visib); // Si on restreint a un profil if ($profil && $visib[$profil]) { switch ($profil) { case 'USER_VIL': $profils = array(); $profils['VIL'] = 1; break; } } if (!$profils && $visib['USER_ELE']) { $profils['ELE'] = 1; } elseif (!$profils && $visib['USER_ENS']) { $profils['PEC'] = 1; } elseif (!$profils && $visib['USER_RES']) { $profils['PAR'] = 1; } elseif (!$profils && $visib['USER_EXT']) { $profils['EXT'] = 1; } elseif (!$profils && $visib['USER_ADM']) { $profils['ADM'] = 1; } elseif (!$profils && $visib['USER_VIL']) { $profils['VIL'] = 1; } //kernel::myDebug($visib); // =============== ELEVES ========================= $eleves = array(); if (isset($profils['ELE']) && $grville && $ville && $ecole && $classe && $visib['USER_ELE']) { if ($classe != $ALL) { // Une classe précise $eleves = $annuaireService->getEleves('BU_CLASSE', $classe); } elseif ($classe == $ALL && $ecole != $ALL) { // Les eleves d'une école $eleves = $annuaireService->getEleves('BU_ECOLE', $ecole); } elseif ($classe == $ALL && $ecole == $ALL && $ville != $ALL) { // Les eleves d'une ville $eleves = $annuaireService->getEleves('BU_VILLE', $ville); } elseif ($classe == $ALL && $ecole == $ALL && $ville == $ALL) { // Les eleves d'un groupe de villes $eleves = $annuaireService->getEleves('BU_GRVILLE', $grville); } } // =============== PERSONNEL ========================= $personnel = array(); if (isset($profils['PEC']) && $grville && $ville && $ecole && $classe && $visib['USER_ENS']) { if ($classe != $ALL) { // Une classe précise $personnel = $annuaireService->getPersonnel('BU_CLASSE', $classe); } elseif ($classe == $ALL && $ecole != $ALL) { // Les classes d'une école $personnel = $annuaireService->getPersonnel('BU_ECOLE', $ecole); } elseif ($classe == $ALL && $ecole == $ALL && $ville != $ALL) { // Les classes d'une ville $personnel = $annuaireService->getPersonnel('BU_VILLE', $ville); } elseif ($classe == $ALL && $ecole == $ALL && $ville == $ALL) { // Les classes d'un groupe de villes $personnel = $annuaireService->getPersonnel('BU_GRVILLE', $grville); } } // =============== PARENTS ========================= $parents = array(); if (isset($profils['PAR']) && $grville && $ville && $ecole && $classe && $visib['USER_RES']) { if ($classe != $ALL) { // Une classe précise $parents = $annuaireService->getParents('BU_CLASSE', $classe); } elseif ($classe == $ALL && $ecole != $ALL) { // Les classes d'une école $parents = $annuaireService->getParents('BU_ECOLE', $ecole); } elseif ($classe == $ALL && $ecole == $ALL && $ville != $ALL) { // Les classes d'une ville $parents = $annuaireService->getParents('BU_VILLE', $ville); } elseif ($classe == $ALL && $ecole == $ALL && $ville == $ALL) { // Les classes d'un groupe de villes $parents = $annuaireService->getParents('BU_GRVILLE', $grville); } } // =============== PERSONNEL ADMINISTRATIF ========================= $adm = array(); if (isset($profils['ADM']) && $grville && $ville && $ecole && $classe && $visib['USER_ADM']) { if (($classe != $ALL || $classe == $ALL) && $ecole != $ALL) { // Les classes d'une école $adm = $annuaireService->getPersonnelAdm('BU_ECOLE', $ecole); } elseif ($classe == $ALL && $ecole == $ALL && $ville != $ALL) { // Les classes d'une ville $adm = $annuaireService->getPersonnelAdm('BU_VILLE', $ville); } elseif ($classe == $ALL && $ecole == $ALL && $ville == $ALL) { // Les classes d'un groupe de villes $adm = $annuaireService->getPersonnelAdm('BU_GRVILLE', $grville); } } // =============== PERSONNEL EXTERIEUR ========================= $ext = array(); if (isset($profils['EXT']) && $grville && $ville && $ecole && $classe && $visib['USER_EXT']) { $ext = $annuaireService->getPersonnelExt('ROOT', 0); } // =============== PERSONNEL VILLE ========================= $vil = array(); if (isset($profils['VIL']) && $grville && $ville && $visib['USER_VIL']) { if ($ville != $ALL) { // Dans une ville $vil = $annuaireService->getPersonnelVil('BU_VILLE', $ville); } elseif ($ville == $ALL) { // Dans un groupe de villes $vil = $annuaireService->getPersonnelVil('BU_GRVILLE', $grville); } } $droits = array('checkAll' => $annuaireService->canMakeInAnnuaire('POPUP_CHECK_ALL')); $users = array(); foreach ($eleves as $user) { $users[$user->bu_type . '-' . $user->bu_id] = $user; } foreach ($parents as $user) { $users[$user->bu_type . '-' . $user->bu_id] = $user; } foreach ($personnel as $user) { $users[$user->bu_type . '-' . $user->bu_id] = $user; } foreach ($adm as $user) { $users[$user->bu_type . '-' . $user->bu_id] = $user; } foreach ($vil as $user) { $users[$user->bu_type . '-' . $user->bu_id] = $user; } foreach ($ext as $user) { $users[$user->bu_type . '-' . $user->bu_id] = $user; } //_dump($eleves); /* if ('communiquer' === $right) { foreach ($users as $k => $user) { //print_r($user); //$matrix->communiquer(); } } */ usort($users, array('ActionGroupAnnuaire', '_usortPopup')); $tplListe->assign('field', $field); $tplListe->assign('grville', $grville); $tplListe->assign('eleves', $eleves); $tplListe->assign('personnel', $personnel); $tplListe->assign('parents', $parents); $tplListe->assign('ext', $ext); $tplListe->assign('adm', $adm); $tplListe->assign('vil', $vil); $tplListe->assign('profils', $profils); $tplListe->assign('droits', $droits); $tplListe->assign('ville', $ville); $tplListe->assign('ecole', $ecole); $tplListe->assign('classe', $classe); $tplListe->assign('visib', $visib); $tplListe->assign('profil', $profil); $tplListe->assign('users', $users); $tplListe->assign('right', $right); $result = $tplListe->fetch('getpopup.tpl'); $ppo = new CopixPPO(); $ppo->result = $result; $ppo->TITLE_PAGE = CopixI18N::get('annuaire|annuaire.moduleDescription'); CopixHTMLHeader::addJSLink(_resource("js/iconito/module_annuaire.js")); return _arPPO($ppo, array('template' => 'getpopup_ppo.tpl', 'mainTemplate' => 'default|main_popup.php')); }
echo CopixUrl::getResource("js/fancybox/jquery.mousewheel-3.0.4.pack.js"); ?> "></script> <script src="<?php echo CopixUrl::getResource("js/jquery/jquery.bgiframe.js"); ?> " type="text/javascript"></script> <script src="<?php echo CopixUrl::getResource("js/jquery/jquery.tooltip.min.js"); ?> " type="text/javascript"></script> <script type="text/javascript"> <?php $js = enic::get('javascript'); echo $js->display(); ?> </script> <script type="text/javascript"> $(document).ready(function(){ $ = jQuery.noConflict(); /* var theme; // RMQ : getJSON use async mode and we need sync... $.ajax({ url: '<?php echo CopixUrl::getResource("theme.conf.json"); ?> ',
/** * CB 01/06/2010 * Renvoie un tableau avec les droits de l'usager courant sur un noeud renvoye par getUserInfo */ public function getUserInfoMatrix($userInfoCible) { $matrix =& enic::get('matrixCache'); $res = array('voir' => false, 'communiquer' => false); $userCible = array(); /* * Déterminer les noeuds de rattachement du userCible * et ses profils sur chaque noeud * si USER_ENS, vérifier s'il s'agit d'un directeur ou non * $userCible['ecole'] = array (1 => 'USER_DIR') * $userCible['ecole'] = array (1 => 'USER_ENS') * $userCible['classe'] = array (1 => 'USER_ELE') * $userCible['classe'] = array (1 => 'USER_RES') * ... */ foreach ($userInfoCible['link'] as $nodeType => $userInfo) { // ecole | classe | ville | ... if (!isset($userCible[$nodeType])) { $userCible[$nodeType] = array(); } foreach ($userInfo as $nodeId => $role) { switch ($userInfoCible['type']) { case 'USER_ENS': if ($role == 2 && ($nodeType = 'ecole')) { $userCible[$nodeType][$nodeId] = 'USER_DIR'; } else { $userCible[$nodeType][$nodeId] = 'USER_ENS'; } break; case 'USER_EXT': case 'USER_VIL': case 'USER_ELE': case 'USER_ADM': case 'USER_RES': default: $userCible[$nodeType][$nodeId] = $userInfoCible['type']; break; } } } // Sur un USER_EXT, généralement rattaché à rien de l'arbre, on regardera aussi si le user a un droit général sur les USER_EXT if ('USER_EXT' === $userInfoCible['type']) { $userCible['ROOT'][0] = $userInfoCible['type']; } /* * Pour chaque noeud de rattachement / profil du user cible, * vérifie ses droits. */ foreach ($userCible as $nodeType => $userInfo) { foreach ($userInfo as $nodeId => $role) { if ($nodeType == "ROOT" && $nodeId == "0") { $res['communiquer'] = $matrix->villes('other')->_right->{$role}->communiquer ? true : $res['communiquer']; $res['voir'] = $matrix->villes('other')->_right->{$role}->voir ? true : $res['voir']; } else { $res['communiquer'] = $matrix->{$nodeType}($nodeId)->_right->{$role}->communiquer ? true : $res['communiquer']; $res['voir'] = $matrix->{$nodeType}($nodeId)->_right->{$role}->voir ? true : $res['voir']; } } } return $res; }
public function __construct() { $options =& enic::get('options'); $bool = $options->matrix->bypass ? true : false; $this->voir = $bool; $this->communiquer = $bool; }