Beispiel #1
0
 public function index()
 {
     $this->getLayoutView()->set("seo", Framework\Registry::get("seo"));
     $view = $this->getActionView();
     $alltests = Test::all(array(), array("id", "title"));
     $view->set("alltests", $alltests);
 }
Beispiel #2
0
 public function showResults()
 {
     $data = array('title' => 'Resultados');
     $data['sports'] = Sport::all()->lists('description', 'idSport');
     $data['tests'] = Test::all()->lists('name', 'idTest');
     $data['cities'] = City::all()->lists('description', 'idCity');
     return View::make('results', $data);
 }
 function get_listall()
 {
     $result = array();
     #$sql = Test::find('all');
     $sql = Test::all();
     foreach ($sql as $data) {
         array_push($result, $data->to_array());
         //using to_array instead of to_json
     }
     #echo json_encode($result);
     return '{"result": ' . json_encode($result) . '}';
 }
 public function getIndex()
 {
     $tests = Test::all();
     $this->layout->content = view::make('tests.index', compact('tests'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $tests = Test::all();
     return $this->respond($this->transformCollection($tests));
 }
 /**
  * Display a listing of the resource.
  * GET /tests
  *
  * @return Response
  */
 public function index()
 {
     $tests = Test::all();
     return View::make('tests.index', compact('tests'));
 }
Beispiel #7
0
 public function popularOffers()
 {
     $this->seo(array("title" => "Popular Offers", "view" => $this->getLayoutView()));
     $view = $this->getActionView();
     $organizations = Organization::all(array("live = ?" => true), array("id", "name"));
     $packages = Package::all(array(), array("title", "id"));
     $tests = Test::all(array(), array("title", "id"));
     $limit = RequestMethods::get("limit", 10);
     $page = RequestMethods::get("page", 1);
     $offers = Offer::all(array("live = ?" => 1), array("*"), "created", "desc", $limit, $page);
     $total = (int) Offer::count(array("live = ?" => 1));
     $results = array();
     foreach ($offers as $o) {
         $type = array();
         switch ($o->property) {
             case 'test':
                 $type['title'] = $tests[$o->property_id]->title;
                 $type['id'] = $o->property_id;
                 break;
             case 'package':
                 $type['title'] = $packages[$o->property_id]->title;
                 $type['id'] = $o->property_id;
                 break;
         }
         $data = array("id" => $o->id, "start" => StringMethods::datetime_to_text($o->start), "end" => StringMethods::datetime_to_text($o->end), "percent" => $o->percent, "type" => $o->property, "type_title" => $type['title'], "type_id" => $type['id'], "lab" => $organizations[$o->organization_id], "lab_id" => $o->organization_id);
         $results[] = ArrayMethods::toObject($data);
     }
     $view->set("offers", $results)->set("total", $total);
 }
Beispiel #8
0
 /**
  * @before _secure, _vendor
  */
 public function download()
 {
     $this->noview();
     $tests = Test::all(array("live = ?" => true), array("title"));
     $centres = Centre::all(array("organization_id = ?" => $this->organization->id), array("location_id"));
     $locations = array();
     foreach ($centres as $centre) {
         $loc = Location::first(array("id = ?" => $centre->location_id), array("city"));
         array_push($locations, $loc->city);
     }
     header('Content-Type: text/csv; charset=utf-8');
     header('Content-Disposition: attachment; filename=medicaltests.csv');
     // create a file pointer connected to the output stream
     $output = fopen('php://output', 'w');
     $first = array("Medical Test");
     $locations = array_unique($locations);
     foreach ($locations as $location) {
         array_push($first, "Price at " . $location);
     }
     fputcsv($output, $first);
     foreach ($tests as $test) {
         $data = array();
         array_push($data, $test->title);
         foreach ($locations as $location) {
             array_push($data, "");
         }
         fputcsv($output, $data);
     }
 }
Beispiel #9
0
 public function modelTest()
 {
     $db = new Test();
     $result = $db->all();
     pad($result);
 }
Beispiel #10
0
     * Run All Tests
     */
    public function all()
    {
        foreach (scandir('tests') as $test) {
            if ($test[0] !== '.' && !is_dir($this->dir . '/tests/tests/' . $test)) {
                include "tests/{$test}";
                $class_name = 'Test_' . ucfirst(str_replace('.php', '', $test));
                $test_instance = new $class_name($this->dir);
                $test_instance->run();
            }
        }
    }
    public function destruct()
    {
        echo "Thankyou for choosing PHP-Payments! Please send questions, comments or donations (via PayPal) to calvinfroedge@gmail.com.  If you find a bug, please post it in the issues section of the Git repository: https://github.com/calvinfroedge/PHP-Payments  \n \n";
    }
}
$test = new Test();
//The 0th element is simply the filename.  Get rid of it and reindex the array.
unset($argv[0]);
$argv = array_values($argv);
if (empty($argv)) {
    $test->all();
} else {
    $test_name = $argv[0];
    //This should be the name of the test to run
    unset($argv[0]);
    $test->single($test_name, $argv);
    //Passing rest of the params to a specific test to set it's options (if any)
}