public function actionIndex() { if (!\Yii::app()->user->getProfile()->company->validate) { $this->redirect('/cabinet'); } elseif (!\ext\services\AccountingPayed::getInstance()->checkPayed()) { $this->redirect('/cabinet/tarif'); } $user = Yii::app()->getUser()->getProfile(); $this->render('index', ['user' => $user]); }
/** * @param $path * @throws CHttpException */ public function actionCategory($path) { \Yii::import('application.modules.cabinet.*'); $category = StoreCategory::model()->findByPath($path); if (null === $category) { throw new CHttpException(404); } $countries['list'] = []; $countries['checked'] = []; $price['minValue'] = []; $price['maxValue'] = []; if ($category->parent_id) { if (!empty($category->country)) { $countriesList = explode(':', $category->country); foreach ($countriesList as $id) { $country = Yii::app()->db->createCommand()->select('value_' . Yii::app()->language)->from('site_store_attribute_option')->where('id = :id', [':id' => $id])->queryScalar(); $countries['list'][$id] = $country; } } if (Yii::app()->request->getQuery('strana')) { foreach (Yii::app()->request->getQuery('strana') as $item) { $countries['checked'] += [$item => $item]; } } $price['minValue'] = $category->price_min; $price['maxValue'] = $category->price_max; if (Yii::app()->request->getQuery('minPrice')) { $price['minValue'] = Yii::app()->request->getQuery('minPrice'); } if (Yii::app()->request->getQuery('maxPrice')) { $price['maxValue'] = Yii::app()->request->getQuery('maxPrice'); } } $data = Yii::app()->getRequest()->getQueryString() ? $this->productRepository->getByFilter($this->attributeFilter->getMainAttributesForSearchFromQuery(Yii::app()->getRequest(), [AttributeFilter::MAIN_SEARCH_PARAM_CATEGORY => [$category->id]]), $this->attributeFilter->getEavAttributesForSearchFromQuery(Yii::app()->getRequest())) : $this->productRepository->getListForCategory($category); $payed = \ext\services\AccountingPayed::getInstance()->checkPayed(); $this->render('category', ['dataProvider' => $data, 'category' => $category, 'price' => $price, 'countries' => $countries, 'payed' => $payed]); }
$this->breadcrumbs = array_merge([CHtml::encode(Yii::t('CustomsModule.default', 'Таможня')) => ['/customs']], [CHtml::encode($this->pageTitle)]); ?> <style> .blue-section { margin: 0; } #directions_panel b { font-family: MuseoSansCyrl-700; } </style> <!--h1><?php //echo=$Custom->user->company->name ?> </h1--> <?php if (\ext\services\AccountingPayed::getInstance()->checkPayed()) { $this->widget('application.components.cabinet.CabinetWidget', ['company_id' => $Custom->user->company_id, 'responseModel' => 'Custom', 'responseExternalID' => $Custom->custom_id]); } elseif (!\Yii::app()->getUser()->isGuest && \Yii::app()->user->getProfile()->company->validate) { ?> <div class="row response-button"> <section class="col-md-2 col-md-offset-8"> <a class="pull-right offer btn btn-default btn-lg" id="yw0" name="yt0" type="button" href='/site/tarif'>Связаться</a><br><br> </section> </div><br><br> <?php } else { ?> <div class="row response-button"> <section class="col-md-2 col-md-offset-8"> <a class="pull-right offer btn btn-default btn-lg" id="yw0" name="yt0" type="button" href='/cabinet'>Связаться</a><br><br> </section>
<?php Yii::app()->getModule('cabinet'); // autoload, in some place can't find module CabinetModule if (Yii::app()->getUser()->getIsGuest() || !\ext\services\AccountingPayed::getInstance()->checkPayed()) { ?> <div class="row company-info"> <div class="col-md-2"> <div class="cabinet-company"> </div> </div> <div class="col-md-9 cabinet"> <div class="info"> <?php $this->widget('application.components.response.ResponseWidget', array('model' => $responseModel, 'external_id' => $responseExternalID)); ?> </div> <?php $this->widget('application.components.complaint.ComplaintWidget', array('model' => $responseModel, 'external_id' => $responseExternalID)); ?> </div> </div> <?php } else { ?> <div class="row company-info"> <?php if ($responseModel != 'Product') { ?>
public function actionAdd($id = 0) { if (!\ext\services\AccountingPayed::getInstance()->checkPayed()) { $this->redirect('/site/tarif'); } $flZayavka = 0; if (!empty($id)) { $this->pageTitle = Yii::t('MarketModule.default', 'Редактирование спецтехники'); $title = Yii::t('MarketModule.default', 'Редактирование объявления на спецтехнику'); } else { $this->pageTitle = Yii::t('MarketModule.default', 'Добавление спецтехники'); $title = Yii::t('MarketModule.default', 'Добавление объявления на спецтехнику'); } $this->breadcrumbs = array_merge([CHtml::encode(Yii::t('MarketModule.default', 'Спецтехника')) => ['/specialtechnique']], [CHtml::encode($this->pageTitle)]); if (!empty($id)) { $SpecialTechnique = SpecialTechnique::model()->findByPk($id); if (!Yii::app()->user->checkAccess('admin') && ((Yii::app()->getUser()->getProfile()->modules->head != UserModules::DIRECTOR_COMPANY || Yii::app()->user->getProfile()->company_id != $SpecialTechnique->user->company_id) && (Yii::app()->getUser()->getProfile()->modules->specialtech != '1' || $SpecialTechnique->user_id != Yii::app()->user->id) || Yii::app()->getUser()->getProfile()->company->active == '0')) { throw new CHttpException(403); } $Address = $SpecialTechnique->address; $CostForm = $SpecialTechnique->getCostForm(); $ContentManager = null; } else { if (Yii::app()->user->getProfile()->content_manager == '0') { if (!Yii::app()->user->checkAccess('admin') && (Yii::app()->getUser()->getProfile()->modules->head != UserModules::DIRECTOR_COMPANY && Yii::app()->getUser()->getProfile()->modules->specialtech != '1' || Yii::app()->getUser()->getProfile()->company->active == '0')) { throw new CHttpException(403); } elseif (!Yii::app()->getUser()->getProfile()->company->validate) { $this->redirect('/complete'); } $ContentManager = null; } else { $ContentManager = new ContentManager(); } $SpecialTechnique = new SpecialTechnique(); $Address = new Address(); $Address->setscenario('specialtechnique'); $CostForm = new CostForm(); } $contacts = User::getContact(); $SpecialTechnique->contact_id = Yii::app()->user->id; if (!empty($_POST)) { if (!empty($id) && $_POST['Address']['name'] != $SpecialTechnique->address->name) { Address::model()->deleteByPk($SpecialTechnique->address->address_id); $Address = new Address(); } $SpecialTechnique->setAttributes($_POST['SpecialTechnique'], false); $SpecialTechnique->type_request = 'offer'; $CostForm->setAttributes($_POST['CostForm'], false); $Address->setAttributes($_POST['Address'], false); if (Yii::app()->user->getProfile()->content_manager == '1' && $id == 0) { $ContentManager->setAttributes($_POST['ContentManager'], false); $contentValid = $ContentManager->validate(); } else { $contentValid = true; } $valid = $Address->validate(); $valid = $SpecialTechnique->validate() && $CostForm->validate() && $valid && $contentValid; if (!$valid) { Yii::import('bootstrap.widgets.TbActiveForm'); if ($ContentManager) { echo TbActiveForm::validate(array($SpecialTechnique, $Address, $CostForm, $ContentManager)); } else { echo TbActiveForm::validate(array($SpecialTechnique, $Address, $CostForm)); } Yii::app()->end(); } else { if (Yii::app()->user->getProfile()->content_manager == '1' && $id == 0) { $SpecialTechnique->user_id = User::createFakeUser($ContentManager); $SpecialTechnique->contact_id = $SpecialTechnique->user_id; } $Address->save(); $SpecialTechnique->address_id = $Address->address_id; $SpecialTechnique->save(); $SpecialTechnique->setRelations($_POST['SpecialTechnique']); $SpecialTechnique->setCost($CostForm); if (isset($_POST['photos'])) { $SpecialTechnique->setPhoto($_POST['photos']); } $SpecialTechnique->autosearch(); //$this->redirect('/specialtechnique'); echo CJSON::encode(array('status' => '500', 'redirect' => '/specialaddsuccess/' . $SpecialTechnique->special_technique_id)); Yii::app()->end(); } } $this->render('add', ['showPhoto' => true, 'SpecialTechnique' => $SpecialTechnique, 'CostForm' => $CostForm, 'contacts' => $contacts, 'Address' => $Address, 'title' => $title, 'ContentManager' => $ContentManager, 'flZayavka' => $flZayavka]); }
public function actionListAjax() { if (!\Yii::app()->user->isGuest) { if (Yii::app()->getRequest()->getPost('Company')) { \ext\services\AccountingPayed::getInstance()->addPayedDaysId($_POST['Company']['id'], $_POST['OpenAccessCompany']['day']); } } else { throw new CHttpException(403, 'Для вас доступ закрыт'); } \Yii::app()->end(); }
public function actionAdd($id = 0) { // !\Yii::app()->user->getProfile()->company->validate if (\Yii::app()->user->getProfile()->company->validate && !\ext\services\AccountingPayed::getInstance()->checkPayed()) { $this->redirect('/cabinet/tarif'); } $AddressesForm = new AddressesForm(); if (!empty($id)) { $Reis = Reis::model()->findByPk($id); if (!Yii::app()->user->checkAccess('admin') && ((Yii::app()->getUser()->getProfile()->modules->head != UserModules::DIRECTOR_COMPANY || Yii::app()->user->getProfile()->company_id != $Reis->user->company_id) && (Yii::app()->getUser()->getProfile()->modules->transport != '1' || $Reis->user_id != Yii::app()->user->id) || Yii::app()->getUser()->getProfile()->company->active == '0')) { throw new CHttpException(403); } $i = 1; $AddressesForm = $Reis->getAddressForm(); $CostForm = $Reis->getCostForm(); $ContentManager = null; } else { if (Yii::app()->user->getProfile()->content_manager == '0') { if (!Yii::app()->user->checkAccess('admin') && (Yii::app()->getUser()->getProfile()->modules->head != UserModules::DIRECTOR_COMPANY && Yii::app()->getUser()->getProfile()->modules->transport != '1' || Yii::app()->getUser()->getProfile()->company->active == '0')) { throw new CHttpException(403); } elseif (!Yii::app()->getUser()->getProfile()->company->validate) { $this->redirect('/complete'); } $ContentManager = null; } else { $ContentManager = new ContentManager(); } $Reis = new Reis(); $Reis->when_type_id = 40; $Reis->when_from = date("Y-m-d"); $Reis->when_to = date("Y-m-d", time() + 60 * 60 * 24 * 15); $CostForm = new CostForm(); } $company_id = Yii::app()->getUser()->getProfile()->company_id; $Contacts = User::model()->findAllByAttributes(['company_id' => $company_id]); $contacts = []; foreach ($Contacts as $Contact) { $contacts[$Contact->id] = $Contact->first_name . ' ' . $Contact->last_name . ' (' . $Contact->contact_phone . ')'; } $AddressesForm->setScenario('reis'); // alternative validation if (!empty($_POST)) { if (!empty($_POST['Reis']['reis_id'])) { $Reis = Reis::model()->findByPk($_POST['Reis']['reis_id']); } else { $Reis = new Reis(); } $postReis = $Reis->processComplexAttributes($_POST); $Reis->setAttributes($postReis['Reis'], false); $AddressesForm->setAttributes($_POST['AddressesForm'], false); if ($Reis->price_asc == '0') { $CostForm->setAttributes($_POST['CostForm'], false); } if (Yii::app()->user->getProfile()->content_manager == '1' && $id == 0) { $ContentManager->setAttributes($_POST['ContentManager'], false); $contentValid = $ContentManager->validate(); } else { $contentValid = true; } $valid = $AddressesForm->validate(); $valid = $Reis->validate() && $CostForm->validate() && $valid && $contentValid; if (!$valid) { Yii::import('bootstrap.widgets.TbActiveForm'); if ($ContentManager) { echo TbActiveForm::validate(array($Reis, $AddressesForm, $CostForm, $ContentManager)); } else { echo TbActiveForm::validate(array($Reis, $AddressesForm, $CostForm)); } Yii::app()->end(); } else { if (Yii::app()->user->getProfile()->content_manager == '1' && $id == 0) { $Reis->user_id = User::createFakeUser($ContentManager); $Reis->contact_id = $Reis->user_id; } $Reis->save(); $Reis->setRelations($postReis['Reis']); $Reis->setAddress($AddressesForm); $Reis->setCost($CostForm); $Reis->autosearch(); echo CJSON::encode(array('status' => '500', 'redirect' => '/transportaddsuccess/' . $Reis->reis_id)); Yii::app()->end(); } } // список своего транспорта $listAvtopark = null; if (Yii::app()->user->checkAccess('avtopark')) { $criteria = new CDbCriteria(); $criteria->with = ['user' => ['joinType' => 'INNER JOIN', 'condition' => 'user.company_id = :company_id']]; $criteria->params = [':company_id' => $company_id]; $listAvtoparkTmp = Transport::model()->findAll($criteria); $arrAttr = ['transport_id', 'name']; // только 2 этих аттрибута, остальное подгрузить через ajax foreach ($listAvtoparkTmp as $vlist) { $arrTmp = []; foreach ($arrAttr as $vattr) { $arrTmp[$vattr] = $vlist->attributes[$vattr]; } $listAvtopark[] = $arrTmp; } } $this->render('add', ['Reis' => $Reis, 'addreses' => $AddressesForm, 'CostForm' => $CostForm, 'contacts' => $contacts, 'listAvtopark' => $listAvtopark, 'ContentManager' => $ContentManager]); }
public function actionEmptypage() { require_once Yii::app()->basePath . "/components/AmoCRM.php"; Yii::import('application.modules.user.models.User'); $pay = \ext\services\AccountingPayed::getInstance()->checkPayed(); $this->render('empty', array('pay' => $pay)); }
public function actionAdd($id = 0) { /*if(!Yii::app()->user->checkAccess('addSklad')) { throw new CHttpException(404,'Указанная запись не найдена'); }*/ if (!\ext\services\AccountingPayed::getInstance()->checkPayed()) { $this->redirect('/site/tarif'); } if (!empty($id)) { $Sklad = Sklad::model()->findByPk($id); $Address = $Sklad->address; $Area = $Sklad->getAreaForm(); if (!Yii::app()->user->checkAccess('admin') && ((Yii::app()->getUser()->getProfile()->modules->head != UserModules::DIRECTOR_COMPANY || Yii::app()->user->getProfile()->company_id != $Sklad->user->company_id) && (Yii::app()->getUser()->getProfile()->modules->storage != '1' || $Sklad->user_id != Yii::app()->user->id) || Yii::app()->getUser()->getProfile()->company->active == '0')) { throw new CHttpException(403); } $ContentManager = null; } else { if (Yii::app()->user->getProfile()->content_manager == '0') { if (!Yii::app()->user->checkAccess('admin') && Yii::app()->getUser()->getProfile()->modules->head != UserModules::DIRECTOR_COMPANY && Yii::app()->getUser()->getProfile()->modules->storage != '1') { throw new CHttpException(403); } elseif (!Yii::app()->getUser()->getProfile()->company->validate) { $this->redirect('/complete'); } $ContentManager = null; } else { $ContentManager = new ContentManager(); } $Sklad = new Sklad(); $Address = new Address(); $Address->setscenario('sklad'); $Area = new AreaForm(); } $contacts = User::getContact(); if (isset($_POST['Sklad'])) { if (!empty($_POST['Sklad']['sklad_id'])) { $Sklad = Sklad::model()->findByPk($_POST['Sklad']['sklad_id']); } else { $Sklad = new Sklad(); } if (!empty($id) && $_POST['Address']['name'] != $Sklad->address->name) { Address::model()->deleteByPk($Sklad->address->address_id); $Address = new Address(); } $Sklad->setAttributes($_POST['Sklad'], false); $Address->setAttributes($_POST['Address'], false); if (Yii::app()->user->getProfile()->content_manager == '1' && $id == 0) { $ContentManager->setAttributes($_POST['ContentManager'], false); $contentValid = $ContentManager->validate(); } else { $contentValid = true; } $valid = $Address->validate(); $valid = $Sklad->validate() && $valid && $contentValid; if ($valid) { if (Yii::app()->user->getProfile()->content_manager == '1' && $id == 0) { $Sklad->user_id = User::createFakeUser($ContentManager); $Sklad->contact_id = $Sklad->user_id; } $Address->save(); $Sklad->address_id = $Address->address_id; $Sklad->save(); $Sklad->setRelations($_POST['Sklad']); $Sklad->setArea($_POST['AreaForm']); if (isset($_POST['photos'])) { $Sklad->setPhoto($_POST['photos']); } $Sklad->autosearch(); //$this->redirect('/storage'); $this->render('skladaddsuccess', ['Sklad' => $Sklad, 'contacts' => $contacts, 'Area' => $Area, 'Address' => $Address]); exit; } } $this->render('add', ['Sklad' => $Sklad, 'contacts' => $contacts, 'Area' => $Area, 'Address' => $Address, 'ContentManager' => $ContentManager]); }
if (!empty($Company->logo_id) && isset($Company->photo) && isset($Company->photo->path)) { ?> <img src="<?php echo File::getImageResize($Company->photo->path, 231, 231); ?> " class="logo" /><br /> <?php } else { ?> <img src="/main/No_Image.png" class="logo" /><br /> <?php } ?> <br><br> <div class='row'><div class='col-lg-6'>Осталось дней оплаченого доступа</div><div class='col-lg-6' style='font-size: 30pt;'><?php echo \ext\services\AccountingPayed::getInstance()->getRemainingDays(); ?> </div></div> <br> <h3> Оплата доступа</h3> <div class='row'><div class='col-lg-10'><a href='/cabinet/tarif' target="_blank" class='btn btn-default' id='ur_litsa'>Оплатить</a></div></div> <!--div class='row'><div class='col-lg-6'><a href='/bill' target="_blank" class='btn btn-default' id='ur_litsa'>Юр. лицо</a></div><div class='col-lg-6'><a href="#getYandexModal" role="button" class="btn btn-default" data-toggle="modal"> Физ. лицо </a></div></div--> <br><br> <?php if ($Company->validate || !$isWoner) { ?> <table> <tr> <td><?php echo Yii::t('CabinetModule.default', 'ИНН'); ?>