public function _createContent(&$toReturn) { $ppo = new CopixPPO(); // Récupérations des filtres en session $ppo->selected = $this->getParam('selected', null); $ppo->withLabel = $this->getParam('with_label', true); $ppo->withEmpty = $this->getParam('with_empty', true); $ppo->labelEmpty = $this->getParam('label_empty', null); $ppo->name = $this->getParam('name', null); $ppo->all = $this->getParam('all', false); $grade = $this->getParam('grade', _sessionGet('grade', Kernel::getAnneeScolaireCourante()->id_as)); if (!is_null($schoolId = $this->getParam('school_id', null))) { // Récupération des écoles de la ville sélectionnée pour liste déroulante $classroomDAO = _ioDAO('kernel|kernel_bu_ecole_classe'); if (_currentUser()->testCredential('module:school|' . $schoolId . '|classroom|create@gestionautonome') || $ppo->all) { $classes = $classroomDAO->getBySchool($schoolId, $grade); } else { $groups = _currentUser()->getGroups(); $classes = $classroomDAO->findBySchoolIdAndUserGroups($schoolId, $groups['gestionautonome|iconitogrouphandler'], $grade); } $ppo->classesIds = array(); $ppo->classesNames = array(); foreach ($classes as $class) { $ppo->classesIds[] = $class->id; $ppo->classesNames[] = $class->nom; } } $toReturn = $this->_usePPO($ppo, '_filter_class.tpl'); }
/** * Affichage des classes */ public function _createContent(&$toReturn) { $ppo = new CopixPPO(); // Récupération de l'année scolaire if (is_null($grade = _sessionGet('grade'))) { $grade = Kernel::getAnneeScolaireCourante()->id_as; } if (is_null($schoolId = $this->getParam('school_id'))) { $toReturn = ''; return; } $classroomDAO = _ioDAO('kernel|kernel_bu_ecole_classe'); if (_currentUser()->testCredential('module:school|' . $schoolId . '|classroom|create@gestionautonome')) { $ppo->classrooms = $classroomDAO->getBySchool($schoolId, $grade); } else { $groups = _currentUser()->getGroups(); $ppo->classrooms = $classroomDAO->findBySchoolIdAndUserGroups($schoolId, $groups['gestionautonome|iconitogrouphandler'], $grade); } $toReturn = $this->_usePPO($ppo, '_classroom.tpl'); }
/** * Retourne si une entité à un rôle d'enseignant dans les classes d'une école donnée * * @param int $id * @param int $schoolId * @param bool $forCurrentGrade * * @return bool */ public function getTeacherRoleInSchool($id, $schoolId, $forCurrentGrade = false) { $toReturn = false; $schoolClassDAO = _ioDAO('kernel|kernel_bu_ecole_classe'); if ($forCurrentGrade) { if (is_null($grade = _sessionGet('grade'))) { $grade = Kernel::getAnneeScolaireCourante()->id_as; } $classrooms = $schoolClassDAO->getBySchool($schoolId, $grade); } else { $classrooms = $schoolClassDAO->getBySchool($schoolId); } foreach ($classrooms as $classroom) { if ($entity = self::getByIdReferenceAndType($id, $classroom->id, 'CLASSE')) { $toReturn[] = $entity; } } return $toReturn; }
/** * Affichage de la fiche d'une ecole * * @author Christophe Beyer <*****@*****.**> * @since 2008/09/03 * @param integer $id Id de l'ecole */ public function blogs() { $id = $this->getRequest('id', null); $pAnnee = $this->getRequest('annee', null); // $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||'))); } $arClasses = AnnuaireService::getClassesInEcole($rEcole->numero, array('forceCanViewEns' => true, 'onlyWithBlog' => true, 'onlyWithBlogIsPublic' => 1, 'enseignant' => false, 'annee' => $pAnnee)); $rEcole->blog = getNodeBlog('BU_ECOLE', $rEcole->numero, array('is_public' => 1)); // Get vocabulary catalog to use $nodeVocabularyCatalogDAO = _ioDAO('kernel|kernel_i18n_node_vocabularycatalog'); $vocabularyCatalog = $nodeVocabularyCatalogDAO->getCatalogForNode('BU_ECOLE', $id); $tpl = new CopixTpl(); $tpl->assign('rEcole', $rEcole); $tpl->assign('arClasses', $arClasses); $tpl->assign('catalog', $vocabularyCatalog->id_vc); if ($anneeDebutBlogs = CopixConfig::get('fichesecoles|anneeDebutBlogs')) { $anneeFinBlogs = Kernel::getAnneeScolaireCourante()->id_as; //Kernel::deb("anneeDebutBlogs=$anneeDebutBlogs / anneeFinBlogs=$anneeFinBlogs"); if (!$pAnnee) { $pAnnee = $anneeFinBlogs; } if ($anneeFinBlogs > $anneeDebutBlogs) { $comboAnnees = CopixZone::process('kernel|combo_annees', array('name' => 'annee', 'selected' => $pAnnee, 'debut' => $anneeDebutBlogs, 'fin' => $anneeFinBlogs, 'extra2' => 'onChange="ficheViewBlogs(' . $id . ',this.options[this.selectedIndex].value);"')); $tpl->assign('comboAnnees', $comboAnnees); } } $result = $tpl->fetch('blogs.tpl'); header('Content-type: text/html; charset=utf-8'); //echo utf8_encode($result); echo $result; return new CopixActionReturn(COPIX_AR_NONE, 0); }
/** * 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'); }