public function run() { SelectAsset::register($this->view); FilterAsset::register($this->view); $values = []; foreach ($this->data as $value) { $value = strval($value); $values[$value] = $value; } if (!$this->default) { $this->default = $this->multiple ? array_keys($values) : key($values); } $selected = $this->selected($this->default); // Setup options $options = ['id' => $this->name, 'name' => $this->name . '[]', 'style' => 'width: 300px;', 'class' => 'selectpicker']; $extra = ['title' => 'Not selected']; if ($this->multiple) { $extra['multiple'] = 'multiple'; } if ($this->placeholder) { $extra['title'] = strval($this->placeholder); } $options = array_merge($options, $extra); if (!$this->method) { $this->method = 'get'; } // Render echo Html::beginForm(Url::canonical(), $this->method, ['data-pjax' => '1', 'id' => $this->name]); echo Html::beginTag('select', $options, ['data-pjax' => '1']); echo Html::renderSelectOptions($selected, $values); echo Html::endTag("select"); echo Html::endForm(); parent::run(); }
/** * @inheritdoc */ public function beforeAction($action) { if (parent::beforeAction($action)) { $this->view->registerLinkTag(['rel' => 'canonical', 'href' => Url::canonical()]); if (\Yii::$app->request->get('page') == 1) { $this->redirect(str_replace('/page/1', '', \Yii::$app->request->getUrl())); } return true; } else { return false; } }
public function run() { $id = $this->getId(); echo Html::beginForm(Url::canonical(), 'get', ['data-pjax' => '1', 'id' => $this->name]); echo Html::beginTag('div'); echo Html::beginTag("select", ['id' => $id, 'multiple' => 'multiple', 'class' => 'invisible', 'style' => 'width: ' . $this->width . 'px;', 'name' => $this->name . '[]']); echo Html::renderSelectOptions($this->selectedValues, $this->_allValues); echo Html::endTag("select"); echo Html::submitButton('OK', ['style' => 'margin: 0 5px;']); echo Html::endTag('div'); echo Html::endForm(); echo "<script type='text/javascript'>"; echo "\$('#{$id}').removeClass('invisible');"; echo "\$('#{$id}').multipleSelect()"; echo "</script>"; }
<?php use thedollarsign\themes\adminlte\ThemeAsset; use yii\helpers\Html; use yii\helpers\Url; ?> <title><?php echo Html::encode($this->title); ?> </title> <?php $this->head(); ThemeAsset::register($this); $this->registerMetaTag(['charset' => Yii::$app->charset]); $this->registerMetaTag(['name' => 'viewport', 'content' => 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no']); $this->registerLinkTag(['rel' => 'canonical', 'href' => Url::canonical()]); echo Html::csrfMetaTags(); ?> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script> <![endif]-->
$( this ).off( event ); }); JS ); ?> <title><?php echo Html::encode($this->title); ?> </title> <?php echo Html::csrfMetaTags(); ?> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script> <![endif]--> <meta charset="<?php echo Yii::$app->charset; ?> "> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/> <meta rel="canonical" href="<?php echo Url::canonical(); ?> "/> <?php $this->head();
/** * Init default variables for autoreplace * * @return $this */ protected function _prepareVars() { $this->setVar(['HOME_URL' => Url::home(true), 'CANONICAL_URL' => Url::canonical(), 'LOCALE' => Yii::$app->formatter->locale]); return $this; }
public function actionPublish() { //Publish it $_file = Yii::getAlias('@apisDirectory') . '/' . ucfirst($this->_core); $swagger = new Swagger($_file); $actual_link = str_replace('/rebuildschema/publish', '', Url::canonical()); $writeFiles = new FileManipulation(); $writeFiles->setFilename(ucfirst($this->_core) . '/api-docs.json'); $writeFiles->write_file($swagger->getResourceList(array('output' => 'json', 'basePath' => $actual_link . '/api-docs/Core'))); foreach ($swagger->registry as $api_name => $api) { $writeFiles->setFilename(ucfirst($this->_core) . '/' . $api_name); $writeFiles->write_file($swagger->getResource($api_name, array('output' => 'json'))); } return $this->redirect(['index']); }
<?php echo Html::a('Delete', ['delete', 'id' => $model->id_product], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Are you sure you want to delete this item?', 'method' => 'post']]); ?> </div> </div> </div> <div class="col-lg-6"> <style> .tab-content { border: 1px #e0e0e0 solid; border-top: none; padding: 20px; } </style> <?php Pjax::begin(['id' => 'pjax', 'enablePushState' => false, 'clientOptions' => ['url' => \yii\helpers\Url::canonical()]]); ?> <?php echo Html::beginForm('', 'post', ['id' => 'input-form', 'data-pjax' => '#pjax']); ?> <?php echo Html::hiddenInput('action'); ?> <?php echo Tabs::widget(['items' => [['label' => 'Uoms', 'content' => $this->render('_form_uom', ['model' => $model]), 'active' => $active == 'uom'], ['label' => 'Barcode', 'content' => $this->render('_form_barcode', ['model' => $model]), 'active' => $active == 'barcode']]]); ?> </div> <?php echo Html::endForm(); Pjax::end();
public function actionWadl($id) { $apiName = $this->actionPublish($id); $basePathPart = Url::canonical(); $basePathPart = explode('swagger', $basePathPart); $basePathPart = explode('hydra', $basePathPart[0]); $basePathPart = explode('raml', $basePathPart[0]); $basePathPart = explode('wadl', $basePathPart[0]); $basePathPart = explode('/apis/', $basePathPart[0]); $basePathPart[0] .= '/api-docs/'; $url = 'http://imagine.epu.ntua.gr:2015/transform/?location='; $url .= $basePathPart[0] . $apiName . '/api-docs.json'; $url .= '&original_format=swagger&to_format=wadl'; $response = Yii::$app->getResponse(); $response->sendContentAsFile(file_get_contents($url), 'wadl.xml'); Yii::$app->end(); }
$this->params['breadcrumbs'][] = $this->title; echo Html::csrfMetaTags(); ?> <div class="sale-order-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <p> <?php echo Html::beginForm(Url::canonical(), 'get', []); ?> <?php echo Html::textInput('page', null, ['placeholder' => 'Go to Page', 'style' => 'width:80px;']); ?> <?php echo Html::endForm(); ?> </p> <?php $url = \yii\helpers\Url::to(['sale-order/get-all-user-list']); $url2 = \yii\helpers\Url::to(['sale-order/get-all-creator-list']); // Script to initialize the selection based on the value of the select2 element $script = function ($uri) { return 'function (element, callback) { var id=$(element).val();
public function testCanonical() { $this->mockAction('page', 'view', null, ['id' => 10]); $this->assertEquals('http://example.com/base/index.php?r=page%2Fview&id=10', Url::canonical()); $this->removeMockedAction(); }
?> "> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="robots" content="index, follow"> <meta name="author" content="Jafaripur"> <meta name="rating" content="general"> <?php echo Html::csrfMetaTags(); ?> <link rel="canonical" href="<?php echo urldecode(Url::canonical()); ?> "> <meta property="og:url" content="<?php echo urldecode(Url::canonical()); ?> " /> <meta property="og:title" content="<?php echo Html::encode($this->title); ?> " /> <meta property="fb:app_id" content="348428045334410" /> <meta property="article:author" content="https://www.facebook.com/jafaripur" /> <?php //<meta property="article:publisher" content="https://www.facebook.com/cnn" /> ?> <link rel='alternate' type='application/rss+xml' title='RSS' href='<?php echo Url::to(['/feed/rss'], true); ?> '>
<?php use yii\helpers\Html; use yii\widgets\ListView; if (count(Yii::$app->request->get())) { $this->registerLinkTag(['rel' => 'canonical', 'href' => \yii\helpers\Url::canonical()]); } $this->title = $category->metaTitle; $this->registerMetaTag(['name' => 'description', 'content' => $category->metaDescription]); $this->registerMetaTag(['name' => 'keywords', 'content' => $category->metaDescription]); $this->params['breadcrumbs'] = array_merge($this->params['breadcrumbs'], $category->breadcrumbs); $layout = $app->itemsColumns > 1 ? '<div class="uk-grid uk-grid-width-medium-1-' . $app->itemsColumns . ' uk-grid-match items" data-uk-grid-margin>{items}</div>' : '<div class="items">{items}</div><div class="pager">{pager}</div>'; if ($app->itemsSort) { $layout = '<div class="sorter">Упорядочить по {sorter}</div>' . $layout; } $pjaxId = $app->name . '-category'; ?> <div class="<?php echo $app->name; ?> <?php echo $app->name; ?> -category"> <?php \yii\widgets\Pjax::begin(['id' => $pjaxId, 'timeout' => 5000, 'options' => ['data-uk-observe' => true]]); ?> <h1><?php echo Html::encode($category->name);
<?php /** * Created by PhpStorm. * User: albert * Date: 15.03.15 * Time: 18:28 * @var $this \yii\base\View * @var $context \common\widgets\Share */ $context = $this->context; use ijackua\sharelinks\ShareLinks; use yii\helpers\Html; Yii::$app->view->registerMetaTag(['name' => "keywords", 'content' => $context->title]); Yii::$app->view->registerMetaTag(['property' => "og:type", 'content' => 'article']); Yii::$app->view->registerMetaTag(['property' => "og:url", 'content' => \yii\helpers\Url::canonical()]); Yii::$app->view->registerMetaTag(['property' => "og:image", 'itemprop' => "image primaryImageOfPage", 'content' => $context->image]); //twitter Yii::$app->view->registerMetaTag(['name' => "twitter:card", 'content' => 'summary']); Yii::$app->view->registerMetaTag(['name' => "twitter:domain", 'content' => Yii::$app->getHomeUrl()]); Yii::$app->view->registerMetaTag(['name' => "twitter:title", 'property' => 'og:title', 'itemprop' => 'title name', 'content' => \common\helpers\String::truncate($context->title, 140)]); Yii::$app->view->registerMetaTag(['name' => "twitter:description", 'property' => "og:description", 'itemprop' => "description", 'content' => \common\helpers\String::truncate($context->description, 140)]); Yii::$app->view->registerMetaTag(['name' => "twitter:image", 'content' => $context->image]); ?> <div class="socialShareBlock"> <?php echo Html::a('', $context->shareUrl(ShareLinks::SOCIAL_FACEBOOK), ['title' => 'Поделиться в Facebook', 'class' => "socicon socicon-facebook"]); ?> <?php echo Html::a('', $context->shareUrl(ShareLinks::SOCIAL_TWITTER), ['title' => 'Поделиться в Twitter', 'class' => "socicon socicon-twitter"]); ?>
?> <title><?= Html::encode($this->title); ?></title> <?= Html::csrfMetaTags(); ?> <?php $this->head(); ?> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script> <![endif]--> <?php AppAsset::register($this); $this->registerMetaTag( [ 'charset' => Yii::$app->charset ] ); $this->registerMetaTag( [ 'name' => 'viewport', 'content' => 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' ] ); $this->registerLinkTag( [ 'rel' => 'canonical', 'href' => Url::canonical() ] ); ?>
?> <head> <!--[if IE]> <meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'> <![endif]--> <meta name="viewport" content="width=device-width, initial-scale=1"> <?php echo Html::csrfMetaTags(); echo Html::tag('title', $title); echo Html::tag('meta', '', ['charset' => Yii::$app->charset]); if (!User()->isGuest) { echo Html::tag('meta', null, ['name' => 'token', 'content' => $User->token]) . "\n"; } echo Html::tag('link', null, ['rel' => 'stylesheet', 'href' => '//fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&subset=latin,cyrillic,cyrillic-ext']); echo Html::tag('link', null, ['rel' => 'canonical', 'href' => \yii\helpers\Url::canonical()]); echo Html::tag('link', null, ['rel' => 'shortcut icon', 'href' => '/favicon.ico']); echo Html::tag('link', null, ['rel' => 'apple-touch-icon', 'href' => '/img/apple-touch-icon.png']); echo Html::tag('link', null, ['rel' => 'apple-touch-icon', 'href' => '/img/apple-touch-icon-72x72.png']); echo Html::tag('link', null, ['rel' => 'apple-touch-icon', 'href' => '/img/apple-touch-icon-114x114.png']); $this->head(); ?> </head> <body> <?php $this->beginBody(); echo $content; echo $this->render('_toast'); $this->endBody(); ?>