public function create(User $_user, float $amount, int $method, string $method_other = null, Guardian $_guardian = null) { $this->_user = $_user; $this->_guardian = $_guardian; $query = "INSERT INTO payment (user_id, amount, date_paid, method, method_other, paid_by_user,\n\t\t\t\t\t paid_by_guardian_id) VALUES (:u, :a, :d, :m, :o, :pu, :pg)"; $this->_pdo->perform($query, ["u" => $this->user_id = $_user->getId(), "a" => $this->amount = $amount, "d" => $this->date_paid = Utility::getDateTimeForMySQLDateTime(), "m" => $this->method = $method, "o" => $this->method_other = $method_other, "pu" => is_null($_guardian), "pg" => $_guardian ? $_guardian->getId() : null]); }
public function create(User $_creator, string $name, float $cost, DateTime $date_open, DateTime $date_closed) { $this->_creator = $_creator; $query = "INSERT INTO swag (`name`, cost, date_created, creator_id, date_open, date_closed)\n\t\t\t\t\t VALUES (:n, :c, :dc, :cid, :dop, :dcl)"; $this->_pdo->perform($query, ["n" => $this->name = $name, "c" => $this->cost = $cost, "dc" => $this->date_created = Utility::getDateTimeForMySQLDateTime(), "cid" => $this->creator_id = $_creator->getId(), "dop" => $this->date_open = Utility::getDateTimeForMySQLDateTime($date_open), "dcl" => $this->date_closed = Utility::getDateTimeForMySQLDateTime($date_closed)]); $this->id = $this->_pdo->lastInsertId(); }
public function create(User $_poster, \string $text, \int $who_for = self::WF_ACTIVES) { $query = "INSERT INTO announcement (poster_id, `text`, date_posted, who_for) VALUES (:p, :t, :d, :w)"; $this->_poster = $_poster; $this->_pdo->perform($query, ["p" => $this->poster_id = $_poster->getId(), "t" => $this->text = $text, "d" => $this->date_posted = Utility::getDateTimeForMySQLDateTime(), "w" => $this->who_for = $who_for]); $this->id = $this->_pdo->lastInsertId(); }
public function create(User $_user, User $_applier, int $type, float $amount, string $reason) { $this->_user = $_user; $this->_applier = $_applier; $query = "INSERT INTO fee (user_id, type, amount, reason, applied_by_user_id, date_applied)\n\t\t\t\t\t VALUES (:u, :t, :a, :r, :au, :d)"; $this->_pdo->perform($query, ["u" => $this->user_id = $_user->getId(), "t" => $this->type = $type, "a" => $this->amount = $amount, "r" => $this->reason = $reason, "au" => $this->applied_by_user_id = $_applier->getId(), "d" => $this->date_applied = Utility::getDateTimeForMySQLDateTime()]); $this->id = $this->_pdo->lastInsertId(); }
public function create(User $_user, string $extension, string $mime_type, string $original_name, string $temp_location, bool $is_image) { $query = "INSERT INTO `file` (user_id, extension, mime_type, md5, original_name, date_added, is_image)\n\t\t\t\t\t VALUES (:u, :e, :mt, :m, :o, :d, :i)"; $this->_pdo->perform($query, ["u" => $this->user_id = $_user->getId(), "e" => $this->extension = $extension, "mt" => $this->mime_type = $mime_type, "m" => $this->md5 = md5_file($temp_location), "o" => $this->original_name = $original_name, "d" => $this->date_added = Utility::getDateTimeForMySQLDateTime(), "i" => $this->is_image = $is_image]); $stream = fopen($temp_location, "r+"); if (!$this->_filesystem->has($this->getDirMain())) { $this->_filesystem->createDir($this->getDirMain()); } if (!$this->_filesystem->has($this->getDirSub())) { $this->_filesystem->createDir($this->getDirSub()); } $this->_filesystem->writeStream($this->getPath(), $stream, ["visibility" => AdapterInterface::VISIBILITY_PUBLIC]); fclose($stream); }
public function create(GreekOrganization $g, University $u) { $query = "INSERT INTO chapter (greek_organization_id, university_id, time_joined) VALUES (:g, :u, :t)"; $this->_pdo->perform($query, ["g" => $this->greek_organization_id = $g->getId(), "u" => $this->university_id = $u->getId(), "t" => $this->time_joined = Utility::getDateTimeForMySQLDateTime()]); $this->id = $this->_pdo->lastInsertId(); }
public function isTokenExpiredAccountVerify() : bool { return Utility::getDateTimeForMySQLDateTime($this->token_expiry_account_verify) < new DateTime(); }
public static function getExpiryAsMySQLDateTime(\string $interval) : string { return Utility::getDateTimeForMySQLDateTime((new DateTime())->add(DateInterval::createFromDateString($interval))); }
public function deleteOnAndAfterDate(DateTime $date) { $this->_pdo->perform("UPDATE `event` SET is_hidden = 1 WHERE `start` >= :s", ["s" => Utility::getDateTimeForMySQLDateTime($date)]); }
public function update(string $name, string $notes, bool $all_day_event, DateTime $start, DateTime $end, User $_lmod_user) { $this->_lmod_user = $_lmod_user; $query = "UPDATE `event` SET `start` = :s, `end` = :e, all_day_event = :a, `name` = :m, notes = :n,\n\t\t\t\t\t lmod_user_id = :u, lmod_date = :l WHERE id = :i"; $this->_pdo->perform($query, ["m" => $this->name = $name, "n" => $this->notes = $notes, "a" => $this->all_day_event = $all_day_event, "s" => $this->start = Utility::getDateTimeForMySQLDateTime($start), "e" => $this->end = Utility::getDateTimeForMySQLDateTime($end), "u" => $this->lmod_user_id = $_lmod_user->getId(), "l" => $this->lmod_date = Utility::getDateTimeForMySQLDateTime(), "i" => $this->id]); }