本文整理汇总了PHP中Result类的典型用法代码示例。如果您正苦于以下问题:PHP Result类的具体用法?PHP Result怎么用?PHP Result使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Result类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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_);
}
示例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]];
}
示例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());
}
}
}
示例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();
}
示例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;
}
示例6: run
public function run(Result $result, $offset)
{
$result->addError($offset);
$result->addSuccesses(15);
$result->addFailures(10);
return $result;
}
示例7: app_continue
function app_continue()
{
$tropo = new Tropo();
@($result = new Result());
$userType = $result->getUserType();
$tropo->say("You are a {$userType}");
$tropo->RenderJson();
}
示例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;
}
示例9: isValid
public function isValid($value)
{
$result = new Result(["value" => true]);
if (!is_numeric($value)) {
$result->setValue(false);
$result->addMessage('float');
}
return $result;
}
示例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();
}
示例11: isValid
public function isValid($value)
{
$result = new Result(["value" => true]);
if ($value !== true && $value !== false) {
$result->setValue(false);
$result->addMessage('boolean');
}
return $result;
}
示例12: isValid
public function isValid($value)
{
$result = new Result(["value" => true]);
if (!is_string($value)) {
$result->setValue(false);
$result->addMessage('string');
}
return $result;
}
示例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;
}
示例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;
}
示例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;
}