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


PHP UserData::instance方法代码示例

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


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

示例1: instance

 /**
  * This class implements the Singleton pattern. There is only ever
  * one instance of the this class and it is accessed only via the 
  * ClassName::instance() method.
  * 
  * @return object 
  * @access public
  * @since 5/26/05
  * @static
  */
 public static function instance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new UserData();
     }
     return self::$instance;
 }
开发者ID:adamfranco,项目名称:harmoni,代码行数:17,代码来源:UserData.class.php

示例2: getHeadJs

 /**
  * Answer the head JS
  * 
  * @return string
  * @access public
  * @since 1/13/09
  * @static
  */
 public static function getHeadJs()
 {
     ob_start();
     print "\n\n\t\t<script type='text/javascript' src='" . POLYPHONY_PATH . "/javascript/UserData.js'></script>";
     print "\n\t\t<script type='text/javascript'>\n\t\t// <![CDATA[\n\t\t\n\t\t\tvar userData = UserData.instance();\n";
     $userData = UserData::instance();
     foreach ($userData->getPreferenceKeys() as $key) {
         print "\n\t\t\tuserData.prefs['{$key}'] = '" . addslashes($userData->getPreference($key)) . "';";
     }
     print "\n\t\t// ]]>\n\t\t</script>\n";
     return ob_get_clean();
 }
开发者ID:adamfranco,项目名称:polyphony,代码行数:20,代码来源:UserDataHelper.class.php

示例3: execute

 /**
  * Execute
  * 
  * @return void
  * @access public
  * @since 09/23/08
  */
 public function execute()
 {
     try {
         $this->start();
         $userData = UserData::instance();
         $userData->setPreference(RequestContext::value('key'), RequestContext::value('val'));
         print "\n\t<preference key=\"" . RequestContext::value('key') . '">';
         print $userData->getPreference(RequestContext::value('key'));
         print '</preference>';
         $this->end();
     } catch (Exception $e) {
         HarmoniErrorHandler::logException($e);
         $this->error($e->getMessage(), get_class($e));
     }
 }
开发者ID:adamfranco,项目名称:polyphony,代码行数:22,代码来源:setPreference.act.php

示例4: buildContent

 /**
  * Build the content for this action
  * 
  * @return void
  * @access public
  * @since 4/26/05
  */
 function buildContent()
 {
     $defaultTextDomain = textdomain("polyphony");
     $actionRows = $this->getActionRows();
     $harmoni = Harmoni::instance();
     ob_start();
     $userPrefs = UserData::instance();
     // 		$userPrefs->setPreference('test_pref2', 'goodbye world');
     print "\n<input type='button' value='" . _("Clear Session-Values") . "'/>";
     // 		print "\n<input type='button' value='"._("Delete All Values")."'/>";
     print "\n<table border='1'>";
     print "\n\t<thead>";
     print "\n\t\t<tr>";
     print "\n\t\t\t<th>" . "</th>";
     print "\n\t\t\t<th>" . _('Key') . "</th>";
     print "\n\t\t\t<th>" . _('Value') . "</th>";
     print "\n\t\t\t<th>" . "</th>";
     print "\n\t\t\t<th>" . _('Session-Value') . "</th>";
     print "\n\t\t\t<th>" . _('Stored-Value') . "</th>";
     print "\n\t\t</tr>";
     print "\n\t</thead>";
     print "\n\t<tbody>";
     foreach ($userPrefs->getPreferenceKeys() as $key) {
         print "\n\t\t<tr>";
         print "\n\t\t\t<td><input type='button' name='" . RequestContext::name('delete') . "' value='" . _("Delete") . "'/></td>";
         print "\n\t\t\t<td class='user_pref_key'>" . $key . "</td>";
         print "\n\t\t\t<td class='user_pref_val'><input type='text' name='" . RequestContext::name('pref_val') . "' value=\"" . $userPrefs->getPreference($key) . "\"/></td>";
         print "\n\t\t\t<td><input type='button' name='" . RequestContext::name('save') . "' value='" . _("Save Changes") . "'/></td>";
         print "\n\t\t\t<td class='user_pref_sess_val'>" . $userPrefs->getPreferenceSessionValue($key) . "</td>";
         print "\n\t\t\t<td class='user_pref_stored_val'>" . $userPrefs->getPreferencePersistantValue($key) . "</td>";
         print "\n\t\t</tr>";
     }
     print "\n\t\t<tr>";
     print "\n\t\t\t<td></td>";
     print "\n\t\t\t<td><input type='text' name='" . RequestContext::name('pref_key') . "'/></td>";
     print "\n\t\t\t<td><input type='text' name='" . RequestContext::name('pref_val') . "'/></td>";
     print "\n\t\t\t<td><input type='button' name='" . RequestContext::name('new') . "' value='" . _("Create New Preference") . "'/></td>";
     print "\n\t\t\t<td></td>";
     print "\n\t\t\t<td></td>";
     print "\n\t\t</tr>";
     print "\n\t</tbody>";
     print "\n</table>";
     $actionRows->add(new Block(ob_get_clean(), STANDARD_BLOCK), "100%", null, LEFT, TOP);
     textdomain($defaultTextDomain);
 }
开发者ID:adamfranco,项目名称:polyphony,代码行数:52,代码来源:preferences.act.php

示例5: setUiModule

 /**
  * Set the UI module
  * 
  * @param string $module
  * @return void
  * @access public
  * @since 7/27/07
  */
 function setUiModule($module)
 {
     $allowed = array('ui1', 'ui2');
     if (in_array($module, $allowed)) {
         UserData::instance()->setPreference('segue_ui_module', $module);
     }
 }
开发者ID:adamfranco,项目名称:segue,代码行数:15,代码来源:change_ui.act.php

示例6: Type

        $authZManager->createAuthorization($adminGroup->getId(), $function->getId(), $allOfSegueId);
        // Administration Functions
        $type = new Type("Authorization", "edu.middlebury.harmoni", "Group Administration", "Functions for administering groups.");
        $id = $idManager->getId("edu.middlebury.authorization.create_group");
        $function = $authZManager->createFunction($id, "Create Groups", "Add Groups to the system.", $type, $qualifierHierarchyId);
        $authZManager->createAuthorization($adminGroup->getId(), $function->getId(), $allOfSegueId);
        $id = $idManager->getId("edu.middlebury.authorization.delete_group");
        $function = $authZManager->createFunction($id, "Delete Groups", "Remove Groups from the system.", $type, $qualifierHierarchyId);
        $authZManager->createAuthorization($adminGroup->getId(), $function->getId(), $allOfSegueId);
        $id = $idManager->getId("edu.middlebury.authorization.modify_group_membership");
        $function = $authZManager->createFunction($id, "Modify Group Membership", "Modify Group membership.", $type, $qualifierHierarchyId);
        $authZManager->createAuthorization($adminGroup->getId(), $function->getId(), $allOfSegueId);
        /*********************************************************
         * Add a site for the administrator user to use for testing
         * new installations.
         *********************************************************/
        $slotMgr = SlotManager::instance();
        $testSlot = $slotMgr->getSlotByShortname('jadministrator-test_site');
        $testSlot->addOwner($adminAgent->getId());
        $testSlot->setLocationCategory('community');
        $slotMgr->convertSlotToType($testSlot, Slot::personal);
        // Set the 'personal' folder as the last visited so that admins logging into
        // a new install will see their personal test site.
        UserData::instance()->setPreference('segue_portal_last_folder', 'personal');
        // 		print "\n<br> ...done";
        $_SESSION['table_setup_complete'] = TRUE;
        unset($_SESSION['installation_underway']);
        // 		$dbHandler->commitTransaction($dbID);
        RequestContext::locationHeader($_SERVER['REQUEST_URI']);
    }
}
开发者ID:adamfranco,项目名称:segue,代码行数:31,代码来源:install.inc.php

示例7: getCurrentFolderId

 /**
  * Answer the current Folder id
  * 
  * @return string
  * @access private
  * @since 4/1/08
  */
 private function getCurrentFolderId()
 {
     if (!isset($this->currentFolderId)) {
         if (RequestContext::value('folder')) {
             try {
                 $portalMgr = PortalManager::instance();
                 $folder = $portalMgr->getFolder(RequestContext::value('folder'));
                 $this->currentFolderId = $folder->getIdString();
             } catch (UnknownIdException $e) {
                 $this->currentFolderId = 'recent_access';
             }
         } else {
             if (UserData::instance()->getPreference('segue_portal_last_folder')) {
                 $harmoni = Harmoni::instance();
                 $this->currentFolderId = UserData::instance()->getPreference('segue_portal_last_folder');
                 if (!strlen(RequestContext::value('starting_number')) && UserData::instance()->getPreference('segue_portal_starting_number')) {
                     $harmoni->request->setRequestParam('starting_number', UserData::instance()->getPreference('segue_portal_starting_number'));
                 }
                 try {
                     $portalMgr = PortalManager::instance();
                     $folder = $portalMgr->getFolder($this->currentFolderId);
                     $this->currentFolderId = $folder->getIdString();
                 } catch (UnknownIdException $e) {
                     $this->currentFolderId = 'personal';
                     $harmoni->request->setRequestParam('starting_number', '0');
                 }
             } else {
                 $this->currentFolderId = 'recent_access';
             }
         }
     }
     UserData::instance()->setPreference('segue_portal_last_folder', $this->currentFolderId);
     UserData::instance()->setPreference('segue_portal_starting_number', strval(intval(RequestContext::value('starting_number'))));
     return $this->currentFolderId;
 }
开发者ID:adamfranco,项目名称:segue,代码行数:42,代码来源:list.act.php

示例8: update

 /**
  * Update from environmental ($_REQUEST) data.
  * Plugin writers should override this method with their own functionality
  * as needed.
  * 
  * @param array $request
  * @return void
  * @access public
  * @since 1/12/06
  */
 function update($request)
 {
     if ($this->getFieldValue('edit')) {
         $this->editing = true;
     }
     if ($this->getFieldValue('submit_pressed')) {
         $this->setContent($this->tokenizeLocalUrls($this->cleanHTML($this->unapplyTextTemplates($this->getFieldValue('content')))));
         $this->setRawDescription(intval($this->getFieldValue('abstractLength')));
         $this->logEvent('Modify Content', 'TextBlock content updated');
         if ($this->getFieldValue('comment') && $this->getFieldValue('comment') != $this->getCommentText()) {
             $this->markVersion($this->getFieldValue('comment'));
         } else {
             $this->markVersion();
         }
     } else {
         if ($this->getFieldValue('editor')) {
             $this->textEditor = $this->getFieldValue('editor');
             UserData::instance()->setPreference('segue_text_editor', $this->textEditor);
             $this->editing = true;
             $this->workingContent = $this->cleanHTML($this->getFieldValue('content'));
             $this->workingAbstractLength = intval($this->getFieldValue('abstractLength'));
         }
     }
 }
开发者ID:adamfranco,项目名称:segue,代码行数:34,代码来源:EduMiddleburyTextBlockPlugin.class.php


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