当前位置: 首页>>代码示例>>PHP>>正文


PHP groups_delete_group函数代码示例

本文整理汇总了PHP中groups_delete_group函数的典型用法代码示例。如果您正苦于以下问题:PHP groups_delete_group函数的具体用法?PHP groups_delete_group怎么用?PHP groups_delete_group使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了groups_delete_group函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: groups_cleanup_groups

/**
 * Cleans up all the groups and groupings in a course (it does this best-effort 
 * i.e. if one deletion fails, it still attempts further deletions).
 * IMPORTANT: Note that if the groups and groupings are used by other courses 
 * somehow, they will still be deleted - it doesn't protect against this. 
 * @param int $courseid The id of the course
 * @return boolean True if the clean up was successful, false otherwise. 
 */
function groups_cleanup_groups($courseid)
{
    $success = true;
    // Delete all the groupings
    $groupings = groups_get_groupings($courseid);
    if ($groupings != false) {
        foreach ($groupings as $groupingid) {
            $groupingdeleted = groups_delete_grouping($groupingid);
            if (!$groupingdeleted) {
                $success = false;
            }
        }
    }
    // Delete all the groups
    $groupids = groups_get_groups($courseid);
    if ($groupids != false) {
        foreach ($groupids as $groupid) {
            $groupdeleted = groups_delete_group($groupid);
            if (!$groupdeleted) {
                $success = false;
            }
        }
    }
    return $success;
}
开发者ID:veritech,项目名称:pare-project,代码行数:33,代码来源:dbcleanup.php

示例2: tearDownAfterClass

 public static function tearDownAfterClass()
 {
     foreach (self::$groups as $group) {
         groups_delete_group($group);
     }
     if (is_multisite()) {
         wpmu_delete_user(self::$user);
         wpmu_delete_user(self::$admin_user);
     } else {
         wp_delete_user(self::$user);
         wp_delete_user(self::$admin_user);
     }
     self::commit_transaction();
 }
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:14,代码来源:groupsIsUser.php

示例3: tearDownAfterClass

 public static function tearDownAfterClass()
 {
     foreach (self::$group_ids as $group_id) {
         groups_delete_group($group_id);
     }
     foreach (self::$user_ids as $user_id) {
         if (is_multisite()) {
             wpmu_delete_user($user_id);
         } else {
             wp_delete_user($user_id);
         }
     }
     self::commit_transaction();
 }
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:14,代码来源:suggestions-nonauth.php

示例4: delete_groups

 /**
  * Delete some groups
  * @param array|struct $params
  * @subparam integer $params:groupid
  * @return boolean result
  */
 static function delete_groups($params)
 {
     if (has_capability('moodle/course:managegroups', get_context_instance(CONTEXT_SYSTEM))) {
         $deletionsuccessfull = true;
         foreach ($params as $groupid) {
             if (!groups_delete_group(clean_param($groupid, PARAM_INTEGER))) {
                 $deletionsuccessfull = false;
             }
         }
         return $deletionsuccessfull;
     } else {
         throw new moodle_exception('wscouldnotdeletegroupnopermission');
     }
 }
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:20,代码来源:external.php

示例5: test_groups_get_group_by_name

 public function test_groups_get_group_by_name()
 {
     $this->resetAfterTest(true);
     $generator = $this->getDataGenerator();
     // Create a course category and course.
     $cat = $generator->create_category(array('parent' => 0));
     $course = $generator->create_course(array('category' => $cat->id));
     $name1 = 'Name 1';
     $name2 = 'Name 2';
     // Test with an empty and a null idnumber.
     $this->assertFalse(groups_get_group_by_name($course->id, ''));
     $this->assertFalse(groups_get_group_by_name($course->id, null));
     // Even when a group exists.
     $generator->create_group(array('courseid' => $course->id));
     $this->assertFalse(groups_get_group_by_name($course->id, ''));
     $this->assertFalse(groups_get_group_by_name($course->id, null));
     // Test with a valid name, but one that doesn't exist yet.
     $this->assertFalse(groups_get_group_by_name($course->id, $name1));
     $this->assertFalse(groups_get_group_by_name($course->id, $name2));
     // We should now have a valid group returned by the name search.
     $group1 = $generator->create_group(array('courseid' => $course->id, 'name' => $name1));
     $this->assertEquals($group1->id, groups_get_group_by_name($course->id, $name1));
     $this->assertFalse(groups_get_group_by_name($course->id, $name2));
     // We should now have a two valid groups returned by the name search.
     $group2 = $generator->create_group(array('courseid' => $course->id, 'name' => $name2));
     $this->assertEquals($group1->id, groups_get_group_by_name($course->id, $name1));
     $this->assertEquals($group2->id, groups_get_group_by_name($course->id, $name2));
     // Delete a group.
     $this->assertTrue(groups_delete_group($group1));
     $this->assertFalse(groups_get_group_by_name($course->id, $name1));
     $this->assertEquals($group2->id, groups_get_group_by_name($course->id, $name2));
     /*
      * Group idnumbers are unique within a course so test that we don't
      * retrieve groups for the first course.
      */
     // Create a second course.
     $course = $generator->create_course(array('category' => $cat->id));
     // An empty name should always return a false value.
     $this->assertFalse(groups_get_group_by_name($course->id, ''));
     $this->assertFalse(groups_get_group_by_name($course->id, null));
     // Our existing names shouldn't be returned here as we're in a different course.
     $this->assertFalse(groups_get_group_by_name($course->id, $name1));
     $this->assertFalse(groups_get_group_by_name($course->id, $name2));
     // We should be able to reuse the idnumbers again since this is a different course.
     $group1 = $generator->create_group(array('courseid' => $course->id, 'name' => $name1));
     $this->assertEquals($group1->id, groups_get_group_by_name($course->id, $name1));
     $group2 = $generator->create_group(array('courseid' => $course->id, 'name' => $name2));
     $this->assertEquals($group2->id, groups_get_group_by_name($course->id, $name2));
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:49,代码来源:grouplib_test.php

示例6: group_deleted

 /**
  * Group deleted
  *
  * @param \core\event\group_deleted $event
  * @return void
  */
 public static function group_deleted(\core\event\group_deleted $event)
 {
     global $DB;
     $group = $event->get_record_snapshot('groups', $event->objectid);
     $courseids = local_metagroups_parent_courses($group->courseid);
     foreach ($courseids as $courseid) {
         $course = get_course($courseid);
         if ($metagroup = $DB->get_record('groups', array('courseid' => $course->id, 'idnumber' => $group->id))) {
             groups_delete_group($metagroup);
         }
     }
 }
开发者ID:stanta,项目名称:moodle-local_metagroups,代码行数:18,代码来源:observers.php

示例7: group_delete

 function group_delete($id, $id2)
 {
     return !groups_get_group(array('group_id' => $id)) || groups_delete_group($id);
 }
开发者ID:pausaura,项目名称:agora_nodes,代码行数:4,代码来源:bpModDefaultContentTypes.php

示例8: facetoface_delete_instance

/**
 * Given an ID of an instance of this module, this function will
 * permanently delete the instance and any data that depends on it.
 */
function facetoface_delete_instance($id) {
    global $CFG, $DB;
  require_once $CFG->dirroot.'/local/evaluations/lib.php';
  require_once $CFG->dirroot.'/group/lib.php';
    if (!$facetoface = $DB->get_record('facetoface', array('id' => $id))) {
        return false;
    }

    $result = true;

    $transaction = $DB->start_delegated_transaction();

    $DB->delete_records_select(
        'facetoface_signups_status',
        "signupid IN
        (
            SELECT
            id
            FROM
    {facetoface_signups}
    WHERE
    sessionid IN
    (
        SELECT
        id
        FROM
    {facetoface_sessions}
    WHERE
    facetoface = ? ))
    ", array($facetoface->id));
    /*===========When batch delete that time we delete records from 'course_modules' and 'context' data tables started by rajut*/
    
    $get_course_modules_id=$DB->get_record('course_modules',array('instance'=>$facetoface->id));
    //print_object($get_course_modules_id);
     $get_course_modules_id_context=$DB->get_record('context',array('contextlevel'=>70,'instanceid'=>$get_course_modules_id->id));
      //print_object($get_course_modules_id_context);
    $DB->delete_records('context', array('id' => $get_course_modules_id_context->id));
    $DB->delete_records('course_modules', array('id' => $get_course_modules_id->id->id));
    //exit;
/*===========When batch delete that time we delete records from 'course_modules' and 'context' data tables Ended by rajut*/
    $DB->delete_records_select('facetoface_signups', "sessionid IN (SELECT id FROM {facetoface_sessions} WHERE facetoface = ?)", array($facetoface->id));

    $DB->delete_records_select('facetoface_sessions_dates', "sessionid in (SELECT id FROM {facetoface_sessions} WHERE facetoface = ?)", array($facetoface->id));

    // Notifications.
    $DB->delete_records('facetoface_notification', array('facetofaceid' => $facetoface->id));
    $DB->delete_records_select('facetoface_notification_sent',
            "sessionid IN (SELECT id FROM {facetoface_sessions} WHERE facetoface = ?)", array($facetoface->id));
    $DB->delete_records_select('facetoface_notification_hist',
            "sessionid IN (SELECT id FROM {facetoface_sessions} WHERE facetoface = ?)", array($facetoface->id));

    $DB->delete_records('facetoface_sessions', array('facetoface' => $facetoface->id));

   

    $DB->delete_records('event', array('modulename' => 'facetoface', 'instance' => $facetoface->id));

    facetoface_grade_item_delete($facetoface);

    $transaction->allow_commit();
    /*=====================Started by rajut when delete batch?delete local_batch_users and local_batch_courses===========*/
    $local_batch_courses=$DB->record_exists('local_batch_courses', array('batchid' => $facetoface->id));
    if($local_batch_courses==1){
        $assigned_course=$DB->get_record('local_batch_courses',array('batchid' => $facetoface->id));

       $assigned_users=$DB->get_records_sql("SELECT * FROM {local_batch_users} WHERE f2fid= $facetoface->id");
       if(!empty($assigned_users)){
            foreach($assigned_users as $assigned_user){ 
                $manual = enrol_get_plugin('manual');
                $studentrole = $DB->get_record('role', array('shortname'=>'student'));
                $instance = $DB->get_record('enrol', array('courseid'=>$assigned_course->courseid, 'enrol'=>'manual'), '*', MUST_EXIST);
                if($instance){
                   $timeend='';
                   if(!$DB->record_exists_sql("SELECT * FROM {course_completions} WHERE course=$assigned_course->courseid AND userid=$assigned_user->userid and timecompleted!=''")){
                        $local_batch_courses=$DB->get_records_sql("SELECT lbu.* FROM {local_batch_users} lbu
                                                                  JOIN {facetoface} fa ON fa.id=lbu.f2fid and fa.active in (0,1,8,3)
                                                                  where lbu.courseid=$assigned_course->courseid and lbu.userid=$assigned_user->userid
                                                                and fa.id!=$facetoface->id");
					   if(count($local_batch_courses)==0){
                           $manual->unenrol_user($instance,$assigned_user->userid, $studentrole->id,time(),$timeend);
                        }
                        //$manual->unenrol_user($instance,$assigned_user->userid, $studentrole->id,time(),$timeend);
                   }
                }
            $deleterecord_users=$DB->delete_records('local_batch_users',array('id'=>$assigned_user->id,'userid'=>$assigned_user->userid));
            }
       }
       if($assigned_course->groupid!=0)
       groups_delete_group($assigned_course->groupid);
     $deleterecord_course=$DB->delete_records('local_batch_courses',array('id'=>$assigned_course->id,'courseid'=>$assigned_course->courseid));
    
    }else{
        
        $assigned_users=$DB->get_records_sql("SELECT * FROM {local_batch_users} WHERE f2fid= $facetoface->id");
       if(!empty($assigned_users)){
            foreach($assigned_users as $assigned_user){    
//.........这里部分代码省略.........
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:101,代码来源:lib.php

示例9: stdClass

		}
        $course_batch=new stdClass();
        $course_batch->id=$confirm;
         $course_batch->courseid=0;
		 $course_batch->testid=0;
		 $course_batch->groupid=0;
        $assigned_course=$DB->update_record('local_batch_courses',$course_batch);
        //$deleterecord=$DB->delete_records('local_batch_courses',array('id'=>$confirm,'courseid'=>$courseid));
		
	return redirect($CFG->wwwroot.'/mod/facetoface/view_sessions.php?sessiontype='.$batchid->active.'&batchid='.$batchid->id);
        //redirect($CFG->wwwroot.'/mod/facetoface/view_sessions.php');
  }elseif($confirm>0&&$testid>0){
	 $assigned_course=$DB->get_record('local_batch_courses',array('id'=>$confirm,'testid'=>$testid));
	 $batchid=$DB->get_record('facetoface',array('id'=>$assigned_course->batchid));
	 if(($assigned_course->testid) !=0 && ($assigned_course->groupid!=0)){
					
			remove_groups_data($assigned_course->testid,$assigned_course->groupid);
			groups_delete_group($assigned_course->groupid);
	   
		}
	    $course_batch=new stdClass();
        $course_batch->id=$confirm;
		 $course_batch->testid=0;
		 $course_batch->groupid=0;
        $assigned_course=$DB->update_record('local_batch_courses',$course_batch);
		
	return redirect($CFG->wwwroot.'/mod/facetoface/view_sessions.php?sessiontype='.$batchid->active.'&batchid='.$batchid->id);
	   //redirect($CFG->wwwroot.'/mod/facetoface/view_sessions.php');
  }

echo $OUTPUT->footer();
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:31,代码来源:confirm_course.php

示例10: groups_screen_group_admin_delete_group

function groups_screen_group_admin_delete_group() {
	global $bp;

	if ( $bp->current_component == $bp->groups->slug && 'delete-group' == $bp->action_variables[0] ) {

		if ( !$bp->is_item_admin && !is_super_admin() )
			return false;

		if ( isset( $_REQUEST['delete-group-button'] ) && isset( $_REQUEST['delete-group-understand'] ) ) {
			/* Check the nonce first. */
			if ( !check_admin_referer( 'groups_delete_group' ) )
				return false;

			// Group admin has deleted the group, now do it.
			if ( !groups_delete_group( $bp->groups->current_group->id ) ) {
				bp_core_add_message( __( 'There was an error deleting the group, please try again.', 'buddypress' ), 'error' );
			} else {
				bp_core_add_message( __( 'The group was deleted successfully', 'buddypress' ) );

				do_action( 'groups_group_deleted', $bp->groups->current_group->id );

				bp_core_redirect( $bp->loggedin_user->domain . $bp->groups->slug . '/' );
			}

			bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component );
		}

		do_action( 'groups_screen_group_admin_delete_group', $bp->groups->current_group->id );

		bp_core_load_template( apply_filters( 'groups_template_group_admin_delete_group', 'groups/single/home' ) );
	}
}
开发者ID:n-sane,项目名称:zaroka,代码行数:32,代码来源:bp-groups.php

示例11: bp_organizer_delete_group

function bp_organizer_delete_group()
{
    $group_id = (int) $_REQUEST['group_id'];
    if (!current_user_can('manage_options')) {
        die(__('Only administrators can delete groups with the organizer.', 'bp-group-organizer'));
    }
    check_ajax_referer('delete-group_' . $group_id);
    if (groups_delete_group($group_id)) {
        do_action('groups_group_deleted', $group_id);
        die('success');
    }
    die(__('Group delete failed.', 'bp-group-organizer'));
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:13,代码来源:index.php

示例12: test_group_event_handlers

    /**
     * Test the group event handlers
     */
    public function test_group_event_handlers() {
        global $DB,$CFG;

        $this->resetAfterTest();

        $this->setAdminUser();

        // Setup course, user and groups

        $course = $this->getDataGenerator()->create_course();
        $user1 = $this->getDataGenerator()->create_user();
        $studentrole = $DB->get_record('role', array('shortname'=>'student'));
        $this->assertNotEmpty($studentrole);
        $this->assertTrue(enrol_try_internal_enrol($course->id, $user1->id, $studentrole->id));
        $group1 = $this->getDataGenerator()->create_group(array('courseid'=>$course->id));
        $group2 = $this->getDataGenerator()->create_group(array('courseid'=>$course->id));
        $this->assertTrue(groups_add_member($group1, $user1));
        $this->assertTrue(groups_add_member($group2, $user1));

        $uniqueid = 0;

        $quiz_generator = $this->getDataGenerator()->get_plugin_generator('mod_quiz');

        $quiz = $quiz_generator->create_instance(array('course'=>$course->id, 'timeclose'=>1200, 'timelimit'=>0));

        // add a group1 override
        $DB->insert_record('quiz_overrides', array('quiz'=>$quiz->id, 'groupid'=>$group1->id, 'timeclose'=>1300, 'timelimit'=>null));

        // add an attempt
        $attemptid = $DB->insert_record('quiz_attempts', array('quiz'=>$quiz->id, 'userid'=>$user1->id, 'state'=>'inprogress', 'timestart'=>100, 'timecheckstate'=>0, 'layout'=>'', 'uniqueid'=>$uniqueid++));

        // update timecheckstate
        quiz_update_open_attempts(array('quizid'=>$quiz->id));
        $this->assertEquals(1300, $DB->get_field('quiz_attempts', 'timecheckstate', array('id'=>$attemptid)));

        // remove from group
        $this->assertTrue(groups_remove_member($group1, $user1));
        $this->assertEquals(1200, $DB->get_field('quiz_attempts', 'timecheckstate', array('id'=>$attemptid)));

        // add back to group
        $this->assertTrue(groups_add_member($group1, $user1));
        $this->assertEquals(1300, $DB->get_field('quiz_attempts', 'timecheckstate', array('id'=>$attemptid)));

        // delete group
        groups_delete_group($group1);
        $this->assertEquals(1200, $DB->get_field('quiz_attempts', 'timecheckstate', array('id'=>$attemptid)));
        $this->assertEquals(0, $DB->count_records('quiz_overrides', array('quiz'=>$quiz->id)));

        // add a group2 override
        $DB->insert_record('quiz_overrides', array('quiz'=>$quiz->id, 'groupid'=>$group2->id, 'timeclose'=>1400, 'timelimit'=>null));
        quiz_update_open_attempts(array('quizid'=>$quiz->id));
        $this->assertEquals(1400, $DB->get_field('quiz_attempts', 'timecheckstate', array('id'=>$attemptid)));

        // delete user1 from all groups
        groups_delete_group_members($course->id, $user1->id);
        $this->assertEquals(1200, $DB->get_field('quiz_attempts', 'timecheckstate', array('id'=>$attemptid)));

        // add back to group2
        $this->assertTrue(groups_add_member($group2, $user1));
        $this->assertEquals(1400, $DB->get_field('quiz_attempts', 'timecheckstate', array('id'=>$attemptid)));

        // delete everyone from all groups
        groups_delete_group_members($course->id);
        $this->assertEquals(1200, $DB->get_field('quiz_attempts', 'timecheckstate', array('id'=>$attemptid)));
    }
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:68,代码来源:attempts_test.php

示例13: groups_screen_group_admin_delete_group

function groups_screen_group_admin_delete_group()
{
    global $bp, $group_obj;
    if ($bp->current_component == $bp->groups->slug && 'delete-group' == $bp->action_variables[0]) {
        if (!$bp->is_item_admin) {
            return false;
        }
        if (isset($_POST['delete-group-button']) && isset($_POST['delete-group-understand'])) {
            // Group admin has deleted the group, now do it.
            if (!groups_delete_group($_POST['group-id'])) {
                bp_core_add_message(__('There was an error deleting the group, please try again.', 'buddypress'), 'error');
            } else {
                bp_core_add_message(__('The group was deleted successfully', 'buddypress'));
                do_action('groups_group_deleted', $_POST['group-id']);
                bp_core_redirect($bp->loggedin_user->domain . $bp->groups->slug . '/');
            }
            bp_core_redirect($bp->loggedin_user->domain . $bp->current_component);
        } else {
            do_action('groups_screen_group_admin_delete_group', $group_obj->id);
            bp_core_load_template(apply_filters('groups_template_group_admin_delete_group', 'groups/admin/delete-group'));
        }
    }
}
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:23,代码来源:bp-groups.php

示例14: test_wp_idea_stream_groups_delete_private_group

 /**
  * @group remove_from_group
  */
 public function test_wp_idea_stream_groups_delete_private_group()
 {
     $bp = buddypress();
     $group = new BP_Groups_Group($this->group_id);
     $group->status = 'private';
     $group->save();
     // Set current group
     $bp->groups->current_group = groups_get_group(array('group_id' => $this->group_id, 'populate_extras' => true));
     $u = $this->factory->user->create();
     groups_join_group($this->group_id, $u);
     $idea1 = $this->factory->idea->create(array('author' => $u, 'metas' => array('group_id' => $this->group_id), 'status' => 'private'));
     $idea2 = $this->factory->idea->create(array('author' => $u, 'metas' => array('group_id' => $this->group_id), 'status' => 'private'));
     $deleted = groups_delete_group($this->group_id);
     // Check metas
     $this->assertEmpty(wp_idea_stream_ideas_get_meta($idea1, 'group_id'));
     $this->assertEmpty(wp_idea_stream_ideas_get_meta($idea2, 'group_id'));
     $ideas = wp_idea_stream_ideas_get_ideas(array('include' => array($idea1, $idea2)));
     $public_ideas = wp_filter_object_list($ideas['ideas'], array('post_status' => 'publish'), 'and', 'ID');
     $this->assertEqualSets(array($idea1, $idea2), $public_ideas, 'Ideas removed from a group should always be public');
 }
开发者ID:BoweFrankema,项目名称:wp-idea-stream,代码行数:23,代码来源:groups.php

示例15: fn_group_deleted_handler

/**
 * This function is called when a 'group_deleted' event is triggered.
 *
 *  @param object $eventdata The group object deleted.
 *  @return boolean Always return true so that the event gets cleared.
 *
 */
function fn_group_deleted_handler($eventdata)
{
    global $CFG;
    static $eventinprogress;
    require_once "{$CFG->dirroot}/enrol/enrol.class.php";
    /// Set a semaphore so that we don't do this for any group deleted from here.
    /// Without this, we would do the same operations again for every delete made in this function.
    if (!empty($eventinprogress)) {
        return true;
    } else {
        $eventinprogress = true;
    }
    if ($eventdata->courseid == SITEID) {
        /// Remove all associated course groups and associations.
        if (!($cgroups = get_records('block_fn_site_groups', 'sitegroupid', $eventdata->id))) {
            /// If no courses, nothing to do.
            return true;
        }
        foreach ($cgroups as $cgroup) {
            groups_delete_group($cgroup->coursegroupid);
            delete_records('block_fn_site_groups', 'id', $cgroup->id);
        }
    } else {
        /// Remove the course group association.
        delete_records('block_fn_site_groups', 'coursegroupid', $eventdata->id);
    }
    return true;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:35,代码来源:eventhandlers.php


注:本文中的groups_delete_group函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。