コード例 #1
0
ファイル: addraid.php プロジェクト: ZerGabriel/Raidtracker
 /**
  * integrates raid in bbDKP
  *
  */
 private function raid_insert()
 {
     global $db, $user, $config, $phpEx, $phpbb_root_path;
     $RaidController = new \bbdkp\controller\raids\RaidController();
     $raidinfo = array('raid_note' => $this->globalcomments[$this->batchid], 'raid_event' => $this->globalcomments[$this->batchid], 'raid_start' => $this->raidbegin, 'raid_end' => $this->raidend, 'event_id' => $this->event);
     foreach ($this->allplayerinfo as $playerid => $attendee) {
         if ($attendee['skipped'] == false) {
             $timebonus = 0;
             if (isset($this->timebonuses[$this->batchid][$attendee['playername']])) {
                 $timebonus = (double) $this->timebonuses[$this->batchid][$attendee['playername']];
             }
             $raiddetail[] = array('member_id' => $attendee['member_id'], 'raid_value' => (double) $this->raid_value[$this->batchid], 'time_bonus' => (double) $timebonus);
         }
     }
     //fill raid and raiddetail table
     $raid_id = $RaidController->add_raid($raidinfo, $raiddetail);
     //fill dkp points table with earned
     $PointsController = new \bbdkp\controller\points\PointsController();
     $PointsController->add_points($raid_id);
     $log_action = array('header' => 'L_ACTION_RAID_ADDED', 'id' => $raid_id, 'L_EVENT' => $this->eventname[$this->batchid], 'L_ATTENDEES' => $this->allattendees[$this->batchid], 'L_NOTE' => $this->globalcomments[$this->batchid], 'L_VALUE' => $this->raid_value[$this->batchid], 'L_ADDED_BY' => $user->data['username']);
     $this->log_insert(array('log_type' => $log_action['header'], 'log_action' => $log_action));
     // commit
     $db->sql_transaction('commit');
     return $raid_id;
 }