Exemplo n.º 1
0
 public function getSourceClaimer()
 {
     if ($this->match_army_update) {
         return ArmyUpdates::find($this->match_table_id)->getClaimer();
     }
     if ($this->match_found_person) {
         return FoundPeople::find($this->match_table_id)->getClaimer();
     }
 }
Exemplo n.º 2
0
 private function doClaim($is_duplicate)
 {
     $claim_match_id = Input::get('match-id');
     Log::info("======[claim_match_id]======");
     Log::info($claim_match_id);
     Log::info(Input::all());
     $match = Match::find($claim_match_id);
     $fip = FindPeople::find($match->fip_id);
     // MARK match as claimed and FIP as found
     $match->claimed = true;
     $match->save();
     $fip->found = true;
     $fip->duplicate = $is_duplicate;
     if ($match->match_army_update) {
         $fip->found_in_army_updates = true;
         $au = ArmyUpdates::find($match->match_table_id);
         $au->claimed = true;
         $au->save();
         // not deleting. allowing duplicate claims instead
         //Match::where('match_table_id', '=', $au->id)->delete();
     }
     if ($match->match_found_person) {
         $fip->found_in_found_people = true;
         $fop = FoundPeople::find($match->match_table_id);
         $fop->claimed = true;
         $fop->save();
         //Match::where('match_table_id', '=', $fop->id)->delete();
     }
     $fip->found_table_id = $match->match_table_id;
     $fip->save();
     Match::deleteMatchesForFip($fip->id);
     // TODO : also send back the id in the table it was matched to
     // Turn into Found
     $response = array('status' => 'success', 'fip-id' => $fip->id);
     return Response::json($response);
 }
 public function edit()
 {
     $fop_id = Input::get('fop-id');
     Log::info("===========================in FoundPeopleController EDIT [fop_id] is =>");
     Log::info($fop_id);
     $fop = FoundPeople::find($fop_id);
     // Storing the image
     $image_file = Input::file('fop-photo-file');
     if ($image_file) {
         $image_file_name = 'FOP_id_' . $fop_id . '.' . $image_file->guessClientExtension();
         $image_file_location = 'images/FOP_photos/';
         $image_file->move($image_file_location, $image_file_name);
         if ($fop->photo_url) {
             // delete old upload
             unlink(app_path() . '/../public' . $fop->photo_url);
         }
         $fop->photo_url = '/' . $image_file_location . $image_file_name;
     }
     $fop->description = Input::get('fop-desc');
     $fop->save();
     return Redirect::route('found.person.show', $fop_id);
 }
Exemplo n.º 4
0
    return View::make('find_person/edit', ['fip' => $fip]);
}))->before('auth');
Route::post('findperson/edit/{id}', array('as' => 'find.person.edit', 'uses' => 'FindPeopleController@edit'))->before('auth');
Route::get('findperson/show/{id}', array('as' => 'find.person.show', 'uses' => function ($id) {
    $fip = FindPeople::find($id);
    $looker = $fip->getLooker();
    return View::make('find_person/show', ['fip' => $fip, 'looker' => $looker]);
}));
Route::post('/found', array('as' => 'found.people.create', 'uses' => 'FoundPeopleController@create'));
Route::get('foundperson/show/{id}', array('as' => 'found.person.show', 'uses' => function ($id) {
    $fop = FoundPeople::find($id);
    $finder = $fop->getFinder();
    return View::make('found_person/show', ['fop' => $fop, 'finder' => $finder]);
}));
Route::get('foundperson/edit/{id}', array('as' => 'found.person.edit', 'uses' => function ($id) {
    $fop = FoundPeople::find($id);
    return View::make('found_person/edit', ['fop' => $fop]);
}))->before('auth');
Route::post('foundperson/edit/{id}', array('as' => 'found.person.edit', 'uses' => 'FoundPeopleController@edit'))->before('auth');
Route::post('deletefop', array('as' => 'found.people.delete', 'uses' => 'FoundPeopleController@delete'))->before('auth');
Route::get('AUdata', array('as' => 'au.data', 'uses' => function () {
    return Response::json(ArmyUpdates::all(array('first_name', 'age')));
}));
Route::get('/updates', array('as' => 'updates', 'uses' => function () {
    $army_updates_pag = ArmyUpdates::orderBy('s_no', 'asc')->paginate(ArmyUpdates::SHOW_PER_PAGE);
    return View::make('armyupdates', ['army_updates_pag' => $army_updates_pag]);
}));
Route::post('/updates', array('as' => 'army.updates.search', 'uses' => 'ArmyUpdatesController@search'));
Route::get('/contributors', array('as' => 'contributors', 'uses' => function () {
    $cu_list = User::where('contributor', true)->get()->sortByDesc('contributed');
    return View::make('contributors', ['contributor_users_list' => $cu_list]);