Permalink
Browse files

MDL-41485 calendar: Replace value of action buttons on managesubscrip…

…tion page with int
  • Loading branch information...
1 parent abb7671 commit 2bcfd98eab96cb7fc43befe8c204885f854b96a4 @ankitagarwal ankitagarwal committed Aug 29, 2013
Showing with 17 additions and 7 deletions.
  1. +12 −4 calendar/lib.php
  2. +1 −1 calendar/managesubscriptions.php
  3. +4 −2 calendar/renderer.php
View
@@ -111,6 +111,16 @@
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
*
* @return array array of days
@@ -2851,11 +2861,9 @@ function calendar_process_subscription_row($subscriptionid, $pollinterval, $acti
// Fetch the subscription from the database making sure it exists.
$sub = $DB->get_record('event_subscriptions', array('id' => $subscriptionid), '*', MUST_EXIST);
- $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;
@@ -2866,7 +2874,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;
@@ -33,7 +33,7 @@
// Used for processing subscription actions.
$subscriptionid = optional_param('id', 0, PARAM_INT);
$pollinterval = optional_param('pollinterval', 0, PARAM_INT);
-$action = optional_param('action', '', PARAM_ALPHA);
+$action = optional_param('action', '', PARAM_INT);
$url = new moodle_url('/calendar/managesubscriptions.php');
if ($courseid != SITEID) {
View
@@ -814,9 +814,11 @@ protected function subscription_action_form($subscription, $courseid) {
$html .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'course', 'value' => $courseid));
$html .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'id', 'value' => $subscription->id));
if (!empty($subscription->url)) {
- $html .= html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'action', 'value' => get_string('update')));
+ $html .= html_writer::tag('button', get_string('update'), array('type' => 'submit', 'name' => 'action',
+ 'value' => CALENDAR_SUBSCRIPTION_UPDATE));
}
- $html .= html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'action', 'value' => get_string('remove')));
+ $html .= html_writer::tag('button', get_string('remove'), array('type' => 'submit', 'name' => 'action',
+ 'value' => CALENDAR_SUBSCRIPTION_REMOVE));
$html .= html_writer::end_tag('div');
$html .= html_writer::end_tag('form');
return $html;

0 comments on commit 2bcfd98

Please sign in to comment.