recalculate() public method

Recalculate a record after a log operation.
public recalculate ( )
Esempio n. 1
0
 public function notSpam($LogIDs)
 {
     $this->permission(array('Garden.Moderation.Manage', 'Moderation.Spam.Manage'), false);
     if (!$this->Request->isPostBack()) {
         throw permissionException('Javascript');
     }
     $Logs = array();
     // Verify the appropriate users.
     $UserIDs = $this->Form->getFormValue('UserID', array());
     if (!is_array($UserIDs)) {
         $UserIDs = array();
     }
     foreach ($UserIDs as $UserID) {
         Gdn::userModel()->setField($UserID, 'Verified', true);
         $Logs = array_merge($Logs, $this->LogModel->getWhere(array('Operation' => 'Spam', 'RecordUserID' => $UserID)));
     }
     // Grab the logs.
     $Logs = array_merge($Logs, $this->LogModel->getIDs($LogIDs));
     //      try {
     foreach ($Logs as $Log) {
         $this->LogModel->restore($Log);
     }
     //      } catch (Exception $Ex) {
     //         $this->Form->addError($Ex->getMessage());
     //      }
     $this->LogModel->recalculate();
     $this->setData('Complete');
     $this->setData('Count', count($Logs));
     $this->render('Blank', 'Utility');
 }