本文整理汇总了PHP中UserGroup::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP UserGroup::delete方法的具体用法?PHP UserGroup::delete怎么用?PHP UserGroup::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserGroup
的用法示例。
在下文中一共展示了UserGroup::delete方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCreateNewGroup
public function testCreateNewGroup()
{
// Create new UserGroup model
$model = new UserGroup();
$model->name = 'Admin';
$model->description = 'Test Group';
$model->gperm_access_admin_panel = 1;
$model->pperm_browse_crash_reports = 1;
$model->pperm_browse_bugs = 1;
$model->pperm_browse_debug_info = 1;
$model->pperm_manage_crash_reports = 1;
$model->pperm_manage_bugs = 1;
$model->pperm_manage_debug_info = 1;
$model->default_sidebar_tab = 'Digest';
$model->default_bug_status_filter = 'open';
// Validate model - assume failure (group name already exist)
$this->assertFalse($model->validate());
// Correct name
$model->name = 'NewGroup';
// Validate model - assume success
$this->assertTrue($model->validate());
// Apply changes to database - assume success
$this->assertTrue($model->save());
// Ensure group's status is Active
$this->assertTrue($model->status == UserGroup::STATUS_ACTIVE);
// Check the new group is not standard
$this->assertFalse($model->isStandard());
// Check the new group can be updated
$this->assertTrue($model->canUpdate());
// Delete new group - should succeed
$this->assertTrue($model->delete());
}
示例2: WSDeleteGroup
function WSDeleteGroup($params)
{
if (!WSHelperVerifyKey($params['secret_key'])) {
return return_error(WS_ERROR_SECRET_KEY);
}
$userGroup = new UserGroup();
return $userGroup->delete($params['id']);
//return GroupPortalManager::delete($params['id']);
}
示例3: elseif
$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) {
Display::display_confirmation_message(get_lang('Deleted'));
}
$usergroup->display();
} else {
$usergroup->display();
}
Display::display_footer();
示例4: ceil
$total_pages = 0;
if ($count > 0) {
if (!empty($limit)) {
$total_pages = ceil((double) $count / (double) $limit);
}
}
if ($page > $total_pages) {
$page = $total_pages;
}
$start = $limit * $page - $limit;
if ($start < 0) {
$start = 0;
}
//4. Deleting an element if the user wants to
if (isset($_REQUEST['oper']) && $_REQUEST['oper'] == 'del') {
$obj->delete($_REQUEST['id']);
}
$is_allowedToEdit = api_is_allowed_to_edit(null, true) || api_is_allowed_to_edit(true) || api_is_drh();
//5. Querying the DB for the elements
$columns = array();
switch ($action) {
case 'get_group_reporting':
$columns = array('name', 'time', 'progress', 'score', 'works', 'messages', 'actions');
$result = Tracking::get_group_reporting($course_id, $group_id, 'all', $start, $limit, $sidx, $sord, $whereCondition);
break;
case 'get_course_exercise_medias':
$columns = array('question');
$result = Question::get_course_medias($course_id, $start, $limit, $sidx, $sord, $whereCondition);
break;
case 'get_user_course_report_resumed':
$columns = array('extra_ruc', 'training_hours', 'count_users', 'count_users_registered', 'average_hours_per_user', 'count_certificates');
示例5: testUserGroupDelete
/**
* @depends testUserGroupOther
* The depends says test is run only if previous is ok
*/
public function testUserGroupDelete($id)
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
$localobject=new UserGroup($this->savdb);
$result=$localobject->fetch($id);
$result=$localobject->delete($id);
print __METHOD__." id=".$id." result=".$result."\n";
$this->assertLessThan($result, 0);
return $result;
}
示例6: _mainModelAfterDelete
private function _mainModelAfterDelete(Model $Model)
{
$UserGroup = new UserGroup();
// find the UserGroup for the Model that this User was just removed from
$userGroupId = $UserGroup->find('first', array('conditions' => array('UserGroup.model' => $Model->alias, 'UserGroup.foreign_key' => $Model->id), 'fields' => array('id')));
// delete this UserGroup
$UserGroup->delete($userGroupId['UserGroup']['id']);
// the UserGroup's members and wallPosts will be deleted through cascading
}
示例7: indexAction
//.........这里部分代码省略.........
break;
case 'get_usergroups':
$obj = new \UserGroup();
$count = $obj->get_count();
break;
case 'get_usergroups_teacher':
$obj = new \UserGroup();
$course_id = api_get_course_int_id();
if ($type == 'registered') {
$count = $obj->get_usergroup_by_course_with_data_count($course_id);
} else {
$count = $obj->get_count();
}
break;
default:
exit;
}
//3. Calculating first, end, etc
$total_pages = 0;
if ((int) $count > 0) {
if (!empty($limit)) {
$total_pages = ceil($count / $limit);
}
}
if ($page > $total_pages) {
$page = $total_pages;
}
$start = $limit * $page - $limit;
if ($start < 0) {
$start = 0;
}
//4. Deleting an element if the user wants to
if ($operation == 'del') {
$obj->delete($request->get('id'));
}
$is_allowedToEdit = api_is_allowed_to_edit(null, true) || api_is_allowed_to_edit(true) || api_is_drh();
//5. Querying the DB for the elements
$columns = array();
switch ($action) {
case 'get_questions':
$columns = \Question::getQuestionColumns(api_get_course_id(), $extra_fields, $questionFields, true);
$columns = $columns['simple_column_name'];
$result = \Question::getQuestions($app, $categoryId, $exerciseId, $courseId, array('where' => $where_condition, 'order' => "{$sidx} {$sord}", 'extra' => $extra_fields, 'question' => $questionFields, 'limit' => "{$start} , {$limit}"));
//var_dump($result);
break;
case 'get_user_list_plugin_widescale':
$columns = array('username', 'firstname', 'lastname', 'exam_password');
$column_names = array(get_lang('Username'), get_lang('Firstname'), get_lang('Lastname'), get_lang('Password'));
$result = \UserManager::get_user_data($start, $limit, $sidx, $sord);
break;
case 'get_question_list':
if (isset($exercise) && !empty($exercise)) {
$columns = array('question', 'type', 'category', 'level', 'score', 'actions');
$result = $exercise->getQuestionListPagination($start, $limit, $sidx, $sord, $where_condition);
}
break;
case 'get_group_reporting':
$columns = array('name', 'time', 'progress', 'score', 'works', 'messages', 'actions');
$result = \Tracking::get_group_reporting($course_id, $group_id, 'all', $start, $limit, $sidx, $sord, $where_condition);
break;
case 'get_course_exercise_medias':
$columns = array('question');
$result = \Question::get_course_medias($course_id, $start, $limit, $sidx, $sord, $where_condition);
if (!empty($result)) {
foreach ($result as &$media) {
$media['id'] = $media['iid'];
示例8: delete
$url = 'https://api.weixin.qq.com/cgi-bin/groups/members/batchupdate?access_token=' . $this->_accessToken;
$result = Curl::doCurl($url, $data);
return $result;
}
/**
* 注意本接口是删除一个用户分组,删除分组后,所有该分组内的用户自动进入默认分组。 接口调用请求说明
* http请求方式: POST(请使用https协议)
* https://api.weixin.qq.com/cgi-bin/groups/delete?access_token=ACCESS_TOKEN
* POST数据格式:json
* POST数据例子:{"group":{"id":108}}
**/
public function delete($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/groups/delete?access_token=' . $this->_accessToken;
$result = Curl::doCurl($url, $data);
return $result;
}
}
$obj = new UserGroup();
// $data = '{"openid":"okw2Sjs5K8PGKpRQVivN9hicdBog"}';
// print_r($obj->queryUser($data));
// $data = '{"group":{"id":101, "name":"demo1"}';
// print_r($obj->update($data));
// $data = '{"openid":"okw2Sjs5K8PGKpRQVivN9hicdBog", "to_groupid":1}';
// print_r($obj->move($data));
// $data = '{"openid_list":["okw2Sjjt_TOo9k4Y7m8kpvWQs74U","okw2Sju8POyk1D682fveTLO7yGTg"], "to_groupid":1}';
// print_r($obj->moveBatch($data));
// print_r($obj->query());
$data = '{"group":{"id":101}}';
print_r($obj->delete($data));
示例9: elseif
$check = Security::check_token('post');
if ($check) {
$values = $form->exportValues();
$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'));
}
}
Security::clear_token();
$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>';
$token = Security::get_token();
$form->addElement('hidden', 'sec_token');
$form->setConstants(array('sec_token' => $token));
$form->display();
}
} elseif (isset($_GET['action']) && $_GET['action'] == 'delete' && is_numeric($_GET['id'])) {
$res = $usergroup->delete(Security::remove_XSS($_GET['id']));
if ($res) {
Display::display_confirmation_message(get_lang('Deleted'));
}
$usergroup->display();
} else {
$usergroup->display();
}
Display::display_footer();