本文整理汇总了PHP中UserManager::create_extra_field方法的典型用法代码示例。如果您正苦于以下问题:PHP UserManager::create_extra_field方法的具体用法?PHP UserManager::create_extra_field怎么用?PHP UserManager::create_extra_field使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserManager
的用法示例。
在下文中一共展示了UserManager::create_extra_field方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: WSUpdateUserApiKey
function WSUpdateUserApiKey($params)
{
if (!WSHelperVerifyKey($params)) {
return return_error(WS_ERROR_SECRET_KEY);
}
$user_id = UserManager::get_user_id_from_original_id($params['original_user_id_value'], $params['original_user_id_name']);
if (!$user_id) {
if (!empty($params['chamilo_username'])) {
$info = api_get_user_info_from_username($params['chamilo_username']);
$user_id = $info['user_id'];
// Save new fieldlabel into user_field table.
$field_id = UserManager::create_extra_field($params['original_user_id_name'], 1, $params['original_user_id_name'], '');
// Save the external system's id into user_field_value table.
$res = UserManager::update_extra_field_value($user_id, $params['original_user_id_name'], $params['original_user_id_value']);
} else {
return 0;
}
}
$list = UserManager::get_api_keys($user_id);
$key_id = UserManager::get_api_key_id($user_id, 'dokeos');
if (isset($list[$key_id])) {
$apikey = $list[$key_id];
} else {
$lastid = UserManager::update_api_key($user_id, 'dokeos');
if ($lastid) {
$apikeys = UserManager::get_api_keys($user_id);
$apikey = $apikeys[$lastid];
}
}
return $apikey;
}
示例2: empty
if ($form->validate()) {
$check = Security::check_token('post');
if ($check) {
$field = $form->exportValues();
$fieldlabel = empty($field['fieldlabel']) ? $field['fieldtitle'] : $field['fieldlabel'];
$fieldlabel = trim(strtolower(str_replace(" ", "_", $fieldlabel)));
$fieldtype = $field['fieldtype'];
$fieldtitle = $field['fieldtitle'];
$fielddefault = $field['fielddefaultvalue'];
$fieldoptions = $field['fieldoptions'];
//comma-separated list of options
if (is_numeric($field['fieldid']) and !empty($field['fieldid'])) {
UserManager::save_extra_field_changes($field['fieldid'], $fieldlabel, $fieldtype, $fieldtitle, $fielddefault, $fieldoptions);
$message = get_lang('FieldEdited');
} else {
$field_id = UserManager::create_extra_field($fieldlabel, $fieldtype, $fieldtitle, $fielddefault, $fieldoptions);
$message = get_lang('FieldAdded');
}
Security::clear_token();
header('Location: user_fields.php?action=show_message&message=' . urlencode(get_lang('FieldAdded')));
exit;
}
} else {
if (isset($_POST['submit'])) {
Security::clear_token();
}
$token = Security::get_token();
$form->addElement('hidden', 'sec_token');
$form->setConstants(array('sec_token' => $token));
}
// Display form
示例3: prepareImport
/**
* Prepares extra fields before the import
*/
private function prepareImport()
{
// Create user extra field: extra_external_user_id
UserManager::create_extra_field($this->extraFieldIdNameList['user'], 1, 'External user id', null);
// Create course extra field: extra_external_course_id
CourseManager::create_course_extra_field($this->extraFieldIdNameList['course'], 1, 'External course id');
// Create session extra field extra_external_session_id
SessionManager::create_session_extra_field($this->extraFieldIdNameList['session'], 1, 'External session id');
// Create calendar_event extra field extra_external_session_id
$extraField = new ExtraField('calendar_event');
$extraField->save(array('field_type' => ExtraField::FIELD_TYPE_TEXT, 'field_variable' => $this->extraFieldIdNameList['calendar_event'], 'field_display_text' => 'External calendar event id'));
}
示例4: prepareImport
/**
* Prepares extra fields before the import
*/
private function prepareImport()
{
// Create user extra field: extra_external_user_id
UserManager::create_extra_field($this->extraFieldIdNameList['user'], 1, 'External user id', null);
// Create course extra field: extra_external_course_id
CourseManager::create_course_extra_field($this->extraFieldIdNameList['course'], 1, 'External course id');
// Create session extra field extra_external_session_id
SessionManager::create_session_extra_field($this->extraFieldIdNameList['session'], 1, 'External session id');
}