Esempio n. 1
0
 /**
  * Set variables up before form is built.
  *
  * @return void
  */
 public function preProcess()
 {
     parent::preProcess();
     $setTab = CRM_Utils_Request::retrieve('setTab', 'Int', $this, FALSE, 0);
     $mapping = CRM_Utils_Array::first(CRM_Core_BAO_ActionSchedule::getMappings(array('id' => $this->_isTemplate ? CRM_Event_ActionMapping::EVENT_TPL_MAPPING_ID : CRM_Event_ActionMapping::EVENT_NAME_MAPPING_ID)));
     $reminderList = CRM_Core_BAO_ActionSchedule::getList(FALSE, $mapping, $this->_id);
     if ($reminderList && is_array($reminderList)) {
         // Add action links to each of the reminders
         foreach ($reminderList as &$format) {
             $action = CRM_Core_Action::UPDATE + CRM_Core_Action::DELETE;
             if ($format['is_active']) {
                 $action += CRM_Core_Action::DISABLE;
             } else {
                 $action += CRM_Core_Action::ENABLE;
             }
             $scheduleReminder = new CRM_Admin_Page_ScheduleReminders();
             $links = $scheduleReminder->links();
             $links[CRM_Core_Action::DELETE]['qs'] .= "&context=event&compId={$this->_id}";
             $links[CRM_Core_Action::UPDATE]['qs'] .= "&context=event&compId={$this->_id}";
             $format['action'] = CRM_Core_Action::formLink($links, $action, array('id' => $format['id']), ts('more'), FALSE, 'actionSchedule.manage.action', 'ActionSchedule', $this->_id);
         }
     }
     $this->assign('rows', $reminderList);
     $this->assign('setTab', $setTab);
     $this->assign('component', 'event');
     // Update tab "disabled" css class
     $this->ajaxResponse['tabValid'] = is_array($reminderList) && count($reminderList) > 0;
     $this->setPageTitle(ts('Scheduled Reminder'));
 }
 /**
  * Function to set variables up before form is built
  *
  * @return void
  * @access public
  */
 function preProcess()
 {
     parent::preProcess();
     $newReminder = CRM_Utils_Request::retrieve('new', 'Boolean', $this, FALSE, FALSE);
     if ($this->_action & CRM_Core_Action::UPDATE && !$newReminder) {
         $field = 'civicrm_event';
         if ($this->_isTemplate) {
             $field = 'event_template';
         }
         $reminderList = CRM_Core_BAO_ActionSchedule::getList(FALSE, $field, $this->_id);
         if ($reminderList && is_array($reminderList)) {
             // Add action links to each of the reminders
             foreach ($reminderList as &$format) {
                 $action = CRM_Core_Action::UPDATE + CRM_Core_Action::DELETE;
                 if ($format['is_active']) {
                     $action += CRM_Core_Action::DISABLE;
                 } else {
                     $action += CRM_Core_Action::ENABLE;
                 }
                 $scheduleReminder = new CRM_Admin_Page_ScheduleReminders();
                 $links = $scheduleReminder->links();
                 $links[CRM_Core_Action::DELETE]['qs'] .= "&context=event&eventId={$this->_id}";
                 $links[CRM_Core_Action::UPDATE]['qs'] .= "&context=event&eventId={$this->_id}";
                 $format['action'] = CRM_Core_Action::formLink($links, $action, array('id' => $format['id']), ts('more'), FALSE, 'event.reminder.list', 'Event', $this->_id);
             }
         } else {
             $reminderList = TRUE;
         }
         $this->assign('rows', $reminderList);
         // Update tab "disabled" css class
         $this->ajaxResponse['tabValid'] = !empty($reminderList) && is_array($reminderList);
     }
     $this->setPageTitle(ts('Scheduled Reminder'));
 }
Esempio n. 3
0
 /**
  * Function to set variables up before form is built
  *
  * @return void
  * @access public
  */
 function preProcess()
 {
     parent::preProcess();
     $newReminder = CRM_Utils_Request::retrieve('new', 'Boolean', $this, FALSE, FALSE);
     if ($this->_action & CRM_Core_Action::UPDATE && !$newReminder) {
         $field = 'civicrm_event';
         if ($this->_isTemplate) {
             $field = 'event_template';
         }
         $reminderList = CRM_Core_BAO_ActionSchedule::getList(FALSE, $field, $this->_id);
         if (is_array($reminderList)) {
             // Add action links to each of the reminders
             foreach ($reminderList as &$format) {
                 $action = CRM_Core_Action::UPDATE + CRM_Core_Action::DELETE;
                 if ($format['is_active']) {
                     $action += CRM_Core_Action::DISABLE;
                 } else {
                     $action += CRM_Core_Action::ENABLE;
                 }
                 $links = CRM_Admin_Page_ScheduleReminders::links();
                 $links[CRM_Core_Action::DELETE]['qs'] .= "&context=event&eventId={$this->_id}";
                 $links[CRM_Core_Action::UPDATE]['qs'] .= "&context=event&eventId={$this->_id}";
                 $format['action'] = CRM_Core_Action::formLink($links, $action, array('id' => $format['id']));
             }
             $this->assign('rows', $reminderList);
         }
     }
 }
 /**
  * Get action Links.
  *
  * @return array
  *   (reference) of action links
  */
 public function &links()
 {
     if (!self::$_links) {
         // helper variable for nicer formatting
         self::$_links = array(CRM_Core_Action::UPDATE => array('name' => ts('Edit'), 'url' => 'civicrm/admin/scheduleReminders', 'qs' => 'action=update&id=%%id%%&reset=1', 'title' => ts('Edit Schedule Reminders')), CRM_Core_Action::ENABLE => array('name' => ts('Enable'), 'ref' => 'crm-enable-disable', 'title' => ts('Enable Label Format')), CRM_Core_Action::DISABLE => array('name' => ts('Disable'), 'ref' => 'crm-enable-disable', 'title' => ts('Disable Label Format')), CRM_Core_Action::DELETE => array('name' => ts('Delete'), 'url' => 'civicrm/admin/scheduleReminders', 'qs' => 'action=delete&id=%%id%%', 'title' => ts('Delete Schedule Reminders')));
     }
     return self::$_links;
 }