This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace controllers; | |
use core\Controller as Controller; | |
use models\Client as Client; | |
use core\View as View; | |
use widgets\DataTable as DataTable; | |
use core\db as db; | |
class ClientController extends Controller { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ($_SERVER["REQUEST_METHOD"] == "POST") { | |
require_once "FileUploader.php"; | |
$uploader = new FileUploader("file", $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "uploads"); | |
try { | |
$uploader->uploadFile(); | |
echo "File uploaded succesfully"; | |
} catch (Exception $e) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class FileUploader { | |
private $fileName; | |
private $targetDir; | |
private $targetFile; | |
private $errors; | |
public function __construct($fileName, $targetDir = '') | |
{ | |
$this->fileName = $fileName; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace core; | |
class db { | |
private $_connection; | |
public function __construct(array $CONFIG) | |
{ | |
try { | |
$this->_connection = new \PDO( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="container" style="margin-top: 40px;"> | |
<form [formGroup]="userForm" (ngSubmit)="onSubmit()"> | |
<div class="form-group"> | |
<label for="first_name">First Name:</label> | |
<input type="text" formControlName="first_name" class="form-control"> | |
<div *ngIf="submitted && userForm.controls['first_name'].errors" class="error"> | |
<div *ngIf="userForm.controls['first_name'].errors['required']"> | |
Your first name is required | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div *ngIf="user" class="container" style="margin-top: 40px;"> | |
<div class="card" style="width: 100%;"> | |
<div class="card-body"> | |
<div class="row"> | |
<div class="col-4" style="text-align: center;"> | |
<img *ngIf="user.avatar" [src]="user.avatar" class="card-img-top img-thumb" [alt]="user.first_name"> | |
<h5 class="card-title">{{user.first_name}}</h5> | |
<div class="form-inline"> | |
<label for="user-name">Name: </label> | |
<input id="user-name" [(ngModel)]="user.first_name" placeholder="name" class="form-control"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { HttpClient } from '@angular/common/http'; | |
import { Injectable } from '@angular/core'; | |
import { Observable } from 'rxjs'; | |
import { User } from '../user'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class ReqresService { | |
private url = 'api/users'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { InMemoryDbService } from 'angular-in-memory-web-api'; | |
import { User } from '../user'; | |
@Injectable({ | |
providedIn: 'root', | |
}) | |
export class InMemoryDataService implements InMemoryDbService { | |
createDb() { | |
const users = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { Router } from '@angular/router'; | |
import * as auth0 from 'auth0-js'; | |
@Injectable() | |
export class AuthService { | |
private _idToken: string; | |
private _accessToken: string; | |
private _expiresAt: number; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { Router } from '@angular/router'; | |
import * as auth0 from 'auth0-js'; | |
@Injectable() | |
export class AuthService { | |
private _idToken: string; | |
private _accessToken: string; | |
private _expiresAt: number; |