本文整理汇总了PHP中UserGroup::getNameArray方法的典型用法代码示例。如果您正苦于以下问题:PHP UserGroup::getNameArray方法的具体用法?PHP UserGroup::getNameArray怎么用?PHP UserGroup::getNameArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserGroup
的用法示例。
在下文中一共展示了UserGroup::getNameArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show_section
/**
* Display a section of settings present in the $arrSettings class array
*
* See the description of {@see show()} for details.
* @param \Cx\Core\Html\Sigma $objTemplateLocal The Template object,
* by reference
* @param string $section The optional section header
* text to add
* @param string $prefix The optional prefix for
* language variables.
* Defaults to 'TXT_'
* @return boolean True on success, false otherwise
*/
static function show_section(&$objTemplateLocal, $section = '', $prefix = 'TXT_', $readOnly = false)
{
global $_ARRAYLANG, $_CORELANG;
$arrSettings = self::getCurrentSettings();
self::verify_template($objTemplateLocal);
// This is set to multipart if necessary
$enctype = '';
$i = 0;
if ($objTemplateLocal->blockExists('core_setting_row')) {
$objTemplateLocal->setCurrentBlock('core_setting_row');
}
foreach ($arrSettings as $name => $arrSetting) {
// Determine HTML element for type and apply values and selected
$element = '';
$value = $arrSetting['value'];
$values = self::splitValues($arrSetting['values']);
$type = $arrSetting['type'];
// Not implemented yet:
// Warn if some mandatory value is empty
if (empty($value) && preg_match('/_mandatory$/', $type)) {
\Message::warning(sprintf($_CORELANG['TXT_CORE_SETTING_WARNING_EMPTY'], $_ARRAYLANG[$prefix . strtoupper($name)], $name));
}
// Warn if some language variable is not defined
if (empty($_ARRAYLANG[$prefix . strtoupper($name)])) {
\Message::warning(sprintf($_CORELANG['TXT_CORE_SETTING_WARNING_MISSING_LANGUAGE'], $prefix . strtoupper($name), $name));
}
//DBG::log("Value: $value -> align $value_align");
switch ($type) {
// Dropdown menu
case self::TYPE_DROPDOWN:
$matches = null;
if (preg_match('/^\\{src:([a-z0-9_\\\\:]+)\\(\\)\\}$/i', $arrSetting['values'], $matches)) {
$arrValues = self::splitValues(call_user_func($matches[1]));
} else {
$arrValues = self::splitValues($arrSetting['values']);
}
//DBG::log("Values: ".var_export($arrValues, true));
$element = \Html::getSelect($name, $arrValues, $value, '', '', 'style="width: ' . self::DEFAULT_INPUT_WIDTH . 'px;' . (isset($arrValues[$value]) && is_numeric($arrValues[$value]) ? 'text-align: right;' : '') . '"' . ($readOnly ? \Html::ATTRIBUTE_DISABLED : ''));
break;
case self::TYPE_DROPDOWN_USER_CUSTOM_ATTRIBUTE:
$element = \Html::getSelect($name, User_Profile_Attribute::getCustomAttributeNameArray(), $arrSetting['value'], '', '', 'style="width: ' . self::DEFAULT_INPUT_WIDTH . 'px;"' . ($readOnly ? \Html::ATTRIBUTE_DISABLED : ''));
break;
case self::TYPE_DROPDOWN_USERGROUP:
$element = \Html::getSelect($name, UserGroup::getNameArray(), $arrSetting['value'], '', '', 'style="width: ' . self::DEFAULT_INPUT_WIDTH . 'px;"' . ($readOnly ? \Html::ATTRIBUTE_DISABLED : ''));
break;
case self::TYPE_WYSIWYG:
// These must be treated differently, as wysiwyg editors
// claim the full width
if ($readOnly) {
// TODO: this might be dangerous! should be rewritten probably
$element = $value;
} else {
$element = new \Cx\Core\Wysiwyg\Wysiwyg($name, $value);
}
$objTemplateLocal->setVariable(array('CORE_SETTING_ROW' => $_ARRAYLANG[$prefix . strtoupper($name)], 'CORE_SETTING_ROWCLASS1' => ++$i % 2 ? '1' : '2'));
$objTemplateLocal->parseCurrentBlock();
$objTemplateLocal->setVariable(array('CORE_SETTING_ROW' => $element . '<br /><br />', 'CORE_SETTING_ROWCLASS1' => ++$i % 2 ? '1' : '2'));
$objTemplateLocal->parseCurrentBlock();
// Skip the part below, all is done already
continue 2;
case self::TYPE_FILEUPLOAD:
//echo("\Cx\Core\Setting\Controller\Setting::show_section(): Setting up upload for $name, $value<br />");
$element = \Html::getInputFileupload($name, $value ? $name : false, Filetype::MAXIMUM_UPLOAD_FILE_SIZE, $arrSetting['values'], 'style="width: ' . self::DEFAULT_INPUT_WIDTH . 'px;"' . ($readOnly ? \Html::ATTRIBUTE_DISABLED : ''), true, $value ? $value : 'media/' . (isset($_REQUEST['cmd']) ? $_REQUEST['cmd'] : 'other'));
// File uploads must be multipart encoded
$enctype = 'enctype="multipart/form-data"';
break;
case self::TYPE_BUTTON:
// The button is only available to trigger some event.
$event = 'onclick=\'' . 'if (confirm("' . $_ARRAYLANG[$prefix . strtoupper($name) . '_CONFIRM'] . '")) {' . 'document.getElementById("' . $name . '").value=1;' . 'document.formSettings_' . self::$tab_index . '.submit();' . '}\'';
//DBG::log("\Cx\Core\Setting\Controller\Setting::show_section(): Event: $event");
$element = \Html::getInputButton('__' . $name, $_ARRAYLANG[strtoupper($prefix . $name) . '_LABEL'], 'button', false, $event . ($readOnly ? \Html::ATTRIBUTE_DISABLED : '')) . \Html::getHidden($name, 0, '');
//DBG::log("\Cx\Core\Setting\Controller\Setting::show_section(): Element: $element");
break;
case self::TYPE_TEXTAREA:
$element = \Html::getTextarea($name, $value, 80, 8, $readOnly ? \Html::ATTRIBUTE_DISABLED : '');
// 'style="width: '.self::DEFAULT_INPUT_WIDTH.'px;'.$value_align.'"');
break;
case self::TYPE_CHECKBOX:
$arrValues = self::splitValues($arrSetting['values']);
$value_true = current($arrValues);
$element = \Html::getCheckbox($name, $value_true, false, in_array($value, $arrValues), '', $readOnly ? \Html::ATTRIBUTE_DISABLED : '');
break;
case self::TYPE_CHECKBOXGROUP:
$checked = self::splitValues($value);
$element = \Html::getCheckboxGroup($name, $values, $values, $checked, '', '', '<br />', $readOnly ? \Html::ATTRIBUTE_DISABLED : '', '');
break;
// 20120508 UNTESTED!
//.........这里部分代码省略.........
示例2: view_settings_general
static function view_settings_general()
{
// General settings
self::$objTemplate->addBlockfile('SHOP_SETTINGS_FILE', 'settings_block', 'module_shop_settings_general.html');
// TODO: Temporary. Remove in release with working update
// Returns NULL on missing entries even when other settings are properly loaded
$test = \Cx\Core\Setting\Controller\Setting::getValue('shopnavbar_on_all_pages', 'Shop');
if ($test === NULL) {
ShopSettings::errorHandler();
\Cx\Core\Setting\Controller\Setting::init('Shop', 'config');
}
self::$objTemplate->setVariable(array('SHOP_CONFIRMATION_EMAILS' => \Cx\Core\Setting\Controller\Setting::getValue('email_confirmation', 'Shop'), 'SHOP_CONTACT_EMAIL' => \Cx\Core\Setting\Controller\Setting::getValue('email', 'Shop'), 'SHOP_CONTACT_COMPANY' => \Cx\Core\Setting\Controller\Setting::getValue('company', 'Shop'), 'SHOP_CONTACT_ADDRESS' => \Cx\Core\Setting\Controller\Setting::getValue('address', 'Shop'), 'SHOP_CONTACT_TEL' => \Cx\Core\Setting\Controller\Setting::getValue('telephone', 'Shop'), 'SHOP_CONTACT_FAX' => \Cx\Core\Setting\Controller\Setting::getValue('fax', 'Shop'), 'SHOP_GENERAL_COUNTRY_MENUOPTIONS' => \Cx\Core\Country\Controller\Country::getMenuoptions(\Cx\Core\Setting\Controller\Setting::getValue('country_id', 'Shop')), 'SHOP_THUMBNAIL_MAX_WIDTH' => \Cx\Core\Setting\Controller\Setting::getValue('thumbnail_max_width', 'Shop'), 'SHOP_THUMBNAIL_MAX_HEIGHT' => \Cx\Core\Setting\Controller\Setting::getValue('thumbnail_max_height', 'Shop'), 'SHOP_THUMBNAIL_QUALITY' => \Cx\Core\Setting\Controller\Setting::getValue('thumbnail_quality', 'Shop'), 'SHOP_WEIGHT_ENABLE_CHECKED' => \Cx\Core\Setting\Controller\Setting::getValue('weight_enable', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_SHOW_PRODUCTS_DEFAULT_OPTIONS' => Products::getDefaultViewMenuoptions(\Cx\Core\Setting\Controller\Setting::getValue('show_products_default', 'Shop')), 'SHOP_PRODUCT_SORTING_MENUOPTIONS' => Products::getProductSortingMenuoptions(), 'SHOP_ORDERITEMS_AMOUNT_MAX' => Currency::formatPrice(\Cx\Core\Setting\Controller\Setting::getValue('orderitems_amount_max', 'Shop')), 'SHOP_ORDERITEMS_AMOUNT_MIN' => Currency::formatPrice(\Cx\Core\Setting\Controller\Setting::getValue('orderitems_amount_min', 'Shop')), 'SHOP_CURRENCY_CODE' => Currency::getCurrencyCodeById(Currency::getDefaultCurrencyId()), 'SHOP_SETTING_CART_USE_JS' => \Html::getCheckbox('use_js_cart', 1, false, \Cx\Core\Setting\Controller\Setting::getValue('use_js_cart', 'Shop')), 'SHOP_SETTING_SHOPNAVBAR_ON_ALL_PAGES' => \Html::getCheckbox('shopnavbar_on_all_pages', 1, false, \Cx\Core\Setting\Controller\Setting::getValue('shopnavbar_on_all_pages', 'Shop')), 'SHOP_SETTING_REGISTER' => \Html::getSelectCustom('register', ShopLibrary::getRegisterMenuoptions(\Cx\Core\Setting\Controller\Setting::getValue('register', 'Shop')), false, '', 'style="width: 270px;"'), 'SHOP_SETTING_NUMOF_PRODUCTS_PER_PAGE_BACKEND' => \Cx\Core\Setting\Controller\Setting::getValue('numof_products_per_page_backend', 'Shop'), 'SHOP_SETTING_NUMOF_ORDERS_PER_PAGE_BACKEND' => \Cx\Core\Setting\Controller\Setting::getValue('numof_orders_per_page_backend', 'Shop'), 'SHOP_SETTING_NUMOF_CUSTOMERS_PER_PAGE_BACKEND' => \Cx\Core\Setting\Controller\Setting::getValue('numof_customers_per_page_backend', 'Shop'), 'SHOP_SETTING_NUMOF_MANUFACTURERS_PER_PAGE_BACKEND' => \Cx\Core\Setting\Controller\Setting::getValue('numof_manufacturers_per_page_backend', 'Shop'), 'SHOP_SETTING_NUMOF_MAILTEMPLATE_PER_PAGE_BACKEND' => \Cx\Core\Setting\Controller\Setting::getValue('numof_mailtemplate_per_page_backend', 'Shop'), 'SHOP_SETTING_NUMOF_COUPON_PER_PAGE_BACKEND' => \Cx\Core\Setting\Controller\Setting::getValue('numof_coupon_per_page_backend', 'Shop'), 'SHOP_SETTING_NUMOF_PRODUCTS_PER_PAGE_FRONTEND' => \Cx\Core\Setting\Controller\Setting::getValue('numof_products_per_page_frontend', 'Shop'), 'SHOP_SETTING_USERGROUP_ID_CUSTOMER' => \Html::getSelect('usergroup_id_customer', \UserGroup::getNameArray(), \Cx\Core\Setting\Controller\Setting::getValue('usergroup_id_customer', 'Shop'), '', '', 'tabindex="0" style="width: 270px;"'), 'SHOP_SETTING_USERGROUP_ID_RESELLER' => \Html::getSelect('usergroup_id_reseller', \UserGroup::getNameArray(), \Cx\Core\Setting\Controller\Setting::getValue('usergroup_id_reseller', 'Shop'), '', '', 'tabindex="0" style="width: 270px;"'), 'SHOP_SETTING_USER_PROFILE_ATTRIBUTE_CUSTOMER_GROUP_ID' => \Html::getSelect('user_profile_attribute_customer_group_id', \User_Profile_Attribute::getCustomAttributeNameArray(), \Cx\Core\Setting\Controller\Setting::getValue('user_profile_attribute_customer_group_id', 'Shop'), '', '', 'tabindex="0" style="width: 270px;"'), 'SHOP_SETTING_USER_PROFILE_ATTRIBUTE_NOTES' => \Html::getSelect('user_profile_attribute_notes', \User_Profile_Attribute::getCustomAttributeNameArray(), \Cx\Core\Setting\Controller\Setting::getValue('user_profile_attribute_notes', 'Shop'), '', '', 'tabindex="0" style="width: 270px;"')));
}