public function init() { if ($this->identity === null) { throw new InvalidConfigException('Need some user info in order to work'); } $this->identity = $this->identity instanceof User ? $this->identity : User::find($this->identity); }
public function run() { $r = new RatingModel(['parent_id' => $this->parentId, 'parent_type' => $this->parentType]); $rating = ''; switch (\nitm\widgets\models\User::isAdmin()) { case true: break; } $rating .= Html::tag('div', Html::tag('strong', $r->rating($this->model), ['id' => 'rating-value' . $this->model->getUnique()]) . "%", ['class' => 'center-block text-center']); $rating .= $this->getActions(); $this->options['id'] .= $this->parentId; echo Html::tag('div', $rating, $this->options); }