Initial import
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\models\parsed;
|
||||
|
||||
interface ArticleParsedInterface
|
||||
{
|
||||
public function id();
|
||||
public function title($lg = null);
|
||||
public function text();
|
||||
public function textShort();
|
||||
public function image($rez = null);
|
||||
public function images($rez = null);
|
||||
public function relation();
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\models\parsed;
|
||||
|
||||
|
||||
interface CartInterface
|
||||
{
|
||||
public function setCart(CartModel $model);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\models\parsed;
|
||||
|
||||
|
||||
class CartModel
|
||||
{
|
||||
public $title;
|
||||
public $subTitle;
|
||||
public $description;
|
||||
public $quantity;
|
||||
public $singlePrice;
|
||||
public $price;
|
||||
public $datetime;
|
||||
public $availableQuantity;
|
||||
public $cartKey;
|
||||
public $name_bg;
|
||||
public $name_en;
|
||||
public $text_bg;
|
||||
public $text_en;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\models\parsed;
|
||||
|
||||
|
||||
class FavoriteModel
|
||||
{
|
||||
public $name;
|
||||
public $url;
|
||||
public $img;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace app\models\parsed;
|
||||
|
||||
use app\models\Navigation;
|
||||
use app\services\Auth;
|
||||
use function GuzzleHttp\Psr7\str;
|
||||
|
||||
class NavigationParsed
|
||||
{
|
||||
public $name;
|
||||
public $relation;
|
||||
|
||||
public function __construct(Navigation $model)
|
||||
{
|
||||
$lg = \Yii::$app->language;
|
||||
|
||||
$urlParams = \Yii::$app->request->get();
|
||||
$partnerUrlAddition = '';
|
||||
if (\Yii::$app->controller->id == 'partner') {
|
||||
$partner = $lg == 'en' ? 'partner' : 'partnjor';
|
||||
$partnerUrlAddition = $partner . '/' . $urlParams['partnerSlug'] . '/';
|
||||
}
|
||||
|
||||
switch ($lg) {
|
||||
default:
|
||||
$this->name = $model->name;
|
||||
if ($model->page_id) {
|
||||
$this->relation = '/' . $lg . '/' . $partnerUrlAddition . $model->page->slug . '/';
|
||||
} else {
|
||||
$this->relation = $model->url ?? '#';
|
||||
if(!empty($model->url_authorised) && (Auth::getUser() || !empty($_SESSION['register_user']))) {
|
||||
$this->relation = $model->url_authorised;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'en':
|
||||
$this->name = $model->ts_en_name;
|
||||
if ($model->page_id) {
|
||||
$this->relation = '/' . $lg . '/' . $partnerUrlAddition . $model->page->slug_en . '/';
|
||||
} else {
|
||||
$this->relation = $model->url ?? '#';
|
||||
if($model->url_authorised && (Auth::getUser() || !empty($_SESSION['register_user']))) {
|
||||
$this->relation = $model->url_authorised;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\models\parsed;
|
||||
|
||||
|
||||
interface Page
|
||||
{
|
||||
public function headerImage($rez = null);
|
||||
public function headerTitle();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\models\parsed;
|
||||
|
||||
|
||||
class SearchResultModel
|
||||
{
|
||||
public $id;
|
||||
public $url;
|
||||
public $text;
|
||||
public $type;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\models\parsed;
|
||||
|
||||
|
||||
use app\models\Slides;
|
||||
|
||||
class SlidesParsed
|
||||
{
|
||||
public $title;
|
||||
public $text;
|
||||
public $relation;
|
||||
public $image;
|
||||
|
||||
public function __construct(Slides $model)
|
||||
{
|
||||
|
||||
switch (\Yii::$app->language) {
|
||||
default:
|
||||
$this->title = $model->title;
|
||||
$this->text = $model->text;
|
||||
$this->relation = $model->relation;
|
||||
break;
|
||||
case 'en':
|
||||
$this->title = $model->ts_en_title;
|
||||
$this->text = $model->ts_en_text;
|
||||
$this->relation = $model->ts_en_relation;
|
||||
}
|
||||
|
||||
$this->image = $model->getSrcOfSingleImage('slide_home_page_image', '16:10');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user