/** * Retrieve url for given object id. * if objectid is NULL, return array containing all URLs * * @static * @param smdoc $foowd Reference to the foowd environment object. * @param int $objectid Specific translation to retrieve. * @return URL for specified translation, or array of all translations. */ function getLink(&$foowd, $objectid = FALSE) { $session_links = new input_session('lang_links', NULL); $workspaces = $foowd->getWorkspaceList(); if (!isset($session_links->value)) { smdoc_translation::initialize($foowd); $session_links->refresh(); } if ($objectid === FALSE) { return $session_links->value; } if (isset($session_links->value[$objectid])) { return $session_links->value[$objectid]; } elseif ($workspaces != NULL && isset($workspaces[$objectid])) { $url_arr['class'] = 'foowd_workspace'; $url_arr['method'] = 'enter'; $url_arr['langid'] = $objectid; $the_url = '<a href="' . getURI($url_arr) . '">'; $the_url .= htmlentities($workspaces[$objectid]) . '</a>'; return $the_url; } else { return NULL; } }