예제 #1
0
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
0
        $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
0
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);
 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++;