本文整理汇总了PHP中eZPreferences::setValue方法的典型用法代码示例。如果您正苦于以下问题:PHP eZPreferences::setValue方法的具体用法?PHP eZPreferences::setValue怎么用?PHP eZPreferences::setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZPreferences
的用法示例。
在下文中一共展示了eZPreferences::setValue方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: instantiate
function instantiate($userID = false, $sectionID = 0, $versionNumber = false, $languageCode = false, $versionStatus = eZContentObjectVersion::STATUS_INTERNAL_DRAFT)
{
$attributes = $this->fetchAttributes();
if ($userID === false) {
$user = eZUser::currentUser();
$userID = $user->attribute('contentobject_id');
}
if ($languageCode == false) {
$languageCode = eZContentObject::defaultLanguage();
}
$object = eZContentObject::create(ezpI18n::tr("kernel/contentclass", "New %1", null, array($this->name($languageCode))), $this->attribute("id"), $userID, $sectionID, 1, $languageCode);
if ($this->attribute('always_available')) {
$object->setAttribute('language_mask', (int) $object->attribute('language_mask') | 1);
}
$db = eZDB::instance();
$db->begin();
$object->store();
$object->assignDefaultStates();
$object->setName(ezpI18n::tr("kernel/contentclass", "New %1", null, array($this->name($languageCode))), false, $languageCode);
if (!$versionNumber) {
$version = $object->createInitialVersion($userID, $languageCode);
} else {
$version = eZContentObjectVersion::create($object->attribute("id"), $userID, $versionNumber, $languageCode);
}
if ($versionStatus !== false) {
$version->setAttribute('status', $versionStatus);
}
$version->store();
foreach ($attributes as $attribute) {
$attribute->instantiate($object->attribute('id'), $languageCode);
}
if (isset($user) && $user instanceof eZUser && $user->isAnonymous()) {
$createdObjectIDList = eZPreferences::value('ObjectCreationIDList');
if (!$createdObjectIDList) {
$createdObjectIDList = array($object->attribute('id'));
} else {
$createdObjectIDList = unserialize($createdObjectIDList);
$createdObjectIDList[] = $object->attribute('id');
}
eZPreferences::setValue('ObjectCreationIDList', serialize($createdObjectIDList));
}
$db->commit();
return $object;
}
示例2: initializePackage
//.........这里部分代码省略.........
foreach ($extraPolicies as $extraPolicy) {
if (isset($extraPolicy['limitation'])) {
$role->appendPolicy($extraPolicy['module'], $extraPolicy['function'], $extraPolicy['limitation']);
} else {
$role->appendPolicy($extraPolicy['module'], $extraPolicy['function']);
}
}
}
if (isset($extraRole['assignments'])) {
$roleAssignments = $extraRole['assignments'];
foreach ($roleAssignments as $roleAssignment) {
$assignmentIdentifier = false;
$assignmentValue = false;
if (isset($roleAssignment['limitation'])) {
$assignmentIdentifier = $roleAssignment['limitation']['identifier'];
$assignmentValue = $roleAssignment['limitation']['value'];
}
$role->assignToUser($roleAssignment['user_id'], $assignmentIdentifier, $assignmentValue);
}
}
}
}
// Setup user preferences based on the site chosen and addons
if (function_exists('eZSitePreferences')) {
$prefs = eZSitePreferences($parameters);
foreach ($prefs as $prefEntry) {
if (!$prefEntry) {
continue;
}
$prefUserID = $prefEntry['user_id'];
foreach ($prefEntry['preferences'] as $pref) {
$prefName = $pref['name'];
$prefValue = $pref['value'];
if (!eZPreferences::setValue($prefName, $prefValue, $prefUserID)) {
$resultArray['errors'][] = array('code' => 'EZSW-070', 'text' => "Could not create ezpreference '{$prefValue}' for {$prefUserID}");
return false;
}
}
}
}
$publishAdmin = false;
$userAccount = eZUser::fetch(14);
if (!is_object($userAccount)) {
$resultArray['errors'][] = array('code' => 'EZSW-020', 'text' => "Could not fetch administrator user object");
return false;
}
$userObject = $userAccount->attribute('contentobject');
if (!is_object($userObject)) {
$resultArray['errors'][] = array('code' => 'EZSW-021', 'text' => "Could not fetch administrator content object");
return false;
}
$newUserObject = $userObject->createNewVersion(false, false);
if (!is_object($newUserObject)) {
$resultArray['errors'][] = array('code' => 'EZSW-022', 'text' => "Could not create new version of administrator content object");
return false;
}
$dataMap = $newUserObject->attribute('data_map');
$error = false;
if (trim($admin['email'])) {
if (!isset($dataMap['user_account'])) {
$resultArray['errors'][] = array('code' => 'EZSW-023', 'text' => "Administrator content object does not have a 'user_account' attribute");
return false;
}
$userAccount->setInformation(14, 'admin', $admin['email'], $admin['password'], $admin['password']);
$dataMap['user_account']->setContent($userAccount);
$dataMap['user_account']->store();
示例3: preferences
/**
* Set user preferences
* Only needed for operations, call eZPreferences::setValue() directly if you want to set user preferences
*
* @param string $key
* @param string $value
*
* @return array An array with operation status, always true
*/
public static function preferences($key, $value)
{
eZPreferences::setValue($key, $value);
return array('status' => true);
}
示例4: elseif
<?php
/**
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
* @version 2014.07.0
* @package kernel
*/
$http = eZHTTPTool::instance();
$module = $Params['Module'];
$cacheType = $module->actionParameter('CacheType');
eZPreferences::setValue('admin_clearcache_type', $cacheType);
if ($module->hasActionParameter('NodeID')) {
$nodeID = $module->actionParameter('NodeID');
}
if ($module->hasActionParameter('ObjectID')) {
$objectID = $module->actionParameter('ObjectID');
}
if ($cacheType == 'All') {
eZCache::clearAll();
} elseif ($cacheType == 'Template') {
eZCache::clearByTag('template');
} elseif ($cacheType == 'Content') {
eZCache::clearByTag('content');
} elseif ($cacheType == 'TemplateContent') {
eZCache::clearByTag('template');
eZCache::clearByTag('content');
} elseif ($cacheType == 'Ini') {
eZCache::clearByTag('ini');
} elseif ($cacheType == 'Static') {
// get staticCacheHandler instance
示例5: setPreferredUserCountry
static function setPreferredUserCountry($country)
{
eZPreferences::setValue('user_preferred_country', $country);
return eZError::SHOP_OK;
}
示例6: array
$http = eZHTTPTool::instance();
$module = $Params['Module'];
$allSettingsList = $module->actionParameter( 'AllSettingsList' );
if ( $module->hasActionParameter( 'SelectedList' ) )
$selectedList = $module->actionParameter( 'SelectedList' );
else
$selectedList=array();
$siteAccess = $module->actionParameter( 'SiteAccess' );
if ( !$siteAccess )
$siteAccess = 'global_override';
eZPreferences::setValue( 'admin_quicksettings_siteaccess', $siteAccess );
$iniFiles = array();
foreach( $allSettingsList as $index => $setting )
{
$settingArray = explode( ';', $setting );
if ( !array_key_exists( $settingArray[2], $iniFiles ) )
$iniFiles[$settingArray[2]] = array();
$iniFiles[$settingArray[2]][] = array ( $settingArray[0], $settingArray[1], in_array( $index, $selectedList ) );
}
unset( $setting );
$iniPath = ( $siteAccess == "global_override" ) ? "settings/override" : "settings/siteaccess/$siteAccess";
示例7: updatePreferences
function updatePreferences( $params )
{
foreach( $params['prefs'] as $prefEntry )
{
$prefUserID = $prefEntry['user_id'];
foreach( $prefEntry['preferences'] as $pref )
{
$prefName = $pref['name'];
$prefValue = $pref['value'];
eZPreferences::setValue( $prefName, $prefValue, $prefUserID );
}
}
}
示例8: foreach
*/
$module = $Params['Module'];
$offset = $Params['Offset'];
$productClassIdentifier = $Params['ProductClass'];
$productClass = false;
$priceAttributeIdentifier = false;
if ( $module->isCurrentAction( 'Sort' ) )
{
$productClassIdentifier = $module->hasActionParameter( 'ProductClass' ) ? $module->actionParameter( 'ProductClass' ) : false;
$sortingField = $module->hasActionParameter( 'SortingField' ) ? $module->actionParameter( 'SortingField' ) : 'none';
$sortingOrder = $module->hasActionParameter( 'SortingOrder' ) ? $module->actionParameter( 'SortingOrder' ) : 'asc';
eZPreferences::setValue( 'productsoverview_sorting_field', $sortingField );
eZPreferences::setValue( 'productsoverview_sorting_order', $sortingOrder );
}
if ( $module->isCurrentAction( 'ShowProducts' ) )
$productClassIdentifier = $module->hasActionParameter( 'ProductClass' ) ? $module->actionParameter( 'ProductClass' ) : false;
$productClassList = eZShopFunctions::productClassList();
// find selected product class
if ( count( $productClassList ) > 0 )
{
if ( $productClassIdentifier )
{
foreach( $productClassList as $productClassItem )
{
if ( $productClassItem->attribute( 'identifier' ) === $productClassIdentifier )
示例9: array
}
if ($http->hasPostVariable('Key')) {
$key = $http->postVariable('Key');
} else {
$key = $Params['Key'];
}
if ($http->hasPostVariable('Value')) {
$value = $http->postVariable('Value');
} else {
$value = $Params['Value'];
}
// Set user preferences
if (eZOperationHandler::operationIsAvailable('user_preferences')) {
$operationResult = eZOperationHandler::execute('user', 'preferences', array('key' => $key, 'value' => $value));
} else {
eZPreferences::setValue($key, $value);
}
// For use by ajax calls
if ($function === 'set_and_exit') {
eZDB::checkTransactionCounter();
eZExecution::cleanExit();
}
if ($http->hasPostVariable('RedirectURIAfterSet')) {
$url = $http->postVariable('RedirectURIAfterSet');
} else {
// Extract URL to redirect to from user parameters.
$urlArray = array_splice($Params['Parameters'], 3);
foreach ($urlArray as $key => $val) {
if (!is_numeric($key)) {
unset($urlArray[$key]);
}
示例10: implode
/*! \file subscription_list.php
*/
$Module = $Params['Module'];
$http = eZHTTPTool::instance();
if ($http->hasPostVariable('SubmitFilter')) {
$value = implode(',', $http->postVariable('statusFilter'));
eZPreferences::setValue('robinsonlist_filter', $value);
}
$statusFilter = eZPreferences::value('robinsonlist_filter');
$limitKey = eZPreferences::value('admin_list_limit');
if ($statusFilter == "") {
eZPreferences::setValue('robinsonlist_filter', '-1');
$statusFilter = eZPreferences::value('robinsonlist_filter');
}
if ($limitKey == "") {
eZPreferences::setValue('admin_list_limit', '1');
$limitKey = eZPreferences::value('admin_list_limit');
}
if ($http->hasPostVariable('RemoveRobinsonlistEntryButton')) {
if ($http->hasPostVariable('EmailIDArray')) {
foreach ($http->postVariable('EmailIDArray') as $id) {
eZRobinsonListEntry::removeById($id);
}
}
if ($http->hasPostVariable('MobileIDArray')) {
foreach ($http->postVariable('MobileIDArray') as $id) {
eZRobinsonListEntry::removeById($id);
}
}
}
$statusFilterArray = explode(',', $statusFilter);