예제 #1
0
 public function actionDeleteQuestion($id)
 {
     $model = QuestionModel::model()->findByPk($id);
     $userQuestion = UserQuestion::model()->findByAttributes(['question_id' => $id]);
     if ($model) {
         $model->delete();
     }
     if ($userQuestion) {
         $userQuestion->delete();
     }
 }
예제 #2
0
파일: add.php 프로젝트: snipesn/pravoved
	<div class="row">
		<?php 
    echo $form->labelEx($model, 'text');
    ?>
		<?php 
    echo $form->textArea($model, 'text');
    ?>
		<?php 
    echo $form->error($model, 'text');
    ?>
	</div>

	<div class="row">
	    <?php 
    echo $form->radioButtonList($model, 'type', QuestionModel::model()->arr_type);
    ?>
	</div>
    
	<div class="row" id="cost">
		<?php 
    echo $form->labelEx($model, 'cost');
    ?>
		<?php 
    echo $form->textField($model, 'cost');
    ?>
		<?php 
    echo $form->error($model, 'cost');
    ?>
	</div>
예제 #3
0
파일: answer.php 프로젝트: Alamast/pravoved
<?php

/**
 * @var Answer $model
 * @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;']);
예제 #4
0
 public function actionPayLawyer($lawyerId, $answerId)
 {
     $question = QuestionModel::model()->findByPk($answerId);
     $user = UserModel::model()->findByPk($lawyerId);
     $cost = $question->cost * 0.7;
     $user->balance = $user->balance + $cost;
     $user->save(false);
     $question->status = QuestionModel::STATUS_CLOSE;
     $question->save(false);
     Yii::app()->user->setFlash('success', 'Спасибо вашь вопрос закрыт!');
     $this->redirect($this->createUrl('question/index'));
 }
예제 #5
0
파일: main.php 프로젝트: Alamast/pravoved
						<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>
									<li class="orderDoc"><a href="/document/add">Заказать документ</a></li>
예제 #6
0
 public function actionList()
 {
     $this->render('list', ['data' => QuestionModel::model()->current()->findAll(['order' => 'date_add DESC'])]);
 }
예제 #7
0
<?php

/**
 * @var CActiveDataProvider $dataProvider
 */
$this->widget('zii.widgets.grid.CGridView', array('dataProvider' => $dataProvider, 'columns' => [['name' => 'id', 'visible' => false], ['name' => 'user_id', 'value' => function ($data) {
    $user = UserInfo::model()->findByAttributes(['user_id' => $data->user_id]);
    if ($user) {
        return $user->fio();
    }
    $user = QuestionModel::model()->findByPk($data->id);
    if ($user) {
        return $user->question_user->email;
    }
}], 'title', 'text', 'city', ['name' => 'cost', 'value' => function ($data) {
    if ($data->cost) {
        return $data->cost . ' руб';
    }
    return 'Бесплатный';
}], ['class' => 'CButtonColumn', 'template' => '{view} {update} {delete}', 'updateButtonUrl' => 'Yii::app()->controller->createUrl("updateQuestion",array("id"=>$data->primaryKey))', 'viewButtonUrl' => 'Yii::app()->controller->createUrl("viewQuestion",array("id"=>$data->primaryKey))', 'deleteButtonUrl' => 'Yii::app()->controller->createUrl("deleteQuestion",array("id"=>$data->primaryKey))']]));
?>
<script type="text/javascript">
	$(function () {
		var content = $('.items'),
			ch = content.height() + content.offset().top;
		if (ch < $(window).height()) {
			content.height($(window).height() - content.offset().top - 94)
		}
	})
</script>
예제 #8
0
파일: index.php 프로젝트: Alamast/pravoved
<?php

/**
 * @var UserModel $user
 * @var CWebApplication $app
 * @var CController $this
 */
$app = Yii::app();
$text = '';
$content = [];
if ($user->client()->findByPk($app->user->id) != null) {
    $content = QuestionModel::model()->findAllByAttributes(['user_id' => $app->user->id]);
    if ($content) {
        $text = 'Вопросов заданно ' . count($content) . ' шт.';
    } else {
        $text = 'Вы еще не задавали вопросы юристам';
    }
}
/*elseif ($user->jurist()->findByPk($app->user->id) !== null) {
	$questions = QuestionModel::model()->findAllByAttributes(['user_id' => $app->user->id]);
	if ($questions) {
		$text = 'Вопросов заданно ' . count($questions) . ' шт.';
	} else {
		$text = 'Вы еще не задавали вопросы юристам';
	}
}*/
?>
<div class="contentInner">
	<div class="userDashboard">
		<?php 
$this->renderPartial('leftPart', array('user' => $user));