Example #1
0
 * @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) {