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); }
function do_main() { $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _kt('Archived Documents')); $this->oPage->setBreadcrumbDetails(_kt('browse')); $oFolder = Folder::get(KTUtil::arrayGet($_REQUEST, 'fFolderId', 1)); if (PEAR::isError($oFolder)) { $this->errorRedirectToMain(_kt('Invalid folder selected.')); exit(0); } // Setup the collection for restore display. $aBaseParams = array(); $collection = new AdvancedCollection(); $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'] = '_d[]'; $col->setOptions($aColOptions); $collection->addColumn($col); $col = $oCR->getColumn('ktcore.columns.title'); //$col->setOptions(array('qs_params'=>kt_array_merge($aBaseParams, array('action' => 'new', 'fFolderId'=>$oFolder->getId())))); $col->setOptions(array('link_documents' => false)); $collection->addColumn($col); //$qObj = new BrowseQuery($iFolderId); $qObj = new ArchivedBrowseQuery($oFolder->getId()); $collection->setQueryObject($qObj); $aOptions = $collection->getEnvironOptions(); $aOptions['result_url'] = KTUtil::addQueryString($_SERVER['PHP_SELF'], array(kt_array_merge($aBaseParams, array('fFolderId' => $oFolder->getId())))); $collection->setOptions($aOptions); $aURLParams = $aBaseParams; $aURLParams['action'] = 'restore'; $aBreadcrumbs = KTUtil::generate_breadcrumbs($oFolder, $iFolderId, $aURLParams); $aTemplateData = array('context' => $this, 'folder' => $oFolder, 'breadcrumbs' => $aBreadcrumbs, 'collection' => $collection); $oTemplate =& $this->oValidator->validateTemplate('ktcore/document/admin/archivebrowse'); return $oTemplate->render($aTemplateData); }