Exemple #1
0
 function approve()
 {
     $u = new User();
     if (!$u->get_where(array('uni' => $this->session->userdata('uni')))->is_admin) {
         redirect();
     }
     $a = new Approveduni();
     $data = array();
     $data['title'] = 'Approve Users';
     $data['errors'] = FALSE;
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         foreach (explode("\n", $this->input->post('unis')) as $uni) {
             $ap = new Approveduni();
             $ap->uni = $uni;
             if (!$ap->save()) {
                 $data['errors'] .= "<p>The uni '{$uni}' is invalid or already included.</p>";
             }
         }
     } else {
     }
     $data['approvedunis'] = $a->get();
     $this->load->view("user_approve.php", $data);
 }