Esempio n. 1
0
 private function _enableAllNotification()
 {
     $enabledSetting = 1;
     $my = JFactory::getUser();
     $notification = new Notifications($my);
     if (is_null($my->getParam($notification->getEmailNotificationIndex('profile_post_comment')))) {
         $notificationSetting = $notification->getNotification();
         foreach ($notificationSetting as $group => $typeInfo) {
             foreach ($typeInfo as $type => $typeSetting) {
                 $globalNotification = $notification->getGlobalNotificationIndex($type);
                 $emailNotification = $notification->getEmailNotificationIndex($type);
                 $my->setParam($globalNotification, $enabledSetting);
                 $my->setParam($emailNotification, $enabledSetting);
             }
         }
         $my->save();
     }
 }
Esempio n. 2
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();
 }