本文整理汇总了PHP中Xoops::getModuleHelper方法的典型用法代码示例。如果您正苦于以下问题:PHP Xoops::getModuleHelper方法的具体用法?PHP Xoops::getModuleHelper怎么用?PHP Xoops::getModuleHelper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Xoops
的用法示例。
在下文中一共展示了Xoops::getModuleHelper方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: eventSystemPreferencesForm
public static function eventSystemPreferencesForm(XoopsModule $module)
{
$helper = \Xoops::getModuleHelper('comments');
if ($plugin = Plugin::getPlugin($module->getVar('dirname'), 'comments')) {
$helper->loadLanguage('main');
}
}
示例2: deleteRegstep
/**
* Delete an object from the database
* @see XoopsPersistableObjectHandler
*
* @param XoopsObject|ProfileRegstep $obj
* @param bool $force
*
* @return bool
*/
public function deleteRegstep(XoopsObject $obj, $force = false)
{
if (parent::delete($obj, $force)) {
$field_handler = \Xoops::getModuleHelper('profile')->getHandler('field');
return $field_handler->updateAll('step_id', 0, new Criteria('step_id', $obj->getVar('step_id')));
}
return false;
}
示例3: backend
/**
* Used to populate backend
*
* @param int $limit : Number of item for backend
* Expects an array containing:
* title : Title for the backend items
* link : Link for the backend items
* content : content for the backend items
* date : Date of the backend items
*
* @return array
*/
public function backend($limit)
{
$ret = array();
$page = \Xoops::getModuleHelper('page');
$contents = $page->getContentHandler()->getPagePublished(0, $limit);
foreach ($contents as $k => $content) {
$ret[$k]['title'] = $content->getVar('content_title');
$ret[$k]['link'] = $page->url('viewpage.php') . '?id=' . $content->getVar('content_id');
$ret[$k]['content'] = $content->getVar('content_shorttext') . '<br />' . $content->getVar('content_text');
$ret[$k]['date'] = $content->getVar('content_create');
}
return $ret;
}
示例4: waiting
/**
* @return array
*/
public function waiting()
{
$comments = \Xoops::getModuleHelper('comments');
//need this here to init constants
$criteria = new CriteriaCompo(new Criteria('status', Comments::STATUS_PENDING));
$ret = array();
if ($count = $comments->getHandlerComment()->getCount($criteria)) {
$ret['count'] = $count;
$ret['name'] = Xoops::getInstance()->getHandlerModule()->getByDirname('comments')->getVar('name');
$ret['link'] = Xoops::getInstance()->url('modules/comments/admin/main.php');
}
return $ret;
}
示例5: b_search_show
/**
* Blocks functions
*
* @copyright XOOPS Project (http://xoops.org)
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @author Laurent JEN (aka DuGris)
* @package system
* @version $Id$
*/
function b_search_show()
{
$search = \Xoops::getModuleHelper('search');
$search->loadLanguage('main', 'search');
$form = new Xoops\Form\SimpleForm('', 'search', $search->url('index.php'), 'get', false, 'inline');
// create form elements
$form->addElement(new Xoops\Form\Text('', 'query', 2, 100, '', _MD_SEARCH_KEYWORDS), true);
$form->addElement(new Xoops\Form\Hidden('action', 'results'));
$form->addElement(new Xoops\Form\Token('id'));
$button = new Xoops\Form\Button('', 'submit', _MD_SEARCH, 'submit');
$button->setClass('btn btn-primary');
$form->addElement($button);
$block['form'] = $form->render();
return $block;
}
示例6: getSearchFrom
public function getSearchFrom($andor, $queries, $mids, $mid)
{
$xoops = \Xoops::getInstance();
$search = \Xoops::getModuleHelper('search');
// create form
parent::__construct(_MD_SEARCH, 'search', 'index.php', 'get');
// create form elements
$this->addElement(new Xoops\Form\Text(_MD_SEARCH_KEYWORDS, 'query', 30, 255, htmlspecialchars(stripslashes($this->queryArrayToString($queries)), ENT_QUOTES)), true);
$type_select = new Xoops\Form\Select(_MD_SEARCH_TYPE, 'andor', $andor);
$type_select->addOptionArray(array('AND' => _MD_SEARCH_ALL, 'OR' => _MD_SEARCH_ANY));
$this->addElement($type_select);
if (!empty($mids)) {
$mods_checkbox = new Xoops\Form\Checkbox(_MD_SEARCH_SEARCHIN, 'mids[]', $mids);
} else {
$mods_checkbox = new Xoops\Form\Checkbox(_MD_SEARCH_SEARCHIN, 'mids[]', $mid);
}
if (empty($modules)) {
$gperm_handler = $xoops->getHandlerGroupPermission();
$available_modules = $gperm_handler->getItemIds('module_read', $xoops->getUserGroups());
$available_plugins = \Xoops\Module\Plugin::getPlugins('search');
//todo, would be nice to have the module ids availabe also
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('dirname', "('" . implode("','", array_keys($available_plugins)) . "')", 'IN'));
if (isset($available_modules) && !empty($available_modules)) {
$criteria->add(new Criteria('mid', '(' . implode(',', $available_modules) . ')', 'IN'));
}
$module_handler = $xoops->getHandlerModule();
$mods_checkbox->addOptionArray($module_handler->getNameList($criteria));
} else {
/* @var $module XoopsModule */
$module_array = array();
foreach ($modules as $mid => $module) {
$module_array[$mid] = $module->getVar('name');
}
$mods_checkbox->addOptionArray($module_array);
}
$this->addElement($mods_checkbox);
if ($search->getConfig('keyword_min') > 0) {
$this->addElement(new Xoops\Form\Label(_MD_SEARCH_SEARCHRULE, sprintf(_MD_SEARCH_KEYIGNORE, $search->getConfig('keyword_min'))));
}
$this->addElement(new Xoops\Form\Hidden('action', 'results'));
$this->addElement(new Xoops\Form\Token('id'));
$this->addElement(new Xoops\Form\Button('', 'submit', _MD_SEARCH, 'submit'));
return $this;
}
示例7: eventSystemModuleUpdateConfigs
public static function eventSystemModuleUpdateConfigs(ConfigCollector $collector)
{
$helper = \Xoops::getModuleHelper('notifications');
if ($plugin = Plugin::getPlugin($collector->module()->getVar('dirname'), 'notifications', true)) {
$pluginConfigs = $helper->getPluginableConfigs($collector->module());
$collector->add($pluginConfigs);
}
}
示例8: array
if (!empty($link)) {
$btn[] = array('link' => $link, 'title' => XoopsLocale::AVATAR, 'icon' => 'icon-user');
$xoops->tpl()->assign('btn', $btn);
}
$xoops->tpl()->assign('xoops_pagetitle', sprintf(XoopsLocale::F_ALL_ABOUT, $thisUser->getVar('uname')));
// Dynamic User Profiles
$thisUsergroups = $thisUser->getGroups();
/* @var $visibility_handler ProfileVisibilityHandler */
$visibility_handler = \Xoops::getModuleHelper('profile')->getHandler('visibility');
//search for visible Fields or null for none
$field_ids_visible = $visibility_handler->getVisibleFields($thisUsergroups, $groups);
/* @var $profile_handler ProfileProfileHandler */
$profile_handler = \Xoops::getModuleHelper('profile')->getHandler('profile');
$fields = $profile_handler->loadFields();
/* @var $category_handler ProfileCategoryHandler */
$cat_handler = \Xoops::getModuleHelper('profile')->getHandler('category');
$cat_crit = new CriteriaCompo();
$cat_crit->setSort("cat_weight");
$cats = $cat_handler->getObjects($cat_crit, true, false);
unset($cat_crit);
$response = $xoops->service("Avatar")->getAvatarUrl($thisUser);
$avatar = $response->getValue();
$avatar = empty($avatar) ? '' : $avatar;
$email = "";
if ($thisUser->getVar('user_viewemail') == 1) {
$email = $thisUser->getVar('email', 'E');
} else {
if ($xoops->isUser()) {
// Module admins will be allowed to see emails
if ($xoops->user->isAdmin() || $xoops->user->getVar("uid") == $thisUser->getVar("uid")) {
$email = $thisUser->getVar('email', 'E');
示例9: profile_getUserForm
/**
* Get {@link Xoops\Form\ThemeForm} for editing a user
*
* @param XoopsUser $user
* @param ProfileProfile|null $profile
* @param bool $action
* @return Xoops\Form\ThemeForm
*/
function profile_getUserForm(XoopsUser $user, ProfileProfile $profile = null, $action = false)
{
$xoops = Xoops::getInstance();
if ($action === false) {
$action = $_SERVER['REQUEST_URI'];
}
$title = $user->isNew() ? _PROFILE_AM_ADDUSER : XoopsLocale::EDIT_PROFILE;
$form = new Xoops\Form\ThemeForm($title, 'userinfo', $action, 'post', true);
/* @var $profile_handler ProfileProfileHandler */
$profile_handler = \Xoops::getModuleHelper('profile')->getHandler('profile');
// Dynamic fields
if (!$profile) {
$profile = $profile_handler->getProfile($user->getVar('uid'));
}
// Get fields
$fields = $profile_handler->loadFields();
// Get ids of fields that can be edited
$gperm_handler = $xoops->getHandlerGroupPermission();
$editable_fields = $gperm_handler->getItemIds('profile_edit', $xoops->user->getGroups(), $xoops->module->getVar('mid'));
if ($user->isNew() || $xoops->user->isAdmin()) {
$elements[0][] = array('element' => new Xoops\Form\Text(XoopsLocale::USERNAME, 'uname', 3, $xoops->user->isAdmin() ? 60 : $xoops->getConfig('maxuname'), $user->getVar('uname', 'e')), 'required' => 1);
$email_text = new Xoops\Form\Text('', 'email', 4, 60, $user->getVar('email'));
} else {
$elements[0][] = array('element' => new Xoops\Form\Label(XoopsLocale::USERNAME, $user->getVar('uname')), 'required' => 0);
$email_text = new Xoops\Form\Label('', $user->getVar('email'));
}
$email_tray = new Xoops\Form\ElementTray(XoopsLocale::EMAIL, '<br />');
$email_tray->addElement($email_text, $user->isNew() || $xoops->user->isAdmin() ? 1 : 0);
$weights[0][] = 0;
$elements[0][] = array('element' => $email_tray, 'required' => 0);
$weights[0][] = 0;
if ($xoops->user->isAdmin() && $user->getVar('uid') != $xoops->user->getVar('uid')) {
//If the user is an admin and is editing someone else
$pwd_text = new Xoops\Form\Password('', 'password', 3, 32);
$pwd_text2 = new Xoops\Form\Password('', 'vpass', 3, 32);
$pwd_tray = new Xoops\Form\ElementTray(XoopsLocale::PASSWORD . '<br />' . XoopsLocale::TYPE_NEW_PASSWORD_TWICE_TO_CHANGE_IT);
$pwd_tray->addElement($pwd_text);
$pwd_tray->addElement($pwd_text2);
$elements[0][] = array('element' => $pwd_tray, 'required' => 0);
//cannot set an element tray required
$weights[0][] = 0;
$level_radio = new Xoops\Form\Radio(_PROFILE_MA_USERLEVEL, 'level', $user->getVar('level'));
$level_radio->addOption(1, _PROFILE_MA_ACTIVE);
$level_radio->addOption(0, _PROFILE_MA_INACTIVE);
//$level_radio->addOption(-1, _PROFILE_MA_DISABLED);
$elements[0][] = array('element' => $level_radio, 'required' => 0);
$weights[0][] = 0;
}
$elements[0][] = array('element' => new Xoops\Form\Hidden('uid', $user->getVar('uid')), 'required' => 0);
$weights[0][] = 0;
$elements[0][] = array('element' => new Xoops\Form\Hidden('op', 'save'), 'required' => 0);
$weights[0][] = 0;
$cat_handler = \Xoops::getModuleHelper('profile')->getHandler('category');
$categories = array();
$all_categories = $cat_handler->getObjects(null, true, false);
$count_fields = count($fields);
/* @var ProfileField $field */
foreach ($fields as $field) {
if (in_array($field->getVar('field_id'), $editable_fields)) {
// Set default value for user fields if available
if ($user->isNew()) {
$default = $field->getVar('field_default');
if ($default !== '' && $default !== null) {
$user->setVar($field->getVar('field_name'), $default);
}
}
if ($profile->getVar($field->getVar('field_name'), 'n') === null) {
$default = $field->getVar('field_default', 'n');
$profile->setVar($field->getVar('field_name'), $default);
}
$fieldinfo['element'] = $field->getEditElement($user, $profile);
$fieldinfo['required'] = $field->getVar('field_required');
$key = @$all_categories[$field->getVar('cat_id')]['cat_weight'] * $count_fields + $field->getVar('cat_id');
$elements[$key][] = $fieldinfo;
$weights[$key][] = $field->getVar('field_weight');
$categories[$key] = @$all_categories[$field->getVar('cat_id')];
}
}
if ($xoops->isUser() && $xoops->user->isAdmin()) {
$xoops->loadLanguage('admin', 'profile');
$gperm_handler = $xoops->getHandlerGroupPermission();
//If user has admin rights on groups
include_once $xoops->path('modules/system/constants.php');
if ($gperm_handler->checkRight('system_admin', XOOPS_SYSTEM_GROUP, $xoops->user->getGroups(), 1)) {
//add group selection
$group_select = new Xoops\Form\SelectGroup(XoopsLocale::USER_GROUPS, 'groups', false, $user->getGroups(), 5, true);
$elements[0][] = array('element' => $group_select, 'required' => 0);
//set as latest;
$weights[0][] = $count_fields + 1;
}
}
ksort($elements);
//.........这里部分代码省略.........
示例10: __construct
/**
* @param ProfileField|XoopsObject $obj
*/
public function __construct(ProfileField $obj)
{
$xoops = Xoops::getInstance();
$title = $obj->isNew() ? sprintf(_PROFILE_AM_ADD, _PROFILE_AM_FIELD) : sprintf(_PROFILE_AM_EDIT, _PROFILE_AM_FIELD);
parent::__construct($title, 'form', '', 'post', true);
$this->addElement(new Xoops\Form\Text(_PROFILE_AM_TITLE, 'field_title', 5, 255, $obj->getVar('field_title', 'e')), true);
$this->addElement(new Xoops\Form\TextArea(_PROFILE_AM_DESCRIPTION, 'field_description', $obj->getVar('field_description', 'e'), 5, 5));
if (!$obj->isNew()) {
$fieldcat_id = $obj->getVar('cat_id');
} else {
$fieldcat_id = 0;
}
$category_handler = \Xoops::getModuleHelper('profile')->getHandler('category');
$cat_select = new Xoops\Form\Select(_PROFILE_AM_CATEGORY, 'field_category', $fieldcat_id);
$cat_select->addOption(0, _PROFILE_AM_DEFAULT);
$cat_select->addOptionArray($category_handler->getList());
$this->addElement($cat_select);
$weight = new Xoops\Form\Text(_PROFILE_AM_WEIGHT, 'field_weight', 1, 10, $obj->getVar('field_weight', 'e'), '');
$weight->setPattern('^\\d+$', _PROFILE_AM_ERROR_WEIGHT);
$this->addElement($weight, true);
if ($obj->getVar('field_config') || $obj->isNew()) {
if (!$obj->isNew()) {
$this->addElement(new Xoops\Form\Label(_PROFILE_AM_NAME, $obj->getVar('field_name')));
$this->addElement(new Xoops\Form\Hidden('id', $obj->getVar('field_id')));
} else {
$this->addElement(new Xoops\Form\Text(_PROFILE_AM_NAME, 'field_name', 5, 255, $obj->getVar('field_name', 'e')), true);
}
//autotext and theme left out of this one as fields of that type should never be changed (valid assumption, I think)
$fieldtypes = array('checkbox' => _PROFILE_AM_CHECKBOX, 'date' => _PROFILE_AM_DATE, 'datetime' => _PROFILE_AM_DATETIME, 'longdate' => _PROFILE_AM_LONGDATE, 'group' => _PROFILE_AM_GROUP, 'group_multi' => _PROFILE_AM_GROUPMULTI, 'language' => _PROFILE_AM_LANGUAGE, 'radio' => _PROFILE_AM_RADIO, 'select' => _PROFILE_AM_SELECT, 'select_multi' => _PROFILE_AM_SELECTMULTI, 'textarea' => _PROFILE_AM_TEXTAREA, 'dhtml' => _PROFILE_AM_DHTMLTEXTAREA, 'textbox' => _PROFILE_AM_TEXTBOX, 'timezone' => _PROFILE_AM_TIMEZONE, 'yesno' => _PROFILE_AM_YESNO);
$element_select = new Xoops\Form\Select(_PROFILE_AM_TYPE, 'field_type', $obj->getVar('field_type', 'e'));
$element_select->addOptionArray($fieldtypes);
$this->addElement($element_select);
switch ($obj->getVar('field_type')) {
case "textbox":
$valuetypes = array(XOBJ_DTYPE_ARRAY => _PROFILE_AM_ARRAY, XOBJ_DTYPE_EMAIL => _PROFILE_AM_EMAIL, XOBJ_DTYPE_INT => _PROFILE_AM_INT, XOBJ_DTYPE_FLOAT => _PROFILE_AM_FLOAT, XOBJ_DTYPE_DECIMAL => _PROFILE_AM_DECIMAL, XOBJ_DTYPE_TXTAREA => _PROFILE_AM_TXTAREA, XOBJ_DTYPE_TXTBOX => _PROFILE_AM_TXTBOX, XOBJ_DTYPE_URL => _PROFILE_AM_URL, XOBJ_DTYPE_OTHER => _PROFILE_AM_OTHER);
$type_select = new Xoops\Form\Select(_PROFILE_AM_VALUETYPE, 'field_valuetype', $obj->getVar('field_valuetype', 'e'), 5, 5);
$type_select->addOptionArray($valuetypes);
$this->addElement($type_select);
break;
case "select":
case "radio":
$valuetypes = array(XOBJ_DTYPE_ARRAY => _PROFILE_AM_ARRAY, XOBJ_DTYPE_EMAIL => _PROFILE_AM_EMAIL, XOBJ_DTYPE_INT => _PROFILE_AM_INT, XOBJ_DTYPE_FLOAT => _PROFILE_AM_FLOAT, XOBJ_DTYPE_DECIMAL => _PROFILE_AM_DECIMAL, XOBJ_DTYPE_TXTAREA => _PROFILE_AM_TXTAREA, XOBJ_DTYPE_TXTBOX => _PROFILE_AM_TXTBOX, XOBJ_DTYPE_URL => _PROFILE_AM_URL, XOBJ_DTYPE_OTHER => _PROFILE_AM_OTHER);
$type_select = new Xoops\Form\Select(_PROFILE_AM_VALUETYPE, 'field_valuetype', $obj->getVar('field_valuetype', 'e'));
$type_select->addOptionArray($valuetypes);
$this->addElement($type_select);
break;
}
//$this->addElement(new Xoops\Form\RadioYesNo(_PROFILE_AM_NOTNULL, 'field_notnull', $obj->getVar('field_notnull', 'e') ));
if ($obj->getVar('field_type') == "select" || $obj->getVar('field_type') == "select_multi" || $obj->getVar('field_type') == "radio" || $obj->getVar('field_type') == "checkbox") {
$options = $obj->getVar('field_options');
if (count($options) > 0) {
$remove_options = new Xoops\Form\Checkbox(_PROFILE_AM_REMOVEOPTIONS, 'removeOptions');
//$remove_options->columns = 3;
asort($options);
foreach (array_keys($options) as $key) {
$options[$key] .= "[{$key}]";
}
$remove_options->addOptionArray($options);
$this->addElement($remove_options);
}
$option_text = "<table cellspacing='1'><tr><td class='width20'>" . _PROFILE_AM_KEY . "</td><td>" . _PROFILE_AM_VALUE . "</td></tr>";
for ($i = 0; $i < 3; ++$i) {
$option_text .= "<tr><td><input type='text' name='addOption[{$i}][key]' id='addOption[{$i}][key]' size='15' /></td><td><input type='text' name='addOption[{$i}][value]' id='addOption[{$i}][value]' size='35' /></td></tr>";
$option_text .= "<tr height='3px'><td colspan='2'> </td></tr>";
}
$option_text .= "</table>";
$this->addElement(new Xoops\Form\Label(_PROFILE_AM_ADDOPTION, $option_text));
}
}
if ($obj->getVar('field_edit')) {
switch ($obj->getVar('field_type')) {
case "textbox":
case "textarea":
case "dhtml":
$this->addElement(new Xoops\Form\Text(_PROFILE_AM_MAXLENGTH, 'field_maxlength', 5, 5, $obj->getVar('field_maxlength', 'e')));
$this->addElement(new Xoops\Form\TextArea(_PROFILE_AM_DEFAULT, 'field_default', $obj->getVar('field_default', 'e')));
break;
case "checkbox":
case "select_multi":
$def_value = $obj->getVar('field_default', 'e') != null ? unserialize($obj->getVar('field_default', 'n')) : null;
$element = new Xoops\Form\Select(_PROFILE_AM_DEFAULT, 'field_default', $def_value, 8, true);
$options = $obj->getVar('field_options');
asort($options);
// If options do not include an empty element, then add a blank option to prevent any default selection
if (!in_array('', array_keys($options))) {
$element->addOption('', XoopsLocale::NONE);
}
$element->addOptionArray($options);
$this->addElement($element);
break;
case "select":
case "radio":
$def_value = $obj->getVar('field_default', 'e') != null ? $obj->getVar('field_default') : null;
$element = new Xoops\Form\Select(_PROFILE_AM_DEFAULT, 'field_default', $def_value);
$options = $obj->getVar('field_options');
asort($options);
// If options do not include an empty element, then add a blank option to prevent any default selection
//.........这里部分代码省略.........
示例11: sprintf
*/
include __DIR__ . '/header.php';
// Get main instance
$system = System::getInstance();
$xoops = Xoops::getInstance();
//there is no way to override current tabs when using system menu
//this dirty hack will have to do it
$_SERVER['REQUEST_URI'] = "admin/permissions.php";
// Get Action type
$op = $system->cleanVars($_REQUEST, 'op', 'visibility', 'string');
// Call header
$xoops->header();
$admin_page = new \Xoops\Module\Admin();
$admin_page->displayNavigation('permissions.php');
$visibility_handler = \Xoops::getModuleHelper('profile')->getHandler('visibility');
$field_handler = \Xoops::getModuleHelper('profile')->getHandler('field');
$fields = $field_handler->getList();
if (isset($_REQUEST['submit'])) {
$visibility = $visibility_handler->create();
$visibility->setVar('field_id', $_REQUEST['field_id']);
$visibility->setVar('user_group', $_REQUEST['ug']);
$visibility->setVar('profile_group', $_REQUEST['pg']);
$visibility_handler->insert($visibility, true);
$xoops->redirect("visibility.php", 2, sprintf(_PROFILE_AM_SAVEDSUCCESS, _PROFILE_AM_PROF_VISIBLE));
}
if ($op == "del") {
$criteria = new CriteriaCompo(new Criteria('field_id', (int) $_REQUEST['field_id']));
$criteria->add(new Criteria('user_group', (int) $_REQUEST['ug']));
$criteria->add(new Criteria('profile_group', (int) $_REQUEST['pg']));
$visibility_handler->deleteAll($criteria, true);
$xoops->redirect("visibility.php", 2, sprintf(_PROFILE_AM_DELETEDSUCCESS, _PROFILE_AM_PROF_VISIBLE));
示例12: __construct
public function __construct(Connection $db)
{
parent::__construct($db, 'profile_profile', 'ProfileProfile', 'profile_id');
$xoops = Xoops::getInstance();
$this->_fHandler = \Xoops::getModuleHelper('profile')->getHandler('field');
}
示例13:
* @package profile
* @since 2.3.0
* @author Jan Pedersen
* @author Taiwen Jiang <phppp@users.sourceforge.net>
* @version $Id$
*/
include __DIR__ . '/header.php';
// Get main instance
$system = System::getInstance();
$xoops = Xoops::getInstance();
// Get Action type
$op = $system->cleanVars($_REQUEST, 'op', 'list', 'string');
// Call header
$xoops->header('admin:profile/steplist.tpl');
// Get handler
$regstep_Handler = \Xoops::getModuleHelper('profile')->getHandler("regstep");
$admin_page = new \Xoops\Module\Admin();
$admin_page->renderNavigation('step.php');
switch ($op) {
case "list":
default:
// Add Scripts
$xoops->theme()->addScript('media/xoops/xoops.js');
$admin_page->addItemButton(XoopsLocale::A_ADD . ' ' . _PROFILE_AM_STEP, 'step.php?op=new', 'add');
$admin_page->renderButton();
$xoops->tpl()->assign('steps', $regstep_Handler->getObjects(null, true, false));
$xoops->tpl()->assign('step', true);
break;
case "new":
$admin_page->addItemButton(_PROFILE_AM_STEP_LIST, 'step.php', 'application-view-detail');
$admin_page->renderButton();
示例14: array
exit;
}
$uid = $xoops->user->getVar('uid');
$errors = array();
$edituser = $xoops->user;
if ($xoops->user->isAdmin()) {
$edituser->setVar('uname', trim($_POST['uname']));
$edituser->setVar('email', trim($_POST['email']));
}
$stop = XoopsUserUtility::validate($edituser);
if (!empty($stop)) {
$op = 'editprofile';
} else {
// Dynamic fields
/* @var $profile_handler ProfileProfileHandler */
$profile_handler = \Xoops::getModuleHelper('profile')->getHandler('profile');
// Get fields
$fields = $profile_handler->loadFields();
// Get ids of fields that can be edited
$gperm_handler = $xoops->getHandlerGroupPermission();
$editable_fields = $gperm_handler->getItemIds('profile_edit', $xoops->user->getGroups(), $xoops->module->getVar('mid'));
if (!($profile = $profile_handler->getProfile($edituser->getVar('uid')))) {
$profile = $profile_handler->create();
$profile->setVar('profile_id', $edituser->getVar('uid'));
}
/* @var ProfileField $field */
foreach ($fields as $field) {
$fieldname = $field->getVar('field_name');
if (in_array($field->getVar('field_id'), $editable_fields) && isset($_REQUEST[$fieldname])) {
$value = $field->getValueForSave($_REQUEST[$fieldname]);
if (in_array($fieldname, $profile_handler->getUserVars())) {
示例15: deleteFields
/**
* delete a profile field from the database
*
* @param XoopsObject|ProfileField $obj reference to the object to delete
* @param bool $force
* @return bool FALSE if failed.
**/
public function deleteFields(XoopsObject $obj, $force = false)
{
$xoops = Xoops::getInstance();
$profile_handler = \Xoops::getModuleHelper('profile')->getHandler('profile');
// remove column from table
$sql = "ALTER TABLE " . $profile_handler->table . " DROP `" . $obj->getVar('field_name', 'n') . "`";
if ($this->db2->query($sql)) {
//change this to update the cached field information storage
if (!parent::delete($obj, $force)) {
return false;
}
if ($obj->getVar('field_show') || $obj->getVar('field_edit')) {
$profile_module = $xoops->getModuleByDirname('profile');
if (is_object($profile_module)) {
// Remove group permissions
$groupperm_handler = $xoops->getHandlerGroupPermission();
$criteria = new CriteriaCompo(new Criteria('gperm_modid', $profile_module->getVar('mid')));
$criteria->add(new Criteria('gperm_itemid', $obj->getVar('field_id')));
return $groupperm_handler->deleteAll($criteria);
}
}
}
return false;
}