示例#1
0
 /**
  *
  */
 public function notification()
 {
     if ($_POST) {
         $notification = new Notifications();
         $notification->setNotification($_POST);
         $user = JXFactory::getUser();
         $notificationSetting = $notification->getNotification();
         foreach ($notificationSetting as $group => $typeInfo) {
             foreach ($typeInfo as $type => $typeSetting) {
                 $globalNotification = $notification->getGlobalNotificationIndex($type);
                 $emailNotification = $notification->getEmailNotificationIndex($type);
                 $user->setParam($globalNotification, $notification->getGlobalNotificationSetting($type));
                 $user->setParam($emailNotification, $notification->getEmailNotificationSetting($type));
             }
         }
         $user->save();
         $mainframe = JFactory::getApplication();
         $mainframe->redirect(JRoute::_('index.php?option=com_profile&view=edit&task=notification', false), JText::_('COM_PROFILE_ACTION_SAVE_NOTIFICATION_SUCCESS'));
         exit;
     }
     JRequest::setVar('view', 'notification');
     parent::display();
 }