Code Duplication    Length = 37-37 lines in 2 locations

mod/au_subgroups/lib/groups.php 1 location

@@ 220-256 (lines=37) @@
217
 * @param string $page
218
 * @param int $guid
219
 */
220
function groups_handle_edit_page($page, $guid = 0) {
221
	elgg_gatekeeper();
222
	elgg_require_js('elgg/groups/edit');
223
224
	if ($page == 'add') {
225
		elgg_set_page_owner_guid(elgg_get_logged_in_user_guid());
226
		$title = elgg_echo('groups:add');
227
		elgg_push_breadcrumb($title);
228
229
		if (elgg_get_plugin_setting('limited_groups', 'groups') != 'yes' || elgg_is_admin_logged_in()) {
230
			$content = elgg_view('groups/edit');
231
		} else {
232
			$content = elgg_echo('groups:cantcreate');
233
		}
234
	} else {
235
		$title = elgg_echo("groups:edit");
236
		$group = get_entity($guid);
237
238
		if (elgg_instanceof($group, 'group') && $group->canEdit()) {
239
			elgg_set_page_owner_guid($group->getGUID());
240
			elgg_push_breadcrumb($group->name, $group->getURL());
241
			elgg_push_breadcrumb($title);
242
			$content = elgg_view("groups/edit", array('entity' => $group));
243
		} else {
244
			$content = elgg_echo('groups:noaccess');
245
		}
246
	}
247
248
	$params = array(
249
		'content' => $content,
250
		'title' => $title,
251
		'filter' => '',
252
	);
253
	$body = elgg_view_layout('content', $params);
254
255
	echo elgg_view_page($title, $body);
256
}
257
258
 // Group invitations for a user
259
function groups_handle_invitations_page() {

mod/groups/lib/groups.php 1 location

@@ 197-233 (lines=37) @@
194
 * @param string $page
195
 * @param int $guid
196
 */
197
function groups_handle_edit_page($page, $guid = 0) {
198
	elgg_gatekeeper();
199
200
	elgg_require_js('elgg/groups/edit');
201
202
	if ($page == 'add') {
203
		elgg_set_page_owner_guid(elgg_get_logged_in_user_guid());
204
		$title = elgg_echo('groups:add');
205
		elgg_push_breadcrumb($title);
206
		if (elgg_get_plugin_setting('limited_groups', 'groups') != 'yes' || elgg_is_admin_logged_in()) {
207
			$content = elgg_view('groups/edit');
208
		} else {
209
			$content = elgg_echo('groups:cantcreate');
210
		}
211
	} else {
212
		$title = elgg_echo("groups:edit");
213
		$group = get_entity($guid);
214
215
		if (elgg_instanceof($group, 'group') && $group->canEdit()) {
216
			elgg_set_page_owner_guid($group->getGUID());
217
			elgg_push_breadcrumb($group->name, $group->getURL());
218
			elgg_push_breadcrumb($title);
219
			$content = elgg_view("groups/edit", array('entity' => $group));
220
		} else {
221
			$content = elgg_echo('groups:noaccess');
222
		}
223
	}
224
225
	$params = array(
226
		'content' => $content,
227
		'title' => $title,
228
		'filter' => '',
229
	);
230
	$body = elgg_view_layout('content', $params);
231
232
	echo elgg_view_page($title, $body);
233
}
234
235
/**
236
 * Group invitations for a user