Пример #1
0
 function handler_index($page, $action = '', $subaction = '')
 {
     global $globals;
     if (!$this->isDeltaTenEnabled(S::user(), Profile::DELTATEN_YOUNG)) {
         $page->killError("Ta promotion ne participe pas à l'opération N N-10.");
     }
     if ($this->isDeltaTenEnabled(S::user(), Profile::DELTATEN_OLD)) {
         $profile = S::user()->profile();
         if ($profile->getDeltatenMessage()) {
             $page->trigSuccess("Tu participes bien à l'opération N N-10 en tant qu'ancien.");
         } else {
             $page->trigWarning("Tu ne participes pas encore à l'opération N N-10 en tant qu'ancien.");
         }
     }
     $page->setTitle("Opération N N-10");
     $page->assign('deltaten_promo_old', S::user()->profile()->yearpromo() - 10);
     $wp = new PlWikiPage('Docs.Deltaten');
     $wp->buildCache();
     require_once 'ufbuilder.inc.php';
     $ufb = new UFB_DeltaTenSearch();
     $page->addJsLink('search.js');
     if (!$ufb->isEmpty()) {
         require_once 'userset.inc.php';
         $ufc = $ufb->getUFC();
         if (!$ufc instanceof PFC_And) {
             $ufc = new PFC_And($ufc);
         }
         $ufc->addChild(new UFC_DeltaTen());
         $ufc->addChild(new UFC_Promo('=', UserFilter::GRADE_ING, S::user()->profile()->yearpromo() - 10));
         $set = new ProfileSet($ufc);
         $set->addMod('minifiche', 'Opération N N-10');
         $set->apply('deltaten/search', $page, $action, $subaction);
         $nb_tot = $set->count();
         if ($nb_tot > $globals->search->private_max) {
             $page->assign('formulaire', 1);
             $page->trigError('Recherche trop générale.');
             $page->assign('plset_count', 0);
         } else {
             if ($nb_tot == 0) {
                 $page->assign('formulaire', 1);
                 $page->trigError("Il n'existe personne correspondant à ces critères dans la base.");
             }
         }
     }
     $page->changeTpl('deltaten/index.tpl');
 }
Пример #2
0
 function handler_referent($page, $action = null, $subaction = null)
 {
     global $globals;
     $wp = new PlWikiPage('Docs.Emploi');
     $wp->buildCache();
     $page->setTitle('Emploi et Carrières');
     $page->addJsLink('jquery.ui.xorg.js');
     // Count mentors
     $res = XDB::query("SELECT count(distinct pid) FROM profile_mentor_term");
     $page->assign('mentors_number', $res->fetchOneCell());
     // Search for mentors matching filters
     require_once 'ufbuilder.inc.php';
     $ufb = new UFB_MentorSearch();
     if (!$ufb->isEmpty()) {
         // Search query is logged
         if (S::logged() && !Env::has('page')) {
             S::logger()->log('search_referent', 'adv=' . var_export($_GET, true));
         }
         require_once 'userset.inc.php';
         $ufc = $ufb->getUFC();
         $set = new ProfileSet($ufc);
         $set->addMod('mentor', 'Référents');
         $set->apply('referent/search', $page, $action, $subaction);
         $nb_tot = $set->count();
         if ($nb_tot > $globals->search->private_max) {
             $this->form_prepare();
             $page->trigError('Recherche trop générale.');
             $page->assign('plset_count', 0);
         } else {
             if ($nb_tot == 0) {
                 $this->form_prepare();
                 $page->trigError('Il n\'existe personne correspondant à ces critères dans la base.');
             }
         }
     }
     $page->changeTpl('search/referent.tpl');
 }