コード例 #1
0
ファイル: Category.php プロジェクト: jimminababan/sangkilbiz3
 public function search($params)
 {
     $query = CategoryModel::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id_category' => $this->id_category, 'create_by' => $this->create_by, 'update_by' => $this->update_by]);
     $query->andFilterWhere(['like', 'cd_category', $this->cd_category])->andFilterWhere(['like', 'nm_category', $this->nm_category])->andFilterWhere(['like', 'create_at', $this->create_at])->andFilterWhere(['like', 'update_at', $this->update_at]);
     return $dataProvider;
 }
コード例 #2
0
 /**
  * Finds the Category model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param  integer               $id
  * @return Category              the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Category::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #3
0
ファイル: _form.php プロジェクト: jimminababan/sangkilbiz3
    <div class="panel panel-primary">
        <div class="panel-heading">
            Product
        </div>
        <div class="panel-body">

            <?php 
echo $form->field($model, 'cd_product')->textInput(['maxlength' => 13, 'style' => 'width:160px;']);
?>

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

            <?php 
echo $form->field($model, 'id_category')->dropDownList(ArrayHelper::map(Category::find()->all(), 'id_category', 'nm_category'), ['style' => 'width:200px;']);
?>

            <?php 
echo $form->field($model, 'id_group')->dropDownList(ArrayHelper::map(ProductGroup::find()->all(), 'id_group', 'nm_group'), ['style' => 'width:200px;']);
?>

        </div>
        <div class="panel-footer">
            <div class="form-group">
                <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
            </div>
        </div>
    </div>
コード例 #4
0
ファイル: Product.php プロジェクト: jimminababan/sangkilbiz3
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdCategory()
 {
     return $this->hasOne(Category::className(), ['id_category' => 'id_category']);
 }