コード例 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Manufacturer::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(['manufacturer_id' => $this->manufacturer_id, 'flag_active' => $this->flag_active, 'date_added' => $this->date_added, 'date_update' => $this->date_update]);
     $query->andFilterWhere(['like', 'manufacturer_name', $this->manufacturer_name])->andFilterWhere(['like', 'manufacturer_desc', $this->manufacturer_desc]);
     return $dataProvider;
 }
コード例 #2
0
ファイル: _form.php プロジェクト: vab777/marts.id_be
    </div><!--/form-group-->
 
    <div class="form-group">
      <label class="col-sm-3 control-label">Category</label>
      <div class="col-sm-6">
          <?php 
echo $form->field($model, 'category_id')->label(false)->dropDownList(ArrayHelper::map(Category::find()->all(), 'category_id', 'category_name'), ['prompt' => 'Select Category Name', 'class' => 'form-control']);
?>
      </div>
    </div><!--/form-group--> 

    <div class="form-group">
      <label class="col-sm-3 control-label">Manufacturer</label>
      <div class="col-sm-6">
        <?php 
echo $form->field($model, 'manufacturer_id')->label(false)->dropDownList(ArrayHelper::map(Manufacturer::find()->all(), 'manufacturer_id', 'manufacturer_name'), ['prompt' => 'Select Manufacturer Name', 'class' => 'form-control']);
?>
      </div>
    </div><!--/form-group--> 

    <div class="form-group">
      <label class="col-sm-3 control-label">UPC Barcode</label>
      <div class="col-sm-6">
        <?php 
echo $form->field($model, 'upc_barcode')->label(false)->textInput(['maxlength' => 12, 'placeholder' => 'Input UPC Barcode.']);
?>
      </div>
    </div><!--/form-group--> 
    
    <div class="form-group">
      <label class="col-sm-3 control-label">ean13 Barcode</label>
コード例 #3
0
 /**
  * Updates an existing Part model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     if (Yii::$app->user->identity && Yii::$app->user->identity->isStaff()) {
         $model = $this->findModel($id);
         $manufacturers = ArrayHelper::map(Manufacturer::find()->all(), 'manufacturer_id', 'manufacturer_name');
         $parametersData = $model->getParametersData($model->role_fk);
         if ($model->load(Yii::$app->request->post()) && $model->save()) {
             return $this->redirect(['view', 'id' => $model->part_id]);
         } else {
             return $this->render('update', ['model' => $model, 'manufacturers' => $manufacturers, 'role' => $model->role_fk, 'parametersData' => $parametersData]);
         }
     } else {
         throw new \yii\web\HttpException(403, 'STAFF ONLY');
     }
 }
コード例 #4
0
 /**
  * Returns a view that invokes the ajax tables which actually contains
  * the content for the manufacturers detail listing, which is generated in getDatatable.
  * This data contains a listing of all assets that belong to that manufacturer.
  *
  * @author [A. Gianotto] [<*****@*****.**>]
  * @see ManufacturersController::getDataView()
  * @param int $manufacturerId
  * @since [v1.0]
  * @return View
  */
 public function getView($manufacturerId = null)
 {
     $manufacturer = Manufacturer::find($manufacturerId);
     if (isset($manufacturer->id)) {
         return View::make('manufacturers/view', compact('manufacturer'));
     } else {
         // Prepare the error message
         $error = trans('admin/manufacturers/message.does_not_exist', compact('id'));
         // Redirect to the user management page
         return redirect()->route('manufacturers')->with('error', $error);
     }
 }