Пример #1
0
function getSelectHtml($name, $currentValue, $options, $attributes = array())
{
    $defaultAttributes = array('size' => 1, 'id' => $name, 'name' => $name);
    $finalAttributes = array_merge($defaultAttributes, $attributes);
    $content = getOptionGroup($options, $currentValue);
    return getElementHtml('select', $finalAttributes, $content);
}
Пример #2
0
 function getOptionGroup($options, $currentValue)
 {
     $content = '';
     foreach ($options as $optionKey => $optionValue) {
         if (is_array($optionValue)) {
             $content .= '<optgroup label="' . $optionKey . '">' . getOptionGroup($optionValue, $currentValue) . '</optgroup>';
         } else {
             $optionAttributes = array();
             if ($currentValue == $optionKey) {
                 $optionAttributes['selected'] = 'selected';
             }
             $content .= $this->getOptionHtml($optionKey, $optionValue, $optionAttributes);
         }
     }
     return $content;
 }
Пример #3
0
 function added_member()
 {
     $this->data['mainTab'] = 'member';
     $this->data['activeTab'] = 'register_member';
     $this->load->library('form_validation');
     $this->form_validation->set_rules('name', 'Name', 'trim|required|xss_clean');
     $this->form_validation->set_rules('bank_info', 'Bank Info', 'trim|xss_clean');
     $this->form_validation->set_rules('household_size', 'House Host size', 'trim|xss_clean');
     $this->form_validation->set_rules('member_title', 'Member Title', 'trim|xss_clean');
     $this->form_validation->set_rules('user_type', 'User Type', 'trim|required|xss_clean');
     $this->form_validation->set_rules('person_number', 'Person Number', 'trim|required|xss_clean|callback_check_person_number');
     $this->form_validation->set_rules('expire_date', 'Expire Date', 'trim|required|xss_clean');
     $this->form_validation->set_rules('address', 'Address', 'trim|required|xss_clean');
     $this->form_validation->set_rules('phone', 'Phone', 'trim|required|xss_clean');
     $this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email|xss_clean|callback_check_member_email');
     $this->form_validation->set_rules('username', 'Username', 'trim|required|xss_clean|callback_check_member_username');
     $this->form_validation->set_rules('member_group', 'Group', 'trim|required|xss_clean');
     $this->form_validation->set_rules('password', 'Password', 'trim|required|xss_clean|min_length[10]|');
     if ($this->form_validation->run() == FALSE) {
         $this->data['OptionsClient'] = getOptionsClient();
         $this->data['OptionsGroup'] = getOptionGroup();
         $this->data['dynamicView'] = 'pages/member/register/entry';
         $this->_commonPageLayout('frontend_viewer');
     } else {
         $query = $this->db->query("select * from member_previlige where user_type='" . $this->input->post('user_type') . "'");
         if ($query->num_rows() == 0) {
             $this->session->set_flashdata('message', '<div id="message">Sorry registration failed.User type previlization not exists.Please set previlization.</div>');
             redirect('organization/info/add_member');
         } else {
             $data = array('name' => $this->input->post('name'), 'member_title' => $this->input->post('member_title'), 'person_number' => $this->input->post('person_number'), 'expire_date' => $this->input->post('expire_date'), 'address' => $this->input->post('address'), 'phone' => $this->input->post('phone'), 'email' => $this->input->post('email'), 'profile_message' => $this->input->post('profile_message'), 'bank_info' => $this->input->post('bank_info'), 'household_size' => $this->input->post('household_size'), 'member_group' => $this->input->post('member_group'), 'username' => $this->input->post('username'), 'password' => base64_encode($this->input->post('password')), 'user_type' => $this->input->post('user_type'), 'org_id' => $this->session->userdata('user_id'));
             $this->info_model->member_registration($data);
             $name = $this->input->post('name');
             $email = $this->input->post('email');
             $username = $this->input->post('username');
             $password = $this->input->post('password');
             $this->load->library('email');
             $this->email->from('*****@*****.**', 'Confirmation ');
             $this->email->to("{$email}");
             $this->email->subject('Confirmation');
             $this->email->message("Dear {$name} Thanks for registration.your registration approved successfully.Your Username is {$username} and Password is {$password}");
             $this->email->send();
             $this->session->set_flashdata('message', '<div id="message1">Member Registered Successfully.</div>');
             redirect('organization/info/add_member');
         }
     }
 }