subtarget is the "objectid" $id = intval($_REQUEST['subtarget']); } else { // find out if a "/" exists => then lat/long is given for "add object" inside subtarget $dividerposition = strpos($_REQUEST['subtarget'], '/'); if ($dividerposition > 0) { // lat/lng passed $latlngarray = explode("/", $_REQUEST['subtarget']); // copy to preassumed values from old tool $_GET['lat'] = $latlngarray[0]; $_GET['lng'] = $latlngarray[1]; } // assume normal "add object" $id = 0; } */ if ($id == 0) { // create a new object $getnewobject = true; // load process for editing the new object $process = Tools::getNextStep(array("currentstep" => "manageobjectdata", "processid" => "")); /* echo "
";
var_dump($process);
echo "";
*/
} else {
// do not create object, edit object
if (isset($params['enableprocess'])) {
// "Manage" was clicked in context menu -- use process for editing
// load process for editing the existing object
$process = Tools::getNextStep(array("currentstep" => "manageobjectdata", "processid" => ""));
}
}
?>
$value) {
$$key = trim(stripslashes($value));
}
require_once CROOT."/midware/Webstring.class.php";
require_once CROOT."/midware/Tools.php";
$GLOBALS['helptexts']['source_help1'] = t("Put here any details that clarify your source: title, page number, url, circumstances of your observation, etc.",2);
$GLOBALS['helptexts']['source_help2'] = t("Put here anything special that is needed to alert others editing this object.",2);
// add new object, if...
if (isset($getnewobject)){
include CROOT."/midware/Structure.class.php";
$newobject = new Structure();
$id = $newobject->create();
$headstr = t('Adding');
} else {
$headstr = t('Editing');
}
// this we need here :-(
$object_source_textfield_default_value = $GLOBALS['helptexts']['source_help1'];
$object_comments_default_value = $GLOBALS['helptexts']['source_help2'];
$source_types = getSource($_SESSION['account_language']);
$query = sprintf("SELECT coalesce(name_%s, name_en) FROM language WHERE NOT deleted AND isocode = '%s'", $_SESSION['account_language'], $_SESSION['account_language']);
$user_language = queryOne($query);
// get SORTED category "source"
function getSource($lng){
$query = sprintf("SELECT categoryid, coalesce(name_%s, name_en) AS desc, final,
CASE WHEN NOT (split_part(categoryid, '.', 3) = '') THEN CAST(split_part(categoryid, '.', 3) AS int) ELSE NULL END AS of2
FROM category
WHERE NOT deleted
AND categoryid LIKE 'source.%%'
ORDER BY
split_part(categoryid, '.', 2), of2 NULLS FIRST",
$lng);
// echo $query;
$rows = query($query);
$return = "";
// todo: find where this is set?
$disabled = False;
foreach ($rows as $row) {
if (!$row['final']){
$return .= sprintf('', $row['desc']);
} elseif (empty($row['of2'])){
$return .= sprintf('', $row['desc']);
$return .= sprintf('', $row['categoryid'], $disabled, $row['desc']);
} else {
$return .= sprintf('', $row['categoryid'], $disabled, $row['desc']);
}
}
return $return;
}
?>