<?php
if(basename(__FILE__) == basename($_SERVER['PHP_SELF'])){exit();}
global $config;
require_once 'config/class/class.database.php';
$db = new database();

require_once 'config/class/class.memberspace.php';
$member = new member_space();
if (!$member->ismembre()) header("Location: ".$config['app_url']."login-connexion");
if ($config['smib_encours_finie']==1) header("Location: ".$config['app_url']."profil");
?>


<?php $_shouldextend[1]=1; ?>


<?php $this->startSection('wisra_basic_content'); ?>
 @parentXYZABC



<div class="content-wrapper">
 <section id="sidebar-promo" class="sidebar-promo sidebar-promo--narrow">
 <picture class="sidebar-promo__picture">
 <img src="<?php echo $config['app_url'] ?>sources/image/basic/semi-marathon.jpg" alt="<?php echo $config['app_name'] ?> hero image" class="sidebar-promo__background">
 </picture>
 <div class="sidebar-promo__header-logo sidebar-promo__header-logo--center" tabindex="0">
 <h1 class="accessible-text">SemiMarathon Béjaia</h1>
 <span>
 <img src="<?php echo $config['app_url'] ?>sources/image/basic/semi-marathon-bejaia.png" alt="<?php echo $config['app_name'] ?> logo">
 </span>
 </div>
 </section>
 <div class="content-section">

 <div class="content-section__header" tabindex="0">
 <a href="<?php echo $config['app_url'] ?>profil" class="content-section__header-button content-section__header-button--narrow content-section__header-button--home button button--transparent button--italic">
 <img type="image/svg+xml" src="<?php echo $config['app_url'] ?>sources/image/svg/left-arrow.svg" width="13" height="16"/>
 <span class="u-hide-phablet">Retour au profil</span>
 </a>
 <span class="content-section__header-text"></span>
 </div>

 <section class="content-section__form-container">

 <h1 class="content-section__heading" tabindex="0">
 <span class="content-section__bold">Participer</span>
 </h1>

 <p class="content-section__subheading" tabindex="0">
 Participez à la <?php echo date('Y')-2006; ?>ème édition du Semi Marathon International de la ville de Béjaia
 </p>

<?php
 $req = "SELECT * FROM member_particip WHERE membre=:id AND annee=:annee AND removed=0;";
 $arg = array('id'=>$_SESSION['id'], 'annee'=>$config['smib_annee_encours']);
 $donnee = $db->select($req, $arg, false);
 if (empty($donnee)) {
 $req = "SELECT datnes FROM member WHERE id=:id AND removed=0;";
 $arg = array('id'=>$_SESSION['id']);
 $donnee = $db->select($req, $arg, false);
 $ageage = date('Y', time()) - date('Y', $donnee['datnes']);
?>
 <section class="info-notice">
 <h2 class="info-notice__sub-text">
 Avoir un compte ne suffit pas pour pouvoir participer, vous devez confirmer votre participation sur cette page
 </h2>
 </section>


 <label class="user-form__label" for="particip-course">
 Course <span class="required-field">*</span>
 </label>
 <select name="particip-course" id="particip-course" class="user-form__input user-form__select">
 <option selected="selected" value="0">Sélectionnez votre course</option>
<?php if ($ageage>=16) { ?>
 <option value="1">21Km</option>
 <option value="2">7Km</option>
<?php } elseif ($ageage>=14) { ?>
 <option value="2">7Km</option>
<?php } ?>
 </select>
 <span id="participcourseError" class="user-form__error-label">
 Veuillez sélectionner une course
 </span>


 <input type="hidden" id="particip-heberg" value="0">



 <label class="user-form__label" for="particip-handi">
 Handisport <span class="required-field">*</span>
 </label>
 <select name="particip-handi" id="particip-handi" class="user-form__input user-form__select">
 <option value="9">Sélectionnez Oui/Non</option>
 <option value="0" selected>Non</option>
 <option value="1">Oui</option>
 </select>
 <span id="participhandiError" class="user-form__error-label">
 Veuillez sélectionner une option
 </span>


 <label class="user-form__label" for="register-phone-2">
 Numéro de téléphone de secours <span class="required-field">*</span>
 </label>
 <input class="user-form__input" id="register-phone-2" type="tel" placeholder="Numéro de quelqu'un de votre famille +213770434566" name="register-phone-2">
 <span id="registerphone2Error" class="user-form__error-label user-form__error-label--show">
 Numéro de téléphone de quelqu'un de votre famille (en cas d'urgence)
 </span>

 <hr/>
 <div class="user-form__checkbox user-form__checkbox--margin-bottom-small">
 <input class="user-form__checkbox-input" id="registration-messaging-checkbox-one" type="checkbox" name="nlSubscription" onclick="this.blur()">
 <label for="registration-messaging-checkbox-one" class="user-form__label user-form__label--checkbox">
 Je déclare ne participer à la course que si je suis médicalement apte à le faire.
 </label>
 </div><!--
 <div class="user-form__checkbox user-form__checkbox--margin-bottom-small">
 <input class="user-form__checkbox-input" id="registration-messaging-checkbox-two" type="checkbox" name="nlSubscription" onclick="this.blur()">
 <label for="registration-messaging-checkbox-two" class="user-form__label user-form__label--checkbox">
 En m'inscrivant je déclare respecter toutes les conditions exigées en matière de protocole sanitaire à savoir: <br/>
▪︎ Respect de la distanciation <br/>
▪︎ Le port de la bavette <br/>
▪︎ L'hygiène des mains <br/>
▪︎ La vaccination
 </label>
 </div>-->

<?php
 if ($config['smib_encours_finie']==0) {
 if ($config['smib_control_opa']==0 && !in_array($_SESSION['id'], $config['smib_not_run'])) {
?>
 <button id="validparticipa" class="button button--primary user-form__submit-button user-form__submit-button--margin-top" type="submit" name="complete registration button">
 <span class="user-form__submit-button-text">
 Valider
 </span>
 </button>
<?php }} elseif ($config['smib_encours_finie']==2) { ?>
 <button class="button button--primary user-form__submit-button user-form__submit-button--margin-top" type="submit" name="complete registration button">
 <span class="user-form__submit-button-text">
 La participation n'est pas encore ouverte
 </span>
 </button>
<?php } ?>
 <hr/>

 <section class="info-notice danger__color">
 <h2 class="info-notice__sub-text">
 Une <b>copie de la pièce d'identité est obligatoire</b> lors de la récupération des dossards
 </h2>
 </section>

 <section class="info-notice danger__color" id="handionly">
 <h2 class="info-notice__sub-text">
 Une <b>copie de la carte handicapé est obligatoire</b> lors de la récupération des dossards pour les handisports.
 </h2>
 </section>

 <section class="info-notice danger__color">
 <h2 class="info-notice__sub-text">
 Les dossards des courses d'adultes ne sont pas gratuits, les prix des dossards sont<br/> 
 <b><?php echo $config['smib_prix_doss_p'];?> DZD</b> pour la course populaire et <b><?php echo $config['smib_prix_doss_s'];?></b> DZD pour le semi marathon.
 </h2>
 </section>


<?php
 } else {
 $req = "
 SELECT A.datnes, B.course, B.handis, B.tel_2 FROM member A 
 INNER JOIN member_particip B ON B.membre=:id AND B.annee=:annee AND B.removed=0
 WHERE A.id=:id AND A.removed=0;
 ";
 $arg = array('id'=>$_SESSION['id'], 'annee'=>$config['smib_annee_encours']);
 $infos = $db->select($req, $arg, false);
 $ageage = date('Y', time()) - date('Y', $infos['datnes']);
?>

<?php if ($donnee['dossard']==0) {?>
 <section class="info-notice">
 <h2 class="info-notice__sub-text">
 Vous êtes déja inscrit pour participer à la <?php echo date('Y')-2005; ?>ème édition du Semi Marathon de Béjaia, Vous pouvez toujours modifier ou annuler votre participation.
 </h2>
 </section>

 <label class="user-form__label" for="particip-course">
 Course <span class="required-field">*</span>
 </label>
 <select name="particip-course" id="particip-course" class="user-form__input user-form__select">
 <option selected="selected" value="0">Sélectionnez votre course</option>
<?php if ($ageage>=18) { ?>
 <option value="1"<?php echo ($infos['course']==1)?' selected':'' ?>>21Km</option>
 <option value="2"<?php echo ($infos['course']==2)?' selected':'' ?>>7Km</option>
<?php } elseif ($ageage>=16) { ?>
 <option value="2"<?php echo ($infos['course']==2)?' selected':'' ?>>7Km</option>
<?php } ?>
 </select>
 <span id="participcourseError" class="user-form__error-label">
 Veuillez sélectionner une course
 </span>


 <input type="hidden" id="particip-heberg" value="0">



 <label class="user-form__label" for="particip-handi">
 Handisport <span class="required-field">*</span>
 </label>
 <select name="particip-handi" id="particip-handi" class="user-form__input user-form__select">
 <option value="9">Sélectionnez Oui/Non</option>
 <option value="0"<?php echo ($infos['handis']==0)?' selected':'' ?>>Non</option>
 <option value="1"<?php echo ($infos['handis']==1)?' selected':'' ?>>Oui</option>
 </select>
 <span id="participhandiError" class="user-form__error-label">
 Veuillez sélectionner une option
 </span>


 <label class="user-form__label" for="register-phone-2">
 Numéro de téléphone de secours <span class="required-field">*</span>
 </label>
 <input class="user-form__input" id="register-phone-2" type="tel" placeholder="Numéro de quelqu'un de votre famille +213770434566" name="register-phone-2" value="<?php echo $infos['tel_2'] ?>">
 <span id="registerphone2Error" class="user-form__error-label user-form__error-label--show">
 Numéro de téléphone de quelqu'un de votre famille (en cas d'urgence)
 </span>

 <label class="user-form__label" for="particip-pass">
 Mot de passe si vous voulez annuler <span class="required-field">*</span>
 </label>
 <input class="user-form__input" id="particip-pass" type="password" placeholder="Votre mot de passe" name="particip-pass">
 <span id="particippassError" class="user-form__error-label">
 Veuillez entrer votre mot de passe
 </span>

 <hr/>
<?php if ($config['smib_control_opa']==0) {?>
 <button id="validparticipa" class="button button--primary user-form__submit-button user-form__submit-button--margin-top" type="submit" name="complete registration button">
 <span class="user-form__submit-button-text">
 Modifier
 </span>
 </button>

 <button id="annulparticipa" class="button button--primary user-form__submit-button user-form__submit-button--margin-top" type="submit" name="complete registration button">
 <span class="user-form__submit-button-text">
 Annuler votre participation
 </span>
 </button>

 <hr/>
<?php } ?>
 <section class="info-notice danger__color">
 <h2 class="info-notice__sub-text">
 Une <b>copie de la pièce d'identité est obligatoire</b> lors de la récupération des dossards
 </h2>
 </section>

 <section class="info-notice danger__color" id="handionly">
 <h2 class="info-notice__sub-text">
 Une <b>copie de la carte handicapé est obligatoire</b> lors de la récupération des dossards pour les handisports.
 </h2>
 </section>

 <section class="info-notice danger__color">
 <h2 class="info-notice__sub-text">
 Les dossards des courses d'adultes ne sont pas gratuits, les prix des dossards sont<br/> 
 <b><?php echo $config['smib_prix_doss_p'];?> DZD</b> pour la course populaire et <b><?php echo $config['smib_prix_doss_s'];?></b> DZD pour le semi marathon.
 </h2>
 </section>
<?php } else {?>
 <section class="info-notice danger__color">
 <h2 class="info-notice__sub-text">
 Vous avez retiré votre dossard donc vous ne pouvez pas annuler votre participation, vous avez toujours le droit de ne pas venir le jour de la course.
 </h2>
 </section>
<?php } ?>
<?php }?>

 </section>

 <?php include_once("sources/include/sponsorx.php");?>
 </div>
</div>

 
 
<?php $this->stopSection(); ?>


<?php /*-------------------------------------- Put here your additional CSS files for this page --------------------------------------*/ ?>
<?php $this->startSection('wisra_css_content'); ?>
<link href="<?php echo $config['app_url'];?>sources/plugin/toastr/toastr.min.css" rel="stylesheet" type="text/css">
<?php $this->stopSection(); ?>


<?php /*-------------------------------------- Put here your additional JS files  for this page --------------------------------------*/ ?>
<?php $this->startSection('wisra_js_content'); ?>
<script src="<?php echo $config['app_url'];?>sources/plugin/toastr/toastr.min.js"></script>
<script src="<?php echo $config['app_url'];?>sources/script/member.js"></script>
<?php $this->stopSection(); ?>
<?php if (@$_shouldextend[1]) { echo $this->runChild('layoutform', ['page_data' => array(
 'plugins' => array(), 
 'title' => "Connexion | Semi Marathon International de Béjaia", 
 'description' => "Se connecter au Semi Marathon International de la ville de Béjaia", 
 'keywords' => array("SMIB", "Semi Marathon", "Semi Marathon de Béjaia", "Semi Marathon International de Béjaia", "Semi Marathon International de la ville de Béjaia", "Se connecter", "Connexion au Semi Marathon", "Connexion au Semi Marathon de Béjaia", "Connexion au Semi Marathon International de Béjaia", "Connexion au Semi Marathon International de la ville de Béjaia", "Course a pied", "Course a pieds", "Course à pied", "Course à pieds", "Course a pieds 21 km", "Course a pieds 7km", "Course a pieds hommes femmes", "Course a pieds algérie"), 
 'facebook_integration' => false, 
 'google_maps_callback' => ''
)]); } ?>