* @var QuestionModel $qM * @var CActiveForm $form */ $model = UserModel::model()->client()->findByPk(Yii::app()->user->id); $this->widget('zii.widgets.CDetailView', array('data' => $qM, 'attributes' => array(array('name' => 'title', 'value' => $qM->title ? $qM->title : null), array('name' => 'text', 'value' => $qM->text ? $qM->text : null), array('name' => 'date_add', 'value' => $qM->date_add ? $qM->date_add : null), array('name' => 'city', 'value' => $qM->city ? $qM->city : null), array('name' => 'id', 'value' => $qM->id ? $qM->id : null), array('name' => 'type', 'value' => QuestionModel::model()->arr_type[$qM->type])))); if ($qM->addQuestions) { $i = 1; foreach ($qM->addQuestions as $k => $addQuestion) { if ($addQuestion->jurist_id !== null) { ?> <h1 style="text-align: center; font-size: 24px">Дополнительные вопрос №<?php echo $i; ?> </h1> <?php $this->widget('zii.widgets.CDetailView', array('data' => $addQuestion, 'attributes' => array(array('name' => 'text', 'type' => 'html', 'value' => $addQuestion->text ? $addQuestion->text : null), array('name' => 'jurist_id', 'value' => $addQuestion->jurist_id ? AddQuestion::fioById($addQuestion->jurist_id) : null)))); $i++; } } } if ($qM->answer) { ?> <h1 style="text-align: center; font-size: 24px">Ответы Юристов</h1> <?php $this->widget('zii.widgets.grid.CGridView', array('dataProvider' => $dataProvider, 'columns' => [['name' => 'id', 'visible' => false], ['name' => 'user.info.avatar', 'type' => 'html', 'value' => function ($data) { if ($data->user && $data->user->info) { return CHtml::image($data->user->info->avatar ? '/uploads/profile/images/' . $data->user->info->avatar : 'https://s0.pravoved.ru/images/design/avatar_large_male_lawyer_default.jpg?s=000d57bb83d9d26ee3a264550dec70d5', '', ['style' => 'height: 150px;']); } }], ['name' => 'text', 'type' => 'html'], $model ? ['class' => 'CButtonColumn', 'template' => '{update} {view}', 'updateButtonOptions' => ['title' => 'Задать доп вопрос', 'class' => 'newButton small green chatWithUser'], 'viewButtonOptions' => ['title' => 'Заплатить юристу за ответ', 'class' => 'newButton small green chatWithUser'], 'updateButtonUrl' => 'Yii::app()->controller->createUrl("followUp",array("lawyerId"=>$data->user_id,"answerId" => $_GET["id"]))', 'updateButtonImageUrl' => [], 'updateButtonLabel' => 'Задать дополнительный вопрос', 'viewButtonUrl' => 'Yii::app()->controller->createUrl("payLawyer",array("lawyerId"=>$data->user_id,"answerId" => $_GET["id"]))', 'viewButtonImageUrl' => [], 'viewButtonLabel' => 'Заплатить за ответ'] : ['class' => 'CButtonColumn', 'template' => '']])); } else { if (UserModel::model()->client()->findByPk(Yii::app()->user->id) !== null) {
</li>--> <li class=""> <a style="<?php echo $addQuestion ? 'background-color: rgba(163, 9, 15, 0.79)' : null; ?> " href="<?php echo $url; ?> ">Уточнения</a> </li> </ul> <?php } elseif ($client = UserModel::model()->client()->findByPk($app->user->id)) { if ($client->id != 1) { $addQuestionClient = AddQuestion::model()->findByAttributes(['status' => 0, 'client_id' => $app->user->id]); $question = QuestionModel::model()->findAllByAttributes(['user_id' => $client->id, 'status' => QuestionModel::STATUS_CLOSE]); $urlClient = $app->createUrl('#'); $urlQuestion = $app->createUrl('#'); if ($addQuestionClient) { $urlClient = $app->createUrl('question/answer', ['id' => $addQuestionClient->q_id]); } if ($question) { $urlQuestion = $app->createUrl('question/close'); } ?> <ul class="newMenu unregistered"> <li class="order dropdown"> <span>Заказать услугу</span> <ul class="hidden"> <li class="orderQuestion"><a href="/question/add/">Задать вопрос</a></li>
public function actionFollowUp($lawyerId, $answerId) { $answer = Answer::model()->findByAttributes(['q_id' => $answerId]); if (isset($_POST['AddQuestion']) && isset($_POST['AddQuestion']['text']) && !empty($_POST['AddQuestion']['text'])) { $model = new AddQuestion(); $model->text = $_POST['AddQuestion']['text']; $model->q_id = $answer->q_id; $model->jurist_id = $lawyerId; $model->status = 0; $model->save(); $this->redirect($this->createUrl('question/answer', ['id' => $answerId])); } $this->render('followUp', ['lawyerId' => $lawyerId, 'answerId' => $answerId]); }
<?php /** * @var CActiveForm $form * @var integer $lawyerId * @var integer $id */ $form = $this->beginWidget('CActiveForm', array('id' => 'spform', 'action' => $this->createUrl('followUp', ['lawyerId' => $lawyerId, 'answerId' => $answerId]), 'enableClientValidation' => true, 'clientOptions' => array('validateOnSubmit' => TRUE, 'validateOnChange' => TRUE))); ?> <div class="standalone"> <?php echo $form->widget('ImperaviRedactorWidget', array('model' => AddQuestion::model(), 'attribute' => 'text', 'options' => array('lang' => 'ru', 'iframe' => true, 'css' => 'wym.css'), 'plugins' => array('textdirection' => array('js' => array('textdirection.js')), 'imagemanager' => array('js' => array('imagemanager.js')), 'filemanager' => array('js' => array('filemanager.js')), 'clips' => array('css' => array('clips.css'), 'js' => array('clips.js'), 'depends' => array('imperavi-redactor')))), true); ?> </div> <br> <div class="clear"></div> <div class="standalone buttons"> <button type="submit" class="toRight" style="border: 1px solid rgb(161, 188, 224); color: rgb(47, 47, 47); padding: 6px 12px; background-color: rgb(143, 174, 216);"> Сохранить </button> </div> </div> <?php $this->endWidget();