forked from egbot/Symbiota
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from BioKIC/master
code update
- Loading branch information
Showing
96 changed files
with
3,139 additions
and
1,249 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
namespace App\Http\Controllers; | ||
|
||
use App\Models\Inventory; | ||
use App\Models\Media; | ||
use App\Models\TaxonomyDescription; | ||
use App\Models\TaxonomyDescriptionStatement; | ||
use Illuminate\Http\Request; | ||
|
||
class InventoryPackageController extends InventoryController{ | ||
/** | ||
* Inventory package controller instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct(){ | ||
} | ||
|
||
public function oneInventoryDataPackage($id, Request $request){ | ||
$this->validate($request, [ | ||
'includeDescriptions' => 'integer', | ||
'descriptionLimit' => 'integer', | ||
'includeImages' => 'integer', | ||
'imageLimit' => 'integer' | ||
]); | ||
$includeDescriptions = $request->input('includeDescriptions', 0); | ||
$descriptionLimit = $request->input('descriptionLimit', 1); | ||
$includeImages = $request->input('includeImages', 0); | ||
$imageLimit = $request->input('imageLimit', 3); | ||
|
||
$id = $this->getClid($id); | ||
$inventoryObj = Inventory::find($id); | ||
$inventoryObj->taxa; | ||
foreach($inventoryObj->taxa as $taxaObj){ | ||
if($includeImages) $taxaObj->media = Media::where('tid', $taxaObj->tid)->orderBy('sortSequence')->take($imageLimit)->get(); | ||
if($includeDescriptions){ | ||
$description = TaxonomyDescription::where('tid', $taxaObj->tid)->orderBy('displayLevel')->take($descriptionLimit)->get(); | ||
foreach($description as $descrObj){ | ||
$descrObj->statements = TaxonomyDescriptionStatement::where('tdbid', $descrObj->tdbid)->get(); | ||
} | ||
$taxaObj->textDescription = $description; | ||
} | ||
|
||
} | ||
$result = $inventoryObj; | ||
if(!$result->count()) $result = ['status' =>false, 'error' => 'Unable to locate inventory based on identifier']; | ||
|
||
return response()->json($result); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
namespace App\Http\Controllers; | ||
|
||
use App\Models\MorphologyCharacter; | ||
use App\Models\PortalIndex; | ||
use Illuminate\Http\Request; | ||
|
||
class MorphologyController extends Controller{ | ||
/** | ||
* Taxon Morphology controller instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct(){ | ||
} | ||
|
||
public function showAllCharacters(Request $request){ | ||
$this->validate($request, [ | ||
'limit' => 'integer', | ||
'offset' => 'integer' | ||
]); | ||
$limit = $request->input('limit',100); | ||
$offset = $request->input('offset',0); | ||
|
||
$fullCnt = PortalIndex::count(); | ||
$result = PortalIndex::skip($offset)->take($limit)->get(); | ||
|
||
$eor = false; | ||
$retObj = [ | ||
"offset" => (int)$offset, | ||
"limit" => (int)$limit, | ||
"endOfRecords" => $eor, | ||
"count" => $fullCnt, | ||
"results" => $result | ||
]; | ||
return response()->json($retObj); | ||
} | ||
|
||
public function showOneCharacter($id, Request $request){ | ||
$portalObj = null; | ||
if(is_numeric($id)) $portalObj = PortalIndex::find($id); | ||
else $portalObj = PortalIndex::where('guid',$id)->first(); | ||
if(!$portalObj->count()) $portalObj = ["status"=>false,"error"=>"Unable to locate installation based on identifier"]; | ||
return response()->json($portalObj); | ||
} | ||
|
||
} |
Oops, something went wrong.