예제 #1
0
파일: wws.php 프로젝트: rlf/raidattendance
 function refetch(&$list)
 {
     global $db, $error, $success, $config;
     if (!$config['raidattendance_wws_guild_id']) {
         $error[] = get_text('NO_WWS_CONFIGURED');
     }
     $url = 'http://www.worldoflogs.com/feeds/guilds/' . $config['raidattendance_wws_guild_id'] . '/raids/?t=xml';
     $old_err = set_error_handler('url_error_handler');
     $data = file_get_contents($url, false);
     set_error_handler($old_err);
     $parser = xml_parser_create('UTF-8');
     xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, false);
     xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
     xml_set_element_handler($parser, array($this, 'start_elem'), array($this, 'end_elem'));
     $this->raids = $list;
     $this->raiders = array();
     $raider_db = new raider_db();
     $this->raiders = array();
     $raider_db->get_raider_list($this->raiders);
     xml_parse($parser, $data);
     xml_parser_free($parser);
     return $this->raids;
 }
예제 #2
0
 }
 $user->add_lang(array('mods/mod_raidattendance', 'mods/info_acp_raidattendance', 'mods/logs_raidattendance'));
 $success = array();
 $error = array();
 $tstamp = request_var('tstamp', 0);
 #$tnow = $user->time_now;
 date_default_timezone_set("Etc/UTC");
 $tnow = time();
 $tnow += 60 * 60 * $config['raidattendance_timezone'];
 $tstamp = $tstamp > 0 ? $tstamp : $tnow;
 $now = strftime('%H:%M', $tnow);
 $today = strftime('%Y%m%d', $tnow);
 $raid_time = $config['raidattendance_raid_time'];
 $signoff_time = $config['raidattendance_raid_late'];
 $raids = get_raiding_days($tstamp, $raid_id);
 $raider_db = new raider_db();
 $raiders = array();
 $raider_db->get_raider_list($raiders, $raid_id, $sort_order);
 $action = request_var('u_action', '');
 if ($action) {
     handle_action($action, $raiders);
 }
 $day_names = get_raiding_day_names($raids);
 $attendance = get_attendance($raids, $raid_id);
 $static_attendance = get_static_attendance($raids);
 add_static_attendance($raids, $attendance, $static_attendance);
 $rowno = 0;
 $statusses = array(STATUS_ON => 'on', STATUS_OFF => 'off', STATUS_NOSHOW => 'noshow', STATUS_LATE => 'late', STATUS_SUBSTITUTE => 'substitute', 0 => 'future', -1 => 'past', -2 => 'unset', STATUS_LATE_SIGNOFF => 'late_signoff');
 $raid_sums = array();
 $raidData = array();
 // data used in the addon...
예제 #3
0
 function showSync($id, $mode)
 {
     global $db, $user, $auth, $template, $config;
     global $error, $success;
     if (!is_array($error)) {
         $error = array();
     }
     if (!is_array($success)) {
         $success = array();
     }
     $this->tpl_name = 'acp_raidattendance_sync';
     $resync = request_var('resync', '');
     $save = request_var('save', '');
     $delete = request_var('delete', '');
     $raider_db = new raider_db();
     $rows = array();
     $raider_db->get_raider_list($rows, false, '3,1');
     $this->merge_data($rows);
     if ($resync) {
         $this->resync($rows);
     }
     if ($save or $resync) {
         $raider_db->save_raider_list($rows);
     } else {
         if ($delete) {
             $raider_db->delete_checked_raiders($rows);
         }
     }
     $rowno = 0;
     $users = $this->get_user_list();
     $roles = $this->get_raider_role_list();
     $raids = get_raids();
     foreach ($rows as $name => $raider) {
         $raider_raids = $raider->get_raids();
         $template->assign_block_vars('raiders', array('ROWNO' => $rowno + 1, 'ID' => $raider->id, 'NAME' => $raider->name, 'RANK' => $raider->get_rank_name(), 'LEVEL' => $raider->level, 'CLASS' => $user->lang['CLASS_' . $raider->class], 'USER' => $raider->user_id, 'STATUS' => $user->lang['STATUS_' . $raider->get_status()], 'ROW_CLASS' => $rowno % 2 == 0 ? 'even' : 'uneven', 'USER_OPTIONS' => $this->get_user_options($users, $raider->name, $raider->user_id), 'ROLE_OPTIONS' => $this->get_raider_role_options($roles, $raider), 'CHECKED' => $raider->is_checked() ? ' checked' : '', 'CSS_CLASS' => 'class_' . $raider->class));
         foreach ($raids as $ix => $raid) {
             $in_raid = in_array($raid['id'], $raider_raids);
             $template->assign_block_vars('raiders.raids', array('DEBUG' => implode(':', $raider_raids) . '[' . $in_raid . ']', 'ID' => $raid['id'], 'S_IN_RAID' => $in_raid, 'CHECKED' => $in_raid ? ' checked' : ''));
             if ($in_raid) {
                 $raid['sum'] = (isset($raid['sum']) ? $raid['sum'] : 0) + 1;
             }
         }
         $rowno++;
     }
     foreach ($raids as $raid) {
         $template->assign_block_vars('raids', array('ID' => $raid['id'], 'SUM' => $raid['sum'], 'NAME' => $raid['name']));
     }
     $dummyraider = new raider(array('class' => CLASS_DRUID, 'role' => ROLE_UNASSIGNED));
     $template->assign_vars(array('L_TITLE' => $user->lang['ACP_RAIDATTENDANCE_SYNC'], 'L_TITLE_EXPLAIN' => $user->lang['ACP_RAIDATTENDANCE_SYNC_EXPLAIN'], 'S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br/>', $error), 'S_SUCCESS' => sizeof($success) ? true : false, 'SUCCESS_MSG' => implode('<br/>', $success), 'U_ACTION' => $this->u_action, 'OPTIONS_NEW_RANK' => $this->get_rank_options(), 'OPTIONS_NEW_CLASS' => $this->get_class_options(), 'OPTIONS_NEW_ROLE' => $this->get_raider_role_options($roles, $dummyraider), 'OPTIONS_NEW_USER' => $this->get_user_options($users, '')));
 }