public function saveNewStateRecord()
 {
     $state = new State();
     $state['state'] = Input::get('txtState');
     if ($state->save()) {
         return 1;
     } else {
         return 0;
     }
 }
 /**
  * Lists all HarvestPlant models.
  * @return mixed
  */
 public function actionIndex()
 {
     $harvestToolsReportSearch = new HarvestToolsReportSearch();
     $harvestToolsReportSearch->yearStart = date('Y');
     $harvestToolsReportSearch->yearEnd = $harvestToolsReportSearch->yearStart;
     $harvestToolsReportSearch->quarterStart = 1;
     if (date('m') >= 9) {
         $harvestToolsReportSearch->quarterEnd = 4;
     } else {
         if (date('m') >= 6) {
             $harvestToolsReportSearch->quarterEnd = 3;
         } else {
             if (date('m') >= 3) {
                 $harvestToolsReportSearch->quarterEnd = 2;
             } else {
                 $harvestToolsReportSearch->quarterEnd = 1;
             }
         }
     }
     $typeToolses = TypeTools::find()->all();
     $stateCount = State::find()->count();
     $years = [];
     $quarters = [];
     $states = State::find()->select('name')->column();
     $typeToolses2 = TypeTools::find()->select('name')->column();
     $stateIds = [];
     if ($harvestToolsReportSearch->load(Yii::$app->request->post())) {
         $stateIds = $harvestToolsReportSearch->stateIds;
         if (!empty($stateIds)) {
             $stateCount = State::find()->where(['id' => $stateIds])->count();
             $states = State::find()->select('name')->where(['id' => $stateIds])->column();
         }
         $typeToolsIds = $harvestToolsReportSearch->typeToolsIds;
         if (!empty($typeToolsIds)) {
             $typeToolses = TypeTools::find()->where(['id' => $typeToolsIds])->all();
             $typeToolses2 = TypeTools::find()->select('name')->where(['id' => $typeToolsIds])->column();
         }
         $yearStart = $harvestToolsReportSearch->yearStart;
         $yearEnd = $harvestToolsReportSearch->yearEnd;
         for ($i = $yearStart; $i <= $yearEnd; $i++) {
             $years[] = $i;
         }
         $quarterStart = $harvestToolsReportSearch->quarterStart;
         $quarterEnd = $harvestToolsReportSearch->quarterEnd;
         for ($i = $quarterStart; $i <= $quarterEnd; $i++) {
             $quarters[] = $i;
         }
     }
     $renders['typeToolses'] = $typeToolses;
     $renders['stateCount'] = $stateCount;
     $renders['stateIds'] = $stateIds;
     $renders['years'] = $years;
     $renders['quarters'] = $quarters;
     $renders['states'] = $states;
     $renders['typeToolses2'] = $typeToolses2;
     $session = Yii::$app->session;
     $session->set('renderHarvestToolsReport', $renders);
     $renders['harvestToolsReportSearch'] = $harvestToolsReportSearch;
     return $this->render('index', $renders);
 }
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $lg_id = LedgerGroup::lists('name', 'id');
     $state_id = State::lists('state_name', 'id');
     //        $state_id = State::where('id','=', 4)->lists('state_name','id'); // with condition
     return view('ledgers.create', compact('lg_id', 'state_id'));
 }
Beispiel #4
0
 /**
  * Finds the State model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return State the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = State::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Beispiel #5
0
 public function actionGetorgstate($id)
 {
     $rows = \app\models\State::find()->where(['country_id' => $id, 'is_status' => 0])->ALL();
     echo Html::tag('option', Html::encode(Yii::t('app', '--- Select State ---')), ['value' => '']);
     foreach ($rows as $row) {
         echo Html::tag('option', Html::encode($row->state_name), ['value' => $row->state_id]);
     }
 }
Beispiel #6
0
 private function getStates()
 {
     $statesResult = State::find()->all();
     $states = array();
     foreach ($statesResult as $state) {
         $states[$state['id']] = $state['name'];
     }
     return $states;
 }
Beispiel #7
0
 public function getCity(Request $req)
 {
     $state = State::find($req->id);
     $city = City::where('state_code', $state->code)->get();
     $html = '<option value="" selected>Choose Option</option>';
     foreach ($city as $cities) {
         $html .= '<option value="' . $cities->id . '">' . $cities->name . '</option>';
     }
     echo $html;
 }
Beispiel #8
0
 public function allState()
 {
     $response = array();
     $infos = State::all();
     if (!empty($infos)) {
         foreach ($infos as $info) {
             $response[] = array("info_id" => $info['id'], "data_description" => $info['state']);
         }
     }
     return $response;
 }
 public function actionEditUserBlock($id)
 {
     $userModel = $this->findUserBlock($id);
     $model = Block::find()->with('links')->where(['id' => $userModel->block_id])->one();
     $states = State::find()->all();
     $test = Link::find()->where(['id' => 2])->one();
     if ($userModel->load(Yii::$app->request->post()) && $userModel->save()) {
         Yii::$app->getSession()->setFlash('success', Yii::t('app', '{model} SUCCESS_UPDATED', ['model' => $model->title]));
     }
     return $this->render('userSettings', ['userModel' => $userModel, 'model' => $model, 'states' => $states, 'test' => $test]);
 }
 public function __construct()
 {
     $this->middleware('auth');
     $user_types = UserType::lists("name", "id");
     $states = State::lists("name", "id");
     $users_count = User::with("state")->latest()->get()->count();
     $universities_count = University::latest()->get()->count();
     $sos_count = SosModel::latest()->get()->count();
     $students_count = Student::latest()->get()->count();
     $companies_count = Company::latest()->get()->count();
     \View::share(compact("users_count", "universities_count", "sos_count", "states", "user_types", "students_count", "companies_count"));
 }
 public function actionEmp_p_state($id)
 {
     $rows = \app\models\State::find()->where(['state_country_id' => $id, 'is_status' => 0])->all();
     echo "<option value=''>---Select State---</option>";
     if (count($rows) > 0) {
         foreach ($rows as $row) {
             echo "<option value='{$row->state_id}'>{$row->state_name}</option>";
         }
     } else {
         echo "";
     }
 }
Beispiel #12
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = State::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSizeLimit' => [10, 100]], 'sort' => ['defaultOrder' => ['name' => SORT_ASC]]]);
     $params = $this->processParams($params);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'country_id' => $this->country_id]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'code', $this->code]);
     return $dataProvider;
 }
Beispiel #13
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = State::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, 'active' => $this->active]);
     $query->andFilterWhere(['like', 'state', $this->state])->andFilterWhere(['like', 'category', $this->category]);
     return $dataProvider;
 }
Beispiel #14
0
 public static function customJs()
 {
     $translates = [];
     $langs = ['No items selected'];
     foreach ($langs as $lang) {
         $translates[$lang] = __($lang);
     }
     $hash_states = [];
     $states = State::find()->orderBy('name asc')->asArray()->all();
     foreach ($states as $state) {
         $hash_states[$state['country_id']][] = ['id' => $state['id'], 'name' => $state['name']];
     }
     return "window.yii.app = " . Json::encode(['states' => $hash_states, 'langs' => $translates]);
 }
 public function search($input)
 {
     $query = State::query();
     $columns = Schema::getColumnListing('states');
     $attributes = array();
     foreach ($columns as $attribute) {
         if (isset($input[$attribute]) and !empty($input[$attribute])) {
             $query->where($attribute, $input[$attribute]);
             $attributes[$attribute] = $input[$attribute];
         } else {
             $attributes[$attribute] = null;
         }
     }
     return [$query->get(), $attributes];
 }
Beispiel #16
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = State::find()->where(['is_status' => 0]);
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['state_id' => SORT_DESC]]]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['state_id' => $this->state_id, 'state_country_id' => $this->state_country_id, 'created_at' => $this->created_at, 'created_by' => $this->created_by, 'updated_at' => $this->updated_at, 'updated_by' => $this->updated_by, 'is_status' => $this->is_status]);
     $query->andFilterWhere(['like', 'state_name', $this->state_name]);
     unset($_SESSION['exportData']);
     $_SESSION['exportData'] = $dataProvider;
     return $dataProvider;
 }
Beispiel #17
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = State::find();
     // add conditions that should always apply here
     $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;
     }
     // grid filtering conditions
     $query->andFilterWhere(['id' => $this->id, 'sort' => $this->sort, 'created_at' => $this->created_at, 'created_by' => $this->created_by, 'updated_at' => $this->updated_at, 'updated_by' => $this->updated_by]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     $query->andFilterWhere(['like', 'coords', $this->name]);
     return $dataProvider;
 }
Beispiel #18
0
 public function ajaxCountryStates()
 {
     $country_id = Input::get("country_id");
     $state = State::where('country_id', '=', $country_id)->get();
     return $state;
 }
 private function addEditVendorView($id)
 {
     $data = array();
     $vendor = Vendor::find($id);
     if ($vendor) {
         $data["vendor"] = $vendor;
     }
     $states = State::all();
     if (count($states) > 0) {
         $data["states"] = $states;
     }
     $benefit_types = $this->getBenefitType();
     if (count($benefit_types) > 0) {
         $data["benefit_types"] = $benefit_types;
     }
     return view('index', $data)->with('page', 'vendor_create_edit');
 }
Beispiel #20
0
             $add_co = '';
         }
         echo "<td class='text-center'>" . EmpAddress::findOne($sd['emp_master_emp_address_id'])->emp_cadd . " " . $add_c . " " . $add_s . " " . $add_co . "</td>";
     } else {
         echo "<td class='text-center'>&nbsp;</td>";
     }
 } else {
     if ($s == 'emp_padd') {
         if ($sd['emp_master_emp_address_id'] != 0) {
             if (!empty(EmpAddress::findOne($sd['emp_master_emp_address_id'])->emp_padd_city)) {
                 $add_c = "<br/>" . City::findOne(EmpAddress::findOne($sd['emp_master_emp_address_id'])->emp_padd_city)->city_name . ", ";
             } else {
                 $add_c = '';
             }
             if (!empty(EmpAddress::findOne($sd['emp_master_emp_address_id'])->emp_padd_state)) {
                 $add_s = State::findOne(EmpAddress::findOne($sd['emp_master_emp_address_id'])->emp_padd_state)->state_name . ", ";
             } else {
                 $add_s = '';
             }
             if (!empty(EmpAddress::findOne($sd['emp_master_emp_address_id'])->emp_padd_country)) {
                 $add_co = Country::findOne(EmpAddress::findOne($sd['emp_master_emp_address_id'])->emp_padd_country)->country_name;
             } else {
                 $add_co = '';
             }
             echo "<td class='text-center'>" . EmpAddress::findOne($sd['emp_master_emp_address_id'])->emp_padd . " " . $add_c . " " . $add_s . " " . $add_co . "</td>";
         } else {
             echo "<td>&nbsp;</td>";
         }
     } else {
         if ($s == 'emp_joining_date') {
             $jdate = EmpInfo::findOne($sd['emp_master_emp_info_id'])->{$s};
Beispiel #21
0
	<div class="bs-callout bs-callout-label-4"><h5> Permanent Address </h5></div>

    <?php 
echo $form->field($model, 'emp_padd')->textArea(['maxlength' => 255]);
?>

     <?php 
echo $form->field($model, 'emp_padd_country')->dropDownList(ArrayHelper::map(\app\models\Country::find()->all(), 'country_id', 'country_name'), ['prompt' => '---Select Country---', 'onchange' => '
                        $.get( "' . Url::toRoute('dependent/emp_p_state') . '", { id: $(this).val() } )
                            .done(function( data ) {
                                $( "#' . Html::getInputId($model, 'emp_padd_state') . '" ).html( data );
                            }
                        );']);
?>
    <?php 
echo $form->field($model, 'emp_padd_state')->dropDownList(ArrayHelper::map(\app\models\State::find()->all(), 'state_id', 'state_name'), ['prompt' => '---Select State---', 'onchange' => '
                        $.get( "' . Url::toRoute('dependent/emp_p_city') . '", { id: $(this).val() } )
                            .done(function( data ) {
                                $( "#' . Html::getInputId($model, 'emp_padd_city') . '" ).html( data );
                            }
                        );']);
?>

    <?php 
echo $form->field($model, 'emp_padd_city')->dropDownList(ArrayHelper::map(\app\models\City::findAll(['city_state_id' => $model->emp_padd_state]), 'city_id', 'city_name'), ['prompt' => '---Select City---']);
?>

    <?php 
echo $form->field($model, 'emp_padd_pincode')->textInput();
?>
Beispiel #22
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getState0()
 {
     return $this->hasOne(State::className(), ['name' => 'state']);
 }
 public function actionState()
 {
     $states = State::find()->all();
     return $this->render('state', ['model' => $states]);
 }
Beispiel #24
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getStates()
 {
     return $this->hasMany(State::className(), ['state_country_id' => 'country_id']);
 }
Beispiel #25
0
 </div>

<div class="col-xs-12 col-sm-12 col-lg-12 no-padding">
      <div class="col-xs-12 col-sm-6 col-lg-6">	
    	<?php 
echo $form->field($address, 'stu_padd_country')->dropDownList(ArrayHelper::map(\app\models\Country::find()->where(['is_status' => 0])->all(), 'country_id', 'country_name'), ['prompt' => Yii::t('stu', '--- Select Country ---'), 'onchange' => '
                        $.get( "' . Url::toRoute('dependent/ustud_p_state') . '", { id: $(this).val() } )
                            .done(function( data ) {
                                $( "#' . Html::getInputId($address, 'stu_padd_state') . '" ).html( data );
                            }
                        );']);
?>
	</div>
	<div class="col-xs-12 col-sm-6 col-lg-6">	
	    <?php 
echo $form->field($address, 'stu_padd_state')->dropDownList(ArrayHelper::map(\app\models\State::find()->where(['state_country_id' => $address->stu_padd_country, 'is_status' => 0])->all(), 'state_id', 'state_name'), ['prompt' => Yii::t('stu', '--- Select State ---'), 'onchange' => '
                        $.get( "' . Url::toRoute('dependent/ustud_p_city') . '", { id: $(this).val() } )
                            .done(function( data ) {
                                $( "#' . Html::getInputId($address, 'stu_padd_city') . '" ).html( data );
                            }
                        );']);
?>
	</div>
 </div>
  <div class="col-xs-12 col-sm-12 col-lg-12 no-padding">
      <div class="col-xs-12 col-sm-6 col-lg-6">	
  	  <?php 
echo $form->field($address, 'stu_padd_city')->dropDownList(ArrayHelper::map(\app\models\City::find()->where(['city_state_id' => $address->stu_padd_state, 'is_status' => 0])->all(), 'city_id', 'city_name'), ['prompt' => Yii::t('stu', '--- Select City ---')]);
?>
     </div>
      <div class="col-xs-12 col-sm-6 col-lg-6">			
Beispiel #26
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCityState()
 {
     return $this->hasOne(State::className(), ['state_id' => 'city_state_id']);
 }
Beispiel #27
0
          <div class="form-group text-center">
          <label class="control-label"><hr></label>
          s/d
          </div>
        </div>
        <div class="col-xs-5 col-sm-3 col-md-2">
          <?php 
echo $form->field($model, 'quarterEnd')->dropDownList(['1' => 'I', '2' => 'II', '3' => 'III', '4' => 'IV']);
?>
        </div>
    </div>

    <div class="row">
      <div class="col-xs-12 col-sm-8 col-md-5">
        <?php 
$data = ArrayHelper::map(State::find()->select(['id', 'name'])->asArray()->all(), 'id', 'name');
echo $form->field($model, 'stateIds')->widget(Select2::classname(), ['data' => $data, 'options' => ['placeholder' => 'Pilih Kecamatan ...'], 'pluginOptions' => ['allowClear' => true, 'multiple' => true]])->label('Kecamatan');
?>
      </div>
    </div>
    <div class="row">
      <div class="col-xs-12 col-sm-8 col-md-5">
        <?php 
$data = ArrayHelper::map(TypeTools::find()->select(['id', 'name'])->asArray()->all(), 'id', 'name');
echo $form->field($model, 'typeToolsIds')->widget(Select2::classname(), ['data' => $data, 'options' => ['placeholder' => 'Pilih Jenis Alat ...'], 'pluginOptions' => ['allowClear' => true, 'multiple' => true]])->label('Jenis Alat');
?>
      </div>
    </div>

    <div class="form-group">
        <?php 
Beispiel #28
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getStates()
 {
     return $this->hasMany(State::className(), ['updated_by' => 'user_id']);
 }
Beispiel #29
0
    <?php 
$state_id = Yii::$app->user->identity->state_id;
$columns[] = ['class' => 'yii\\grid\\SerialColumn'];
$columns[] = ['attribute' => 'tools_id', 'format' => 'raw', 'value' => function ($data) {
    if ($data->tools_id > 0) {
        return \app\models\Tools::findOne($data->tools_id)->name;
    } else {
        return "-";
    }
}];
if ($state_id > 0) {
} else {
    $columns[] = ['attribute' => 'state_id', 'format' => 'raw', 'value' => function ($data) {
        if ($data->state_id > 0) {
            return \app\models\State::findOne($data->state_id)->name;
        } else {
            return "-";
        }
    }];
}
$columns[] = ['attribute' => 'year', 'headerOptions' => ['style' => 'width:75px;', 'class' => 'text-center'], 'contentOptions' => ['class' => 'text-center']];
$columns[] = ['attribute' => 'quarter', 'headerOptions' => ['style' => 'width:75px;', 'class' => 'text-center'], 'contentOptions' => ['class' => 'text-center']];
$columns[] = ['attribute' => 'param', 'headerOptions' => ['style' => 'width:75px;', 'class' => 'text-center'], 'contentOptions' => ['class' => 'text-center']];
/*
$columns[] = [
  'attribute' => 'note',
  'headerOptions' => [
      'style' => 'width:75px;',
      'class' => 'text-center',
  ],
Beispiel #30
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getState()
 {
     return $this->hasOne(State::className(), ['id' => 'state_id']);
 }