Beispiel #1
0
 private function _sendPayment($marker, $marks, $assessmentAssoc, $assessmentFix = 0)
 {
     if (count($marks) === 0 && empty($assessmentAssoc)) {
         return false;
     }
     foreach ($marks as $markAssoc) {
         $mark = new Mark();
         $mark->setKey($markAssoc[$mark->getKeyField()]);
         $mark->paid();
         $mark->update();
         $markKeys[] = $markAssoc[$mark->getKeyField()];
     }
     $assessmentAmount = 0;
     if (!empty($assessmentAssoc)) {
         $assessment = new Assessment();
         $assessment->setKey($assessmentAssoc[$assessment->getKeyField()]);
         $assessment->paid();
         $assessment->update();
         $markKeys[] = 'Assessment script';
         $assessmentAmount = 1;
     }
     if ($assessmentFix) {
         $assessmentFix = new AssessmentFix();
         $assessmentFix->setKey($this->_getUser());
         $assessmentFix->paid();
         $assessmentFix->update();
         $markKeys[] = 'Assessment bounty';
     }
     $this->load->model('wage');
     $amount = ($assessmentFix + count($marks) + $assessmentAmount) * 1.5;
     $wage = new Wage();
     $wage->paid($marker, $amount, $markKeys);
     $wage->create();
     return $amount;
 }