/** * Determine si l'usager peut afficher ou modifier la fiche d'une ecole * * @author Christophe Beyer <*****@*****.**> * @since 2008/08/04 * @param integer $pId Id de l'ecole * @param string $pAction Indication eventuelle sur une action precise. * @return boolean True s'il a le droit, false sinon */ public function canMakeInFicheEcole($pId, $pAction) { $can = false; //echo "canMakeInFicheEcole ($pId, $pAction)"; $session = Kernel::getSessionBU(); $myNodes = Kernel::getMyNodes(); if ($pAction == "VIEW") { return true; } //var_dump($myNodes); //var_dump($session); switch ($session['type']) { case 'USER_ENS': foreach ($myNodes as $node) { if ($node->type == 'BU_ECOLE' && $node->id == $pId && $node->droit >= 70) { if ($pAction == 'MODIFY') { $can = true; } } } break; case 'USER_VIL': if ($pAction == 'MODIFY_VILLE') { // Court-circuite du reste, canMakeInFicheEcole(MODIFY) ayant forcement ete fait avant return true; } foreach ($myNodes as $node) { if ($node->type == 'BU_ECOLE' && $node->id == $pId && $node->droit >= 70) { $can = true; } } if (!$can) { // On verifie si l'ecole est dans sa ville $rEcole = Kernel::getNodeInfo('BU_ECOLE', $pId, false); reset($myNodes); //var_dump($myNodes); //var_dump($rEcole['ALL']); foreach ($myNodes as $node) { if ($node->type == 'BU_VILLE' && $node->id == $rEcole['ALL']->vil_id_vi && $node->droit >= 70) { $can = true; } } } break; } return $can; }
/** * Detail d'une procedure * * @author Christophe Beyer <*****@*****.**> * @since 2008/01/30 * @param object $rFiche Recordset de la procedure */ public function _createContent(&$toReturn) { $tpl = new CopixTpl(); $rFiche = $this->getParam('rFiche'); $errors = $this->getParam('errors'); $ok = $this->getParam('ok'); $print = $this->getParam('print'); //var_dump($rFiche); //$daoType = & _dao ('type'); //$tpl->assign ('arTypes', $daoType->findAll ()); $arResponsables = preg_split('/[\\s,]+/', $rFiche->responsables); $rFiche->tabResponsables = $arResponsables; $mondroit = $this->getParam('mondroit'); $rEcole = Kernel::getNodeInfo('BU_ECOLE', $rFiche->idetabliss, false); //var_dump($rEcole); $rFiche->ecole_nom = $rEcole['ALL']->eco_nom; $rFiche->ecole_type = $rEcole['ALL']->eco_type; $rFiche->ecole_tel = $rEcole['ALL']->eco_tel; $rFiche->ecole_dir = AnnuaireService::getDirecteurInEcole($rFiche->idetabliss); $daoType =& _dao('teleprocedures|type'); if ($tmp = $daoType->get($rFiche->idtype)) { $rFiche->idtype_nom = $tmp->nom; } $daoStatu =& _dao('teleprocedures|statu'); if ($tmp = $daoStatu->get($rFiche->idstatu)) { $rFiche->idstatu_nom = $tmp->nom; } $canDelegue = TeleproceduresService::canMakeInTelep('DELEGUE', $mondroit, array('idinter' => $rFiche->idinter)); $tpl->assign('canDelegue', $canDelegue); $tpl->assign('canViewDelai', TeleproceduresService::canMakeInTelep('VIEW_DELAI', $mondroit)); $tpl->assign('rFiche', $rFiche); $tpl->assign('errors', $errors); $tpl->assign('ok', $ok); $tpl->assign('print', $print); $tplFiche = $tpl->fetch('fiche-zone.tpl'); $toReturn = $tplFiche; return true; }
/** * Affiche la liste déroulante avec toutes les écoles d'une ville * * @author Christophe Beyer <*****@*****.**> * @since 2006/01/06 * @param integer $ville Id de la ville * @param integer $value Valeur actuelle de la combo * @param string $fieldName Nom du champ de type SELECT qui en résulte * @param string $attribs Attributs HTML de la liste (STYLE, ONCHANGE...) */ public function _createContent(&$toReturn) { $tpl = new CopixTpl(); $ville = $this->getParam('ville') ? $this->getParam('ville') : NULL; $value = $this->getParam('value') ? $this->getParam('value') : 0; $fieldName = $this->getParam('fieldName') ? $this->getParam('fieldName') : NULL; $attribs = $this->getParam('attribs') ? $this->getParam('attribs') : NULL; $ecoles = array(); $childs = Kernel::getNodeChilds('BU_VILLE', $ville); foreach ($childs as $child) { if ($child['type'] == 'BU_ECOLE') { $node = Kernel::getNodeInfo($child['type'], $child['id'], false); //print_r($node); $ecoles[] = array('id' => $child['id'], 'nom' => $node['nom']); } } $tpl->assign('items', $ecoles); $tpl->assign('value', $value); $tpl->assign('fieldName', $fieldName); $tpl->assign('attribs', $attribs); $toReturn = $tpl->fetch('comboecoles.tpl'); return true; }
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; }
public function whereAmI($node_type = false, $node_id = false) { // Patch EN2010 return array(); $where = array(); if ($node_type == 'BU_CLASSE') { $where['BU_CLASSE']['type'] = $node_type; $where['BU_CLASSE']['id'] = $node_id; $infos = Kernel::getNodeInfo($node_type, $node_id); $where['BU_CLASSE']['nom'] = $infos['nom']; $parents = Kernel::getNodeParents($node_type, $node_id); $parent = Kernel::filterNodeList($parents, 'BU_ECOLE'); $node_type = $parent[0]["type"]; $node_id = $parent[0]["id"]; } if ($node_type == 'BU_ECOLE') { $where['BU_ECOLE']['type'] = $node_type; $where['BU_ECOLE']['id'] = $node_id; $infos = Kernel::getNodeInfo($node_type, $node_id); $where['BU_ECOLE']['nom'] = $infos['nom']; $parents = Kernel::getNodeParents($node_type, $node_id); $parent = Kernel::filterNodeList($parents, 'BU_VILLE'); $node_type = $parent[0]["type"]; $node_id = $parent[0]["id"]; } if ($node_type == 'BU_VILLE') { $where['BU_VILLE']['type'] = $node_type; $where['BU_VILLE']['id'] = $node_id; $infos = Kernel::getNodeInfo($node_type, $node_id); $where['BU_VILLE']['nom'] = $infos['nom']; $parents = Kernel::getNodeParents($node_type, $node_id); $parent = Kernel::filterNodeList($parents, 'BU_GRVILLE'); $node_type = $parent[0]["type"]; $node_id = $parent[0]["id"]; } if ($node_type == 'BU_GRVILLE') { $where['BU_GRVILLE']['type'] = $node_type; $where['BU_GRVILLE']['id'] = $node_id; $infos = Kernel::getNodeInfo($node_type, $node_id); $where['BU_GRVILLE']['nom'] = $infos['nom']; } return $where; }
/** * 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')); }
/** * Envoi d'une intervention a des mails exterieurs * * @author Christophe Beyer <*****@*****.**> * @since 2009/01/22 * @param integer $id Id de la procedure * @param string $mail_from Expediteur * @param string $mail_to Destinataire * @param string $mail_cc Copie a * @param string $mail_message Message d'accompagnement optionnel */ public function sendMails() { $id = $this->getRequest('id', null); $mail_from = $this->getRequest('mail_from', null); $mail_to = $this->getRequest('mail_to', null); $mail_cc = $this->getRequest('mail_cc', null); $mail_message = $this->getRequest('mail_message', null); $daoIntervention = CopixDAOFactory::create("intervention"); $criticErrors = $errors = array(); if ($id && ($rFiche = $daoIntervention->get($id))) { $title = $rFiche->objet; $mondroit = Kernel::getLevel("MOD_TELEPROCEDURES", $rFiche->type_teleprocedure); if (!TeleproceduresService::canMakeInTelep('SEND_MAILS', $mondroit, array('idinter' => $rFiche->idinter))) { $criticErrors[] = CopixI18N::get('kernel|kernel.error.noRights'); } } else { $criticErrors[] = CopixI18N::get('teleprocedures|teleprocedures.error.prob.telep'); } if (!CopixConfig::get('|mailEnabled')) { $criticErrors[] = CopixI18N::get('teleprocedures|teleprocedures.error.noMailEnabled'); } if ($criticErrors) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => implode('<br/>', $criticErrors), 'back' => CopixUrl::get('teleprocedures||'))); } $fiche = CopixZone::process('fiche', array('rFiche' => $rFiche, 'print' => 1)); $ecoleInfos = Kernel::getNodeInfo('BU_ECOLE', $rFiche->idetabliss, false); $errors = $ok = null; require_once COPIX_UTILS_PATH . 'CopixUtils.lib.php'; if (!$mail_from) { $errors = CopixI18N::get('teleprocedures|teleprocedures.error.mail_from', ''); } else { $list = preg_split("/[\\s,]+/", $mail_from); foreach ($list as $email) { if (!validateEMail($email)) { $errors .= CopixI18N::get('teleprocedures|teleprocedures.error.incorrectMail', $email) . "\n"; } } } if (!$mail_to) { $errors = CopixI18N::get('teleprocedures|teleprocedures.error.mail_to', ''); } else { $list = preg_split("/[\\s,]+/", $mail_to); foreach ($list as $email) { if (!validateEMail($email)) { $errors .= CopixI18N::get('teleprocedures|teleprocedures.error.incorrectMail', $email) . "\n"; } } } if ($mail_cc) { $list = preg_split("/[\\s,]+/", $mail_cc); foreach ($list as $email) { if (!validateEMail($email)) { $errors .= CopixI18N::get('teleprocedures|teleprocedures.error.incorrectMail', $email) . "\n"; } } } if ($errors) { return CopixActionGroup::process('teleprocedures|default::fiche', array('id' => $id, 'errors' => $errors, 'rFiche' => array('mail_from' => $mail_from, 'mail_to' => $mail_to, 'mail_cc' => $mail_cc, 'mail_message' => $mail_message))); } if (!$errors) { require_once COPIX_UTILS_PATH . 'CopixEMailer.class.php'; $from = $fromName = $mail_from; $to = $mail_to; $cc = $cci = null; if ($mail_cc) { $cc = $mail_cc; } $subject = $rFiche->objet . ' / ' . $rFiche->type_nom . ' / ' . $rFiche->ecole_nom; if ($rFiche->ecole_type) { $subject .= ' (' . $rFiche->ecole_type . ')'; } $de = _currentUser()->getExtra('prenom') . ' ' . _currentUser()->getExtra('nom'); $message = ''; $message .= "<p>L'intervention suivante vous est transmise par " . $de . ".</p>"; if ($mail_message) { $message .= '<p>' . nl2br($mail_message) . '</p><hr/>'; } $message .= $fiche; //$from = CopixConfig::get('|mailFrom'); //$fromName = CopixConfig::get('|mailFromName'); $mail = new CopixHtmlEMail($to, $cc, $cci, utf8_decode($subject), utf8_decode($message)); $send = $mail->send($from, $fromName); if (!$send) { $errors = CopixI18N::get('teleprocedures|teleprocedures.error.sendMail'); } else { $ok = CopixI18N::get('teleprocedures|teleprocedures.ok.sendMail', $mail_to); $info_commentaire = "Mail envoyé de {$from} à {$to}"; if ($cc) { $info_commentaire .= " (copie à {$cc})"; } if ($mail_message) { $info_commentaire .= " - Message d'acompagnement : " . $mail_message . ""; } $rFiche->insertInfoSupp(null, $info_commentaire); } } //var_dump($send); if ($errors) { $errors = str_replace("\n", "<br/>", trim($errors)); } if ($ok) { $ok = $ok; } return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('|fiche', array('id' => $id, 'errors' => $errors, 'ok' => $ok))); //return CopixActionGroup::process ('teleprocedures|default::fiche', array ('id'=>$id, 'errors'=>$errors)); }
/** * L'annuaire (TODO temporaire) */ public function view() { $annuaireService =& CopixClassesFactory::Create('annuaire|AnnuaireService'); $classe = _request("classe"); $id = 1; $type = "BU_ECOLE"; $ecole = Kernel::getNodeInfo($type, $id, false); //print_r($ecole); $classes = $enseignants = $directeur = array(); $result = Kernel::getNodeChilds($type, $id); foreach ($result as $key => $value) { //print_r($value); if ($value["type"] == "BU_CLASSE") { $nodeInfo = Kernel::getNodeInfo($value["type"], $value["id"], false); $result[$key]["info"] = $nodeInfo; // Enseignants $childs = Kernel::getNodeChilds($value["type"], $value["id"]); //print_r($childs); $enseignants = array(); foreach ($childs as $child) { if ($child["type"] == "USER_ENS") { $userInfo = Kernel::getUserInfo($child["type"], $child["id"]); // print_r($userInfo); $enseignants[] = $userInfo; } } $result[$key]["enseignants"] = $enseignants; $classes[] = $result[$key]; } elseif ($value["type"] == "USER_ENS") { $droit = Kernel::getLevel($type, $id, $value["type"], $value["id"]); if ($droit >= PROFILE_CCV_ADMIN) { $nodeInfo = Kernel::getUserInfo($value["type"], $value["id"]); //print_r($nodeInfo); $result[$key]["info"] = $nodeInfo; //$enseignants[] = $result[$key]; $directeur = $result[$key]; } } } //print_r($directeur); $ecole["directeur"] = $directeur; //print_r($ecole); $id = $classe; $type = "BU_CLASSE"; $classe = Kernel::getNodeInfo($type, $id, false); $eleves = $enseignants = array(); $result = Kernel::getNodeChilds($type, $id); foreach ($result as $key => $value) { if ($value["type"] == "USER_ELE") { $nodeInfo = Kernel::getUserInfo($value["type"], $value["id"]); $result[$key]["info"] = $nodeInfo; //print_r($result[$key]); $eleves[] = $result[$key]; } elseif ($value["type"] == "USER_ENS") { $userInfo = Kernel::getUserInfo($value["type"], $value["id"]); //print_r($userInfo); $enseignants[] = $userInfo; } } //print_r($eleves); $classe["eleves"] = $annuaireService->order_tab_eleves($eleves); $classe["enseignants"] = $annuaireService->order_tab_enseignants($enseignants); //$classe["enseignants"]=($enseignants); //print_r($classe); $tplListe = new CopixTpl(); $tplListe->assign('ecole', $ecole); $tplListe->assign('classes', $classes); $tplListe->assign('classe', $classe); $tplListe->assign('annu', "<pre>" . $return_str . "</pre>"); $result = $tplListe->fetch("view.tpl"); $tpl = new CopixTpl(); $tpl->assign('TITLE_PAGE', $ecole["nom"] . " (" . $ecole["desc"] . ")"); $tpl->assign("MAIN", $result); $tpl->assign('MENU', $this->menu); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); }
/** * Retourne les classes d'un groupe de villes, avec les infos des enseignants affect�s * * @author Christophe Beyer <*****@*****.**> * @since 2006/01/19 * @param integer $grville Id du groupe de villes * @param array $options Tableau d'options. [droit] pour n'avoir que les classes sur lesquelles on a ce droit * @return array Tableau avec les classes */ public function getClassesInGrville($grville, $options = array()) { $classes = array(); if (isset($options['getNodeInfo_light']) && $options['getNodeInfo_light']) { $getNodeInfo_full = false; } else { $getNodeInfo_full = true; } $matrix =& enic::get('matrixCache'); $childs = Kernel::getNodeChilds('BU_GRVILLE', $grville); foreach ($childs as $child) { if ($child['type'] == 'BU_VILLE') { if (($ville_as_array = Kernel::getKernelLimits('ville_as_array')) && !in_array($child['id'], $ville_as_array)) { continue; } if (isset($options['droit'])) { $tmp = AnnuaireService::getClassesInVille($child['id'], array('droit' => $options['droit'])); } else { $tmp = AnnuaireService::getClassesInVille($child['id']); } if (count($tmp) > 0) { $node = Kernel::getNodeInfo($child['type'], $child['id'], $getNodeInfo_full); $classes[] = array('id' => '0', 'nom' => "----- " . $node['nom'] . " -----"); $classes = array_merge($classes, $tmp); } } } return $classes; }
public function _createContent(&$toReturn) { $ppo = new CopixPPO(); // Récupération des paramètres $id = $this->getParam('node_id'); $ppo->type = $this->getParam('node_type'); $ppo->tab = $this->getParam('tab') ? $this->getParam('tab') : 0; // Récupération de l'utilisateur connecté $ppo->user = _currentUser(); if (!is_null($ppo->type) && !is_null($id)) { $ppo->parent = Kernel::getNodeInfo($ppo->type, $id); $personnelDAO = _ioDAO('kernel|kernel_bu_personnel'); switch ($ppo->type) { case 'BU_GRVILLE': $ppo->persons = $personnelDAO->findCitiesAgentsByCitiesGroupId($id); break; case 'BU_VILLE': $ppo->persons = $personnelDAO->findCityAgentsByCityId($id); break; case 'BU_ECOLE': $personEntityDAO = _ioDAO('kernel|kernel_bu_personnel_entite'); $classroomDAO = _ioDAO('kernel|kernel_bu_ecole_classe'); $classnames = array(); $ppo->persons = $personnelDAO->findAdministrationStaffAndPrincipalBySchoolId($id); foreach ($ppo->persons as $person) { // Pour les enseignants, on récupère leurs affectations pour déterminer s'il est possible de les désaffecter de l'école if ($person->role == DAOKernel_bu_personnel_entite::ROLE_TEACHER && $personEntityDAO->hasTeacherRoleInSchool($person->numero, $id, true)) { $person->hasTeacherRoleInSchool = true; // Récupération du nom des classes ou il est affecté $classnames = array(); $personEntities = $personEntityDAO->getTeacherRoleInSchool($person->numero, $id, true); foreach ($personEntities as $personEntity) { $class = $classroomDAO->get($personEntity->pers_entite_reference); $classnames[] = $class->nom; } $person->classrooms = implode(', ', $classnames); } else { $person->hasTeacherRoleInSchool = false; } } break; case 'BU_CLASSE': // Récupération des enseignants $ppo->persons = $personnelDAO->findTeachersByClassroomId($id); // Récupération des élèves $studentDAO = _ioDAO('kernel|kernel_bu_ele'); $ppo->students = $studentDAO->getStudentsByClass($id); // Récupération des parents $responsableDAO = _ioDAO('kernel|kernel_bu_res'); $ppo->responsables = $responsableDAO->getParentsInClasse($id); _classInclude('gestionautonome|GestionAutonomeService'); $ppo->isTeachersLimitByClassroomReached = false; if (GestionAutonomeService::hasTeachersLimitByClassroom()) { $ppo->isTeachersLimitByClassroomReached = count($ppo->persons) >= CopixConfig::get('gestionautonome|teachersLimitByClassroom'); } $ppo->isStudentsLimitByClassroomReached = false; if (GestionAutonomeService::hasStudentsLimitByClassroom()) { $ppo->isStudentsLimitByClassroomReached = count($ppo->students) >= CopixConfig::get('gestionautonome|studentsLimitByClassroom'); } break; } } // Récupération du catalogue de vocabulaire à utiliser $nodeVocabularyCatalogDAO = _ioDAO('kernel|kernel_i18n_node_vocabularycatalog'); $ppo->vocabularyCatalog = $nodeVocabularyCatalogDAO->getCatalogForNode($ppo->type, $id); // Récupération de l'année scolaire suivante $ppo->nextGrade = _ioDAO('kernel|kernel_bu_annee_scolaire')->getNextGrade(_sessionGet('grade')); $toReturn = $this->_usePPO($ppo, '_persons_data.tpl'); }
/** * 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; }
/** * Envoi de messages prives aux responsables d'une intervention lorsqu'on les change. Envoie un message aux nouveaux responsables * * @author Christophe Beyer <*****@*****.**> * @since 2009/01/22 * @param object $rIntervention Recordset de l'intervention * @param string $responsables Liste des nouveaux responsables (logins separes par virgules) * @return null */ public function alertChangeResponsables($rIntervention, $responsables) { //print_r($rIntervention); //print_r($responsables); $minimailService =& CopixClassesFactory::Create('minimail|minimailService'); $titre = $rIntervention->objet; $auteur = $rIntervention->iduser; $ecoleInfos = Kernel::getNodeInfo('BU_ECOLE', $rIntervention->idetabliss, false); $arOld = $rIntervention->responsables; $arOld = str_replace(array(" "), "", $arOld); $arOld = str_replace(array(",", ";"), ",", $arOld); $arOld = preg_split('/[\\s,]+/', $arOld); $arNew = $responsables; $arNew = str_replace(array(" "), "", $arNew); $arNew = str_replace(array(",", ";"), ",", $arNew); $arNew = preg_split('/[\\s,]+/', $arNew); //print_r($arOld); //print_r($arNew); foreach ($arNew as $login) { if (!in_array($login, $arOld)) { $userInfo = Kernel::getUserInfo('LOGIN', $login); if ($userInfo && $userInfo["user_id"]) { $dest = array($userInfo["user_id"] => 1); $ecole = $ecoleInfos['nom']; $url = CopixUrl::get('teleprocedures||fiche', array("id" => $rIntervention->idinter)); $message = CopixI18N::get('teleprocedures|teleprocedures.message.alertChangeResp', array(1 => $ecole, 2 => $url, 3 => $url)); $message = str_replace("\\n", "\n", $message); $minimailService->sendMinimail($titre, $message, $auteur, $dest, 'dokuwiki'); } } } }
/** * Prépare les actions de gestion des affectations : * - Récupération des paramètres * - Contrôle des droits * - Création du PPO contenant les variables communes * * @return PPO */ protected function _prepareAssignmentsManagement() { $ppo = new CopixPPO(); $nodeId = _request('nodeId', null); $nodeType = _request('nodeType', null); if (is_null($nodeId) || is_null($nodeType)) { return CopixActionGroup::process('generictools|Messages::getError', array('message' => "Une erreur est survenue.", 'back' => CopixUrl::get('gestionautonome||showTree'))); } // Définition des filtres par défaut $ppo->filters = _sessionGet('gestionautonome|assignments_management_filters'); if (null === $ppo->filters) { $ppo->filters = array(); } // Mode de recherche : par structure ou par nom $searchMode = _request('searchMode', 'byStructure'); if (CopixConfig::exists('|can_search_by_name') && CopixConfig::get('|can_search_by_name') && in_array($searchMode, array('byStructure', 'byName'))) { $ppo->filters['searchMode'] = $searchMode; } // Contrôle des droits if ($nodeType == 'BU_CLASSE') { _currentUser()->assertCredential('module:classroom|' . $nodeId . '|student|update@gestionautonome'); // Récupération de la classe $classroomDAO = _ioDAO('kernel|kernel_bu_ecole_classe'); if (!($ppo->classroom = $classroomDAO->get($nodeId))) { return CopixActionGroup::process('generictools|Messages::getError', array('message' => 'La classe d\'origine que vous avez défini n\'existe pas.', 'back' => CopixUrl::get('gestionautonome||showTree'))); } $classroomDatas = Kernel::getNodeInfo('BU_CLASSE', $ppo->classroom->id, true); $cityDAO = _ioDAO('kernel|kernel_bu_ville'); $originCity = $cityDAO->get($classroomDatas['ALL']->eco_id_ville); $ppo->filters['schoolName'] = $classroomDatas['ALL']->eco_nom; $ppo->filters['originGrade'] = $ppo->classroom->annee_scol; $ppo->filters['originCityGroup'] = $originCity->id_grville; $ppo->filters['originCity'] = $classroomDatas['ALL']->eco_id_ville; $ppo->filters['originSchool'] = $classroomDatas['ALL']->eco_numero; $ppo->filters['originClassroom'] = $ppo->classroom->id; $ppo->filters['originUserType'] = 'USER_ELE'; $ppo->filters['destinationCityGroup'] = $originCity->id_grville; $ppo->filters['destinationCity'] = $classroomDatas['ALL']->eco_id_ville; $ppo->filters['destinationSchool'] = $classroomDatas['ALL']->eco_numero; } else { _currentUser()->assertCredential('module:school|' . $nodeId . '|student|update@gestionautonome'); $schoolDatas = Kernel::getNodeInfo('BU_ECOLE', $nodeId, true); $ppo->filters['schoolName'] = $schoolDatas['ALL']->eco_nom; $ppo->filters['originGrade'] = is_null(_sessionGet('grade')) ? Kernel::getAnneeScolaireCourante()->id_as : _sessionGet('grade'); $ppo->filters['originCityGroup'] = $schoolDatas['ALL']->vil_id_grville; $ppo->filters['originCity'] = $schoolDatas['ALL']->vil_id_vi; $ppo->filters['originSchool'] = $schoolDatas['ALL']->eco_numero; $ppo->filters['originClassroom'] = null; $ppo->filters['originUserType'] = 'USER_ELE'; $ppo->filters['destinationCityGroup'] = $schoolDatas['ALL']->vil_id_grville; $ppo->filters['destinationCity'] = $schoolDatas['ALL']->vil_id_vi; $ppo->filters['destinationSchool'] = $schoolDatas['ALL']->eco_numero; } $ppo->filters['originLevel'] = null; $ppo->filters['originLastname'] = null; $ppo->filters['originFirstname'] = null; $ppo->filters['destinationClassroom'] = null; $ppo->filters['destinationLevel'] = null; $ppo->filters['originLastnameSearch'] = null; $ppo->filters['originFirstnameSearch'] = null; $ppo->filters['originUserTypeSearch'] = 'USER_ELE'; // Récupération de l'utilisateur $ppo->user = _currentUser(); $ppo->user->isDirector = $this->user->director !== false ? true : false; $ppo->user->isAnimator = $this->user->animator; // Récupération du catalogue de vocab. à utiliser $nodeVocabularyCatalogDAO = _ioDAO('kernel|kernel_i18n_node_vocabularycatalog'); $ppo->vocabularyCatalog = $nodeVocabularyCatalogDAO->getCatalogForNode('BU_CLASSE', $nodeId); return $ppo; }
/** * walk * * DEBUG: Affichage des parents et enfants d'un noeud, pour valider le * fonctionnement des fonctions getNodeParents et getNodeChilds. * @author Frédéric Mossmann <*****@*****.**> * @see getNodeParents( $type, $id ) * @see getNodeChilds( $type, $id ) */ public function processWalk() { $tpl = new CopixTpl(); $tpl->assign('TITLE_PAGE', "Walk"); $return_left = ""; $return_center = ""; $return_right = ""; if (_request("type")) { $type = _request("type"); $id = _request("id"); } else { if (_currentUser()->getExtra('type') && _currentUser()->getExtra('id')) { $type = _currentUser()->getExtra('type'); $id = _currentUser()->getExtra('id'); } else { $type = "USER_ELE"; $id = 3777; } } $result = Kernel::getNodeParents($type, $id); foreach ($result as $key => $value) { $return_left .= '<a href="' . CopixUrl::get('kernel||walk', array("type" => $value["type"], "id" => $value["id"])) . '">'; $return_left .= $value["type"] . "/" . $value["id"]; if (isset($value["droit"]) && $value["droit"]) { $return_left .= ' (' . $value["droit"] . ')'; } $return_left .= '</a>'; // $tmp = Kernel::getNodeChilds( $value["type"], $value["id"] ); // if( sizeof($tmp) ) $return_left .= " (".sizeof($tmp).")"; $return_left .= '<br />'; } $result = Kernel::getNodeChilds($type, $id); foreach ($result as $key => $value) { // $tmp = Kernel::getNodeChilds( $value["type"], $value["id"] ); // if( sizeof($tmp) ) $return_right .= "(".sizeof($tmp).") "; $return_right .= '<a href="' . CopixUrl::get('kernel||walk', array("type" => $value["type"], "id" => $value["id"])) . '">'; $return_right .= $value["type"] . "/" . $value["id"]; if (isset($value["droit"]) && $value["droit"]) { $return_right .= ' (' . $value["droit"] . ')'; } $return_right .= '</a>'; $return_right .= '<br />'; } $return_center .= $type . "/" . $id; if (ereg("^USER_", $type)) { $user_infos = Kernel::getUserInfo($type, $id); if (isset($user_infos["login"])) { $return_center .= "<br />Login: "******"login"]; } if (isset($user_infos["nom"]) && isset($user_infos["prenom"])) { $return_center .= "<br />("; $return_center .= $user_infos["prenom"] . " " . $user_infos["nom"]; $return_center .= ")"; } } else { $node_infos = Kernel::getNodeInfo($type, $id, false); if (isset($node_infos["nom"])) { $return_center .= "<br />" . $node_infos["nom"]; } if (isset($node_infos["desc"])) { $return_center .= "<br />("; if (strlen($node_infos["desc"]) > 45) { $return_center .= substr($node_infos["desc"], 0, 40) . "..."; } else { $return_center .= $node_infos["desc"]; } $return_center .= ")"; } } $return_str = '<center><h3>' . $return_center . '</h3></center>'; $return_str .= '<table width="100%"><tr><td valign="top" align="left"><strong>Parents</strong></td><td valign="top" align="right"><strong>Childs</strong></td></tr>'; $return_str .= '<tr><td valign="top" align="left">' . $return_left . '</td><td valign="top" align="right">' . $return_right . '</td></tr></table>'; $tpl->assign('MAIN', "<pre>" . $return_str . "</pre>"); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); }
/** * Affiche la série de boutons permettant à l'utilisateur de mettre en forme simplement le texte qu'il saisit dans une zone de texte libre. * * @author Christophe Beyer <*****@*****.**> * @since 2005/12/28 * @param string $field Nom du champ dans le formulaire. Correspond à l'attribut "name" et "id" dans le template (les deux doivent être positionnés) * @param string $format Format de la zone de saisie (wiki, html, fckeditor...) * @param array $objet (option) Module dans lequel se trouve la barre wiki, dans un tableau indexé avec TYPE et ID (exemple: type=>MOD_BLOG, ID=>4). Si positionné, on va vérifier si le parent de cet objet a un album photos, une malle et un classeur, et si oui on affiche les liens vers l'album photos, la malle et le classeur en mode popup */ public function _createContent(&$toReturn) { $tpl = new CopixTpl(); $field = $this->getParam('field', NULL); $format = $this->getParam('format', NULL); $object = $this->getParam('object', NULL); $withAlbum = $this->getParam('withAlbum', true); CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/wikibuttons.js'); if ($field && $format) { $buttonAlbum = $buttonMalle = $buttonClasseur = array(); // Bouton album photos et malle $buttons = array(); // Tableau avec les boutons switch ($format) { case "wiki": CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/format_' . $format . '.js'); $buttons[] = array('titre' => CopixI18N::get('wikibuttons.bold'), 'accesskey' => 'g', 'tabindex' => 10, 'link' => "javascript:bbstyle('','{$field}',0);"); // Gras $buttons[] = array('titre' => CopixI18N::get('wikibuttons.italic'), 'accesskey' => 'i', 'tabindex' => 11, 'link' => "javascript:bbstyle('','{$field}',2);"); // Italique $buttons[] = array('titre' => CopixI18N::get('wikibuttons.image'), 'accesskey' => 'm', 'tabindex' => 12, 'link' => "javascript:bblink('','{$field}',12);"); // Image $buttons[] = array('titre' => CopixI18N::get('wikibuttons.link'), 'accesskey' => 'l', 'tabindex' => 13, 'link' => "javascript:bblink('','{$field}',8);"); // Lien $buttons[] = array('titre' => CopixI18N::get('wikibuttons.hr'), 'accesskey' => 'h', 'tabindex' => 14, 'link' => "javascript:bbcar('','{$field}',4);"); // HR $buttons[] = array('titre' => CopixI18N::get('wikibuttons.h1'), 'accesskey' => 'j', 'tabindex' => 15, 'link' => "javascript:bblink('','{$field}',20);"); // H1 $buttons[] = array('titre' => CopixI18N::get('wikibuttons.h2'), 'accesskey' => 'v', 'tabindex' => 16, 'link' => "javascript:bblink('','{$field}',22);"); // H2 $buttons[] = array('titre' => CopixI18N::get('wikibuttons.h3'), 'accesskey' => 'w', 'tabindex' => 17, 'link' => "javascript:bblink('','{$field}',24);"); // H3 break; case "dokuwiki": CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/format_' . $format . '.js'); $buttons[] = array('titre' => CopixI18N::get('wikibuttons.bold'), 'accesskey' => 'g', 'tabindex' => 10, 'link' => "javascript:bbstyle('','{$field}',0);", 'icon' => 'bold.png'); // Gras $buttons[] = array('titre' => CopixI18N::get('wikibuttons.italic'), 'accesskey' => 'i', 'tabindex' => 11, 'link' => "javascript:bbstyle('','{$field}',2);", 'icon' => 'italic.png'); // Italique $buttons[] = array('titre' => CopixI18N::get('wikibuttons.underline'), 'accesskey' => 's', 'tabindex' => 12, 'link' => "javascript:bbstyle('','{$field}',4);", 'icon' => 'underline.png'); // Souligne $buttons[] = array('titre' => CopixI18N::get('wikibuttons.image'), 'accesskey' => 'm', 'tabindex' => 12, 'link' => "javascript:bblink('','{$field}',12);", 'icon' => 'image.png'); // Image $buttons[] = array('titre' => CopixI18N::get('wikibuttons.link'), 'accesskey' => 'l', 'tabindex' => 13, 'link' => "javascript:bblink('','{$field}',8);", 'icon' => 'linkextern.png'); // Lien $buttons[] = array('titre' => CopixI18N::get('wikibuttons.email'), 'accesskey' => 'e', 'tabindex' => 13, 'link' => "javascript:bblink('','{$field}',10);", 'icon' => '../../tpl/default/images/mail_icon.gif'); // Email $buttons[] = array('titre' => CopixI18N::get('wikibuttons.hr'), 'accesskey' => 'h', 'tabindex' => 14, 'link' => "javascript:bbcar('','{$field}',4);", 'icon' => 'hr.png'); // HR $buttons[] = array('titre' => CopixI18N::get('wikibuttons.h1'), 'accesskey' => 'j', 'tabindex' => 15, 'link' => "javascript:bblink('','{$field}',20);", 'icon' => 'h1.png'); // H1 $buttons[] = array('titre' => CopixI18N::get('wikibuttons.h2'), 'accesskey' => 'v', 'tabindex' => 16, 'link' => "javascript:bblink('','{$field}',22);", 'icon' => 'h2.png'); // H2 $buttons[] = array('titre' => CopixI18N::get('wikibuttons.h3'), 'accesskey' => 'w', 'tabindex' => 17, 'link' => "javascript:bblink('','{$field}',24);", 'icon' => 'h3.png'); // H3 $buttons[] = array('titre' => CopixI18N::get('wikibuttons.ul'), 'accesskey' => 'w', 'tabindex' => 17, 'link' => "javascript:bbcar('','{$field}',5);", 'icon' => 'ul.png'); // UL $buttons[] = array('titre' => CopixI18N::get('wikibuttons.ol'), 'accesskey' => 'w', 'tabindex' => 17, 'link' => "javascript:bbcar('','{$field}',6);", 'icon' => 'ol.png'); // OL break; } if ($object) { $user_type = _currentUser()->getExtra('type'); $user_id = _currentUser()->getExtra('id'); if ('USER' === $object) { Kernel::createMissingModules($user_type, $user_id); $parent = array('type' => $user_type, 'id' => $user_id); } elseif (preg_match('/^MOD_/', $object['type'])) { $parent = Kernel::getModParentInfo($object['type'], $object['id']); } else { $parent = Kernel::getNodeInfo($object['type'], $object['id']); } if ($parent) { $mods = Kernel::getModEnabled($parent['type'], $parent['id']); $alb = Kernel::filterModuleList($mods, 'MOD_ALBUM'); if ($alb && $withAlbum) { $url = CopixUrl::get('album||getpopup', array('album_id' => $alb[0]->module_id, 'field' => $field, 'format' => $format)); $buttonAlbum = array('titre' => CopixI18N::get('wikibuttons.album'), 'accesskey' => 'a', 'tabindex' => 18, 'link' => $url); // Album photos } $mal = Kernel::filterModuleList($mods, 'MOD_MALLE'); if ($mal) { $url = CopixUrl::get('malle|malle|getMallePopup', array('id' => $mal[0]->module_id, 'field' => $field, 'format' => $format)); $buttonMalle = array('titre' => CopixI18N::get('wikibuttons.malleTxt'), 'accesskey' => 'd', 'tabindex' => 19, 'link' => $url); // Malle } $cla = Kernel::filterModuleList($mods, 'MOD_CLASSEUR'); if ($cla) { $url = CopixUrl::get('classeur||getClasseurPopup', array('classeurId' => $cla[0]->module_id, 'field' => $field, 'format' => $format, 'withPersonal' => 1, 'moduleType' => $object['type'], 'moduleId' => $object['id'])); $buttonClasseur = array('titre' => CopixI18N::get('wikibuttons.classeurTxt'), 'accesskey' => 'd', 'tabindex' => 20, 'link' => $url); // Classeur } } } $tpl->assign('format', $format); $tpl->assign('buttons', $buttons); $tpl->assign('buttonAlbum', $buttonAlbum); $tpl->assign('buttonMalle', $buttonMalle); $tpl->assign('buttonClasseur', $buttonClasseur); $tpl->assign('field', $field); $toReturn = $tpl->fetch('wikibuttons.tpl'); } return true; }
/** * Affiche la liste des groupes publics * * @author Christophe Beyer <*****@*****.**> * @since 2005/11/15 * @param integer $page (option, 1 par d�faut) Num�ro de page dans la liste des groupes * @param string $kw (option, NULL par d�faut) Mot cl� en cas de recherche */ public function getListPublic() { if (!Kernel::is_connected()) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.nologin'), 'back' => CopixUrl::get('auth|default|login'))); } $dao = CopixDAOFactory::create("groupe"); $groupeService =& CopixClassesFactory::Create('groupe|groupeService'); $page = $this->getRequest('page', 1); $kw = $this->getRequest('kw'); $offset = ($page - 1) * CopixConfig::get('groupe|list_nbgroupes'); $count = CopixConfig::get('groupe|list_nbgroupes'); $groupesAll = $dao->getListPublic('', '', $kw); $nbPages = ceil(count($groupesAll) / $count); //for Tags Cloud $groupsArray = array(); foreach ($groupesAll as $groupAll) { $groupsArray[] = $groupAll->id; } $list = array_slice($groupesAll, $offset, $count); $groupes = array(); //var_dump($groupes); foreach ($list as $groupe) { $parent = Kernel::getNodeParents("CLUB", $groupe->id); $ok = true; if ($groupe->parent) { $parentInfo = Kernel::getNodeInfo($groupe->parent[0]["type"], $groupe->parent[0]["id"], false); if (isset($parentInfo["nom"])) { $groupe->rattachement = $parentInfo["nom"]; } if (isset($parentInfo["desc"])) { $groupe->rattachement .= " (" . $parentInfo["desc"] . ")"; } } $userInfo = Kernel::getUserInfo("ID", $groupe->createur); $groupe->createur_nom = $userInfo["prenom"] . " " . $userInfo["nom"]; $groupe->createur_infos = $userInfo; $mondroit = Kernel::getLevel("CLUB", $groupe->id); $groupe->mondroit = $mondroit; $members = $groupeService->getNbMembersInGroupe($groupe->id); $groupe->inscrits = $members['inscrits']; $groupe->canViewHome = $groupeService->canMakeInGroupe('VIEW_HOME', $mondroit); $blog = $groupeService->getGroupeBlog($groupe->id); if ($blog && ($blog->is_public || $groupeService->canMakeInGroupe('VIEW_HOME', $mondroit))) { $groupe->blog = $blog; } $groupe->canAdmin = $groupeService->canMakeInGroupe('ADMIN', $mondroit); $groupe->tags = $this->service('tagService')->createLinkForGroup($groupe->id); $groupes[] = $groupe; } $tagsCloud = $this->service('tagService')->createTagsCloud($groupsArray); //_dump($tagsCloud); $this->js->confirm('#groups .subscribe', 'groupe.conf.groupJoin'); $tpl = new CopixTpl(); $tpl->assign('TITLE_PAGE', CopixI18N::get('groupe|groupe.annuaire')); $menu = array(); if ($groupeService->canMakeInGroupe('ADD_GROUP', NULL)) { $menu[] = array('url' => CopixUrl::get('groupe||getEdit'), 'txt' => CopixI18N::get('groupe|groupe.btn.addGroup'), 'size' => 140, 'type' => 'create'); } $tpl->assign('MENU', $menu); $tplListe = new CopixTpl(); $tplListe->assign('list', $groupes); $tplListe->assign('canCreate', $groupeService->canMakeInGroupe('ADD_GROUP', NULL) ? 1 : 0); $tplListe->assign('reglettepages', CopixZone::process('kernel|reglettepages', array('page' => $page, 'nbPages' => $nbPages, 'url' => CopixUrl::get('groupe||getListPublic')))); $tplListe->assign("kw", $kw); $tplListe->assign('tagsCloud', $tagsCloud); $result = $tplListe->fetch("getlist.tpl"); $this->addCss('styles/tag_cloud.css'); $tpl->assign("MAIN", $result); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); }