예제 #1
0
 public function addPresForUser($usr_id)
 {
     // begin transaction
     global $db;
     $db->beginTransaction();
     try {
         Presentation::deletePresentationsByUserBySession($usr_id, $this->ses_id);
         // Inserts the new session for the user.
         $this->insert_presentation_for_user($usr_id);
         if ($this->pres_paired_pres_id != null) {
             $pairedPresentation = Presentation::getPresentation($this->pres_paired_pres_id);
             // iterate through a change of presentation ids until we get back to where we started.
             while ($pairedPresentation->pres_id != $this->pres_id) {
                 Presentation::deletePresentationsByUserBySession($usr_id, $pairedPresentation->ses_id);
                 // Inserts the new session for the user.
                 $pairedPresentation->insert_presentation_for_user($usr_id);
                 // iterate down the chain of paired presentations.
                 $pairedPresentation = Presentation::getPresentation($pairedPresentation->pres_paired_pres_id);
             }
         }
         // commit transaction
         $db->commit();
     } catch (PDOException $e) {
         // roll back transaction
         $db->rollback();
         // log any errors to file
         log_pdo_exception($e, $usr_id, "Adding Presentation:" . $this, "addPresForUser");
         display_error("Error saving data.");
         exit;
     }
 }
예제 #2
0
파일: index.php 프로젝트: ATCS-BCA/bca-apps
$current_date = time();
$action = filter_input(INPUT_GET, 'action');
$id = 0;
$register_id = 0;
$is_changing = $is_enrolled;
if ($action == "register") {
    if (!($current_date < $start_date || $current_date > $end_date) || isset($_SESSION['prev_usr_id'])) {
        $presentations = get_presentation_list($currentSession, $sort_by, $sort_order);
        include "view.php";
    } else {
        display_user_message("It's not time to enroll yet", "/" . $app_url_path . "/itinerary");
    }
} else {
    if ($action == "commit") {
        $pres_id = filter_input(INPUT_GET, 'pres_id');
        $presentation = Presentation::getPresentation($pres_id);
        // Error -- not time to sign up.
        if (!isset($_SESSION['prev_usr_id'])) {
            if ($current_date < $start_date || $current_date > $end_date) {
                display_user_message("It is not currently time to enroll.  Please check the enrollment dates.", "/" . $app_url_path . "/itinerary");
                exit;
            } else {
                if (!$presentation->has_space()) {
                    display_user_message("The presentation you selected is already full.  Please select another.", "/" . $app_url_path . "/itinerary");
                    exit;
                }
            }
        }
        // All good -- add the presentation!
        //    echo "add";
        $presentation->addPresForUser($user->usr_id);
예제 #3
0
require_once "modele/dao/connection.class.php";
require_once "modele/dao/evenement.class.php";
require_once "modele/dao/presentation.class.php";
require_once "modele/dao/sendmail.class.php";
$currentevent = Evenement::getEventArray();
if (isset($_REQUEST['accueil'])) {
    $event = Evenement::getCurrentEventArray();
    $prezs = Presentation::getPrezByEvent($event['id_evnt']);
    $array['event'] = $event;
    $array['prezs'] = $prezs;
    echo json_encode($array);
}
if (isset($_REQUEST['id'])) {
    $event = Evenement::getCurrentEventArray();
    $prezs = Presentation::getPrezsOrdered($event['id_evnt']);
    $prez = Presentation::getPresentation($_REQUEST['id']);
    $array['liste_prezs'] = $prezs;
    $array['detail_prez'] = $prez;
    echo json_encode($array);
}
if (isset($_REQUEST['haut'])) {
    $event = Evenement::getCurrentEventArray();
    echo json_encode($event);
}
if (isset($_REQUEST['getPosition'])) {
    $position = Evenement::getCurrentEventArray();
    echo json_encode($position);
}
if (isset($_POST['send_mail'])) {
    $subject = $_POST['subject'];
    $texte = $_POST['message'];