示例#1
0
 public function get_get_view()
 {
     if (Auth::has_access('user.view')) {
         $users = Model_User::find('all');
         $user_parse = array();
         foreach ($users as $user) {
             $user_parse[] = array('<img src="https://secure.gravatar.com/avatar/' . md5(strtolower(trim($user->email))) . '?d=mm" alt="Gravatar Image" height="40" width="40">', $user->name, $user->username, Auth_Group_SimpleGroup::instance()->get_name($user->group), $user->email, $user->call_center->title, strlen($user->last_login) > 2 ? date("M j, Y g:i A", (int) $user->last_login) : "No previous Login");
         }
         $this->response(array("aaData" => $user_parse, "aoColumnDefs" => array(array("iDataSort" => 6, "asSorting" => array("desc"), "aTargets" => array(0))), "aoColumns" => array(array("mDataProp" => "id", "bSortable" => false), array("mDataProp" => "name", "sTitle" => "Name", "sType" => "string"), array("mDataProp" => "username", "sTitle" => "Username", "sType" => "string"), array("mDataProp" => "group", "sTitle" => "Group", "sType" => "string"), array("mDataProp" => "email", "sTitle" => "E-mail", "sType" => "string"), array("mDataProp" => "call_center", "sTitle" => "Call Center", "sType" => "string"), array("mDataProp" => "last_login", "sTitle" => "Last Login", "sType" => "date"))));
     } else {
         $this->response(array("error" => "You are not authorised to view this content!"));
     }
 }
示例#2
0
 public function before()
 {
     parent::before();
     \Session::set("current_page", \Uri::string());
     $segments = implode(\Uri::segments());
     if (Auth::check() || $segments == 'userlogin') {
         list($driver, $user_id) = Auth::get_user_id();
         $this->current_user = Model_User::find($user_id);
     } else {
         if ($segments != 'userlogin') {
             Session::set("lastpage", implode("/", \Uri::segments()));
         }
         $this->current_user = null;
         Response::redirect('user/login');
     }
     if ($segments != 'userlogin') {
         View::set_global('group_name', Auth_Group_SimpleGroup::instance()->get_name($this->current_user->group));
         View::set_global('current_user', $this->current_user);
     }
 }
示例#3
0
 public function before()
 {
     $this->template = $this->newIntranet() ? "templates/layout" : "template";
     \Session::set("current_page", \Uri::string());
     $segments = implode(\Uri::segments());
     if (\Auth::check() || $segments == 'userlogin') {
         list($driver, $user_id) = \Auth::get_user_id();
         $this->current_user = \Model_User::find($user_id);
     } else {
         if ($segments != 'userlogin') {
             \Session::set("lastpage", implode("/", \Uri::segments()));
         }
         $this->current_user = null;
         \Response::redirect('user/login');
     }
     if ($segments != 'userlogin') {
         \View::set_global('group_name', \Auth_Group_SimpleGroup::instance()->get_name($this->current_user->group));
         \View::set_global('current_user', $this->current_user);
     }
     parent::before();
     // Remove when login implemented
 }