本文整理汇总了PHP中KTUtil::ktLink方法的典型用法代码示例。如果您正苦于以下问题:PHP KTUtil::ktLink方法的具体用法?PHP KTUtil::ktLink怎么用?PHP KTUtil::ktLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KTUtil
的用法示例。
在下文中一共展示了KTUtil::ktLink方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display_viewlet
function display_viewlet()
{
$oKTTemplating =& KTTemplating::getSingleton();
$oTemplate =& $oKTTemplating->loadTemplate("ktcore/document/viewlets/workflow");
if (is_null($oTemplate)) {
return "";
}
$oWorkflowState = KTWorkflowState::get($this->oDocument->getWorkflowStateId());
if (PEAR::isError($oWorkflowState)) {
return "";
}
$aDisplayTransitions = array();
$aTransitions = KTWorkflowUtil::getTransitionsForDocumentUser($this->oDocument, $this->oUser);
if (empty($aTransitions)) {
return "";
}
// Check if the document has been checked out
$bIsCheckedOut = $this->oDocument->getIsCheckedOut();
$iId = $this->oDocument->getId();
if ($bIsCheckedOut) {
// If document is checked out, don't link into the workflow.
$aDisplayTransitions = array();
} else {
foreach ($aTransitions as $oTransition) {
if (is_null($oTransition) || PEAR::isError($oTransition)) {
continue;
}
$aDisplayTransitions[] = array('url' => KTUtil::ktLink('action.php', 'ktcore.actions.document.workflow', array("fDocumentId" => $iId, "action" => "quicktransition", "fTransitionId" => $oTransition->getId())), 'name' => $oTransition->getName());
}
}
//Retreive the comment for the previous transition
$aCommentQuery = array("SELECT comment FROM document_transactions\n where transaction_namespace='ktcore.transactions.workflow_state_transition'\n AND document_id = ?\n ORDER BY id DESC LIMIT 1;");
$aCommentQuery[] = array($iId);
$aTransitionComments = DBUtil::getResultArray($aCommentQuery);
$oLatestTransitionComment = null;
if (!empty($aTransitionComments)) {
$aRow = $aTransitionComments[0];
$oLatestTransitionComment = $aRow['comment'];
$iCommentPosition = strpos($oLatestTransitionComment, ':');
//comment found after first colon in string
if ($iCommentPosition > 0) {
$oLatestTransitionComment = substr($oLatestTransitionComment, $iCommentPosition + 2, strlen($oLatestTransitionComment) - $iCommentPosition);
} else {
$oLatestTransitionComment = null;
}
}
$oTemplate->setData(array('context' => $this, 'bIsCheckedOut' => $bIsCheckedOut, 'transitions' => $aDisplayTransitions, 'state_name' => $oWorkflowState->getName(), 'comment' => $oLatestTransitionComment));
return $oTemplate->render();
}
示例2: do_main
/**
* Dispatch function
*/
function do_main()
{
$this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _kt('Task Scheduler Management'));
$this->oPage->setTitle(_kt('Task Scheduler Management'));
$this->oPage->requireJSResource('resources/js/scheduler.js');
$oTemplating =& KTTemplating::getSingleton();
$oTemplate = $oTemplating->loadTemplate('ktcore/scheduler');
// Link for clearing out old tasks
// $lClear = KTUtil::ktLink('admin.php', 'misc/scheduler', 'action=clearTasks');
// $sClear = "<a href='#' onclick='javascript: clearTasks(\"{$lClear}\");'>"._kt('Clean-up old tasks').'</a>';
// Link for saving the updated frequencies
$sUrl = KTUtil::ktLink('admin.php', 'misc/scheduler', 'action=saveFreq');
// Get all tasks
$aList = SchedulerEntity::getTaskList();
$aHeadings = array(' ', _kt('Task'), _kt('Frequency'), _kt('Next run time'), _kt('Previous run time'), _kt('Time taken to complete'), ' ');
//$aFrequencies = array('monthly', 'weekly', 'daily', 'hourly', 'half_hourly', 'quarter_hourly', '10mins', '5mins');
$aFrequencies = array('monthly' => _kt('monthly'), 'weekly' => _kt('weekly'), 'daily' => _kt('daily'), 'hourly' => _kt('hourly'), 'half_hourly' => _kt('every half hour'), 'quarter_hourly' => _kt('every quarter hour'), '10mins' => _kt('every 10 minutes'), '5mins' => _kt('every 5 minutes'), '1min' => _kt('every minute'), '30secs' => _kt('every 30 seconds'));
$aTemplateData = array('context' => $this, 'aList' => $aList, 'aHeadings' => $aHeadings, 'aFrequencies' => $aFrequencies, 'i' => 1, 'sUrl' => $sUrl);
return $oTemplate->render($aTemplateData);
}
示例3: do_viewComparison
/**
* Display the metadata comparison
*
*/
function do_viewComparison()
{
// this is just a redirector
$QS = array('action' => 'viewComparison', 'fDocumentId' => $this->oDocument->getId(), 'fBaseVersion' => $_REQUEST['fBaseVersion'], 'fComparisonVersion' => $_REQUEST['fComparisonVersion']);
$frag = array();
foreach ($QS as $k => $v) {
$frag[] = sprintf('%s=%s', urlencode($k), urlencode($v));
}
redirect(KTUtil::ktLink('view.php', null, implode('&', $frag)));
}
示例4: getHelpURL
function getHelpURL()
{
if (empty($this->helpPage)) {
return null;
}
return KTUtil::ktLink('help.php', $this->helpPage);
}
示例5: getStatusLink
/**
* Run the task on the next iteration
*/
function getStatusLink()
{
$sId = $this->getId();
$sStatus = $this->getStatus();
if ($sStatus == 'system') {
return '';
}
$sDisableText = _kt('Disable Task');
$sEnableText = _kt('Enable Task');
$sLinkText = $sStatus == 'enabled' ? $sDisableText : $sEnableText;
$sUrl = KTUtil::ktLink('admin.php', 'misc/scheduler', 'action=updateStatus');
$sLink = "<input type='button' id='statusLink{$this->getId()}'\n onclick='javascript: toggleStatus(\"{$sId}\", \"{$sUrl}\", \"{$sDisableText}\", \"{$sEnableText}\");' value='{$sLinkText}' />";
return $sLink;
}
示例6: permissionDenied
function permissionDenied()
{
// handle anonymous specially.
if ($this->oUser->getId() == -2) {
redirect(KTUtil::ktLink('login.php', '', sprintf("redirect=%s&errorMessage=%s", urlencode($_SERVER['REQUEST_URI']), urlencode(_kt("You must be logged in to perform this action")))));
exit(0);
}
global $default;
$msg = '<h2>' . _kt('Permission Denied') . '</h2>';
$msg .= '<p>' . _kt('If you feel that this is incorrect, please report both the action and your username to a system administrator.') . '</p>';
$this->oPage->setPageContents($msg);
$this->oPage->setUser($this->oUser);
$this->oPage->hideSection();
$this->oPage->render();
exit(0);
}
示例7: renderData
function renderData($aDataRow)
{
$localname = $this->name;
// only _ever_ show this folder documents.
if ($aDataRow['type'] === 'folder') {
return ' ';
}
// FIXME at some point we may want to hide this if the user doens't have the download action, but its OK for now.
$link = KTUtil::ktLink('action.php', 'ktcore.actions.document.view', 'fDocumentId=' . $aDataRow['document']->getId());
$outStr = sprintf('<a href="%s" class="ktAction ktDownload" title="%s">%s</a>', $link, _kt('Download Document'), _kt('Download Document'));
return $outStr;
}
示例8: render
function render()
{
$bWin = false;
if (OS_WINDOWS) {
$bWin = true;
}
$aTimes = schedulerDashlet::getRunTimes();
$sLastTime = $aTimes['lasttime'];
$sTimeDif = $aTimes['timedif'];
$bDue = $aTimes['due'];
$oKTConfig =& KTConfig::getSingleton();
$rootUrl = $oKTConfig->get("rootUrl");
if ($oKTConfig->get("ui/morphEnabled") == '1') {
$sImg = $rootUrl . '/skins/kts_' . $oKTConfig->get("ui/morphTo");
} else {
$sImg = $rootUrl . '/resources/graphics';
}
$sImgPlus = $sImg . '/bullet_toggle_plus.png';
$sImgMinus = $sImg . '/bullet_toggle_minus.png';
$sPath = KT_DIR . '/bin/scheduler.php';
$sOnClick = " var cron = document.getElementById('cronguide');\n var icon = document.getElementById('scheduler_icon');\n if(cron.style.visibility == 'hidden'){\n cron.style.visibility = 'visible'; cron.style.display = 'block';\n icon.src = '{$sImgMinus}';\n }else{\n cron.style.visibility = 'hidden'; cron.style.display = 'none';\n icon.src = '{$sImgPlus}';\n }";
$sAdmin = KTUtil::ktLink('admin.php', 'misc/scheduler');
$sAdminLink = "<a href='{$sAdmin}'>" . _kt('Administration page') . '</a>';
$oTemplating =& KTTemplating::getSingleton();
$oTemplate = $oTemplating->loadTemplate('ktcore/dashlets/scheduler');
$aTemplateData = array('lasttime' => $sLastTime, 'timedif' => $sTimeDif, 'isDue' => $bDue, 'bWin' => $bWin, 'sPath' => $sPath, 'sAdminLink' => $sAdminLink, 'sImg' => $sImgPlus, 'onClick' => $sOnClick);
return $oTemplate->render($aTemplateData);
}
示例9: do_selectType
function do_selectType()
{
switch ($_REQUEST[data][convert_type]) {
case '0':
$this->do_pdfdownload();
break;
case '1':
$this->do_pdfduplicate();
break;
case '2':
$this->do_pdfreplace();
break;
default:
$this->do_pdfdownload();
}
redirect(KTUtil::ktLink('action.php', 'ktstandard.pdf.generate', array("fDocumentId" => $this->oDocument->getId())));
exit(0);
}
示例10: do_viewCategory
function do_viewCategory()
{
// are we categorised, or not?
$category = KTUtil::arrayGet($_REQUEST, 'fCategory', $this->category);
//Removing bad documents/fieldmanagement links from the Document Metadata and Workflow Configuration page.
if ($category == 'documents') {
$oPage =& $GLOBALS['main'];
$aJavascript[] = 'thirdpartyjs/jquery/jquery-1.3.2.js';
$oPage->requireJSResources($aJavascript);
$jscript .= "<script src='resources/js/kt_hideadminlink.js' type='text/javascript'></script>";
}
$oRegistry =& KTAdminNavigationRegistry::getSingleton();
$aCategory = $oRegistry->getCategory($category);
$aItems = $oRegistry->getItemsForCategory($category);
asort($aItems);
$this->aBreadcrumbs[] = array('name' => $aCategory['title'], 'url' => KTUtil::ktLink('admin.php', $category));
$this->oPage->title = _kt('Administration') . ': ' . $aCategory['title'];
$oTemplating =& KTTemplating::getSingleton();
$oTemplate = $oTemplating->loadTemplate('kt3/admin_items');
$aTemplateData = array('context' => $this, 'category' => $aCategory, 'items' => $aItems, 'baseurl' => $_SERVER['PHP_SELF'], 'jscript' => $jscript);
return $oTemplate->render($aTemplateData);
}
示例11: ktLink
function ktLink($params, &$smarty)
{
return KTUtil::ktLink($params['base'], $params['subpath'], $params['query']);
}
示例12: renderData
function renderData($aDataRow)
{
// only _ever_ show this for documents.
if ($aDataRow["type"] === "folder") {
return ' ';
}
$link = KTUtil::ktLink('action.php', 'ktcore.actions.document.view', 'fDocumentId=' . $aDataRow['document']->getId());
return sprintf('<a href="%s" class="ktAction ktDownload" title="%s">%s</a>', $link, _kt('Download Document'), _kt('Download Document'));
}
示例13: do_editComplexFieldset
function do_editComplexFieldset()
{
$fieldset_id = KTUtil::arrayGet($_REQUEST, "fieldset_id");
$oTemplating =& KTTemplating::getSingleton();
$oTemplate = $oTemplating->loadTemplate("ktcore/metadata/conditional/editcomplex");
/* alright: to "do" this we need at least:
* 1. the list of all the columns (id, name) and their available values.
* 2. the fieldset_id.
* we can then render in/out. Everything "intelligent" happens
* in AJAX (doing it with submits sucks arse.
*
* FIXME we fake it here with nested arrays...
*/
$oFieldset =& KTFieldset::get($fieldset_id);
$aFields =& $oFieldset->getFields();
$this->aBreadcrumbs[] = array('url' => KTUtil::ktLink('admin.php', 'documents/fieldmanagement', 'action=edit&fFieldsetId=' . $oFieldset->getId()), 'name' => $oFieldset->getName());
$this->aBreadcrumbs[] = array('url' => KTUtil::ktLink('admin.php', 'documents/fieldmanagement', 'action=manageConditional&fFieldsetId=' . $oFieldset->getId()), 'name' => _kt('Manage conditional fieldset'));
$sTable = KTUtil::getTableName('field_orders');
$aQuery = array("SELECT parent_field_id, child_field_id FROM {$sTable} WHERE fieldset_id = ?", array($oFieldset->getId()));
$aFieldOrders = DBUtil::getResultArray($aQuery);
$aOrders = array();
foreach ($aFieldOrders as $row) {
$aChildren = KTUtil::arrayGet($aOrders, $row['parent_field_id'], array());
$aChildren[] = $row['child_field_id'];
$aOrders[$row['parent_field_id']] = $aChildren;
}
$aKeyedFields = array();
$aOrderedFields = array();
$aStack = array($oFieldset->getMasterFieldId());
// first, key
foreach ($aFields as $oField) {
$aKeyedFields[$oField->getId()] = $oField;
}
while (!empty($aStack)) {
$iKey = array_shift($aStack);
// this shouldn't happen, but avoid it anyway.
if (!is_null($aKeyedFields[$iKey])) {
$aOrderedFields[] = $aKeyedFields[$iKey];
unset($aKeyedFields[$iKey]);
}
// add children to stack
$aStack = kt_array_merge($aStack, $aOrders[$iKey]);
}
$this->oPage->setBreadcrumbDetails(_kt('Manage complex conditional'));
$aTemplateData = array("context" => &$this, "fieldset_id" => $fieldset_id, "ordering" => $aOrders, "aFields" => $aOrderedFields, "iMasterFieldId" => $oFieldset->getMasterFieldId());
return $oTemplate->render($aTemplateData);
}
示例14: do_viewCategory
function do_viewCategory()
{
// are we categorised, or not?
$category = KTUtil::arrayGet($_REQUEST, 'fCategory', $this->category);
$oRegistry =& KTAdminNavigationRegistry::getSingleton();
$aCategory = $oRegistry->getCategory($category);
$aItems = $oRegistry->getItemsForCategory($category);
asort($aItems);
$this->aBreadcrumbs[] = array('name' => $aCategory['title'], 'url' => KTUtil::ktLink('admin.php', $category));
$this->oPage->title = _kt('DMS Administration') . ': ' . $aCategory['title'];
$oTemplating =& KTTemplating::getSingleton();
$oTemplate = $oTemplating->loadTemplate('kt3/admin_items');
$aTemplateData = array('context' => $this, 'category' => $aCategory, 'items' => $aItems, 'baseurl' => $_SERVER['PHP_SELF']);
return $oTemplate->render($aTemplateData);
}
示例15: delete
function delete($oDocument, $sReason, $iDestFolderId = null)
{
// use the deleteSymbolicLink function is this is a symlink
if ($oDocument->isSymbolicLink()) {
return KTDocumentUtil::deleteSymbolicLink($oDocument);
}
$oDocument =& KTUtil::getObject('Document', $oDocument);
if (is_null($iDestFolderId)) {
$iDestFolderId = $oDocument->getFolderID();
}
$oStorageManager =& KTStorageManagerUtil::getSingleton();
global $default;
if (count(trim($sReason)) == 0) {
return PEAR::raiseError(_kt('Deletion requires a reason'));
}
if (PEAR::isError($oDocument) || $oDocument == false) {
return PEAR::raiseError(_kt('Invalid document object.'));
}
if ($oDocument->getIsCheckedOut() == true) {
return PEAR::raiseError(sprintf(_kt('The document is checked out and cannot be deleted: %s'), $oDocument->getName()));
}
if (!KTWorkflowUtil::actionEnabledForDocument($oDocument, 'ktcore.actions.document.delete')) {
return PEAR::raiseError(_kt('Document cannot be deleted as it is restricted by the workflow.'));
}
// IF we're deleted ...
if ($oDocument->getStatusID() == DELETED) {
return true;
}
$oOrigFolder = Folder::get($oDocument->getFolderId());
DBUtil::startTransaction();
// flip the status id
$oDocument->setStatusID(DELETED);
// $iDestFolderId is DEPRECATED.
$oDocument->setFolderID(null);
$oDocument->setRestoreFolderId($oOrigFolder->getId());
$oDocument->setRestoreFolderPath(Folder::generateFolderIDs($oOrigFolder->getId()));
$res = $oDocument->update();
if (PEAR::isError($res) || $res == false) {
DBUtil::rollback();
return PEAR::raiseError(_kt('There was a problem deleting the document from the database.'));
}
// now move the document to the delete folder
$res = $oStorageManager->delete($oDocument);
if (PEAR::isError($res) || $res == false) {
//could not delete the document from the file system
$default->log->error('Deletion: Filesystem error deleting document ' . $oDocument->getFileName() . ' from folder ' . Folder::getFolderPath($oDocument->getFolderID()) . ' id=' . $oDocument->getFolderID());
// we use a _real_ transaction here ...
DBUtil::rollback();
/*
//reverse the document deletion
$oDocument->setStatusID(LIVE);
$oDocument->update();
*/
return PEAR::raiseError(_kt('There was a problem deleting the document from storage.'));
}
// get the user object
$oUser = User::get($_SESSION['userID']);
//delete all shortcuts linking to this document
$aSymlinks = $oDocument->getSymbolicLinks();
foreach ($aSymlinks as $aSymlink) {
$oShortcutDocument = Document::get($aSymlink['id']);
$oOwnerUser = User::get($oShortcutDocument->getOwnerID());
KTDocumentUtil::deleteSymbolicLink($aSymlink['id']);
//send an email to the owner of the shortcut
if ($oOwnerUser->getEmail() != null && $oOwnerUser->getEmailNotification() == true) {
$emailTemplate = new EmailTemplate("kt3/notifications/notification.SymbolicLinkDeleted", array('user_name' => $oUser->getName(), 'url' => KTUtil::ktLink(KTBrowseUtil::getUrlForDocument($oShortcutDocument)), 'title' => $oShortcutDocument->getName()));
$email = new EmailAlert($oOwnerUser->getEmail(), _kt("KnowledgeTree Notification"), $emailTemplate->getBody());
$email->send();
}
}
$oDocumentTransaction = new DocumentTransaction($oDocument, _kt('Document deleted: ') . $sReason, 'ktcore.transactions.delete');
$oDocumentTransaction->create();
$oDocument->setFolderID(1);
DBUtil::commit();
// we weren't doing notifications on this one
$oSubscriptionEvent = new SubscriptionEvent();
$oSubscriptionEvent->RemoveDocument($oDocument, $oOrigFolder);
// document is now deleted: triggers are best-effort.
$oKTTriggerRegistry = KTTriggerRegistry::getSingleton();
$aTriggers = $oKTTriggerRegistry->getTriggers('delete', 'postValidate');
foreach ($aTriggers as $aTrigger) {
$sTrigger = $aTrigger[0];
$oTrigger = new $sTrigger();
$aInfo = array('document' => $oDocument);
$oTrigger->setInfo($aInfo);
$ret = $oTrigger->postValidate();
if (PEAR::isError($ret)) {
$oDocument->delete();
// FIXME nbm: review that on-fail => delete is correct ?!
return $ret;
}
}
}