public function storeInDb() { $db = OcDb::instance(); if ($_REQUEST['type'] == Log::TYPE_CONQUESTED && $this->powerTrail->isAlreadyConquestedByUser($this->user)) { /* atempt to add second 'conquested' log */ return false; } if ($this->id) { ddd('TODO'); } else { if ($this->type === self::TYPE_ADD_WARNING && $this->user->getIsAdmin() === false) { return false; /* regular user is not allowed to add entery of this type */ } $query = 'INSERT INTO `PowerTrail_comments`(`userId`, `PowerTrailId`, `commentType`, `commentText`, `logDateTime`, `dbInsertDateTime`, `deleted`) VALUES (:1, :2, :3, :4, :5, NOW(),0)'; $db->multiVariableQuery($query, $this->user->getUserId(), $this->powerTrail->getId(), $this->type, $this->text, $this->dateTime->format('Y-m-d H:i:s')); if ($this->type == self::TYPE_CONQUESTED) { $this->powerTrail->increaseConquestedCount(); } } $this->changePowerTrailStatusAfterLog(); return true; }