public function create()
 {
     $data = array();
     $clientCollection = new ClientsCollection();
     $insertInfo = array('username' => '', 'password' => '', 'email' => '');
     $errors = array();
     if (isset($_POST['createUser'])) {
         $insertInfo = array('username' => isset($_POST['username']) ? $_POST['username'] : '', 'password' => isset($_POST['password']) ? $_POST['password'] : '', 'email' => isset($_POST['email']) ? $_POST['email'] : '');
         $errors = $this->validateUserInput($insertInfo);
         if (empty($errors)) {
             $clientEntity = new ClientsEntity();
             $obj = $clientEntity->init($insertInfo);
             $clientCollection->save($obj);
             $_SESSION['flashMessage'] = 'You have 1 new user';
             header('Location: index.php?c=client&m=index');
         }
     }
     $data['errors'] = $errors;
     $data['insertInfo'] = $insertInfo;
     $this->loadView('clients/create', $data);
 }
Example #2
0
}
if (!isset($_GET['id'])) {
    header('Location: clients.php');
}
$clientCollection = new ClientsCollection();
$client = $clientCollection->getOne($_GET['id']);
if (is_null($client)) {
    header('Location: clients.php');
}
$insertInfo = array('username' => $client->getUsername(), 'password' => '', 'email' => $client->getEmail());
$errors = array();
if (isset($_POST['editUser'])) {
    $insertInfo = array('username' => isset($_POST['username']) ? $_POST['username'] : '', 'password' => isset($_POST['password']) ? $_POST['password'] : '', 'email' => isset($_POST['email']) ? $_POST['email'] : '');
    $errors = validateUserInput($insertInfo);
    if (empty($errors)) {
        $clientEntity = new ClientsEntity();
        $clientEntity->setId($_GET['id']);
        $obj = $clientEntity->init($insertInfo);
        $clientCollection->save($obj);
        $_SESSION['flashMessage'] = 'You have 1 affected row';
        header('Location: clients.php');
    }
}
?>


<?php 
require_once 'common/sidebar.php';
?>

    <!-- start: Content -->
Example #3
0
require_once 'common/header.php';
if (!loggedIn()) {
    header('Location: login.php');
}
$clientCollection = new ClientsCollection();
?>

<?php 
$insertInfo = array('username' => '', 'password' => '', 'email' => '');
$errors = array();
if (isset($_POST['createUser'])) {
    $insertInfo = array('username' => isset($_POST['username']) ? $_POST['username'] : '', 'password' => isset($_POST['password']) ? $_POST['password'] : '', 'email' => isset($_POST['email']) ? $_POST['email'] : '');
    $errors = validateUserInput($insertInfo);
    if (empty($errors)) {
        $clientEntity = new ClientsEntity();
        $obj = $clientEntity->init($insertInfo);
        $clientCollection->save($obj);
        $_SESSION['flashMessage'] = 'You have 1 new user';
        header('Location: clients.php');
    }
}
?>

<?php 
require_once 'common/sidebar.php';
?>
    <!-- start: Content -->
    <div id="content" class="span10" xmlns="http://www.w3.org/1999/html">

        <ul class="breadcrumb">