mirror of
https://github.com/LBRYFoundation/lbry.com.git
synced 2025-08-23 17:47:26 +00:00
Add sorting and array_filter for job listing
This commit is contained in:
parent
ed582b7862
commit
9630777ec6
3 changed files with 12 additions and 9 deletions
|
@ -398,15 +398,18 @@ class ContentActions extends Actions
|
|||
|
||||
$jobs = array();
|
||||
|
||||
foreach(glob(static::VIEW_FOLDER_JOBS . '/*') as $job){
|
||||
|
||||
$jobs = array_filter(glob(static::VIEW_FOLDER_JOBS . '/*'), function($job){
|
||||
list($metadata, $jobHTML) = View::parseMarkdown($job);
|
||||
|
||||
if($metadata['status'] != 'closed')
|
||||
{
|
||||
array_push($jobs, $job);
|
||||
}
|
||||
}
|
||||
return $metadata['status'] != 'closed';
|
||||
});
|
||||
|
||||
usort($jobs, function($job1, $job2){
|
||||
list($metadataA, $jobHTMLA) = View::parseMarkdown($job1);
|
||||
list($metadataB, $jobHTMLB) = View::parseMarkdown($job2);
|
||||
return $metadataA['order'] <=> $metadataB['order'];
|
||||
});
|
||||
|
||||
return ['content/join-us', ['jobs' => $jobs]];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue