示例#1
0
文件: raids.php 项目: ZerGabriel/core
 public function get_raids($params, $body)
 {
     $isAPITokenRequest = $this->pex->getIsApiTokenRequest();
     if ($this->user->check_pageobjects(array('raids'), 'AND', false) || $isAPITokenRequest) {
         $raidlist = $this->pdh->get('raid', 'id_list');
         $raidlist = $this->pdh->sort($raidlist, 'raid', 'date', 'desc');
         $intNumber = intval($params['get']['number']) > 0 ? intval($params['get']['number']) : false;
         $intStart = intval($params['get']['number']) > 0 ? intval($params['get']['start']) : 0;
         if ($intNumber !== false) {
             $raidlist = $this->pdh->limit($raidlist, $intStart, $intNumber);
         }
         $out = array();
         foreach ($raidlist as $key => $raid_id) {
             $date_raw = $this->pdh->get('raid', 'date', array($raid_id));
             $date_info = $this->pdh->get('raid', 'date', array($raid_id));
             $date_info = date("Y-m-d H:i:s", $date_raw);
             $added_by = $this->pdh->get('raid', 'added_by', array($raid_id));
             $event_name = unsanitize($this->pdh->get('raid', 'event_name', array($raid_id)));
             $event_id = unsanitize($this->pdh->get('raid', 'event', array($raid_id)));
             $raid_note = unsanitize($this->pdh->get('raid', 'note', array($raid_id)));
             $added_by_name = unsanitize($this->pdh->get('user', 'name', array($added_by)));
             $raid_value = $this->pdh->get('raid', 'value', array($raid_id));
             $out['raid:' . $raid_id] = array('id' => $raid_id, 'date' => $date_info, 'date_timestamp' => $date_raw, 'note' => $raid_note, 'event_id' => $event_id, 'event_name' => $event_name, 'added_by_id' => 0, 'added_by_name' => $added_by, 'value' => runden($raid_value));
         }
         return $out;
     } else {
         return $this->pex->error('access denied');
     }
 }
 public function get_effective_dkp($member_id, $multidkp_id, $time_period, $with_twink = true)
 {
     if (!isset($this->edkp[$time_period])) {
         $this->init_effective_dkp($time_period, $with_twink);
     }
     return runden($this->edkp[$time_period][$member_id][$multidkp_id]);
 }
示例#3
0
 public function ajax_eventvalue()
 {
     header('content-type: text/html; charset=UTF-8');
     $event_id = $this->in->get('event', 0);
     $event_value = $this->pdh->geth("event", "value", array($event_id));
     echo runden($event_value);
     die;
 }
示例#4
0
 private function prepare_data($type, $id, $method = 'add')
 {
     $data = array();
     if ($type == 'zone') {
         $data = array($this->in->get('string:' . $id, ''), $this->in->get('event:' . $id, 0), runden($this->in->get('timebonus:' . $id, 0.0)), $this->in->get('diff:' . $id, 0), $this->in->get('sort:' . $id, 0));
     } else {
         $data = array($this->in->get('string:' . $id, '', 'string'), $this->config->get('event_boss', 'raidlogimport') & 1 ? $this->in->get('event:' . $id, 0) : $this->in->get('note:' . $id, ''), runden($this->in->get('bonus:' . $id, 0.0)), runden($this->in->get('timebonus:' . $id, 0.0)), $this->in->get('diff:' . $id, 0), $this->in->get('tozone:' . $id, 0), $this->in->get('sort:' . $id, 0));
     }
     if ($method == 'update') {
         list($type, $id) = explode('_', $id);
         $data = array_merge(array($id), $data);
     }
     return $data;
 }
 public function display($with_form = false)
 {
     if ($this->rli->get_cache_data('progress') == 'adjustments') {
         $this->rli->add_cache_data('progress', 'finish');
     }
     $members = $this->member->get_for_dropdown(4);
     $events = $this->pdh->aget('event', 'name', 0, array($this->pdh->get('event', 'id_list')));
     $raid_select = array_merge(array($this->user->lang('none')), $this->raid->raidlist());
     $a = 0;
     if (is_array($this->adjs)) {
         foreach ($this->adjs as $a => $adj) {
             $ev_sel = isset($adj['event']) ? $adj['event'] : 0;
             if (runden($adj['value']) == '0' || runden($adj['value']) == '-0') {
                 unset($data['adjs'][$a]);
                 continue;
             }
             $this->tpl->assign_block_vars('adjs', array('MEMBER' => $this->html->widget(array('type' => 'dropdown', 'name' => 'adjs[' . $a . '][member]', 'options' => $members, 'selected' => $adj['member'], 'id' => 'adjs_' . $a . '_member', 'no_lang' => true)), 'EVENT' => $this->html->widget(array('type' => 'dropdown', 'name' => 'adjs[' . $a . '][event]', 'options' => $events, 'selected' => $ev_sel, 'id' => 'adjs_' . $a . '_event', 'no_lang' => true)), 'NOTE' => $adj['reason'], 'VALUE' => $adj['value'], 'RAID' => $this->html->widget(array('type' => 'dropdown', 'name' => 'adjs[' . $a . '][raid]', 'options' => $raid_select, 'selected' => $adj['raid'], 'id' => 'adjs_' . $a . 'raid', 'no_lang' => true)), 'KEY' => $a));
         }
     }
     $this->tpl->assign_block_vars('adjs', array('KEY' => 999, 'MEMBER' => $this->html->widget(array('type' => 'dropdown', 'name' => 'adjs[999][member]', 'options' => $members, 'selected' => 0, 'id' => 'adjs_999_member', 'no_lang' => true)), 'EVENT' => $this->html->widget(array('type' => 'dropdown', 'name' => 'adjs[999][event]', 'options' => $events, 'selected' => 0, 'id' => 'adjs_999_event', 'no_lang' => true)), 'RAID' => $this->html->widget(array('type' => 'dropdown', 'name' => 'adjs[999][raid]', 'options' => $raid_select, 'selected' => 0, 'id' => 'adjs_999_raid', 'no_lang' => true)), 'DISPLAY' => 'style="display: none;"', 'DELCHK' => 'checked="checked"'));
     $this->tpl->add_js("\$('#rli_select_all').click(function() {\n\tif(\$('.rli_select_me').prop('checked')) {\n\t\t\$('.rli_select_me').removeAttr('checked');\n\t} else {\n\t\t\$('.rli_select_me').attr('checked', 'checked');\n\t}\n});\nvar rli_key = " . ($a + 1) . ";\n\$('#add_adj_button').click(function() {\n\tvar adj = \$('#adj_999').clone(true);\n\tadj.find('.rli_select_me').removeAttr('checked');\n\tadj.html(adj.html().replace(/999/g, rli_key));\n\tadj.attr('id', 'adj_'+rli_key);\n\tadj.removeAttr('style');\n\t\$('#adj_999').before(adj);\n\trli_key++;\n});", 'docready');
 }
示例#6
0
 public function display($with_form = false)
 {
     if ($this->config('deactivate_adj')) {
         if ($this->rli->get_cache_data('progress') == 'items') {
             $this->rli->add_cache_data('progress', 'finish');
         }
     } else {
         if ($this->rli->get_cache_data('progress') == 'items') {
             $this->rli->add_cache_data('progress', 'adjustments');
         }
     }
     $p = count($this->items);
     $start = 0;
     $end = $p + 1;
     if (false && ($vars = ini_get('suhosin.post.max_vars'))) {
         //Disabled for now, not yet working with new tab-layout
         $vars = $vars - 5;
         $dic = $vars / 7;
         settype($dic, 'int');
         $page = 1;
         if (!(strpos($this->in->get('checkitem'), $this->user->lang('rli_itempage')) === false)) {
             $page = str_replace($this->user->lang('rli_itempage'), '', $this->in->get('checkitem'));
         }
         if ($page >= 1) {
             $start = ($page - 1) * $dic;
             $page++;
         }
         $end = $start + $dic;
     }
     $members = $this->member->get_for_dropdown(2);
     //add disenchanted and bank if not ignored
     if (empty($this->toignore) || !in_array('disenchanted', $this->toignore)) {
         $members['disenchanted'] = 'disenchanted';
         $this->member->check_special('disenchanted');
     }
     if (empty($this->toignore) || !in_array('bank', $this->toignore)) {
         $members['bank'] = 'bank';
         $this->member->check_special('bank');
     }
     ksort($members);
     $members = array_merge(array($this->user->lang('rli_choose_mem')), $members);
     $itempools = $this->pdh->aget('itempool', 'name', 0, array($this->pdh->get('itempool', 'id_list')));
     //maybe add "saving" for itempool
     $key = -1;
     foreach ($this->items as $key => $item) {
         if ($start <= $key and $key < $end or !$with_form) {
             if ($with_form) {
                 $mem_sel = isset($members[$item['member']]) ? $item['member'] : 0;
                 $raid_select = "<select size='1' name='loots[" . $key . "][raid]'>";
                 $att_raids = $this->raid->get_attendance_raids();
                 $this->raid->raidlist(true);
                 foreach ($this->raid->raidlist as $i => $note) {
                     if (!(in_array($i, $att_raids) and $this->config('attendence_raid'))) {
                         $raid_select .= "<option value='" . $i . "'";
                         if (!$item['raid'] && $this->raid->item_in_raid($i, $item['time']) || $item['raid'] && $item['raid'] == $i) {
                             $raid_select .= ' selected="selected"';
                             if (!$item['itempool'] && $this->config('itempool_save')) {
                                 $item['itempool'] = $this->pdh->get('rli_item', 'itempool', array($item['game_id'], $this->raid->raidevents[$i]));
                             }
                             if (!$item['itempool']) {
                                 $mdkps = $this->pdh->get('multidkp', 'mdkpids4eventid', array($this->raid->raidevents[$i]));
                                 $itmpls = $this->pdh->get('multidkp', 'itempool_ids', array($mdkps[0]));
                                 $item['itempool'] = $itmpls[0];
                             }
                         }
                         $raid_select .= ">" . $note . "</option>";
                     }
                 }
             }
             $this->tpl->assign_block_vars('loots', array('LOOTNAME' => $item['name'], 'ITEMID' => isset($item['game_id']) ? $item['game_id'] : '', 'LOOTER' => $with_form ? $this->html->widget(array('type' => 'dropdown', 'name' => "loots[" . $key . "][member]", 'options' => $members, 'selected' => $mem_sel, 'id' => 'loots_' . $key . '_member', 'no_lang' => true)) : $item['member'], 'RAID' => $with_form ? $raid_select . "</select>" : $item['raid'], 'ITEMPOOL' => $with_form ? $this->html->widget(array('type' => 'dropdown', 'name' => "loots[" . $key . "][itempool]", 'options' => $itempools, 'selected' => $item['itempool'], 'id' => 'loots_' . $key . '_itempool', 'no_lang' => true)) : $this->pdh->get('itempool', 'name', array($item['itempool'])), 'LOOTDKP' => runden($item['value']), 'KEY' => $key, 'DELDIS' => 'disabled="disabled"'));
         }
     }
     if ($with_form) {
         //js deletion
         if (!$this->rli->config('no_del_warn')) {
             $options = array('custom_js' => "\$('#'+del_id).css('display', 'none'); \$('#'+del_id+'submit').removeAttr('disabled');", 'withid' => 'del_id', 'message' => $this->user->lang('rli_delete_items_warning'));
             $this->jquery->Dialog('delete_warning', $this->user->lang('confirm_deletion'), $options, 'confirm');
         }
         //js addition
         $this->tpl->assign_block_vars('loots', array('KEY' => 999, 'ITEMPOOL' => $this->html->widget(array('type' => 'dropdown', 'name' => 'loots[999][itempool]', 'options' => $itempools, 'selected' => 0, 'id' => 'loots_999_itempool', 'no_lang' => true)), 'LOOTER' => $this->html->widget(array('type' => 'dropdown', 'name' => 'loots[999][member]', 'options' => $members, 'selected' => 0, 'id' => 'loots_999_member', 'no_lang' => true)), 'RAID' => $this->html->widget(array('type' => 'dropdown', 'name' => 'loots[999][raid]', 'options' => $this->raid->raidlist, 'selected' => 0, 'id' => 'loots_999_raid', 'no_lang' => true)), 'DISPLAY' => 'style="display: none;"', 'S_IP_SAVE' => $this->config('itempool_save')));
         $this->tpl->add_js("var rli_key = " . ($key + 1) . ";\n\$('.del_item').click(function() {\n\t\$(this).removeClass('del_item');\n\t" . ($this->rli->config('no_del_warn') ? "\$('#'+\$(this).attr('class')).css('display', 'none');\n\t\$('#'+\$(this).attr('class')+'submit').removeAttr('disabled');" : "delete_warning(\$(this).attr('class'));") . "\n});\n\$('#add_item_button').click(function() {\n\tvar item = \$('#item_999').clone(true);\n\titem.find('#item_999submit').attr('disabled', 'disabled');\n\titem.html(item.html().replace(/999/g, rli_key));\n\titem.attr('id', 'item_'+rli_key);\n\titem.removeAttr('style');\n\t\$('#item_999').before(item);\n\trli_key++;\n});", 'docready');
     }
     if ($end && $end <= $p) {
         $next_button = '<input type="submit" name="checkitem" value="' . $this->user->lang('rli_itempage') . ($page ? $page : 2) . '" class="mainoption" />';
     } elseif ($this->config('deactivate_adj')) {
         $next_button = '<input type="submit" name="insert" value="' . $this->user->lang('rli_go_on') . ' (' . $this->user->lang('rli_insert') . ')" class="mainoption" />';
     } else {
         $next_button = '<input type="submit" name="checkadj" value="' . $this->user->lang('rli_go_on') . ' (' . $this->user->lang('rli_checkadj') . ')" class="mainoption" />';
     }
     if ($end >= $p && !empty($dic) && $p + $dic >= $end) {
         $next_button .= ' <input type="submit" name="checkitem" value="' . $this->user->lang('rli_itempage') . ($page ? $page : 2) . '" class="mainoption" />';
     }
     $this->tpl->assign_var('NEXT_BUTTON', $next_button);
 }
示例#7
0
 public function get_html_current($member_id, $multidkp_id, $event_id = 0, $itempool_id = 0, $with_twink = true)
 {
     $with_twink = (int) $with_twink;
     $current = $this->get_current($member_id, $multidkp_id, $event_id, $itempool_id, $with_twink);
     return '<span class="' . color_item($current) . '">' . runden($current) . '</span>';
 }
示例#8
0
 public function get_epgp($member_id, $multidkp_id, $round = true, $with_twink = true)
 {
     $single = $with_twink ? 'multi' : 'single';
     $epgp = $this->epgp[$single][$member_id][$multidkp_id]['epgp'];
     return $round == true ? runden($epgp) : $epgp;
 }
 public function get_html_value($id, $dkp_id = 0)
 {
     return '<span class="positive">' . runden($this->get_value($id, $dkp_id)) . '</span>';
 }
示例#10
0
 public function get_epgp($member_id, $multidkp_id, $round = true, $with_twink = true)
 {
     if (!isset($this->epgp[$member_id])) {
         $this->init_epgp($with_twink);
     }
     $epgp = $this->epgp[$member_id][$multidkp_id]['epgp'];
     return $round == true ? runden($epgp) : $epgp;
 }
示例#11
0
 public function update($message = false, $force_refresh = false, $copy = false)
 {
     if ($message) {
         $this->core->messages($message);
     }
     $data = array();
     if ($force_refresh) {
         $data = $this->get_post(true);
         $this->pdh->process_hook_queue();
     }
     //fetch members
     $members = $this->pdh->aget('member', 'name', 0, array($this->pdh->sort($this->pdh->get('member', 'id_list', array(false, true, false)), 'member', 'name', 'asc')));
     //fetch events
     $events = $this->pdh->aget('event', 'name', 0, array($this->pdh->get('event', 'id_list')));
     asort($events);
     //fetch itempools
     $itempools = $this->pdh->aget('itempool', 'name', 0, array($this->pdh->get('itempool', 'id_list')));
     asort($itempools);
     //fetch Raids
     $raidlist = $this->pdh->get('raid', 'id_list');
     $raidlist = $this->pdh->sort($raidlist, 'raid', 'date', 'desc');
     $raids[] = '';
     foreach ($raidlist as $key => $row) {
         $raids[$row] = $this->time->user_date($this->pdh->get('raid', 'date', array($row))) . ' - ' . stripslashes($this->pdh->get('raid', 'event_name', array($row)));
     }
     //fetch notes
     $notes = $this->pdh->aget('raid', 'note', 0, array($this->pdh->get('raid', 'id_list')));
     asort($notes);
     $this->jquery->Autocomplete('note', array_unique($notes));
     //Autocompletes
     $adjustment_reasons = $this->pdh->aget('adjustment', 'reason', 0, array($this->pdh->get('adjustment', 'id_list')));
     $item_names = $this->pdh->aget('item', 'name', 0, array($this->pdh->get('item', 'id_list')));
     $raid = array('id' => $this->url_id, 'date' => $this->time->time, 'note' => '', 'event' => 0, 'value' => 0.0, 'attendees' => array());
     if ($raid['id']) {
         //we're updating a raid
         //fetch raid-data
         $raid = $this->get_raiddata($raid['id'], true);
         //fetch adjs
         $adjs = $this->get_adjsofraid($raid['id']);
         //fetch items
         $items = $this->get_itemsofraid($raid['id']);
         //Add additional members
         if (count($raid['attendees']) > 0) {
             $arrIDList = array_keys($members);
             $blnResort = false;
             foreach ($raid['attendees'] as $member_id) {
                 if (!isset($members[$member_id])) {
                     $arrIDList[] = $member_id;
                     $blnResort = true;
                 }
             }
             if ($blnResort) {
                 $members = $this->pdh->aget('member', 'name', 0, array($this->pdh->sort($arrIDList, 'member', 'name', 'asc')));
             }
         }
     }
     //If we get a draft
     if ($this->in->get('draft', 0) > 0) {
         $raid = $this->get_raiddata($this->in->get('draft', 0), true);
         $raid['id'] = 0;
         $raid['date'] = $this->time->time;
     }
     //we're refreshing the view
     if ($force_refresh) {
         if (!empty($data['raid'])) {
             $raid = $data['raid'];
         }
         if (!empty($data['adjs'])) {
             $adjs = $data['adjs'];
         }
         if (!empty($data['items'])) {
             $items = $data['items'];
         }
     }
     $intAdjKey = 0;
     if (isset($adjs) and is_array($adjs)) {
         foreach ($adjs as $key => $adj) {
             $this->tpl->assign_block_vars('adjs', array('KEY' => $key, 'GK' => $copy ? 'new' : $adj['group_key'], 'MEMBER' => $this->jquery->MultiSelect('adjs[' . $key . '][members]', $members, $adj['members'], array('width' => 250, 'id' => 'adjs_' . $key . '_members', 'filter' => true)), 'REASON' => sanitize($adj['reason']), 'EVENT' => new hdropdown('adjs[' . $key . '][event]', array('options' => $events, 'value' => $adj['event'], 'id' => 'event_' . $key)), 'VALUE' => $adj['value']));
             $adjs_ids[] = 'adjs_' . $key;
             if ($key > $intAdjKey) {
                 $intAdjKey = $key;
             }
         }
         if (isset($adjs_ids) and is_array($adjs_ids)) {
             $this->jquery->Autocomplete($adjs_ids, array_unique($adjustment_reasons));
         }
     }
     $intItemKey = 0;
     if (isset($items) and is_array($items)) {
         foreach ($items as $key => $item) {
             $this->tpl->assign_block_vars('items', array('KEY' => $key, 'GK' => $copy ? 'new' : $item['group_key'], 'NAME' => stripslashes($item['name']), 'ITEMID' => $item['item_id'], 'MEMBER' => $this->jquery->MultiSelect('items[' . $key . '][members]', $members, $item['members'], array('width' => 250, 'id' => 'items_' . $key . '_members', 'filter' => true)), 'VALUE' => $item['value'], 'ITEMPOOL' => new hdropdown('items[' . $key . '][itempool_id]', array('options' => $itempools, 'value' => $item['itempool_id'], 'id' => 'itempool_id_' . $key))));
             $item_ids[] = 'items_' . $key;
             if ($key > $intItemKey) {
                 $intItemKey = $key;
             }
         }
         if (isset($item_ids) and is_array($item_ids)) {
             $this->jquery->Autocomplete($item_ids, array_unique($item_names));
         }
     }
     if ($raid['id'] and $raid['id'] != 'new') {
         $this->confirm_delete($this->user->lang('del_raid_with_itemadj') . "<br />" . $this->time->user_date($raid['date']) . " " . $events[$raid['event']] . ": " . addslashes($raid['note']));
     }
     $this->tpl->assign_vars(array('DATE' => $this->jquery->Calendar('date', $this->in->get('dataimport', '') == 'true' ? $this->in->get('date', '') : $this->time->user_date($raid['date'], true, false, false, function_exists('date_create_from_format')), '', array('timepicker' => true)), 'NOTE' => stripslashes($this->in->get('dataimport', '') == 'true' ? $this->in->get('rnote', '') : $raid['note']), 'EVENT' => new hdropdown('event', array('options' => $events, 'value' => $this->in->get('dataimport', '') == 'true' ? $this->in->get('event', 0) : $raid['event'], 'js' => 'onchange="loadEventValue($(this).val())"')), 'RAID_EVENT' => $this->pdh->get('event', 'name', array($raid['event'])), 'RAID_DATE' => $this->time->user_date($raid['date']), 'RAID_ID' => $raid['id'] && !$copy ? $raid['id'] : 0, 'VALUE' => runden($this->in->get('dataimport', '') == 'true' ? $this->in->get('value', 0) : $raid['value']), 'NEW_MEM_SEL' => $this->jquery->MultiSelect('raid_attendees', $members, $this->in->get('dataimport', '') == 'true' ? $this->in->getArray('attendees', 'int') : $raid['attendees'], array('width' => 400, 'filter' => true)), 'RAID_DROPDOWN' => new hdropdown('draft', array('options' => $raids, 'value' => $this->in->get('draft', 0), 'js' => 'onchange="window.location=\'manage_raids.php' . $this->SID . '&amp;upd=true&amp;draft=\'+this.value"')), 'ADJ_KEY' => $intAdjKey + 1, 'MEMBER_DROPDOWN' => $this->jquery->MultiSelect('adjs[KEY][members]', $members, array(), array('width' => 250, 'id' => 'adjs_KEY_members', 'filter' => true)), 'MEMBER_ITEM_DROPDOWN' => $this->jquery->MultiSelect('items[KEY][members]', $members, array(), array('width' => 250, 'id' => 'items_KEY_members', 'filter' => true)), 'EVENT_DROPDOWN' => new hdropdown('adjs[KEY][event]', array('options' => $events, 'value' => $adj['event'], 'id' => 'event_KEY')), 'ADJ_REASON_AUTOCOMPLETE' => $this->jquery->Autocomplete('adjs_KEY', array_unique($adjustment_reasons)), 'ITEM_KEY' => $intItemKey + 1, 'ITEMPOOL_DROPDOWN' => new hdropdown('items[KEY][itempool_id]', array('options' => $itempools, 'value' => $item['itempool_id'], 'id' => 'itempool_id_KEY')), 'ITEM_AUTOCOMPLETE' => $this->jquery->Autocomplete('item_KEY', array_unique($item_names)), 'L_RAID_SAVE' => ($raid['id'] and $raid['id'] != 'new' && !$copy) ? $this->user->lang('update_raid') : $this->user->lang('add_raid'), 'S_RAID_UPD' => ($raid['id'] and $raid['id'] != 'new' && !$copy) ? true : false, 'S_EVENTVAL_ONLOAD' => $raid['id'] == 'new' && !$force_refresh && $this->in->get('dataimport', '') != 'true' ? true : false, 'ADDITIONAL_INFOS_EDITOR' => new hbbcodeeditor('additional_data', array('rows' => 10, 'value' => $this->in->get('dataimport', '') == 'true' ? $this->in->get('additional_data') : $raid['additional_data'])), 'ADDITIONAL_INFOS' => (isset($raid['additional_data']) and strlen($raid['additional_data'])) || $this->in->get('dataimport', '') == 'true' && strlen($this->in->get('additional_data')) ? 'true' : 'false'));
     $this->tpl->add_js("\n\t\$('#r_add_mem').click(function() {\n\t\tr_add_mem_durl();\n\t});\n\t\$('#r_add_event').click(function() {\n\t\tr_add_event_durl();\n\t});", 'docready');
     $this->jquery->dialog('r_add_mem_durl', $this->user->lang('add_member'), array('url' => $this->controller_path . 'AddCharacter/' . $this->SID . '&adminmode=1', 'width' => '640', 'height' => '520', 'onclosejs' => 'document.getElementById("refresh_button").click();'));
     $this->jquery->dialog('r_add_event_durl', $this->user->lang('add_event'), array('url' => 'manage_events.php' . $this->SID . '&upd=true&simple_head=true', 'width' => '700', 'height' => '550', 'onclosejs' => 'document.getElementById("refresh_button").click();'));
     $this->jquery->Collapse('#toggleAdjustments');
     $this->jquery->Collapse('#toggleItems');
     $this->jquery->Collapse('#toggleRaidInfos');
     $this->core->set_vars(array('page_title' => $this->user->lang('manraid_title'), 'template_file' => 'admin/manage_raids_edit.html', 'display' => true));
 }
示例#12
0
 public function display()
 {
     if ($raid_id = $this->in->get('r', 0)) {
         if (!in_array($raid_id, $this->pdh->get('raid', 'id_list'))) {
             message_die($this->user->lang('error_invalid_raid_provided'));
         }
         // Attendees
         $attendees_ids = $this->pdh->get('raid', 'raid_attendees', array($raid_id));
         foreach ($attendees_ids as $attendee_id) {
             $attendees[$attendee_id] = addslashes($this->pdh->get('member', 'name', array($attendee_id)));
         }
         $attendee_copy = $attendees;
         // Get each attendee's rank
         foreach ($attendees as $attendee_id => $attendee_name) {
             $ranks[$attendee_name] = array('prefix' => $this->pdh->get('rank', 'prefix', array($this->pdh->get('member', 'rankid', array($attendee_id)))), 'suffix' => $this->pdh->get('rank', 'suffix', array($this->pdh->get('member', 'rankid', array($attendee_id)))));
         }
         if (@sizeof($attendees) > 0) {
             // First get rid of duplicates and resort them just in case,
             // so we're sure they're displayed correctly
             $attendees = array_unique($attendees);
             sort($attendees);
             reset($attendees);
             $rows = ceil(sizeof($attendees) / $this->user->style['attendees_columns']);
             // First loop: iterate through the rows
             // Second loop: iterate through the columns as defined in template_config,
             // then "add" an array to $block_vars that contains the column definitions,
             // then assign the block vars.
             // Prevents one column from being assigned and the rest of the columns for
             // that row being blank
             for ($i = 0; $i < $rows; $i++) {
                 $block_vars = array();
                 for ($j = 0; $j < $this->user->style['attendees_columns']; $j++) {
                     $offset = $i + $rows * $j;
                     $attendee = isset($attendees_ids[$offset]) ? $attendees_ids[$offset] : '';
                     if ($attendee != '') {
                         $block_vars += array('COLUMN' . $j . '_NAME' => $this->pdh->get('member', 'html_memberlink', array($attendee, 'viewcharacter.php')));
                     } else {
                         $block_vars += array('COLUMN' . $j . '_NAME' => '');
                     }
                     // Are we showing this column?
                     $s_column = 's_column' . $j;
                     ${$s_column} = true;
                 }
                 $this->tpl->assign_block_vars('attendees_row', $block_vars);
             }
             $column_width = floor(100 / $this->user->style['attendees_columns']);
         } else {
             message_die('Could not get raid attendee information.', 'Critical Error');
         }
         // Drops
         $loot_dist = array();
         $items = $this->pdh->get('item', 'itemsofraid', array($raid_id));
         $chartcolorsLootdisti = array();
         foreach ($items as $item_id) {
             $buyer_id = $this->pdh->get('item', 'buyer', array($item_id));
             $class_name = $this->pdh->get('member', 'classname', array($buyer_id));
             $class_id = $this->pdh->get('member', 'classid', array($buyer_id));
             if (isset($loot_dist[$class_id])) {
                 $loot_dist[$class_id]['value']++;
             } else {
                 $loot_dist[$class_id] = array('value' => 1, 'name' => $class_name);
                 $chartcolorsLootdisti[$class_id] = $this->game->get_class_color($class_id);
             }
             $this->tpl->assign_block_vars('items_row', array('BUYER' => $this->pdh->get('member', 'html_memberlink', array($buyer_id, 'viewcharacter.php')), 'ITEM' => $this->pdh->get('item', 'link_itt', array($item_id, 'viewitem.php')), 'VALUE' => runden($this->pdh->get('item', 'value', array($item_id)))));
         }
         ksort($loot_dist);
         ksort($chartcolorsLootdisti);
         // Class distribution
         $class_dist = array();
         $total_attendee_count = sizeof($attendee_copy);
         foreach ($attendee_copy as $member_id => $member_name) {
             $member_class = $this->pdh->get('member', 'classname', array($member_id));
             $member_class_id = $this->pdh->get('member', 'classid', array($member_id));
             if ($member_name != '') {
                 $html_prefix = isset($ranks[$member_name]) ? $ranks[$member_name]['prefix'] : '';
                 $html_suffix = isset($ranks[$member_name]) ? $ranks[$member_name]['suffix'] : '';
                 if (isset($class_dist[$member_class_id]['names']) && isset($class_dist[$member_class_id]['count'])) {
                     $class_dist[$member_class_id]['names'] .= " " . $html_prefix . $member_name . $html_suffix . ",";
                     $class_dist[$member_class_id]['count']++;
                 } else {
                     $class_dist[$member_class_id] = array('names' => $html_prefix . $member_name . $html_suffix . ",", 'count' => 1);
                 }
             }
         }
         unset($ranks);
         #Class distribution
         $chartarray = array();
         $chartcolors = array();
         foreach ($class_dist as $class_id => $details) {
             $percentage = $total_attendee_count > 0 ? round($details['count'] / $total_attendee_count * 100) : 0;
             $class = $this->game->get_name('classes', $class_id);
             $chartarray[] = array('value' => $percentage, 'name' => $class . " (" . $class_dist[$class_id]['count'] . " - " . $percentage . "%)");
             $chartcolors[] = $this->game->get_class_color($class_id);
             $this->tpl->assign_block_vars('class_row', array('CLASS' => $this->game->decorate('classes', $class_id) . ' <span class="class_' . $class_id . '">' . $class . '</span>', 'BAR' => $this->jquery->ProgressBar('bar_' . $class, $percentage, $percentage . '%'), 'ATTENDEES' => $class_dist[$class_id]['names']));
         }
         $chartoptions['border'] = '0.0';
         $chartoptions['background'] = 'transparent';
         $chartoptionsLootDistri = $chartoptions;
         if ($this->game->get_class_color(1) != '') {
             $chartoptions['color_array'] = $chartcolors;
             $chartoptionsLootDistri['color_array'] = $chartcolorsLootdisti;
         }
         unset($eq_classes);
         // Comment System
         $comm_settings = array('attach_id' => $raid_id, 'page' => 'raids');
         $this->comments->SetVars($comm_settings);
         $COMMENT = $this->config->get('pk_enable_comments') == 1 ? $this->comments->Show() : '';
         $vpre = $this->pdh->pre_process_preset('rvalue', array(), 0);
         $vpre[2][0] = $raid_id;
         $this->tpl->assign_vars(array('L_MEMBERS_PRESENT_AT' => sprintf($this->user->lang('members_present_at'), $this->time->user_date($this->pdh->get('raid', 'date', array($raid_id)), false, false, true), $this->time->user_date($this->pdh->get('raid', 'date', array($raid_id)), false, true)), 'EVENT_ICON' => $this->game->decorate('events', array($this->pdh->get('raid', 'event', array($raid_id)), 40)), 'EVENT_NAME' => stripslashes($this->pdh->get('raid', 'event_name', array($raid_id))), 'COMMENT' => $COMMENT, 'S_COLUMN0' => isset($s_column0) ? true : false, 'S_COLUMN1' => isset($s_column1) ? true : false, 'S_COLUMN2' => isset($s_column2) ? true : false, 'S_COLUMN3' => isset($s_column3) ? true : false, 'S_COLUMN4' => isset($s_column4) ? true : false, 'S_COLUMN5' => isset($s_column5) ? true : false, 'S_COLUMN6' => isset($s_column6) ? true : false, 'S_COLUMN7' => isset($s_column7) ? true : false, 'S_COLUMN8' => isset($s_column8) ? true : false, 'S_COLUMN9' => isset($s_column9) ? true : false, 'COLUMN_WIDTH' => isset($column_width) ? $column_width : 0, 'COLSPAN' => $this->user->style['attendees_columns'], 'RAID_ADDED_BY' => $this->pdh->get('raid', 'added_by', array($raid_id)) != '' ? stripslashes($this->pdh->get('raid', 'added_by', array($raid_id))) : 'N/A', 'RAID_UPDATED_BY' => $this->pdh->get('raid', 'updated_by', array($raid_id)) != '' ? stripslashes($this->pdh->get('raid', 'updated_by', array($raid_id))) : 'N/A', 'RAID_NOTE' => $this->pdh->get('raid', 'note', array($raid_id)) != '' ? stripslashes($this->pdh->get('raid', 'note', array($raid_id))) : '&nbsp;', 'DKP_NAME' => $this->config->get('dkp_name'), 'RAID_VALUE' => $this->pdh->geth($vpre[0], $vpre[1], $vpre[2]), 'ATTENDEES_FOOTCOUNT' => sprintf($this->user->lang('viewraid_attendees_footcount'), sizeof($attendees)), 'ITEM_FOOTCOUNT' => sprintf($this->user->lang('viewraid_drops_footcount'), sizeof($items)), 'CLASS_PERCENT_CHART' => $this->jquery->PieChart('class_dist', $chartarray, '', $chartoptions, 2, true, true), 'LOOT_PERCENT_CHART' => count($loot_dist) > 0 ? $this->jquery->PieChart('loot_dist', $loot_dist, '', $chartoptionsLootDistri, 2) : ''));
         $this->core->set_vars(array('page_title' => $this->user->lang('viewraid_title'), 'template_file' => 'viewraid.html', 'display' => true));
     } else {
         message_die($this->user->lang('error_invalid_raid_provided'));
     }
 }
 public function get_html_attendance($member_id, $event_id, $time_period, $with_twinks = true)
 {
     $data = $this->get_attendance($member_id, $event_id, $time_period, $with_twinks, true);
     $percent = runden($data['member_attendance'] * 100);
     return $this->jquery->ProgressBar('evatt_' . $member_id . '_' . $event_id, $percent, $percent . '% (' . $data['member_raidcount'] . '/' . $data['total_raidcount'] . ')', 'center', true);
     return '<span class="' . color_item($percent * 100, true) . '">' . $percent * 100 . '% (' . $data['member_raidcount'] . '/' . $data['total_raidcount'] . ')</span>';
 }
示例#14
0
    public function update($message = false, $copy = false)
    {
        //fetch members for select
        $members = $this->pdh->aget('member', 'name', 0, array($this->pdh->sort($this->pdh->get('member', 'id_list', array(false, true, false)), 'member', 'name', 'asc')));
        //fetch raids for select
        $raids = array();
        $raidids = $this->pdh->sort($this->pdh->get('raid', 'id_list'), 'raid', 'date', 'desc');
        foreach ($raidids as $id) {
            $raids[$id] = '#ID:' . $id . ' - ' . $this->pdh->get('event', 'name', array($this->pdh->get('raid', 'event', array($id)))) . ' ' . $this->time->user_date($this->pdh->get('raid', 'date', array($id)));
        }
        //fetch itempools for select
        $itempools = $this->pdh->aget('itempool', 'name', 0, array($this->pdh->get('itempool', 'id_list')));
        if ($message) {
            $this->core->messages($message);
            $item = $this->get_post(true);
        }
        if ($this->in->exists('i')) {
            $grp_key = $this->pdh->get('item', 'group_key', array($this->in->get('i', 0)));
            $ids = $this->pdh->get('item', 'ids_of_group_key', array($grp_key));
            foreach ($ids as $id) {
                $item['buyers'][] = $this->pdh->get('item', 'buyer', array($id));
            }
            $item['name'] = $this->pdh->get('item', 'name', array($id));
            $item['value'] = $this->pdh->get('item', 'value', array($id));
            $item['date'] = $this->pdh->get('item', 'date', array($id));
            $item['raid_id'] = $this->pdh->get('item', 'raid_id', array($id));
            $item['item_id'] = $this->pdh->get('item', 'game_itemid', array($id));
            $item['itempool_id'] = $this->pdh->get('item', 'itempool_id', array($id));
            //Add additional members
            if (count($item['buyers']) > 0) {
                $arrIDList = array_keys($members);
                $blnResort = false;
                foreach ($item['buyers'] as $member_id) {
                    if (!isset($members[$member_id])) {
                        $arrIDList[] = $member_id;
                        $blnResort = true;
                    }
                }
                if ($blnResort) {
                    $members = $this->pdh->aget('member', 'name', 0, array($this->pdh->sort($arrIDList, 'member', 'name', 'asc')));
                }
            }
        } else {
            $item['date'] = $this->time->time;
        }
        $arrAutocomplete = array();
        foreach ($this->pdh->get('item', 'id_list') as $intItemID) {
            $arrAutocomplete[] = array('label' => $this->pdh->get('item', 'name', array($intItemID)) . ', ' . $this->pdh->geth('item', 'date', array($intItemID)) . ($this->config->get('enable_points') ? ', ' . runden($this->pdh->get('item', 'value', array($intItemID))) . ' ' . $this->config->get('dkp_name') : '') . ' (#' . $intItemID . ')', 'ivalue' => runden($this->pdh->get('item', 'value', array($intItemID))), 'game_id' => $this->pdh->get('item', 'game_itemid', array($intItemID)), 'iname' => $this->pdh->get('item', 'name', array($intItemID)), 'itempool' => $this->pdh->get('item', 'itempool_id', array($intItemID)));
        }
        $this->jquery->AutocompleteMultiple("name", $arrAutocomplete, '
			$("#item_value").val(ui.item.ivalue);
			$("#item_id").val(ui.item.game_id);
			$("#name").val(ui.item.iname);
			$("#itempool_id").val(ui.item.itempool);
			event.preventDefault();
		');
        $item_names = $this->pdh->aget('item', 'name', 0, array($this->pdh->get('item', 'id_list')));
        $this->confirm_delete($this->user->lang('confirm_delete_item') . "<br />" . (isset($item['name']) ? $item['name'] : ''), '', true);
        $this->tpl->assign_vars(array('GRP_KEY' => isset($grp_key) && !$copy ? $grp_key : '', 'NAME' => isset($item['name']) ? $item['name'] : '', 'RAID' => new hdropdown('raid_id', array('options' => $raids, 'value' => isset($item['raid_id']) ? $item['raid_id'] : '')), 'BUYERS' => $this->jquery->MultiSelect('buyers', $members, isset($item['buyers']) ? $item['buyers'] : '', array('width' => 350, 'filter' => true)), 'DATE' => $this->jquery->Calendar('date', $this->time->user_date($item['date'], true, false, false, function_exists('date_create_from_format')), '', array('timepicker' => true)), 'VALUE' => isset($item['value']) ? $item['value'] : '', 'ITEM_ID' => isset($item['item_id']) ? $item['item_id'] : '', 'ITEMPOOLS' => new hdropdown('itempool_id', array('options' => $itempools, 'value' => isset($item['itempool_id']) ? $item['itempool_id'] : ''))));
        $this->core->set_vars(array('page_title' => $this->user->lang('manitems_title'), 'template_file' => 'admin/manage_items_edit.html', 'display' => true));
    }
 public function createSignature($intCharID, $arrSignatureData, $strFilename)
 {
     //Background
     $strBackground = $this->root_path . $arrSignatureData['background'];
     //Create Background Image
     $strExtension = strtolower(pathinfo($strBackground, PATHINFO_EXTENSION));
     switch ($strExtension) {
         case "jpg":
             $img = imagecreatefromjpeg($strBackground);
             break;
         case "gif":
             $img = imagecreatefromgif($strBackground);
             break;
         case "png":
             $img = imagecreatefrompng($strBackground);
             break;
     }
     //Colors:
     $fontColor = $this->hex2rgb($arrSignatureData['font_color']);
     $fontColorRes = ImageColorAllocate($img, $fontColor[0], $fontColor[1], $fontColor[2]);
     //Margin
     $intMargin = 4;
     $marginRechtsLinks = 10;
     $intImageMargin = 10;
     //Charicon
     register('game');
     $arrPresets = $this->pdh->get_preset($arrSignatureData['picture_preset']);
     $subArray = array('%member_id%' => $intCharID);
     $strCharicon = $this->pdh->get($arrPresets[0], $arrPresets[1], $arrPresets[2], $subArray);
     if (substr($strCharicon, 0, strlen($this->server_path)) === $this->server_path) {
         $strCharicon = $this->root_path . substr($strCharicon, strlen($this->server_path));
     }
     if (strlen($strCharicon)) {
         $strChariconExtension = strtolower(pathinfo($strCharicon, PATHINFO_EXTENSION));
         switch ($strChariconExtension) {
             case "jpg":
                 $charicon = imagecreatefromjpeg($strCharicon);
                 break;
             case "gif":
                 $charicon = imagecreatefromgif($strCharicon);
                 break;
             case "png":
                 $charicon = imagecreatefrompng($strCharicon);
                 break;
         }
         // Set a maximum height and width
         $charicon_width = 48;
         $charicon_height = 48;
         // Get new dimensions
         list($width_orig, $height_orig) = getimagesize($strCharicon);
         $ratio_orig = $width_orig / $height_orig;
         if ($charicon_width / $charicon_height > $ratio_orig) {
             $charicon_width = $charicon_height * $ratio_orig;
         } else {
             $charicon_height = $charicon_width / $ratio_orig;
         }
         // Resample
         $intImageMargin = 70;
         imagefilledrectangle($img, $marginRechtsLinks, $intMargin, $charicon_width + $marginRechtsLinks + 1, $charicon_height + $intMargin + 1, $fontColorRes);
         imagecopyresampled($img, $charicon, $marginRechtsLinks + 1, $intMargin + 1, 0, 0, $charicon_width, $charicon_height, $width_orig, $height_orig);
     }
     //Load Font
     $font = $this->root_path . $arrSignatureData['font'];
     $strokeColor = $this->hex2rgb($arrSignatureData['font_border_color']);
     $strokeColorRes = imagecolorallocate($img, $strokeColor[0], $strokeColor[1], $strokeColor[2]);
     $intStrokeWidth = (int) $arrSignatureData['font_border_size'];
     $arrTitle = $arrSubtitle = $arrRight = $arrLeft = array();
     //Title
     if (isset($arrSignatureData['title'])) {
         foreach ($arrSignatureData['title'] as $key => $arrData) {
             $myPreset = $arrData[0];
             $intShowLabel = $arrData[1];
             $myStrPos = strpos($myPreset, '_mdkp');
             if ($myStrPos !== false) {
                 $realPreset = substr($myPreset, 0, $myStrPos);
                 $dkp_id = substr($myPreset, $myStrPos + 5);
                 $arrPresets = $this->pdh->get_preset($realPreset);
                 $subArray = array('%dkp_id%' => $dkp_id, '%member_id%' => $intCharID, '%with_twink%' => !intval($this->config->get('show_twinks')));
                 $value = $this->pdh->get($arrPresets[0], $arrPresets[1], $arrPresets[2], $subArray);
                 if (in_array($realPreset, array('first_item', 'last_item', 'first_raid', 'last_raid'))) {
                     $value = $this->pdh->geth($arrPresets[0], $arrPresets[1], $arrPresets[2], $subArray);
                 }
                 $strDKPName = $this->pdh->get('multidkp', 'name', array($dkp_id));
                 $strPresetname = $this->pdh->get_caption($arrPresets[0], $arrPresets[1], $this->pdh->post_process_preset($arrPresets[3], $subArray)) . ' [' . $strDKPName . ']';
                 if (is_float($value)) {
                     $value = runden($value);
                 }
             } else {
                 $arrPresets = $this->pdh->get_preset($myPreset);
                 $subArray = array('%member_id%' => $intCharID, '%with_twink%' => !intval($this->config->get('show_twinks')));
                 if ($arrPresets[0] == 'member' && $arrPresets[1] == 'profile_field') {
                     $arrPresets[2][] = true;
                     $value = $this->pdh->geth($arrPresets[0], $arrPresets[1], $arrPresets[2], $subArray);
                 } else {
                     $value = $this->pdh->geth($arrPresets[0], $arrPresets[1], $arrPresets[2], $subArray);
                 }
                 $value = trim(strip_tags($value));
                 $strPresetname = $this->pdh->get_caption($arrPresets[0], $arrPresets[1], $this->pdh->post_process_preset($arrPresets[3], $subArray));
             }
             $arrTitle[] = $intShowLabel ? $strPresetname . ' ' . $value : $value;
         }
     }
     $strTitle = implode(', ', $arrTitle);
     $this->imagettfstroketext($img, 20, 0, $intImageMargin, 26, $fontColorRes, $strokeColorRes, $font, $strTitle, $intStrokeWidth);
     //Subtitle
     if (isset($arrSignatureData['subtitle'])) {
         foreach ($arrSignatureData['subtitle'] as $key => $arrData) {
             $myPreset = $arrData[0];
             $intShowLabel = $arrData[1];
             $myStrPos = strpos($myPreset, '_mdkp');
             if ($myStrPos !== false) {
                 $realPreset = substr($myPreset, 0, $myStrPos);
                 $dkp_id = substr($myPreset, $myStrPos + 5);
                 $arrPresets = $this->pdh->get_preset($realPreset);
                 $subArray = array('%dkp_id%' => $dkp_id, '%member_id%' => $intCharID, '%with_twink%' => !intval($this->config->get('show_twinks')));
                 $value = $this->pdh->get($arrPresets[0], $arrPresets[1], $arrPresets[2], $subArray);
                 if (in_array($realPreset, array('first_item', 'last_item', 'first_raid', 'last_raid'))) {
                     $value = $this->pdh->geth($arrPresets[0], $arrPresets[1], $arrPresets[2], $subArray);
                 }
                 $strDKPName = $this->pdh->get('multidkp', 'name', array($dkp_id));
                 $strPresetname = $this->pdh->get_caption($arrPresets[0], $arrPresets[1], $this->pdh->post_process_preset($arrPresets[3], $subArray)) . ' [' . $strDKPName . ']';
                 if (is_float($value)) {
                     $value = runden($value);
                 }
             } else {
                 $arrPresets = $this->pdh->get_preset($myPreset);
                 $subArray = array('%member_id%' => $intCharID, '%with_twink%' => !intval($this->config->get('show_twinks')));
                 if ($arrPresets[0] == 'member' && $arrPresets[1] == 'profile_field') {
                     $arrPresets[2][] = true;
                     $value = $this->pdh->geth($arrPresets[0], $arrPresets[1], $arrPresets[2], $subArray);
                 } else {
                     $value = $this->pdh->geth($arrPresets[0], $arrPresets[1], $arrPresets[2], $subArray);
                 }
                 $value = trim(strip_tags($value));
                 $strPresetname = $this->pdh->get_caption($arrPresets[0], $arrPresets[1], $this->pdh->post_process_preset($arrPresets[3], $subArray));
             }
             $arrSubtitle[] = $intShowLabel ? $strPresetname . ' ' . $value : $value;
         }
     }
     $strSubtitle = implode(', ', $arrSubtitle);
     $this->imagettfstroketext($img, 12, 0, $intImageMargin, 50, $fontColorRes, $strokeColorRes, $font, $strSubtitle, $intStrokeWidth);
     //Left
     if (isset($arrSignatureData['left'])) {
         foreach ($arrSignatureData['left'] as $key => $arrData) {
             $myPreset = $arrData[0];
             $intShowLabel = $arrData[1];
             if ($myPreset == '-') {
                 continue;
             }
             $myStrPos = strpos($myPreset, '_mdkp');
             if ($myStrPos !== false) {
                 $realPreset = substr($myPreset, 0, $myStrPos);
                 $dkp_id = substr($myPreset, $myStrPos + 5);
                 $arrPresets = $this->pdh->get_preset($realPreset);
                 $subArray = array('%dkp_id%' => $dkp_id, '%member_id%' => $intCharID, '%with_twink%' => !intval($this->config->get('show_twinks')));
                 $value = $this->pdh->get($arrPresets[0], $arrPresets[1], $arrPresets[2], $subArray);
                 if (in_array($realPreset, array('first_item', 'last_item', 'first_raid', 'last_raid'))) {
                     $value = $this->pdh->geth($arrPresets[0], $arrPresets[1], $arrPresets[2], $subArray);
                 }
                 $strDKPName = $this->pdh->get('multidkp', 'name', array($dkp_id));
                 $strPresetname = $this->pdh->get_caption($arrPresets[0], $arrPresets[1], $this->pdh->post_process_preset($arrPresets[3], $subArray)) . ' [' . $strDKPName . ']';
                 if (is_float($value)) {
                     $value = runden($value);
                 }
             } else {
                 $arrPresets = $this->pdh->get_preset($myPreset);
                 $subArray = array('%member_id%' => $intCharID, '%with_twink%' => !intval($this->config->get('show_twinks')));
                 if ($arrPresets[0] == 'member' && $arrPresets[1] == 'profile_field') {
                     $arrPresets[2][] = true;
                     $value = $this->pdh->geth($arrPresets[0], $arrPresets[1], $arrPresets[2], $subArray);
                 } else {
                     $value = $this->pdh->geth($arrPresets[0], $arrPresets[1], $arrPresets[2], $subArray);
                 }
                 $value = trim(strip_tags($value));
                 $strPresetname = $this->pdh->get_caption($arrPresets[0], $arrPresets[1], $this->pdh->post_process_preset($arrPresets[3], $subArray));
             }
             $value = $intShowLabel ? $strPresetname . ': ' . $value : $value;
             $this->imagettfstroketext($img, 11, 0, $marginRechtsLinks, 52 + 15 * ($key + 1), $fontColorRes, $strokeColorRes, $font, $value, $intStrokeWidth);
         }
     }
     //Right
     if (isset($arrSignatureData['right'])) {
         foreach ($arrSignatureData['right'] as $key => $arrData) {
             if ($myPreset == '-') {
                 continue;
             }
             $myPreset = $arrData[0];
             $intShowLabel = $arrData[1];
             $myStrPos = strpos($myPreset, '_mdkp');
             if ($myStrPos !== false) {
                 $realPreset = substr($myPreset, 0, $myStrPos);
                 $dkp_id = substr($myPreset, $myStrPos + 5);
                 $arrPresets = $this->pdh->get_preset($realPreset);
                 $subArray = array('%dkp_id%' => $dkp_id, '%member_id%' => $intCharID, '%with_twink%' => !intval($this->config->get('show_twinks')));
                 $value = $this->pdh->get($arrPresets[0], $arrPresets[1], $arrPresets[2], $subArray);
                 if (in_array($realPreset, array('first_item', 'last_item', 'first_raid', 'last_raid'))) {
                     $value = $this->pdh->geth($arrPresets[0], $arrPresets[1], $arrPresets[2], $subArray);
                 }
                 $strDKPName = $this->pdh->get('multidkp', 'name', array($dkp_id));
                 if (is_float($value)) {
                     $value = runden($value);
                 }
                 $strPresetname = $this->pdh->get_caption($arrPresets[0], $arrPresets[1], $this->pdh->post_process_preset($arrPresets[3], $subArray)) . ' [' . $strDKPName . ']';
             } else {
                 $arrPresets = $this->pdh->get_preset($myPreset);
                 $subArray = array('%member_id%' => $intCharID, '%with_twink%' => !intval($this->config->get('show_twinks')));
                 if ($arrPresets[0] == 'member' && $arrPresets[1] == 'profile_field') {
                     $arrPresets[2][] = true;
                     $value = $this->pdh->geth($arrPresets[0], $arrPresets[1], $arrPresets[2], $subArray);
                 } else {
                     $value = $this->pdh->geth($arrPresets[0], $arrPresets[1], $arrPresets[2], $subArray);
                 }
                 $value = trim(strip_tags($value));
                 $strPresetname = $this->pdh->get_caption($arrPresets[0], $arrPresets[1], $this->pdh->post_process_preset($arrPresets[3], $subArray));
             }
             $value = $intShowLabel ? $strPresetname . ': ' . $value : $value;
             $dimensions = imagettfbbox(11, 0, $font, $value);
             $textWidth = abs($dimensions[4] - $dimensions[0]);
             $x = imagesx($img) - $textWidth;
             $this->imagettfstroketext($img, 11, 0, $x - $marginRechtsLinks, 5 + 15 * ($key + 1), $fontColorRes, $strokeColorRes, $font, $value, $intStrokeWidth);
         }
     }
     //URL
     $strURL = str_replace(array('http://', 'https://'), '', $this->env->buildlink());
     $dimensions = imagettfbbox(7, 0, $font, $strURL);
     $textWidth = abs($dimensions[4] - $dimensions[0]);
     $x = imagesx($img) - $textWidth;
     $y = imagesy($img);
     imagettftext($img, 7, 0, $x - $marginRechtsLinks, $y - $intMargin, $fontColorRes, $font, $strURL);
     //Save that thing
     $strFolder = $this->pfh->FolderPath('sigs', 'signatures');
     imagejpeg($img, $strFolder . $strFilename, 100);
     return $strFolder . $strFilename;
 }
 public function recalc($first = false)
 {
     $ignore = $this->get_attendance_raids(true);
     foreach ($this->raids as $key => $raid) {
         if (!in_array($key, $ignore)) {
             $this->diff = $raid['diff'];
             // if there are raids per boss, only get bosskills for those raids
             if ($first) {
                 if (!($this->config('raidcount') & 2) || $this->config('raidcount') & 2 && count($this->raids[$key]['bosskills']) == 1) {
                     $this->raids[$key]['bosskills'] = $this->get_bosskills($raid['begin'], $raid['end']);
                 }
                 $this->raids[$key]['event'] = $this->get_event($key);
                 $this->raids[$key]['value'] = runden($this->get_value($key, false));
             }
             $this->raids[$key]['note'] = isset($this->data['add']) && $key == $this->data['add']['standby_raid'] ? $this->config('standby_raidnote') : $this->get_note($key);
         }
     }
 }
 public function load_members()
 {
     $globalattraids = $this->raid->get_attendance_raids();
     $one_attendant = false;
     foreach ($_POST['members'] as $k => $mem) {
         if (!(is_array($this->members) and in_array($k, array_keys($this->members)))) {
             $this->members[$k] = array();
         }
         foreach ($this->members as $key => &$member) {
             if ($k == $key) {
                 if (isset($mem['delete']) and $mem['delete']) {
                     unset($this->members[$key]);
                     continue;
                 }
                 $member['name'] = $this->in->get('members:' . $key . ':name', '');
                 if ($this->config('member_display') == 2) {
                     $times = array();
                     foreach ($mem['times'] as $tk => $time) {
                         $times[$tk]['join'] = $this->in->get('members:' . $key . ':times:' . $tk . ':join', 0);
                         $times[$tk]['leave'] = $this->in->get('members:' . $key . ':times:' . $tk . ':leave', 0);
                         $extra = $this->in->get('members:' . $key . ':times:' . $tk . ':extra', '');
                         if ($extra) {
                             $times[$tk][$extra] = 1;
                         }
                     }
                     $member['times'] = $times;
                     $member['raid_list'] = $this->raid->get_memberraids($member['times']);
                     $a = $this->raid->get_attendance($member['times']);
                     $member['att_begin'] = $a['begin'];
                     $member['att_end'] = $a['end'];
                     unset($a);
                 } else {
                     $member['raid_list'] = $this->in->getArray('members:' . $key . ':raid_list', 'int');
                     $member['att_begin'] = isset($mem['att_begin']) ? true : false;
                     $member['att_end'] = isset($mem['att_end']) ? true : false;
                 }
                 if ($member['raid_list']) {
                     foreach ($member['raid_list'] as $raid_id) {
                         $one_attendant = true;
                         if (!$this->config('attendance_raid') or $raid_id != $globalattraids['begin'] and $raid_id != $globalattraids['end']) {
                             $dkp = $this->raid->get_value($raid_id, $member['times'], array($member['att_begin'], $member['att_end']));
                             $dkp = runden($dkp);
                             $raid = $this->raid->get($raid_id);
                             if ($dkp < $raid['value']) {
                                 //add an adjustment
                                 $dkp -= $raid['value'];
                                 $akey = $this->adj->check_adj_exists($member['name'], $this->user->lang('rli_partial_raid'), $raid_id);
                                 if ($akey !== false) {
                                     $this->adj->update($akey, array('value' => $dkp));
                                 } else {
                                     $this->adj->add($this->user->lang('rli_partial_raid'), $member['name'], $dkp, $raid['event'], $raid['begin'], $raid_id);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if (!$one_attendant) {
         $this->rli->error('process_members', $this->user->lang('rli_error_no_attendant'));
     }
 }
示例#18
0
 public function get_html_value($event_id)
 {
     return runden($this->events[$event_id]['value']);
 }
示例#19
0
 public function get_html_value($adj_id, $dkp_id = 0)
 {
     return '<span class="' . color_item($this->get_value($adj_id, $dkp_id)) . '">' . runden($this->get_value($adj_id, $dkp_id)) . '</span>';
 }
示例#20
0
 public function display_raid()
 {
     infotooltip_js();
     $raid_id = $this->in->get('r', 0);
     if ($raid_id) {
         if (!in_array($raid_id, $this->pdh->get('raid', 'id_list'))) {
             message_die($this->user->lang('error_invalid_raid_provided'));
         }
         // Attendees
         $attendees_ids = $this->pdh->get('raid', 'raid_attendees', array($raid_id));
         $attendee_copy = $attendees = array();
         foreach ($attendees_ids as $attendee_id) {
             $attendees[$attendee_id] = sanitize($this->pdh->get('member', 'name', array($attendee_id)));
         }
         $attendee_copy = $attendees;
         // Get each attendee's rank
         foreach ($attendees as $attendee_id => $attendee_name) {
             $ranks[$attendee_name] = array('prefix' => $this->pdh->get('rank', 'prefix', array($this->pdh->get('member', 'rankid', array($attendee_id)))), 'suffix' => $this->pdh->get('rank', 'suffix', array($this->pdh->get('member', 'rankid', array($attendee_id)))));
         }
         if (count($attendees) > 0) {
             // First get rid of duplicates and resort them just in case,
             // so we're sure they're displayed correctly
             $attendees = array_unique($attendees);
             sort($attendees);
             reset($attendees);
             $rows = ceil(sizeof($attendees) / $this->user->style['attendees_columns']);
             // First loop: iterate through the rows
             // Second loop: iterate through the columns as defined in template_config,
             // then "add" an array to $block_vars that contains the column definitions,
             // then assign the block vars.
             // Prevents one column from being assigned and the rest of the columns for
             // that row being blank
             for ($i = 0; $i < $rows; $i++) {
                 $block_vars = array();
                 for ($j = 0; $j < $this->user->style['attendees_columns']; $j++) {
                     $offset = $i + $rows * $j;
                     $attendee = isset($attendees_ids[$offset]) ? $attendees_ids[$offset] : '';
                     if ($attendee != '') {
                         $block_vars += array('COLUMN' . $j . '_NAME' => $this->pdh->get('member', 'html_memberlink', array($attendee, $this->routing->simpleBuild('character'), '', false, false, true, true)));
                     } else {
                         $block_vars += array('COLUMN' . $j . '_NAME' => '');
                     }
                     // Are we showing this column?
                     $s_column = 's_column' . $j;
                     ${$s_column} = true;
                 }
                 $this->tpl->assign_block_vars('attendees_row', $block_vars);
             }
             $column_width = floor(100 / $this->user->style['attendees_columns']);
         } else {
             message_die('Could not get raid attendee information.', 'Critical Error');
         }
         // Drops
         $loot_dist = array();
         $items = $this->pdh->get('item', 'itemsofraid', array($raid_id));
         $chartcolorsLootdisti = array();
         foreach ($items as $item_id) {
             $buyer_id = (int) $this->pdh->get('item', 'buyer', array($item_id));
             $class_name = $this->pdh->get('member', 'classname', array($buyer_id));
             $class_id = (int) $this->pdh->get('member', 'classid', array($buyer_id));
             if (isset($loot_dist[$class_id])) {
                 $loot_dist[$class_id]['value']++;
             } else {
                 $loot_dist[$class_id] = array('value' => 1, 'name' => $class_name);
                 $tmp_classcolor = $this->game->get_class_color($class_id);
                 $chartcolorsLootdisti[$class_id] = $tmp_classcolor != '' ? $tmp_classcolor : 'gray';
             }
             $this->tpl->assign_block_vars('items_row', array('BUYER' => $this->pdh->get('member', 'html_memberlink', array($buyer_id, $this->routing->simpleBuild('character'), '', false, false, true, true)), 'ITEM' => $this->pdh->get('item', 'link_itt', array($item_id, $this->routing->simpleBuild('items'), '', false, false, false, false, false, true)), 'VALUE' => runden($this->pdh->get('item', 'value', array($item_id)))));
         }
         ksort($loot_dist);
         ksort($chartcolorsLootdisti);
         // Class distribution
         $class_dist = array();
         $total_attendee_count = sizeof($attendee_copy);
         foreach ($attendee_copy as $member_id => $member_name) {
             $member_class = $this->pdh->get('member', 'classname', array($member_id));
             $member_class_id = $this->pdh->get('member', 'classid', array($member_id));
             if ($member_name != '') {
                 $html_prefix = isset($ranks[$member_name]) ? $ranks[$member_name]['prefix'] : '';
                 $html_suffix = isset($ranks[$member_name]) ? $ranks[$member_name]['suffix'] : '';
                 if (isset($class_dist[$member_class_id]['names']) && isset($class_dist[$member_class_id]['count'])) {
                     $class_dist[$member_class_id]['names'] .= ", " . $html_prefix . $member_name . $html_suffix;
                     $class_dist[$member_class_id]['count']++;
                 } else {
                     $class_dist[$member_class_id] = array('names' => $html_prefix . $member_name . $html_suffix, 'count' => 1);
                 }
             }
         }
         unset($ranks);
         #Class distribution
         $chartarray = array();
         $chartcolors = array();
         foreach ($class_dist as $class_id => $details) {
             $percentage = $total_attendee_count > 0 ? round($details['count'] / $total_attendee_count * 100) : 0;
             $class = $this->game->get_name('primary', $class_id);
             $chartarray[] = array('value' => $percentage, 'name' => ($class ? $class : $this->user->lang('unknown')) . " (" . $class_dist[$class_id]['count'] . " - " . $percentage . "%)");
             $chartcolors[] = strlen($this->game->get_class_color($class_id)) ? $this->game->get_class_color($class_id) : "gray";
             $this->tpl->assign_block_vars('class_row', array('CLASS' => $this->game->decorate('primary', $class_id) . ' <span class="class_' . $class_id . '">' . ($class_id > 0 ? $class : $this->user->lang('unknown')) . '</span>', 'BAR' => $this->jquery->progressbar('bar_' . md5($class), $percentage, array('text' => '%percentage%')), 'ATTENDEES' => $class_dist[$class_id]['names']));
         }
         $chartoptions = array('border' => '0.0', 'piemargin' => 2, 'datalabels' => true, 'legend' => true, 'background' => 'rgba(255, 255, 255, 0.1)');
         $chartoptionsLootDistri = $chartoptions;
         if ($this->game->get_class_color(1) != '') {
             $chartoptions['color_array'] = $chartcolors;
             $chartoptionsLootDistri['color_array'] = $chartcolorsLootdisti;
         }
         unset($eq_classes);
         $vpre = $this->pdh->pre_process_preset('rvalue', array(), 0);
         $vpre[2][0] = $raid_id;
         //Items
         $arrItemListSettings = array('name' => 'hptt_viewmember_itemlist', 'table_main_sub' => '%item_id%', 'table_subs' => array('%item_id%', '%link_url%', '%link_url_suffix%', '%raid_link_url%', '%raid_link_url_suffix%', '%itt_lang%', '%itt_direct%', '%onlyicon%', '%noicon%'), 'page_ref' => 'viewcharacter.php', 'show_numbers' => false, 'show_select_boxes' => false, 'show_detail_twink' => false, 'table_sort_col' => 0, 'table_sort_dir' => 'asc', 'table_presets' => array(array('name' => 'ibuyerlink', 'sort' => true, 'th_add' => '', 'td_add' => ''), array('name' => 'ilink_itt', 'sort' => true, 'th_add' => '', 'td_add' => 'style="height:21px;"'), array('name' => 'ipoolname', 'sort' => true, 'th_add' => '', 'td_add' => ''), array('name' => 'idroprate', 'sort' => true, 'th_add' => '', 'td_add' => '')));
         if (!$this->config->get('disable_points')) {
             $arrItemListSettings['table_presets'][] = array('name' => 'ivalue', 'sort' => true, 'th_add' => '', 'td_add' => '');
         }
         $hptt_page_settings = $arrItemListSettings;
         $hptt = $this->get_hptt($hptt_page_settings, $items, $items, array('%link_url%' => $this->routing->simpleBuild('items'), '%link_url_suffix%' => '', '%itt_lang%' => false, '%itt_direct%' => 0, '%onlyicon%' => 0, '%noicon%' => 0, '%raid_link_url%' => $this->routing->simpleBuild('raids'), '%raid_link_url_suffix%' => '', '%use_controller%' => true, '%member_link_url_suffix%' => '', '%member_link_url%' => $this->routing->simpleBuild('character')), 'raid_' . $this->url_id, 'isort');
         $hptt->setPageRef($this->strPath);
         $this->tpl->assign_vars(array('ITEM_OUT' => $hptt->get_html_table($this->in->get('isort'), '', null, false, sprintf($this->user->lang('viewitem_footcount'), count($items)))));
         //Adjustments
         if (!$this->config->get('disable_points')) {
             $arrAdjListSettings = array('name' => 'hptt_viewmember_adjlist', 'table_main_sub' => '%adjustment_id%', 'table_subs' => array('%adjustment_id%', '%raid_link_url%', '%raid_link_url_suffix%'), 'page_ref' => 'viewcharacter.php', 'show_numbers' => false, 'show_select_boxes' => false, 'show_detail_twink' => false, 'table_sort_col' => 0, 'table_sort_dir' => 'desc', 'table_presets' => array(array('name' => 'adj_reason', 'sort' => true, 'th_add' => '', 'td_add' => ''), array('name' => 'adj_members', 'sort' => true, 'th_add' => 'width="70%"', 'td_add' => ''), array('name' => 'adj_value', 'sort' => true, 'th_add' => '', 'td_add' => 'nowrap="nowrap"')));
             $arrAdjustments = $this->pdh->get('adjustment', 'adjsofraid', array($raid_id, true));
             $hptt_page_settings = $arrAdjListSettings;
             $hptt = $this->get_hptt($hptt_page_settings, $arrAdjustments, $arrAdjustments, array('%raid_link_url%' => $this->routing->simpleBuild('raids'), '%raid_link_url_suffix%' => '', '%use_controller%' => true), 'raid_' . $this->url_id, 'asort');
             $hptt->setPageRef($this->strPath);
             $this->tpl->assign_vars(array('ADJUSTMENT_OUT' => $hptt->get_html_table($this->in->get('asort', ''), ''), 'S_ADJUSTMENTS' => count($arrAdjustments)));
         }
         $this->tpl->assign_vars(array('L_MEMBERS_PRESENT_AT' => sprintf($this->user->lang('members_present_at'), $this->time->user_date($this->pdh->get('raid', 'date', array($raid_id)), false, false, true), $this->time->user_date($this->pdh->get('raid', 'date', array($raid_id)), false, true)), 'EVENT_ICON' => $this->game->decorate('events', $this->pdh->get('raid', 'event', array($raid_id)), array(), 40), 'EVENT_NAME' => stripslashes($this->pdh->get('raid', 'event_name', array($raid_id))), 'S_COLUMN0' => isset($s_column0) ? true : false, 'S_COLUMN1' => isset($s_column1) ? true : false, 'S_COLUMN2' => isset($s_column2) ? true : false, 'S_COLUMN3' => isset($s_column3) ? true : false, 'S_COLUMN4' => isset($s_column4) ? true : false, 'S_COLUMN5' => isset($s_column5) ? true : false, 'S_COLUMN6' => isset($s_column6) ? true : false, 'S_COLUMN7' => isset($s_column7) ? true : false, 'S_COLUMN8' => isset($s_column8) ? true : false, 'S_COLUMN9' => isset($s_column9) ? true : false, 'COLUMN_WIDTH' => isset($column_width) ? $column_width : 0, 'COLSPAN' => $this->user->style['attendees_columns'], 'RAID_ADDED_BY' => $this->pdh->get('raid', 'added_by', array($raid_id)) != '' ? stripslashes($this->pdh->get('raid', 'added_by', array($raid_id))) : 'N/A', 'RAID_UPDATED_BY' => $this->pdh->get('raid', 'updated_by', array($raid_id)) != '' ? stripslashes($this->pdh->get('raid', 'updated_by', array($raid_id))) : 'N/A', 'S_RAID_UPDATED' => strlen($this->pdh->get('raid', 'updated_by', array($raid_id))), 'RAID_NOTE' => $this->pdh->get('raid', 'note', array($raid_id)) != '' ? sanitize($this->pdh->get('raid', 'note', array($raid_id))) : '&nbsp;', 'DKP_NAME' => $this->config->get('dkp_name'), 'RAID_VALUE' => $this->pdh->geth($vpre[0], $vpre[1], $vpre[2]), 'ATTENDEES_FOOTCOUNT' => sprintf($this->user->lang('viewraid_attendees_footcount'), sizeof($attendees)), 'ITEM_FOOTCOUNT' => sprintf($this->user->lang('viewitem_footcount'), sizeof($items)), 'CLASS_PERCENT_CHART' => $this->jquery->charts('pie', 'class_dist', $chartarray, $chartoptions), 'LOOT_PERCENT_CHART' => count($loot_dist) > 0 ? $this->jquery->charts('pie', 'loot_dist', $loot_dist, $chartoptionsLootDistri) : '', 'RAID_DATE' => $this->time->user_date($this->pdh->get('raid', 'date', array($raid_id)), true, false, true), 'U_RAIDLIST' => $this->routing->build('raids'), 'RAID_ID' => $raid_id, 'S_ADDITIONAL_DATA' => strlen($this->pdh->get('raid', 'additional_data', array($raid_id))) ? true : false, 'RAID_ADDITIONAL_DATA' => $this->pdh->geth('raid', 'additional_data', array($raid_id)), 'S_PERM_RAID_ADMIN' => $this->user->check_auth('a_raid_upd', false)));
         if ($this->user->check_auth('a_raid_upd', false)) {
             $this->jquery->dialog('editRaid', $this->user->lang('raidevent_raid_edit'), array('url' => $this->server_path . "admin/manage_raids.php" . $this->SID . "&r=" . $raid_id . "&upd=true&simple_head=simple", 'width' => 920, 'height' => 740, 'onclose' => $this->env->link . $this->controller_path_plain . $this->page_path . $this->SID));
         }
         chartooltip_js();
         $this->set_vars(array('page_title' => $this->pdh->get('raid', 'event_name', array($raid_id)) . ', ' . $this->time->user_date($this->pdh->get('raid', 'date', array($raid_id))), 'template_file' => 'viewraid.html', 'display' => true));
     } else {
         redirect($this->routing->build('raids', false, false, true, true));
     }
 }