示例#1
0
 public function getUrl($name, $page = 1000)
 {
     $_data = ReceivedFilter::find($name, [], $page);
     $pageCount = $_data[1]->pageCount;
     //        $pageCount = 1;
     $this->stdout('Get ' . $name . ' [' . $pageCount . ' page]' . PHP_EOL, Console::FG_GREEN);
     $result = [];
     for ($i = 1; $i < $pageCount + 1; $i++) {
         $_GET['page'] = $i;
         $data = ReceivedFilter::find($name, [], $page);
         $count = count($data[0]);
         $_count = 0;
         Console::startProgress(0, $count);
         foreach ($data[0] as $value) {
             $url = Received::toPattern($name, 'url', $value);
             if (empty($result[$url])) {
                 $result[$url] = 1;
             }
             $result[$url] = ++$result[$url];
             Console::updateProgress(++$_count, $count, $i . ' ');
         }
         Console::endProgress();
     }
     return $result;
 }
示例#2
0
<?php

/**
 * direction.php - travel.loc
 * Initial version by: BeforyDeath
 * Initial version created on: 11.10.15 18:24
 */
use common\helpers\Received;
/* @var $this yii\web\View */
/* @var $dataProviderDirection yii\data\ArrayDataProvider */
/* @var $request array */
/* @var $result array */
$this->params['result'] = $result;
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Countries'), 'url' => '/route/'];
$this->params['breadcrumbs'][] = ['label' => Received::toPattern('country', 'anchor', $result), 'url' => Received::toPattern('country', 'url', $result)];
$this->params['breadcrumbs'][] = ['label' => Received::toPattern('city', 'anchor', $result), 'url' => Received::toPattern('city', 'url', $result)];
$this->params['breadcrumbs'][] = ['label' => Received::toPattern('direction', 'anchor', $result)];
$this->registerMetaTag(['name' => 'description', 'content' => Received::toPattern('direction', 'meta-desc', $result, false)]);
$this->registerMetaTag(['name' => 'keywords', 'content' => Received::toPattern('direction', 'meta-key', $result, false)]);
$this->title = Received::toPattern('direction', 'meta-title', $result, false);
$directions = $dataProviderDirection->getModels();
$result = Received::getDataPattern($result);
$count = 1;
foreach ($directions as $value) {
    $result['{airline_' . $count++ . '}'] = $value['iata_code'];
}
?>

<?php 
echo Received::toPattern('direction', 'content', $result, true, true);
示例#3
0
<?php

/**
 * airline-all.php - travel.loc
 * Initial version by: BeforyDeath
 * Initial version created on: 22.11.15 16:56
 */
use common\helpers\Received;
use yii\helpers\Html;
use yii\widgets\LinkPager;
/* @var $this yii\web\View */
/* @var $data array */
/* @var $pagination \yii\data\Pagination */
$pagination->route = '/airline/';
$this->params['breadcrumbs'][] = Yii::t('app', 'Airlines');
?>

<div class="row">
    <?php 
foreach ($data as $value) {
    ?>
        <?php 
    echo Html::a(Received::toPattern('airline', 'anchor', $value), Received::toPattern('airline', 'url', $value), ['class' => 'col-lg-6']);
    ?>
    <?php 
}
?>
</div>
<?php 
echo LinkPager::widget(['pagination' => $pagination]);
示例#4
0
<?php

/**
 * airport.php - travel.loc
 * Initial version by: BeforyDeath
 * Initial version created on: 22.11.15 12:38
 */
use common\helpers\Received;
/* @var $result array */
$this->params['result'] = $result;
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Airports'), 'url' => '/airport/'];
$this->params['breadcrumbs'][] = ['label' => Received::toPattern('airport', 'anchor', $result)];
$this->registerMetaTag(['name' => 'description', 'content' => Received::toPattern('airport', 'meta-desc', $result, false)]);
$this->registerMetaTag(['name' => 'keywords', 'content' => Received::toPattern('airport', 'meta-key', $result, false)]);
$this->title = Received::toPattern('airport', 'meta-title', $result, false);
echo Received::toPattern('airport', 'content', $result);
示例#5
0
        <div class="col-lg-12">
            <?php 
    echo $result->content;
    ?>
        </div>
    </div>
<?php 
}
?>
<div class="row">
    <?php 
foreach ($data as $value) {
    ?>
        <div class="col-lg-6">
            <?php 
    echo Html::a(Received::toPattern('country', 'anchor', $value), Received::toPattern('country', 'url', $value));
    ?>
        </div>
    <?php 
}
?>
    <?php 
/*/?>
    <?php foreach ($direction as $value) : ?>
        <div class="col-lg-6">
            <?= Html::a(
                Received::toPattern('direction', 'anchor', $value),
                Received::toPattern('direction', 'url', $value)
            ) ?>
        </div>
    <?php endforeach ?>
示例#6
0
 * Initial version by: BeforyDeath
 * Initial version created on: 22.11.15 12:38
 */
use common\helpers\Received;
use yii\bootstrap\Html;
/* @var $result array */
$this->params['result'] = $result;
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Airlines'), 'url' => '/airline/'];
$this->params['breadcrumbs'][] = ['label' => Received::toPattern('airline', 'anchor', $result)];
$this->registerMetaTag(['name' => 'description', 'content' => Received::toPattern('airline', 'meta-desc', $result, false)]);
$this->registerMetaTag(['name' => 'keywords', 'content' => Received::toPattern('airline', 'meta-key', $result, false)]);
$this->title = Received::toPattern('airline', 'meta-title', $result, false);
echo Received::toPattern('airline', 'content', $result);
?>

<h3><?php 
echo Yii::t('app', 'Directions');
?>
</h3>
<div class="row">
    <?php 
foreach ($result['directions'] as $value) {
    ?>
        <?php 
    echo Html::a(Received::toPattern('direction', 'anchor', $value), Received::toPattern('direction', 'url', $value), ['class' => 'col-lg-6']);
    ?>
    <?php 
}
?>
</div>