Skip to content

Instantly share code, notes, and snippets.

View mgerasimchuk's full-sized avatar

Mikhail Gerasimchuk mgerasimchuk

View GitHub Profile
<?php
namespace backend\modules\manager\controllers;
use backend\modules\manager\Controller;
use common\core\Core;
use common\models\billing\Account;
use common\models\billing\Transaction;
use common\models\billing\TransactionSearch;
use Yii;
@mgerasimchuk
mgerasimchuk / calendar.php
Last active October 26, 2016 15:32
FullCalendar js plugin + ajax in view
<?php
use common\models\Project;
/* @var $this yii\web\View */
/* @var $model Project */
$this->title = Yii::t('app', 'General statistic');
$this->params['breadcrumbs'][] = $this->title;
\backend\assets\FullCalendarAsset::register($this);
@mgerasimchuk
mgerasimchuk / UserAccountTest.php
Created October 26, 2016 15:04
Test for UserAccount model
<?php
namespace tests\codeception\common\models;
use Codeception\Specify;
use common\models\AffiliateGroup;
use common\models\MarketplaceCategory;
use common\models\UserAccount;
use common\models\UserProfile;
use tests\codeception\common\fixtures\UserAccountFixture;
use tests\codeception\common\fixtures\UserProfileFixture;
<?php
namespace tests\codeception\api\v1\affiliate;
use common\models\Campaign;
use common\models\UserAccount;
use tests\codeception\api\FunctionalTester;
use tests\codeception\common\fixtures\CampaignFixture;
use tests\codeception\common\fixtures\UserAccountFixture;
class AffiliateCampaignsCest
{
<?php
/* @var $this \yii\web\View */
/* @var $content string */
use frontend\assets\AppAsset;
use frontend\widgets\Services;
use frontend\widgets\Portfolio;
use frontend\widgets\AboutWidget;
use frontend\widgets\Team;
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model app\models\Partner */
$this->title = 'Create Partner';
$this->params['breadcrumbs'][] = ['label' => 'Partners', 'url' => ['index']];
<?php
use yii\widgets\ActiveForm;
?>
<?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]) ?>
<?= $form->field($model, 'file')->fileInput() ?>
<button>Отправить</button>
@mgerasimchuk
mgerasimchuk / main.php
Created September 23, 2015 06:54
WIDGET
<!--сворачиваем левый навигатор в зависимости от того авторизирован ли пользователь-->
<body class = "skin-green <?= (Yii::$app->user->isGuest) ? 'sidebar-collapse' : '' ?>" ">
<?php $this->beginBody() ?>
<div class="wrap">
<!--в зависимости от того, авторизирован ли пользователь, добавляем соответствующий шаблон шапки-->
<?= (Yii::$app->user->isGuest) ? $this->render('header-guest', ['baseUrl' => $baseUrl]) : $this->render('header', ['baseUrl' => $baseUrl]) ?>
<?= (Yii::$app->user->isGuest) ? null : $this->render('left-menu', ['baseUrl' => $baseUrl]) ?>
<?= $this->render('content', ['content' => $content]) ?>
<?= $this->render('footer', ['baseUrl' => $baseUrl]) ?>
@mgerasimchuk
mgerasimchuk / main.php
Created September 23, 2015 05:54
main
<!--сворачиваем левый навигатор в зависимости от того авторизирован ли пользователь-->
<?= (Yii::$app->user->isGuest) ? '<body class = "skin-green sidebar-collapse">' : '<body class = "skin-green">' ?>
<?php $this->beginBody() ?>
<div class="wrap">
<!--в зависимости от того, авторизирован ли пользователь, добавляем соответствующий шаблон шапки-->
<?= (Yii::$app->user->isGuest) ? $this->render('header-guest', ['baseUrl' => $baseUrl]) : $this->render('header', ['baseUrl' => $baseUrl]) ?>
<?= (Yii::$app->user->isGuest) ? null : $this->render('left-menu', ['baseUrl' => $baseUrl]) ?>
<?= $this->render('content', ['content' => $content]) ?>
<?= $this->render('footer', ['baseUrl' => $baseUrl]) ?>
<?php
/**
* @param bool $isGuest - является ли пользователь гостем
*/
function getHeader($isGuest)
{
if($isGuest)
{
}