Exemple #1
0
 function check_suffix()
 {
     // result to return
     $result = new Result();
     $result->updateResult($this->check_suffix_with_casual_leave());
     if (!$result->getResult()) {
         return $result;
     }
     $result->updateResult($this->check_suffix_with_restricted_leave());
     if (!$result->getResult()) {
         return $result;
     }
     return $result;
 }
Exemple #2
0
 /**
  * @dataProvider resultThresholdProvider
  */
 public function testGetResultThreshold($pos, $neg, $expected)
 {
     $result = new Result('Test Sample', $pos, $neg);
     $this->assertEquals($expected, $result->getResult());
 }
Exemple #3
0
 /**
  * This function evaluates emptiness of fields
  * @return \Result
  */
 function is_required_data_filled()
 {
     $result = new Result();
     // check for leave type
     if ($_POST[Leave_application::LEAVE_TYPE] == Leave_application::EMPTY_VAL) {
         $result->setResult(FALSE);
         $result->addError("Please select type of leave.");
     }
     // check for leave start date
     if (empty($_POST[Leave_application::LEAVE_START_DATE])) {
         $result->setResult(FALSE);
         $result->addError("Please select start date.");
     }
     // if leave is not of restricted type check for end date
     if ($_POST[Leave_application::LEAVE_TYPE] != Leave_constants::$TYPE_RESTRICTED_LEAVE) {
         // check for leave end date
         if (empty($_POST[Leave_application::LEAVE_END_DATE])) {
             $result->setResult(FALSE);
             $result->addError("Please select end date.");
         }
     }
     // check for casual leave extra data if start date == end date
     if ($_POST[Leave_application::LEAVE_TYPE] === Leave_constants::$TYPE_CASUAL_LEAVE && $_POST[Leave_application::LEAVE_START_DATE] === $_POST[Leave_application::LEAVE_END_DATE] && $result->getResult()) {
         // check if half or full is marked
         if ($_POST[Leave_application::LEAVE_CASUAL_PERIOD] == Leave_application::EMPTY_VAL) {
             $result->setResult(FALSE);
             $result->addError("For casual leave of single day, please specify period half or full");
         } else {
             if ($_POST[Leave_application::LEAVE_CASUAL_PERIOD] == Leave_application::LEAVE_PERIOD_HALF && $_POST[Leave_application::LEAVE_J_NOON] == Leave_application::EMPTY_VAL) {
                 $result->setResult(FALSE);
                 $result->addError("Please select in which half you want to take leave, before noon or after noon");
             }
         }
     }
     // check for purpose
     if (empty($_POST[Leave_application::LEAVE_PURPOSE])) {
         $result->setResult(FALSE);
         $result->addError("Please mention purpose.");
     }
     return $result;
 }
Exemple #4
0
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
        curl_setopt($ch, CURLOPT_USERAGENT, 'Flower-Color-Test-App');
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $response = curl_exec($ch);
        curl_close($ch);
        # Parsing the response
        $decoded = json_decode($response, TRUE);
        $gistlink = $decoded['html_url'];
        die(json_encode(array('success' => true, 'hash' => str_replace('https://gist.github.com/', '', $gistlink))));
    }
}
$result = new Result();
if (isset($_GET['TxtFunc'])) {
    switch ($_GET['TxtFunc']) {
        case 'get':
            $resultId = isset($_GET['TxtID']) ? $_GET['TxtID'] : null;
            if ($resultId === NULL) {
                die(json_decode(array('result' => false, 'message' => 'Please provide result id.')));
            }
            $result->getResult($resultId);
            break;
        case 'save':
            $resultData = isset($_GET['TxtData']) ? $_GET['TxtData'] : null;
            if ($resultData === NULL) {
                die(json_decode(array('result' => false, 'message' => 'Please provide result data.')));
            }
            $result->saveResult($resultData);
            break;
    }
}
Exemple #5
0
 public static function go($queryString, $obj = NULL)
 {
     $api = new Result($queryString, $obj);
     //----------------------------------------------------------
     return $api->count ? $api->countResult() : $api->getResult();
 }
Exemple #6
0
 /**
  * This test checks a that the resolved result is NULL.
  *
  * @return void
  */
 public function testGetResultWithoutValue()
 {
     $annotation = new Result('Result', array());
     $this->assertNull($annotation->getResult());
 }