MDL-41485 calendar: Replace value of action buttons on managesubscription page with int

This commit is contained in:
Ankit Agarwal 2013-08-29 14:54:26 +08:00
parent d2aa53be1b
commit ee74a2a19e
3 changed files with 17 additions and 9 deletions

View file

@ -110,6 +110,16 @@ define('CALENDAR_IMPORT_EVENT_UPDATED', 1);
*/
define('CALENDAR_IMPORT_EVENT_INSERTED', 2);
/**
* CALENDAR_SUBSCRIPTION_UPDATE - Used to represent update action for subscriptions in various forms.
*/
define('CALENDAR_SUBSCRIPTION_UPDATE', 1);
/**
* CALENDAR_SUBSCRIPTION_REMOVE - Used to represent remove action for subscriptions in various forms.
*/
define('CALENDAR_SUBSCRIPTION_REMOVE', 2);
/**
* Return the days of the week
*
@ -2914,17 +2924,13 @@ function calendar_add_icalendar_event($event, $courseid, $subscriptionid) {
* @return string A log of the import progress, including errors
*/
function calendar_process_subscription_row($subscriptionid, $pollinterval, $action) {
global $DB;
// Fetch the subscription from the database making sure it exists.
$sub = calendar_get_subscription($subscriptionid);
$strupdate = get_string('update');
$strremove = get_string('remove');
// Update or remove the subscription, based on action.
switch ($action) {
case $strupdate:
case CALENDAR_SUBSCRIPTION_UPDATE:
// Skip updating file subscriptions.
if (empty($sub->url)) {
break;
@ -2935,7 +2941,7 @@ function calendar_process_subscription_row($subscriptionid, $pollinterval, $acti
// Update the events.
return "<p>".get_string('subscriptionupdated', 'calendar', $sub->name)."</p>" . calendar_update_subscription_events($subscriptionid);
case $strremove:
case CALENDAR_SUBSCRIPTION_REMOVE:
calendar_delete_subscription($subscriptionid);
return get_string('subscriptionremoved', 'calendar', $sub->name);
break;