本文整理汇总了PHP中FieldList::isFilledFieldsForUser方法的典型用法代码示例。如果您正苦于以下问题:PHP FieldList::isFilledFieldsForUser方法的具体用法?PHP FieldList::isFilledFieldsForUser怎么用?PHP FieldList::isFilledFieldsForUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FieldList
的用法示例。
在下文中一共展示了FieldList::isFilledFieldsForUser方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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');
}
示例2: checkUserInfo
/**
* check the user data filled in the mod user gui
* @return mixed boolean true if all is ok , else a text that describe the error
*/
function checkUserInfo()
{
require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
$extra_field = new FieldList();
if (!$this->_user_profile->godMode()) {
$re_filled = $extra_field->isFilledFieldsForUser($this->_user_profile->getIdUser());
if ($re_filled !== true) {
return implode('<br/>', $re_filled);
}
}
return true;
}
示例3: array
/**
* Control the contents of the field
* @param array $source the values to check
* @param array $options the values needed for control
*
* @return array ( [error] => true o false , [msg] => error message)
*/
function _checkField($source, $options, $platform, $control_extra_field = true)
{
$lang =& DoceboLanguage::createInstance('register', $platform);
// control if the inserted data is valid
if ($options['privacy_policy'] == 'on') {
if (!isset($source['register']['privacy'])) {
return array('error' => true, 'msg' => $lang->def('_ERR_POLICY_NOT_CHECKED'));
} elseif ($source['register']['privacy'] != 'ok') {
return array('error' => true, 'msg' => $lang->def('_ERR_POLICY_NOT_CHECKED'));
}
}
// control mail is correct
if ($source['register']['email'] == '') {
return array('error' => true, 'msg' => $lang->def('_ERR_INVALID_MAIL'));
}
if (!eregi("^([a-z0-9_\\-]|\\.[a-z0-9_])+@(([a-z0-9_\\-]|\\.-)+\\.)+[a-z]{2,8}\$", $source['register']['email'])) {
return array('error' => true, 'msg' => $lang->def('_ERR_INVALID_MAIL'));
}
if (eregi("[\r\n]+", $source['register']['email'])) {
return array('error' => true, 'msg' => $lang->def('_ERR_INVALID_MAIL'));
}
$acl_man =& Docebo::user()->getAclManager();
if ($acl_man->getUserByEmail($source['register']['email']) !== false) {
return array('error' => true, 'msg' => $lang->def('_ERR_DUPLICATE_MAIL'));
}
if (($tuser = $acl_man->getTempUserByEmail($source['register']['email'])) !== false) {
$msg = $lang->def('_ERR_DUPLICATE_RESEND');
return array('error' => true, 'msg' => $msg);
}
// check if userid has been inserted
if ($source['register']['userid'] == '' || $source['register']['userid'] == $lang->def('_REG_USERID_DEF')) {
return array('error' => true, 'msg' => $lang->def('_ERR_INVALID_USER'));
}
// control if userid is duplicate
$user = $acl_man->getUserST($source['register']['userid']);
$temp_user = $acl_man->getTempUserInfo($source['register']['userid']);
if ($user !== false || $temp_user !== false) {
return array('error' => true, 'msg' => $lang->def('_ERR_DUPLICATE_USER'));
}
// control password
if (strlen($_POST['register']['pwd']) < $options['pass_min_char']) {
return array('error' => true, 'msg' => $lang->def('_PASSWORD_TOO_SHORT'));
}
if ($_POST['register']['pwd'] != $source['register']['pwd_retype']) {
return array('error' => true, 'msg' => $lang->def('_ERR_PASSWORD_NO_MATCH'));
}
if ($options['pass_alfanumeric'] == 'on') {
if (!preg_match('/[a-z]/i', $source['register']['pwd']) || !preg_match('/[0-9]/', $source['register']['pwd'])) {
return array('error' => true, 'msg' => $lang->def('_ERR_PASSWORD_MUSTBE_ALPHA'));
}
}
if ($options['lastfirst_mandatory'] == 'on') {
if (trim($source['register']['firstname']) == '' || trim($source['register']['lastname']) == '') {
return array('error' => true, 'msg' => $lang->def('_SOME_MANDATORY_EMPTY'));
}
}
if ($control_extra_field) {
$extra_field = new FieldList();
$re_filled = $extra_field->isFilledFieldsForUser(0, isset($_POST['group_sel_implode']) ? explode(',', $_POST['group_sel_implode']) : false);
if ($re_filled !== true) {
return array('error' => true, 'msg' => implode('<br/>', $re_filled));
}
}
return array('error' => false, 'msg' => '');
}