abc/application/controllers/Registration.php
Ian Christensen 6822968785 added files
2019-06-27 08:19:59 -07:00

362 lines
10 KiB
PHP

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Registration extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->helper('url');
$this->load->helper('form');
$this->load->library('form_validation');
$this->load->library('session');
$this->load->model('Index_model');
}
public function index($locat_id=NULL)
{
$data['reg_location']=$this->Index_model->reg_location();
$first_locat=$this->Index_model->first_location();
$data['first_loc']=$first_locat->locat_id;
if($locat_id)
{
$loc = $locat_id;
}
else
{
$loc = $first_locat->locat_id;
}
$data['reg_class']=$this->Index_model->reg_class($loc);
$this->load->view('front/index',$data);
}
public function reset_fn()
{
$this->session->sess_destroy();
redirect(base_url());
}
public function unset_fn($form,$key,$price,$type)
{
if($type=='M')
{
$member = $this->session->userdata('member'.$form);
foreach ($member as $count => $subArr) {
unset($member[$count][$key]);
}
$this->session->set_userdata('member'.$form,$member);
$classtotal = $this->session->userdata('classtotal'.$form);
$currentp = $classtotal - $price;
$this->session->set_userdata('classtotal'.$form,$currentp);
}
elseif($type=='M2')
{
$memplus = $this->session->userdata('memplus'.$form);
foreach ($memplus as $count => $subArr) {
unset($memplus[$count][$key]);
}
$this->session->set_userdata('memplus'.$form,$memplus);
$classtotal = $this->session->userdata('classtotal'.$form);
$currentp = $classtotal - $price;
$this->session->set_userdata('classtotal'.$form,$currentp);
}
elseif ($type=='N')
{
$nonmember = $this->session->userdata('nonmember'.$form);
foreach ($nonmember as $count => $subArr) {
unset($nonmember[$count][$key]);
}
$this->session->set_userdata('nonmember'.$form,$nonmember);
$classtotal = $this->session->userdata('classtotal'.$form);
$currentp = $classtotal - $price;
$this->session->set_userdata('classtotal'.$form,$currentp);
}
elseif ($type=='N2')
{
$nonplus = $this->session->userdata('nonplus'.$form);
foreach ($nonplus as $count => $subArr) {
unset($nonplus[$count][$key]);
}
$this->session->set_userdata('nonplus'.$form,$nonplus);
$classtotal = $this->session->userdata('classtotal'.$form);
$currentp = $classtotal - $price;
$this->session->set_userdata('classtotal'.$form,$currentp);
}
elseif ($type=='S')
{
$semember = $this->session->userdata('semember'.$form);
foreach ($semember as $count => $subArr) {
unset($semember[$count][$key]);
}
$this->session->set_userdata('semember'.$form,$semember);
$classtotal = $this->session->userdata('classtotal'.$form);
$currentp = $classtotal - $price;
$this->session->set_userdata('classtotal'.$form,$currentp);
}
$urlcheck = $this->session->userdata('urlcheck');
if($urlcheck)
{
redirect('loc-class/'.$urlcheck);
}else{
redirect(base_url());
}
}
public function manage_reg()
{
$form_class = $this->input->post('form_class');
if(!empty($form_class))
{
foreach ($form_class as $form)
{
if (!empty($this->input->post('m_first_name_'.$form)) || isset($this->input->post('m_first_name_'.$form)['m_first_name_'.$form]))
{
foreach ($this->input->post('m_first_name_'.$form) as $mnamecount => $value)
{
if (!empty($value))
{
$member[$form]['M'][$mnamecount]['first_name'] = $value;
}
}
foreach ($this->input->post('m_last_name_'.$form) as $mnamecount => $value)
{
if (!empty($value))
{
$member[$form]['M'][$mnamecount]['last_name'] = $value;
}
}
foreach ($this->input->post('m_email_id_'.$form) as $mnamecount => $value)
{
if (!empty($value))
{
$member[$form]['M'][$mnamecount]['email_id'] = $value;
}
}
foreach ($this->input->post('m_phone_no_'.$form) as $mnamecount => $value)
{
if (!empty($value))
{
$member[$form]['M'][$mnamecount]['phone_no'] = $value;
}
}
foreach ($this->input->post('m_ssn_'.$form) as $mnamecount => $value)
{
if (!empty($value))
{
$member[$form]['M'][$mnamecount]['ssn'] = $value;
}
}
if(!empty($member))
{
$this->session->set_userdata('member'.$form,$member[$form]); /* Session Of Member */
}
else { $m = 0; }
}
if (!empty($this->input->post('mp_first_name_'.$form)) || isset($this->input->post('mp_first_name_'.$form)['mp_first_name_'.$form]))
{
foreach ($this->input->post('mp_first_name_'.$form) as $mplusnmeount => $value)
{
if (!empty($value))
{
$memplus[$form]['M2'][$mplusnmeount]['first_name'] = $value;
}
}
foreach ($this->input->post('mp_last_name_'.$form) as $mplusnmeount => $value)
{
if (!empty($value))
{
$memplus[$form]['M2'][$mplusnmeount]['last_name'] = $value;
}
}
foreach ($this->input->post('mp_email_id_'.$form) as $mplusnmeount => $value)
{
if (!empty($value))
{
$memplus[$form]['M2'][$mplusnmeount]['email_id'] = $value;
}
}
foreach ($this->input->post('mp_phone_no_'.$form) as $mplusnmeount => $value)
{
if (!empty($value))
{
$memplus[$form]['M2'][$mplusnmeount]['phone_no'] = $value;
}
}
foreach ($this->input->post('mp_ssn_'.$form) as $mplusnmeount => $value)
{
if (!empty($value))
{
$memplus[$form]['M2'][$mplusnmeount]['ssn'] = $value;
}
}
if(!empty($memplus))
{
$this->session->set_userdata('memplus'.$form,$memplus[$form]); /* Session Of Member 2+ */
}
else { $mp = 0; }
}
if (!empty($this->input->post('n_first_name_'.$form)) || isset($this->input->post('n_first_name_'.$form)['n_first_name_'.$form]))
{
foreach ($this->input->post('n_first_name_'.$form) as $nnamecount => $value)
{
if (!empty($value))
{
$nonmember[$form]['N'][$nnamecount]['first_name'] = $value;
}
}
foreach ($this->input->post('n_last_name_'.$form) as $nnamecount => $value)
{
if (!empty($value))
{
$nonmember[$form]['N'][$nnamecount]['last_name'] = $value;
}
}
foreach ($this->input->post('n_email_id_'.$form) as $nnamecount => $value)
{
if (!empty($value))
{
$nonmember[$form]['N'][$nnamecount]['email_id'] = $value;
}
}
foreach ($this->input->post('n_phone_no_'.$form) as $nnamecount => $value)
{
if (!empty($value))
{
$nonmember[$form]['N'][$nnamecount]['phone_no'] = $value;
}
}
foreach ($this->input->post('n_ssn_'.$form) as $nnamecount => $value)
{
if (!empty($value))
{
$nonmember[$form]['N'][$nnamecount]['ssn'] = $value;
}
}
if(!empty($nonmember))
{
$this->session->set_userdata('nonmember'.$form,$nonmember[$form]); /* Session Of Non Member */
}
else { $n = 0; }
}
if (!empty($this->input->post('np_first_name_'.$form)) || isset($this->input->post('np_first_name_'.$form)['np_first_name_'.$form]))
{
foreach ($this->input->post('np_first_name_'.$form) as $nplusnmeount => $value)
{
if (!empty($value))
{
$nonplus[$form]['N2'][$nplusnmeount]['first_name'] = $value;
}
}
foreach ($this->input->post('np_last_name_'.$form) as $nplusnmeount => $value)
{
if (!empty($value))
{
$nonplus[$form]['N2'][$nplusnmeount]['last_name'] = $value;
}
}
foreach ($this->input->post('np_email_id_'.$form) as $nplusnmeount => $value)
{
if (!empty($value))
{
$nonplus[$form]['N2'][$nplusnmeount]['email_id'] = $value;
}
}
foreach ($this->input->post('np_phone_no_'.$form) as $nplusnmeount => $value)
{
if (!empty($value))
{
$nonplus[$form]['N2'][$nplusnmeount]['phone_no'] = $value;
}
}
foreach ($this->input->post('np_ssn_'.$form) as $nplusnmeount => $value)
{
if (!empty($value))
{
$nonplus[$form]['N2'][$nplusnmeount]['ssn'] = $value;
}
}
if(!empty($nonplus))
{
$this->session->set_userdata('nonplus'.$form,$nonplus[$form]); /* Session Of Non Member 2+*/
}
else { $np = 0; }
}
if (!empty($this->input->post('s_first_name_'.$form)) || isset($this->input->post('s_first_name_'.$form)['s_first_name_'.$form]))
{
foreach ($this->input->post('s_first_name_'.$form) as $snamecount => $value)
{
if (!empty($value))
{
$semember[$form]['S'][$snamecount]['first_name'] = $value;
}
}
foreach ($this->input->post('s_last_name_'.$form) as $snamecount => $value)
{
if (!empty($value))
{
$semember[$form]['S'][$snamecount]['last_name'] = $value;
}
}
foreach ($this->input->post('s_email_id_'.$form) as $snamecount => $value)
{
if (!empty($value))
{
$semember[$form]['S'][$snamecount]['email_id'] = $value;
}
}
foreach ($this->input->post('s_phone_no_'.$form) as $snamecount => $value)
{
if (!empty($value))
{
$semember[$form]['S'][$snamecount]['phone_no'] = $value;
}
}
foreach ($this->input->post('s_ssn_'.$form) as $snamecount => $value)
{
if (!empty($value))
{
$semember[$form]['S'][$snamecount]['ssn'] = $value;
}
}
if(!empty($semember))
{
$this->session->set_userdata('semember'.$form,$semember[$form]); /* Session Of Subscribing Employer */
}
else { $s = 0; }
}
// if($m==0 && $mp==0 && $n==0 && $np==0 && $s==0)
// {
// $currenturl = $this->session->userdata('urlcheck');
// $this->session->sess_destroy();
// if($currenturl)
// {
// redirect('loc-class/'.$currenturl);
// }
// else
// {
// redirect(base_url());
// }
// }
}
}
$this->session->set_userdata('cart',$form_class);
redirect('review-order');
}
}
?>