private function handleGET_delete($request_data)
 {
     global $error_msg;
     if (PA::$login_uid && !empty($this->shared_data['group_info']) && @$_POST['content_type'] != 'media') {
         $group = $this->shared_data['group_info'];
         $user = PA::$login_user;
         if (Group::is_admin((int) $request_data['gid'], (int) PA::$login_uid)) {
             $group->delete();
             // Deleting all the activities of this group from activities table for rivers of people module
             Activities::delete_for_group($request_data['gid']);
             if (!empty(PA::$config->useTypedGroups)) {
                 require_once 'api/Entity/TypedGroupEntity.php';
                 require_once "api/Entity/TypedGroupEntityRelation.php";
                 TypedGroupEntityRelation::delete_all_relations($request_data['gid']);
                 TypedGroupEntity::delete_for_group($request_data['gid']);
             }
             $this->controller->redirect(PA::$url . PA_ROUTE_GROUPS . "?error_msg=" . __("Group sucessfully deleted."));
         }
     }
 }
Exemple #2
0
                 $x = $group->leave((int) $login_uid);
             } catch (PAException $e) {
                 $group_top_mesg = "Operation failed (" . $e->message . "). Please try again";
             }
         } else {
             $group_top_mesg = "You are not member of " . stripslashes($group->title) . " group.";
         }
     }
     if ($x) {
         $group_top_mesg = "You have left the \"" . stripslashes($group->title) . "\" group successfully.";
     }
 } elseif (@$_GET['action'] == 'delete' && $_POST['content_type'] != 'media') {
     if (Group::is_admin((int) $_REQUEST['gid'], (int) $login_uid)) {
         $group->delete();
         //Deleting all the activities of this group from activities table for rivers of people module
         Activities::delete_for_group($_REQUEST['gid']);
         header("location:groups_home.php");
         exit;
     } else {
         if ($_POST['content_type'] == 'media') {
             $med_type = ucfirst($_POST['media_type']);
             $group_top_mesg = "Your {$med_type} file has been deleted.";
         } else {
             $group_top_mesg = "You dont have permissions to delete this group";
         }
     }
 } else {
     if ((@$_POST['submit'] || @$_POST['submit_audio'] || @$_POST['submit_video']) && @$_POST['content_type'] == 'media') {
         $error_media = FALSE;
         $med_type = ucfirst($_POST['media_type']);
         if (!empty($upload_array)) {
        $gid = (int) $_GET['delete_gid'];
        $group = ContentCollection::load_collection((int) $gid, $login_uid);
        $group->delete();
        //Deleting all the activities of this group from activities table for rivers of people module
        Activities::delete_for_group($gid);
        $message = __("Group deleted successfully");
        unset($_GET['delete_gid']);
    }
}
if (!empty($_POST['gid'])) {
    $group_ids = $_POST['gid'];
    foreach ($group_ids as $i => $delete_gid) {
        $group = ContentCollection::load_collection((int) $delete_gid, $login_uid);
        $group->delete();
        //Deleting all the activities of this group from activities table for rivers of people module
        Activities::delete_for_group($delete_gid);
        unset($_POST['gid']);
    }
    $msg = uihelper_plural(count($group_ids), 'group');
    $message = sprintf(__("%s groups deleted successfully"), $msg);
}
function setup_module($column, $module, $obj)
{
    switch ($module) {
        case 'ManageGroupsModule':
            if (!empty($_GET['sort_by'])) {
                $obj->set_sort_by($_GET['sort_by']);
            }
            if (!empty($_GET['sort_dir'])) {
                $obj->set_sort_dir($_GET['sort_dir']);
            }
    if (!empty($_GET['action']) && $_GET['action'] == 'delete') {
        $gid = (int) $_GET['gid'];
        $group = ContentCollection::load_collection((int) $gid, $login_uid);
        $group->delete();
        //Deleting all the activities of this group from activities table for rivers of people module
        Activities::delete_for_group($gid);
        $message = "Group deleted successfully";
    }
    if (!empty($_POST['gid'])) {
        $group_ids = $_POST['gid'];
        $cnt = count($group_ids);
        for ($i = 0; $i < $cnt; $i++) {
            $group = ContentCollection::load_collection((int) $group_ids[$i], $login_uid);
            $group->delete();
            //Deleting all the activities of this group from activities table for rivers of people module
            Activities::delete_for_group($group_ids[$i]);
        }
        $msg = uihelper_plural($cnt, 'group');
        $message = $msg . " deleted successfully";
    }
}
function setup_module($column, $module, $obj)
{
    global $configure_permission;
    switch ($module) {
        case 'ManageGroupsModule':
            if (!$configure_permission) {
                return 'skip';
            }
    }
}