Esempio n. 1
0
 public function beforeDelete()
 {
     if (parent::beforeDelete()) {
         //delete: Messages(to/from), Ban History, UpVotes, LogTopic
         YBoardMessage::deleteAll(['or', 'sendfrom' => $this->id, 'sendto' => $this->id]);
         // Post(Polls and Votes)
         YBoardVote::deleteAll(['user_id' => $this->id]);
         YBoardUpvoted::deleteAll(['member_id' => $this->id]);
         YBoardPoll::deleteAll(['user_id' => $this->id]);
         YBoardPost::deleteAll(['user_id' => $this->id]);
         //log topic
         YBoardLogTopic::deleteAll(['member_id' => $this->id]);
         //ban
         YBoardBan::deleteAll(['user_id' => $this->id]);
         return true;
     } else {
         return false;
     }
 }
Esempio n. 2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPoll()
 {
     return $this->hasOne(YBoardPoll::className(), ['id' => 'poll_id']);
 }
Esempio n. 3
0
 public function beforeDelete()
 {
     if (parent::beforeDelete()) {
         //delete all upvotes and polls
         YBoardUpvoted::deleteAll(['post_id' => $this->id]);
         YBoardPoll::deleteAll(['post_id' => $this->id]);
         return true;
     } else {
         return false;
     }
 }
 /**
  * Determine the icon for a topic
  */
 public function topicIcon($topic)
 {
     $img = 'topic';
     if ($this->topicIsRead($topic->id)) {
         $img .= '2';
     } else {
         $img .= '1';
     }
     if ($topic->global) {
         $img .= 'g';
     }
     if ($topic->sticky) {
         $img .= 's';
     }
     if (YBoardPoll::find()->where(['post_id' => $topic->first_post_id])->one()) {
         $img .= 'p';
     }
     if ($topic->locked) {
         $img .= 'l';
     }
     return $img;
 }