public function processDefault()
 {
     $tpl = new CopixTpl();
     $tplModule = new CopixTpl();
     //if user is not connected :
     if (1) {
         // S'il y a un blog prevu a l'accueil
         $dispBlog = false;
         $getKernelLimitsIdBlog = Kernel::getKernelLimits('id_blog');
         if ($getKernelLimitsIdBlog) {
             _classInclude('blog|kernelblog');
             if ($blog = _ioDao('blog|blog')->getBlogById($getKernelLimitsIdBlog)) {
                 // On v�rifie qu'il y a au moins un article
                 $stats = KernelBlog::getStats($blog->id_blog);
                 if ($stats['nbArticles']['value'] > 0) {
                     $dispBlog = true;
                 }
             }
         }
         if ($dispBlog) {
             //return CopixActionGroup::process ('blog|frontblog::getListArticle', array ('blog'=>$blog->url_blog));
             return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('blog||', array('blog' => $blog->url_blog)));
         }
         if (!CopixConfig::exists('|can_public_rssfeed') || CopixConfig::get('|can_public_rssfeed')) {
             CopixHtmlHeader::addOthers('<link rel="alternate" href="' . CopixUrl::get('public||rss', array()) . '" type="application/rss+xml" title="' . htmlentities(CopixI18N::get('public|public.rss.flux.title')) . '" />');
         }
         CopixHTMLHeader::addCSSLink(_resource("styles/module_fichesecoles.css"));
         $tplModule->assign('user', _currentUser());
         $result = $tplModule->fetch('welcome|welcome_' . CopixI18N::getLang() . '.tpl');
         $tpl->assign('TITLE_PAGE', '' . CopixI18N::get('public|public.welcome.title'));
         $tpl->assign('MAIN', $result);
         return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl);
     }
 }
 public function _createContent(&$toReturn)
 {
     //load PPO
     $ppo = new CopixPPO();
     $ppo->user = _currentUser();
     //if user is connected : load personal informations
     if ($ppo->user->isConnected()) {
         $ppo->animateur = _sessionGet('user_animateur') ? 1 : 0;
         $ppo->ien = _sessionGet('prisedecontrole_ien') ? 1 : 0;
         $type = $ppo->user->getExtra('type');
         $sexe = $ppo->user->getExtra('sexe') == 2 ? 2 : '';
         $ppo->usertype = strtolower($type) . $sexe;
     }
     // Get vocabulary catalog to use
     if ($myNode = CopixSession::get('myNode')) {
         $nodeVocabularyCatalogDAO = _ioDAO('kernel|kernel_i18n_node_vocabularycatalog');
         $vocabularyCatalog = $nodeVocabularyCatalogDAO->getCatalogForNode($myNode['type'], $myNode['id']);
     }
     $ppo->vocabularyCatalogId = isset($vocabularyCatalog) ? $vocabularyCatalog->id_vc : CopixConfig::get('kernel|defaultVocabularyCatalog');
     $this->addJs('js/iconito/module_auth.js');
     $this->addCss('styles/module_auth.css');
     $ppo->conf_Cas_actif = CopixConfig::exists('default|conf_Cas_actif') ? CopixConfig::get('default|conf_Cas_actif') : 0;
     $ppo->conf_Saml_actif = CopixConfig::exists('default|conf_Saml_actif') ? CopixConfig::get('default|conf_Saml_actif') : 0;
     //load tpl
     $toReturn = $this->_usePPO($ppo, 'userlogged.tpl');
 }
 public function _createContent(&$toReturn)
 {
     $ppo = new CopixPPO();
     // Récupération des paramètres
     $ppo->classeurId = $this->getParam('classeurId');
     $ppo->dossierId = $this->getParam('dossierId');
     $ppo->current = $this->getParam('current');
     // Gestion des droits
     $ppo->niveauUtilisateur = Kernel::getLevel('MOD_CLASSEUR', $ppo->classeurId);
     $ppo->typeUtilisateur = _currentUser()->getExtra('type');
     $ppo->vue = !is_null(_sessionGet('classeur|typeVue')) ? _sessionGet('classeur|typeVue') : 'liste';
     $ppo->conf_ModClasseur_options = CopixConfig::exists('default|conf_ModClasseur_options') ? CopixConfig::get('default|conf_ModClasseur_options') : 0;
     // L'album public est t-il publié ?
     $ppo->estPublic = false;
     if (!is_null($ppo->dossierId) && $ppo->dossierId != 0) {
         $dossierDAO = _ioDAO('classeur|classeurdossier');
         $ppo->dossier = $dossierDAO->get($ppo->dossierId);
         if ($ppo->dossier->public) {
             $ppo->estPublic = true;
         }
     } else {
         $classeurDAO = _ioDAO('classeur|classeur');
         $classeur = $classeurDAO->get($ppo->classeurId);
         if ($classeur->public) {
             $ppo->estPublic = true;
         }
     }
     $toReturn = $this->_usePPO($ppo, '_affichage_menu.tpl');
 }
 public function create($infos = array())
 {
     $blogDAO = _dao('blog|blog');
     $res = null;
     $tabBlogFunctions = returnAllBlogFunctions();
     $blog = _record('blog|blog');
     if ($infos['title']) {
         $blog->name_blog = $infos['title'] . (isset($infos['subtitle']) && strlen($infos['subtitle']) > 0 ? ' (' . $infos['subtitle'] . ')' : '');
     } else {
         $blog->name_blog = CopixI18N::get('blog|blog.default.titre');
     }
     $blog->id_ctpt = 1;
     $blog->style_blog_file = 0;
     $is_public_default = CopixConfig::exists('blog|blog.default.is_public') ? CopixConfig::get('blog|blog.default.is_public') : 1;
     $blog->is_public = isset($infos['is_public']) ? $infos['is_public'] : $is_public_default;
     $blog->has_comments_activated = 0;
     $blog->type_moderation_comments = CopixConfig::get('blog|blog.default.type_moderation_comments');
     $blog->default_format_articles = CopixConfig::get('blog|blog.default.default_format_articles');
     $blog->privacy = CopixConfig::exists('blog|blog.default.privacy') ? CopixConfig::get('blog|blog.default.privacy') : 0;
     $blogDAO->insert($blog);
     if ($blog->id_blog !== NULL) {
         // On détermine l'URL titre
         $blog->url_blog = KernelBlog::calcule_url_blog($blog->id_blog, $blog->name_blog);
         $blogDAO->update($blog);
         // On ajoute une catégorie
         $categoryDAO = _dao('blog|blogarticlecategory');
         $category = _record('blog|blogarticlecategory');
         $category->id_blog = $blog->id_blog;
         $category->name_bacg = CopixI18N::get('blog|blog.default.categorie');
         $category->url_bacg = killBadUrlChars($category->name_bacg) . date('YmdHis');
         $category->order_bacg = $categoryDAO->getNewPos($blog->id_blog);
         $categoryDAO->insert($category);
     }
     return $blog->id_blog !== NULL ? $blog->id_blog : NULL;
 }
 /**
  * apply updates
  */
 function doValid()
 {
     if (isset($this->vars['idFirst']) && isset($this->vars['idSecond']) && isset($this->vars['value']) && CopixConfig::exists($this->vars['idFirst'] . '|' . $this->vars['idSecond'])) {
         $this->vars['id'] = $this->vars['idFirst'] . '|' . $this->vars['idSecond'];
         CopixConfig::set($this->vars['id'], $this->vars['value']);
     }
     return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('parameters||', array('choiceModule' => $this->vars['choiceModule'])));
 }
/**
 * Valeur de la conf pour un parametre
 *
 * @author Christophe Beyer <*****@*****.**>
 * @param string $parameter
 * @since 2009/08/13
 */
function smarty_function_copixconf($params, &$smarty)
{
    $conf = CopixConfig::exists($params['parameter']) ? CopixConfig::get($params['parameter']) : null;
    if (isset($params['assign'])) {
        $assignVar = $params['assign'];
        //unset ($params['assign']);
        $smarty->assign($assignVar, $conf);
        return;
    } else {
        return $conf;
    }
}
 /**
  * Affichage de la fiche d'une ecole
  *
  * @author Christophe Beyer <*****@*****.**>
  * @since 2008/09/03
  * @param integer $id Id de l'ecole
  * @param integer $popup 1 pour afficher la fiche en popup Fancybox
  */
 public function fiche()
 {
     $id = $this->getRequest('id', null);
     $iPopup = CopixRequest::getInt('popup');
     $ecoleDAO = CopixDAOFactory::create('kernel|kernel_bu_ecole');
     $ficheDAO = CopixDAOFactory::create("fiches_ecoles");
     $criticErrors = array();
     if (!($rEcole = $ecoleDAO->get($id))) {
         $criticErrors[] = CopixI18N::get('fichesecoles.error.param');
     } elseif (!FichesEcolesService::canMakeInFicheEcole($id, 'VIEW')) {
         $criticErrors[] = CopixI18N::get('kernel|kernel.error.noRights');
     }
     if ($criticErrors) {
         return CopixActionGroup::process('genericTools|Messages::getError', array('message' => implode('<br/>', $criticErrors), 'back' => CopixUrl::get('annuaire||')));
     }
     $rFiche = $ficheDAO->get($id);
     $tpl = new CopixTpl();
     CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/module_fichesecoles.js');
     $fiche = CopixZone::process('fiche', array('rEcole' => $rEcole, 'rFiche' => $rFiche));
     $main = $fiche;
     $title = $rEcole->nom;
     if ($rEcole->type) {
         $title .= ' (' . $rEcole->type . ')';
     }
     $tpl->assign('TITLE_PAGE', $title);
     // Get vocabulary catalog to use
     $nodeVocabularyCatalogDAO = _ioDAO('kernel|kernel_i18n_node_vocabularycatalog');
     $vocabularyCatalog = $nodeVocabularyCatalogDAO->getCatalogForNode('BU_ECOLE', $rEcole->numero);
     if (strtolower($rEcole->type) == 'crèche') {
         $tpl->assign('TITLE_CONTEXT', CopixI18N::get('kernel|kernel.codes.mod_fichesecoles_creche'));
     } else {
         $tpl->assign('TITLE_CONTEXT', CopixCustomI18N::get('kernel|kernel.codes.mod_fiche%%structure%%', array('catalog' => $vocabularyCatalog->id_vc)));
     }
     $menu = array();
     $menu[] = array('url' => CopixUrl::get('public||getListBlogs'), 'txt' => CopixCustomI18N::get('public|public.blog.annuaire.%%structures%%', array('catalog' => $vocabularyCatalog->id_vc)));
     if (Kernel::is_connected()) {
         $menu[] = array('url' => CopixUrl::get('annuaire||getAnnuaireEcole', array('ecole' => $rEcole->numero)), 'txt' => CopixCustomI18N::get('annuaire|annuaire.back%%structure%%', array('catalog' => $vocabularyCatalog->id_vc)));
     }
     if (CopixConfig::exists('|can_annuaire_menu') && !CopixConfig::get('|can_annuaire_menu')) {
         $menu = array();
     }
     $tpl->assign('MENU', $menu);
     $tpl->assign("MAIN", $main);
     if ($iPopup) {
         $ppo = new CopixPPO();
         $ppo->fiche = $fiche;
         $ppo->TITLE = $title;
         return _arPPO($ppo, array('template' => 'fiche_popup.tpl', 'mainTemplate' => 'main|main_fancy.php'));
     }
     return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl);
 }
 /**
  * Applique les changements sur le paramètre
  */
 public function processValid()
 {
     CopixRequest::assert('idFirst', 'idSecond', 'value');
     // si la config existe bien
     if (CopixConfig::exists(CopixRequest::get('idFirst') . '|' . CopixRequest::get('idSecond'))) {
         // initialisation de variables
         $id = CopixRequest::get('idFirst') . '|' . CopixRequest::get('idSecond');
         $params = CopixConfig::getParams(CopixRequest::get('idFirst'));
         $config = $params[$id];
         $value = CopixRequest::get('value');
         $error = false;
         // type int
         if ($config['Type'] == 'int') {
             // chiffre invalide
             if ((string) intval($value) != (string) $value) {
                 $error = 'typeInt';
                 // chiffre trop petit
             } elseif (!is_null($config['MinValue']) && $config['MinValue'] > intval($value)) {
                 $error = 'typeIntMin';
                 // chiffre trop grand
             } elseif (!is_null($config['MaxValue']) && $config['MaxValue'] < intval($value)) {
                 $error = 'typeIntMax';
             }
             // type email
         } elseif ($config['Type'] == 'email') {
             // email invalide
             try {
                 CopixFormatter::getMail($value);
             } catch (CopixException $e) {
                 $error = 'typeEmail';
             }
             // e-mail trop long
             if (!is_null($config['MaxLength']) && strlen($value) > $config['MaxLength']) {
                 $error = 'typeEmailMax';
             }
             // type text
         } elseif ($config['Type'] == 'text') {
             // texte trop long
             if (!is_null($config['MaxLength']) && strlen($value) > $config['MaxLength']) {
                 $error = 'typeTextMax';
             }
         }
         // si il y a eu une erreur
         if ($error !== false) {
             return _arRedirect(_url('admin|parameters|', array('choiceModule' => CopixRequest::get('choiceModule'), 'editParam' => CopixRequest::get('idSecond'), 'error' => $error)));
         }
         // modification de la config
         CopixConfig::set($id, $value);
     }
     return _arRedirect(_url('admin|parameters|', array('choiceModule' => CopixRequest::get('choiceModule'))));
 }
 /**
  * Test de lecture d'un paramètre existant
  */
 public function testRead()
 {
     CopixConfig::get('default|mailEnabled');
     CopixConfig::get('|mailEnabled');
     $this->assertEquals(CopixConfig::get('|mailEnabled'), CopixConfig::get('default|mailEnabled'));
     CopixConfig::get('copixtest|test');
     try {
         CopixConfig::get('copixtest|parametreBidon');
         $this->fail('Aucune exception de générée pour un paramètre inexistant');
     } catch (CopixException $e) {
     }
     $this->assertFalse(CopixConfig::exists('|parametreBidon'));
     $this->assertTrue(CopixConfig::exists('default|mailEnabled'));
 }
 public function canSsoGael()
 {
     if (!Kernel::isEnseignant() && !Kernel::isAgentVille()) {
         return false;
     }
     if (!CopixConfig::exists('|urlGael') || trim(CopixConfig::get('|urlGael')) == '') {
         return false;
     }
     $mysession = Kernel::getSessionBU();
     if (trim($mysession['cle_privee']) == '') {
         return false;
     }
     return true;
 }
 /**
  * Pour le dashboard, zone affichant le lien vers l'annuaire des groupes, et le bouton pour creer un groupe
  *
  * @author Christophe Beyer <*****@*****.**>
  * @since 2010/06/11
  */
 public function _createContent(&$toReturn)
 {
     $groupeService =& CopixClassesFactory::Create('groupe|groupeService');
     $tpl = new CopixTpl();
     //$tpl->assign ('list', $groupes);
     $tpl->assign('canCreate', $groupeService->canMakeInGroupe('ADD_GROUP', NULL) ? 1 : 0);
     if (!CopixConfig::exists('|can_group_showlist') || CopixConfig::get('|can_group_showlist')) {
         $tpl->assign('can_group_showlist', 1);
     } else {
         $tpl->assign('can_group_showlist', 0);
     }
     $toReturn = $tpl->fetch('dashboardgroups.tpl');
     return true;
 }
 /**
  * Vide la table des configurations sauf exceptions
  *
  * @author Frederic Mossmann <*****@*****.**>
  * @since 2007/01/19
  */
 public function clearConfDB()
 {
     $sauvegarde = array('kernel|jeuEssaiInstalled');
     $saved_data = array();
     reset($sauvegarde);
     foreach ($sauvegarde as $saved_key) {
         if (CopixConfig::exists($saved_key)) {
             $saved_data[$saved_key] = CopixConfig::get($saved_key);
         }
     }
     $sql = "DELETE FROM copixconfig";
     _doQuery($sql);
     foreach ($saved_data as $saved_key => $saved_val) {
         CopixConfig::set($saved_key, $saved_val);
     }
 }
 public function beforeProcess(&$action)
 {
     if (CopixConfig::get('conf_Saml_actif') != 1) {
         return;
     }
     require_once COPIX_UTILS_PATH . '../../simplesamlphp/lib/_autoload.php';
     $asId = 'iconito-sql';
     if (CopixConfig::exists('default|conf_Saml_authSource') && CopixConfig::get('default|conf_Saml_authSource')) {
         $asId = CopixConfig::get('default|conf_Saml_authSource');
     }
     $as = new SimpleSAML_Auth_Simple($asId);
     $ppo->user = _currentUser();
     if ($as->isAuthenticated() && !$ppo->user->isConnected()) {
         $attributes = $as->getAttributes();
         $uidAttribute = 'login_dbuser';
         if (CopixConfig::exists('default|conf_Saml_uidAttribute') && CopixConfig::get('default|conf_Saml_uidAttribute')) {
             $uidAttribute = CopixConfig::get('default|conf_Saml_uidAttribute');
         }
         $ppo->saml_user = null;
         if (isset($attributes[$uidAttribute]) && isset($attributes[$uidAttribute][0])) {
             $ppo->saml_user = $attributes[$uidAttribute][0];
         }
         if ($ppo->saml_user) {
             $ppo->iconito_user = Kernel::getUserInfo("LOGIN", $ppo->saml_user);
             if ($ppo->iconito_user['login']) {
                 _currentUser()->login(array('login' => $ppo->iconito_user['login'], 'assistance' => true));
                 $url_return = CopixUrl::get('kernel||doSelectHome');
                 // $url_return = CopixUrl::get ('assistance||users');
                 return new CopixActionReturn(COPIX_AR_REDIRECT, $url_return);
             } else {
                 $ppo->cas_error = 'no-iconito-user';
                 return _arPpo($ppo, 'cas.tpl');
             }
         }
     }
     if (!$as->isAuthenticated() && $ppo->user->isConnected()) {
         $ppo->user = _currentUser();
         if ($ppo->user->isConnected()) {
             CopixAuth::getCurrentUser()->logout(array());
             CopixEventNotifier::notify('logout', array('login' => CopixAuth::getCurrentUser()->getLogin()));
             CopixAuth::destroyCurrentUser();
             CopixSession::destroyNamespace('default');
         }
     }
 }
 public function beforeAction()
 {
     _currentUser()->assertCredential('group:[current_user]');
     $this->menu = array();
     if (Kernel::isAdmin() || _currentUser()->hasAssistance('can_comptes')) {
         if (CopixConfig::exists('kernel|gestionAutonomeEnabled') && CopixConfig::get('kernel|gestionAutonomeEnabled')) {
             $this->menu[] = array('txt' => CopixI18N::get('comptes|comptes.menu.getUsers'), 'url' => CopixUrl::get('gestionautonome||showTree'), 'type' => 'users');
         } else {
             $this->menu[] = array('txt' => CopixI18N::get('comptes|comptes.menu.getUsers'), 'url' => CopixUrl::get('comptes||'), 'type' => 'users');
         }
         $this->menu[] = array('txt' => CopixI18N::get('comptes|comptes.menu.getExt'), 'url' => CopixUrl::get('comptes||getUserExt'), 'type' => 'acl');
     }
     if (Kernel::isAdmin()) {
         $this->menu[] = array('txt' => CopixI18N::get('comptes|comptes.menu.getRoles'), 'url' => CopixUrl::get('comptes||getRoles'), 'type' => 'acl', 'current' => 'current');
         $this->menu[] = array('txt' => CopixI18N::get('comptes|comptes.menu.manageGrades'), 'url' => CopixUrl::get('gestionautonome||manageGrades'), 'type' => 'agendalist');
     }
     //CopixHTMLHeader::addCSSLink (_resource("styles/module_comptes.css"));
 }
 /**
  * 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 processRedirect()
 {
     $accept = $this->request('typeAction') == 'accept' ? true : false;
     CopixHTMLHeader::addCSSLink(_resource("styles/module_charte.css"));
     if ($accept) {
         $typeUser = isset($this->flash->userType) ? $this->flash->userType : 'USER_ALL';
         $this->service('CharteService')->addUserValidation($typeUser);
         $_SESSION['chartValid'] = true;
         return $this->go(isset($this->flash->redirect) ? $this->flash->redirect : '||');
     } else {
         $ppo = new CopixPPO();
         if (CopixConfig::exists('default|conf_Saml_actif') && CopixConfig::get('default|conf_Saml_actif')) {
             $ppo->conf_Saml_actif = true;
         } else {
             $ppo->conf_Saml_actif = false;
         }
         return _arPPO($ppo, 'charte.no.tpl');
     }
 }
 public function beforeAction()
 {
     _currentUser()->assertCredential('group:[current_user]');
     $this->menu = array();
     if (Kernel::isAdmin() || _currentUser()->hasAssistance('can_comptes')) {
         if (CopixConfig::exists('kernel|gestionAutonomeEnabled') && CopixConfig::get('kernel|gestionAutonomeEnabled')) {
             $this->menu[] = array('txt' => CopixI18N::get('comptes|comptes.menu.getUsers'), 'url' => CopixUrl::get('gestionautonome||showTree'), 'type' => 'users');
         } else {
             $this->menu[] = array('txt' => CopixI18N::get('comptes|comptes.menu.getUsers'), 'url' => CopixUrl::get('comptes||'), 'type' => 'users');
         }
         $this->menu[] = array('txt' => CopixI18N::get('comptes|comptes.menu.getExt'), 'url' => CopixUrl::get('comptes||getUserExt'), 'type' => 'acl');
     }
     if (Kernel::isAdmin()) {
         $this->menu[] = array('txt' => CopixI18N::get('comptes|comptes.menu.getRoles'), 'url' => CopixUrl::get('comptes||getRoles'), 'type' => 'acl', 'current' => 'current');
         $this->menu[] = array('txt' => CopixI18N::get('comptes|comptes.menu.manageGrades'), 'url' => CopixUrl::get('gestionautonome||manageGrades'), 'type' => 'agendalist');
     }
     $session = _sessionGet('modules|comptes|doLoginCreate|success');
     if ($session && is_array($session) && sizeof($session)) {
         $this->menu[] = array('txt' => CopixI18N::get('comptes.strings.showloginresult', sizeof($session)), 'url' => CopixUrl::get('comptes||getLoginResult'), 'size' => 145);
     }
 }
 public function _createContent(&$toReturn)
 {
     $ppo = new CopixPPO();
     // Récupération des paramètres
     $ppo->nodeId = $this->getParam('nodeId');
     $ppo->nodeType = $this->getParam('nodeType');
     $ppo->studentId = $this->getParam('studentId');
     $ppo->user = _currentUser();
     // Récupérations des responsables de l'élève
     $personsInChargeDAO = _ioDAO('kernel|kernel_bu_res');
     $ppo->persons = $personsInChargeDAO->getByStudent($ppo->studentId);
     // Fonctionnalité de rattachement de parents à un élève activé ?
     $ppo->personInChargeLinkingEnabled = false;
     if (CopixConfig::exists('gestionautonome|personInChargeLinkingEnabled') && CopixConfig::get('gestionautonome|personInChargeLinkingEnabled')) {
         $ppo->personInChargeLinkingEnabled = true;
     }
     // Get vocabulary catalog to use
     $nodeVocabularyCatalogDAO = _ioDAO('kernel|kernel_i18n_node_vocabularycatalog');
     $ppo->vocabularyCatalog = $nodeVocabularyCatalogDAO->getCatalogForNode($ppo->nodeType, $ppo->nodeId);
     $toReturn = $this->_usePPO($ppo, '_persons_in_charge.tpl');
 }
 /**
  * Affiche la liste des blogs
  *
  * @author Christophe Beyer <*****@*****.**>
  * @since 2006/03/09
  * @todo Positionner $grville
  */
 public function processGetListBlogs()
 {
     if (!CopixConfig::exists('|can_public_rssfeed') || CopixConfig::get('|can_public_rssfeed')) {
         CopixHtmlHeader::addOthers('<link rel="alternate" href="' . CopixUrl::get('public||rss', array()) . '" type="application/rss+xml" title="' . htmlentities(CopixI18N::get('public|public.rss.flux.title')) . '" />');
     }
     CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/module_annuaire.js');
     $tpl = new CopixTpl();
     $tpl->assign('TITLE_PAGE', CopixI18N::get('public|public.blog.annuaire'));
     $kw = $this->getRequest('kw', null);
     $grville = 1;
     $tplListe = new CopixTpl();
     if ($ville_as_array = Kernel::getKernelLimits('ville_as_array')) {
         $tplListe->assign('list', CopixZone::process('GetListBlogs2', array('kw' => $kw, 'ville' => $ville_as_array)));
     } else {
         $tplListe->assign('list', CopixZone::process('GetListBlogs2', array('kw' => $kw, 'grville' => $grville)));
     }
     $tplListe->assign('kw', $kw);
     $result = $tplListe->fetch("getlistblogs.tpl");
     $tpl->assign("MAIN", $result);
     return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl);
 }
 public function getPrefs($data = null)
 {
     $toReturn = array();
     $toReturn['name'] = CopixI18N::get('prefs.string.generalprefs');
     $toReturn['form'][] = array('type' => 'titre', 'text' => CopixI18N::get('prefs.config.passwd.title'), 'expl' => CopixI18N::get('prefs.config.passwd.expl'));
     $toReturn['form'][] = array('code' => 'passwd1', 'type' => 'password', 'text' => CopixI18N::get('prefs.config.passwd1.input'), 'value' => '');
     $toReturn['form'][] = array('code' => 'passwd2', 'type' => 'password', 'text' => CopixI18N::get('prefs.config.passwd2.input'), 'value' => '');
     if (!CopixConfig::exists('|can_pref_assistance_animtice') || CopixConfig::get('|can_pref_assistance_animtice')) {
         $toReturn['form'][] = array('type' => 'titre', 'text' => CopixI18N::get('prefs.config.assistance.title'), 'expl' => CopixI18N::get('prefs.config.assistance.expl'));
         $toReturn['form'][] = array('code' => 'assistance', 'type' => 'checkbox', 'text' => CopixI18N::get('prefs.config.assistance'), 'value' => isset($data['assistance']) && $data['assistance'] ? true : false);
     }
     if (!CopixConfig::exists('|can_pref_assistance_ien') || CopixConfig::get('|can_pref_assistance_ien')) {
         $user_infos = Kernel::getUserInfo();
         if ($user_infos['type'] == 'USER_ENS') {
             $toReturn['form'][] = array('type' => 'titre', 'text' => CopixI18N::get('prefs.config.ien.title'), 'expl' => CopixI18N::get('prefs.config.ien.expl'));
             $toReturn['form'][] = array('code' => 'assistance_ien', 'type' => 'checkbox', 'text' => CopixI18N::get('prefs.config.ien'), 'value' => isset($data['assistance_ien']) && $data['assistance_ien'] ? true : false);
         }
     }
     $toReturn['form'][] = array('type' => 'titre', 'text' => CopixI18N::get('prefs.config.avatar.title'), 'expl' => CopixI18N::get('prefs.config.avatar.expl'));
     $avatar = Prefs::get('prefs', 'avatar');
     if ($avatar) {
         $avatar_url = 'static/prefs/avatar/' . $avatar;
         $toReturn['form'][] = array('type' => 'image', 'text' => CopixI18N::get('prefs.config.avatar.image'), 'value' => $avatar_url);
     }
     $toReturn['form'][] = array('code' => 'avatar_upload', 'type' => 'upload', 'text' => CopixI18N::get('prefs.config.avatar.upload'), 'value' => isset($data['nom']) ? $data['nom'] : _currentUser()->getExtra('nom'));
     if ($avatar) {
         $toReturn['form'][] = array('code' => 'avatar_delete', 'type' => 'checkbox', 'text' => CopixI18N::get('prefs.config.avatar.delete'), 'value' => false);
     }
     /////////////////////////// ALERTE MAIL ///////////////////////////
     $toReturn['form'][] = array('type' => 'titre', 'text' => CopixI18N::get('prefs.config.mail.title'), 'expl' => CopixI18N::get('prefs.config.mail.expl'));
     /*
     $toReturn['form'][] = array(
             'code'=>'alerte_mail_active',
             'type'=>'checkbox',
             'text'=>CopixI18N::get ('prefs.config.mail.alerte_mail_active'), // 'Souhaitez-vous être alerté par un email à chaque fois que vous recevez un minimail ?',
             'value'=>($data['alerte_mail_active']?true:false) );
     */
     $toReturn['form'][] = array('code' => 'alerte_mail_email', 'type' => 'string', 'text' => CopixI18N::get('prefs.config.mail.alerte_mail_email'), 'value' => isset($data['alerte_mail_email']) ? $data['alerte_mail_email'] : '');
     return $toReturn;
 }
 /**
  * Affiche la liste des groupes de l'utilisateur courant
  *
  * @author Christophe Beyer <*****@*****.**>
  * @since 2006/03/23
  * @param string $kw Mot-clé pour la recherche (option)
  */
 public function _createContent(&$toReturn)
 {
     $toReturn = '';
     $tpl = new CopixTpl();
     if (CopixConfig::exists('|conf_ModConcerto') && CopixConfig::get('|conf_ModConcerto') && _currentUser()->getExtra('type') == 'USER_RES') {
         $new_module = null;
         $sql = 'SELECT id,login,password FROM kernel_bu_auth WHERE node_type=\'responsable\' AND node_id=' . _currentUser()->getExtra('id') . ' AND service=\'concerto\'';
         $concerto = _doQuery($sql);
         if ($concerto) {
             $new_module = _record("kernel|kernel_mod_enabled");
             $new_module->node_type = _currentUser()->getExtra('type');
             $new_module->node_id = _currentUser()->getExtra('id');
             $new_module->module_type = "MOD_CONCERTO";
             $new_module->module_id = 0;
             $modules[] = $new_module;
             $tpl->assign('concerto', $new_module);
             $tpl->assign('concerto_data', $concerto);
             $toReturn = $tpl->fetch('concerto|concerto-home.tpl');
         }
     }
     return true;
 }
 public function processDefault()
 {
     $ppo = new CopixPPO();
     $ppo->visio = new CopixPPO();
     $ppo->error = "";
     $user_from = Kernel::getUserInfo("ME", 0);
     $ppo->login_to = $this->request('login', 'str');
     $ppo->login_from = $user_from['login'];
     $ppo->visio->red5 = CopixConfig::exists('default|conf_ModVisio_url') ? CopixConfig::get('default|conf_ModVisio_url') : '';
     $ppo->visio->secondsToWait = CopixConfig::exists('visio|conf_secondsToWait') ? CopixConfig::get('visio|conf_secondsToWait') : 30;
     $ppo->visio->secondsToRetry = CopixConfig::exists('visio|conf_secondsToRetry') ? CopixConfig::get('visio|conf_secondsToRetry') : 60;
     $ppo->visio->textColor = CopixConfig::exists('visio|conf_textColor') ? CopixConfig::get('visio|conf_textColor') : "#FF0000";
     $ppo->visio->textOverColor = CopixConfig::exists('visio|conf_textOverColor') ? CopixConfig::get('visio|conf_textOverColor') : "#00FF00";
     $ppo->visio->infoTextColor = CopixConfig::exists('visio|conf_infoTextColor') ? CopixConfig::get('visio|conf_infoTextColor') : "#0000FF";
     $ppo->visio->bandwidth = CopixConfig::exists('visio|conf_bandwidth') ? CopixConfig::get('visio|conf_bandwidth') : 0;
     $ppo->visio->videoQuality = CopixConfig::exists('visio|conf_videoQuality') ? CopixConfig::get('visio|conf_videoQuality') : 95;
     $ppo->visio->motionLevel = CopixConfig::exists('visio|conf_motionLevel') ? CopixConfig::get('visio|conf_motionLevel') : 60;
     $ppo->visio->motionTimeout = CopixConfig::exists('visio|conf_motionTimeout') ? CopixConfig::get('visio|conf_motionTimeout') : 1500;
     $ppo->visio->keyFrameInterval = CopixConfig::exists('visio|conf_keyFrameInterval') ? CopixConfig::get('visio|conf_keyFrameInterval') : 15;
     $ppo->visio->useEchoSuppression = CopixConfig::exists('visio|conf_useEchoSuppression') ? CopixConfig::get('visio|conf_useEchoSuppression') : 'on';
     $ppo->visio->bufferTime = CopixConfig::exists('visio|conf_bufferTime') ? CopixConfig::get('visio|conf_bufferTime') : 0;
     $ppo->visio->useSpeex = CopixConfig::exists('visio|conf_useSpeex') ? CopixConfig::get('visio|conf_useSpeex') : 'off';
     $ppo->visio->microSilenceLevel = CopixConfig::exists('visio|conf_microSilenceLevel') ? CopixConfig::get('visio|conf_microSilenceLevel') : 20;
     $ppo->visio->microSilenceTimeout = CopixConfig::exists('visio|conf_microSilenceTimeout') ? CopixConfig::get('visio|conf_microSilenceTimeout') : -1;
     $ppo->visio->microSetLoopBack = CopixConfig::exists('visio|conf_microSetLoopBack') ? CopixConfig::get('visio|conf_microSetLoopBack') : 'false';
     $ppo->visio->microGain = CopixConfig::exists('visio|conf_microGain') ? CopixConfig::get('visio|conf_microGain') : 50;
     $ppo->visio->speexEncodeQuality = CopixConfig::exists('visio|conf_speexEncodeQuality') ? CopixConfig::get('visio|conf_speexEncodeQuality') : 6;
     if ($ppo->login_to) {
         $user_to = Kernel::getUserInfo("LOGIN", $ppo->login_to);
         if ($user_to) {
             return _arPPO($ppo, 'visio.tpl');
         } else {
             $ppo->error = "Login inconnu";
         }
     }
     return _arPPO($ppo, 'default.tpl');
 }
 public function loadXml()
 {
     if (!is_null($myNode = _sessionGet('myNode'))) {
         $ppo = new CopixPPO();
         $ppo->targetId = $myNode['id'];
         $ppo->targetType = $myNode['type'];
         $ppo->myNodeInfos = Kernel::getNodeInfo($myNode['type'], $myNode['id']);
         if ($ppo->targetType == "BU_CLASSE") {
             $ppo->url_classe = urlencode($ppo->myNodeInfos['nom']);
             $ppo->siret_ecole = $ppo->myNodeInfos['ALL']->eco_siret;
         }
     }
     $this->rssUrl = $this->helpers->config('rssetagere|rss_url');
     // $this->rssUrl = $this->rssUrl.'?classe='.$ppo->url_classe.'&siren='.$ppo->url_ecole.($ppo->targetType=="BU_CLASSE"?'&classeId='.$ppo->targetId:'');
     $this->rssUrl = $this->rssUrl . '?siren=' . $ppo->siret_ecole . ($ppo->targetType == "BU_CLASSE" ? '&classe=' . $ppo->targetId : '');
     if (CopixConfig::exists('default|rssEtagereEnt') && ($ent = CopixConfig::get('default|rssEtagereEnt'))) {
         $this->rssUrl .= '&ent=' . urlencode($ent);
     }
     $this->xml = @simplexml_load_file($this->rssUrl);
     if ($this->xml == false) {
         return false;
     }
     return true;
 }
 /**
  * Affiche la liste des groupes de l'utilisateur courant
  *
  * @author Christophe Beyer <*****@*****.**>
  * @since 2006/03/23
  * @param string $kw Mot-clé pour la recherche (option)
  */
 public function _createContent(&$toReturn)
 {
     $where = $this->getParam('where', 'home');
     $dao = _dao("groupe");
     $kernel_service =& CopixClassesFactory::Create('kernel|kernel');
     $groupeService =& CopixClassesFactory::Create('groupe|groupeService');
     $groupesAll = $dao->getListAll();
     //print_r($groupesAll);
     // Parcours de chaque groupe
     $groupes = array();
     foreach ($groupesAll as $k => $gr) {
         if (CopixConfig::exists('kernel|groupeAssistance') && ($groupeAssistance = CopixConfig::get('kernel|groupeAssistance')) && $gr->id == $groupeAssistance) {
             continue;
         }
         $mondroit = $kernel_service->getLevel("CLUB", $groupesAll[$k]->id);
         //print_r($mondroit."-".PROFILE_CCV_READ);
         // Affichage sur la page d'accueil limité aux groupes dont on est admin.
         // if( $where=='home' && $mondroit<70 ) continue;
         //print_r($mondroit);
         if ($groupeService->canMakeInGroupe('VIEW_HOME', $mondroit)) {
             $groupesAll[$k]->mondroit = $mondroit;
             $groupesAll[$k]->mondroitnom = $groupeService->getRightName($mondroit);
             $userInfo = $kernel_service->getUserInfo("ID", $groupesAll[$k]->createur);
             $groupesAll[$k]->createur_nom = $userInfo["prenom"] . " " . $userInfo["nom"];
             $groupesAll[$k]->createur_infos = $userInfo;
             $members = $groupeService->getNbMembersInGroupe($groupesAll[$k]->id);
             $groupesAll[$k]->inscrits = $members['inscrits'];
             $groupesAll[$k]->canViewHome = 1;
             $blog = $groupeService->getGroupeBlog($groupesAll[$k]->id);
             if ($blog && ($blog->is_public || $groupeService->canMakeInGroupe('VIEW_HOME', $mondroit))) {
                 $groupesAll[$k]->blog = $blog;
             }
             $groupesAll[$k]->canAdmin = $groupeService->canMakeInGroupe('ADMIN', $mondroit);
             $groupes[] = $groupesAll[$k];
             //print_r($groupesAll[$k]);
         }
     }
     //$groupes = array_reverse ($groupes, true);
     //print_r($groupes);
     //print_r($where);
     $tpl = new CopixTpl();
     $tpl->assign('list', $groupes);
     if ($where == 'groupes') {
         $toReturn = $tpl->fetch('zonemygroupes.tpl');
     } elseif ($where == 'home') {
         if (CopixConfig::exists('|conf_ModConcerto') && CopixConfig::get('|conf_ModConcerto') && _currentUser()->getExtra('type') == 'USER_RES') {
             $new_module = null;
             $sql = 'SELECT id,login,password FROM kernel_bu_auth WHERE node_type=\'responsable\' AND node_id=' . _currentUser()->getExtra('id') . ' AND service=\'concerto\'';
             $concerto = _doQuery($sql);
             if ($concerto) {
                 $new_module = _record("kernel|kernel_mod_enabled");
                 $new_module->node_type = _currentUser()->getExtra('type');
                 $new_module->node_id = _currentUser()->getExtra('id');
                 $new_module->module_type = "MOD_CONCERTO";
                 $new_module->module_id = 0;
                 $modules[] = $new_module;
             }
             $tpl->assign('concerto', $new_module);
             $tpl->assign('concerto_data', $concerto);
         }
         $toReturn = $tpl->fetch('zonemygroupes_home.tpl');
     }
     return true;
 }
Пример #25
0
 /**
  * DÈtermine si Iconito est en mode "dÈmo" (accËs limitÈ et auto-login).
  *
  * @author FrÈdÈric Mossmann <*****@*****.**>
  * @since 2006/11/23
  * @return bool True si Iconito est en mode "dÈmo" (cf. config |isdemo)
  */
 public function isDemo()
 {
     return CopixConfig::exists('default|isDemo') && CopixConfig::get('default|isDemo');
 }
 /**
  * Récupère la liste des derniers articles publiés dans des blogs publics. A utiliser pour des flux RSS ou des zones de la Une
  *
  * @author Christophe Beyer <*****@*****.**>
  * @since 2012/02/21
  * @param array $options
  *      [nb] Nombre d'éléments à afficher
  *      [categories] Pour ajouter les catégories de chaque article
  *      [parent] Pour récupérer les infos sur le parent du blog
  *      [blogId] Pour limiter à un blog précis
  *      [future] Pour afficher ou non les articles post-datés (true par défaut)
  *
  */
 public function findPublic($options = array())
 {
     $limit = isset($options['nb']) && $options['nb'] ? $options['nb'] : 10;
     $arTypes = array();
     if (CopixConfig::exists('public|blogs.types') && CopixConfig::get('public|blogs.types')) {
         $arTypes = explode(",", CopixConfig::get('public|blogs.types'));
     }
     $arTypes[] = 'CLUB';
     $params = array();
     $critere = 'SELECT ART.id_bact, ART.name_bact, ART.url_bact, ART.date_bact, ART.time_bact, ART.sumary_bact, ART.sumary_html_bact, BLOG.url_blog, KME.node_type AS parent_type, KME.node_id AS parent_id FROM module_blog BLOG, module_blog_article ART, kernel_mod_enabled KME WHERE ART.id_blog=BLOG.id_blog AND KME.module_id=BLOG.id_blog AND KME.module_type=\'MOD_BLOG\' AND BLOG.is_public=1 AND ART.is_online=1';
     $blogId = isset($options['blogId']) && $options['blogId'] ? (int) $options['blogId'] : 0;
     $future = isset($options['future']) ? $options['future'] : true;
     if ($blogId) {
         $critere .= ' AND ART.id_blog = :blogId';
         $params['blogId'] = $blogId;
     } else {
         $critere .= ' AND KME.node_type IN (\'' . implode('\',\'', $arTypes) . '\')';
     }
     if (!$future) {
         $critere .= ' AND (ART.date_bact < :today1 OR (ART.date_bact = :today2 AND ART.time_bact <= :now))';
         $params['today1'] = $params['today2'] = date('Ymd');
         $params['now'] = date('Hi');
     }
     $critere .= ' ORDER BY ART.date_bact DESC, ART.time_bact DESC, ART.id_bact ASC';
     if (!$blogId && Kernel::getKernelLimits('ville')) {
         $critere .= ' LIMIT ' . $limit * 10;
     } else {
         $critere .= ' LIMIT ' . $limit;
     }
     $list = _doQuery($critere, $params);
     $arArticle = array();
     foreach ($list as $article) {
         $add = true;
         if (!$blogId) {
             switch ($article->parent_type) {
                 case 'CLUB':
                     if (Kernel::getKernelLimits('ville')) {
                         $ville = GroupeService::getGroupeVille($article->parent_id);
                         if (!in_array($ville, Kernel::getKernelLimits('ville_as_array'))) {
                             $add = false;
                         }
                     }
                     break;
             }
         }
         if (isset($options['categories']) && $options['categories']) {
             $sp = _daoSp();
             $sp->addCondition('id_bact', '=', $article->id_bact);
             $article->categories = array();
             foreach (_ioDAO('blog|blogarticle_blogarticlecategory')->findBy($sp) as $object) {
                 $article->categories[] = _ioDAO('blog|blogarticlecategory')->get($object->id_bacg);
             }
         }
         $date = array();
         $date['Y'] = substr($article->date_bact, 0, 4);
         $date['m'] = substr($article->date_bact, 4, 2);
         $date['d'] = substr($article->date_bact, 6, 2);
         $date['H'] = substr($article->time_bact, 0, 2);
         $date['i'] = substr($article->time_bact, 2, 2);
         $article->dateRFC822 = gmdate('D, d M Y H:i:s', mktime($date['H'], $date['i'], 0, $date['m'], $date['d'], $date['Y'])) . ' GMT';
         if ($add) {
             if (!isset($options['parent']) || $options['parent']) {
                 $article->parent = Kernel::getNodeInfo($article->parent_type, $article->parent_id);
             }
             $arArticle[] = $article;
         }
     }
     if (!$blogId && Kernel::getKernelLimits('ville')) {
         $arArticle = array_slice($arArticle, 0, $limit);
     }
     return $arArticle;
 }
 public function hasAssistance($check = '')
 {
     if (!CopixConfig::exists('|can_pref_assistance') || CopixConfig::get('|can_pref_assistance')) {
     } else {
         return false;
     }
     $animateur_dao = _dao("kernel|kernel_animateurs");
     $animateur = $animateur_dao->get($this->getExtra('type'), $this->getExtra('id'));
     $ien_dao = _dao("kernel|kernel_ien");
     $ien = $ien_dao->get($this->getExtra('type'), $this->getExtra('id'));
     if ($animateur) {
         switch ($check) {
             case 'all':
                 return $animateur;
                 break;
             case 'can_connect':
                 return $animateur->can_connect ? true : false;
                 break;
             case 'can_tableaubord':
                 return $animateur->can_tableaubord ? true : false;
                 break;
             case 'can_comptes':
                 return $animateur->can_comptes ? true : false;
                 break;
             case 'is_visibleannuaire':
                 return $animateur->is_visibleannuaire ? true : false;
                 break;
             default:
                 return true;
                 break;
         }
     } elseif ($ien) {
         switch ($check) {
             case 'all':
                 return $ien;
                 break;
             case 'can_connect':
                 return $ien->can_connect ? true : false;
                 break;
             case 'can_tableaubord':
                 return $ien->can_tableaubord ? true : false;
                 break;
             case 'can_comptes':
                 return $ien->can_comptes ? true : false;
                 break;
             case 'is_visibleannuaire':
                 return $ien->is_visibleannuaire ? true : false;
                 break;
             default:
                 return true;
                 break;
         }
     } else {
         return false;
     }
 }
 public function processDefault()
 {
     _classInclude('classeur|classeurService');
     $classeurDAO = _ioDAO('classeur|classeur');
     $dossierDAO = _ioDAO('classeur|classeurdossier');
     $ppo->conf_ModClasseur_upload = CopixConfig::exists('default|conf_ModClasseur_upload') ? CopixConfig::get('default|conf_ModClasseur_upload') : 0;
     if (is_null($ppo->classeur = $classeurDAO->get(_request('classeurId', null)))) {
         return CopixActionGroup::process('generictools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.errorOccurred'), 'back' => CopixUrl::get('', array('error' => 'classeur_not_found'))));
     }
     if (!realpath('./upload')) {
         return CopixActionGroup::process('generictools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.errorOccurred'), 'back' => CopixUrl::get('', array('error' => 'upload_folder_not_found'))));
     }
     if ($ppo->save->mode = _request('save-mode', null)) {
         switch ($ppo->save->mode) {
             case 'upload':
                 $ppo->save->ok = true;
                 $ppo->save->error = '';
                 $ppo->save->folder_input = _request('destination', 0);
                 if (!preg_match('/dossier-(?P<folder>\\d+)/', $ppo->save->folder_input, $matches)) {
                     $ppo->save->ok = false;
                     $ppo->save->error = '-ERR destination';
                     break;
                 }
                 $ppo->save->folder_id = $matches['folder'];
                 if ($ppo->classeur->upload_fs) {
                     $dir = realpath('.') . '/upload/' . $ppo->classeur->upload_fs . '/';
                     if (is_dir($dir)) {
                         $this->rrmdir($dir);
                     }
                 }
                 $ppo->classeur->upload_db = $ppo->save->folder_id;
                 $ppo->classeur->upload_fs = 'classeur-' . $ppo->classeur->id;
                 if (!$ppo->classeur->upload_pw) {
                     $ppo->classeur->upload_pw = substr(md5($ppo->classeur->id . $ppo->save->folder_id . $ppo->classeur->cle . date('YmdHis')), 0, 8);
                 }
                 $classeurDAO->update($ppo->classeur);
                 // Création du répertoire
                 $dir = realpath('.') . '/upload/' . $ppo->classeur->upload_fs . '/';
                 if (!file_exists($dir)) {
                     mkdir($dir, 0755, true);
                     $htaccess = fopen($dir . '.htaccess', 'w');
                     fwrite($htaccess, "<Limit GET HEAD OPTIONS POST>\n\trequire user " . $ppo->classeur->upload_fs . "\n</Limit>\n<Files .htaccess>\n\torder allow,deny\n\tdeny from all\n</Files>\n");
                     fclose($htaccess);
                 }
                 // Génération du fichier .htpasswd
                 $htpasswd_file = realpath('.') . '/upload/.htpasswd';
                 $htpasswd_output = '';
                 $in = fopen($htpasswd_file, 'r');
                 $htpasswd_updated = false;
                 if ($in) {
                     while (preg_match("/:/", $line = fgets($in))) {
                         $line = rtrim($line);
                         $a = explode(':', $line);
                         if ($a[0] != 'classeur-' . $ppo->classeur->id) {
                             $htpasswd_output .= $line . "\n";
                         }
                     }
                 }
                 $htpasswd_salt = substr(str_shuffle("abcdefghijklmnopqrstuvwxyz0123456789"), 0, 2);
                 $htpasswd_output .= $ppo->classeur->upload_fs . ":" . crypt($ppo->classeur->upload_pw, $htpasswd_salt) . "\n";
                 fclose($in);
                 $out = fopen($htpasswd_file, 'w');
                 fwrite($out, $htpasswd_output);
                 fclose($out);
                 // Génération du fichier .htdigest
                 $htpasswd_file = realpath('.') . '/upload/.htdigest';
                 $htpasswd_output = '';
                 $in = fopen($htpasswd_file, 'r');
                 $htpasswd_updated = false;
                 if ($in) {
                     while (preg_match("/:/", $line = fgets($in))) {
                         $line = rtrim($line);
                         $a = explode(':', $line);
                         if ($a[0] != 'classeur-' . $ppo->classeur->id) {
                             $htpasswd_output .= $line . "\n";
                         }
                     }
                 }
                 $htpasswd_output .= $ppo->classeur->upload_fs . ":Classeur:" . md5($ppo->classeur->upload_fs . ":Classeur:" . $ppo->classeur->upload_pw) . "\n";
                 fclose($in);
                 $out = fopen($htpasswd_file, 'w');
                 fwrite($out, $htpasswd_output);
                 fclose($out);
                 break;
             case 'upload-delete':
                 $dir = realpath('.') . '/upload/' . $ppo->classeur->upload_fs . '/';
                 if (strlen($ppo->classeur->upload_fs) > 3 && is_dir($dir)) {
                     $this->rrmdir($dir);
                 }
                 $ppo->classeur->upload_db = null;
                 $ppo->classeur->upload_fs = null;
                 $ppo->classeur->upload_pw = null;
                 $classeurDAO->update($ppo->classeur);
                 // Suppression de l'utilisateur dans le .htpasswd
                 $htpasswd_file = realpath('.') . '/upload/.htpasswd';
                 $htpasswd_output = '';
                 $in = fopen($htpasswd_file, 'r');
                 $htpasswd_updated = false;
                 if ($in) {
                     while (preg_match("/:/", $line = fgets($in))) {
                         $line = rtrim($line);
                         $a = explode(':', $line);
                         if ($a[0] != 'classeur-' . $ppo->classeur->id) {
                             $htpasswd_output .= $line . "\n";
                         }
                     }
                 }
                 fclose($in);
                 $out = fopen($htpasswd_file, 'w');
                 fwrite($out, $htpasswd_output);
                 fclose($out);
                 // Suppression de l'utilisateur dans le .htdigest
                 $htpasswd_file = realpath('.') . '/upload/.htdigest';
                 $htpasswd_output = '';
                 $in = fopen($htpasswd_file, 'r');
                 $htpasswd_updated = false;
                 if ($in) {
                     while (preg_match("/:/", $line = fgets($in))) {
                         $line = rtrim($line);
                         $a = explode(':', $line);
                         if ($a[0] != 'classeur-' . $ppo->classeur->id) {
                             $htpasswd_output .= $line . "\n";
                         }
                     }
                 }
                 fclose($in);
                 $out = fopen($htpasswd_file, 'w');
                 fwrite($out, $htpasswd_output);
                 fclose($out);
                 break;
             default:
                 break;
         }
         $ppo->classeur = $classeurDAO->get($ppo->classeur->id);
         $classeurs2htaccess_list = $classeurDAO->findBy(_daoSp()->addCondition('upload_fs', '!=', null));
         $classeurs2htaccess_string = '';
         /*
         $classeurs2htaccess_string .= "<Directory ".realpath('./upload').">\n";
         $classeurs2htaccess_string .= "\t<Limit GET HEAD OPTIONS POST>\n";
         $classeurs2htaccess_string .= "\t\trequire user admin\n";
         $classeurs2htaccess_string .= "\t</Limit>\n";
         $classeurs2htaccess_string .= "</Directory>\n";
         if($classeurs2htaccess_list) foreach( $classeurs2htaccess_list AS $classeurs2htaccess_item ) {
             $classeurs2htaccess_string .= "<Directory ".realpath('./upload/'.$classeurs2htaccess_item->upload_fs).">\n";
             $classeurs2htaccess_string .= "\t<Limit GET HEAD OPTIONS POST>\n";
             $classeurs2htaccess_string .= "\t\trequire user ".$classeurs2htaccess_item->upload_fs."\n";
             $classeurs2htaccess_string .= "\t</Limit>\n";
             $classeurs2htaccess_string .= "</Directory>\n";
         }
         
         $htaccess_file = realpath('.').'/upload/.htaccess';
         $out = fopen( $htaccess_file, 'w' );
         fwrite( $out, $classeurs2htaccess_string );
         fclose( $out );
         */
     }
     $ppo->classeur->upload_url = CopixUrl::get() . "upload/" . $ppo->classeur->upload_fs . "/";
     if ($ppo->classeur->upload_db) {
         $ppo->classeur->folder_infos = $dossierDAO->get($ppo->classeur->upload_db);
     } else {
         $ppo->classeur->folder_infos = NULL;
     }
     $ppo->niveauUtilisateur = Kernel::getLevel('MOD_CLASSEUR', $ppo->classeur->id);
     return _arPPO($ppo, 'options_default.tpl');
 }
 /**
  * Affichage d'un annuaire de classe
  *
  * @author Christophe Beyer <*****@*****.**>
  * @since 2006/01/18
  * @param integer $classe Id de la classe
  */
 public function getAnnuaireClasse()
 {
     if (!Kernel::is_connected()) {
         return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('annuaire|annuaire.error.noLogged'), 'back' => CopixUrl::get('||')));
     }
     $classe = _request("classe") ? _request("classe") : NULL;
     $annuaireService =& CopixClassesFactory::Create('annuaire|AnnuaireService');
     $criticErrors = array();
     $rClasse = Kernel::getNodeInfo('BU_CLASSE', $classe, false);
     $matrix =& enic::get('matrixCache');
     if (!$rClasse) {
         $criticErrors[] = CopixI18N::get('annuaire|annuaire.error.noClasse');
     } elseif (!$matrix->classe($classe)->_right->count->voir > 0) {
         $criticErrors[] = CopixI18N::get('kernel|kernel.error.noRights');
     }
     if ($criticErrors) {
         return CopixActionGroup::process('genericTools|Messages::getError', array('message' => implode('<br/>', $criticErrors), 'back' => CopixUrl::get('annuaire||')));
     }
     CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/module_fichesecoles.js');
     // Si c'est le détail d'une classe, on en déduit l'école
     $parent = Kernel::getNodeParents('BU_CLASSE', $classe);
     if ($parent[0]['type'] == 'BU_ECOLE') {
         $ecole = $parent[0]['id'];
     }
     $rEcole = Kernel::getNodeInfo('BU_ECOLE', $ecole, false);
     // Blog de l'école
     $blog = getNodeBlog('BU_ECOLE', $ecole, array('is_public' => 1));
     if ($blog) {
         $rEcole['blog'] = CopixUrl::get('blog||', array('blog' => $blog->url_blog));
     }
     $tplListe = new CopixTpl();
     $tplListe->assign('infosecole', CopixZone::process('annuaire|infosecole', array('rEcole' => $rEcole)));
     $tplListe->assign('infosclasse', CopixZone::process('annuaire|infosclasse', array('rClasse' => $rClasse)));
     $tplListe->assign('classe', $rClasse);
     $result = $tplListe->fetch('getannuaireclasse.tpl');
     //print_r($rEcole);
     $tpl = new CopixTpl();
     $tpl->assign('TITLE_PAGE', $rClasse["nom"]);
     $menu = array();
     if (!CopixConfig::exists('|can_group_showlist') || CopixConfig::get('|can_group_showlist')) {
         $menu[] = array('txt' => CopixI18N::get('groupe|groupe.annuaire'), 'url' => CopixUrl::get('groupe||getListPublic'), 'size' => '110');
     }
     $menu[] = array('txt' => CopixI18N::get('public|public.blog.annuaire'), 'url' => CopixUrl::get('public||getListBlogs'));
     $menu[] = array('txt' => CopixI18N::get('annuaire|annuaire.backEcole'), 'url' => CopixUrl::get('|getAnnuaireEcole', array('ecole' => $ecole)));
     $menu[] = array('txt' => CopixI18N::get('annuaire|annuaire.backVille'), 'url' => CopixUrl::get('|getAnnuaireVille', array('ville' => $rEcole['ALL']->vil_id_vi)));
     if (CopixConfig::exists('|can_annuaire_menu') && !CopixConfig::get('|can_annuaire_menu')) {
         $menu = array();
     }
     $tpl->assign('MENU', $menu);
     $tpl->assign('MAIN', $result);
     return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl);
 }
 /**
  * getRoles
  *
  * Affiche le menu des rôles d'utilisateurs
  *
  * @package	Comptes
  * @author	Frédéric Mossmann <*****@*****.**>
  */
 public function getRoles()
 {
     if (!Kernel::isAdmin()) {
         return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('||'));
     }
     $this->menu = array();
     if (Kernel::isAdmin() || _currentUser()->hasAssistance('can_comptes')) {
         if (CopixConfig::exists('kernel|gestionAutonomeEnabled') && CopixConfig::get('kernel|gestionAutonomeEnabled')) {
             $this->menu[] = array('txt' => CopixI18N::get('comptes|comptes.menu.getUsers'), 'url' => CopixUrl::get('gestionautonome||showTree'), 'type' => 'users');
         } else {
             $this->menu[] = array('txt' => CopixI18N::get('comptes|comptes.menu.getUsers'), 'url' => CopixUrl::get('comptes||'), 'type' => 'users');
         }
         $this->menu[] = array('txt' => CopixI18N::get('comptes|comptes.menu.getExt'), 'url' => CopixUrl::get('comptes||getUserExt'), 'type' => 'acl');
     }
     if (Kernel::isAdmin()) {
         $this->menu[] = array('txt' => CopixI18N::get('comptes|comptes.menu.getRoles'), 'url' => CopixUrl::get('comptes||getRoles'), 'type' => 'acl', 'current' => 'current');
         $this->menu[] = array('txt' => CopixI18N::get('comptes|comptes.menu.manageGrades'), 'url' => CopixUrl::get('gestionautonome||manageGrades'), 'type' => 'agendalist');
     }
     $tpl = new CopixTpl();
     $tplRegroupements = new CopixTpl();
     // CopixHTMLHeader::addCSSLink (_resource("styles/module_grvilles.css"));
     // $tpl->assign ('TITLE_PAGE', CopixI18N::get ('grvilles|grvilles.module.titre'));
     $dao_grvilles = CopixDAOFactory::create("regroupements|grvilles");
     $grvilles = $dao_grvilles->findAll();
     $tplRegroupements->assign('GRVILLES', count($grvilles));
     $dao_grecoles = CopixDAOFactory::create("regroupements|grecoles");
     $grecoles = $dao_grecoles->findAll();
     $tplRegroupements->assign('GRECOLES', count($grecoles));
     $main = $tplRegroupements->fetch('roles-default.tpl');
     $tpl->assign('TITLE_PAGE', CopixI18N::get('comptes.moduleDescription') . " &raquo; " . CopixI18N::get('comptes.title.roles'));
     $tpl->assign('MAIN', $main);
     $tpl->assign('MENU', $this->menu);
     return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl);
 }