Skip to content

Commit

Permalink
Fix watchers field
Browse files Browse the repository at this point in the history
  • Loading branch information
tafid committed May 19, 2015
1 parent 29caf62 commit f41eb95
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
4 changes: 2 additions & 2 deletions models/Thread.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ public function prepareTopic()

public function afterFind()
{
// if (is_array($this->topics)) $this->topics = array_keys($this->topics);
if (is_array($this->watchers)) $this->watchers = array_keys($this->watchers);
// if (is_array($this->topics)) $this->topics = array_keys($this->topics);
// if (is_array($this->watchers)) $this->watchers = array_keys($this->watchers);

parent::afterFind();
}
Expand Down
12 changes: 12 additions & 0 deletions views/ticket/_advanced_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@
],
],
]); ?>
<?php else : ?>
<?= $form->field($model, 'watchers')->widget(ClientCombo::classname(), [
// 'clientType' => 'manager',
'inputOptions' => [
'value' => implode(',', array_keys($model->watchers)),
],
'pluginOptions' => [
'select2Options' => [
'multiple' => true,
],
],
]); ?>
<?php endif; ?>

<?php
Expand Down
2 changes: 1 addition & 1 deletion views/ticket/_leftBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
</div>
<?php endif; ?>
<?php $box->beginFooter(); ?>
<?php if (is_array($model->watchers) && in_array(Yii::$app->user->identity->id, $model->watchers)) : ?>
<?php if (is_array($model->watchers) && array_keys(Yii::$app->user->identity->id, $model->watchers)) : ?>
<?= Html::a('<i class="fa fa-eye-slash"></i>&nbsp;&nbsp;' . Yii::t('app', 'Unsubscribe'), ['unsubscribe', 'id' => $model->id], ['class' => 'btn btn-default btn-block']) ?>
<?php else : ?>
<?= Html::a('<i class="fa fa-eye"></i>&nbsp;&nbsp;' . Yii::t('app', 'Subscribe'), ['subscribe', 'id' => $model->id], ['class' => 'btn btn-default btn-block']) ?>
Expand Down

0 comments on commit f41eb95

Please sign in to comment.