Exemple #1
0
 public function changeTypeYES()
 {
     // Check for request forgeries.
     JRequest::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     // Initialise variables.
     $ids = JRequest::getVar('cid', array(), '', 'array');
     if (empty($ids)) {
         JError::raiseWarning(500, JText::_('COM_TRACKER_GROUPS_NO_GROUP_SELECTED'));
     } else {
         // Add the ability to leech from the users of the specified group
         if ($this->task == 'can_leech') {
             TrackerHelper::changeUsersPermission('can_leech', $ids, 1);
         }
         // Get the model.
         $model = $this->getModel();
         // Change the state of the records.
         if (!$model->changeValue($ids, $this->task, 1)) {
             JError::raiseWarning(500, $model->getError());
         } else {
             $this->setMessage(JText::_('COM_TRACKER_GROUP_CHANGE_' . strtoupper($this->task) . '_YES'));
         }
     }
     $this->setRedirect('index.php?option=com_tracker&view=groups');
 }