public function getCategory() { if ($this->category == null) { $this->load->model('entities/easol/Easol_ReportCategory'); $category = new Easol_ReportCategory(); $this->category = $category->findOne(['ReportCategoryId' => $this->ReportCategoryId]); } return $this->category; }
public function createCategory() { $this->load->model('entities/easol/Easol_ReportCategory'); $model = new Easol_ReportCategory(); if ($this->input->post('ReportCategory') && $model->populateForm($this->input->post('ReportCategory'))) { if ($model->save()) { $this->session->set_flashdata('message', 'Category : ' . $model->ReportCategoryName . ' Successfully added'); $this->session->set_flashdata('type', 'success'); return redirect(site_url("reports/create")); } } return $this->render("createcategory", ['model' => $model]); }
echo $model->ReportName; ?> " required> </div> </div> <div class="form-group"> <label for="ReportCategoryId" class="col-md-4 control-label"><?php echo $model->labels()['ReportCategoryId']; ?> </label> <div class="col-md-4"> <select class="form-control" id="ReportCategoryId" name="report[ReportCategoryId]"> <?php $this->load->model("entities/easol/Easol_ReportCategory", 'Easol_ReportCategory'); $reportCategories = new Easol_ReportCategory(); foreach ($reportCategories->findAll()->result() as $reportCategory) { ?> <option value="<?php echo $reportCategory->ReportCategoryId; ?> " <?php echo $model->ReportCategoryId == $reportCategory->ReportCategoryId ? "selected" : ""; ?> ><?php echo $reportCategory->ReportCategoryName; ?> </option> <?php } ?>