当前位置: 首页>>代码示例>>PHP>>正文


PHP KTUtil::addQueryStringSelf方法代码示例

本文整理汇总了PHP中KTUtil::addQueryStringSelf方法的典型用法代码示例。如果您正苦于以下问题:PHP KTUtil::addQueryStringSelf方法的具体用法?PHP KTUtil::addQueryStringSelf怎么用?PHP KTUtil::addQueryStringSelf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KTUtil的用法示例。


在下文中一共展示了KTUtil::addQueryStringSelf方法的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);
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:27,代码来源:advancedcolumns.inc.php

示例2: do_main

 function do_main()
 {
     $notifications = (array) KTNotification::getList(array("user_id = ?", $this->oUser->getId()));
     $num_notifications = count($notifications);
     $PAGE_SIZE = 5;
     $page = (int) KTUtil::arrayGet($_REQUEST, 'page', 0);
     $page_count = ceil($num_notifications / $PAGE_SIZE);
     if ($page >= $page_count) {
         $page = $page_count - 1;
     }
     if ($page < 0) {
         $page = 0;
     }
     // slice the notification array.
     $notifications = array_slice($notifications, $page * $PAGE_SIZE, $PAGE_SIZE);
     // prepare the batch html.  easier to do this here than in the template.
     $batch = array();
     for ($i = 0; $i < $page_count; $i++) {
         if ($i == $page) {
             $batch[] = sprintf("<strong>%d</strong>", $i + 1);
         } else {
             $batch[] = sprintf('<a href="%s">%d</a>', KTUtil::addQueryStringSelf($this->meldPersistQuery(array("page" => $i), "main", true)), $i + 1);
         }
     }
     $batch_html = implode(' &middot; ', $batch);
     $count_string = sprintf(_kt("Showing Notifications %d - %d of %d"), $page * $PAGE_SIZE + 1, min(($page + 1) * $PAGE_SIZE, $num_notifications), $num_notifications);
     $this->oPage->setTitle(_kt("Items that require your attention"));
     $oTemplate =& $this->oValidator->validateTemplate("ktcore/misc/notification_overflow");
     $oTemplate->setData(array('count_string' => $count_string, 'batch_html' => $batch_html, 'notifications' => $notifications));
     return $oTemplate->render();
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:31,代码来源:KTMiscPages.php

示例3: KTForm

 function &form_step1()
 {
     $oForm = new KTForm();
     $oForm->setOptions(array('action' => 'process_step1', 'cancel_url' => KTUtil::addQueryStringSelf(''), 'fail_action' => 'main', 'label' => _kt('Workflow Details'), 'submit_label' => _kt('Next'), 'description' => _kt('This first step requires that you provide basic details about the workflow: its name, etc.'), 'context' => $this));
     $oForm->setWidgets(array(array('ktcore.widgets.string', array('label' => _kt('Workflow Name'), 'description' => _kt('Each workflow must have a unique name.'), 'required' => true, 'name' => 'workflow_name')), array('ktcore.widgets.text', array('label' => _kt('States'), 'description' => _kt('As documents progress through their lifecycle, they pass through a number of <strong>states</strong>.  These states describe a step in the process the document must follow.  Examples of states include "reviewed","submitted" or "pending".  Please enter a list of states, one per line.  State names must be unique.'), 'important_description' => _kt('Note that the first state you list is the one in which documents will start the workflow - this can be changed later on. '), 'required' => true, 'name' => 'states', 'rows' => 15)), array('ktcore.widgets.text', array('label' => _kt('Transitions'), 'description' => _kt('In order to move between states, users will cause "transitions" to occur.  These transitions represent processes followed, e.g. "review document", "distribute invoice" or "publish".  Please enter a list of transitions, one per line.  Transition names must be unique.  You\'ll assign transitions to states in the next step.'), 'required' => false, 'name' => 'transitions')), array('ktcore.widgets.hidden', array('required' => false, 'name' => 'fWizardKey', 'value' => KTUtil::randomString()))));
     $oForm->setValidators(array(array('ktcore.validators.string', array('test' => 'workflow_name', 'output' => 'workflow_name')), array('ktcore.validators.string', array('test' => 'fWizardKey', 'output' => 'fWizardKey')), array('ktcore.validators.string', array('test' => 'states', 'output' => 'states', 'max_length' => 9999)), array('ktcore.validators.string', array('test' => 'transitions', 'output' => 'transitions', 'max_length' => 9999))));
     return $oForm;
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:8,代码来源:newworkflow.inc.php

示例4: breadcrumbsForDocument

 function breadcrumbsForDocument($oDocument, $aOptions = null, $iFolderId = null)
 {
     $bFinal = KTUtil::arrayGet($aOptions, 'final', true, false);
     $aOptions = KTUtil::meldOptions($aOptions, array('final' => false));
     if ($iFolderId == null) {
         $iFolderId = $oDocument->getFolderId();
     }
     $aBreadcrumbs = KTBrowseUtil::breadcrumbsForFolder($iFolderId, $aOptions);
     $sAction = KTUtil::arrayGet($aOptions, 'documentaction');
     $url = KTUtil::addQueryStringSelf('fDocumentId=' . $oDocument->getId());
     if (!empty($sAction)) {
         $url = generateControllerUrl($sAction, 'fDocumentId=' . $oDocument->getId());
     }
     if ($bFinal) {
         $aBreadcrumbs[] = array('name' => $oDocument->getName());
     } else {
         $aBreadcrumbs[] = array('url' => $url, 'name' => $oDocument->getName());
     }
     return $aBreadcrumbs;
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:20,代码来源:browseutil.inc.php

示例5: showUserSource

 function showUserSource($oUser, $oSource)
 {
     return '<a href="' . KTUtil::addQueryStringSelf('action=editUserSource&user_id=' . $oUser->getId()) . '">' . _kt('Edit LDAP info') . '</a>';
 }
开发者ID:DanielDobre,项目名称:fossology,代码行数:4,代码来源:ldapbaseauthenticationprovider.inc.php

示例6: 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']);
         }
     }
 }
开发者ID:jpbauer,项目名称:knowledgetree,代码行数:23,代码来源:KTColumns.inc.php

示例7: loginRequired

 function loginRequired()
 {
     $oKTConfig =& KTConfig::getSingleton();
     if ($oKTConfig->get('allowAnonymousLogin', false)) {
         // anonymous logins are now allowed.
         // the anonymous user is -1.
         //
         // we short-circuit the login mechanisms, setup the session, and go.
         $oUser =& User::get(-2);
         if (PEAR::isError($oUser) || $oUser->getName() != 'Anonymous') {
             // do nothing - the database integrity would break if we log the user in now.
         } else {
             $session = new Session();
             $sessionID = $session->create($oUser);
             $this->sessionStatus = $this->session->verify();
             if ($this->sessionStatus === true) {
                 return;
             }
         }
     }
     $sErrorMessage = "";
     if (PEAR::isError($this->sessionStatus)) {
         $sErrorMessage = $this->sessionStatus->getMessage();
     }
     // check if we're in JSON mode - in which case, throw error
     // but JSON mode only gets set later, so gonna have to check action
     if (KTUtil::arrayGet($_REQUEST, 'action', '') == 'json') {
         //$this->bJSONMode) {
         $this->handleOutputJSON(array('error' => true, 'type' => 'kt.not_logged_in', 'alert' => true, 'message' => _kt('Your session has expired, please log in again.')));
         exit(0);
     }
     // redirect to login with error message
     if ($sErrorMessage) {
         // session timed out
         $url = generateControllerUrl("login", "errorMessage=" . urlencode($sErrorMessage));
     } else {
         $url = generateControllerUrl("login");
     }
     $redirect = urlencode(KTUtil::addQueryStringSelf($_SERVER["QUERY_STRING"]));
     if (strlen($redirect) > 1) {
         global $default;
         $default->log->debug("checkSession:: redirect url={$redirect}");
         // this session verification failure represents either the first visit to
         // the site OR a session timeout etc. (in which case we still want to bounce
         // the user to the login page, and then back to whatever page they're on now)
         $url = $url . urlencode("&redirect=" . urlencode($redirect));
     }
     $default->log->debug("checkSession:: about to redirect to {$url}");
     redirect($url);
     exit(0);
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:51,代码来源:dispatcher.inc.php

示例8: do_resetPassword

 function do_resetPassword()
 {
     $email = $_REQUEST['email'];
     $user = $_REQUEST['username'];
     $password = $_REQUEST['password'];
     $confirm = $_REQUEST['confirm'];
     if (!($password == $confirm)) {
         return _kt('The passwords do not match, please re-enter them.');
     }
     $password = md5($password);
     // Get user from db
     $sQuery = 'SELECT id FROM users WHERE username = ? AND email = ?';
     $aParams = array($user, $email);
     $id = DBUtil::getOneResultKey(array($sQuery, $aParams), 'id');
     if (!is_numeric($id) || $id < 1) {
         //PEAR::isError($res) || is_null($res)){
         return _kt('Please check that you have entered a valid username and email address.');
     }
     // Check expiry
     $expiry = KTUtil::getSystemSetting('password_reset_expire-' . $id);
     if ($expiry < time()) {
         return _kt('The password reset key has expired, please send a new request.');
     }
     // Update password
     $res = DBUtil::autoUpdate('users', array('password' => $password), $id);
     if (PEAR::isError($res) || is_null($res)) {
         return _kt('Your password could not be reset, please try again.');
     }
     // Unset expiry date and key
     KTUtil::setSystemSetting('password_reset_expire-' . $id, '');
     KTUtil::setSystemSetting('password_reset_key-' . $id, '');
     // Email confirmation
     $url = KTUtil::addQueryStringSelf('');
     $subject = APP_NAME . ': ' . _kt('password successfully reset');
     $body = '<dd><p>';
     $body .= _kt('Your password has been successfully reset, click the link below to login.');
     $body .= "</p><p><a href = '{$url}'>" . _kt('Login') . '</a></p></dd>';
     $oEmail = new Email();
     $res = $oEmail->send($email, $subject, $body);
     if ($res === true) {
         return _kt('Your password has been successfully reset.');
     }
     return _kt('An error occurred while sending the email, please try again or contact the System Administrator.');
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:44,代码来源:loginResetDispatcher.php

示例9: do_performEditSourceProvider

 function do_performEditSourceProvider()
 {
     $oSource =& KTAuthenticationSource::get($_REQUEST['source_id']);
     $sProvider = $oSource->getAuthenticationProvider();
     $oRegistry =& KTAuthenticationProviderRegistry::getSingleton();
     $oProvider =& $oRegistry->getAuthenticationProvider($sProvider);
     $this->aBreadcrumbs[] = array('name' => $oSource->getName(), 'url' => KTUtil::addQueryStringSelf("source_id=" . $oSource->getId()));
     $oProvider->subDispatch($this);
     exit(0);
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:10,代码来源:authenticationadminpage.inc.php

示例10: do_oldSearchResults

 function do_oldSearchResults()
 {
     // call the results sorting function in case of sort options selected
     search2QuerySort(stripslashes($_GET['sort_on']), stripslashes($_GET['sort_order']));
     $this->oPage->setBreadcrumbDetails(_kt("Search Results"));
     $this->oPage->title = _kt("Search Results");
     $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', 'direct_folder' => true);
     $collection->setColumnOptions('ktcore.columns.title', $aTitleOptions);
     // set the selection options
     $collection->setColumnOptions('ktcore.columns.selection', array('rangename' => 'selection', 'show_folders' => true, 'show_documents' => true));
     $aOptions = $collection->getEnvironOptions();
     // extract data from the environment
     $aOptions['empty_message'] = _kt("No documents or folders match this query.");
     $aOptions['is_browse'] = true;
     $aOptions['return_url'] = KTUtil::addQueryStringSelf("action=oldSearchResults");
     $collection->setOptions($aOptions);
     $collection->setQueryObject(new Search2Query());
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate("kt3/browse");
     $aTemplateData = array("context" => $this, "collection" => $collection, 'isEditable' => true, 'bulkactions' => KTBulkActionUtil::getAllBulkActions(), 'browseutil' => new KTBrowseUtil(), 'returnaction' => 'search2');
     return $oTemplate->render($aTemplateData);
 }
开发者ID:jpbauer,项目名称:knowledgetree,代码行数:27,代码来源:search2.php

示例11: _actionhelper

 function _actionhelper($aActionTuple)
 {
     $aTuple = array("label" => $aActionTuple["name"]);
     if ($aActionTuple["action"]) {
         $aTuple["url"] = generateControllerLink($aActionTuple["action"], $aActionTuple["query"]);
     } else {
         if ($aActionTuple["url"]) {
             $sUrl = $aActionTuple["url"];
             $sQuery = KTUtil::arrayGet($aActionTuple, 'query');
             if ($sQuery) {
                 $sUrl = KTUtil::addQueryString($sUrl, $sQuery);
             }
             $aTuple["url"] = $sUrl;
         } else {
             if ($aActionTuple["query"]) {
                 $aTuple['url'] = KTUtil::addQueryStringSelf($aActionTuple["query"]);
             } else {
                 $aTuple["url"] = false;
             }
         }
     }
     return $aTuple;
 }
开发者ID:jpbauer,项目名称:knowledgetree,代码行数:23,代码来源:kt3template.inc.php

示例12: do_performaction

    function do_performaction()
    {
        // Get reason for checkout & check if docs must be downloaded
        $this->store_lists();
        $this->get_lists();
        $oForm = $this->form_collectinfo();
        $res = $oForm->validate();
        if (!empty($res['errors'])) {
            $oForm->handleError();
        }
        $this->sReason = $_REQUEST['data']['reason'];
        $this->bDownload = $_REQUEST['data']['download_file'];
        $oKTConfig =& KTConfig::getSingleton();
        $this->bNoisy = $oKTConfig->get("tweaks/noisyBulkOperations");
        $folderurl = KTBrowseUtil::getUrlForFolder($this->oFolder);
        $sReturn = sprintf('<p>' . _kt('Return to the original <a href="%s">folder</a>') . "</p>\n", $folderurl);
        $this->startTransaction();
        // if files are to be downloaded - create the temp directory for the bulk export
        if ($this->bDownload) {
            $folderName = $this->oFolder->getName();
            $this->oZip = new ZipFolder($folderName);
            $res = $this->oZip->checkConvertEncoding();
            if (PEAR::isError($res)) {
                $this->addErrorMessage($res->getMessage());
                return $sReturn;
            }
        }
        $result = parent::do_performaction();
        if (PEAR::isError($result)) {
            $this->addErrorMessage($result->getMessage());
            return $sReturn;
        }
        if ($this->bDownload) {
            $sExportCode = $this->oZip->createZipFile();
            if (PEAR::isError($sExportCode)) {
                $this->addErrorMessage($sExportCode->getMessage());
                return $sReturn;
            }
        }
        $this->commitTransaction();
        if ($this->bDownload) {
            $url = KTUtil::addQueryStringSelf(sprintf('action=downloadZipFile&fFolderId=%d&exportcode=%s', $this->oFolder->getId(), $sExportCode));
            $str = sprintf('<p>' . _kt('Go <a href="%s">here</a> to download the zip file if you are not automatically redirected there') . "</p>\n", $url);
            $folderurl = KTBrowseUtil::getUrlForFolder($this->oFolder);
            $str .= sprintf('<p>' . _kt('Once downloaded, return to the original <a href="%s">folder</a>') . "</p>\n", $folderurl);
            $str .= sprintf("</div></div></body></html>\n");
            $str .= sprintf('<script language="JavaScript">
                    function kt_bulkexport_redirect() {
                        document.location.href = "%s";
                    }
                    callLater(1, kt_bulkexport_redirect);

                    </script>', $url);
            return $str;
        }
        return $result;
    }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:57,代码来源:KTBulkActions.php

示例13: do_main

 function do_main()
 {
     $aErrorOptions = array("message" => _kt("Please provide a search term"));
     $searchable_text = sanitizeForSQL(KTUtil::arrayGet($_REQUEST, "fSearchableText"));
     $this->oValidator->notEmpty($searchable_text, $aErrorOptions);
     $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', 'direct_folder' => true);
     $collection->setColumnOptions('ktcore.columns.title', $aTitleOptions);
     // set the selection options
     $collection->setColumnOptions('ktcore.columns.selection', array('rangename' => 'selection', 'show_folders' => true, 'show_documents' => true));
     $aOptions = $collection->getEnvironOptions();
     // extract data from the environment
     $aOptions['return_url'] = KTUtil::addQueryStringSelf("fSearchableText=" . urlencode($searchable_text));
     $aOptions['empty_message'] = _kt("No documents or folders match this query.");
     $aOptions['is_browse'] = true;
     $collection->setOptions($aOptions);
     $collection->setQueryObject(new SimpleSearchQuery($searchable_text));
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate("kt3/browse");
     $aTemplateData = array("context" => $this, "collection" => $collection, 'isEditable' => true, 'bulkactions' => KTBulkActionUtil::getAllBulkActions(), 'browseutil' => new KTBrowseUtil(), 'returnaction' => 'simpleSearch', 'returndata' => $searchable_text);
     return $oTemplate->render($aTemplateData);
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:26,代码来源:simpleSearch.php

示例14: do_graphrepresentation

 function do_graphrepresentation()
 {
     $oTemplate = $this->oValidator->validateTemplate('ktcore/workflow/admin/graphrep');
     // this is not ideal
     // is there no way to get graphviz to give us this more "usefully"
     $graph = $this->get_graph($this->oWorkflow);
     $rdata = $graph['graph']->fetch("imap");
     // we can skip some of this.
     $data = explode("\n", $rdata);
     $data = array_slice($data, 1, -1);
     if (false) {
         print '<pre>';
         print print_r($data, true);
         exit(0);
     }
     $pat = '|^([\\w]+).    # rect, circle, etc.
         ([^ ]+).       # href
         ([\\d]+),        # x0
         ([\\d]+).         # x1
         ([\\d]+),        # y0
         ([\\d]+)         # y1
     |x';
     $coords = array();
     foreach ($data as $row) {
         $matches = array();
         if (preg_match($pat, $row, $matches)) {
             $rowdata = array_slice($matches, 1);
             list($shape, $href, $x0, $y0, $x1, $y1) = $rowdata;
             // FIXME sanity check, we only handle "rect"
             $real_href = null;
             $m = array();
             $alt = null;
             if (preg_match('|^(\\w)([\\d]+)$|', $href, $m)) {
                 if ($m[1] == 's') {
                     $real_href = KTUtil::addQueryStringSelf($this->meldPersistQuery(array('fStateId' => $m[2]), "editstate"));
                     $alt = sprintf('Edit State "%s"', $this->state_names[$m[2]]);
                 } else {
                     $real_href = KTUtil::addQueryStringSelf($this->meldPersistQuery(array('fTransitionId' => $m[2]), "edittransition"));
                     $alt = sprintf('Edit Transition "%s"', $this->transition_names[$m[2]]);
                 }
             }
             $coords[] = array('shape' => $shape, 'href' => $real_href, 'coords' => sprintf("%d,%d,%d,%d", $x0, $y0, $x1, $y1), 'alt' => $alt);
         }
     }
     if (false) {
         print '<pre>';
         var_dump($coords);
         exit(0);
     }
     $oTemplate->setData(array('context' => $this, 'coords' => $coords));
     print $oTemplate->render();
     exit(0);
 }
开发者ID:jpbauer,项目名称:knowledgetree,代码行数:53,代码来源:workflowsv2.php

示例15: do_main

    function do_main()
    {
        $config = KTConfig::getSingleton();
        $useQueue = $config->get('export/useDownloadQueue', true);
        // Create the export code
        $exportCode = KTUtil::randomString();
        $this->oZip = new ZipFolder('', $exportCode);
        if (!$this->oZip->checkConvertEncoding()) {
            redirect(KTBrowseUtil::getUrlForFolder($this->oFolder));
            exit(0);
        }
        $bNoisy = $config->get("tweaks/noisyBulkOperations");
        $bNotifications = $config->get('export/enablenotifications', 'on') == 'on' ? true : false;
        $sCurrentFolderId = $this->oFolder->getId();
        $url = KTUtil::addQueryStringSelf(sprintf('action=downloadZipFile&fFolderId=%d&exportcode=%s', $sCurrentFolderId, $exportCode));
        $folderurl = KTBrowseUtil::getUrlForFolder($this->oFolder);
        if ($useQueue) {
            DownloadQueue::addItem($exportCode, $sCurrentFolderId, $sCurrentFolderId, 'folder');
            $task_url = KTUtil::kt_url() . '/bin/ajaxtasks/downloadTask.php';
            $oTemplating =& KTTemplating::getSingleton();
            $oTemplate = $oTemplating->loadTemplate('ktcore/action/bulk_download');
            $aParams = array('folder_url' => $folderurl, 'url' => $task_url, 'code' => $exportCode, 'download_url' => $url);
            return $oTemplate->render($aParams);
        }
        // Get all folders and sub-folders
        $sWhereClause = "parent_folder_ids = '{$sCurrentFolderId}' OR\n        parent_folder_ids LIKE '{$sCurrentFolderId},%' OR\n        parent_folder_ids LIKE '%,{$sCurrentFolderId},%' OR\n        parent_folder_ids LIKE '%,{$sCurrentFolderId}'";
        $aFolderList = $this->oFolder->getList($sWhereClause);
        // Get any folder shortcuts within the folders
        $aLinkedFolders = KTBulkAction::getLinkingEntities($aFolderList);
        $aFolderList = array_merge($aFolderList, $aLinkedFolders);
        // Add the folders to the zip file
        $aFolderObjects = array($sCurrentFolderId => $this->oFolder);
        if (!empty($aFolderList)) {
            foreach ($aFolderList as $oFolderItem) {
                $itemId = $oFolderItem->getId();
                $linkedFolder = $oFolderItem->getLinkedFolderId();
                // If the folder has been added or is a shortcut then skip
                // The shortcut folders don't need to be added as their targets will be added.
                if (array_key_exists($itemId, $aFolderObjects) || !empty($linkedFolder)) {
                    continue;
                }
                $this->oZip->addFolderToZip($oFolderItem);
                $aFolderObjects[$oFolderItem->getId()] = $oFolderItem;
            }
        }
        // Get the list of folder ids
        $aFolderIds = array_keys($aFolderObjects);
        // Get all documents in the folder list
        $aQuery = $this->buildQuery($aFolderIds);
        $aDocumentIds = DBUtil::getResultArrayKey($aQuery, 'id');
        if (PEAR::isError($aDocumentIds)) {
            $this->addErrorMessage(_kt('There was a problem exporting the documents: ') . $aDocumentIds->getMessage());
            redirect(KTBrowseUtil::getUrlForFolder($this->oFolder));
            exit(0);
        }
        // Redirect if there are no documents and no folders to export
        if (empty($aDocumentIds) && empty($aFolderList)) {
            $this->addErrorMessage(_kt("No documents found to export"));
            redirect(KTBrowseUtil::getUrlForFolder($this->oFolder));
            exit(0);
        }
        $this->oPage->template = "kt3/minimal_page";
        $this->handleOutput("");
        // Add the documents to the zip file
        if (!empty($aDocumentIds)) {
            foreach ($aDocumentIds as $iId) {
                $oDocument = Document::get($iId);
                $sFolderId = $oDocument->getFolderID();
                if (!KTWorkflowUtil::actionEnabledForDocument($oDocument, 'ktcore.actions.document.view')) {
                    $this->addErrorMessage($oDocument->getName() . ': ' . _kt('Document cannot be exported as it is restricted by the workflow.'));
                    continue;
                }
                $oFolder = isset($aFolderObjects[$sFolderId]) ? $aFolderObjects[$sFolderId] : Folder::get($sFolderId);
                if ($bNoisy) {
                    $oDocumentTransaction =& new DocumentTransaction($oDocument, "Document part of bulk export", 'ktstandard.transactions.bulk_export', array());
                    $oDocumentTransaction->create();
                }
                // fire subscription alerts for the downloaded document
                if ($bNotifications) {
                    //$oSubscriptionEvent = new SubscriptionEvent();
                    //$oSubscriptionEvent->DownloadDocument($oDocument, $oFolder);
                }
                $this->oZip->addDocumentToZip($oDocument, $oFolder);
            }
        }
        $sExportCode = $this->oZip->createZipFile(TRUE);
        $oTransaction = KTFolderTransaction::createFromArray(array('folderid' => $this->oFolder->getId(), 'comment' => "Bulk export", 'transactionNS' => 'ktstandard.transactions.bulk_export', 'userid' => $_SESSION['userID'], 'ip' => Session::getClientIP()));
        $sReturn = '<p>' . _kt('Creating zip file. Compressing and archiving in progress ...') . '</p>';
        $sReturn .= "<p style='margin-bottom: 10px;'><br /><b>" . _kt('Warning! Please wait for archiving to complete before closing the page.') . '</b><br />' . _kt('Note: Closing the page before the download link displays will cancel your Bulk Download.') . '</p>';
        $sReturn .= '<p>' . _kt('Once your download is complete, click <a href="' . $folderurl . '">here</a> to return to the original folder') . "</p>\n";
        print $sReturn;
        printf("</div></div></body></html>\n");
        printf('<script language="JavaScript">
                function kt_bulkexport_redirect() {
                    document.location.href = "%s";
                }
                callLater(2, kt_bulkexport_redirect);

                </script>', $url);
        exit(0);
//.........这里部分代码省略.........
开发者ID:jpbauer,项目名称:knowledgetree,代码行数:101,代码来源:KTBulkExportPlugin.php


注:本文中的KTUtil::addQueryStringSelf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。