to() public méthode

public to ( )
Exemple #1
0
 public static function notify($thread)
 {
     if (is_numeric($thread) && $thread > 0) {
         $email = Content::find()->where(['name' => 'email-sub'])->one();
         if ($email) {
             $topic = $email->topic;
             $content = $email->content;
         } else {
             $topic = 'New post in subscribed thread at {forum}';
             $content = '<p>There has been new post added in the thread you are subscribing. Click the following link to read the thread.</p><p>{link}</p><p>See you soon!<br />{forum}</p>';
         }
         $forum = Config::getInstance()->get('name');
         $subs = static::find()->where(['thread_id' => (int) $thread, 'post_seen' => static::POST_SEEN]);
         foreach ($subs->each() as $sub) {
             $sub->post_seen = static::POST_NEW;
             if ($sub->save()) {
                 if (Email::queue($sub->user->email, str_replace('{forum}', $forum, $topic), str_replace('{forum}', $forum, str_replace('{link}', Html::a(Url::to(['default/last', 'id' => $sub->thread_id], true), Url::to(['default/last', 'id' => $sub->thread_id], true)), $content)), !empty($sub->user_id) ? $sub->user_id : null)) {
                     Log::info('Subscription notice link queued', !empty($sub->user_id) ? $sub->user_id : '', __METHOD__);
                 } else {
                     Log::error('Error while queuing subscription notice link', !empty($sub->user_id) ? $sub->user_id : '', __METHOD__);
                 }
             }
         }
     }
 }
 public function actionAdd()
 {
     $id = !empty(yii::$app->request->get('id')) ? yii::$app->request->get('id') : 0;
     $item = $this->GetModel()->GetItem($id);
     if ($item) {
         $this->headerPage = "Редактировать слайдер " . $item["name"];
     } else {
         $this->headerPage = "Новый слайдер";
     }
     if (yii::$app->request->isPost) {
         $pathInfo = Yii::$app->request->pathInfo;
         $fields = Yii::$app->request->post();
         if (isset($fields["main"]["id"])) {
             $id = $fields["main"]["id"];
         } else {
             $id = Yii::$app->request->get('id') ? (int) Yii::$app->request->get('id') : 0;
         }
         $model = $this->GetModel();
         $model->attributes = $fields["main"];
         if ($model->validate()) {
             $insert_id = $model->Add($id, $fields["main"]);
             $this->redirect(Url::to(["/{$pathInfo}", "id" => $insert_id]));
         } else {
             $errors = $model->errors;
             app::PrintPre($errors);
         }
     }
     $interface = $this->MakeInterface($item);
     return $this->render('add', ['interface' => $interface, 'data' => $item]);
 }
 public function actionSaveComment()
 {
     if (!isset($_POST['article_id'])) {
         return $this->redirect('/article');
     }
     Comment::saveComment($_POST, true);
     $this->redirect(Url::to('/article/show/' . $_POST['article_id']));
 }
Exemple #4
0
 /**
  * Zwraca urla danego obiektu
  * @param integer $id
  * @return string
  */
 public function getUrl($id, $model)
 {
     $object = $model::find((int) $id);
     if (isset($object->url)) {
         $url = $object->url;
     }
     return \Url::to($url);
 }
Exemple #5
0
 /**
  * @param $user_id
  * @return mixed
  */
 private function getUserDirectory($user_id)
 {
     $uploads = Yii::$app->getModule('user')->uploads;
     $path = str_replace('\\', '/', Url::to('@webroot') . DIRECTORY_SEPARATOR . $uploads . DIRECTORY_SEPARATOR . $user_id);
     if (!file_exists($path)) {
         mkdir($path, 0700, true);
     }
     return $path;
 }
 public function actionPing($src)
 {
     $filename = basename($src);
     $filepath = Url::to(ImgController::PING_IMG_DIR) . $filename;
     if (!file_exists($filepath)) {
         ImageHelper::createPingImg($src);
     }
     $path = Url::to(['/.resource/' . $filename], true);
     $this->renderJsonpForJquery(['src' => $path]);
     \Yii::$app->end();
 }
 public function actionSaveComment()
 {
     if (!isset($_POST['article_id'])) {
         return $this->redirect('/article');
     }
     $comment = new Comment();
     $comment->author_id = $_POST['author_id'];
     $comment->article_id = $_POST['article_id'];
     $comment->text = $_POST['text'];
     $comment->save();
     $this->redirect(Url::to('/article/show-article', ['id' => $_POST['article_id']]));
 }
Exemple #8
0
 /**
  * @return bool|mixed
  */
 private function getDefaultAvatar()
 {
     $defaultPath = Url::to('@webroot') . DIRECTORY_SEPARATOR . $this->uploads . DIRECTORY_SEPARATOR . 'default';
     $dataFile = Url::to('@app') . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'user' . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . $this->uploads . DIRECTORY_SEPARATOR . 'default' . DIRECTORY_SEPARATOR . $this->defaultAvatar;
     $newFile = $defaultPath . DIRECTORY_SEPARATOR . $this->defaultAvatar;
     if (!file_exists($defaultPath)) {
         mkdir($defaultPath, 0700, true);
         if (!copy($dataFile, $newFile)) {
             return false;
         }
     }
     $urlDefaultAvatar = str_replace('\\', '/', Url::to(DIRECTORY_SEPARATOR . $this->uploads . DIRECTORY_SEPARATOR . 'default' . DIRECTORY_SEPARATOR . $this->defaultAvatar));
     return $urlDefaultAvatar;
 }
Exemple #9
0
 /**
  * Generates a script tag that refers to an external JavaScript file.
  * @param  string $url     the URL of the external JavaScript file. This parameter will be processed by [[\yii\helpers\Url::to()]].
  * @param  array  $options the tag options in terms of name-value pairs. These will be rendered as
  *                         the attributes of the resulting tag. The values will be HTML-encoded using [[encode()]].
  *                         If a value is null, the corresponding attribute will not be rendered.
  *                         See [[renderTagAttributes()]] for details on how attributes are being rendered.
  * @return string the generated script tag
  * @see \yii\helpers\Url::to()
  */
 public static function jsFile($url, $options = [])
 {
     $options['src'] = Url::to($url);
     if (!empty($options['conditions'])) {
         foreach ($options['conditions'] as $file => $condition) {
             if (strpos($url, $file) !== false) {
                 unset($options['conditions']);
                 return static::conditionalComment(static::tag('script', '', $options), $condition);
             }
         }
     }
     unset($options['conditions']);
     return static::tag('script', '', $options);
 }
 static function get($img, $w = "", $h = "", $crop = true, $params = array())
 {
     $fullPath = public_path() . '/' . $img;
     if (!File::exists($fullPath)) {
         return false;
     }
     $format = '';
     $width = '';
     $htmlWidth = '';
     $height = '';
     $htmlHeight = '';
     $filter = "";
     $method = '';
     $lazyParams = '';
     $ext = File::extension($fullPath);
     if ($ext == 'png') {
         $firstBytes = @file_get_contents($fullPath, false, null, 25, 1);
         if (ord($firstBytes) & 4) {
             $format = "f=png";
             //for transparent pngs
         }
     }
     if ($w) {
         $width = 'w=' . $w;
         $htmlWidth = 'width="' . $w . '"';
     }
     if ($h) {
         $height = 'h=' . $h;
         $htmlHeight = 'height="' . $h . '"';
     }
     if (count($params) > 0) {
         $filter = implode('&', $params);
         //eg: fltr[]=gray
     }
     if ($w != "" && $h != "") {
         if ($crop) {
             $method = 'zc=1';
         } else {
             $method = 'far=1&bg=FFFFFF';
         }
     }
     $image = 'src=' . $img;
     $optionsSlices = array($method, $width, $height, $filter, $image, $format);
     $options = implode('&', array_filter($optionsSlices));
     $src = Url::to('/phpthumb') . "?" . $options;
     $htmlOptionsSlices = array($htmlWidth, $htmlHeight, $lazyParams);
     $htmlOptions = implode(' ', array_filter($htmlOptionsSlices));
     return '<img src="' . $src . '" ' . $htmlOptions . ' />';
 }
Exemple #11
0
 public function redirect($url, $force = false, $statusCode = 302)
 {
     $params = Yii::$app->request->queryParams;
     // Meta redirect
     if (headers_sent() || ob_get_contents()) {
         $url = !empty($params['_return_url']) ? $params['_return_url'] : $url;
         $url = Url::to($url);
         $this->ech(Html::tag('meta', '', ['http-equiv' => 'Refresh', 'content' => '1;URL=' . $url . '']));
         $this->ech(Html::a(__('Continue'), $url));
     }
     if (!empty($params['_return_url']) && !$force) {
         return Yii::$app->getResponse()->redirect($params['_return_url'], $statusCode);
     }
     return parent::redirect($url, $statusCode);
 }
 public static function athenticateTwitter()
 {
     $return_url = Url::to('/backend/system/settings/update/radiantweb/problog/settings');
     $pb_auth = DB::table('radiantweb_twitter_auth')->first();
     $oauth_token = Session::get('oauth_token');
     $oauth_token_secret = Session::get('oauth_token_secret');
     /* Create TwitteroAuth object with app key/secret and token key/secret from default phase */
     $connection = new TwitterOAuth($pb_auth->twitter_key, $pb_auth->twitter_secret, $oauth_token, $oauth_token_secret);
     /* Request access tokens from twitter */
     $access_token = $connection->getAccessToken($_REQUEST['oauth_verifier']);
     $data = array('twitter_auth_token' => $access_token['oauth_token'], 'twitter_auth_secret' => $access_token['oauth_token_secret']);
     DB::table('radiantweb_twitter_auth')->where('twitter_key', $pb_auth->twitter_key)->update($data);
     header('Location: ' . $return_url);
     //return Redirect::to($return_url);
 }
Exemple #13
0
 /**
  * TODO Comments.
  */
 public function open($action = null, $method = 'post', $enctype = false, $attributes = array())
 {
     if (is_null($action)) {
         $action = Url::toCurrent();
     } else {
         $action = Url::to($action);
     }
     $attr = '';
     if ($attributes) {
         foreach ($attributes as $k => $v) {
             $attr .= sprintf(' %s="%s"', $k, $v);
         }
     }
     $enctype = $enctype ? ' enctype="multipart/form-data"' : '';
     return sprintf('<form method="%s" action="%s"%s%s>', $method, $action, $enctype, $attr);
 }
 function onDoTweet()
 {
     $settings = ProblogSettingsModel::instance();
     $blogPost = $settings->get('blogPost');
     $pb_auth = DB::table('radiantweb_twitter_auth')->first();
     $PB_AUTH_TOKEN = $pb_auth->twitter_auth_token;
     $PB_AUTH_SECRET = $pb_auth->twitter_auth_secret;
     $PB_APP_KEY = $pb_auth->twitter_key;
     $PB_APP_SECRET = $pb_auth->twitter_secret;
     if ($PB_AUTH_TOKEN) {
         $connection = new TwitterOAuth($PB_APP_KEY, $PB_APP_SECRET, $PB_AUTH_TOKEN, $PB_AUTH_SECRET);
         $url = Url::to('/') . '/' . $blogPost . '/' . $this->model->slug . '/';
         $msg = str_replace('{{url}}', $url, $_REQUEST['message']);
         $update_status = $connection->post('statuses/update', ['status' => $msg]);
     }
 }
 /**
  * Tries to authenticate user via social network. If user has already used
  * this network's account, he will be logged in. Otherwise, it will try
  * to create new user account.
  *
  * @param ClientInterface $client
  */
 public function authenticate(ClientInterface $client)
 {
     $account = $this->finder->findAccount()->byClient($client)->one();
     if ($account === null) {
         $account = Account::create($client);
     }
     if ($account->user instanceof User) {
         if ($account->user->isBlocked) {
             Yii::$app->session->setFlash('danger', Yii::t('user', 'Your account has been blocked.'));
             $this->action->successUrl = Url::to(['/user/security/login']);
         } else {
             if ($account->user->esActivo) {
                 Yii::$app->user->login($account->user, $this->module->rememberFor);
                 $this->action->successUrl = Yii::$app->getUser()->getReturnUrl();
             }
         }
     } else {
         $this->action->successUrl = $account->getConnectUrl();
     }
 }
Exemple #16
0
 /**
  * Creates an HTML anchor tag. If the given url matches the first part of current url, a class of "active" will automatically
  * be added to the attributes.
  *
  * Basic Example:
  * Html::a('My Text', 'some/path'); // Short hand
  * Html::a()->get('My Text', 'some/path');
  *
  * Attributes Example:
  * Html::a()->get('My Text', 'some/path', array('title' => 'My Text', 'class' => 'active'));
  *
  * @param string $title The text to go between the tags
  * @param string $url The relative or full url
  * @param array $attributes An optional array of attributes where the key is the attribute name
  * @return string An HTML anchor tag
  */
 public function get($title, $url, $attributes = array())
 {
     $attr = '';
     if ($url != '/' && strstr(Url::current(true), $url)) {
         if (isset($attributes['class'])) {
             $attributes['class'] = 'active ' . $attributes['class'];
         } else {
             $attributes['class'] = 'active';
         }
     } elseif ($url == '/' && !strlen(Url::current(true))) {
         $attributes['class'] = 'active';
     }
     if ($attributes) {
         foreach ($attributes as $k => $v) {
             $attr .= sprintf(' %s="%s"', $k, $v);
         }
     }
     $url = is_null($url) ? 'javascript:null' : Url::to($url);
     return sprintf('<a href="%s"%s>%s</a>', $url, $attr, $title);
 }
 /**
  * VISTA CATEGORIA PROVINCIA
  * @param $provincia
  * @param $categoria
  * @param $estado
  * @param null $pp
  * @param null $p
  * @return string
  */
 public function run($provincia, $categoria, $estado, $pp = null, $p = null)
 {
     $parametros = Yii::$app->request->post();
     $model = Articulos::obtenerArticulosPorCategoriaProvincia($categoria, $provincia, $estado);
     $datos = new ArticulosBuscador();
     $datos->cs = $categoria;
     $datos->ps = $provincia;
     $datos->ea = $estado;
     $dataProvider = $datos->buscadorCategoriaProvincia($parametros, $pp, $p, 'categoria-provincia');
     if (!empty($model)) {
         if ($provincia == Provincias::TODA_REP_DOM) {
             $this->controller->view->params['breadcrumbs'][] = ['label' => 'Toda República Dominicana', 'url' => Url::to(['articulo/provincia', 'provincia' => Provincias::TODA_REP_DOM])];
         } else {
             $this->controller->view->params['breadcrumbs'][] = ['label' => $model[0]->usuarios->municipios->provincias->nombre, 'url' => Url::to(['articulo/provincia', 'provincia' => $model[0]->usuarios->municipios->provincias->slug])];
             $this->controller->view->params['breadcrumbs'][] = ['label' => $model[0]->usuarios->municipios->nombre, 'url' => Url::to(['articulo/provincia', 'provincia' => $model[0]->usuarios->municipios->provincias->slug])];
         }
         $this->controller->view->params['breadcrumbs'][] = $model[0]->categorias->nombre;
         return $this->controller->render('categoria-provincia', ['model' => $model, 'dataProvider' => $dataProvider]);
         echo '<pre>';
         print_r(array('categoria provincia', $provincia, $model[0]->usuarios->municipios->provincias->slug, count($model), $model));
     }
     echo '<pre>';
     print_r(array('categoria provincia', $provincia, $categoria, $estado, 'articulo no existe'));
 }
 /**
  * 绑定第三方账号
  * @param  ClientInterface $client
  * @return \yii\web\Response
  */
 public function connect(ClientInterface $client)
 {
     $attributes = $client->getUserAttributes();
     $provider = $client->getId();
     $clientId = $attributes['id'];
     $account = $this->finder->findAccountByProviderAndClientId($provider, $clientId);
     if ($account === null) {
         $account = Yii::createObject(['class' => UserAccount::className(), 'provider' => $provider, 'client_id' => $clientId, 'data' => json_encode($attributes), 'user_id' => Yii::$app->user->id, 'created_at' => time()]);
         $account->save(false);
         Yii::$app->session->setFlash('success', '账号绑定成功');
     } else {
         Yii::$app->session->setFlash('error', '绑定失败,此账号已经绑定过了');
     }
     $this->action->successUrl = Url::to(['/user/setting/networks']);
 }
Exemple #19
0
<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
$this->title = 'Schilderwerken';
$this->params['breadcrumbs'][] = ['label' => 'Gyproc', 'url' => Url::to(['site/gyproc'])];
$this->params['breadcrumbs'][] = $this->title;
 /**
  * Get the URL to the post.
  *
  * @return string
  */
 public function url()
 {
     return Url::to($this->slug);
 }
Exemple #21
0
<?php

use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model frontend\models\Transactions */
$this->title = Yii::t('app', 'Update {modelClass}: ', ['modelClass' => 'Transactions']) . ' ' . $model->id;
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Transactions'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = Yii::t('app', 'Update');
$pageDescription = '<p style="font-size:12px; line-height:14px; margin:10px;">' . Yii::t('app', 'Lista mojih sačuvanih predmeta usluga i njihove karakteristike. Klikom na dugme desno "dodaj/izbaci predmet" pređite na stranicu za izbor i izaberite predmet.') . '</p>';
$this->pageTitle = ['icon' => 'credit-card', 'title' => Html::encode($this->title) . Html::a('<i class="fa fa-arrow-circle-left"></i>&nbsp;' . Yii::t('app', 'Nazad na transakcije'), Url::to('/' . $model->user->username . '/transactions'), ['class' => 'btn btn-default btn-sm float-right']), 'description' => $pageDescription, 'search' => null];
?>
<div class="transactions-update">

    <?php 
echo $this->render('_form', ['model' => $model]);
?>

</div>
<p class="commentCount">Количество: <?php 
echo $data['commentsCount'];
?>
 </p>

<div id="commentsList">
    <?php 
foreach ($data['comments'] as $comment) {
    $this->includeTemplate('commentBlock.php', $comment);
}
?>
</div>


<form id="addComment" role="form" method="post" action="<?php 
echo Url::to('/article/save-comment');
?>
">
    <h3>Написать коментарий</h3>

    <?php 
if (App::isAdmin()) {
    echo '<input type="hidden" value="1" name="author_id" required>';
}
?>

    <label>Текст</label>
    <textarea rows="5" name="text" required></textarea>

    <input type="hidden" name="article_id" value="<?php 
echo $data['article']->id;
Exemple #23
0
	<?php 
echo $form->field($model, 'postcode');
?>

	<?php 
echo $form->field($model, 'subdistrict_id')->widget(DepDrop::classname(), ['data' => [], 'type' => DepDrop::TYPE_SELECT2, 'select2Options' => ['pluginOptions' => ['multiple' => FALSE, 'allowClear' => TRUE, 'tags' => TRUE, 'maximumInputLength' => 255]], 'pluginOptions' => ['initialize' => TRUE, 'placeholder' => 'Select or type subdistrict', 'depends' => ['postcodeform-district_id'], 'url' => Url::to(['/region/subdistrict/depdrop-options', 'selected' => $model->subdistrict_id]), 'loadingText' => 'Loading subdistricts ...']]);
?>
	<?php 
echo $form->field($model, 'district_id')->widget(DepDrop::classname(), ['data' => [], 'type' => DepDrop::TYPE_SELECT2, 'select2Options' => ['pluginOptions' => ['multiple' => FALSE, 'allowClear' => TRUE, 'tags' => TRUE, 'maximumInputLength' => 255]], 'pluginOptions' => ['initialize' => TRUE, 'placeholder' => 'Select or type district', 'depends' => ['postcodeform-city_id'], 'url' => Url::to(['/region/district/depdrop-options', 'selected' => $model->city_id]), 'loadingText' => 'Loading districts ...']]);
?>
	<?php 
echo $form->field($model, 'city_id')->widget(DepDrop::classname(), ['data' => [], 'type' => DepDrop::TYPE_SELECT2, 'select2Options' => ['pluginOptions' => ['multiple' => FALSE, 'allowClear' => TRUE, 'tags' => TRUE, 'maximumInputLength' => 255]], 'pluginOptions' => ['initialize' => TRUE, 'placeholder' => 'Select or type city', 'depends' => ['postcodeform-province_id'], 'url' => Url::to(['/region/city/depdrop-options', 'selected' => $model->city_id]), 'loadingText' => 'Loading cities ...']]);
?>
	<?php 
echo $form->field($model, 'province_id')->widget(DepDrop::classname(), ['data' => [], 'type' => DepDrop::TYPE_SELECT2, 'select2Options' => ['pluginOptions' => ['multiple' => FALSE, 'allowClear' => TRUE, 'tags' => TRUE, 'maximumInputLength' => 255]], 'pluginOptions' => ['initialize' => TRUE, 'placeholder' => 'Select or type province', 'depends' => ['postcodeform-country_id'], 'url' => Url::to(['/region/province/depdrop-options', 'selected' => $model->province_id]), 'loadingText' => 'Loading provinces ...']]);
?>
	<?php 
echo $form->field($model, 'country_id')->widget(Select2::classname(), ['data' => Country::asOption(), 'pluginOptions' => ['placeholder' => 'Select or type Country', 'multiple' => FALSE, 'allowClear' => TRUE, 'tags' => TRUE, 'maximumInputLength' => 255]]);
?>

	<div class="form-group">
		<?php 
echo Html::submitButton('Search', ['class' => 'btn btn-primary']);
?>
		<?php 
echo Html::resetButton('Reset', ['class' => 'btn btn-default']);
?>
	</div>

	<?php 
Exemple #24
0
/* @var $this yii\web\View */
/* @var $searchModel backend\models\EventSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Events';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="event-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a('Create Event', ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo yii2fullcalendar\yii2fullcalendar::widget(['options' => ['language' => 'de'], 'ajaxEvents' => Url::to(['/timetrack/default/jsoncalendar'])]);
?>
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', 'title', 'description:ntext', 'created_date', ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
Exemple #25
0
<?php

use app\widgets\grid\GridView;
$detailsLink = function ($model) {
    return ['label' => __('Edit'), 'href' => Url::to(['/partner/update', 'id' => $model->id])];
};
$columns = [['class' => 'yii\\grid\\CheckboxColumn'], ['class' => 'app\\widgets\\grid\\ImageColumn'], ['attribute' => 'name', 'link' => $detailsLink], 'email:email', 'city', ['attribute' => 'type', 'value' => function ($model, $key, $index, $column) {
    return $model->getLookupItem('type', $model->type);
}], ['attribute' => 'status', 'value' => function ($model, $key, $index, $column) {
    return $model->getLookupItem('status', $model->status);
}], 'created_at:date'];
echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => $columns]);
<?php

use yii\widgets\Pjax;
use yii\web\JsExpression;
use execut\widget\TreeView;
Pjax::begin(['id' => 'pjax-container']);
echo \yii::$app->request->get('page');
Pjax::end();
$onSelect = new JsExpression(<<<JS
function (undefined, item) {
    if (item.href !== location.pathname) {
        \$.pjax({
            container: '#pjax-container',
            url: item.href,
            timeout: null
        });
    }

    var otherTreeWidgetEl = \$('.treeview.small').not(\$(this)),
        otherTreeWidget = otherTreeWidgetEl.data('treeview'),
        selectedEl = otherTreeWidgetEl.find('.node-selected');
    if (selectedEl.length) {
        otherTreeWidget.unselectNode(Number(selectedEl.attr('data-nodeid')));
    }
}
JS
);
$items = [['text' => 'Parent 1', 'href' => Url::to(['', 'page' => 'parent1']), 'nodes' => [['text' => 'Child 1', 'href' => Url::to(['', 'page' => 'child1']), 'nodes' => [['text' => 'Grandchild 1', 'href' => Url::to(['', 'page' => 'grandchild1'])], ['text' => 'Grandchild 2', 'href' => Url::to(['', 'page' => 'grandchild2'])]]]]]];
echo TreeView::widget(['data' => $items, 'size' => TreeView::SIZE_SMALL, 'clientOptions' => ['onNodeSelected' => $onSelect]]);
Exemple #27
0
 /**
  * @inheritDoc
  */
 public static function beginForm($action = '', $method = 'post', $options = [])
 {
     if (!empty($action)) {
         $action = Url::to($action);
     }
     $hiddenInputs = [];
     $request = Yii::$app->getRequest();
     if ($request instanceof Request) {
         if (strcasecmp($method, 'get') && strcasecmp($method, 'post')) {
             // simulate PUT, DELETE, etc. via POST
             $hiddenInputs[] = static::hiddenInput($request->methodParam, $method);
             $method = 'post';
         }
         if ($request->enableCsrfValidation && !strcasecmp($method, 'post')) {
             $hiddenInputs[] = static::hiddenInput($request->csrfParam, $request->getCsrfToken());
         }
     }
     if (!strcasecmp($method, 'get') && ($pos = strpos($action, '?')) !== false) {
         // query parameters in the action are ignored for GET method
         // we use hidden fields to add them back
         foreach (explode('&', substr($action, $pos + 1)) as $pair) {
             if (($pos1 = strpos($pair, '=')) !== false) {
                 $hiddenInputs[] = static::hiddenInput(urldecode(substr($pair, 0, $pos1)), urldecode(substr($pair, $pos1 + 1)));
             } else {
                 $hiddenInputs[] = static::hiddenInput(urldecode($pair), '');
             }
         }
         if (!empty($action)) {
             $action = substr($action, 0, $pos);
         }
     }
     if (!empty($action)) {
         $options['action'] = $action;
     }
     $options['method'] = $method;
     $form = static::beginTag('form', $options);
     if (!empty($hiddenInputs)) {
         $form .= "\n" . implode("\n", $hiddenInputs);
     }
     return $form;
 }
Exemple #28
0
<?php

echo render('includes.header');
echo render('includes.navbar');
?>
<div class="container" id="content">

<div class="row">
<div class="span4 offset4">

<form id="formPass" class="well" action="<?php 
echo Url::to('home/user_password');
?>
" method="post" accept-charset="utf-8">
	<div class="input-prepend">
		<span class="add-on"><i class="icon-lock"></i></span>
		<input type="text" class="span3" name="newPassword" placeholder="New Password" required maxlength="30" />
	</div>
	<br>
	<button type="submit" class="btn btn-block btn-primary">
	<i class="icon-refresh icon-white"></i> Change Password</button>
</form>

</div>
</div>

<div class="row">
	<div class="span4 offset4">
		
		<div id="successMessage" class="alert alert-success" style="display: none">Password changed!</div>
		<div id="errorMessage" class="alert alert-error" style="display: none">Error!</div>
Exemple #29
0
            echo t("We're not sure why, but this product doesn't seem to have a Page that correlates to it.");
            ?>
                        </div>

                        <div class="form-group">
                            <label><?php 
            echo t("Page Template");
            ?>
</label>
                            <?php 
            echo $form->select('selectPageTemplate', $pageTemplates, null);
            ?>
                        </div>

                        <a href="<?php 
            echo Url::to('/dashboard/store/products/generate/', $p->getProductID());
            ?>
" class="btn btn-primary" id="btn-generate-page"><?php 
            echo t("Generate a Product Page");
            ?>
</a>


                    <?php 
        }
        ?>

                <?php 
    } else {
        ?>
Exemple #30
0
<?php

echo render('includes.header_admin');
echo render('includes.navbar_admin');
?>

<div class="container" id="content">

<div class="row">
<div class="span4 offset4">
<form class="well" action="<?php 
echo Url::to('admin/galleries/delete/' . $gallery->id);
?>
" method="post" accept-charset="utf-8">
	<p>You really want to delete the Gallery:<br><b><?php 
echo $gallery->name;
?>
</b></p>
	<button type="submit" class="btn btn-block btn-danger"><i class="icon-trash icon-white"></i> Delete Gallery</button>
</form>
</div>
</div>

</div> <!-- /container -->

<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->

</body>
</html>