Skip to content

Commit

Permalink
Checklist Index Page
Browse files Browse the repository at this point in the history
- Display all checklists that have at least one linked taxon OR is a parent checklist inheriting taxa from a child checklist.
- Removed limit that required checklist to have at least 10 linked taxa
- Order checklists by project and checklists names
- Only display Global symbol within map display option when one or more checklists within a group have lat/long centroids
  • Loading branch information
egbot committed Jul 24, 2024
1 parent 80532df commit c7265d0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
10 changes: 7 additions & 3 deletions checklists/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,14 @@
$projName = $projArr['name'];
if($projName == 'Miscellaneous Inventories') $projName = (isset($LANG['MISC_INVENTORIES'])?$LANG['MISC_INVENTORIES']:'Miscellaneous Inventories');
echo $projName;
if(!empty($projArr['displayMap'])){
?>
<a href="<?php echo "clgmap.php?pid=" . $pid; ?>" title='<?php echo (isset($LANG['SHOW_MAP'])?$LANG['SHOW_MAP']:'Show inventories on map'); ?>'>
<img src='../images/world.png' style='width:10px;border:0' />
</a>
<?php
}
?>
<a href="<?php echo "clgmap.php?pid=" . $pid; ?>" title='<?php echo (isset($LANG['SHOW_MAP'])?$LANG['SHOW_MAP']:'Show inventories on map'); ?>'>
<img src='../images/world.png' style='width:10px;border:0' />
</a>
</h3>
<ul>
<?php
Expand Down
18 changes: 12 additions & 6 deletions classes/ChecklistManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -657,17 +657,22 @@ public function addNewSpecies($postArr){
//Checklist index page fucntions
public function getChecklists($limitToKey=false){
$retArr = Array();
$sql = 'SELECT p.pid, p.projname, p.ispublic, c.clid, c.name, c.access, c.defaultSettings, COUNT(l.tid) AS sppcnt
$sql = 'SELECT p.pid, p.projname, p.ispublic, c.clid, c.name, c.access, c.defaultSettings, c.latCentroid
FROM fmchecklists c LEFT JOIN fmchklstprojlink cpl ON c.clid = cpl.clid
INNER JOIN fmchklsttaxalink l ON c.clid = l.clid
LEFT JOIN fmprojects p ON cpl.pid = p.pid
WHERE ((c.access LIKE "public%") ';
if(isset($GLOBALS['USER_RIGHTS']['ClAdmin']) && $GLOBALS['USER_RIGHTS']['ClAdmin']) $sql .= 'OR (c.clid IN('.implode(',',$GLOBALS['USER_RIGHTS']['ClAdmin']).'))';
WHERE c.type != "excludespp" AND ((c.access LIKE "public%") ';
if(isset($GLOBALS['USER_RIGHTS']['ClAdmin']) && $GLOBALS['USER_RIGHTS']['ClAdmin']){
$sql .= 'OR (c.clid IN('.implode(',',$GLOBALS['USER_RIGHTS']['ClAdmin']).'))';
}
$sql .= ') AND ((p.pid IS NULL) OR (p.ispublic = 1) ';
if(isset($GLOBALS['USER_RIGHTS']['ProjAdmin']) && $GLOBALS['USER_RIGHTS']['ProjAdmin']) $sql .= 'OR (p.pid IN('.implode(',',$GLOBALS['USER_RIGHTS']['ProjAdmin']).'))';
if(isset($GLOBALS['USER_RIGHTS']['ProjAdmin']) && $GLOBALS['USER_RIGHTS']['ProjAdmin']){
$sql .= 'OR (p.pid IN('.implode(',',$GLOBALS['USER_RIGHTS']['ProjAdmin']).'))';
}
$sql .= ') ';
if($this->pid) $sql .= 'AND (p.pid = '.$this->pid.') ';
$sql .= 'GROUP BY p.projname, c.Name HAVING sppcnt > 10';
//Following line limits result to only checklists that have a linked taxon or is a parent checklist with possible inherited taxa
$sql .= 'AND c.clid IN(SELECT clid FROM fmchklsttaxalink UNION DISTINCT SELECT clid FROM fmchklstchildren) ';
$sql .= 'ORDER BY p.projname, c.name';
$rs = $this->conn->query($sql);
while($row = $rs->fetch_object()){
if($limitToKey){
Expand All @@ -681,6 +686,7 @@ public function getChecklists($limitToKey=false){
$pid = 0;
$projName = 'Miscellaneous Inventories';
}
if($row->latCentroid) $retArr[$pid]['displayMap'] = 1;
$retArr[$pid]['name'] = $this->cleanOutStr($projName);
$retArr[$pid]['clid'][$row->clid] = $this->cleanOutStr($row->name).($row->access=='private'?' (Private)':'');
}
Expand Down
6 changes: 5 additions & 1 deletion ident/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@
foreach($projArr as $pidKey => $pArr){
$clArr = $pArr['clid'];
echo '<div style="margin:3px 0px 0px 15px;">';
echo '<h3>'.$pArr['name'].' <a href="../checklists/clgmap.php?pid='.$pidKey.'&target=keys"><img src="../images/world.png" style="width:10px;border:0" /></a></h3>';
echo '<h3>' . $pArr['name'];
if(!empty($pArr['displayMap'])){
echo ' <a href="../checklists/clgmap.php?pid=' . $pidKey . '&target=keys"><img src="../images/world.png" style="width:10px;border:0" /></a>';
}
echo '</h3>';
echo '<div><ul>';
foreach($clArr as $clid => $clName){
echo '<li><a href="key.php?clid='.$clid.'&pid='.$pidKey.'&taxon=All+Species">'.$clName.'</a></li>';
Expand Down

0 comments on commit c7265d0

Please sign in to comment.