public static function createConfigurationTable() { $configTable = new Configuration(); $configTable->configuration_name = Input::get('configuration_name'); $configTable->status = 'Active'; $configTable->save(); return $configTable->config_id; }
public static function takeValue($key) { $data = \App\Models\Configuration::where('key', $key); if ($data->count() < 1) { return ""; } return $data->first()->value; }
/** * @param Request $request * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View */ public function showAction(Request $request) { $configuration = $this->repository->findFirst(); if (!$configuration) { $data = ['send_email_process' => '1']; $data['url_form'] = Configuration::URL_FORM; $configuration = Configuration::firstOrCreate($data); } return view('configuration.form', ['configuration' => $configuration, 'password' => strlen($configuration->password) ? Crypt::decrypt($configuration->password) : $configuration->password, 'choices' => Configuration::$selectChoices]); }
public function postIndex(FormConfigurationRequest $request) { if (!empty($request)) { $dataConfiguration = $request->all(); if ($request->id) { $obj = Configuration::find($request->id); $obj->update($dataConfiguration); } return redirect('admpanel/' . self::NAMEC)->with('messageSuccess', 'Caracteristicas Guardado'); } return redirect('admpanel')->with('messageError', 'Error al guardar la configuraciĆ³n'); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Configuration::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, 'attach_size' => $this->attach_size, 'create_time' => $this->create_time, 'update_time' => $this->update_time]); $query->andFilterWhere(['like', 'web_name', $this->web_name])->andFilterWhere(['like', 'contact_email', $this->contact_email])->andFilterWhere(['like', 'keyword', $this->keyword])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'copyright', $this->copyright])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'contact_phone', $this->contact_phone])->andFilterWhere(['like', 'icp', $this->icp])->andFilterWhere(['like', 'create_user', $this->create_user])->andFilterWhere(['like', 'update_user', $this->update_user]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Configuration::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(['configuration_id' => $this->configuration_id, 'sort_order' => $this->sort_order, 'created' => $this->created, 'last_updated' => $this->last_updated, 'configuration_group_id' => $this->configuration_group_id]); $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'key', $this->key])->andFilterWhere(['like', 'value', $this->value])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'type', $this->type]); return $dataProvider; }
public function actionApplication() { $model = new Application(); $model_contacts[] = new ApplicationContact(); $model_jobs[] = new ApplicationJob(); $user = \Yii::$app->user->getIdentity(); if ($user != null && $user->getCompany()->one() == null) { $this->render('fair/application_fail', ['error' => Yii::t('app', 'Students can not sign up for a fair.')]); } elseif ($user != null) { $model->name = $user->name; $model->address = $user->address; $model->email = $user->email; $model->website = $user->getCompany()->one()->website; $model->info_email = $user->email; $model->contact_name = $user->getCompany()->one()->contact_name; $model->idCompany = $user->id; } $model->fair_number = Configuration::find()->where(['name' => 'fair_number'])->one()->value; return $this->render('application', ['model' => $model, 'model_contacts' => $model_contacts, 'model_jobs' => $model_jobs]); }
public function get($key, $default = null) { # SEARCH FROM AUTOLOADED CONFIG if (isset($this->autoloaded[$key])) { if (empty($this->autoloaded[$key])) { return (string) $default; } else { return $this->autoloaded[$key]; } } else { $config = Configuration::find($key); if ($config) { if (empty($config->value)) { return (string) $default; } else { return (string) $config->value; } } } return ''; }
public function run() { Eloquent::unguard(); Configuration::create(['time_interval_id' => '2']); }
/** * Finds the Configuration model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Configuration the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Configuration::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function savereport() { Session::flush('reportSheetData'); $allfiles = Input::get('allfiles'); $allfiles = explode(',', $allfiles); // get config $config = Configuration::getById(Input::get('config_id')); // get config sheets $configSheets = ConfigurationSheet::getArrangedSheets($config->config_id); // create the report first $report = Reports::addNewReport(); foreach ($allfiles as $currentFile) { if ($currentFile != '') { // save file $reporfileData = array(); //$reporfileData['flag_current_version'] = 1; //$reporfileData['report_filename'] = $currentFile; $reporfileData['report_id'] = $report->report_id; $reportFile = ReportFile::addReportFile($reporfileData); // save file version $reportFileVersionData = array(); $reportFileVersionData['file_id'] = $reportFile->file_id; $reportFileVersionData['flag_current_version'] = 1; $reportFileVersionData['report_filename'] = $currentFile; $reportVersion = ReportFileVersion::addReportFileVersion($reportFileVersionData); // save each sheet $file = "uploads/{$currentFile}"; Excel::load($file, function ($reader) use($reportFile, $reportVersion, $config, $configSheets) { foreach ($reader->getWorksheetIterator() as $worksheetNbr => $worksheet) { //echo 'Worksheet number - ', $worksheetNbr, PHP_EOL; $currentWorksheet = $worksheetNbr + 1; if (isset($configSheets["sheet{$currentWorksheet}"])) { $currentConfig = $configSheets["sheet{$currentWorksheet}"]; // data table columns $data_table_columns = $worksheet->rangeToArray($currentConfig['data_table_columns']); $data_table_columns = json_encode($data_table_columns); // data table //$data_table = $worksheet->rangeToArray($currentConfig['data_table']); $data_table = $worksheet->rangeToArray($currentConfig['data_table'], false, true, true, true); Reports::prepareFileSheetSession($data_table); $data_table = json_encode($data_table); // excel info if ($currentConfig['configuration_string'] != '') { $config_string = json_decode($currentConfig['configuration_string']); $new_config_string = array(); for ($i = 0; $i < count($config_string); $i++) { $currentCell = $worksheet->getCell("{$config_string[$i]->column}{$config_string[$i]->row}")->getValue(); $currentCellColor = $worksheet->getStyle("{$config_string[$i]->column}{$config_string[$i]->row}")->getFill()->getStartColor()->getARGB(); $new_config_string[$i] = $config_string[$i]; $new_config_string[$i]->cell_value = $currentCell; $new_config_string[$i]->cell_color = $currentCellColor; } $new_config_string = json_encode($new_config_string); } else { $new_config_string = ''; } // insert sheet $reportSheetData = array(); $reportSheetData['version_id'] = $reportVersion->version_id; $reportSheetData['worksheet_number'] = $worksheetNbr; $reportSheetData['data_table'] = $data_table; $reportSheetData['data_table_columns'] = $data_table_columns; $reportSheetData['excel_info'] = $new_config_string; ReportFileSheets::addReportFileSheet($reportSheetData); } } }); } } // get previous incident's data $previousIncidentData = Reports::getPreviousIncidentData(); // get current incident's data $reportSheets = Reports::retrieveFileSheetSession(); $newIncidenData = Reports::rearrangeSheetSession($reportSheets); $incidentComparison = Reports::compareIncidentData($previousIncidentData, $newIncidenData); if (count($incidentComparison) > 0) { Session::put('incidentReportErrors' . $report->report_id, $incidentComparison); /*$sessionErrors = Session::get('reportSheetData'); exit;*/ Session::flash('incident_warning', 'There are errors in your report. Please see below.'); return Redirect::to('reports/view1/' . $report->report_id); } else { Session::flash('success', 'Your report(s) has been successfully added.'); return Redirect::to('reports/list'); } exit; Session::flash('success', 'Your report(s) has been successfully added.'); return Redirect::to('reports/list'); }
/** * "Delete" Record * * @return Response */ public function delete($id = 0) { Configuration::deleteRecord($id); // redirect Session::flash('success', 'You have successfully deleted the record.'); return Redirect::to('configuration/list'); }
public function dataPremium($idPost) { $modelAds = new PuAds(); $modelTypeAds = new PuTypes(); $modelConfig = \App\Models\Configuration::whereFlagactive(1)->first(); $dataComentario = $modelAds->getAdsType($idPost, 2); $dataLike = $modelAds->getAdsType($idPost, 1); if ($dataComentario->comentario >= $modelConfig->limit_datear || $dataLike->likes >= $modelConfig->limit_buen_dato) { $type = $modelTypeAds->getIdPuType(PuTypes::TYPE_POPULAR); } else { $type = $modelTypeAds->getIdPuType(PuTypes::TYPE_COMUN); } return $type; }