common.php 11.3 KB
<?php

    use common\models\User;
    use kartik\rating\StarRating;
    use \yii\helpers\Html;

    /* @var yii\web\View $this
     * @var User  $user
     * @var array $developments
     * @var array $educations
     * @var array $courses
     * @var int[] $geography
     */
    $this->params[ 'user' ] = $user;
    
    $this->title = 'Proektant.net';

    $geographyString = '';

    $first = 1;
    foreach($geography as $city => $count) {
        if(!$first) {
            $geographyString .= ', ';
        }
        $geographyString .= $city . ' (' . $count . ')';
        $first = 0;
    }
    unset( $first );
?>
<div class="proektant-profile-content">
    <?php
        if(!empty( $user->userInfo->about )) {
            ?>
            <div class="proektant-profile-hidden-txt">
                <?= $user->userInfo->about ?>
            </div>
            <a href="#" class="profile-see-all"></a>
            <?php
        }
    ?>
    <?php
        if(!empty( $educations )) {
            ?>
            <div class="proektant-profile-courses-wr style">
                <div class="proektant-profile-courses">
                    <div class="proektant-profile-courses-title">Образование:</div>
                    <?php
                        foreach($educations as $education) {
                            ?>
                            <div class="proektant-profile-courses-year"><?= isset( $education[ 'year_from' ] ) ? $education[ 'year_from' ] : '' ?>-<?= isset( $education[ 'year_to' ] ) ? $education[ 'year_to' ] : 'настоящее время' ?></div>
                            <div class="proektant-profile-courses-content"><?= isset( $education[ 'name' ] ) ? $education[ 'name' ] : '' ?></div>
                            <?php
                        }
                    ?>
                </div>
            </div>
            <?php
        }
    ?>
    <?php
        if(!empty( $developments )) {
            ?>
            <div class="proektant-profile-courses-wr style">
                <div class="proektant-profile-courses">
                    <div class="proektant-profile-courses-title">Собственные разработки, патенты:</div>
                    <?php
                        foreach($developments as $development) {
                            ?>
                            <div class="proektant-profile-courses-year"><?= isset( $development[ 'year' ] ) ? $development[ 'year' ] : '' ?></div>
                            <div class="proektant-profile-courses-content"><?= isset( $development[ 'name' ] ) ? $development[ 'name' ] : '' ?></div>
                            <?php
                        }
                    ?>
                </div>
            </div>
            <?php
        }
    ?>
    <?php
        if(!empty( $courses )) {
            ?>
            <div class="proektant-profile-courses-wr style">
                <div class="proektant-profile-courses">
                    <div class="proektant-profile-courses-title">Пройденные курсы, тренинги:</div>
                    <?php
                        foreach($courses as $course) {
                            ?>
                            <div class="proektant-profile-courses-year"><?= isset( $course[ 'year' ] ) ? $course[ 'year' ] : '' ?></div>
                            <div class="proektant-profile-courses-content"><?= isset( $course[ 'name' ] ) ? $course[ 'name' ] : '' ?></div>
                            <?php
                        }
                    ?>
                </div>
            </div>
            <?php
        }
    ?>
    <?php
        if(!empty( $user->jobs )) {
            ?>
            <div class="proektant-profile-statistic-wr style">
                <div class="proektant-profile-tb-blocks">
                    <div class="proektant-profile-stat-title">Статистика участия</div>
                    <div class="proektant-profile-stat-table">
                        <table cellspacing="0" cellpadding="0" border="0" width="100%" style="border: 1px solid #dfdfdf; border-radius: 4px;">
                            <tr>
                                <td width="284" style="border-left: none;">Компания</td>
                                <td width="75">Проекты</td>
                                <td width="117">Реализованные</td>
                            </tr>
                            <?php
                                foreach($user->jobs as $job) {
                                    ?>
                                    <tr>
                                        <td style="border-left: none"><?= $job->name ?></td>
                                        <td><?= $job->total_count ?></td>
                                        <td><?= $job->complete_count ?></td>
                                    </tr>
                                    <?php
                                }
                            ?>
                        </table>
                    </div>
                </div>
            </div>
            <?php
        }
    ?>
</div>
<div class="proektant-profile-sidebar-right">
    <div class="style">
        <div class="profile-phone-site style">
            <?= $this->render('/patrial/show_phone', [
                'phones' => $phones,
            ]) ?>
            <?= $this->render('/patrial/show_site', [
                'sites' => $sites,
            ]) ?>
        </div>
        <div class="profile-features style">
            <ul>
                <?php
                    if(!empty( $geographyString )) {
                        ?>
                        <li>
                            <span>География работ: </span><?= $geographyString ?>
                        </li>
                        <?php
                    }
                ?>
                <li><span>Местонахождение: </span>
                    <?php
                        if(!empty( $user->userInfo->city )) {
                            echo $user->userInfo->city;
                        } else {
                            echo 'Не указано';
                        }
                    ?>
                </li>
                <li>
                    <div class="features-tags features-tags-profile">
                        <?php foreach($user->specializations as $specialization): ?>
                            <span><a href="#"><?= $specialization->specialization_name ?></a>, </span>
                        <?php endforeach; ?>
                    </div>
                </li>
                <?php
                    if(!empty( $soft )) {
                        ?>
                        <li><span>Работа с программами: </span><?= $soft ?></li>
                        <?php
                    }
                ?>
                <?php
                    if(!empty( $user->userInfo->guarantee )) {
                        ?>
                        <li><span>Гарантия: </span><?= $user->userInfo->guarantee ?> года</li>
                        <?php
                    }
                ?>
                <?php
                    if(!empty( $user->userInfo->contract )) {
                        ?>
                        <li>
                            <span>Договор: </span><?= $user->userInfo->contract ?>
                        </li>
                        <?php
                    }
                ?>
                <?php
                    if(!empty( $user->userInfo->estimate )) {
                        ?>
                        <li>
                            <span>Смета: </span><?= $user->userInfo->estimate ?>
                        </li>
                        <?php
                    }
                ?>
                <?php
                    if(!empty( $user->userInfo->purchase )) {
                        ?>
                        <li>
                            <span>Закупка стройматериалов: </span><?= $user->userInfo->purchase ?>
                        </li>
                        <?php
                    }
                ?>
                <?php
                    if(!empty( $user->userInfo->delivery )) {
                        ?>
                        <li>
                            <span>Доставка стройматериалов: </span><?= $user->userInfo->delivery ?>
                        </li>
                        <?php
                    }
                ?>
                <li><span>Предоплата:</span>
                    <?php
                        if(!empty( $user->userInfo->prepayment )) {
                            echo $user->userInfo->prepayment . '%';
                        } else {
                            echo 'без предоплаты';
                        }
                    ?>
                </li>
            </ul>
        </div>
        <div class="profile-comments style">
            <div class="company-performer-comm-title style">Мнений: <?= count($user->comments) ?></div>
            <div class="company-performer-comments-wr style">
                <?php
                    $count = ( count($user->comments) > 4 ) ? 4 : count($user->comments);
                    for($i = 0; $i < $count; $i++) {
                        ?>
                        <div class="company-performer-comments-bl">
                            <?php
                                if(!empty( $user->comments[ $i ]->rating )) {
                                    echo StarRating::widget([
                                        'name'          => 'rating_common',
                                        'value'         => $user->comments[ $i ]->rating->value,
                                        'pluginOptions' => [
                                            'displayOnly' => true,
                                            'size'        => 'xxs',
                                            'min'         => 0,
                                            'max'         => 10,
                                            'stars'       => 10,
                                        ],
                                    ]);
                                }
                            ?>
                            <div class="company-performer-comments-autor">Мнение от: <?= $user->comments[ $i ]->getAuthor(' (Гость)') ?></div>
                            <div class="company-performer-comments-txt"><?= $user->comments[ $i ]->text ?></div>
                            <a href="#" class="company-comm-see-all"><span>Развернуть</span></a>
                        </div>
                        <?php
                    }
                ?>
            </div>
            <div class="company-performer-comm-see-all-butt style">
                <?php
                    echo Html::a('Читать все мнения', [
                        'performer/review',
                        'performer_id' => $user->id,
                        'type'         => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
                    ]);
                ?>
            </div>
        </div>
    </div>
</div>