Exemple #1
0
<?php

include_once '../../config/symbini.php';
include_once $serverRoot . '/classes/OccurrenceDataset.php';
header("Content-Type: text/html; charset=" . $charset);
if (!$SYMB_UID) {
    header('Location: ../../profile/index.php?refurl=../collections/datasets/index.php?' . $_SERVER['QUERY_STRING']);
}
$action = array_key_exists('submitaction', $_REQUEST) ? $_REQUEST['submitaction'] : '';
//Sanitize input variables
if ($action && !preg_match('/^[a-zA-Z0-9\\s_]+$/', $action)) {
    $action = '';
}
$datasetManager = new OccurrenceDataset();
$datasetManager->setSymbUid($SYMB_UID);
$statusStr = '';
if ($action == 'Create New Dataset') {
    if (!$datasetManager->createDataset($_POST['name'], $_POST['notes'], $SYMB_UID)) {
        $statusStr = implode(',', $datasetManager->getErrorArr());
    }
}
?>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=<?php 
echo $charset;
?>
">
		<title><?php 
echo $defaultTitle;
?>
<?php

include_once '../../../config/symbini.php';
include_once $serverRoot . '/classes/MapInterfaceManager.php';
include_once $serverRoot . '/classes/OccurrenceDataset.php';
header("Content-Type: text/html; charset=" . $charset);
$uid = array_key_exists("uid", $_REQUEST) ? $_REQUEST["uid"] : '';
$action = array_key_exists("action", $_REQUEST) ? $_REQUEST["action"] : '';
$newName = array_key_exists("newname", $_REQUEST) ? $_REQUEST["newname"] : '';
$newNotes = array_key_exists("newnotes", $_REQUEST) ? $_REQUEST["newnotes"] : '';
$dsId = array_key_exists("dsid", $_REQUEST) ? $_REQUEST["dsid"] : '';
$selections = array_key_exists('selections', $_REQUEST) ? $_REQUEST['selections'] : 0;
$selset = array_key_exists('selset', $_REQUEST) ? $_REQUEST['selset'] : 0;
$mapManager = new MapInterfaceManager();
$datasetManager = new OccurrenceDataset();
if ($action == "loadlist") {
    $recordsetlist = $mapManager->getPersonalRecordsets($uid);
    $listHtml = '';
    if ($recordsetlist) {
        foreach ($recordsetlist as $recList => $recSet) {
            $roleStr = "'" . $recSet['role'] . "'";
            $listHtml .= '<input data-role="none" type="radio" name="dsid" value="' . $recSet['datasetid'] . '" onchange="loadRecordset(' . $recSet['datasetid'] . ',' . $roleStr . ');" ' . ($recSet['datasetid'] == $selset ? 'checked' : '') . '> <a href="../datasets/index.php" target="_blank" onclick="">' . $recSet['name'] . ($recSet['role'] == "DatasetReader" ? " (read-only)" : "") . '</a><br />';
        }
    }
    echo $listHtml;
}
if ($action == "createset") {
    $newId = '';
    $datasetManager->createDataset($newName, $newNotes, $uid);
    $newId = $datasetManager->getDsId();
    echo $newId;
    header('Location: ../../profile/index.php?refurl=../collections/datasets/datasetmanager.php?' . $_SERVER['QUERY_STRING']);
}
$datasetId = $_REQUEST['datasetid'];
$tabIndex = array_key_exists('tabindex', $_REQUEST) ? $_REQUEST['tabindex'] : 0;
$action = array_key_exists('submitaction', $_REQUEST) ? $_REQUEST['submitaction'] : '';
//Sanitation
if (!is_numeric($datasetId)) {
    $datasetId = 0;
}
if (!is_numeric($tabIndex)) {
    $tabIndex = 0;
}
if ($action && !preg_match('/^[a-zA-Z0-9\\s_]+$/', $action)) {
    $action = '';
}
$datasetManager = new OccurrenceDataset();
$datasetManager->setSymbUid($SYMB_UID);
$mdArr = $datasetManager->getDatasetMetadata($datasetId);
$role = '';
$roleLabel = '';
$isEditor = 0;
if ($SYMB_UID == $mdArr['uid']) {
    $isEditor = 1;
    $role = 'owner';
} elseif (isset($mdArr['roles'])) {
    if (in_array('DatasetAdmin', $mdArr['roles'])) {
        $isEditor = 1;
        $role = 'administrator';
    } elseif (in_array('DatasetEditor', $mdArr['roles'])) {
        $isEditor = 2;
        $role = 'editor';