Example #1
0
 public function init()
 {
     $this->model = new RepliesModel(['constrain' => ['type' => 'chat']]);
     $this->notificationModel = new \nitm\widgets\models\Notification(['constrain' => ['user_id' => \Yii::$app->user->getId()]]);
     $this->updateOptions = array_merge($this->_updateOptions, $this->updateOptions);
     parent::init();
     Asset::register($this->getView());
 }
Example #2
0
 public function init()
 {
     $this->model = $this->model instanceof RepliesModel ? $this->model : new RepliesModel(['constrain' => ['type' => 'notes']]);
     $this->model->maxLength = 140;
     $this->editorOptions = array_merge($this->defaultEditorOptions(), $this->editorOptions);
     $this->options = array_merge($this->defaultOptions(), $this->options);
     parent::init();
     Asset::register($this->getView());
 }
Example #3
0
 public function init()
 {
     switch (1) {
         case !$this->model instanceof IssuesModel && ($this->parentType == null || $this->parentId == null):
             $this->model = null;
             break;
         default:
             $this->model = $this->model instanceof IssuesModel ? $this->model : IssuesModel::findModel([$this->parentId, $this->parentType]);
             break;
     }
     parent::init();
 }
Example #4
0
 public function init()
 {
     if (!$this->model instanceof VoteModel && $this->parentType == null || $this->parentId == null) {
         $this->model = new VoteModel(['parent_id' => $this->parentId, 'parent_type' => $this->parentType]);
     } else {
         $this->model = $this->model instanceof VoteModel ? $this->model : VoteModel::findModel([$this->parentId, $this->parentType]);
     }
     $this->uniqid = uniqid();
     $this->iconOptions = !isset($this->iconOptions) ? $this->_defaultIconOptions : $this->iconOptions;
     parent::init();
     Asset::register($this->getView());
 }
 public function init()
 {
     switch (1) {
         case !$this->revisionsModel instanceof RevisionsModel && ($this->parentType == null || $this->parentId == null):
             $this->_enableRevisions = false;
             break;
         default:
             $this->revisionsModel = $this->revisionsModel instanceof RevisionsModel ? $this->model : RevisionsModel::findModel([$this->parentId, $this->parentType]);
             break;
     }
     parent::init();
 }
Example #6
0
 public function init()
 {
     switch (1) {
         case !$this->model instanceof RevisionsModel && ($this->parentType == null || $this->parentId == null):
             $this->model = null;
             break;
         default:
             $this->model = $this->model instanceof RevisionsModel ? $this->model : (new RevisionsModel(['initSearchClass' => false]))->findModel([$this->parentId, $this->parentType]);
             break;
     }
     parent::init();
     Asset::register($this->getView());
 }
Example #7
0
 public function init()
 {
     switch (1) {
         case !$this->model instanceof RepliesModel && ($this->parentType == null || $this->parentId == null || $this->parentKey == null):
             $this->model = null;
             break;
         default:
             $this->model = $this->model instanceof RepliesModel ? $this->model : (new RepliesModel(['initSearchClass' => false]))->findModel([$this->parentId, $this->parentType, $this->parentKey]);
             break;
     }
     parent::init();
     $this->options = array_merge($this->defaultOptions(), $this->options);
     $this->options['id'] .= $this->uniqid;
     Asset::register($this->getView());
 }
Example #8
0
 public function init()
 {
     switch (1) {
         case !$this->model instanceof RepliesModel && ($this->parentType == null || $this->parentId == null || $this->parentKey == null):
             $this->model = null;
             break;
         default:
             $this->model = $this->model instanceof RepliesModel ? $this->model : RepliesModel::findModel([$this->parentId, $this->parentType, $this->parentKey]);
             break;
     }
     parent::init();
     $this->uniqid = !$this->uniqid ? '-' . uniqid() : $this->uniqid;
     $this->options['id'] .= $this->uniqid;
     Asset::register($this->getView());
 }
Example #9
0
 public function init()
 {
     parent::init();
     $legend = Html::tag('span', 'Legend: ', []);
     foreach ($this->legend as $type => $message) {
         /* initialize css class for each alert box */
         $options['class'] = $this->labelOptions['class'] . ' label-' . $type;
         if ($type == 'normal') {
             $options['style'] = 'color:black';
         } else {
             $options['style'] = '';
         }
         /* assign unique id to each alert box */
         $options['id'] = $this->getId() . '-' . $type;
         $legend .= Html::tag('span', $message, $options);
     }
     echo Html::tag('div', $legend, $this->options);
 }
Example #10
0
 public function init()
 {
     $this->model = $this->model instanceof RepliesModel ? $this->model : new RepliesModel(['constrain' => ['type' => 'chat']]);
     parent::init();
 }