<?php $sess = get_instance()->session; $flashmsg = $sess->flashdata('msg'); $uni = $sess->userdata('uni'); $name = FALSE; $admin = FALSE; if ($uni) { $u = new User(); $u->get_where(array('uni' => $uni)); $name = $u->full_name; $admin = $u->is_admin; } /* SQL IN THE VIEW?! NOO!!! */ $tag_list = array('field' => '', 'type' => '', 'location' => ''); $tag_names = array('field' => 'Field/Discipline', 'type' => 'Type of Project', 'location' => 'Location'); foreach ($tag_list as $k => &$v) { $v = new Tag(); $v->get_by_category($k); } isset($tag_name_base_url) || ($tag_name_base_url = '/home/browse/'); ?> <!DOCTYPE html> <html> <head> <title><?php echo $title; ?> | Scholars Information Database</title> <!-- TODO: Optimize, esp. use Google's versions of some. Compile down rest. --> <script src="<?php
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); }