42 lines
1.5 KiB
PHP
42 lines
1.5 KiB
PHP
<?php
|
|
/**
|
|
* app/controllers/api/users.php
|
|
*
|
|
* This is the users' api controller.
|
|
*
|
|
* @version 3.0
|
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
|
* @link https://TheTempusProject.com
|
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
|
*/
|
|
namespace TheTempusProject\Controllers\Api;
|
|
|
|
use TheTempusProject\Models\User;
|
|
use TheTempusProject\Classes\ApiController;
|
|
use TheTempusProject\Houdini\Classes\Views;
|
|
use TheTempusProject\Bedrock\Functions\Input;
|
|
use TheTempusProject\Classes\Forms;
|
|
use TheTempusProject\Houdini\Classes\Template;
|
|
use TheTempusProject\Models\Timers as Timer;
|
|
|
|
class Timers extends ApiController {
|
|
public static $timers;
|
|
|
|
public function __construct() {
|
|
parent::__construct();
|
|
self::$timers = new Timer;
|
|
Template::setTemplate( 'api' );
|
|
}
|
|
|
|
public function create() {
|
|
$name = Input::exists('name') ? Input::post('name') : '';
|
|
$type = Input::exists('type') ? Input::post('type') : 'stopwatch';
|
|
$currentSeconds = Input::exists('currentSeconds') ? Input::post('currentSeconds') : 0;
|
|
$pausedAt = 0;
|
|
$hours = Input::exists('hours') ? Input::post('hour') : '00';
|
|
$minutes = Input::exists('minutes') ? Input::post('minute') : '00';
|
|
$seconds = Input::exists('seconds') ? Input::post('seconds') : '00';
|
|
$response = self::$timers->create( $name, $currentSeconds, $type, $pausedAt, $hours, $minutes, $seconds);
|
|
Views::view( 'api.response', ['response' => json_encode( [ 'data' => $response ], true )]);
|
|
}
|
|
} |