コード例 #1
0
ファイル: LineSearch.php プロジェクト: frankpaul142/chaide
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Line::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'type_id' => $this->type_id]);
     $query->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'status', $this->status])->andFilterWhere(['like', 'picture', $this->picture])->andFilterWhere(['like', 'title', $this->title]);
     return $dataProvider;
 }
コード例 #2
0
 public function actionIndex()
 {
     $product = Product::findOne(6);
     $line = Line::findOne(3);
     return $this->render('index', ['product' => $product, 'line' => $line]);
 }
コード例 #3
0
ファイル: _form.php プロジェクト: frankpaul142/chaide
use yii\widgets\ActiveForm;
use app\models\Line;
use yii\helpers\ArrayHelper;
/* @var $this yii\web\View */
/* @var $model app\models\Product */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="product-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'line_id')->DropDownList(ArrayHelper::map(Line::find()->all(), 'id', 'title'));
?>

    <?php 
echo $form->field($model, 'title')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'description')->textarea(['rows' => 6]);
?>

    <?php 
echo $form->field($model, 'price')->textInput(['maxlength' => true]);
?>

    <?php 
コード例 #4
0
ファイル: Product.php プロジェクト: frankpaul142/chaide
 public function getLine()
 {
     return $this->hasOne(Line::className(), ['id' => 'line_id']);
 }
コード例 #5
0
ファイル: main2.php プロジェクト: frankpaul142/chaide
<?php

use yii\helpers\Html;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
use app\assets\AppAsset;
use yii\web\View;
use yii\helpers\Url;
use app\models\Line;
use app\models\City;
/* @var $this \yii\web\View */
/* @var $content string */
$lines = Line::find()->where(['status' => 'ACTIVE'])->all();
$cities = City::find()->all();
$script = '$(document).ready(function() {
$("#menu-chaide").click(function(){
        $(this).toggleClass("active");
        $("#menu-mobile").toggleClass("menu-active");
        $("#general").toggleClass("general-active");
    });  
});
   (function(){ var widget_id = "QcMOZSFvGS";
var s = document.createElement("script"); s.type = "text/javascript"; s.async = true; s.src = "//code.jivosite.com/script/widget/"+widget_id; var ss = document.getElementsByTagName("script")[0]; ss.parentNode.insertBefore(s, ss);})(); ';
$this->registerJs($script, View::POS_END);
AppAsset::register($this);
$this->beginPage();
?>
<!DOCTYPE html>
<html lang="<?php 
echo Yii::$app->language;
コード例 #6
0
 /**
  * Finds the Line model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Line the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Line::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #7
0
ファイル: index.php プロジェクト: frankpaul142/chaide
</h1>
                <span><?php 
echo $line->description;
?>
</span>
            </div>
        </div> 
        <!-- <a href="#" class="flecha-l"><img src="<?php 
echo URL::base();
?>
/images/flecha-seccL.svg" alt="flecha"/></a> -->
    </section>
    <?php 
if (Yii::$app->getRequest()->getCookies()->has('line')) {
    $line_id = Yii::$app->getRequest()->getCookies()->getValue('line');
    $line_i = Line::findOne($line_id);
    ?>
    <section class="sect-productos">
        <div id="secc-edredones">
            <img src="<?php 
    echo URL::base();
    ?>
/images/<?php 
    echo $line_i->picture;
    ?>
"/>
            <a href="<?php 
    echo URl::to(['line/view', 'id' => $line_i->id, '#' => $line->description]);
    ?>
"><div class="btn-comprar2">Comprar</div></a>
            <div class="txt-secciones background-edredones">