| Total Complexity | 4 |
| Total Lines | 51 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | class NotesSideWidget extends ProfileSideWidget |
||
| 17 | { |
||
| 18 | public $header = 'Note'; |
||
| 19 | public $headerIcon = 'comment'; |
||
| 20 | public $modalToggleButton = [ |
||
| 21 | 'label' => 'Update', |
||
| 22 | 'class' => 'btn btn-xs btn-link', |
||
| 23 | ]; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @var \app\modules\admin\models\Account |
||
| 27 | */ |
||
| 28 | public $model; |
||
| 29 | |||
| 30 | protected function renderModalContent() |
||
| 31 | { |
||
| 32 | $form = ActiveForm::begin([ |
||
| 33 | 'method' => 'post', |
||
| 34 | 'action' => ['account/update-note', 'id' => $this->model->id], |
||
| 35 | ]); |
||
| 36 | $note = $this->getNote(); |
||
| 37 | echo $form |
||
| 38 | ->field(new AccountNote(), 'note') |
||
| 39 | ->label(false) |
||
| 40 | ->textarea([ |
||
| 41 | 'maxlength' => true, |
||
| 42 | 'rows' => 5, |
||
| 43 | 'placeholder' => true, |
||
| 44 | 'autofocus' => true, |
||
| 45 | 'value' => $note, |
||
| 46 | ]); |
||
| 47 | |||
| 48 | echo Html::submitButton('Update', ['class' => 'btn btn-small btn-primary']); |
||
| 49 | |||
| 50 | ActiveForm::end(); |
||
| 51 | } |
||
| 52 | |||
| 53 | protected function renderBoxContent() |
||
| 54 | { |
||
| 55 | $note = $this->getNote(); |
||
| 56 | echo "<p class=\"text-muted\">\n"; |
||
| 57 | echo \Yii::$app->formatter->asNtext($note); |
||
| 58 | echo "</p>\n"; |
||
| 59 | } |
||
| 60 | |||
| 61 | protected function getNote() |
||
| 67 | } |
||
| 68 | } |