<?php class DislikeWordCallbackHandler extends CallBackhandler { public static $key= "dislikeWord"; function execute() { $wordID = $this->data; if($this->getParent()->getDB()->hasDisliked($this->getTG()->getUser(),$wordID)){ $this->getTG()->sendMessage("قبلا هم این نظر رو داشتی",$this->getTG()->chat_id); return false; } if(strpos($wordID,"c") !== false){ $this->getParent()->getDB()->dislikeWordInContribution($wordID); } else { $this->getParent()->getDB()->dislikeWord($wordID); } $this->getParent()->getDB()->insertUserToRatedList($this->getTG()->getUser(), $wordID, 0, 1); $this->updateMessage($wordID); } public function getParent() : EvaluationSystem{ return parent::getParent(); } public function getTG() : TranslateGerman { return parent::getSM(); } private function updateMessage($wordID){ $button = $this->getTG()->getButtonService()->findButton(static::$key); $parts= explode(" ",$button->getText()); $button->setText("👎🏻 ".($parts[1]+1)); $button2 = $this->getTG()->getButtonService()->findButton(LikeWordCallbackHandler::$key); $button2->setText("👍"); $this->getTG()->getButtonService()->rebuildKeyboard(); $keyboards = $this->getTG()->getButtonService()->getKeyboardMarkedup(); $this->getTG()->editMultpleButtonsMessage( $this->getTG()->message['text'], $keyboards ); } } ?>
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
learn | Folder | 2755 |
|
|
DeDeTextTranslateCallbackHandler.class.php | File | 2.7 KB | 0755 |
|
DeFaTextTranslateCallbackHandler.class.php | File | 2.71 KB | 0755 |
|
DislikeWordCallbackHandler.class.php | File | 1.55 KB | 0755 |
|
FaDeTextTranslateCallbackHandler.class.php | File | 2.71 KB | 0755 |
|
LikeWordCallbackHandler.class.php | File | 1.53 KB | 0755 |
|
NextWordCallbackHandler.class.php | File | 2.61 KB | 0755 |
|
NotFoundCallbackHandler.class.php | File | 509 B | 0755 |
|
PrevWordCallbackHandler.class.php | File | 2.36 KB | 0755 |
|
ReportCallbackHandler.class.php | File | 1.21 KB | 0755 |
|
UserWantsEvaluateCallbackHandler.class.php | File | 1.96 KB | 0755 |
|