示例#1
0
 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);
 }
示例#2
0
 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);
 }