本文整理汇总了PHP中Source::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Source::get方法的具体用法?PHP Source::get怎么用?PHP Source::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Source
的用法示例。
在下文中一共展示了Source::get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
/**
* 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;
}
示例2: array
<?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')) {
示例3: _debug
/**
* @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);
}