Add a 'due date' field and display the number of comments on the board

This commit is contained in:
Frédéric Guillot
2014-03-05 22:27:48 -05:00
parent 1e994f3448
commit 544f992424
15 changed files with 195 additions and 6 deletions

View File

@@ -12,13 +12,14 @@ require __DIR__.'/../vendor/SimpleValidator/Validators/Integer.php';
require __DIR__.'/../vendor/SimpleValidator/Validators/Equals.php';
require __DIR__.'/../vendor/SimpleValidator/Validators/AlphaNumeric.php';
require __DIR__.'/../vendor/SimpleValidator/Validators/GreaterThan.php';
require __DIR__.'/../vendor/SimpleValidator/Validators/Date.php';
require __DIR__.'/../vendor/PicoDb/Database.php';
require __DIR__.'/schema.php';
abstract class Base
{
const APP_VERSION = 'master';
const DB_VERSION = 8;
const DB_VERSION = 9;
private static $dbInstance = null;
protected $db;
@@ -59,4 +60,19 @@ abstract class Base
return hash('crc32b', $token);
}
public function getTimestampFromDate($value, $format)
{
$date = \DateTime::createFromFormat($format, $value);
if ($date !== false) {
$errors = \DateTime::getLastErrors();
if ($errors['error_count'] === 0 && $errors['warning_count'] === 0) {
$timestamp = $date->getTimestamp();
return $timestamp > 0 ? $timestamp : 0;
}
}
return 0;
}
}