Example #1
0
 public function getPageTitle()
 {
     $pageTitle = $this->context->module->forumTitle;
     if ($this->getId() == 'forum') {
         switch ($this->getAction()->getId()) {
             case 'createTopic':
                 $pageTitle .= ' - ' . Yii::t('BbiiModule.bbii', 'Create new topic');
                 break;
             case 'forum':
                 $pageTitle .= ' - ' . @BbiiForum::find(\Yii::$app->request->get()['id'])->name;
                 break;
             case 'topic':
                 $pageTitle .= ' - ' . @BbiiTopic::find(\Yii::$app->request->get()['id'])->title;
                 break;
             case 'quote':
                 $pageTitle .= ' - ' . Yii::t('BbiiModule.bbii', 'Quote');
                 break;
             case 'reply':
                 $pageTitle .= ' - ' . Yii::t('BbiiModule.bbii', 'Reply');
                 break;
             case 'update':
                 $pageTitle .= ' - ' . Yii::t('BbiiModule.bbii', 'Update');
                 break;
         }
     } elseif ($this->getId() == 'member') {
         switch ($this->getAction()->getId()) {
             case 'index':
                 $pageTitle .= ' - ' . Yii::t('BbiiModule.bbii', 'Members');
                 break;
             case 'view':
                 $pageTitle .= ' - ' . @BbiiMember::find(\Yii::$app->request->get()['id'])->member_name;
                 break;
             case 'update':
                 $pageTitle .= ' - ' . Yii::t('BbiiModule.bbii', 'Update');
                 break;
         }
     } elseif ($this->getId() == 'message') {
         switch ($this->getAction()->getId()) {
             case 'inbox':
                 $pageTitle .= ' - ' . Yii::t('BbiiModule.bbii', 'Inbox');
                 break;
             case 'outbox':
                 $pageTitle .= ' - ' . Yii::t('BbiiModule.bbii', 'Outbox');
                 break;
             case 'create':
                 $pageTitle .= ' - ' . Yii::t('BbiiModule.bbii', 'New message');
                 break;
         }
     } else {
         $pageTitle .= ' - ' . ucfirst($this->getAction()->getId());
     }
     return $pageTitle;
 }
Example #2
0
 /**
  * Retrieves a list of models based on the current search/filter conditions.
  * @param  [type] $params [description]
  * @return ActiveDataProvider the data provider that can return the models based on the search/filter conditions.
  */
 public function search($params = null)
 {
     $query = BbiiMember::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $this->addCondition('avatar', $this->avatar, true);
     $this->addCondition('birthdate', $this->birthdate, true);
     $this->addCondition('blogger', $this->blogger, true);
     $this->addCondition('contact_email', $this->contact_email);
     $this->addCondition('contact_pm', $this->contact_pm);
     $this->addCondition('facebook', $this->facebook, true);
     $this->addCondition('first_visit', $this->first_visit, true);
     $this->addCondition('flickr', $this->flickr, true);
     $this->addCondition('gender', $this->gender);
     $this->addCondition('google', $this->google, true);
     $this->addCondition('group_id', $this->group_id);
     $this->addCondition('id', $this->id, true);
     $this->addCondition('last_visit', $this->last_visit, true);
     $this->addCondition('linkedin', $this->linkedin, true);
     $this->addCondition('location', $this->location, true);
     $this->addCondition('member_name', $this->member_name, true);
     $this->addCondition('metacafe', $this->metacafe, true);
     $this->addCondition('moderator', $this->moderator, true);
     $this->addCondition('myspace', $this->myspace, true);
     $this->addCondition('orkut', $this->orkut, true);
     $this->addCondition('personal_text', $this->personal_text, true);
     $this->addCondition('posts', $this->posts);
     $this->addCondition('show_online', $this->show_online);
     $this->addCondition('signature', $this->signature, true);
     $this->addCondition('timezone', $this->timezone, true);
     $this->addCondition('tumblr', $this->tumblr, true);
     $this->addCondition('twitter', $this->twitter, true);
     $this->addCondition('upvoted', $this->upvoted);
     $this->addCondition('warning', $this->warning);
     $this->addCondition('website', $this->website, true);
     $this->addCondition('wordpress', $this->wordpress, true);
     $this->addCondition('yahoo', $this->yahoo, true);
     $this->addCondition('youtube', $this->youtube, true);
     return $dataProvider;
 }
Example #3
0
 private function assignMembergroup($id)
 {
     $member = BbiiMember::findOne($id);
     $group = BbiiMembergroup::find($member->group_id);
     if ($group !== null && (isset($group->min_posts) && $group->min_posts < 0)) {
         return;
     }
     $newGroup = BbiiMembergroup::find()->where("min_posts > 0 and min_posts < =  " . $member->posts)->orderBy('min_posts DESC');
     if ($newGroup !== null && isset($group->id) && $group->id != $newGroup->id) {
         $member->group_id = $newGroup->id;
         $member->save();
     }
 }
Example #4
0
 /**
  * Display message contents
  * 
  * @param  [type] $id [description]
  * @return [type]     [description]
  */
 public function actionView($id = null)
 {
     $model = $this->getMessageMDL($id);
     // @todo This should be done at the VW level - DJE : 2015-08-03
     $model->sendfrom = BbiiMember::find()->where(['id' => $model->sendfrom])->one()->member_name;
     // mark message as viewed
     $model->read_indicator = true;
     $model->save();
     // send message data to VW
     return $this->render('view', array('count' => $this->getMessageCount(), 'model' => $model));
 }
Example #5
0
 /**
  * this method is called before any module controller action is performed
  * you may place customized code here
  *
  * @version  2.2.0
  * @param  [type] $controller [description]
  * @param  [type] $action     [description]
  * @return [type]             [description]
  */
 public function beforeAction($controller, $action = null)
 {
     if (parent::beforeAction($controller, $action)) {
         // register last visit by member
         if (isset(\Yii::$app->user->identity->id)) {
             //$model = BbiiMember::find(\Yii::$app->user->identity->id );
             $model = BbiiMember::find()->where(['id' => \Yii::$app->user->identity->id])->one();
             if ($model !== null) {
                 $model->setAttribute('last_visit', date('Y-m-d H:i:s'));
                 $model->save();
             } else {
                 $userClass = new User();
                 $user = $userClass::find()->where([$this->userIdColumn => \Yii::$app->user->identity->id])->one();
                 $username = $user->getAttribute($this->userNameColumn);
                 $model = new BbiiMember();
                 $model->setAttribute('first_visit', date('Y-m-d H:i:s'));
                 $model->setAttribute('id', \Yii::$app->user->identity->id);
                 $model->setAttribute('last_visit', date('Y-m-d H:i:s'));
                 $model->setAttribute('member_name', $username);
                 $model->save();
             }
         }
         // register visits
         if (isset($_SERVER['HTTP_USER_AGENT'])) {
             // web spider visit
             $spider = BbiiSpider::find()->where(['user_agent' => $_SERVER['HTTP_USER_AGENT']])->one();
             if ($spider !== null) {
                 $spider->setScenario('visit');
                 $spider->hits++;
                 $spider->last_visit = null;
                 if (!$spider->validate() || !$spider->save()) {
                     // todo Some kind of logging when the spider model does not validate or save - DJE : 2015-07-20
                 }
                 // guest visit
             } else {
                 $model = BbiiSession::find()->where(['id' => \Yii::$app->session->getId()])->one();
                 $model = $model ?: new BbiiSession();
                 $model->id = \Yii::$app->session->getId();
                 if (!$model->validate() || !$model->save()) {
                     // todo Some kind of logging when the user model does not validate or save - DJE : 2015-07-20
                 }
             }
         }
         // delete older session entries
         BbiiSession::deleteAll('last_visit < \'' . date('Y-m-d H:i:s', time() - 24 * 3600) . '\'');
         return true;
     }
     return false;
 }
Example #6
0
 /**
  * 
  * @version  2.1.1
  * @return
  */
 public static function getForumOptions()
 {
     $return = array();
     $groups = BbiiForum::find()->where('type = 0')->orderBy('sort')->all();
     foreach ($groups as $group) {
         $forum = BbiiForum::find()->where('type = 1 and cat_id = ' . $group->id)->all();
         foreach ($forum as $option) {
             if ($option->public || !\Yii::$app->user->isGuest) {
                 if ($option->membergroup_id == 0) {
                     $return[] = array('id' => $option->id, 'name' => $option->name, 'group' => $group->name);
                 } elseif (!\Yii::$app->user->isGuest) {
                     $groupId = BbiiMember::find(\Yii::$app->user->identity->id)->one()->group_id;
                     if ($option->membergroup_id == $groupId) {
                         $return[] = array('id' => $option->id, 'name' => $option->name, 'group' => $group->name);
                     }
                 }
             }
         }
     }
     return $return;
 }
Example #7
0
 public function getReciever()
 {
     return $this->hasOne(BbiiMember::className(), ['id' => 'sendto']);
 }
Example #8
0
 public function loadModel($id = null)
 {
     $model = BbiiMember::find($id);
     if ($model === null) {
         throw new HttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Example #9
0
                </li>
                <li class="list-group-item">
                    <?php 
echo Yii::t('BbiiModule.bbii', 'Total posts');
?>
                    <div class="badge pull-right"><?php 
echo BbiiPost::find()->count();
?>
</div>
                </li>
                <li class="list-group-item">
                    <?php 
echo Yii::t('BbiiModule.bbii', 'Total members');
?>
                    <div class="badge pull-right"><?php 
echo BbiiMember::find()->count();
?>
</div>
                </li>
                <li class="list-group-item">
                    <?php 
echo Yii::t('BbiiModule.bbii', 'Newest member');
?>
                    <div class="pull-right"><?php 
echo Html::a($member->member_name, array('member/view', 'id' => $member->id));
?>
</div>
                </li>
                <li class="list-group-item">
                    <?php 
echo Yii::t('BbiiModule.bbii', 'Visitors today');
Example #10
0
 public function getPoster()
 {
     return $this->hasOne(BbiiMember::className(), ['id' => 'user_id']);
 }