/**
  * Tests the update function in the UserController
  * @param  void
  * @return void
  */
 public function testUpdate()
 {
     // Update the User Types
     Input::replace($this->userData);
     $user = new UserController();
     $user->store();
     Input::replace($this->userDataUpdate);
     $user->update(1);
     $userUpdated = User::find(1);
     $this->assertEquals($userUpdated->email, $this->userDataUpdate['email']);
     $this->assertEquals($userUpdated->name, $this->userDataUpdate['full_name']);
     $this->assertEquals($userUpdated->gender, $this->userDataUpdate['gender']);
     $this->assertEquals($userUpdated->designation, $this->userDataUpdate['designation']);
 }
Esempio n. 2
0
    SessionController::destroy();
});
$routes->get('/signup', function () {
    UserController::create();
});
$routes->post('/signup', function () {
    UserController::store();
});
$routes->get('/user', function () {
    UserController::index();
});
$routes->get('/user/:id', function ($id) {
    UserController::show($id);
});
$routes->post('/user/:id', function ($id) {
    UserController::update($id);
});
$routes->get('/user/:id/edit', function ($id) {
    UserController::edit($id);
});
$routes->get('/user/:id/destroy', function ($id) {
    UserController::destroy($id);
});
$routes->get('/group', function () {
    GroupController::index();
});
$routes->post('/group', function () {
    GroupController::store();
});
$routes->get('/group/new', function () {
    GroupController::create();
Esempio n. 3
0
     break;
 case "logout":
     include_once "controllers/UserController.php";
     $user = new UserController();
     $user->logout();
     break;
 case "register":
     include_once "controllers/UserController.php";
     $user = new UserController();
     $user->register();
     break;
 case "user":
     include_once "controllers/UserController.php";
     $user = new UserController();
     if ($_GET["action"] == "update") {
         $user->update();
     }
     if ($_GET["action"] == "delete") {
         $user->delete();
     }
     break;
 case "profile":
     include_once "controllers/UserController.php";
     $user = new UserController();
     $user->profile();
     break;
 case "dashboard":
     include_once "controllers/DashboardController.php";
     $dashboard = new dashboardController();
     $dashboard->render();
     break;
    UserController::logout();
});
$routes->get('/register/', function () {
    UserController::register();
});
$routes->post('/register/', function () {
    UserController::handle_register();
});
$routes->post('/user/:user_id/delete', function ($item_id) {
    UserController::destroy($item_id);
});
$routes->get('/user/:user_id/edit', function ($user_id) {
    UserController::edit($user_id);
});
$routes->post('/user/:user_id/edit', function ($user_id) {
    UserController::update($user_id);
});
// Vaatteen esittelysivu
$routes->get('/user/:item_id', function ($user_id) {
    UserController::show($user_id);
});
// Vaatteet
// Vaatteiden indeksisivu
$routes->get('/items/', function () {
    ItemController::index();
});
// Vaatteen lisäyssivu
$routes->get('/items/new', function () {
    ItemController::create();
});
// Vaatteen esittelysivu
Esempio n. 5
0
<?php

//////// INITIALISE USER DB DATA ////////
//////// USER SETUP SETTINGS ////////
$stub = "noodlehuttullamarine";
$displayName = "Noodle Hut Tullamarine";
$address = nl2br("Shop 2/223 Melrose Dr\nTullamarine\nVIC 3043");
$phone = "(03) 9338 1392";
$hours = nl2br("Mon - Sat\n11am - 9:30pm\nSun\n4:30pm - 9pm");
$email = "*****@*****.**";
$language = "eng";
$adminLanguage = "eng";
$userData = array("username" => $stub, "password" => "abc123", "displayName" => $displayName, "address" => $address, "phone" => $phone, "hours" => $hours, "email" => $email, "status" => STATUS_ACTIVE);
if (SETUP_NEW_ACCOUNT) {
    $userController = new UserController(null, $userData);
    $userController->update();
}
Esempio n. 6
0
     UserController::nuevo();
     break;
 case 'POST | users':
     require 'controladores/users.php';
     autorizar();
     UserController::crear();
     break;
 case 'GET | users/editar':
     require 'controladores/users.php';
     autorizar();
     UserController::editar();
     break;
 case 'POST | user':
     require 'controladores/users.php';
     autorizar();
     UserController::update();
     break;
 case 'POST | user/delete':
     require 'controladores/users.php';
     autorizar();
     UserController::eliminar();
     break;
 case 'POST | user/promover':
     require 'controladores/users.php';
     autorizar();
     UserController::upgrade();
     break;
 case 'POST | user/degradar':
     require 'controladores/users.php';
     autorizar();
     UserController::downgrade();
Esempio n. 7
0
<?php

$data = array("id" => $_POST['id'], "address" => $_POST['input_address'], "hours" => $_POST['input_hours'], "phone" => $_POST['input_phone'], "email" => $_POST['input_email'], "hours" => $_POST['input_hours']);
$userController = new UserController($data['id']);
if (!empty($_POST['input_password']) && $_POST['input_password'] == $_POST['input_passwordConfirm']) {
    $data['password'] = $_POST['input_password'];
}
if ($userController->update($data) === true) {
    echo "ok";
    exit;
} else {
    echo "saveError";
    exit;
}
echo "error";
exit;
Esempio n. 8
0
                 //                        print_r($_POST);
                 $u = new user($_POST['username'], $_POST['family'], $_POST['name'], $_POST['family'], $_POST['credit']['irr'], $_POST['credit']['eur'], $_POST['credit']['usd'], $_POST['credit']['aed'], $_POST['isadmin']);
                 $usr->add($u);
             }
         } else {
             $usr->_new();
         }
     } else {
         echo '<h1>Error  404  </h1>';
     }
     break;
 case 'update':
     if (isset($_SESSION['user']['isadmin']) && $_SESSION['user']['isadmin']) {
         if (isset($_POST['id'])) {
             $u = new user($_POST['username'], $_POST['family'], $_POST['name'], $_POST['family'], $_POST['credit']['irr'], $_POST['credit']['eur'], $_POST['credit']['usd'], $_POST['credit']['aed'], $_POST['isadmin']);
             $usr->update($_POST['id'], $u);
         } else {
             $usr->loadupdate($_GET['id']);
         }
     } else {
         echo '<h1>Error  404  </h1>';
     }
     break;
 case 'delete':
     if (isset($_SESSION['user']['isadmin']) && $_SESSION['user']['isadmin']) {
         if (isset($_GET['id'])) {
             $usr->Delete($_GET['id']);
         }
     } else {
         echo '<h1>Error  404  </h1>';
     }