本文整理汇总了PHP中XoopsLists::getThemesList方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsLists::getThemesList方法的具体用法?PHP XoopsLists::getThemesList怎么用?PHP XoopsLists::getThemesList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XoopsLists
的用法示例。
在下文中一共展示了XoopsLists::getThemesList方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: eventCoreFooterEnd
/**
* @param $args
*/
function eventCoreFooterEnd($args)
{
global $resourcesModule, $resourcesConfigsList;
if (empty($resourcesModule)) {
if (is_a($resourcesModule = xoops_gethandler('module')->getByDirname(basename(dirname(__DIR__))), "XoopsModule")) {
if (empty($resourcesConfigsList)) {
$resourcesConfigsList = xoops_gethandler('config')->getConfigsList($resourcesModule->getVar('mid'));
}
}
}
xoops_load("XoopsCache");
xoops_load("XoopsLists");
if (!($themes = XoopsCache::read(basename(dirname(__DIR__)) . '.available.themes'))) {
$themes = json_decode(getURIData(sprintf(_MI_RESOURCES_THEMES, _RESOURCES_SUPPORTING)), true);
if (!empty($themes)) {
XoopsCache::write(basename(dirname(__DIR__)) . '.available.themes', $themes, 3600 * mt_rand(2.99999, 12.99999));
}
}
if (!($modules = XoopsCache::read(basename(dirname(__DIR__)) . '.available.modules'))) {
$modules = json_decode(getURIData(sprintf(_MI_RESOURCES_MODULES, _RESOURCES_SUPPORTING)), true);
if (!empty($themes)) {
XoopsCache::write(basename(dirname(__DIR__)) . '.available.modules', $modules, 3600 * mt_rand(2.99999, 12.99999));
}
}
if (!($peers = XoopsCache::read(basename(dirname(__DIR__)) . '.available.peers'))) {
$peers = json_decode(getURIData(sprintf(_MI_RESOURCES_PEERS, _RESOURCES_SUPPORTING)), true);
if (!empty($themes)) {
XoopsCache::write(basename(dirname(__DIR__)) . '.available.peers', $peers, 3600 * 24 * mt_rand(5.99999, 24.99999));
}
}
if (!($modules = XoopsCache::read(basename(dirname(__DIR__)) . '.modules.delays') && $resourcesConfigsList['harvester'])) {
XoopsCache::write(basename(dirname(__DIR__)) . '.modules', true, 3600 * 24 * 29);
XoopsCache::write(basename(dirname(__DIR__)) . '.modules.delays', $modules = XoopsLists::getModulesList(), 3600 * 24 * 31);
foreach ($modules as $module) {
$map = getFolderMap($GLOBALS['xoops']->path('/modules/' . $module));
XoopsCache::write(basename(dirname(__DIR__)) . '.module' . $module, true, $seconds = 3600 * 24 * mt_rand(21.69999, 42.998876));
XoopsCache::write(basename(dirname(__DIR__)) . '.module' . $module . '.delays', $map, $seconds + 3600 * 4);
if (is_dir(XOOPS_PATH . '/modules/' . $module)) {
$map = getFolderMap(XOOPS_PATH . '/modules/' . $module, XOOPS_PATH);
XoopsCache::write(basename(dirname(__DIR__)) . '.xoopslib' . $module, true, $seconds);
XoopsCache::write(basename(dirname(__DIR__)) . '.xoopslib' . $module . '.delays', $map, $seconds + 3600 * 4);
}
}
}
if (!($themes = XoopsCache::read(basename(dirname(__DIR__)) . '.themes.delays') && $resourcesConfigsList['harvester'])) {
XoopsCache::write(basename(dirname(__DIR__)) . '.themes', true, 3600 * 24 * 29);
XoopsCache::write(basename(dirname(__DIR__)) . '.themes.delays', $themes = XoopsLists::getThemesList(), 3600 * 24 * 31);
foreach ($themes as $theme) {
$map = getFolderMap($GLOBALS['xoops']->path('/themes/' . $theme));
XoopsCache::write(basename(dirname(__DIR__)) . '.theme' . $theme, true, $seconds = 3600 * 24 * mt_rand(21.69999, 42.998876));
XoopsCache::write(basename(dirname(__DIR__)) . '.theme' . $theme . '.delays', $map, $seconds + 3600 * 4);
}
}
}
示例2: __construct
/**
* Constructor
*
* @param string $caption
* @param string $name
* @param mixed $value Pre-selected value (or array of them).
* @param int $size Number or rows. "1" makes a drop-down-list
* @param bool $theme_set_allowed Flag to use only selectable theme
*/
public function __construct($caption, $name, $value = null, $size = 1, $theme_set_allowed = false)
{
parent::__construct($caption, $name, $value, $size);
if ($theme_set_allowed === false) {
$this->addOptionArray(XoopsLists::getThemesList());
} else {
$theme_arr = $GLOBALS['xoopsConfig']['theme_set_allowed'];
foreach (array_keys($theme_arr) as $i) {
$this->addOption($theme_arr[$i], $theme_arr[$i]);
}
}
}
示例3: Criteria
$options = $config_handler->getConfigOptions(new Criteria('conf_id', $config[$i]->getVar('conf_id')));
$opcount = count($options);
for ($j = 0; $j < $opcount; $j++) {
$optval = defined($options[$j]->getVar('confop_value')) ? constant($options[$j]->getVar('confop_value')) : $options[$j]->getVar('confop_value');
$optkey = defined($options[$j]->getVar('confop_name')) ? constant($options[$j]->getVar('confop_name')) : $options[$j]->getVar('confop_name');
$ele->addOption($optval, $optkey);
}
break;
case 'yesno':
$ele = new XoopsFormRadioYN($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput(), _YES, _NO);
break;
case 'theme':
case 'theme_multi':
$ele = $config[$i]->getVar('conf_formtype') != 'theme_multi' ? new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput()) : new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput(), 5, true);
require_once XOOPS_ROOT_PATH . "/class/xoopslists.php";
$dirlist = XoopsLists::getThemesList();
if (!empty($dirlist)) {
asort($dirlist);
$ele->addOptionArray($dirlist);
}
//$themeset_handler =& xoops_gethandler('themeset');
//$themesetlist =& $themeset_handler->getList();
//asort($themesetlist);
//foreach ($themesetlist as $key => $name) {
// $ele->addOption($key, $name.' ('._MD_AM_THEMESET.')');
//}
// old theme value is used to determine whether to update cache or not. kind of dirty way
$form->addElement(new XoopsFormHidden('_old_theme', $config[$i]->getConfValueForOutput()));
break;
case 'tplset':
$ele = new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput());
示例4: getForm
/**
* @param array $obj
* @param XoopsModule $mod
*/
public function getForm(&$obj, XoopsModule $mod)
{
$xoops = Xoops::getInstance();
$helper = Userconfigs::getInstance();
$config_handler = $helper->getHandlerConfig();
/* @var $plugin UserconfigsPluginInterface */
if ($plugin = \Xoops\Module\Plugin::getPlugin($mod->getVar('dirname'), 'userconfigs')) {
parent::__construct('', 'pref_form', 'index.php', 'post', true);
if ($mod->getVar('dirname') != 'system') {
$xoops->loadLanguage('modinfo', $mod->getVar('dirname'));
$xoops->loadLocale($mod->getVar('dirname'));
}
$configs = $plugin->configs();
$configNames = array();
foreach (array_keys($configs) as $i) {
$configNames[$configs[$i]['name']] =& $configs[$i];
}
$configCats = $plugin->categories();
if (!$configCats) {
$configCats = array('default' => array('name' => _MD_USERCONFIGS_CONFIGS, 'description' => ''));
}
if (!in_array('default', array_keys($configCats))) {
$configCats['default'] = array('name' => _MD_USERCONFIGS_CONFIGS, 'description' => '');
}
foreach (array_keys($configNames) as $name) {
if (!isset($configNames[$name]['category'])) {
$configNames[$name]['category'] = 'default';
}
}
$tabtray = new Xoops\Form\TabTray('', 'pref_tabtay', $xoops->getModuleConfig('jquery_theme', 'system'));
$tabs = array();
foreach ($configCats as $name => $info) {
$tabs[$name] = new Xoops\Form\Tab($info['name'], 'pref_tab_' . $name);
if (isset($info['description']) && $info['description'] != '') {
$tabs[$name]->addElement(new Xoops\Form\Label('', $info['description']));
}
}
$count = count($obj);
for ($i = 0; $i < $count; ++$i) {
$title = Xoops_Locale::translate($obj[$i]->getVar('conf_title'), $mod->getVar('dirname'));
$desc = $obj[$i]->getVar('conf_desc') != '' ? Xoops_Locale::translate($obj[$i]->getVar('conf_desc'), $mod->getVar('dirname')) : '';
switch ($obj[$i]->getVar('conf_formtype')) {
case 'textarea':
$myts = MyTextSanitizer::getInstance();
if ($obj[$i]->getVar('conf_valuetype') == 'array') {
// this is exceptional.. only when value type is arrayneed a smarter way for this
$ele = $obj[$i]->getVar('conf_value') != '' ? new Xoops\Form\TextArea($title, $obj[$i]->getVar('conf_name'), $myts->htmlSpecialChars(implode('|', $obj[$i]->getConfValueForOutput())), 5, 5) : new Xoops\Form\TextArea($title, $obj[$i]->getVar('conf_name'), '', 5, 5);
} else {
$ele = new Xoops\Form\TextArea($title, $obj[$i]->getVar('conf_name'), $myts->htmlSpecialChars($obj[$i]->getConfValueForOutput()), 5, 5);
}
break;
case 'select':
$ele = new Xoops\Form\Select($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput());
$options = $config_handler->getConfigOptions(new Criteria('conf_id', $obj[$i]->getVar('conf_id')));
$opcount = count($options);
for ($j = 0; $j < $opcount; ++$j) {
$optval = Xoops_Locale::translate($options[$j]->getVar('confop_value'), $mod->getVar('dirname'));
$optkey = Xoops_Locale::translate($options[$j]->getVar('confop_name'), $mod->getVar('dirname'));
$ele->addOption($optval, $optkey);
}
break;
case 'select_multi':
$ele = new Xoops\Form\Select($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput(), 5, true);
$options = $config_handler->getConfigOptions(new Criteria('conf_id', $obj[$i]->getVar('conf_id')));
$opcount = count($options);
for ($j = 0; $j < $opcount; ++$j) {
$optval = Xoops_Locale::translate($options[$j]->getVar('confop_value'), $mod->getVar('dirname'));
$optkey = Xoops_Locale::translate($options[$j]->getVar('confop_name'), $mod->getVar('dirname'));
$ele->addOption($optval, $optkey);
}
break;
case 'yesno':
$ele = new Xoops\Form\RadioYesNo($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput());
break;
case 'theme':
case 'theme_multi':
$ele = $obj[$i]->getVar('conf_formtype') != 'theme_multi' ? new Xoops\Form\Select($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput()) : new Xoops\Form\Select($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput(), 5, true);
$dirlist = XoopsLists::getThemesList();
if (!empty($dirlist)) {
asort($dirlist);
$ele->addOptionArray($dirlist);
}
break;
case 'tplset':
$ele = new Xoops\Form\Select($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput());
$tplset_handler = $xoops->getHandlerTplSet();
$tplsetlist = $tplset_handler->getNameList();
asort($tplsetlist);
foreach ($tplsetlist as $key => $name) {
$ele->addOption($key, $name);
}
break;
case 'cpanel':
$ele = new Xoops\Form\Hidden($obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput());
/*
$ele = new Xoops\Form\Select($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput());
//.........这里部分代码省略.........
示例5: XoopsFormSelectTheme
/**
* Constructor
*
* @param string $caption
* @param string $name
* @param mixed $value Pre-selected value (or array of them).
* @param int $size Number or rows. "1" makes a drop-down-list
*/
function XoopsFormSelectTheme($caption, $name, $value = null, $size = 1)
{
$this->XoopsFormSelect($caption, $name, $value, $size);
$this->addOptionArray(XoopsLists::getThemesList());
}
示例6: createThemeform
/**
* @param XoopsConfigItem $config
*
* @return Xoops\Form\ThemeForm[]
*/
function createThemeform(XoopsConfigItem $config)
{
$title = $config->getVar('conf_desc') == '' ? Xoops_Locale::translate($config->getVar('conf_title'), 'system') : Xoops_Locale::translate($config->getVar('conf_title'), 'system') . '<br /><br /><span>' . Xoops_Locale::translate($config->getVar('conf_desc'), 'system') . '</span>';
$form_theme_set = new Xoops\Form\Select('', $config->getVar('conf_name'), $config->getConfValueForOutput(), 1, false);
$dirlist = XoopsLists::getThemesList();
if (!empty($dirlist)) {
asort($dirlist);
$form_theme_set->addOptionArray($dirlist);
}
$label_content = "";
// read ini file for each theme
foreach ($dirlist as $theme) {
// set default value
$theme_ini = array('Name' => $theme, 'Description' => '', 'Version' => '', 'Format' => '', 'Author' => '', 'Demo' => '', 'Url' => '', 'Download' => '', 'W3C' => '', 'Licence' => '', 'thumbnail' => 'screenshot.gif', 'screenshot' => 'screenshot.png');
if ($theme == $config->getConfValueForOutput()) {
$label_content .= "<div id='{$theme}' rel='theme' style='display:block;'>";
} else {
$label_content .= "<div id='{$theme}' rel='theme' style='display:none;'>";
}
if (file_exists(XOOPS_ROOT_PATH . "/themes/{$theme}/theme.ini")) {
$theme_ini = parse_ini_file(XOOPS_ROOT_PATH . "/themes/{$theme}/theme.ini");
if ($theme_ini['screenshot'] == '') {
$theme_ini['screenshot'] = 'screenshot.png';
$theme_ini['thumbnail'] = 'thumbnail.png';
}
}
if ($theme_ini['screenshot'] != '' && file_exists(XOOPS_ROOT_PATH . "/themes/{$theme}/" . $theme_ini['screenshot'])) {
$label_content .= "<img src='" . XOOPS_URL . "/themes/" . $theme . "/" . $theme_ini['screenshot'] . "' alt='Screenshot' />";
} elseif ($theme_ini['thumbnail'] != '' && file_exists(XOOPS_ROOT_PATH . "/themes/{$theme}/" . $theme_ini['thumbnail'])) {
$label_content .= "<img src='" . XOOPS_URL . "/themes/" . $theme . "/" . $theme_ini['thumbnail'] . "' alt='{$theme}' />";
} else {
$label_content .= THEME_NO_SCREENSHOT;
}
$label_content .= "</div>";
}
// read ini file for each theme
$form_theme_set->setExtra("onchange='showThemeSelected(this)'");
$form = new Xoops\Form\ThemeForm($title, 'themes', 'index.php', 'post');
$form->addElement($form_theme_set);
$form->addElement(new Xoops\Form\Label('', "<div id='screenshot'>" . $label_content . "</div>"));
$form->addElement(new Xoops\Form\Hidden('conf_ids[]', $config->getVar('conf_id')));
return array($form);
}
示例7: getEditElement
/**
* Returns a {@link XoopsFormElement} for editing the value of this field
*
* @param object $user {@link XoopsUser} object to edit the value of
*
* @return object
**/
function getEditElement(&$user)
{
$value = $user->getVar($this->getVar('field_name'), 'e');
$caption = $this->getVar('field_title');
$caption = defined($caption) ? constant($caption) : $caption;
$name = $this->getVar('field_name', 'e');
$options = $this->getVar('field_options');
asort($options);
foreach (array_keys($options) as $key) {
$optval = defined($options[$key]) ? constant($options[$key]) : $options[$key];
$optkey = defined($key) ? constant($key) : $key;
unset($options[$key]);
$options[$optkey] = $optval;
}
include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
switch ($this->getVar('field_type')) {
default:
case "autotext":
//autotext is not for editing
$element = new XoopsFormLabel($caption, $this->getOutputValue($user));
break;
case "textbox":
$element = new XoopsFormText($caption, $name, 35, $this->getVar('field_maxlength'), $value);
break;
case "textarea":
$element = new XoopsFormTextArea($caption, $name, $value, 10, 50);
break;
case "dhtml":
$element = new XoopsFormDhtmlTextArea($caption, $name, $value, 10, 50);
break;
case "select":
$element = new XoopsFormSelect($caption, $name, $value);
$element->addOptionArray($options);
break;
case "select_multi":
$element = new XoopsFormSelect($caption, $name, $value, 5, true);
$element->addOptionArray($options);
break;
case "radio":
$element = new XoopsFormRadio($caption, $name, $value);
$element->addOptionArray($options);
break;
case "checkbox":
$element = new XoopsFormCheckBox($caption, $name, $value);
$element->addOptionArray($options);
break;
case "yesno":
$element = new XoopsFormRadioYN($caption, $name, $value);
break;
case "group":
$element = new XoopsFormSelectGroup($caption, $name, true, $value);
break;
case "group_multi":
$element = new XoopsFormSelectGroup($caption, $name, true, $value, 5, true);
break;
case "language":
$element = new XoopsFormSelectLang($caption, $name, $value);
break;
case "date":
$element = new XoopsFormTextDateSelect($caption, $name, 15, $value);
break;
// case "longdate":
// $element = new XoopsFormTextDateSelect($caption, $name, 15, str_replace("-", "/", $value));
// break;
// case "longdate":
// $element = new XoopsFormTextDateSelect($caption, $name, 15, str_replace("-", "/", $value));
// break;
case "datetime":
$element = new XoopsFormDatetime($caption, $name, 15, $value);
break;
case "list":
$element = new XoopsFormSelectList($caption, $name, $value, 1, $options[0]);
break;
case "timezone":
$element = new XoopsFormSelectTimezone($caption, $name, $value);
break;
case 'theme':
$element = new XoopsFormSelect($caption, $name, $value);
$element->addOption("0", _SITEDEFAULT);
$theme_list = XoopsLists::getThemesList();
foreach ($theme_list as $key => $val) {
if (!in_array($key, $GLOBALS['xoopsConfig']['theme_set_allowed'])) {
continue;
}
$element->addOption($key, $val);
}
/*
$handle = opendir(XOOPS_THEME_PATH.'/');
$dirlist = array();
while (false !== ($file = readdir($handle))) {
if (is_dir(XOOPS_THEME_PATH.'/'.$file) && !preg_match("/^[.]{1,2}$/",$file) && strtolower($file) != 'cvs') {
if (file_exists(XOOPS_THEME_PATH."/".$file."/theme.html") && in_array($file, $GLOBALS['xoopsConfig']['theme_set_allowed'])) {
$dirlist[$file]=$file;
//.........这里部分代码省略.........
示例8: dirname
<?php
require_once dirname(dirname(dirname(dirname(__DIR__)))) . DIRECTORY_SEPARATOR . 'mainfile.php';
require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'common.php';
global $resourcesModule, $resourcesConfigsList;
if (empty($resourcesModule)) {
if (is_a($resourcesModule = xoops_gethandler('module')->getByDirname(basename(dirname(__DIR__))), "XoopsModule")) {
if (empty($resourcesConfigsList)) {
$resourcesConfigsList = xoops_gethandler('config')->getConfigsList($resourcesModule->getVar('mid'));
}
}
}
xoops_load("XoopsCache");
xoops_load("XoopsLists");
if ($resourcesConfigsList['harvester']) {
foreach (XoopsLists::getThemesList() as $theme) {
if ($thememap = XoopsCache::read(basename(dirname(dirname(__DIR__))) . '.theme' . $theme . '.delays')) {
if (!XoopsCache::read(basename(dirname(dirname(__DIR__))) . '.theme' . $theme)) {
if ($monthmap = XoopsCache::read(basename(dirname(dirname(__DIR__))) . '.theme' . $theme . '.old')) {
foreach ($monthmap as $key => $values) {
if (isset($thememap[$key]) && $thememap[$key]['is'] == 'file') {
unset($thememap[$key]);
} elseif (isset($thememap[$key]) && $thememap[$key]['is'] == 'folder') {
unset($thememap[$key]);
}
}
if (count($thememap) > 0) {
$thememap = getMapFingering($thememap, $theme, 'theme');
} else {
$thememap = array();
}
示例9: __construct
/**
* Constructor
*
* @param string $caption caption
* @param string $name name
* @param mixed $value Pre-selected value (or array of them).
* @param integer $size Number or rows. "1" makes a drop-down-list
*/
public function __construct($caption, $name, $value = null, $size = 1)
{
parent::__construct($caption, $name, $value, $size);
$this->addOptionArray(\XoopsLists::getThemesList());
}
示例10: getFieldForm
//.........这里部分代码省略.........
$form->addElement(new XoopsFormText(_PROFILE_AM_MAXLENGTH, 'field_maxlength', 35, 35, $field->getVar('field_maxlength', 'e')));
$form->addElement(new XoopsFormTextArea(_PROFILE_AM_DEFAULT, 'field_default', $field->getVar('field_default', 'e')));
break;
case "checkbox":
case "select_multi":
$def_value = $field->getVar('field_default', 'e') != null ? unserialize($field->getVar('field_default', 'n')) : null;
$element = new XoopsFormSelect(_PROFILE_AM_DEFAULT, 'field_default', $def_value, 8, true);
$options = $field->getVar('field_options');
asort($options);
$element->addOptionArray($options);
$form->addElement($element);
break;
case "select":
case "radio":
$def_value = $field->getVar('field_default', 'e') != null ? $field->getVar('field_default') : null;
$element = new XoopsFormSelect(_PROFILE_AM_DEFAULT, 'field_default', $def_value);
$options = $field->getVar('field_options');
asort($options);
$element->addOptionArray($options);
$form->addElement($element);
break;
case "date":
$form->addElement(new XoopsFormTextDateSelect(_PROFILE_AM_DEFAULT, 'field_default', 15, $field->getVar('field_default', 'e')));
break;
case "datetime":
$form->addElement(new XoopsFormDateTime(_PROFILE_AM_DEFAULT, 'field_default', 15, $field->getVar('field_default', 'e')));
break;
case "yesno":
$form->addElement(new XoopsFormRadioYN(_PROFILE_AM_DEFAULT, 'field_default', $field->getVar('field_default', 'e')));
break;
case "timezone":
$form->addElement(new XoopsFormSelectTimezone(_PROFILE_AM_DEFAULT, 'field_default', $field->getVar('field_default', 'e')));
break;
case "language":
$form->addElement(new XoopsFormSelectLang(_PROFILE_AM_DEFAULT, 'field_default', $field->getVar('field_default', 'e')));
break;
case "group":
$form->addElement(new XoopsFormSelectGroup(_PROFILE_AM_DEFAULT, 'field_default', true, $field->getVar('field_default', 'e')));
break;
case "group_multi":
$form->addElement(new XoopsFormSelectGroup(_PROFILE_AM_DEFAULT, 'field_default', true, $field->getVar('field_default', 'e'), 5, true));
break;
case "theme":
$element = new XoopsFormSelect(_PROFILE_AM_DEFAULT, 'field_default', $field->getVar('field_default', 'e'));
$element->addOption("0", _SITEDEFAULT);
$theme_list = XoopsLists::getThemesList();
foreach ($theme_list as $key => $val) {
if (!in_array($key, $GLOBALS['xoopsConfig']['theme_set_allowed'])) {
continue;
}
$element->addOption($key, $val);
}
$form->addElement($element);
//$form->addElement(new XoopsFormSelectTheme(_PROFILE_AM_DEFAULT, 'field_default', $field->getVar('field_default', 'e')));
break;
case "autotext":
$form->addElement(new XoopsFormTextArea(_PROFILE_AM_DEFAULT, 'field_default', $field->getVar('field_default', 'e')));
break;
}
}
$groupperm_handler =& xoops_gethandler('groupperm');
$searchable_types = array('textbox', 'select', 'radio', 'yesno', 'date', 'datetime', 'timezone', 'language');
if (in_array($field->getVar('field_type'), $searchable_types)) {
$search_groups = $groupperm_handler->getGroupIds('profile_search', $field->getVar('fieldid'), $GLOBALS['xoopsModule']->getVar('mid'));
$form->addElement(new XoopsFormSelectGroup(_PROFILE_AM_PROF_SEARCH, 'profile_search', true, $search_groups, 5, true));
}
if ($field->getVar('field_show') || $field->getVar('field_edit')) {
//$form->addElement(new XoopsFormText(_PROFILE_AM_FIELD." "._PROFILE_AM_WEIGHT, 'field_weight', 35, 35, $field->getVar('field_weight', 'e')));
if (!$field->isNew()) {
//Load groups
$show_groups = $groupperm_handler->getGroupIds('profile_show', $field->getVar('fieldid'), $GLOBALS['xoopsModule']->getVar('mid'));
$editable_groups = $groupperm_handler->getGroupIds('profile_edit', $field->getVar('fieldid'), $GLOBALS['xoopsModule']->getVar('mid'));
$visible_groups = $groupperm_handler->getGroupIds('profile_visible', $field->getVar('fieldid'), $GLOBALS['xoopsModule']->getVar('mid'));
} else {
$visible_groups = array();
$show_groups = array();
$editable_groups = array();
}
if ($field->getVar('field_show')) {
// Leave out categories for now
// $cat_select = new XoopsFormSelect(_PROFILE_AM_CATEGORY, 'catid', $field->getVar('catid'));
// $category_handler =& xoops_getmodulehandler('category');
// $categories =& $category_handler->getObjects(null, true);
// foreach (array_keys($categories) as $i) {
// $cat_select->addOption($i, $categories[$i]->getVar('cat_title'));
// }
// $form->addElement($cat_select);
$form->addElement(new XoopsFormSelectGroup(_PROFILE_AM_PROF_VISIBLE_ON, 'profile_show', false, $show_groups, 5, true));
$form->addElement(new XoopsFormSelectGroup(_PROFILE_AM_PROF_VISIBLE_FOR, 'profile_visible', true, $visible_groups, 5, true));
}
if ($field->getVar('field_edit')) {
$form->addElement(new XoopsFormSelectGroup(_PROFILE_AM_PROF_EDITABLE, 'profile_edit', false, $editable_groups, 5, true));
$form->addElement(new XoopsFormRadioYN(_PROFILE_AM_REQUIRED, 'field_required', $field->getVar('field_required', 'e')));
$form->addElement(new XoopsFormRadioYN(_PROFILE_AM_PROF_REGISTER, 'field_register', $field->getVar('field_register', 'e')));
}
}
$form->addElement(new XoopsFormHidden('op', 'save'));
$form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
return $form;
}