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


PHP KTUtil类代码示例

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


在下文中一共展示了KTUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderData

 function renderData($aDataRow)
 {
     // only _ever_ show this for documents.
     if ($aDataRow["type"] === "folder") {
         return ' ';
     }
     $sUrl = KTUtil::kt_url() . '/' . $this->sPluginPath . '/documentPreview.php';
     $sDir = KT_DIR;
     $iDelay = 1000;
     // milliseconds
     $iDocumentId = $aDataRow['document']->getId();
     $sTitle = _kt('Property Preview');
     $sLoading = _kt('Loading...');
     $width = 500;
     // Check for existence of thumbnail plugin
     if (KTPluginUtil::pluginIsActive('thumbnails.generator.processor.plugin')) {
         // hook into thumbnail plugin to get display for thumbnail
         include_once KT_DIR . '/plugins/thumbnails/thumbnails.php';
         $thumbnailer = new ThumbnailViewlet();
         $thumbnailwidth = $thumbnailer->get_width($iDocumentId);
         $width += $thumbnailwidth + 30;
     }
     //$link = '<a name = "ktP'.$iDocumentId.'" href = "#ktP'.$iDocumentId.'" class="ktAction ktPreview" id = "box_'.$iDocumentId.'" ';
     $link = '<a href = "#browseForm" class="ktAction ktPreview" id = "box_' . $iDocumentId . '" ';
     if ($this->sActivation == 'mouse-over') {
         $sJs = "javascript: this.t = setTimeout('showInfo(\\'{$iDocumentId}\\', \\'{$sUrl}\\', \\'{$sDir}\\', \\'{$sLoading}\\', {$width})', {$iDelay});";
         $link .= 'onmouseover = "' . $sJs . '" onmouseout = "clearTimeout(this.t);">';
     } else {
         $sJs = "javascript: showInfo('{$iDocumentId}', '{$sUrl}', '{$sDir}', '{$sLoading}', {$width});";
         $link .= 'onclick = "' . $sJs . '" title="' . $sTitle . '">';
     }
     return $link . $sTitle . '</a>';
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:33,代码来源:documentPreviewPlugin.php

示例2: synchroniseGroupToSource

 function synchroniseGroupToSource($oGroup)
 {
     $oGroup =& KTUtil::getObject('Group', $oGroup);
     $iSourceId = $oGroup->getAuthenticationSourceId();
     $oAuthenticator = KTAuthenticationUtil::getAuthenticatorForSource($iSourceId);
     return $oAuthenticator->synchroniseGroup($oGroup);
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:7,代码来源:authenticationutil.inc.php

示例3: isRegistered

 function isRegistered($sName)
 {
     if (KTUtil::arrayGet($this->aResources, $sName)) {
         return true;
     }
     return false;
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:7,代码来源:KTAdminNavigation.php

示例4: KTFieldsetDisplayRegistry

 function &getSingleton()
 {
     if (!KTUtil::arrayGet($GLOBALS, 'oKTFieldsetDisplayRegistry')) {
         $GLOBALS['oKTFieldsetDisplayRegistry'] = new KTFieldsetDisplayRegistry();
     }
     return $GLOBALS['oKTFieldsetDisplayRegistry'];
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:7,代码来源:FieldsetDisplayRegistry.inc.php

示例5: check

 function check()
 {
     $this->checkOpenOffice();
     $this->checkLucene();
     $this->checkDF();
     KTUtil::setSystemSetting('externalResourceIssues', serialize($this->resources));
 }
开发者ID:jpbauer,项目名称:knowledgetree,代码行数:7,代码来源:cronResources.php

示例6: do_checkin

 function do_checkin()
 {
     global $default;
     $document_id = KTUtil::arrayGet($_REQUEST, 'fDocumentId');
     if (empty($document_id)) {
         return $this->errorRedirectToMain(_kt('You must select a document to check in first.'));
     }
     $oDocument = Document::get($document_id);
     if (PEAR::isError($oDocument)) {
         return $this->errorRedirectToMain(_kt('The document you specified appears to be invalid.'));
     }
     $this->startTransaction();
     // actually do the checkin.
     $oDocument->setIsCheckedOut(0);
     $oDocument->setCheckedOutUserID(-1);
     if (!$oDocument->update()) {
         $this->rollbackTransaction();
         return $this->errorRedirectToMain(_kt("Failed to force the document's checkin."));
     }
     // checkout cancelled transaction
     $oDocumentTransaction =& new DocumentTransaction($oDocument, _kt('Document checked out cancelled'), 'ktcore.transactions.force_checkin');
     $res = $oDocumentTransaction->create();
     if (PEAR::isError($res) || $res == false) {
         $this->rollbackTransaction();
         return $this->errorRedirectToMain(_kt("Failed to force the document's checkin."));
     }
     $this->commitTransaction();
     // FIXME do we want to do this if we can't created the document-transaction?
     return $this->successRedirectToMain(sprintf(_kt('Successfully forced "%s" to be checked in.'), $oDocument->getName()));
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:30,代码来源:documentCheckout.php

示例7: KTCache

 function KTCache()
 {
     require_once "Cache/Lite.php";
     require_once KT_LIB_DIR . '/config/config.inc.php';
     $aOptions = array();
     $oKTConfig = KTConfig::getSingleton();
     $this->bEnabled = $oKTConfig->get('cache/cacheEnabled', false);
     if (empty($this->bEnabled)) {
         return;
     }
     $aOptions['cacheDir'] = $oKTConfig->get('cache/cacheDirectory') . "/";
     $user = KTUtil::running_user();
     if ($user) {
         $aOptions['cacheDir'] .= $user . '/';
     }
     if (!file_exists($aOptions['cacheDir'])) {
         mkdir($aOptions['cacheDir']);
     }
     // See thirdparty/pear/Cache/Lite.php to customize cache
     $aOptions['lifeTime'] = 60;
     $aOptions['memoryCaching'] = true;
     $aOptions['automaticSerialization'] = true;
     /* Patched line */
     // Disable fileCaching (when cache > 5Mo)
     $aOptions['onlyMemoryCaching'] = true;
     $this->cacheDir = $aOptions['cacheDir'];
     $this->oLite = new Cache_Lite($aOptions);
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:28,代码来源:cache.inc.php

示例8: KTFieldsetRegistry

 function &getSingleton()
 {
     if (!KTUtil::arrayGet($GLOBALS['_KT_PLUGIN'], 'oKTFieldsetRegistry')) {
         $GLOBALS['_KT_PLUGIN']['oKTFieldsetRegistry'] = new KTFieldsetRegistry();
     }
     return $GLOBALS['_KT_PLUGIN']['oKTFieldsetRegistry'];
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:7,代码来源:fieldsetregistry.inc.php

示例9: render

 function render()
 {
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate('ktcore/search2/lucene_migration');
     $config = KTConfig::getSingleton();
     $batchDocuments = $config->get('indexer/batchMigrateDocuments');
     $migratedDocuments = KTUtil::getSystemSetting('migratedDocuments', 0);
     $migratingDocuments = $this->migratingDocuments;
     $migrationStart = KTUtil::getSystemSetting('migrationStarted');
     if (is_null($migrationStart)) {
         $migrationStartString = _kt('Not started');
         $migrationPeriod = _kt('N/A');
         $estimatedTime = _kt('Unknown');
         $estimatedPeriod = $estimatedTime;
     } else {
         $migrationStartString = date('Y-m-d H:i:s', $migrationStart);
         $migrationTime = KTUtil::getSystemSetting('migrationTime', 0);
         $migrationPeriod = KTUtil::computePeriod($migrationTime, '');
         // Cannot divide by zero so make it 1
         $divMigratedDocuments = $migratedDocuments > 0 ? $migratedDocuments : 1;
         $timePerDocument = $migrationTime / $divMigratedDocuments;
         $estimatedPeriod = $timePerDocument * $migratingDocuments;
         $estimatedTime = date('Y-m-d H:i:s', $migrationStart + $estimatedPeriod);
         $estimatedPeriod = KTUtil::computePeriod($estimatedPeriod, '');
     }
     $aTemplateData = array('context' => $this, 'batchDocuments' => $batchDocuments, 'batchPeriod' => 'Periodically', 'migrationStart' => $migrationStartString, 'migrationPeriod' => $migrationPeriod, 'migratedDocuments' => $migratedDocuments, 'migratingDocuments' => $migratingDocuments, 'estimatedTime' => $estimatedTime, 'estimatedPeriod' => $estimatedPeriod);
     return $oTemplate->render($aTemplateData);
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:28,代码来源:MigrationDashlet.php

示例10: do_main

 function do_main()
 {
     $this->oPage->setBreadcrumbDetails(_kt("transactions"));
     $this->oPage->setTitle(_kt('Folder transactions'));
     $folder_data = array();
     $folder_data["folder_id"] = $this->oFolder->getId();
     $this->oPage->setSecondaryTitle($this->oFolder->getName());
     $aTransactions = array();
     // FIXME do we really need to use a raw db-access here?  probably...
     $sQuery = "SELECT DTT.name AS transaction_name, FT.transaction_namespace, U.name AS user_name, FT.comment AS comment, FT.datetime AS datetime " . "FROM " . KTUtil::getTableName("folder_transactions") . " AS FT LEFT JOIN " . KTUtil::getTableName("users") . " AS U ON FT.user_id = U.id " . "LEFT JOIN " . KTUtil::getTableName("transaction_types") . " AS DTT ON DTT.namespace = FT.transaction_namespace " . "WHERE FT.folder_id = ? ORDER BY FT.datetime DESC";
     $aParams = array($this->oFolder->getId());
     $res = DBUtil::getResultArray(array($sQuery, $aParams));
     if (PEAR::isError($res)) {
         var_dump($res);
         // FIXME be graceful on failure.
         exit(0);
     }
     // FIXME roll up view transactions
     $aTransactions = $res;
     // Set the namespaces where not in the transactions lookup
     foreach ($aTransactions as $key => $transaction) {
         if (empty($transaction['transaction_name'])) {
             $aTransactions[$key]['transaction_name'] = $this->_getActionNameForNamespace($transaction['transaction_namespace']);
         }
     }
     // render pass.
     $this->oPage->title = _kt("Folder History");
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate("kt3/view_folder_history");
     $aTemplateData = array("context" => $this, "folder_id" => $folder_id, "folder" => $this->oFolder, "transactions" => $aTransactions);
     return $oTemplate->render($aTemplateData);
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:32,代码来源:Transactions.php

示例11: do_rename

 function do_rename()
 {
     $aErrorOptions = array('redirect_to' => array('', sprintf('fFolderId=%d', $this->oFolder->getId())));
     $sFolderName = KTUtil::arrayGet($_REQUEST, 'foldername');
     $aErrorOptions['defaultmessage'] = _kt("No folder name given");
     $sFolderName = $this->oValidator->validateString($sFolderName, $aErrorOptions);
     $sFolderName = $this->oValidator->validateIllegalCharacters($sFolderName, $aErrorOptions);
     $sOldFolderName = $this->oFolder->getName();
     if ($this->oFolder->getId() != 1) {
         $oParentFolder =& Folder::get($this->oFolder->getParentID());
         if (PEAR::isError($oParentFolder)) {
             $this->errorRedirectToMain(_kt('Unable to retrieve parent folder.'), $aErrorOptions['redirect_to'][1]);
             exit(0);
         }
         if (KTFolderUtil::exists($oParentFolder, $sFolderName)) {
             $this->errorRedirectToMain(_kt('A folder with that name already exists.'), $aErrorOptions['redirect_to'][1]);
             exit(0);
         }
     }
     $res = KTFolderUtil::rename($this->oFolder, $sFolderName, $this->oUser);
     if (PEAR::isError($res)) {
         $_SESSION['KTErrorMessage'][] = $res->getMessage();
         redirect(KTBrowseUtil::getUrlForFolder($this->oFolder));
         exit(0);
     } else {
         $_SESSION['KTInfoMessage'][] = sprintf(_kt('Folder "%s" renamed to "%s".'), $sOldFolderName, $sFolderName);
     }
     $this->commitTransaction();
     redirect(KTBrowseUtil::getUrlForFolder($this->oFolder));
     exit(0);
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:31,代码来源:Rename.php

示例12: KTNotificationRegistry

 static function &getSingleton()
 {
     if (!KTUtil::arrayGet($GLOBALS['_KT_PLUGIN'], 'oKTNotificationRegistry')) {
         $GLOBALS['_KT_PLUGIN']['oKTNotificationRegistry'] = new KTNotificationRegistry();
     }
     return $GLOBALS['_KT_PLUGIN']['oKTNotificationRegistry'];
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:7,代码来源:NotificationRegistry.inc.php

示例13: 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

示例14: do_update

 function do_update()
 {
     $sTable = KTUtil::getTableName('plugins');
     $aIds = (array) KTUtil::arrayGet($_REQUEST, 'pluginids');
     // Update disabled plugins
     $sIds = implode(',', $aIds);
     $sQuery = "UPDATE {$sTable} SET disabled = 1 WHERE id NOT IN ({$sIds})";
     DBUtil::runQuery(array($sQuery));
     // Select disabled plugins that have been enabled
     $sQuery = "SELECT * FROM {$sTable} WHERE disabled = 1 AND id IN ({$sIds})";
     $res = DBUtil::getResultArray($sQuery);
     if (!PEAR::isError($res)) {
         // Enable the disabled plugins
         $sQuery = "UPDATE {$sTable} SET disabled = 0 WHERE id IN ({$sIds})";
         DBUtil::runQuery(array($sQuery));
         // run setup for each plugin
         $aEnabled = array();
         if (!empty($res)) {
             foreach ($res as $item) {
                 $aEnabled[] = $item['id'];
             }
             $sEnabled = implode(',', $aEnabled);
             $sQuery = "SELECT h.classname, h.pathname FROM {$sTable} p\n                    INNER JOIN plugin_helper h ON (p.namespace = h.plugin)\n                    WHERE classtype = 'plugin' AND p.id IN ({$sEnabled})";
             $res = DBUtil::getResultArray($sQuery);
             if (!PEAR::isError($res)) {
                 foreach ($res as $item) {
                     $classname = $item['classname'];
                     $path = $item['pathname'];
                     if (!empty($path)) {
                         require_once $path;
                     }
                     $oPlugin = new $classname($path);
                     $oPlugin->setup();
                 }
             }
         }
     }
     KTPluginEntity::clearAllCaches();
     // FIXME!!! Plugin manager needs to be updated to deal with this situation. This code should be in the plugin.
     //enabling or disabling Tag fieldset depending on whether tag cloud plugin is enabled or disabled.
     //Get tag cloud object
     $oTagClouPlugin = KTPluginEntity::getByNamespace('ktcore.tagcloud.plugin');
     if (!PEAR::isError($oTagClouPlugin) && !is_a($oTagClouPlugin, 'KTEntityNoObjects') && !is_null($oTagClouPlugin)) {
         if ($oTagClouPlugin->getDisabled() == '1') {
             //disable tag fieldset
             $aFV = array('disabled' => true);
             $aWFV = array('namespace' => 'tagcloud');
             $res = DBUtil::whereUpdate('fieldsets', $aFV, $aWFV);
         } else {
             //enable tag fieldset
             $aFV = array('disabled' => false);
             $aWFV = array('namespace' => 'tagcloud');
             $res = DBUtil::whereUpdate('fieldsets', $aFV, $aWFV);
         }
     }
     // we reregister the plugins to ensure they are in the correct order
     KTPluginUtil::registerPlugins();
     $this->successRedirectToMain(_kt('Plugins updated'));
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:59,代码来源:plugins.php

示例15: __construct

 public function __construct()
 {
     $config = KTConfig::getSingleton();
     $this->unzip = KTUtil::findCommand("import/unzip", 'unzip');
     $this->unzip = str_replace('\\', '/', $this->unzip);
     $this->unzip_params = $config->get('extractorParameters/unzip', '"{source}" "{part}" -d "{target_dir}"');
     parent::__construct();
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:8,代码来源:OpenOfficeTextExtractor.inc.php


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