本文整理汇总了PHP中UserGroup::update方法的典型用法代码示例。如果您正苦于以下问题:PHP UserGroup::update方法的具体用法?PHP UserGroup::update怎么用?PHP UserGroup::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserGroup
的用法示例。
在下文中一共展示了UserGroup::update方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: WSUpdateGroup
function WSUpdateGroup($params)
{
if (!WSHelperVerifyKey($params['secret_key'])) {
return return_error(WS_ERROR_SECRET_KEY);
}
$params['allow_member_group_to_leave'] = null;
$userGroup = new UserGroup();
return $userGroup->update($params);
/*return GroupPortalManager::update(
$params['id'],
$params['name'],
$params['description'],
$params['url'],
$params['visibility'],
$params['picture_uri'],
$params['allow_member_group_to_leave']
);*/
}
示例2: elseif
$form->setConstants(array('sec_token' => $token));
$form->display();
}
} elseif (isset($_GET['action']) && $_GET['action'] == 'edit' && is_numeric($_GET['id'])) {
$id = intval($_GET['id']);
$form = new FormValidator('usergroup', 'post', api_get_self() . '?action=' . Security::remove_XSS($_GET['action']) . '&id=' . $id);
$defaults = $usergroup->get($id);
$usergroup->setForm($form, 'edit', $defaults);
// Setting the form elements
$form->addElement('hidden', 'id', $id);
// Setting the defaults
$form->setDefaults($defaults);
// The validation or display.
if ($form->validate()) {
$values = $form->getSubmitValues();
$res = $usergroup->update($values);
if ($res) {
Display::display_confirmation_message(get_lang('Updated'));
} else {
Display::display_warning_message(Security::remove_XSS($values['name']) . ': ' . get_lang('AlreadyExists'));
}
$usergroup->display();
} else {
echo '<div class="actions">';
echo '<a href="' . api_get_self() . '">' . Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM) . '</a>';
echo '</div>';
$form->display();
}
} elseif (isset($_GET['action']) && $_GET['action'] == 'delete' && is_numeric($_GET['id'])) {
$res = $usergroup->delete($_GET['id']);
if ($res) {
示例3: FormValidator
if (!$usergroup->is_group_admin($group_id)) {
api_not_allowed();
}
// Create the form
$form = new FormValidator('group_edit', 'post', '', '');
$form->addElement('hidden', 'id', $group_id);
$usergroup->setGroupType($usergroup::SOCIAL_CLASS);
$usergroup->setForm($form, 'edit', $group_data);
// Set default values
$form->setDefaults($group_data);
// Validate form
if ($form->validate()) {
$group = $form->exportValues();
$group['id'] = $group_id;
$group['type'] = $usergroup::SOCIAL_CLASS;
$usergroup->update($group);
$tok = Security::get_token();
header('Location: groups.php?id=' . $group_id . '&action=show_message&message=' . urlencode(get_lang('GroupUpdated')) . '&sec_token=' . $tok);
exit;
}
$social_left_content = SocialManager::show_social_menu('group_edit', $group_id);
$social_right_content = '<div class="span9">';
$social_right_content .= $form->return_form();
$social_right_content .= '</div>';
$app['title'] = $tool_name;
$tpl = $app['template'];
$tpl->setHelp('Groups');
$tpl->assign('social_left_content', $social_left_content);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('layout/social_layout.tpl');
$tpl->display($social_layout);
示例4: foreach
if (is_array($ldaprecords)) {
$db->begin();
// Warning $ldapuser has a key in lowercase
foreach ($ldaprecords as $key => $ldapgroup) {
$group = new UserGroup($db);
$group->fetch('', $ldapgroup[$conf->global->LDAP_KEY_GROUPS]);
$group->name = $ldapgroup[$conf->global->LDAP_GROUP_FIELD_FULLNAME];
$group->nom = $group->name;
// For backward compatibility
$group->note = $ldapgroup[$conf->global->LDAP_GROUP_FIELD_DESCRIPTION];
$group->entity = $conf->entity;
//print_r($ldapgroup);
if ($group->id > 0) {
// Group update
print $langs->transnoentities("GroupUpdate") . ' # ' . $key . ': name=' . $group->name;
$res = $group->update();
if ($res > 0) {
print ' --> Updated group id=' . $group->id . ' name=' . $group->name;
} else {
$error++;
print ' --> ' . $res . ' ' . $group->error;
}
print "\n";
} else {
// Group creation
print $langs->transnoentities("GroupCreate") . ' # ' . $key . ': name=' . $group->name;
$res = $group->create();
if ($res > 0) {
print ' --> Created group id=' . $group->id . ' name=' . $group->name;
} else {
$error++;