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


PHP KTUtil::arrayGet方法代码示例

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


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

示例1: KTFieldsetDisplayRegistry

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

 function do_assign_handler()
 {
     $oKTTriggerRegistry = KTTriggerRegistry::getSingleton();
     $aTriggers = $oKTTriggerRegistry->getTriggers('workflow', 'objectModification');
     $selection_ns = KTUtil::arrayGet($_REQUEST, 'selection_ns');
     if (empty($selection_ns)) {
         $sQuery = 'DELETE FROM ' . KTUtil::getTableName('trigger_selection');
         $sQuery .= ' WHERE event_ns = ?';
         $aParams = array('ktstandard.workflowassociation.handler');
         DBUtil::runQuery(array($sQuery, $aParams));
         $this->successRedirectToMain(_kt('Handler removed.'));
     } else {
         if (!array_key_exists($selection_ns, $aTriggers)) {
             $this->errorRedirectToMain(_kt('Invalid assignment'));
         }
         // clear
         $sQuery = 'DELETE FROM ' . KTUtil::getTableName('trigger_selection');
         $sQuery .= ' WHERE event_ns = ?';
         $aParams = array('ktstandard.workflowassociation.handler');
         DBUtil::runQuery(array($sQuery, $aParams));
         // set
         $sQuery = 'INSERT INTO ' . KTUtil::getTableName('trigger_selection');
         $sQuery .= ' (event_ns, selection_ns)';
         $sQuery .= ' VALUES ("ktstandard.workflowassociation.handler",?)';
         $aParams = array($selection_ns);
         DBUtil::runQuery(array($sQuery, $aParams));
         $this->successRedirectToMain(_kt('Handler set.'));
     }
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:29,代码来源:adminpage.php

示例4: isRegistered

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

示例5: KTTriggerRegistry

 static function &getSingleton()
 {
     if (!KTUtil::arrayGet($GLOBALS['_KT_PLUGIN'], 'oKTTriggerRegistry')) {
         $GLOBALS['_KT_PLUGIN']['oKTTriggerRegistry'] = new KTTriggerRegistry();
     }
     return $GLOBALS['_KT_PLUGIN']['oKTTriggerRegistry'];
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:7,代码来源:triggerregistry.inc.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: 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

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

示例9: unserialize

 function &retrieveList($sCode)
 {
     $sList = KTUtil::arrayGet($_SESSION['ktentitylists'], $sCode, False);
     if ($sList === False) {
         return PEAR::raiseError(_kt('No such KTEntityList'));
     }
     $oList = unserialize($sList);
     return $oList;
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:9,代码来源:entitylist.php

示例10: renderDocumentLink

 function renderDocumentLink($aDataRow)
 {
     $aOptions = $this->getOptions();
     $fParentDocId = KTUtil::arrayGet(KTUtil::arrayGet($aOptions, 'qs_params', array()), 'fDocumentId', False);
     if ((int) $aDataRow["document"]->getId() === (int) $fParentDocId) {
         return htmlentities($aDataRow["document"]->getName(), ENT_QUOTES, 'UTF-8') . ' <span class="descriptiveText">(' . _kt('you cannot link to the source document') . ')';
     } else {
         return parent::renderDocumentLink($aDataRow);
     }
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:10,代码来源:KTDocumentLinksColumns.php

示例11:

 function &getValidatorByNamespace($sNamespace)
 {
     $aInfo = KTUtil::arrayGet($this->validators, $sNamespace);
     if (empty($aInfo)) {
         return PEAR::raiseError(sprintf(_kt('No such validator: %s'), $sNamespace));
     }
     if (!empty($aInfo['file'])) {
         require_once $aInfo['file'];
     }
     return new $aInfo['class']();
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:11,代码来源:validatorfactory.inc.php

示例12: takeover

 function takeover()
 {
     $oRegistry =& KTPluginRegistry::getSingleton();
     $oPlugin =& $oRegistry->getPlugin('password.reset.plugin');
     $dispatcherURL = $oPlugin->getURLPath('loginResetDispatcher.php');
     $redirect = KTUtil::arrayGet($_REQUEST, 'redirect');
     $url = KTUtil::kt_url() . $dispatcherURL;
     $url .= !empty($redirect) ? '?redirect=' . $redirect : '';
     redirect($url);
     exit(0);
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:11,代码来源:passwordResetPlugin.php

示例13: do_main

 function do_main()
 {
     $clear_all = KTUtil::arrayGet($_REQUEST, 'clearAll');
     if ($clear_all) {
         return $this->clearAll();
     }
     // get the notification-handler, instantiate it, call resolveNotification.
     $oHandler =& $this->notification->getHandler();
     $oHandler->notification =& $this->notification;
     $oHandler->subDispatch($this);
     exit(0);
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:12,代码来源:notify.php

示例14: KTBulkImportManager

 function KTBulkImportManager($oFolder, $oStorage, $oUser, $aOptions = null)
 {
     $this->oFolder =& $oFolder;
     $this->oStorage =& $oStorage;
     $this->oUser =& $oUser;
     $this->aOptions =& $aOptions;
     if (is_null($aOptions)) {
         $aOptions = array();
     }
     $this->aMetadata = KTUtil::arrayGet($aOptions, 'metadata', array());
     $this->oDocumentType = KTUtil::arrayGet($aOptions, 'documenttype', null);
     // DocUtil::_add will do the right thing.
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:13,代码来源:bulkimport.inc.php

示例15: getPage

 function getPage($sPath)
 {
     $aInfo = KTUtil::arrayGet($this->aResources, $sPath);
     if (empty($aInfo)) {
         return null;
     }
     $sClassName = $aInfo[1];
     $sFilename = $aInfo[2];
     if ($sFilename) {
         require_once $sFilename;
     }
     return new $sClassName();
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:13,代码来源:pageregistry.inc.php


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