public function processDefault() { $this->matrix =& enic::get('matrix'); $ppo = new CopixPPO(); $ppo->matrix = $this->matrix->display(); return _arPPO($ppo, 'matrix.tpl'); }
public function processAdmin() { $mailConf = $this->service('mailExtService')->getConf(); //test if error occured if (isset($this->flash->error) && $this->flash->error || isset($this->flash->validMailConf)) { $modifId = $this->flash->mailConfId; if ($modifId == 'new') { //build new item from error array $newItem = $this->flash->formData; $newItem['error'] = $this->flash->errorMsg; array_unshift($mailConf, $newItem); } else { foreach ($mailConf as $k => $mail) { if ($modifId != $mail['id']) { continue; } if (isset($this->flash->error)) { $mailConf[$k] = $this->flash->formData; $mailConf[$k]['error'] = $this->flash->errorMsg; } else { $mailConf[$k]['valid'] = $this->flash->validMailConf; } break; } } } $ppo = new CopixPPO(); $ppo->mailConf = $mailConf; if (isset($this->flash->validMailConf)) { $ppo->validMailConf = $this->flash->validMailConf; } $this->addCss('styles/module_mailext.css'); return _arPPO($ppo, 'admin.tpl'); }
public function processDefault() { $ppo = new CopixPPO(); $ppo->items = $this->service->getItems(); $ppo->source = $this->service->getSource(); $ppo->summary = $this->service->getSummary(); $ppo->title = $this->service->getTitle(); return _arPPO($ppo, 'default.tpl'); }
/** * Page d'accueil du framework */ public function processWelcome() { $ppo = new CopixPPO(); $ppo->TITLE_PAGE = _i18n('default.welcome2Copix3'); try { CopixDB::getConnection(); $ppo->dbOK = true; } catch (Exception $e) { $ppo->dbOK = false; } return _arPPO($ppo, 'welcome.php'); }
/** * Création du mail avec vérification des paramètres */ public function processCreate() { $ppo = new CopixPPO(); $ppo->TITLE_PAGE = _i18n('email.create'); $ppo->infomail = _class("emailservices")->getInfoMail(); if (($ppo->mail = CopixSession::get('admin|email|donnees')) == null) { CopixSession::set('admin|email|donnees', _class("emailservices")->newMail()); $ppo->mail = CopixSession::get('admin|email|donnees'); } $ppo->sending = _request('sending', 'false'); $ppo->errors = _request('error'); return _arPPO($ppo, 'email.tpl'); }
/** * Affiche la liste des thèmes disponibles */ public function processDefault() { $ppo = new CopixPPO(); $ppo->TITLE_PAGE = _i18n('themes.titlePage.selectTheme'); $arThemes = CopixTpl::getThemesList(); $arThemesInfos = array(); $ppo->arThemes = array(); foreach ($arThemes as $theme) { $ppo->arThemes[] = CopixTpl::getThemeInformations($theme); } $ppo->selectedTheme = CopixConfig::get('defaultThemeId'); return _arPPO($ppo, 'theme.list.tpl'); }
public function processDefault() { $ppo = new CopixPPO(); if (!$this->service->loadxml()) { return $this->error('rssetagere.notfound', true, '||'); } $ppo->title = $this->service->getTitle(); $ppo->desc = $this->service->getDescription(); $ppo->items = $this->service->getItems(); $ppo->isEns = $this->user->type == 'USER_ENS'; $ppo->listUrl = $this->helpers->config('rssetagere|list_url'); return _arPPO($ppo, 'default.tpl'); }
/** * 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); }
/** * Action par défaut * * @return CopixPPO */ public function processDefault() { $ppo = new CopixPPO(); $ppo->home_url = CopixConfig::get('default|homePage'); if (strpos($ppo->home_url, 'http://') !== 0) { $ppo->home_url = _url() . $ppo->home_url; } $ppo->search_url = CopixConfig::get('404|search_url'); $ppo->sitemap_url = CopixConfig::get('404|sitemap_url'); // Mise en place des en-têtes 404 header("HTTP/1.0 404 Not Found"); header("Status: 404 Not found"); return _arPPO($ppo, 'default.tpl'); }
/** * Page d'affichage des logs */ public function processShow() { $ppo = new CopixPPO(); $profil = _request('profile'); $nbitems = _request('nbitems', 20); $ppo->TITLE_PAGE = _i18n('logs.show'); $ppo->profil = $profil; $ppo->nbitems = $nbitems; $page = _request('page', null) !== null ? _request('page', null) : 1; CopixSession::set('log|numpage', $page); foreach (CopixConfig::instance()->copixlog_getRegistered() as $profil) { $ppo->profils[$profil] = $profil; } return _arPPO($ppo, array('template' => 'logs.show.php')); }
public function processDefault() { $ppo = new CopixPPO(); // Le KNE est activé sur une classe, il nous faut son école $classId = (int) $this->request('id_classe'); $parent = Kernel::getNodeParents('BU_CLASSE', $classId); if ($parent[0] && $parent[0]['type'] == 'BU_ECOLE') { $schoolId = (int) $parent[0]['id']; } else { $schoolId = null; } $KneRessources = $this->service('KneService')->getRessources($schoolId); $ppo->ressources = $KneRessources; return _arPPO($ppo, 'default.tpl'); }
/** * Ecran d'accueil des opérations d'administration * */ public function processDefault() { //Inclusion de la classe checker pour tester les pré-requis _classInclude('InstallChecker'); $checker = new InstallChecker(); $ppo = new CopixPPO(); $ppo->TITLE_PAGE = _i18n('install.title.admin'); $tips = $this->_getTips(); $ppo->tips = $tips->tips; $ppo->warning = $tips->warning; $ppo->homePageUrl = CopixConfig::get('|homePage'); $ppo->pdomysqlEnabled = $checker->typeDbInstalled('pdo_mysql'); if (!$ppo->pdomysqlEnabled) { $ppo->tips[] = _i18n('install.tips.pdomysql'); } $ppo->phpunitEnabled = @(include_once 'PHPUnit/Framework.php'); if (!$ppo->phpunitEnabled) { $ppo->tips[] = _i18n('install.tips.unittest'); } $ppo->databaseEnabled = $checker->isValidDefaultDatabase(); if (!$ppo->databaseEnabled) { $ppo->tips[] = _i18n('install.tips.database'); } if (!_currentUser()->testCredential('basic:admin')) { $ppo->tips = array(); } // recherche des liens $ppo->links = array(); foreach (CopixModule::getList() as $moduleName) { $moduleInformations = CopixModule::getInformations($moduleName); // si on a au moins un lien if (count($moduleInformations->admin_links) > 0) { $groupid = !is_null($moduleInformations->admin_links_group->id) ? $moduleInformations->admin_links_group->id : uniqid(); foreach ($moduleInformations->admin_links as $linkInformations) { if ($linkInformations['credentials'] == null || CopixAuth::getCurrentUser()->testCredential($linkInformations['credentials'])) { $ppo->links[$groupid]['modules'][][$linkInformations['url']] = $linkInformations['caption']; $ppo->links[$groupid]['caption'] = $moduleInformations->description; $ppo->links[$groupid]['groupcaption'] = $moduleInformations->admin_links_group->caption; $ppo->links[$groupid]['icon'] = !is_null($moduleInformations->admin_links_group->icon) ? $moduleInformations->admin_links_group->icon : $moduleInformations->icon; } } } } return _arPPO($ppo, 'admin.tpl'); }
/** * Page de modification d'un utilisateur */ public function processEdit() { //création du tableau d'erreur $errors = array(); if (CopixRequest::get('loginNotAvailable', '0') == 1) { $errors[] = _i18n('auth.error.loginNotAvailable'); } if (CopixRequest::get('loginEmpty', '0') == 1) { $errors[] = _i18n('auth.error.loginEmpty'); } if (CopixRequest::get('passwordDoNotMatch', '0') == 1) { $errors[] = _i18n('auth.error.passwordDoNotMatch'); } if (CopixRequest::get('passwordEmpty', '0') == 1) { $errors[] = _i18n('auth.error.passwordEmpty'); } if (CopixRequest::get('emailEmpty', '0') == 1) { $errors[] = _i18n('auth.error.emailEmpty'); } if (CopixRequest::get('emailIsBad', '0') == 1) { $errors[] = _i18n('auth.error.emailIsBad'); } if (CopixRequest::get('confirmCodeBad', '0') == 1) { $errors[] = _i18n('auth.error.confirmCodeBad'); } //Affichage de la page $ppo = new CopixPPO(); $ppo->TITLE_PAGE = _i18n('auth.newUser'); $ppo->errors = $errors; $ppo->createInProcess = "true"; $ppo->createUser = Copixconfig::get('auth|createUser'); $ppo->typeConfirm = Copixconfig::get('auth|typeConfirm'); // Cherche les valeurs du formulaire si l'ont est en mode réédition if (($idForm = CopixRequest::get('idForm', '0')) != 0) { $user = CopixSession::get('auth|createForm', $idForm); if ($user !== null) { CopixSession::destroyNamespace($idForm); $ppo->user = $user; } } return _arPPO($ppo, 'user.edit.php'); }
/** * Affiche les informations sur le serveur de base de données */ public function processDefault() { $ppo = new CopixPPO(); $ppo->TITLE_PAGE = ''; // profil de connexion utilisé actuellement $profile = CopixDb::getConnection()->getProfile(); $parts = $profile->getConnectionStringParts(); $section = _i18n('copix.section.dbProfile', array($profile->getName())); $sections[$section][_i18n('copix.dbProfile.connexionString')] = $profile->getConnectionString(); $sections[$section][_i18n('copix.dbProfile.driverName')] = $profile->getDriverName(); $sections[$section][_i18n('copix.dbProfile.databaseType')] = $profile->getDatabase(); $sections[$section][_i18n('copix.dbProfile.user')] = $profile->getUser(); $sections[$section][_i18n('copix.dbProfile.database')] = $parts['dbname']; $sections[$section][_i18n('copix.dbProfile.serverName')] = isset($parts['host']) ? $parts['host'] : 'localhost'; $sections[$section][_i18n('copix.dbProfile.options')] = $profile->getOptions(); if ($profile->getDatabase() == 'mysql') { _class('mysqlserverinfos')->fillInformations($sections); } $ppo->sections = $sections; return _arPPO($ppo, 'infos.tpl'); }
public function processAdmin() { //check if the user is admin : if (!Kernel::isAdmin()) { return $this->error('charte.noRight', true, '||'); } $ppo = new CopixPPO(); $ppo->errors = isset($this->flash->errors) ? $this->flash->errors : null; $ppo->success = isset($this->flash->success) ? $this->flash->success : null; $ppo->chartes = $this->service('CharteService')->getChartesTypes(); $ppo->radio = array(1 => 'oui', 0 => 'non'); $ppo->idClasseur = $ppo->idMalle = null; $modsAvailable = Kernel::getModAvailable($this->user->type); $malleAvailable = Kernel::filterModuleList($modsAvailable, 'MOD_MALLE'); // Malle activée if (!empty($malleAvailable)) { $modsEnabled = Kernel::getModEnabled($this->user->type, $this->user->idEn); $mal = Kernel::filterModuleList($modsEnabled, 'MOD_MALLE'); // Si la malle est bien initialisée if (!empty($mal)) { $ppo->idMalle = $mal[0]->module_id; } else { return $this->error('charte.admin.noMalle', true, 'malle||'); } } else { $classeurAvailable = Kernel::filterModuleList($modsAvailable, 'MOD_CLASSEUR'); // Classeur activé if (!empty($classeurAvailable)) { Kernel::createMissingModules($this->user->type, $this->user->idEn); $modsEnabled = Kernel::getModEnabled($this->user->type, $this->user->idEn); $classeur = Kernel::filterModuleList($modsEnabled, 'MOD_CLASSEUR'); if (!empty($classeur)) { $ppo->idClasseur = $classeur[0]->module_id; } } } CopixHTMLHeader::addCSSLink(_resource("styles/module_charte.css")); return _arPPO($ppo, 'charte.admin.tpl'); }
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 processGo() { $ppo = new CopixPPO(); if (!Kernel::is_connected()) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.nologin'), 'back' => CopixUrl::get('auth|default|login'))); } $user = _currentUser(); $ppo->ceriseprim_url = ''; $ppo->ceriseprim_admin = ''; if (preg_match("/^(?P<node_type>[\\w_]+)-(?P<node_id>\\d+)\$/", _request("id"), $regs)) { if ($regs['node_type'] == "BU_ECOLE" || $regs['node_type'] == "BU_CLASSE") { if ($regs['node_type'] == "BU_ECOLE") { $sql = "\n SELECT *\n FROM kernel_bu_ecole\n WHERE numero=:id\n "; $params = array(':id' => $regs['node_id']); } if ($regs['node_type'] == "BU_CLASSE") { $sql = "\n SELECT kernel_bu_ecole.RNE\n FROM kernel_bu_ecole\n JOIN kernel_bu_ecole_classe ON kernel_bu_ecole.numero=kernel_bu_ecole_classe.ecole\n WHERE kernel_bu_ecole_classe.id=:id\n "; $params = array(':id' => $regs['node_id']); } $ecoles_list = _doQuery($sql, $params); if (count($ecoles_list)) { $url = CopixConfig::get('default|conf_Ceriseprim_url') . "/" . $ecoles_list[0]->RNE . "/ico.php?user=personnel-" . $user->getExtra('id') . "&date=" . date('Y-m-d') . "&key=" . md5($ecoles_list[0]->RNE . "personnel-" . $user->getExtra('id') . date('Y-m-d') . CopixConfig::get('default|conf_Ceriseprim_secret')); $ppo->ceriseprim_url = $url; if ($regs['node_type'] == "BU_ECOLE") { $mynodes = Kernel::getMyNodes(); foreach ($mynodes as $node) { if ($node->type == $regs['node_type'] && $node->id == $regs['node_id'] && $node->droit >= 70) { $ppo->ceriseprim_admin = CopixConfig::get('default|conf_Ceriseprim_url') . "/support/iconito/updateIconito.php?rne=" . $ecoles_list[0]->RNE; } } } } } } return _arPPO($ppo, 'default.tpl'); }
public function processAlpi_blogalbum() { $ppo = new CopixPPO(); /* $connection_old = CopixDB::getConnection ('iconito_migration_old')->getProfile ()->getConnectionStringParts (); $connection_new = CopixDB::getConnection ('iconito_migration_new')->getProfile ()->getConnectionStringParts (); $path_old = ''; $path_new = ''; $bdname_old = $connection_old['dbname']; $bdname_new = $connection_new['dbname']; */ $ppo->a_migrer = _doQuery(' SELECT PER.numero AS per_id, PER.nom AS per_nom, PER.prenom1 AS per_prenom, OLD_CLA.id AS cla_id, OLD_CLA.nom AS cla_nom, OLD_ECO.numero AS eco_id, OLD_ECO.nom AS eco_nom, OLD_MOD.module_type AS from_mod_type, OLD_MOD.module_id AS from_mod_id, NEW_MOD.module_id AS to_malle_id FROM ' . $this->bdname_new . '.kernel_bu_personnel PER JOIN ' . $this->bdname_old . '.kernel_bu_personnel_entite OLD_ENT ON PER.numero=OLD_ENT.id_per AND OLD_ENT.type_ref="CLASSE" JOIN ' . $this->bdname_old . '.kernel_bu_ecole_classe OLD_CLA ON OLD_ENT.reference=OLD_CLA.id JOIN ' . $this->bdname_old . '.kernel_bu_ecole OLD_ECO ON OLD_CLA.ecole=OLD_ECO.numero JOIN ' . $this->bdname_old . '.kernel_mod_enabled OLD_MOD ON OLD_ENT.reference=OLD_MOD.node_id AND OLD_MOD.node_type="BU_CLASSE" AND (OLD_MOD.module_type="MOD_MALLE" OR OLD_MOD.module_type="MOD_ALBUM") JOIN ' . $this->bdname_new . '.kernel_mod_enabled NEW_MOD ON PER.numero=NEW_MOD.node_id AND NEW_MOD.node_type="USER_ENS" AND NEW_MOD.module_type="MOD_MALLE" -- DEBUG -- WHERE OLD_MOD.module_type="MOD_MALLE" AND NEW_MOD.module_id=52 ORDER BY eco_nom, cla_nom, per_nom, per_prenom '); // node_type node_id module_type module_id // USER_RES 8451 MOD_MALLE 853 // kernel_bu_personnel : numero nom nom_jf prenom1 civilite id_sexe // kernel_bu_personnel_entite : id_per reference type_ref role // kernel_bu_ecole_classe : id ecole nom annee_scol is_validee is_supprimee // kernel_bu_ecole : numero RNE code_ecole_vaccination type nom // kernel_mod_enabled : node_type node_id module_type module_id // _dump($ppo->a_migrer); die(); foreach ($ppo->a_migrer as $a_migrer_key => $a_migrer_val) { // Rechercher malle archive nom classe // // Si absente : creer switch ($a_migrer_val->from_mod_type) { case 'MOD_ALBUM': $ppo->a_migrer[$a_migrer_key]->data = new CopixPPO(); $ppo->a_migrer[$a_migrer_key]->data->files = $this->getAlbumFiles($a_migrer_val->from_mod_id); $ppo->a_migrer[$a_migrer_key]->data->folders = $this->getAlbumFolders($a_migrer_val->from_mod_id); break; case 'MOD_MALLE': $ppo->a_migrer[$a_migrer_key]->data = new CopixPPO(); $ppo->a_migrer[$a_migrer_key]->data->files = $this->getMalleFiles($a_migrer_val->from_mod_id); $ppo->a_migrer[$a_migrer_key]->data->folders = $this->getMalleFolders($a_migrer_val->from_mod_id); break; } } if (_request("go", 0)) { $this->doMigration($ppo->a_migrer); } return _arPPO($ppo, 'migration_alpi_blogalbum.tpl'); }
/** * Téléchargement d'une pièce jointe dans un classeur * * @author Christophe Beyer <*****@*****.**> * @since 2012/06/21 * @param integer $id Id du minimail de départ */ public function attachmentToClasseur() { //_dump($_POST); $this->addJs('js/iconito/module_classeur.js'); $this->addJs('js/iconito/module_minimail.js'); $this->addCss('styles/module_classeur.css'); _classInclude('classeur|classeurService'); _classInclude('kernel|Request'); $idUser = _currentUser()->getId(); $idMessage = _request("id"); $files = _request('files', array()); $destination = _request('destination'); $errors = array(); $daoFrom = _ioDAO("minimail|minimail_from"); $daoTo = CopixDAOFactory::create("minimail_to"); $message = $daoFrom->getMessage($idMessage); $canMake = $isRecv = $isSend = false; if ($message && $message->from_id == $idUser) { // Message qu'il a envoyé $canMake = $isSend = true; } else { // Il en est peut-être destinataire $canMake = $isRecv = $daoTo->selectDestFromIdAndToUser($idMessage, $idUser); // Test s'il est dans les destin } if (!$canMake) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('minimail.error.cantDisplay'), 'back' => CopixUrl::get('minimail||'))); } $menu = array(); $menu[] = array('txt' => CopixI18N::get('minimail.mess_recv'), 'url' => CopixUrl::get('minimail||getListRecv'), 'current' => $isRecv); $menu[] = array('txt' => CopixI18N::get('minimail.mess_send'), 'url' => CopixUrl::get('minimail||getListSend'), 'current' => $isSend); $menu[] = array('txt' => CopixI18N::get('minimail.mess_write'), 'url' => CopixUrl::get('minimail||getNewForm')); $ppo = new CopixPPO(); $ppo->TITLE_PAGE = $message; $ppo->MENU = $menu; $ppo->message = $message; //_dump(Request::isXmlHttpRequest()); if (Request::isPostMethod()) { $error = $success = array(); if (!$files) { $error[] = CopixI18N::get('minimail.attachmentToClasseur.error.noFiles'); } if ($destination) { list($ppo->destinationType, $ppo->destinationId) = explode('-', $destination); if ('classeur' == $ppo->destinationType) { $rClasseur = _ioDAO('classeur|classeur')->get($ppo->destinationId); } if ('dossier' == $ppo->destinationType) { if ($rDossier = _ioDAO('classeur|classeurdossier')->get($ppo->destinationId)) { $rClasseur = _ioDAO('classeur|classeur')->get($rDossier->classeur_id); } } } if (!$destination || !$rClasseur) { $error[] = CopixI18N::get('classeur|classeur.error.noDestination'); } if ($error) { $ppo->error = $error; return _arPPO($ppo, array('template' => 'attachmentToClasseur.tpl', 'mainTemplate' => 'main|main_popup.php')); } //_dump($destination); //_dump($rClasseur); $dir = realpath('./static/classeur') . '/' . $rClasseur->id . '-' . $rClasseur->cle . '/'; if (!file_exists($dir)) { mkdir($dir, 0755, true); } foreach ($files as $file) { $fichierPhysique = realpath("../var/data") . "/minimail/" . $file; $nomFichierPhysique = $file; $fichier = _record('classeur|classeurfichier'); $fichier->classeur_id = $rClasseur->id; $fichier->dossier_id = isset($rDossier) && $rDossier ? $rDossier->id : 0; $fichier->titre = MinimailService::getAttachmentName($file); $fichier->fichier = $nomFichierPhysique; $fichier->taille = filesize($fichierPhysique); $fichier->type = strtoupper(substr(strrchr($nomFichierPhysique, '.'), 1)); $fichier->cle = classeurService::createKey(); $fichier->date_upload = date('Y-m-d H:i:s'); $fichier->user_type = _currentUser()->getExtra('type'); $fichier->user_id = _currentUser()->getExtra('id'); _ioDAO('classeur|classeurfichier')->insert($fichier); if ($fichier->id > 0) { $nomClasseur = $rClasseur->id . '-' . $rClasseur->cle; $nomFichier = $fichier->id . '-' . $fichier->cle; $extension = strtolower(strrchr($nomFichierPhysique, '.')); if (copy($fichierPhysique, $dir . $fichier->id . '-' . $fichier->cle . $extension)) { $success[] = MinimailService::getAttachmentName($file); } else { $error[] = CopixI18N::get('minimail.attachmentToClasseur.error.moved', array(MinimailService::getAttachmentName($file))); } } else { $error[] = CopixI18N::get('minimail.attachmentToClasseur.error.creation', array(MinimailService::getAttachmentName($file))); } } if (count($success) > 0) { $dest = $rClasseur; if (isset($rDossier) && $rDossier) { $dest .= ' / ' . $rDossier; } if (1 == count($success)) { Kernel::setFlashMessage('success', CopixI18N::get('minimail.attachmentToClasseur.moved_1', array(implode(', ', $success), $dest))); } else { Kernel::setFlashMessage('success', CopixI18N::get('minimail.attachmentToClasseur.moved_N', array(implode(', ', $success), $dest))); } } if ($error) { Kernel::setFlashMessage('error', implode('<br />', $error)); } $ppo->ok = 1; //echo 'OK'; //return _arNone(); //return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('minimail||getMessage', array('id' => $idMessage))); } return _arPPO($ppo, array('template' => 'attachmentToClasseur.tpl', 'mainTemplate' => 'main|main_popup.php')); }
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'); }
public function processEndQuestions() { $pId = CopixRequest::getInt('id', false); if (!$pId || is_null(qSession('id')) || $pId != qSession('id')) { return CopixActionGroup::process('quiz|default::Quiz', array('id' => $pId)); } $ppo = new CopixPPO(); CopixHTMLHeader::addCSSLink(_resource("styles/module_quiz.css")); return _arPPO($ppo, 'end_questions.tpl'); }
public function processDefault() { if (!Kernel::isAdmin()) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.noRights'), 'back' => CopixUrl::get())); } $ppo = new CopixPPO(); $ppo->from = array('USER_VIL', 'USER_DIR', 'USER_ENS', 'USER_RES', 'USER_ELE', 'USER_ATI', 'USER_EXT', 'USER_ADM'); $ppo->to = array('USER_VIL', 'USER_DIR', 'USER_ENS', 'USER_RES', 'USER_ELE', 'USER_ATI', 'USER_EXT', 'USER_ADM'); $ppo->where = array('NOWHERE', 'BU_CLASSE', 'BU_ECOLE', 'BU_VILLE', 'BU_GRVILLE', 'ROOT'); $ppo->do = array('VOIR', 'COMM'); $ppo->trad = array('USER_VIL' => "Agent ville", 'USER_DIR' => "Directeur", 'USER_ENS' => "Enseignant", 'USER_RES' => "Parent", 'USER_ELE' => "Elève", 'USER_ADM' => "Admin", 'USER_ATI' => "Anim TICE", 'USER_EXT' => "Personne ext", 'NOWHERE' => "Interdit", 'BU_CLASSE' => "Même classe", 'BU_ECOLE' => "Même école", 'BU_VILLE' => "Même ville", 'BU_GRVILLE' => "Même groupe<br/>de ville", 'ROOT' => "Partout", 'VOIR' => "Voir", 'COMM' => "Ecrire"); if (_request("save", 0) == 1) { // echo "<pre>"; print_r($_POST); die(); // Clear matrix _doQuery('DELETE FROM module_rightmatrix'); /* Mode checkbox foreach( $ppo->from AS $cpt_from ) { foreach( $ppo->to AS $cpt_to ) { foreach( $ppo->do AS $cpt_do ) { // Retournement de la Matrice pour écrire dans le domaine le plus large (uniquement) foreach( array_reverse($ppo->where) AS $cpt_where ) { $droit = _request("right_".$cpt_from."_".$cpt_to."_".$cpt_where."_".$cpt_do); // if($droit) echo "<li>[$cpt_from][$cpt_to][$cpt_where][$cpt_do] = ".($droit?"OUI":"non")."</li>"; // if($droit) echo "<li>[$cpt_from][$cpt_to][$cpt_where][$cpt_do] = ".($droit?"OUI":"non")."</li>"; if($droit) _doQuery('INSERT INTO module_rightmatrix (user_type_in, user_type_out, node_type, `right`) VALUES (:user_type_in, :user_type_out, :node_type, :right)', array( ':user_type_in'=> $cpt_from, ':user_type_out' => $cpt_to, ':node_type' => $cpt_where, ':right' => $cpt_do )); if($droit) break; } } } } */ foreach ($ppo->from as $cpt_from) { foreach ($ppo->to as $cpt_to) { foreach ($ppo->do as $cpt_do) { $droit = _request("right_" . $cpt_from . "_" . $cpt_to . "_" . $cpt_do); if ($droit != "NOWHERE") { _doQuery('INSERT INTO module_rightmatrix (user_type_in, user_type_out, node_type, `right`) VALUES (:user_type_in, :user_type_out, :node_type, :right)', array(':user_type_in' => $cpt_from, ':user_type_out' => $cpt_to, ':node_type' => $droit, ':right' => $cpt_do)); } } } } // die('save'); } // Initialisation de la matrice $ppo->right = array(); foreach ($ppo->from as $cpt_from) { $ppo->right[$cpt_from] = array(); foreach ($ppo->to as $cpt_to) { $ppo->right[$cpt_from][$cpt_to] = array(); foreach ($ppo->where as $cpt_where) { $ppo->right[$cpt_from][$cpt_to][$cpt_where] = array(); foreach ($ppo->do as $cpt_do) { $ppo->right[$cpt_from][$cpt_to][$cpt_where][$cpt_do] = false; } } } } // Récupération des information de la matrice en base de données $tmp_right = _doQuery('SELECT * FROM module_rightmatrix'); foreach ($tmp_right as $tmp_right_item) { $ppo->right[$tmp_right_item->user_type_in][$tmp_right_item->user_type_out][$tmp_right_item->node_type][$tmp_right_item->right] = true; } return _arPPO($ppo, 'matrix-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')); }
/** * Detail d'une teleprocedure * * @author Christophe Beyer <*****@*****.**> * @since 2008/01/30 * @param integer $id Id de la procedure * @param integer $print Si version imprimable * @param array $rFiche (Si on revient en modif apres erreur) Contient des donnees de l'intervention qui ecrasent celles issues de la base */ public function processFiche() { $id = $this->getRequest('id', null); $errors = $this->getRequest('errors', array()); $ok = $this->getRequest('ok', array()); $print = $this->getRequest('print'); $send = $this->getRequest('send'); $fiche = $this->getRequest('rFiche', array()); $daoIntervention = CopixDAOFactory::create("intervention"); $criticErrors = array(); if ($id && ($rFiche = $daoIntervention->get($id))) { $title = $rFiche->objet; $mondroit = Kernel::getLevel("MOD_TELEPROCEDURES", $rFiche->type_teleprocedure); if (!TeleproceduresService::canMakeInTelep('VIEW', $mondroit)) { $criticErrors[] = CopixI18N::get('kernel|kernel.error.noRights'); } } else { $criticErrors[] = CopixI18N::get('teleprocedures|teleprocedures.error.prob.telep'); } if ($criticErrors) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => implode('<br/>', $criticErrors), 'back' => CopixUrl::get('teleprocedures||'))); } if (isset($fiche['mail_from'])) { $rFiche->mail_from = $fiche['mail_from']; } if (isset($fiche['mail_to'])) { $rFiche->mail_to = $fiche['mail_to']; } if (isset($fiche['mail_cc'])) { $rFiche->mail_cc = $fiche['mail_cc']; } if (isset($fiche['mail_message'])) { $rFiche->mail_message = $fiche['mail_message']; } $fiche = CopixZone::process('fiche', array('rFiche' => $rFiche, 'mondroit' => $mondroit, 'errors' => $errors, 'ok' => $ok, 'print' => $print)); $comms = CopixZone::process('ficheComms', array('rFiche' => $rFiche, 'mondroit' => $mondroit)); $actions = CopixZone::process('ficheActions', array('rFiche' => $rFiche, 'mondroit' => $mondroit)); if ($print) { $main = $fiche; } else { $main = $fiche . $comms . $actions; } $tpl = new CopixTpl(); $tpl->assign('TITLE_PAGE', $title); $tpl->assign("MAIN", $main); if (!$print) { // Enregistrement dans le trackin $user = _currentUser()->getId(); TeleproceduresService::userReadIntervention($id, $user); } if (0 && $print) { $ppo = new CopixPPO(); $ppo->result = $main; $ppo->TITLE_PAGE = $title; return _arPPO($ppo, array('template' => 'print_ppo.tpl', 'mainTemplate' => 'default|main_print.php')); } else { return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); } }
/** * Permet d'exporter les classes des modukes * * @return CopixActionReturn */ public function processExportClass() { $pModuleName = CopixRequest::get('moduleName'); $pClassFileName = CopixRequest::get('classFileName'); // si on a confirmé l'ajout if (CopixRequest::get('confirm')) { $pServiceName = trim(CopixRequest::get('serviceName')); $pClassName = CopixRequest::get('className'); $pClassFileName = _request('classFileName'); $pModuleName = _request('moduleName'); // nom de service vide if ($pServiceName == '') { return _arRedirect(_url('admin|ExportClass', array('error' => 'serviceEmpty', 'moduleName' => $pModuleName, 'classFileName' => $pClassFileName))); } // verification si on n'a pas déja un service de ce nom $wsservices = _ioDao('wsservices')->findBy(_daoSP()->addCondition('name_wsservices', '=', $pServiceName)); if (count($wsservices) > 0) { return _arRedirect(_url('admin|ExportClass', array('error' => 'serviceExists', 'moduleName' => $pModuleName, 'classFileName' => $pClassFileName))); } CopixDB::getConnection()->doQuery("insert into wsservices (name_wsservices, module_wsservices, file_wsservices, class_wsservices) values ('" . $pServiceName . "','" . $pModuleName . "','" . $pClassFileName . "', '" . $pClassName . "')"); $res = 'Url du Webservice : <a href="' . _url('wsserver||', array('wsname' => $pServiceName)) . '">' . _url('wsserver||', array('wsname' => $pServiceName)) . '</a><br/>' . "\n"; $res .= 'Url du fichier wsdl : <a href="' . _url('wsserver|default|wsdl', array('wsname' => $pServiceName)) . '">' . _url('wsserver|default|wsdl', array('wsname' => $pServiceName)) . '</a><br/>' . "\n"; $res .= '<br />'; $res .= '<input type="button" value="' . _i18n('wsserver.back') . '" onclick="javascript: document.location=\'' . _url('admin|manageWebServices') . '\';" />'; $tpl = new CopixTpl(); $tpl->assign('MAIN', $res); return new CopixActionReturn(CopixActionReturn::DISPLAY, $tpl); // si on doit afficher le formulaire d'ajout } else { $ppo = new CopixPPO(); $ppo->TITLE_PAGE = _i18n('wsserver.title.manageWebServices'); $ppo->classFileName = $pClassFileName; $ppo->arErrors = array(); // erreur "service existant" passée en paramètre if (_request('error') !== null) { $ppo->arErrors[] = _i18n('wsserver.error.' . _request('error')); } $ppo->ModuleName = $pModuleName; $arBefore = get_declared_classes(); include CopixModule::getPath($pModuleName) . COPIX_CLASSES_DIR . $pClassFileName; $arAfter = get_declared_classes(); $arClass = array_diff($arAfter, $arBefore); sort($arClass); if (count($arClass) == 0) { throw new Exception('Pas de classe à exporter'); } $ppo->arClass = $arClass; return _arPPO($ppo, 'wsservices.add.php'); } }
/** * Ecran de connexion */ public function processForm() { $ppo = new CopixPPO(); $ppo->TITLE_PAGE = _i18n('auth.connect'); if (CopixAuth::getCurrentUser()->isConnected()) { $ppo->user = CopixAuth::getCurrentUser(); return _arRedirect(_url('kernel||getHome')); } $config = CopixConfig::instance(); if (count($config->copixauth_getRegisteredUserHandlers()) > 1 && CopixConfig::get('auth|multipleConnectionHandler')) { $ppo->noCredential = true; } $ppo->auth_url_return = CopixRequest::get('auth_url_return', _url('#')); $ppo->failed = array(); if (CopixRequest::getInt('noCredential', 0)) { $ppo->failed[] = _i18n('auth.error.noCredentials'); } if (CopixRequest::getInt('failed', 0)) { $ppo->failed[] = _i18n('auth.error.failedLogin'); } $ppo->createUser = Copixconfig::get('auth|createUser'); $ppo->conf_Saml_actif = CopixConfig::exists('default|conf_Saml_actif') ? CopixConfig::get('default|conf_Saml_actif') : 0; return _arPPO($ppo, 'login.form.php'); }
/** * Changement de classe */ public function processChangeClassroom() { if (CopixRequest::isXmlHttpRequest()) { return new CopixActionReturn(CopixActionReturn::HTTPCODE, array('Content-Type: text/html; charset=utf-8', 'HTTP/1.1 200 OK'), CopixZone::process('gestionautonome|changeClassroom')); } $ppo = $this->_prepareAssignmentsManagement(); // Mise en session de l'année scolaire de destination $ppo->filters['destinationGrade'] = isset($ppo->classroom) ? $ppo->classroom->annee_scol : (is_null(_sessionGet('grade')) ? Kernel::getAnneeScolaireCourante()->id_as : _sessionGet('grade')); $ppo->filters['mode'] = 'changeClassroom'; _sessionSet('gestionautonome|assignments_management_filters', $ppo->filters); return _arPPO($ppo, 'manage_assignments.tpl'); }
public function processUpdate() { if (!Kernel::isAdmin()) { return $this->error('rssmix.noRight', true, '||'); } $ppo = new CopixPPO(); //check errors : if (isset($this->flash->error)) { $ppo->error = $this->flash->error; } if (isset($this->flash->success)) { $ppo->success = $this->flash->success; } if (!$this->istyreq('id')) { return $this->error('rssmix.error'); } $id = (int) $this->request('id'); $url = $this->service->getRssUrl($id); if (empty($url)) { return $this->error('rssmix.error'); } $ppo->url = $url[0]['url']; $ppo->title = $url[0]['title']; if (!empty($url[0]['image'])) { $imageClass = new enicImage(); try { $ppo->image = $imageClass->get($url[0]['image'], 50, 50, 'crop'); } catch (Exception $e) { $ppo->error = $e->getMessage(); } } $ppo->id = $id; $ppo->formAction = $this->url('rssmix|default|updatep', array('id' => $id)); return _arPPO($ppo, 'update.tpl'); }
/** * Editer un captcha */ public function processEditCaptcha() { CopixRequest::assert('captchaid'); if (CopixRequest::getInt('confirm') == 1) { $arrCaptcha = _ioDAO('commentscaptcha')->findBy(_daoSP()->addCondition("captcha_id", "=", _request('captchaid'))); $objCaptcha = $arrCaptcha[0]; $objCaptcha->captcha_question = _request('captcha_question'); $objCaptcha->captcha_answer = _request('captcha_answer'); _ioDAO('commentscaptcha')->update($objCaptcha); return _arRedirect(_url('comments|admin|listcaptcha')); } else { $ppo = new CopixPPO(); $ppo->TITLE_PAGE = _i18n('comments.admin.captchalist'); $ppo->arrCaptcha = _ioDAO('commentscaptcha')->findall(); $ppo->editedCaptcha = _request('captchaid'); return _arPPO($ppo, 'captcha.list.tpl'); } }
/** * Affichage de la page d'édition * */ public function processEdit() { if (!($toEdit = $this->_getSessionSimpleHelp())) { return CopixActionGroup::process('generictools|Messages::getError', array('message' => _i18n('simplehelp.unableToGetEdited'), 'back' => _url('simplehelp|admin|listAide'))); } // Création de PPO $ppo = new CopixPPO(array('TITLE_PAGE' => strlen($toEdit->id_sh) >= 1 ? _i18n('simplehelp.title.update') : _i18n('simplehelp.title.create'))); $ppo->toEdit = $toEdit; $ppo->showErrors = _request('e', null) !== null ? true : false; $ppo->errors = _ioDao('simplehelp')->check($ppo->toEdit); return _arPPO($ppo, 'simplehelp|simplehelp.edit.tpl'); }