Пример #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
 public function __construct(array $emails)
 {
     parent::__construct(new UFC_Email($emails));
 }
Пример #3
0
 function handler_contacts($page, $action = null, $subaction = null, $ssaction = null)
 {
     $page->setTitle('Mes contacts');
     $this->_add_rss_link($page);
     // For XSRF protection, checks both the normal xsrf token, and the special RSS token.
     // It allows direct linking to contact adding in the RSS feed.
     if (Env::v('action') && Env::v('token') !== S::user()->token) {
         S::assert_xsrf_token();
     }
     switch (Env::v('action')) {
         case 'retirer':
             if ($contact = Profile::get(Env::v('user'))) {
                 $this->delRegistered($page, $contact);
             }
             break;
         case 'ajouter':
             if ($contact = Profile::get(Env::v('user'))) {
                 $this->addRegistered($page, $contact);
             }
             break;
     }
     $search = false;
     $user = S::user();
     require_once 'userset.inc.php';
     if ($action == 'search') {
         $action = $subaction;
         $subaction = $ssaction;
         $search = true;
     }
     if ($search && trim(Env::v('quick'))) {
         $base = 'carnet/contacts/search';
         $view = new QuickSearchSet(new UFC_Contact($user));
     } else {
         $base = 'carnet/contacts';
         $view = new ProfileSet(new UFC_Contact($user));
     }
     $view->addMod('minifiche', 'Mini-fiches', true);
     $view->addMod('trombi', 'Trombinoscope', false, array('with_admin' => false, 'with_promo' => true));
     $view->addMod('map', 'Planisphère');
     $view->apply('carnet/contacts', $page, $action, $subaction);
     $page->changeTpl('carnet/mescontacts.tpl');
 }
Пример #4
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');
 }