예제 #1
0
 /**
  * Apply filter settings to the source
  *
  * @param array $settings
  */
 protected function processFilters(array $settings = [])
 {
     foreach ($settings['filters'] as $column => $filter) {
         switch (key($filter)) {
             case Grid\Grid::FILTER_EQ:
                 $this->source->equalTo($column, reset($filter));
                 break;
             case Grid\Grid::FILTER_LIKE:
                 $this->source->startsWith($column, reset($filter));
                 break;
             default:
                 // throw NotImplemented?
                 break;
         }
     }
 }
예제 #2
0
function getNumOfSleepers()
{
    $query = new ParseQuery("BagTransaction");
    $query->startsWith("status", "active");
    $results = $query->find();
    $count = count($results);
    return $count;
}
예제 #3
0
 public function testQueryDataUnt()
 {
     $department = "ACCT";
     $course = "2010";
     $section = "001";
     $obj = ParseObject::create('TestObject');
     $obj->set('department', $department);
     $obj->set('course', $course);
     $obj->set('section', $section);
     $obj->save();
     $query = new ParseQuery('TestObject');
     $query->startsWith('department', $department);
     $query->equalTo('course', $course);
     $query->startsWith('section', $section);
     $query->limit(1);
     $response = $query->find();
     $this->assertTrue(count($response) == 1);
 }
예제 #4
0
 public function ventasDiaTotales($fecha)
 {
     $query = new ParseQuery("facturas");
     $query->startsWith("fecha", $fecha);
     $results = $query->find();
     $data['facturas'] = '';
     //print_r($results[0]->folio);
     foreach ($results as $record) {
         echo $record->serie . $record->folio;
     }
     $this->load->view('reportes/ventas_dia', $data);
 }
예제 #5
0
function queryDataUnt($department, $course, $section = "001")
{
    $query = new ParseQuery("Book");
    $query->startsWith("department", $department);
    $query->equalTo("course", $course);
    //$query->startsWith("section", $section);
    $query->limit(1);
    try {
        $result = $query->find();
        if (isset($result[0])) {
            $object = $result[0];
            $GLOBALS['isbn'] = $object->get("isbn");
            $GLOBALS['name'] = $object->get("name");
            $GLOBALS['priceNewUnt'] = $object->get("priceNew");
        }
    } catch (ParseException $ex) {
        echo "Book not found in database.";
    }
}
예제 #6
0
 public function testStartsWith()
 {
     $someAscii = "\\E' !\"#\$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTU" . "VWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~'";
     $prefixes = ['zax', 'start', '', ''];
     $suffixes = ['qub', '', 'end', ''];
     $this->saveObjects(4, function ($i) use($prefixes, $suffixes, $someAscii) {
         $obj = ParseObject::create("TestObject");
         $obj->set("myString", $prefixes[$i] . $someAscii . $suffixes[$i]);
         return $obj;
     });
     $query = new ParseQuery("TestObject");
     $query->startsWith("myString", $someAscii);
     $results = $query->find();
     $this->assertEquals(2, count($results), 'Did not return correct number of objects.');
 }