diff options
| -rw-r--r-- | actions/event_calendar/manage_subscribers.php | 11 | ||||
| -rw-r--r-- | languages/en.php | 6 | ||||
| -rw-r--r-- | models/model.php | 18 | ||||
| -rw-r--r-- | views/default/plugins/event_calendar/settings.php (renamed from views/default/settings/event_calendar/edit.php) | 0 | 
4 files changed, 28 insertions, 7 deletions
| diff --git a/actions/event_calendar/manage_subscribers.php b/actions/event_calendar/manage_subscribers.php index 212150082..d20c73cbd 100644 --- a/actions/event_calendar/manage_subscribers.php +++ b/actions/event_calendar/manage_subscribers.php @@ -1,13 +1,22 @@  <?php  $event_guid = get_input('event_guid');  $event = get_entity($event_guid); -if (elgg_instanceof($event,'object','event_calendar') && $event->canEdit()) { +$event_calendar_add_users = elgg_get_plugin_setting('add_users', 'event_calendar'); +if (($event_calendar_add_users == 'yes') && elgg_instanceof($event,'object','event_calendar') && $event->canEdit()) {  	$members = get_input('members');  	// clear the event from all personal calendars  	remove_entity_relationships($event_guid, 'personal_event', TRUE);  	// add event to personal calendars +	$event_calendar_add_users_notify = elgg_get_plugin_setting('add_users_notify', 'event_calendar'); +	$site_guid = elgg_get_site_entity()->guid;  	foreach ($members as $user_guid) {  		add_entity_relationship($user_guid,'personal_event',$event_guid); +		if ($event_calendar_add_users_notify == 'yes') { +			$subject = elgg_echo('event_calendar:add_users_notify:subject'); +			$user = get_user($user_guid); +			$message = elgg_echo('event_calendar:add_users_notify:body',array($user->name,$event->title,$event->getURL())); +			notify_user($user_guid, $site_guid, $subject, $message); +		}  	}  	system_message(elgg_echo('event_calendar:manage_subscribers:success'));  	forward($event->getURL()); diff --git a/languages/en.php b/languages/en.php index d16085994..621387103 100644 --- a/languages/en.php +++ b/languages/en.php @@ -149,11 +149,11 @@  	'event_calendar:spots_label' => "Spots",  	'event_calendar:spots_description' => "How many people are allowed to add this event to their personal calendars?",  	'event_calendar:open' => "Open", -	'event_calendar:settings:add_users:title' => "Allow event creators to add their event to other personal calendars (requires autocomplete plugin).", +	'event_calendar:settings:add_users:title' => "Allow event creators and site admins to add their event to other personal calendars.",  	'event_calendar:add_user_label' => "Add users",  	'event_calendar:add_user_description' => "Add this event to personal calendars by typing two or more characters in the above text autocomplete field to select a user. "  		."You can add multiple users by clicking the \"+\" link. (You must submit this form to actually add the event to the calendars.)",		 -	'event_calendar:settings:add_users_notify:title' => "Notify users who have had an event added to their personal calendar by an admin or event creator.", +	'event_calendar:settings:add_users_notify:title' => "Email users who have had an event added to their personal calendar by an admin or event creator.",  	'event_calendar:add_users_notify:subject' => "A new event has been added to your personal calendar",  	'event_calendar:add_users_notify:body' => "%s,\n\nThe \"%s\" event has been added to your calendar.\n\nYou can view it here: \n\n%s\n", @@ -217,6 +217,7 @@ You can manage calendar requests for this event here:  	'event_calendar:ical_auth_file_name:title' => "Location of iCal authentication file on local file system (experimental - not needed for public feeds)",  	'event_calendar:owner:permissions_error' => "You do not have permission to view that page.", +	'event_calendar:feature_not_activated' => "This feature is not activated",  	'event_calendar:show_all' => "Show all",  	'event_calendar:show_open' => "Show open", @@ -250,6 +251,7 @@ You can manage calendar requests for this event here:  	'river:update:object:event_calendar' => "%s updated the event %s",  	'river:create:object:event_calendar' => "%s added the event %s", +	'river:comment:object:event_calendar' => '%s commented on the event %s',      'event_calendar:river:created' => "%s added",      'event_calendar:river:updated' => "%s updated",      'event_calendar:river:annotated1' => "%s added", diff --git a/models/model.php b/models/model.php index 65a9215af..90f20fba3 100644 --- a/models/model.php +++ b/models/model.php @@ -1548,6 +1548,13 @@ function event_calendar_get_page_content_manage_users($event_guid) {  	$event = get_entity($event_guid);  	$limit = 10;  	$offset = get_input('offset', 0); +	 +	$event_calendar_add_users = elgg_get_plugin_setting('add_users', 'event_calendar'); +	if ($event_calendar_add_users != 'yes') { +		register_error(elgg_echo('event_calendar:feature_not_activated')); +		forward(); +		exit; +	}  	if (!elgg_instanceof($event, 'object', 'event_calendar')) {  		$content = elgg_echo('event_calendar:error_nosuchevent'); @@ -1658,10 +1665,13 @@ function event_calendar_handle_menu($event_guid) {  		elgg_register_menu_item('page', $item);  		//add_submenu_item(elgg_echo('event_calendar:review_requests_title'), $CONFIG->wwwroot . "pg/event_calendar/review_requests/".$event_id, '0eventcalendaradmin');  	} -	$url =  "event_calendar/manage_users/$event_guid"; -	$item = new ElggMenuItem('event-calendar-1manage_users', elgg_echo('event_calendar:manage_users:breadcrumb'), $url); -	$item->setSection('event_calendar'); -	elgg_register_menu_item('page', $item); +	$event_calendar_add_users = elgg_get_plugin_setting('add_users', 'event_calendar'); +	if ($event_calendar_add_users == 'yes') { +		$url =  "event_calendar/manage_users/$event_guid"; +		$item = new ElggMenuItem('event-calendar-1manage_users', elgg_echo('event_calendar:manage_users:breadcrumb'), $url); +		$item->setSection('event_calendar'); +		elgg_register_menu_item('page', $item); +	}  }  function event_calendar_get_secret_key() {  	$key_file_name = elgg_get_plugin_setting('ical_auth_file_name','event_calendar'); diff --git a/views/default/settings/event_calendar/edit.php b/views/default/plugins/event_calendar/settings.php index 54ff5c1c3..54ff5c1c3 100644 --- a/views/default/settings/event_calendar/edit.php +++ b/views/default/plugins/event_calendar/settings.php | 
