Esempio n. 1
0
 /**
  * run - display template and edit data
  *
  * @access public
  */
 public function run()
 {
     $tpl = new template();
     $user = new users();
     //Only admins
     if ($user->isAdmin($_SESSION['userdata']['id'])) {
         $msgKey = '';
         if (isset($_POST['save']) === true) {
             $values = array('name' => $_POST['name'], 'street' => $_POST['street'], 'zip' => $_POST['zip'], 'city' => $_POST['city'], 'state' => $_POST['state'], 'country' => $_POST['country'], 'phone' => $_POST['phone'], 'internet' => $_POST['internet'], 'email' => $_POST['email']);
             if ($values['name'] !== '') {
                 if ($this->isClient($values) !== true) {
                     $this->addClient($values);
                     $tpl->setNotification('ADD_CLIENT_SUCCESS', 'success');
                 } else {
                     $tpl->setNotification('CLIENT_EXISTS', 'error');
                 }
             } else {
                 $tpl->setNotification('NO_NAME', 'error');
             }
             $tpl->assign('values', $values);
         }
         $tpl->display('clients.newClient');
     } else {
         $tpl->display('general.error');
     }
 }
Esempio n. 2
0
 public function getModules($id)
 {
     $users = new users();
     $modules = $this->userModules;
     if ($users->isAdmin($id)) {
         $modules = $this->adminModules;
     }
     return $modules;
 }
Esempio n. 3
0
 /**
  * getAll - get all Tickets, depending on userrole
  *
  * @access public
  * @return array
  */
 public function getAll($limit = 9999)
 {
     $id = $_SESSION['userdata']['id'];
     $users = new users();
     if ($users->isAdmin($id)) {
         $values = $this->getAdminTickets($limit);
     } else {
         $values = $this->getUsersTickets($id, $limit);
     }
     return $values;
 }