本文整理汇总了PHP中FieldList::storeFieldsForUser方法的典型用法代码示例。如果您正苦于以下问题:PHP FieldList::storeFieldsForUser方法的具体用法?PHP FieldList::storeFieldsForUser怎么用?PHP FieldList::storeFieldsForUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FieldList
的用法示例。
在下文中一共展示了FieldList::storeFieldsForUser方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fieldsTask
public function fieldsTask()
{
$level = Docebo::user()->getUserLevelId();
if (Get::sett('request_mandatory_fields_compilation', 'off') == 'on' && $level != ADMIN_GROUP_GODADMIN) {
require_once _adm_ . '/lib/lib.field.php';
$fl = new FieldList();
$idst_user = Docebo::user()->getIdSt();
$res = $fl->storeFieldsForUser($idst_user);
}
Util::jump_to('index.php?r=elearning/show');
}
示例2: set
/**
* Set the new fields and policy acceptance, than jump to the proper page
*/
public function set()
{
$id_user = Docebo::user()->getIdst();
require_once _adm_ . '/lib/lib.field.php';
$fl = new FieldList();
$fl->storeFieldsForUser($id_user);
$accept_policy = Get::req('accept_policy', DOTY_INT, 0) > 0;
$this->model->setAcceptingPolicy($id_user, $accept_policy);
$policy_checked = $this->model->getAcceptingPolicy($id_user);
$fields_checked = $fl->checkUserMandatoryFields($id_user);
if ($fields_checked && $policy_checked) {
//send alert
Util::jump_to($this->jump_url);
} else {
//send alert
Util::jump_to('index.php?r=precompile/show&res=err');
}
}
示例3: saveUserData
/**
* save the data sended by a user profile modification
*/
function saveUserData($id_user, $data, $also_preference, $also_extra_field)
{
if (!$this->acl_man->updateUser($id_user, isset($data['userid']) ? $data['userid'] : false, $data['firstname'], $data['lastname'], isset($data['new_pwd']) && $data['new_pwd'] != '' && $data['new_pwd'] == $data['repeat_pwd'] ? $data['new_pwd'] : false, $data['email'], FALSE, $data['signature'], FALSE, FALSE, isset($data['force_change']) ? $data['force_change'] : '', $data['facebook_id'], $data['twitter_id'], $data['linkedin_id'], $data['google_id'])) {
return false;
}
if (isset($data['level'])) {
$acl_man =& Docebo::user()->getAclManager();
$current_level = $acl_man->getUserLevelId($id_user);
if ($data['level'] != $current_level) {
$arr_levels = $acl_man->getAdminLevels();
$acl_man->addToGroup($arr_levels[$data['level']], $id_user);
$acl_man->removeFromGroup($arr_levels[$current_level], $id_user);
}
}
if ($also_extra_field) {
require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
$extra_field = new FieldList();
if (!$extra_field->storeFieldsForUser($id_user)) {
return false;
}
}
if ($also_preference) {
require_once _base_ . '/lib/lib.preference.php';
$preference = new UserPreferences($id_user);
if (!$preference->savePreferences($_POST, 'ui.')) {
return false;
}
}
return true;
}
示例4: savesel
function savesel()
{
checkPerm('view');
require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
require_once _base_ . '/lib/lib.form.php';
$lang =& DoceboLanguage::createInstance('register', 'lms');
$mand_sym = '<span class="mandatory">*</span>';
$extra_field = new FieldList();
$GLOBALS['page']->add(getTitleArea($lang->def('_MYGROUP'), 'mygroup') . '<div class="std_block">', 'content');
$selected = array();
if (isset($_POST['group_sel'])) {
$selected = $_POST['group_sel'];
} elseif (isset($_POST['group_sel_implode'])) {
$selected = explode(',', $_POST['group_sel_implode']);
}
$play_field = $extra_field->playFieldsForUser(getLogUserId(), $selected, false, false, array('readonly'));
if (isset($_POST['save_field']) || $play_field === false || $play_field == '') {
$re_filled = $extra_field->isFilledFieldsForUser(getLogUserId(), $selected);
if (!$re_filled) {
$GLOBALS['page']->add(getErrorUi($lang->def('_SOME_MANDATORY_EMPTY')), 'content');
} else {
$acl =& Docebo::user()->getAcl();
$acl_man =& Docebo::user()->getAclManager();
$groups =& $acl_man->getAllGroupsId(array('free', 'moderate'));
$groups_id = array_keys($groups);
$user_group = $acl->getSTGroupsST(getLogUserId());
$add_groups = array_diff($selected, $user_group);
$del_groups = array_diff($groups_id, $selected);
$moderate_add = false;
if (!empty($add_groups)) {
while (list(, $idst) = each($add_groups)) {
if ($groups[$idst]['type'] == 'free') {
$acl_man->addToGroup($idst, getLogUserId());
} elseif ($groups[$idst]['type'] == 'moderate') {
$acl_man->addToWaitingGroup($idst, getLogUserId());
$moderate_add = true;
}
}
}
if ($moderate_add === true) {
require_once _base_ . '/lib/lib.eventmanager.php';
// message to user that is odified
$msg_composer = new EventMessageComposer();
$msg_composer->setSubjectLangText('email', '_TO_APPROVE_GROUP_USER_SBJ', false);
$msg_composer->setBodyLangText('email', '_TO_APPROVE_GROUP_USER_TEXT', array('[url]' => Get::sett('url')));
$msg_composer->setBodyLangText('sms', '_TO_APPROVE_GROUP_USER_TEXT_SMS', array('[url]' => Get::sett('url')));
$idst_approve = $acl->getRoleST('/framework/admin/directory/editgroup');
$recipients = $acl_man->getAllRoleMembers($idst_approve);
createNewAlert('UserGroupModerated', 'directory', 'moderate', '1', 'User group subscription to moderate', $recipients, $msg_composer);
}
if (!empty($del_groups)) {
while (list(, $idst_group) = each($del_groups)) {
$extra_field->removeUserEntry(getLogUserId(), $idst_group);
$acl_man->removeFromGroup($idst_group, getLogUserId());
}
}
// Save fields
$extra_field->storeFieldsForUser(getLogUserId());
Util::jump_to('index.php?modname=mygroup&op=group');
}
}
$GLOBALS['page']->add('<div class="reg_note">' . $lang->def('_GROUPS_FIELDS') . '<ul class="reg_instruction">' . '<li>' . str_replace('[mandatory]', $mand_sym, $lang->def('_REG_MANDATORY')) . '</li>' . '</ul>' . '</div>' . Form::openForm('group_subscription', 'index.php?modname=mygroup&op=savesel') . Form::openElementSpace() . Form::getHidden('group_sel_implode', 'group_sel_implode', isset($_POST['group_sel_implode']) ? $_POST['group_sel_implode'] : implode(',', $selected)) . $play_field . Form::getBreakRow() . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save_field', 'save_field', $lang->def('_SAVE')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
}
示例5: Social
function _opt_in($options, $platform, $opt_link)
{
$social = new Social();
$lang =& DoceboLanguage::createInstance('register', $platform);
// Check for error
$out = '';
$error = $this->_checkField($_POST, $options, $platform, true);
if ($error['error']) {
$this->error = true;
return '<div class="reg_err_data">' . $error['msg'] . '</div>';
}
// Insert temporary
$random_code = md5($_POST['register']['userid'] . mt_rand() . mt_rand() . mt_rand());
// register as temporary user and send mail
$acl_man =& Docebo::user()->getAclManager();
$iduser = $acl_man->registerTempUser($_POST['register']['userid'], $_POST['register']['firstname'], $_POST['register']['lastname'], $_POST['register']['pwd'], $_POST['register']['email'], $random_code);
if ($iduser === false) {
$out .= '<div class="reg_err_data">' . $lang->def('_OPERATION_FAILURE') . '</div>';
$this->error = true;
return $out;
}
// facebook register:
if ($social->isActive('facebook')) {
if (isset($_SESSION['fb_info']) && is_array($_SESSION['fb_info'])) {
$social = new Social();
$social->connectAccount('facebook', $_SESSION['fb_info']['id'], $iduser, true);
unset($_SESSION['fb_info']);
}
}
// ----
// add base inscription policy
$enrollrules = new EnrollrulesAlms();
$enrollrules->newRules('_NEW_USER', array($iduser), Lang::get());
// subscribe to groups -----------------------------------------
if (isset($_POST['group_sel_implode'])) {
$groups = explode(',', $_POST['group_sel_implode']);
while (list(, $idst) = each($groups)) {
$acl_man->addToGroup($idst, $iduser);
// FORMA: added the inscription policy
$enrollrules = new EnrollrulesAlms();
$enrollrules->applyRulesMultiLang('_LOG_USERS_TO_GROUP', array((string) $iduser), false, (int) $idst, true);
// END FORMA
}
}
//if the user had enter a code we must check if there are folder related to it and add the folder's field
$registration_code_type = Get::sett('registration_code_type', '0');
$code_is_mandatory = Get::sett('mandatory_code', 'off') == 'on';
$reg_code = Get::req('reg_code', DOTY_MIXED, '');
if ($registration_code_type === 'custom') {
$reg_code = 'change_by_custom_operation';
}
$array_folder = false;
$uma = new UsermanagementAdm();
$reg_code_res = $this->processRegistrationCode($acl_man, $uma, $iduser, $reg_code, $registration_code_type);
if ($reg_code_res['success'] == false) {
$acl_man->deleteTempUser($iduser);
$this->error = true;
return '<div class="reg_err_data">' . $reg_code_res['msg'] . '</div>';
}
// save language selected
require_once _base_ . '/lib/lib.preference.php';
$preference = new UserPreferences($iduser);
$preference->setPreference('ui.language', Lang::get());
// Save fields
$extra_field = new FieldList();
$extra_field->setFieldEntryTable($GLOBALS['prefix_fw'] . '_field_userentry');
$extra_field->storeFieldsForUser($iduser);
// Send mail
$admin_mail = $options['mail_sender'];
// FIX BUG 399
//$link = str_replace('&', '&', $opt_link.( strpos($opt_link, '?') === false ? '?' : '&' ).'random_code='.$random_code);
$link = Get::sett('url', '') . 'index.php?modname=login&op=register_opt&random_code=' . $random_code;
// END FIX BUG 399
$text = $lang->def('_REG_MAIL_TEXT');
$text = str_replace('[userid]', $_POST['register']['userid'], $text);
$text = str_replace('[firstname]', $_POST['register']['firstname'], $text);
$text = str_replace('[lastname]', $_POST['register']['lastname'], $text);
$text = str_replace('[password]', $_POST['register']['pwd'], $text);
$text = str_replace('[link]', '' . $link . '', $text);
$text = str_replace('[hour]', $options['hour_request_limit'], $text);
$text = stripslashes($text);
//check register_type != self (include all previous cases except the new one "self without opt-in")
if (strcmp($options['register_type'], 'self') != 0) {
require_once _base_ . '/lib/lib.mailer.php';
$mailer = DoceboMailer::getInstance();
if (!$mailer->SendMail($admin_mail, $_POST['register']['email'], Lang::t('_MAIL_OBJECT', 'register'), $text, false, array(MAIL_REPLYTO => $admin_mail, MAIL_SENDER_ACLNAME => false))) {
if ($registration_code_type == 'code_module') {
// ok, the registration has failed, let's remove the user association form the code
$code_manager = new CodeManager();
$code_manager->resetUserAssociation($code, $iduser);
}
$acl_man->deleteTempUser($iduser);
$this->error = true;
$out .= '<div class="reg_err_data">' . $lang->def('_OPERATION_FAILURE') . '</div>';
} else {
$out .= '<div class="reg_success">' . $lang->def('_REG_SUCCESS') . '</div>';
}
}
//end
$_GET['random_code'] = $random_code;
//.........这里部分代码省略.........
示例6: extendedParsing
function extendedParsing($arrayState, $arrayExpand, $arrayCompress)
{
if (isset($arrayState['editpersonsave'])) {
$idst = $_POST['idst'];
$userid = $_POST['userid'];
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$pass = $_POST['pass'];
$userlevel = $_POST['userlevel'];
$olduserlevel = $_POST['olduserlevel'];
if ($pass === '') {
$pass = FALSE;
}
$email = $_POST['email'];
if ($idst !== '') {
//-extra field-----------------------------------------------
require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
$fields = new FieldList();
//$re_filled = $fields->isFilledFieldsForUser($idst);
if ($userid != '') {
$info = $this->aclManager->getUser($idst, false);
$this->aclManager->updateUser($idst, $userid, $firstname, $lastname, $pass, $email, FALSE, FALSE);
//-extra field-----------------------------------------------
$fields->storeFieldsForUser($idst);
//-----------------------------------------------------------
// remove from old group level
$this->aclManager->removeFromGroup($olduserlevel, $idst);
// add to group level
$this->aclManager->addToGroup($userlevel, $idst);
if ($this->aclManager->absoluteId($userid) != $info[ACL_INFO_USERID] || $this->aclManager->encrypt($pass) != $info[ACL_INFO_PASS]) {
require_once _base_ . '/lib/lib.eventmanager.php';
$pl_man = PlatformManager::createInstance();
$array_subst = array('[url]' => Get::sett('url', ''), '[userid]' => $userid, '[password]' => $pass);
// message to user that is odified
$msg_composer = new EventMessageComposer();
$msg_composer->setSubjectLangText('email', '_MODIFIED_USER_SBJ', false);
$msg_composer->setBodyLangText('email', '_MODIFIED_USER_TEXT', $array_subst);
if ($pass != '') {
$msg_composer->setBodyLangText('email', '_PASSWORD_CHANGED', array('[password]' => $pass));
}
$msg_composer->setBodyLangText('sms', '_MODIFIED_USER_TEXT_SMS', $array_subst);
if ($pass != '') {
$msg_composer->setBodyLangText('sms', '_PASSWORD_CHANGED_SMS', array('[password]' => $pass));
}
createNewAlert('UserMod', 'directory', 'edit', '1', 'User ' . $userid . ' was modified', array($userid), $msg_composer);
}
$GLOBALS['page']->add(getResultUi($this->lang->def('_OPERATION_SUCCESSFUL')));
} else {
$this->op = 'reedit_person';
//$GLOBALS['page']->add( getErrorUi( implode(',', $re_filled) ), 'content');
}
} else {
if (isset($_POST['arr_idst_groups'])) {
$arr_idst_groups = unserialize(urldecode($_POST['arr_idst_groups']));
$acl =& Docebo::user()->getACL();
$arr_idst_all = $acl->getArrSTGroupsST($arr_idst_groups);
} else {
$arr_idst_groups = FALSE;
$arr_idst_all = FALSE;
}
//-verify that userid is not already used
if ($this->aclManager->getUserST($userid) !== FALSE) {
$GLOBALS['page']->add(getErrorUi($this->lang->def('_USERID_DUPLICATE')));
$_POST['userid'] = '';
$this->op = 'reedit_person';
} else {
//-verify mandatory extra field--------------------------------
require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
$fields = new FieldList();
//$re_filled = $fields->isFilledFieldsForUser(0, $arr_idst_all);
if ($arr_idst_groups != FALSE && $userid != '') {
$idst = false;
if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
$limit_insert = Docebo::user()->preference->getAdminPreference('admin_rules.limit_user_insert');
$max_insert = Docebo::user()->preference->getAdminPreference('admin_rules.max_user_insert');
$direct_insert = Docebo::user()->preference->getAdminPreference('admin_rules.direct_user_insert');
if ($limit_insert == 'off' || $limit_insert == 'on' && $max_insert > 0) {
if ($direct_insert == 'on') {
Docebo::user()->preference->setPreference('admin_rules.max_user_insert', $max_insert - 1);
$idst = $this->aclManager->registerUser($userid, $firstname, $lastname, $pass, $email, '', '');
require_once _base_ . '/lib/lib.preference.php';
$preference = new UserPreferences($idst);
$preference->savePreferences($_POST, 'ui.');
require_once _base_ . "/lib/lib.eventmanager.php";
$pl_man =& PlatformManager::createInstance();
$array_subst = array('[url]' => Get::sett('url', ''), '[userid]' => $userid, '[password]' => $pass);
// message to user that is inserted
$msg_composer = new EventMessageComposer();
$msg_composer->setSubjectLangText('email', '_REGISTERED_USER_SBJ', false);
$msg_composer->setBodyLangText('email', '_REGISTERED_USER_TEXT', $array_subst);
$msg_composer->setBodyLangText('sms', '_REGISTERED_USER_TEXT_SMS', $array_subst);
createNewAlert('UserNew', 'directory', 'edit', '1', 'User ' . $userid . ' created', array($userid), $msg_composer);
$GLOBALS['page']->add(getResultUi($this->lang->def('_INSERTED_NEW_USER')));
} else {
$acl = Docebo::user()->getAcl();
$idst = $this->aclManager->registerTempUser($userid, $firstname, $lastname, $pass, $email, 0, getLogUserId());
require_once _base_ . "/lib/lib.eventmanager.php";
$pl_man =& PlatformManager::createInstance();
$array_subst = array('[url]' => Get::sett('url', ''), '[userid]' => $userid, '[password]' => $pass);
// message to user that is waiting
//.........这里部分代码省略.........