当前位置: 首页>>代码示例>>PHP>>正文


PHP url::toRoute方法代码示例

本文整理汇总了PHP中url::toRoute方法的典型用法代码示例。如果您正苦于以下问题:PHP url::toRoute方法的具体用法?PHP url::toRoute怎么用?PHP url::toRoute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在url的用法示例。


在下文中一共展示了url::toRoute方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: statusIssue

function statusIssue($model)
{
    if ($model->STATUS == 1) {
        /*REVIEW*/
        // return Html::a('<i class="fa fa-square-o fa-md"></i> REVIEW','#',['class'=>'btn btn-info btn-xs', 'style'=>['width'=>'100px'],'title'=>'Review']);
        return Html::button(Yii::t('app', 'Review'), ['value' => url::to(['link-berita', 'id' => $model->ID]), 'id' => 'modal-btn-issue', 'class' => "btn btn-info btn-xs", 'style' => ['width' => '100px']]);
    } elseif ($model->STATUS == 2) {
        /*PROCESS*/
        return Html::a('<i class="fa fa-check-square-o fa-md"></i> OPEN', url::toRoute(['/widget/berita/detail-berita-open', 'id' => $model->ID_ISSUE_REF]), ['class' => 'btn btn-success btn-xs', 'style' => ['width' => '100px'], 'title' => 'Process']);
    } elseif ($model->STATUS == 3) {
        /*CLODED*/
        return Html::a('<i class="glyphicon glyphicon-remove"></i> CLOSED', url::toRoute(['/widget/berita/detail-berita-open', 'id' => $model->ID_ISSUE_REF]), ['class' => 'btn btn-danger btn-xs', 'style' => ['width' => '100px'], 'title' => 'Closed']);
    }
}
开发者ID:adem-team,项目名称:advanced,代码行数:14,代码来源:_indexIssue.php

示例2:

    <!-- Portfolio Item Row -->
    <div class="row">
        <div class="col-lg-8">
            <!-- Blog Post -->
            <p><i class="fa fa-clock-o"></i> Posted on <?php 
echo $model->date;
?>
 </p>
            <hr>

            <?php 
$images = ContentHelper::fetchImages($model->text);
if ($images['count']) {
    $carousel = CarouselWidget::widget(['template' => 'single', 'mode' => 'images', 'slides' => $images['images']]);
    echo '<div class="col-lg-12">' . $carousel . '</div>';
    $this->registerMetaTag(['property' => 'og:image', 'content' => url::toRoute($images['main']['src'], true)]);
}
?>

            <div class="col-lg-12">
                <?php 
echo ContentHelper::cleanImages($model->text);
?>
            </div>

        </div>
        <div class="col-md-4">
            <!-- Blog Search Well -->
            <!--            <div class="well">-->
            <!--                <h4>Search</h4>-->
            <!--                <div class="input-group">-->
开发者ID:ut8ia,项目名称:iwet,代码行数:31,代码来源:single.php

示例3: foreach

    echo Url::toRoute(['/errors/tracereport']);
    ?>
" class="btn btn-default">总统计</a>
                            <a href="<?php 
    echo Url::toRoute(['/errors/tracedayreport']);
    ?>
" class="btn btn-default">日统计</a>
                            <a href="<?php 
    echo Url::toRoute(['/errors/tracemonreport']);
    ?>
" class="btn btn-default">月统计</a>
                        </div>
                        <div class="btn-group pull-right" role="group" aria-label="First group">
                            <select id="year_select"
                                    onchange="window.location.href = '<?php 
    echo url::toRoute("errors/tracemonreport");
    ?>
?years=' + options[selectedIndex].value"
                                    class="form-control" name="years">
                                <?php 
    foreach ($options as $key => $value) {
        ?>
                                    <option value="<?php 
        echo $key;
        ?>
"
                                            <?php 
        if ($years == $key) {
            ?>
selected <?php 
        }
开发者ID:bfyang5130,项目名称:tuanlogs,代码行数:31,代码来源:tracereport.php

示例4:

    <div class="offer-v2-item">
        <div class="offer-v2-img">
            <a href="<?php 
echo url::toRoute(['view', 'id' => $model->id], true);
?>
">
                 <img class="offer-v2-img-bg" src="<?php 
echo $model->Image;
?>
">
            </a>
        </div>
        <div class="offer-v2-info">
            <h3><a href="<?php 
echo url::toRoute(['view', 'id' => $model->id], true);
?>
"><?php 
echo $model->name;
?>
</a></h3>
            <div class="offer-v2-code">Код: <?php 
echo $model->id;
?>
</div>
<!--            <table class="table offer-v2-spec-table">-->
<!--            </table>-->
            <div class="offer-v2-deliv">
                <table class="table page-table-deliv">
                    <tr><td class="page-table-deliv-1"><span class="offer-v1-deliv-days"><?php 
echo $model->srok;
开发者ID:kd-brinex,项目名称:kd,代码行数:30,代码来源:tovars_block_view_2.php

示例5: actionPut

 public function actionPut()
 {
     $params = Yii::$app->request->post();
     $post = array_merge(Yii::$app->request->post());
     $params = Yii::$app->request->queryParams;
     switch ($params['mode']) {
         case 'changeQuantity':
             if (Yii::$app->request->isAjax) {
                 if (!empty($position = (int) $post['position']) && !empty($quantity = (int) $post['quantity'])) {
                     $basket = BasketSearch::findOne($position);
                     $basket->tovar_count = $quantity;
                     return $basket->update();
                 }
             }
             break;
         case 'put':
             $session = new \yii\web\Session();
             $id = Yii::$app->request->post('id');
             if ($id) {
                 $tovar = Tovar::findOne(['id' => $id]);
                 if ($tovar) {
                     $toBasket = new BasketSearch();
                     $toBasket->tovar_id = $id;
                     $toBasket->tovar_count = 1;
                     $toBasket->tovar_price = $tovar->price;
                     $toBasket->session_id = Yii::$app->session->id;
                     $toBasket->tovar_min = 1;
                     $toBasket->provider_id = 5;
                     //id=5 провайдер KD ищет в локальной базе
                     if (Yii::$app->user->id) {
                         $toBasket->uid = Yii::$app->user->id;
                     }
                     if ($toBasket->save()) {
                         return '<a class="btn" href="' . url::toRoute(['/basket/basket'], true) . '"><i class="icon-shopping-cart icon-black"></i>Уже в корзине</a>';
                     } else {
                         if (YII_DEBUG) {
                             var_dump($toBasket->getErrors());
                         }
                     }
                 } else {
                     return false;
                 }
             }
             return '<a class="btn" href="' . url::toRoute(['/basket/basket'], true) . '"><i class="icon-shopping-cart icon-black"></i>Уже в корзине</a>';
             break;
         case 'update':
             //                $data = Yii::$app->request->post();
             //                if (isset($data) && $data != '') {
             //                    $basket = BasketSearch::findOne(['id' => intval($data['row_id'])]);
             //                    if ($basket)
             //                        $basket->description = Html::encode($data['text']);
             //                    if ($basket->save())
             //                        return true;
             //                }
             if (Yii::$app->request->post('hasEditable')) {
                 $post = Yii::$app->request->post();
                 $model = $basket = BasketSearch::findOne(['id' => $post['editableKey']]);
                 $data['OrderSearch'] = current($post['OrderSearch']);
                 if ($model->load($data) && $model->save()) {
                     $data = ['output' => $model->comment];
                 }
                 return Json::encode($data);
             }
             break;
         case 'order':
             // создаем новый заказ
             $user_id = Yii::$app->user->id;
             $number = ($user_id ? $user_id : 'N') . '-' . date("ymdhis");
             $orders = explode(';', Yii::$app->request->post('orderData'));
             $formData = Yii::$app->request->post('formData');
             if (isset($formData) && $formData != '') {
                 parse_str($formData, $fdata);
                 $profileData = array_values($fdata['Profile']);
             }
             $fdata['deliveryStore'] = isset($fdata['deliveryStore']) ? $fdata['deliveryStore'] : 0;
             $cityCode = Yii::$app->request->cookies['city'];
             $city = \app\modules\city\models\CitySearch::find()->where(['id' => $cityCode ? $cityCode : 2097])->one();
             $order_data = ['number' => $number, 'date' => date("Y-m-d H:i:s"), 'user_id' => $user_id, 'user_name' => $fdata['Profile']['name'], 'user_email' => $fdata['User']['email'], 'user_telephone' => $fdata['User']['telephone'], 'user_location' => $city->name, 'store_id' => (int) $fdata['deliveryStore']];
             $order = new Order();
             $order->load($order_data, '');
             $order->save();
             // передаем id заказа
             $order_id = $order->id;
             $order = new OrderUpdate1c();
             $order->OrderId = $order_id;
             $order->save();
             $user = \app\modules\user\models\User::findOne($user_id);
             $user->scenario = 'update';
             $user->telephone = $order_data['user_telephone'];
             $user->save();
             $profile = Profile::findOne($user_id);
             $profile->scenario = 'order';
             $profile->name = $order_data['user_name'];
             $profile->save();
             foreach ($orders as $order) {
                 $order = explode(':', $order);
                 $basket = BasketSearch::findOne(['id' => intval($order[0])]);
                 if ($basket) {
                     $product = Tovar::findOne(['id' => $basket->tovar_id]);
                     $data['Orders'] = ['product_id' => $product ? $product->id : null, 'manufacture' => $basket->manufacturer, 'part_name' => $product ? $product->name : $basket->part_name, 'part_price' => $basket->tovar_price, 'product_article' => $product ? null : $basket->part_number, 'quantity' => $order[1], 'reference' => '', 'status' => \app\modules\user\models\Orders::ORDER_ADOPTED, 'datetime' => date('Y-m-d H:i:s'), 'description' => $basket->description, 'order_id' => (int) $order_id, 'provider_id' => (int) $basket->provider_id, 'delivery_days' => (int) $basket->period];
//.........这里部分代码省略.........
开发者ID:kd-brinex,项目名称:kd,代码行数:101,代码来源:BasketController.php

示例6:

use yii\helpers\Url;
use yii\helpers\Html;
//use yii\helpers\Html5;
?>
<div id="<?php 
echo $model->tovar_id;
?>
_offer">
    <div class="col-xs-12 col-lg-6 col-md-5 col-sm-5">
        <div class="offer-v3-code"><?php 
echo $model->tovar_id;
?>
</div>

            <a href="<?php 
echo url::toRoute(['/tovar/tovar/view', 'id' => $model->tovar_id], true);
?>
"><?php 
echo $model->tovarname;
?>
</a>

    </div>
    <div class="col-xs-5 col-lg-1 col-md-2 col-sm-2" ><?php 
echo HTML::input('number', 'tovar_count', $model->tovar_count, ['size' => '5', 'min' => 1, 'max' => 10, 'id' => $model->tovar_id, 'onchange' => 'count(this)']);
?>
</div>
    <div class="hidden-xs col-lg-2 col-md-2 col-sm-2" id="<?php 
echo $model->tovar_id;
?>
_price" ?><?php 
开发者ID:kd-brinex,项目名称:kd,代码行数:31,代码来源:tovars_block_view.php

示例7:

<?php

use yii\helpers\Url;
/**
 * Created by PhpStorm.
 * User: marat
 * Date: 27.02.15
 * Time: 10:40
 */
if ($model->inbasket > 0) {
    echo '<a class="btn" href="' . url::toRoute(['/basket/basket'], true) . '"><i class="icon-shopping-cart icon-black"></i>Уже в корзине</a>';
} else {
    echo '<div tovar_id="' . $model->id . '" onclick="put(this)">
                <div class="btn btn-basket">
                <i class="icon-shopping-cart icon-white"></i>' . ($viewtype == 3 ? '' : 'Заказать') . '</div></div>';
}
开发者ID:kd-brinex,项目名称:kd,代码行数:16,代码来源:btn_basket.php


注:本文中的url::toRoute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。