/** * Convert request to data result * * @access public * @fixme Authentication / request validation * @return void */ public function get($forecast = false, $data = false) { $validRequest = $this->_validateRequest() !== False; $validAuth = $this->_validateAuth() !== False; $post = $data !== false ? $data : $this->input->post(); $post["download"] = false; if (isset($post["region"])) { $post["multiple"] = true; } else { $post["multiple"] = false; } if ($validRequest && $validAuth) { $source = new Source($post); $res = $source->get($this->_user); if ($forecast != false) { if ($this->_user) { $result = $source->gatherForecast($this->_user); if (isset($result[0])) { array_push($res, $result[0]); } } } echo json_encode($res); } else { http_response_code(400); echo json_encode(["message" => $this->_message]); } exit; }
<?php /** * Remove from LOC all the lexems which * - are associated with definitions from DN or MDN, and * - are not associated with definitions from DEX (all editions), DEX-S, DMLR, DLRM, DOOM or DOOM-2, and * - are not infinitives or participles of lexems in the above sources. **/ require_once '../phplib/util.php'; $goodSourceIds = array(Source::get("shortName = \"DEX '75\"")->id, Source::get("shortName = \"DEX '84\"")->id, Source::get("shortName = \"DEX '96\"")->id, Source::get("shortName = \"DEX '98\"")->id, Source::get("shortName = \"DEX '09\"")->id, Source::get("shortName = 'DEX-S'")->id, Source::get("shortName = 'DMLR'")->id, Source::get("shortName = 'DLRM'")->id, Source::get("shortName = 'DOOM'")->id, Source::get("shortName = 'DOOM 2'")->id); // Select all the LOC lexems associated with definitions from DN / MDN. // Process verbs first because we will need to look at their participles / long infinitives later. $query = "select * from Lexem where isLoc order by Lexem.modelType in ('V', 'VT') desc, Lexem.formNoAccent"; $dbResult = db_execute($query); while (!$dbResult->EOF) { $l = new Lexem(); $l->set($dbResult->fields); $dbResult->MoveNext(); $definitions = Definition::loadByLexemId($l->id); $hasGoodSourceIds = false; $i = 0; while ($i < count($definitions) && !$hasGoodSourceIds) { $hasGoodSourceIds = in_array($definitions[$i]->sourceId, $goodSourceIds); $i++; } if (!$hasGoodSourceIds) { $isDerivative = false; // Check if the lexem is a long infinitive or a participle $verbQuery = "select distinct Lexem.* from Lexem, InflectedForm where Lexem.id = InflectedForm.lexemId and Lexem.isLoc " . "and InflectedForm.formNoAccent = '{$l->formNoAccent}' and InflectedForm.inflectionId in (50, 52)"; $verbs = db_getObjects(new Lexem(), db_execute($verbQuery)); if (count($verbs) && $l->modelType == 'F' && ($l->modelNumber == '107' || $l->modelNumber == '113')) {
/** * @access protected * @param Station $station * @param Array $data * @return void */ protected function _debug(Station $station, $data) { require APPPATH . "models/Sources/Measurements.php"; $measurements = new Measurements(); $columns = $measurements->_default_columns; $final = []; $data['station'] = $station->getId(); $data['multiple'] = false; $data['download'] = false; foreach ($columns as $column => $value) { $data['measurement'] = $value['name']; $source = new Source($data); $res = $source->get(); if (isset($res[0]['data'])) { $result[$value["name"]] = count($res[0]['data']); } else { $result[$value["name"]] = 0; } } $region = (new Region())->findById($station->getRegionId()); $final['rows'] = json_encode($result); $final['station'] = $station->getName(); $final['region'] = $region->getName(); $final['created'] = (new DateTime())->format("Y-m-d H:i:s"); $this->_addContent($station->getId(), $final); }