finished
This commit is contained in:
parent
1f487fe45e
commit
dd6c8d1cab
|
|
@ -150,24 +150,26 @@ class Portal {
|
||||||
|
|
||||||
public function addUserSubmit() {
|
public function addUserSubmit() {
|
||||||
if ($_SESSION['userType'] == 'admin') {
|
if ($_SESSION['userType'] == 'admin') {
|
||||||
$record = [
|
if($_POST['password'] != "") {
|
||||||
'username' => $_POST['username'],
|
$record = [
|
||||||
'password' => password_hash($_POST['password'], PASSWORD_DEFAULT),
|
'username' => $_POST['username'],
|
||||||
'userType' => $_POST['type']
|
'password' => password_hash($_POST['password'], PASSWORD_DEFAULT),
|
||||||
];
|
'userType' => $_POST['type']
|
||||||
if ($_POST['submit'] == 'Update') {
|
];
|
||||||
$record['id'] = $_POST['user_id'];
|
if ($_POST['submit'] == 'Update') {
|
||||||
$this->vars['response'] = 'User Updated Successfully';
|
$record['id'] = $_POST['user_id'];
|
||||||
|
$this->vars['response'] = 'User Updated Successfully';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->vars['response'] = 'User Created Successfully';
|
||||||
|
}
|
||||||
|
$this->usersTable->save($record);
|
||||||
|
return [
|
||||||
|
'template' => 'response.html.php',
|
||||||
|
'title' => 'Jo\'s Jobs- Edit user',
|
||||||
|
'vars' => $this->vars
|
||||||
|
];
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
$this->vars['response'] = 'User Created Successfully';
|
|
||||||
}
|
|
||||||
$this->usersTable->save($record);
|
|
||||||
return [
|
|
||||||
'template' => 'response.html.php',
|
|
||||||
'title' => 'Jo\'s Jobs- Edit user',
|
|
||||||
'vars' => $this->vars
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<phpunit>
|
||||||
|
<testsuites>
|
||||||
|
<testsuite name="tests">
|
||||||
|
<directory>tests</directory>
|
||||||
|
</testsuite>
|
||||||
|
</testsuites>
|
||||||
|
</phpunit>
|
||||||
|
|
@ -1,12 +1,7 @@
|
||||||
<main class="home">
|
<main class="home">
|
||||||
<form method="post" action="/portal/addJob">
|
<form method="post" action="/portal/addJob">
|
||||||
<?php if ($archive) { ?>
|
<?php if ($update) {?>
|
||||||
<input type="hidden" name="archived" value="n"/>
|
|
||||||
<?php }
|
|
||||||
else { ?>
|
|
||||||
<input type="hidden" name="archived" value="<?=$job->archived?>"/>
|
<input type="hidden" name="archived" value="<?=$job->archived?>"/>
|
||||||
<?php }
|
|
||||||
if ($update) {?>
|
|
||||||
<label>Enter Job Title</label>
|
<label>Enter Job Title</label>
|
||||||
<input type="text" name="title" value="<?=$job->title?>"/>
|
<input type="text" name="title" value="<?=$job->title?>"/>
|
||||||
<label>Enter Job Description</label>
|
<label>Enter Job Description</label>
|
||||||
|
|
@ -22,8 +17,12 @@
|
||||||
<input type="hidden" name="client_id" value="<?=$job->clientId?>" />
|
<input type="hidden" name="client_id" value="<?=$job->clientId?>" />
|
||||||
<input type="hidden" name="jobId" value="<?=$job->id?>"/>
|
<input type="hidden" name="jobId" value="<?=$job->id?>"/>
|
||||||
<input type="submit" name="submit" value="Update"/>
|
<input type="submit" name="submit" value="Update"/>
|
||||||
|
<?php }
|
||||||
|
else if ($archive) { ?>
|
||||||
|
<input type="hidden" name="archived" value="n"/>
|
||||||
<?php }
|
<?php }
|
||||||
else { ?>
|
else { ?>
|
||||||
|
<input type="hidden" name="archived" value="n"/>
|
||||||
<label>Enter Job Title</label>
|
<label>Enter Job Title</label>
|
||||||
<input type="text" name="title"/>
|
<input type="text" name="title"/>
|
||||||
<label>Enter Job Description</label>
|
<label>Enter Job Description</label>
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,12 @@
|
||||||
<?php if (isset($_SESSION['loggedin'])) {
|
<?php if (isset($_SESSION['loggedin'])) {
|
||||||
if ($_SESSION['userType'] == 'admin') {?>
|
if ($_SESSION['userType'] == 'admin') {?>
|
||||||
<li><a href="/portal">Admin Portal</a></li>
|
<li><a href="/portal">Admin Portal</a></li>
|
||||||
<?php }
|
<?php }
|
||||||
else if ($_SESSION['userType'] == 'client') {?>
|
else if ($_SESSION['userType'] == 'client') {?>
|
||||||
<li><a href="/portal">Client Portal</a></li>
|
<li><a href="/portal">Client Portal</a></li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<li><a href="/user/logout">Logout</a></li>
|
<li><a href="/user/logout">Logout</a></li>
|
||||||
<?php }
|
<?php }
|
||||||
else {?>
|
else {?>
|
||||||
<li><a href="/user/login">Login</a></li>
|
<li><a href="/user/login">Login</a></li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<label>Enter Username</label>
|
<label>Enter Username</label>
|
||||||
<input type="username" name="username" value="<?=$user->username?>"/>
|
<input type="username" name="username" value="<?=$user->username?>"/>
|
||||||
<label>Enter Password</label>
|
<label>Enter Password</label>
|
||||||
<input type="password" name="password" value="<?=$user->password?>"/>
|
<input type="password" name="password" value=""/>
|
||||||
<label>Enter User Type</label>
|
<label>Enter User Type</label>
|
||||||
<input type="text" name="type" value="<?=$user->userType?>"/>
|
<input type="text" name="type" value="<?=$user->userType?>"/>
|
||||||
<input type="hidden" name="user_id" value="<?=$user->id?>" />
|
<input type="hidden" name="user_id" value="<?=$user->id?>" />
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?php
|
||||||
|
class DatabaseTableTest extends \PHPUnit\Framework\TestCase {
|
||||||
|
public function testFindColumnsValues() {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
Loading…
Reference in New Issue