Exemplo n.º 1
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);
 }
Exemplo n.º 2
0
}));
Route::get('plea/add', array('as' => 'pleaadd', 'uses' => 'PleaController@add'));
Route::post('plea/add', array('before' => 'csrf', 'uses' => 'PleaController@add'));
Route::get('plea/{id}', array('as' => 'pleadetail', 'uses' => 'PleaController@showDetail'));
Route::get('plea/{id}/edit', array('as' => 'pleaedit', 'uses' => 'PleaController@edit'));
Route::post('plea/{id}/reject', array('as' => 'pleareject', 'uses' => 'PleaController@reject'));
Route::post('plea/{id}/edit', array('before' => 'csrf', 'uses' => 'PleaController@edit'));
Route::get('pleas/by/user/{user_id}', array('as' => 'pleasbyuser', 'uses' => 'PleaController@showPleasByUser'));
// PLEDGES ROUTES
//Route::get('pledge/add', array('as'=>'pledgeadd', 'uses'=>'PledgeController@add'));
Route::post('pledge/add', array('before' => 'csrf', 'uses' => 'PledgeController@add'));
Route::get('pledges/by/user/{user_id}', array('as' => 'pledgesbyuser', 'uses' => 'PledgeController@showPledgesByUser'));
Route::get('pledges/by/plea/{plea_id}', array('as' => 'pledgesbyplea', 'uses' => 'PledgeController@showPledgesByPlea'));
// OFFER ROUTES
Route::get('offers', function () {
    return View::make('default', array('objects' => Offer::all(), 'class' => 'Offer'));
});
Route::get('offer/add', array('as' => 'addoffer', 'uses' => 'OfferController@add'));
Route::post('offer/add', array('before' => 'csrf', 'uses' => 'OfferController@add'));
Route::get('offer/{id}', 'OfferController@showDetail');
Route::get('offer/{id}/edit', 'OfferController@edit');
Route::post('offer/{id}/edit', array('before' => 'csrf', 'uses' => 'OfferController@edit'));
// COMMENTS ROUTES
Route::post('comment/add', array('before' => 'csrf', 'uses' => 'CommentController@add'));
// ADMIN/MODERATION PAGE
Route::get('admin', function () {
    return View::make('admin');
});
// PASSWORD VIEWS
Route::get('password/forgot', array('as' => 'forgot', 'uses' => 'UserController@doForgotForm'));
Route::post('password/forgot', array('before' => 'csrf', function () {