本文整理汇总了PHP中Result类的典型用法代码示例。如果您正苦于以下问题:PHP Result类的具体用法?PHP Result怎么用?PHP Result使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Result类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get_calendar
public function get_calendar()
{
$date_start = date('Y-m-d', $_GET['start']);
$date_end = date('Y-m-d', $_GET['end']);
$variable = new Result();
$variable->get();
$day = 24 * 60 * 60 * 1000;
foreach ($variable as $key => $value) {
$title = null;
$color = null;
switch ($value->result_type_id) {
case 1:
$title = "รายสัปดาห์";
$color = "#337AB7";
break;
case 2:
$title = "รายเดือน";
$color = "#f0AD4E";
break;
default:
$title = "รายวัน";
$color = "#5cb85c";
break;
}
$data_[] = array("title" => $value->title, "start" => date("Y-m-d", strtotime($value->import_time)), "url" => "reports/views/" . $value->id, "color" => $color);
}
echo json_encode(@$data_);
}
开发者ID:ultraauchz,项目名称:asean_cultural_mapping,代码行数:28,代码来源:reports.php
示例2: __get
/** Get referenced row
* @param string
* @return NotORM_Row or null if the row does not exist
*/
function __get($name)
{
$this->result->notORM->__updateRowClass($name);
$column = $this->result->notORM->structure->getReferencedColumn($name, $this->result->table);
$referenced =& $this->result->referenced[$name];
if (!isset($referenced)) {
$keys = array();
foreach ($this->result->rows as $row) {
if ($row[$column] !== null) {
$keys[$row[$column]] = null;
}
}
if ($keys) {
$table = $this->result->notORM->structure->getReferencedTable($name, $this->result->table);
$referenced = new Result($table, $this->result->notORM);
$referenced->where("{$table}." . $this->result->notORM->structure->getPrimary($table), array_keys($keys));
} else {
$referenced = array();
}
}
if (!isset($referenced[$this[$column]])) {
// referenced row may not exist
return null;
}
return $referenced[$this[$column]];
}
开发者ID:mnohosten,项目名称:yesorm,代码行数:30,代码来源:Row.php
示例3: __construct
/**
* Constructor
* Use $db->createResult( $parent, $name ) instead
*
* @param Database|Result|Row $parent
* @param string $name
*/
function __construct($parent, $name)
{
if ($parent instanceof Database) {
// basic result
$this->db = $parent;
$this->table = $this->db->getAlias($name);
} else {
// Row or Result
// result referenced to parent
$this->parent_ = $parent;
$this->db = $parent->getDatabase();
// determine type of reference based on conventions and user hints
$fullName = $name;
$name = preg_replace('/List$/', '', $fullName);
$this->table = $this->db->getAlias($name);
$this->single = $name === $fullName;
if ($this->single) {
$this->key = $this->db->getPrimary($this->getTable());
$this->parentKey = $this->db->getReference($parent->getTable(), $name);
} else {
$this->key = $this->db->getBackReference($parent->getTable(), $name);
$this->parentKey = $this->db->getPrimary($parent->getTable());
}
}
}
开发者ID:morris,项目名称:lessql,代码行数:32,代码来源:Result.php
示例4: app_choice
function app_choice()
{
// Accessing the result object
$result = new Result();
$choice = $result->getValue();
// Create a new instance of the Tropo object.
$tropo = new Tropo();
// Provide a prompt based on the value
if ($choice == "1") {
$tropo->say("You picked Lord of the Rings. Did you know Gandalf is also Mag knee toe? Weird.");
}
if ($choice == "2") {
$tropo->say("You picked the original Star Wars. I hear Leonard Nimoy was awe some in those.");
}
if ($choice == "3") {
$tropo->say("You picked the Star Wars prequels. Stop calling this number, Mr. Lucas, we know it's you.");
}
if ($choice == "4") {
$tropo->say("You picked the Matrix. Dude, woe.");
}
// Tell Tropo what to do next. This redirects to the instructions under dispatch_post('/hangup', 'app_hangup').
$tropo->on(array("event" => "continue", "next" => "favorite-movie-webapi.php?uri=hangup"));
// Tell Tropo what to do if there's an problem, like a timeout. This redirects to the instructions under dispatch_post('/incomplete', 'app_incomplete').
$tropo->on(array("event" => "incomplete", "next" => "favorite-movie-webapi.php?uri=incomplete"));
// Render the JSON for the Tropo WebAPI to consume.
return $tropo->RenderJson();
}
开发者ID:MeiTen,项目名称:tropo-webapi-php,代码行数:27,代码来源:favorite-movie-webapi.php
示例5: createResult
/**
* @param string $status
* @param string $message
* @return Result
*/
public function createResult($status = Result::STATUS_OK, $message = '')
{
$result = new Result($status, $message);
$result->setResultGroup($this->_resultGroup);
$this->addResult($result);
return $result;
}
开发者ID:lslab,项目名称:n98-magerun,代码行数:12,代码来源:ResultCollection.php
示例6: run
public function run(Result $result, $offset)
{
$result->addError($offset);
$result->addSuccesses(15);
$result->addFailures(10);
return $result;
}
开发者ID:elgg,项目名称:elgg,代码行数:7,代码来源:TestBatch.php
示例7: app_continue
function app_continue()
{
$tropo = new Tropo();
@($result = new Result());
$userType = $result->getUserType();
$tropo->say("You are a {$userType}");
$tropo->RenderJson();
}
开发者ID:MeiTen,项目名称:tropo-webapi-php,代码行数:8,代码来源:callMachineDetection.php
示例8: isValid
public function isValid($value)
{
$result = new Result(["value" => true]);
if (!($value === $this->compare && !$value instanceof \DateTime) && !($value instanceof \DateTime && $this->compare instanceof \DateTime && $value == $this->compare)) {
$result->setValue(false);
$result->addMessage('equal');
}
return $result;
}
开发者ID:zoopcommerce,项目名称:mystique-php,代码行数:9,代码来源:Equal.php
示例9: isValid
public function isValid($value)
{
$result = new Result(["value" => true]);
if (!is_numeric($value)) {
$result->setValue(false);
$result->addMessage('float');
}
return $result;
}
开发者ID:zoopcommerce,项目名称:mystique-php,代码行数:9,代码来源:Float.php
示例10: voice_continue
public function voice_continue()
{
$this->set_output_mode(MY_Controller::OUTPUT_NORMAL);
$tropo = new Tropo();
@($result = new Result());
$answer = $result->getValue();
$tropo->say("You said " . $answer);
$tropo->RenderJson();
}
开发者ID:anupkelkar02,项目名称:FSM,代码行数:9,代码来源:tropo_api.php
示例11: isValid
public function isValid($value)
{
$result = new Result(["value" => true]);
if ($value !== true && $value !== false) {
$result->setValue(false);
$result->addMessage('boolean');
}
return $result;
}
开发者ID:zoopcommerce,项目名称:mystique-php,代码行数:9,代码来源:Boolean.php
示例12: isValid
public function isValid($value)
{
$result = new Result(["value" => true]);
if (!is_string($value)) {
$result->setValue(false);
$result->addMessage('string');
}
return $result;
}
开发者ID:zoopcommerce,项目名称:mystique-php,代码行数:9,代码来源:String.php
示例13: isValid
public function isValid($value)
{
$result = new Result(["value" => true]);
if (!preg_match('/' . $this->regex . '/', $value)) {
$result->setValue(false);
$result->addMessage(['regex', $this->regex]);
}
return $result;
}
开发者ID:zoopcommerce,项目名称:mystique-php,代码行数:9,代码来源:Regex.php
示例14: isValid
public function isValid($value)
{
$result = new Result(["value" => true]);
if (!preg_match($this->regex, $value)) {
$result->setValue(false);
$result->addMessage('alpha');
}
return $result;
}
开发者ID:zoopcommerce,项目名称:mystique-php,代码行数:9,代码来源:Email.php
示例15: validate_cancel_input
function validate_cancel_input()
{
$result = new Result();
if (!isset($_POST['leave_to_cancel']) || empty($_POST['leave_to_cancel'])) {
$result->setResult(FALSE);
$result->addError("Please select leave to cancel");
}
return $result;
}
开发者ID:pkdism,项目名称:ISM-MIS,代码行数:9,代码来源:leave_cancel.php
示例16: isValid
public function isValid($value)
{
$result = new Result(["value" => true]);
if (!($value < $this->compare)) {
$result->setValue(false);
$result->addMessage('lessThan');
}
return $result;
}
开发者ID:zoopcommerce,项目名称:mystique-php,代码行数:9,代码来源:LessThan.php
示例17: isValid
public function isValid($value)
{
$result = new Result(["value" => true]);
if (!$value instanceof \DateTime) {
$result->setValue(false);
$result->addMessage('date');
}
return $result;
}
开发者ID:zoopcommerce,项目名称:mystique-php,代码行数:9,代码来源:Date.php
示例18: testContentIsGenerator
public function testContentIsGenerator()
{
$data = $this->mock_gen();
$r = new Result($data, 'json', ['header_func' => function ($h) use(&$header) {
$header = $h;
}]);
$expected = json_encode([["id" => 0], ["id" => 1], ["id" => 2]]);
$result = $r->render();
$this->assertEquals($expected, $result);
}
开发者ID:alkemann,项目名称:h2l,代码行数:10,代码来源:ResultTest.php
示例19: isRecordExists
/**
* 查看一条记录是否在结果集中存在
* @param Result $record
* @return boolean
*/
public function isRecordExists($record)
{
foreach ($this->resArr as $value) {
$value_record = $value->getRecord();
if ($value_record == $record->getRecord()) {
return true;
}
}
return false;
}
开发者ID:getcode2git,项目名称:phpvulhunter,代码行数:15,代码来源:ResultContext.class.php
示例20: isValid
public function isValid($value)
{
$result = new Result(["value" => true]);
$length = strlen($value);
if ($length < $this->min || $length > $this->max) {
$result->setValue(false);
$result->addMessage(['length', $this->min, $this->max]);
}
return $result;
}
开发者ID:zoopcommerce,项目名称:mystique-php,代码行数:10,代码来源:Length.php
注:本文中的Result类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论