Пример #1
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 = BbiiMembergroup::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $this->addCondition('color', $this->color, true);
     $this->addCondition('description', $this->description, true);
     $this->addCondition('id', $this->id, true);
     $this->addCondition('image', $this->image, true);
     $this->addCondition('min_posts', $this->min_posts);
     $this->addCondition('name', $this->name, true);
     return $dataProvider;
 }
Пример #2
0
 public function getGroup()
 {
     return $this->hasOne(BbiiMembergroup::className(), ['id' => 'group_id']);
 }
Пример #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();
     }
 }
Пример #4
0
//echo $form->error($model,'member_name');
?>
                </div>

                <?php 
if ($this->context->isModerator()) {
    ?>
                    <div>
                        <?php 
    //echo $form->labelEx($model,'group_id');
    ?>
                        <?php 
    //->label('Group Name')
    ?>
                        <?php 
    echo $form->field($model, 'group_id')->dropDownList(ArrayHelper::map(BbiiMembergroup::find()->all(), 'id', 'name'), ['prompt' => 'Group', 'class' => 'form-control']);
    ?>
                        <?php 
    //echo $form->error($model,'group_id');
    ?>
                    </div>
                    <br />
                <?php 
}
?>

                <div>
                    <?php 
//echo $form->labelEx($model,'gender');
?>
                    <?php 
Пример #5
0
            </div>

            <div>
                <div class="form-group field-bbiiforum-moderated">
                    <label class="control-label" for="name">Moderated</label>
                    <?php 
echo Html::activeDropDownList($model, 'moderated', $booleanDDLOptions, ['class' => 'form-control', 'id' => 'moderated']);
?>
                </div>
            </div>

            <div>
                <div class="form-group field-bbiiforum-membergroup">
                    <label class="control-label" for="name">Member Group</label>
                    <?php 
echo Html::activeDropDownList($model, 'membergroup_id', ArrayHelper::map(BbiiMembergroup::find()->specific()->all(), 'id', 'name'), ['class' => 'form-control', 'id' => 'membergroup']);
?>
                </div>
            </div>

            <div>
                <div class="form-group field-bbiiforum-poll">
                    <label class="control-label" for="name">Poll</label>
                    <?php 
echo Html::activeDropDownList($model, 'poll', ['0' => Yii::t('BbiiModule.bbii', 'No polls'), '1' => Yii::t('BbiiModule.bbii', 'Moderator polls'), '2' => Yii::t('BbiiModule.bbii', 'User polls')], ['class' => 'form-control', 'disabled' => true, 'id' => 'poll']);
?>
                </div>
            </div>
            
            <div>
                <?php 
Пример #6
0
 /**
  * [actionUpdatemembergroup description]
  * 
  * @param  [type] $id [description]
  * @return [type]     [description]
  */
 public function actionUpdatemembergroup($id = null)
 {
     $id = is_numeric($id) ? $id : \Yii::$app->request->get('id');
     $model = BbiiMembergroup::find()->where(['id' => $id])->one();
     // set data
     if ($model->load(\Yii::$app->request->post())) {
         // validate and save
         if ($model->validate() && $model->save()) {
             \Yii::$app->getSession()->addFlash('success', Yii::t('BbiiModule.bbii', 'Change saved.'));
             return \Yii::$app->response->redirect('group');
             // error when saving
         }
     } else {
         return $this->render('update/membergroup', ['model' => $model]);
     }
 }
Пример #7
0
               'value' => '$data->group->name',
               'filter' => ArrayHelper::map(BbiiMembergroup::find()->findAll(), 'id', 'name'),
           ),
           array(
               'name' => 'moderator',
               'value' => 'Html::checkBox("moderator", $data->moderator, array("onclick" => "changeModeration(this,$data->id,\'' . \Yii::$app->urlManager->createAbsoluteUrl('setting/changeModerator') . '\')"))',
               'type' => 'raw',
               'filter' => array('0' => Yii::t('BbiiModule.bbii', 'No'), '1' => Yii::t('BbiiModule.bbii', 'Yes')),
               'htmlOptions' => array("style" => "text-align:center"),
           ),
           
       ),
   ));*/
?>

    <p>
        <?php 
// This is done via the web app itself - DJE : 2015-05-25
//echo Html::a('Create Moderator', ['../member/create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(array('columns' => array('member_name', array('attribute' => 'group_id', 'filter' => ArrayHelper::map(BbiiMembergroup::find()->findAll(), 'id', 'name'), 'value' => function ($data) {
    return isset($data->group) ? $data->group->name : null;
}), array('attribute' => 'moderator', 'filter' => array('0' => Yii::t('BbiiModule.bbii', 'No'), '1' => Yii::t('BbiiModule.bbii', 'Yes')), 'format' => 'raw', 'options' => array("style" => "text-align:center")), ['buttons' => ['update' => function ($url, $model) {
    return Html::a('<span class="glyphicon glyphicon-pencil"></span>', '../member/update?id=' . $model->id, ['title' => Yii::t('yii', 'Update')]);
}], 'class' => 'yii\\grid\\ActionColumn', 'template' => '{update}']), 'dataProvider' => $model, 'id' => 'moderator-grid'));
?>

</div>