Commit db5c27d2 authored by Carson Greene's avatar Carson Greene

Add Docker

parent cce48f5e
FROM php:apache
COPY ./app/* /var/www/html
......@@ -15,6 +15,14 @@ class Chapter {
$this->pcrId = $row['pcrId'];
}
/**
* Get the ID of the chapter
* @return int The Chapter's ID
*/
public function getId() {
return $this->id;
}
private $id; //< The unique ID
private $school; //< The school the chapter is located at
private $location; //< The location of the chapter
......
<?php
namespace Knob;
class Chapters extends Table {
/**
* Chapters constructor
* @param Site $site The global Site object
*/
public function __construct(Site $site) {
parent::__construct($site, 'chapter');
}
/**
* Get a Chapter from the table
* @param int $id The ID of the chapter to get
* @retutrn Chapter The chapter object for that ID
*/
public function get($id) {
$sql = <<<SQL
select *
from $this->tableName
where id = ?
SQL;
$pdo = $this->pdo();
$statement = $pdo->prepare($sql);
$result = $statement->execute([$id]);
if ($result) {
$chapterRow = $statement->fetch(\PDO::FETCH_ASSOC);
if ($chapterRow !== null) {
return new Chapter($chapterRow);
}
}
return null;
}
/**
* Gets all the chapters
* @return array An array of Chapter objects
*/
public function getAll() {
$sql = <<<SQL
select *
from $this->tableName
SQL;
$pdo = $this->pdo();
$statement = $pdo->prepare($sql);
$result = $statement->execute([]);
if ($result) {
$chapterRows = $statement->fetchAll(\PDO::FETCH_ASSOC);
if ($chapterRows != null && count($chapterRows) > 0) {
$chapters = [];
foreach($chapterRows as $chapterRow) {
$chapters[] = new Chapter($chapterRow);
}
return $chapters;
}
}
return null;
}
}
\ No newline at end of file
......@@ -6,7 +6,7 @@
* Time: 22:07
*/
namespace Felis;
namespace Knob;
class Site {
......
......@@ -65,13 +65,13 @@ class User {
}
/**
* Get the user's chapter
* @return Chapter The chapter they belong to
* Get the user's chapter ID
* @return int The chapter ID of the chapter they belong to
*/
public function getChapter() {
// TODO: Return the chapter object for this user
public function getChapterId() {
return $this->chapterId;
}
/**
* Get the date the user's joined
* @return int The timestamp of when the user joined
......@@ -85,15 +85,8 @@ class User {
* @return bool Whether or not the user is an admin
*/
public function isPriveleged() {
return $this->role === self::ADMIN;
}
/**
* Determine whether or not the user has elevated priveleges
* @return bool Whether or not the user has priveleges
*/
public function isElevated() {
return $this->role === self::PRES || $this->isPriveleged();
return $this->role === self::ADMIN ||
$this->role === self::SUPERUSER;
}
/**
......@@ -126,7 +119,8 @@ class User {
* @param string $last The user's last name
*/
public function setName($last, $first) {
$this->name = $name;
$this->lastName = $last;
$this->firstName = $first;
}
/**
......@@ -152,9 +146,8 @@ class User {
$this->pending = true;
}
const SUPERUSER ='S';
const ADMIN = 'A';
const PRES = 'P';
const PCR = 'C';
const BROTHER = 'B';
const SESSION_NAME = 'user';
......
version: '3'
services:
db:
image: mariadb
knoblogger:
depends_on:
- db
build: .
ports:
- "80:80"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment