本文整理汇总了PHP中KTUtil::addQueryString方法的典型用法代码示例。如果您正苦于以下问题:PHP KTUtil::addQueryString方法的具体用法?PHP KTUtil::addQueryString怎么用?PHP KTUtil::addQueryString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KTUtil
的用法示例。
在下文中一共展示了KTUtil::addQueryString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderHeader
function renderHeader()
{
// short-circuit
if (empty($this->label)) {
return '';
}
// for safety
$label = htmlentities($this->label, ENT_NOQUOTES, 'UTF-8');
// without sorthing to sort on, don't bother.
if (empty($this->namespace)) {
$this->sortable = false;
// if we haven't set which column we're sorted by, do nothing.
}
// no sorting, no link
if (!$this->sortable) {
return $label;
}
// merge the sorting options into the header.
$sort_order = $this->sort_direction == 'asc' ? 'desc' : 'asc';
$qs = sprintf('sort_on=%s&sort_order=%s', $this->namespace, $sort_order);
if (is_null($this->return_url)) {
$url = KTUtil::addQueryStringSelf($qs);
} else {
$url = KTUtil::addQueryString($this->return_url, $qs);
}
return sprintf('<a href="%s">%s</a>', $url, $label);
}
示例2: setupServerVariables
function setupServerVariables()
{
$oKTConfig =& KTConfig::getSingleton();
$bPathInfoSupport = $oKTConfig->get('KnowledgeTree/pathInfoSupport');
if ($bPathInfoSupport) {
// KTS-21: Some environments (FastCGI only?) don't set PATH_INFO
// correctly, but do set ORIG_PATH_INFO.
$path_info = KTUtil::arrayGet($_SERVER, 'PATH_INFO');
$orig_path_info = KTUtil::arrayGet($_SERVER, 'ORIG_PATH_INFO');
if (empty($path_info) && !empty($orig_path_info)) {
$_SERVER['PATH_INFO'] = strip_tags($_SERVER['ORIG_PATH_INFO']);
$_SERVER['PHP_SELF'] .= $_SERVER['PATH_INFO'];
}
$env_path_info = KTUtil::arrayGet($_SERVER, 'REDIRECT_kt_path_info');
if (empty($path_info) && !empty($env_path_info)) {
$_SERVER['PATH_INFO'] = strip_tags($env_path_info);
$_SERVER['PHP_SELF'] .= $_SERVER['PATH_INFO'];
}
// KTS-50: IIS (and probably most non-Apache web servers) don't
// set REQUEST_URI. Fake it.
$request_uri = KTUtil::arrayGet($_SERVER, 'REQUEST_URI');
if (empty($request_uri)) {
$_SERVER['REQUEST_URI'] = strip_tags(KTUtil::addQueryString($_SERVER['PHP_SELF'], $_SERVER['QUERY_STRING']));
}
} else {
unset($_SERVER['PATH_INFO']);
}
$script_name = strip_tags(KTUtil::arrayGet($_SERVER, 'SCRIPT_NAME'));
$php_self = strip_tags(KTUtil::arrayGet($_SERVER, 'PHP_SELF'));
$_SERVER['SCRIPT_NAME'] = $script_name;
$_SERVER['PHP_SELF'] = $php_self;
$kt_path_info = strip_tags(KTUtil::arrayGet($_REQUEST, 'kt_path_info'));
if (!empty($kt_path_info)) {
$_SERVER['PHP_SELF'] .= '?kt_path_info=' . $kt_path_info;
$_SERVER['PATH_INFO'] = $kt_path_info;
}
$sServerName = $oKTConfig->get('KnowledgeTree/serverName');
$_SERVER['HTTP_HOST'] = $sServerName;
}
示例3: buildFolderLink
function buildFolderLink($aDataRow)
{
return KTUtil::addQueryString($_SERVER['PHP_SELF'], sprintf('action=addUnit2&unit_name=%s&fFolderId=%d', $this->sName, $aDataRow['folder']->getId()));
}
示例4: do_main
function do_main()
{
$sCode = KTUtil::arrayGet($_REQUEST, 'code');
$sName = KTUtil::arrayGet($_REQUEST, 'varname', 'fFolderId');
$oWidget = unserialize($_SESSION['collection_widgets'][$sCode]);
$oCollection = $oWidget->getCollection();
$oFolder = Folder::get(KTUtil::arrayGet($_REQUEST, 'fFolderId', 1));
if (PEAR::isError($oFolder)) {
$this->errorRedirectToMain(_kt('Invalid folder selected.'));
exit(0);
}
$aOptions = array('ignorepermissions' => KTBrowseUtil::inAdminMode($this->oUser, $oFolder));
$oCollection->_queryObj->folder_id = $oFolder->getId();
$aOptions = $oCollection->getEnvironOptions();
$aOptions['return_url'] = KTUtil::addQueryString($_SERVER['PHP_SELF'], array('code' => $sCode, 'varname' => $sName, 'fFolderId' => $oFolder->getId()));
$oCollection->setOptions($aOptions);
// add the collection code to the title column QS params
foreach ($oWidget->aCols as $ns) {
$aColOpts = $oCollection->getColumnOptions($ns);
$aColOpts['qs_params'] = kt_array_merge(KTUtil::arrayGet($aColOpts, 'qs_params', array()), array('code' => $sCode, 'varname' => $sName));
$oCollection->setColumnOptions($ns, $aColOpts);
}
// make the breadcrumbs
$aBreadcrumbs = $this->_generate_breadcrumbs($oFolder, $sCode, $oWidget->aBCUrlParams, $sName);
print KTTemplating::renderTemplate('ktcore/forms/widgets/collection', array('collection' => $oCollection, 'folder' => $oFolder, 'breadcrumbs' => $aBreadcrumbs, 'targetname' => $sName));
exit(0);
}
示例5: errorRedirectToBrowse
function errorRedirectToBrowse($sErrorMessage, $sQuery = "", $event = 'main')
{
if ($this->bTransactionStarted) {
$this->rollbackTransaction();
}
$_SESSION['KTErrorMessage'][] = $sErrorMessage;
// meld persistant options
$sQuery = $this->meldPersistQuery($sQuery, $event);
$server = str_replace('action.php', 'browse.php', $_SERVER['PHP_SELF']);
$sRedirect = KTUtil::addQueryString($server, $sQuery);
$this->oRedirector->redirect($sRedirect);
exit(0);
}
示例6: getBulkReturnUrl
function getBulkReturnUrl()
{
$sReturnAction = $_REQUEST['fReturnAction'];
$sReturnData = $_REQUEST['fReturnData'];
$sAction = 'main';
$qs = '';
switch ($sReturnAction) {
case 'browse':
$sReturnData = empty($sReturnData) ? $_REQUEST['fFolderId'] : $sReturnData;
$sTargetUrl = KTBrowseUtil::getUrlForFolder(Folder::get($sReturnData));
break;
case 'simpleSearch':
$sTargetUrl = KTBrowseUtil::getSimpleSearchBaseUrl();
$extra = 'fSearchableText=' . $sReturnData;
break;
case 'booleanSearch':
$sTargetUrl = KTBrowseUtil::getBooleanSearchBaseUrl();
$sAction = 'performSearch';
$extra = 'boolean_search_id=' . $sReturnData;
break;
case 'search2':
$sTargetUrl = KTBrowseUtil::getSearchResultURL();
$sAction = 'searchResults';
break;
default:
$sTargetUrl = $sReturnAction;
$sAction = '';
}
$qs = !empty($sAction) ? 'action=' . $sAction : '';
$qs .= !empty($extra) ? '&' . $extra : '';
$sTargetUrl = KTUtil::addQueryString($sTargetUrl, $qs);
return $sTargetUrl;
}
示例7: check
function check()
{
$this->browse_mode = KTUtil::arrayGet($_REQUEST, 'fBrowseMode', 'folder');
$action = KTUtil::arrayGet($_REQUEST, $this->event_var, 'main');
$this->editable = false;
// catch the alternative actions.
if ($action != 'main') {
return true;
}
// if we're going to main ...
// folder browse mode
if ($this->browse_mode == 'folder') {
$in_folder_id = KTUtil::arrayGet($_REQUEST, 'fFolderId');
if (empty($in_folder_id)) {
$oConfig = KTConfig::getSingleton();
if ($oConfig->get('tweaks/browseToUnitFolder')) {
$iHomeFolderId = $this->oUser->getHomeFolderId();
if ($iHomeFolderId) {
$in_folder_id = $iHomeFolderId;
}
}
}
$folder_id = (int) $in_folder_id;
// conveniently, will be 0 if not possible.
if ($folder_id == 0) {
$folder_id = 1;
}
$_REQUEST['fBrowseMode'] = 'folder';
// here we need the folder object to do the breadcrumbs.
$oFolder =& Folder::get($folder_id);
if (PEAR::isError($oFolder)) {
return false;
// just fail.
}
// check whether the user can edit this folder
$oPerm = KTPermission::getByName('ktcore.permissions.write');
if (KTPermissionUtil::userHasPermissionOnItem($this->oUser, $oPerm, $oFolder)) {
$this->editable = true;
} else {
$this->editable = false;
}
// set the title and breadcrumbs...
$this->oPage->setTitle(_kt('Browse'));
if (KTPermissionUtil::userHasPermissionOnItem($this->oUser, 'ktcore.permissions.folder_details', $oFolder)) {
$this->oPage->setSecondaryTitle($oFolder->getName());
} else {
if (KTBrowseUtil::inAdminMode($this->oUser, $oFolder)) {
$this->oPage->setSecondaryTitle(sprintf('(%s)', $oFolder->getName()));
} else {
$this->oPage->setSecondaryTitle('...');
}
}
//Figure out if we came here by navigating trough a shortcut.
//If we came here from a shortcut, the breadcrumbspath should be relative
//to the shortcut folder.
$iSymLinkFolderId = KTUtil::arrayGet($_REQUEST, 'fShortcutFolder', null);
if (is_numeric($iSymLinkFolderId)) {
$oBreadcrumbsFolder = Folder::get($iSymLinkFolderId);
$this->aBreadcrumbs = kt_array_merge($this->aBreadcrumbs, KTBrowseUtil::breadcrumbsForFolder($oBreadcrumbsFolder, array('final' => false)));
$this->aBreadcrumbs[] = array('name' => $oFolder->getName());
} else {
$this->aBreadcrumbs = kt_array_merge($this->aBreadcrumbs, KTBrowseUtil::breadcrumbsForFolder($oFolder));
}
$this->oFolder =& $oFolder;
// we now have a folder, and need to create the query.
$aOptions = array('ignorepermissions' => KTBrowseUtil::inAdminMode($this->oUser, $oFolder));
$this->oQuery = new BrowseQuery($oFolder->getId(), $this->oUser, $aOptions);
$this->resultURL = KTUtil::addQueryString($_SERVER['PHP_SELF'], sprintf('fFolderId=%d', $oFolder->getId()));
// and the portlets
$portlet = new KTActionPortlet(sprintf(_kt('About this folder')));
$aActions = KTFolderActionUtil::getFolderInfoActionsForFolder($this->oFolder, $this->oUser);
$portlet->setActions($aActions, $this->sName);
$this->oPage->addPortlet($portlet);
$portlet = new KTActionPortlet(sprintf(_kt('Actions on this folder')));
$aActions = KTFolderActionUtil::getFolderActionsForFolder($oFolder, $this->oUser);
$portlet->setActions($aActions, null);
$this->oPage->addPortlet($portlet);
} else {
if ($this->browse_mode == 'lookup_value') {
// browsing by a lookup value
$this->editable = false;
// check the inputs
$field = KTUtil::arrayGet($_REQUEST, 'fField', null);
$oField = DocumentField::get($field);
if (PEAR::isError($oField) || $oField == false) {
$this->errorRedirectToMain('No Field selected.');
exit(0);
}
$value = KTUtil::arrayGet($_REQUEST, 'fValue', null);
$oValue = MetaData::get($value);
if (PEAR::isError($oValue) || $oValue == false) {
$this->errorRedirectToMain('No Value selected.');
exit(0);
}
$this->oQuery = new ValueBrowseQuery($oField, $oValue);
$this->resultURL = KTUtil::addQueryString($_SERVER['PHP_SELF'], sprintf('fBrowseMode=lookup_value&fField=%d&fValue=%d', $field, $value));
// setup breadcrumbs
$this->aBreadcrumbs = array(array('name' => _kt('Lookup Values'), 'url' => KTUtil::addQueryString($_SERVER['PHP_SELF'], 'action=selectField')), array('name' => $oField->getName(), 'url' => KTUtil::addQueryString($_SERVER['PHP_SELF'], 'action=selectLookup&fField=' . $oField->getId())), array('name' => $oValue->getName(), 'url' => KTUtil::addQueryString($_SERVER['PHP_SELF'], sprintf('fBrowseMode=lookup_value&fField=%d&fValue=%d', $field, $value))));
} else {
if ($this->browse_mode == 'document_type') {
//.........这里部分代码省略.........
示例8: do_new
function do_new()
{
$this->oPage->setBreadcrumbDetails(_kt("New Link"));
$this->oPage->setTitle(_kt("New Link"));
$oPermission =& KTPermission::getByName('ktcore.permissions.write');
if (PEAR::isError($oPermission) || !KTPermissionUtil::userHasPermissionOnItem($this->oUser, $oPermission, $this->oDocument)) {
$this->errorRedirectToMain(_kt('You do not have sufficient permissions to add a document link'), sprintf("fDocumentId=%d", $this->oDocument->getId()));
exit(0);
}
$oParentDocument =& $this->oDocument;
if (PEAR::isError($oParentDocument)) {
$this->errorRedirectToMain(_kt('Invalid parent document selected.'));
exit(0);
}
$oFolder = Folder::get(KTUtil::arrayGet($_REQUEST, 'fFolderId', $oParentDocument->getFolderID()));
if (PEAR::isError($oFolder) || $oFolder == false) {
$this->errorRedirectToMain(_kt('Invalid folder selected.'));
exit(0);
}
$iFolderId = $oFolder->getId();
// Setup the collection for move display.
$collection = new AdvancedCollection();
$aBaseParams = array('fDocumentId' => $oParentDocument->getId());
$oCR =& KTColumnRegistry::getSingleton();
$col = $oCR->getColumn('ktcore.columns.selection');
$aColOptions = array();
$aColOptions['qs_params'] = kt_array_merge($aBaseParams, array('fFolderId' => $oFolder->getId()));
$aColOptions['show_folders'] = false;
$aColOptions['show_documents'] = true;
$aColOptions['rangename'] = 'linkselection[]';
$col->setOptions($aColOptions);
$collection->addColumn($col);
$col = $oCR->getColumn('ktdocumentlinks.columns.title');
$col->setOptions(array('qs_params' => kt_array_merge($aBaseParams, array('action' => 'new', 'fFolderId' => $oFolder->getId()))));
$collection->addColumn($col);
$qObj = new BrowseQuery($iFolderId);
$collection->setQueryObject($qObj);
$aOptions = $collection->getEnvironOptions();
//$aOptions['is_browse'] = true;
$aResultUrl = $aBaseParams;
$aResultUrl['fFolderId'] = $oFolder->getId();
$aResultUrl['action'] = 'new';
$aOptions['result_url'] = KTUtil::addQueryString($_SERVER['PHP_SELF'], $aResultUrl);
$collection->setOptions($aOptions);
$aURLParams = $aBaseParams;
$aURLParams['action'] = 'new';
$aBreadcrumbs = KTUtil::generate_breadcrumbs($oFolder, $iFolderId, $aURLParams);
// Add an electronic signature
global $default;
if ($default->enableESignatures) {
$sUrl = KTPluginUtil::getPluginPath('electronic.signatures.plugin', true);
$heading = _kt('You are attempting to add a document link');
$submit['type'] = 'button';
$submit['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'ktcore.transactions.add_link', 'document', 'document_add_link_form', 'submit', {$oParentDocument->iId});";
} else {
$submit['type'] = 'submit';
$submit['onclick'] = '';
}
$aTemplateData = array('context' => $this, 'folder' => $oFolder, 'parent' => $oParentDocument, 'breadcrumbs' => $aBreadcrumbs, 'collection' => $collection, 'link_types' => LinkType::getList("id > 0"), 'submit' => $submit);
$oTemplate =& $this->oValidator->validateTemplate('ktstandard/action/link');
return $oTemplate->render($aTemplateData);
}
示例9: do_update
function do_update()
{
$aOptions = array('redirect_to' => array('main', 'fFolderId=' . $this->oFolder->getId()));
if (!KTBrowseUtil::inAdminMode($this->oUser, $this->oFolder)) {
$this->oValidator->userHasPermissionOnItem($this->oUser, $this->_sEditShowPermission, $this->oFolder, $aOptions);
}
$aFoo = $_REQUEST['foo'];
$aPermissions = KTPermission::getList();
/*
--- This section has been commented out to remove these checks when permissions
--- are updated.
---------------------------------------------------------------------------------
//-------------------
//This section is used to make sure that a user doesn't disable the admin groups
//Manage security permission or the Manage Security permission of a group they
//are currently a member of.
// Check which groups have permission to manage security
$aNewGroups = (isset($aFoo[4]['group']) ? $aFoo[4]['group'] : array());
$aNewRoles = (isset($aFoo[4]['role']) ? $aFoo[4]['role'] : array());
$iUserId = $this->oUser->getId();
//Check that they aren't removing the sys admin Manage Security permission
//1 in this case is the admin group.
if(!in_array('1', $aNewGroups))
{
$this->addErrorMessage(_kt('You cannot remove the Manage Security permission from the System Administrators Group'));
$this->redirectTo('edit', 'fFolderId=' . $this->oFolder->getId());
exit(0);
}
//Check that they aren't removing the Manage Security permission from a group
//They are a member of.
if(!GroupUtil::checkUserInGroups($iUserId, array(1)))
{
//Ensure the user is not removing his/her own permission to update the folder permissions (manage security)
if(!in_array(-3, $aNewRoles))
{
if(!GroupUtil::checkUserInGroups($iUserId, $aNewGroups))
{
// If user no longer has permission, return an error.
$this->addErrorMessage(_kt('You cannot remove the Manage Security permission from a group you belong to.'));
$this->redirectTo('edit', 'fFolderId=' . $this->oFolder->getId());
exit(0);
}
}
}
//-----------------
*/
require_once KT_LIB_DIR . '/documentmanagement/observers.inc.php';
$oPO = KTPermissionObject::get($this->oFolder->getPermissionObjectId());
foreach ($aPermissions as $oPermission) {
$iPermId = $oPermission->getId();
$aAllowed = KTUtil::arrayGet($aFoo, $iPermId, array());
KTPermissionUtil::setPermissionForId($oPermission, $oPO, $aAllowed);
}
$oTransaction = KTFolderTransaction::createFromArray(array('folderid' => $this->oFolder->getId(), 'comment' => _kt('Updated permissions'), 'transactionNS' => 'ktcore.transactions.permissions_change', 'userid' => $_SESSION['userID'], 'ip' => Session::getClientIP()));
$aOptions = array('defaultmessage' => _kt('Error updating permissions'), 'redirect_to' => array('edit', sprintf('fFolderId=%d', $this->oFolder->getId())));
$this->oValidator->notErrorFalse($oTransaction, $aOptions);
$po =& new JavascriptObserver($this);
$po->start();
$oChannel =& KTPermissionChannel::getSingleton();
$oChannel->addObserver($po);
KTPermissionUtil::updatePermissionLookupForPO($oPO);
$this->commitTransaction();
$this->addInfoMessage(_kt('Permissions on folder updated'));
$po->redirect(KTUtil::addQueryString($_SERVER['PHP_SELF'], 'action=edit&fFolderId=' . $this->oFolder->getId()));
exit(0);
}
示例10: handleError
function handleError($sGlobalError = null, $aSimplerErrors = null)
{
if (!is_null($sGlobalError)) {
$this->_errors['_kt_global'][] = $sGlobalError;
}
if (!is_null($aSimplerErrors)) {
foreach ($aSimplerErrors as $k => $v) {
$this->_errors[$k] = kt_array_merge($this->_errors[$k], $v);
}
// since we've changed them, update the stored version
$_SESSION['_kt_old_data'][$this->_kt_form_name]['errors'] = serialize($this->_errors);
}
if (is_array($this->_errors)) {
$global_errors = KTUtil::arrayGet($this->_errors, '_kt_global', array());
$_SESSION['KTErrorMessage'] = kt_array_merge($_SESSION['KTErrorMessage'], $global_errors);
}
if (!empty($this->_failaction) && !is_null($this->_context)) {
$this->_context->errorRedirectTo($this->_failaction, _kt("Please correct the errors indicated."), sprintf("_kt_form_name=%s", $this->_kt_form_name));
exit(0);
} else {
if ($this->_failurl) {
redirect(KTUtil::addQueryString($this->_failurl, sprintf("_kt_form_name=%s", $this->_kt_form_name)));
exit(0);
} else {
return '<div class="ktError"><p>' . _kt("An error occured, and no error handlers were configured.") . '</p></div>';
exit(0);
}
}
}
示例11: do_search
function do_search()
{
// Get the tag to search for and create search query
$tag = isset($_REQUEST['tag']) ? $_REQUEST['tag'] : '';
$decode = isset($_REQUEST['decode']) ? $_REQUEST['decode'] : '';
if ($decode == 'true') {
$tag = urldecode($tag);
}
$iUserId = $_SESSION['userID'];
$oUser = User::get($iUserId);
// set breadcrumbs
$this->aBreadcrumbs[] = array('url' => 'dashboard.php', 'name' => _kt('Dashboard'));
$this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _kt('Tag Cloud Search'));
$tagList = $_SESSION['tagList'];
if (!empty($tagList)) {
$aPrevTag = end($tagList);
$aTagTree = $aPrevTag['tagTree'];
$base = KTUtil::addQueryString('TagCloudRedirection&action=recall', null);
foreach ($aTagTree as $key => $item) {
if ($tag == $item) {
continue;
}
$url = $base . '&tag=' . urlencode($item) . '&pos=' . $key;
$this->aBreadcrumbs[] = array('url' => $url, 'name' => $item);
}
}
if (!empty($tag)) {
$this->aBreadcrumbs[] = array('url' => '', 'name' => $tag);
}
// set page title
$sTitle = _kt('Search Results');
$this->oPage->setBreadcrumbDetails($sTitle);
// Set tag cloud portlet
$portlet = new TagCloudPortlet($oUser, $tag);
$this->oPage->addPortlet($portlet);
$collection = new AdvancedCollection();
$oColumnRegistry = KTColumnRegistry::getSingleton();
$aColumns = $oColumnRegistry->getColumnsForView('ktcore.views.search');
$collection->addColumns($aColumns);
// set a view option
$aTitleOptions = array('documenturl' => $GLOBALS['KTRootUrl'] . '/view.php');
$collection->setColumnOptions('ktcore.columns.title', $aTitleOptions);
$collection->setColumnOptions('ktcore.columns.selection', array('rangename' => 'selection', 'show_folders' => true, 'show_documents' => true));
$aOptions = $collection->getEnvironOptions();
// extract data from the environment
$returnUrl = KTUtil::addQueryString('TagCloudRedirection&action=search&tag=' . urlencode($tag), false);
$aOptions['return_url'] = $returnUrl;
$aOptions['empty_message'] = _kt('No documents or folders match this query.');
$aOptions['is_browse'] = true;
$collection->setOptions($aOptions);
$collection->setQueryObject(new TagQuery($oUser, $tag));
$oTemplating =& KTTemplating::getSingleton();
$oTemplate = $oTemplating->loadTemplate('kt3/browse');
$aTemplateData = array('context' => $this, 'collection' => $collection, 'custom_title' => $sTitle, 'isEditable' => true, 'boolean_search' => $sSearch, 'bulkactions' => KTBulkActionUtil::getAllBulkActions(), 'browseutil' => new KTBrowseUtil(), 'returnaction' => $returnUrl);
return $oTemplate->render($aTemplateData);
}
示例12: addQueryString
function addQueryString($url, $qs)
{
return KTUtil::addQueryString($url, $qs);
}
示例13: render
function render()
{
$iFolderId = KTUtil::arrayGet($_REQUEST, 'fFolderId', 1);
$iDocumentId = KTUtil::arrayGet($_REQUEST, 'fDocumentId');
if (!$iFolderId && !$iDocumentId) {
return null;
}
if ($iDocumentId) {
$oDocument = Document::get($iDocumentId);
if (PEAR::isError($oDocument) || $oDocument === false) {
return null;
}
$iFolderId = $oDocument->getFolderId();
}
require_once KT_LIB_DIR . '/security/Permission.inc';
$oUser =& User::get($_SESSION['userID']);
if (!Permission::userIsSystemAdministrator($oUser) && !Permission::isUnitAdministratorForFolder($oUser, $iFolderId)) {
return null;
}
require_once KT_LIB_DIR . '/browse/browseutil.inc.php';
$oTemplating =& KTTemplating::getSingleton();
$oTemplate = $oTemplating->loadTemplate("kt3/portlets/admin_mode_portlet");
$toggleMode = 'action=disableAdminMode';
if (KTUtil::arrayGet($_SESSION, 'adminmode', false) == false) {
$toggleMode = 'action=enableAdminMode';
}
$QS = sprintf('fDocumentId=%s&fFolderId=%s&%s', $iDocumentId, $iFolderId, $toggleMode);
$toggleUrl = KTUtil::addQueryString(KTBrowseUtil::getBrowseBaseUrl(), $QS);
$aTemplateData = array("context" => $this, 'toggleurl' => $toggleUrl, 'enabled' => KTUtil::arrayGet($_SESSION, 'adminmode', false));
return $oTemplate->render($aTemplateData);
}
示例14: buildFolderLink
function buildFolderLink($aDataRow)
{
if (is_null(KTUtil::arrayGet($this->aOptions, 'direct_folder'))) {
$dest = KTUtil::arrayGet($this->aOptions, 'folder_link');
if ($aDataRow['folder']->isSymbolicLink()) {
$params = array('fFolderId' => $aDataRow['folder']->getLinkedFolderId(), 'fShortcutFolder' => $aDataRow['folder']->getParentID());
} else {
$params = array('fFolderId' => $aDataRow['folder']->getId());
}
$params = kt_array_merge(KTUtil::arrayGet($this->aOptions, 'qs_params', array()), $params);
if (empty($dest)) {
return KTUtil::addQueryStringSelf($params);
} else {
return KTUtil::addQueryString($dest, $params);
}
} else {
if ($aDataRow['folder']->isSymbolicLink()) {
return KTBrowseUtil::getUrlForFolder($aDataRow['folder']->getLinkedFolder()) . "&fShortcutFolder=" . $aDataRow['folder']->getParentID();
} else {
return KTBrowseUtil::getUrlForFolder($aDataRow['folder']);
}
}
}
示例15: pageLink
function pageLink($iPageNumber)
{
$qs = sprintf('page=%s&sort_on=%s&sort_order=%s', $iPageNumber, $this->sort_column, $this->sort_order);
return KTUtil::addQueryString($this->returnURL, $qs);
}