コード例 #1
0
    foreach ($raids as $raid) {
        $tm = strptime($raid, '%Y%m%d');
        $time = tm2time($tm);
        $future = $raid > $today || $raid == $today && strcmp($now, $raid_time) < 0;
        $date = sprintf($user->lang['DAY_MONTH'], post_num(strftime('%e', $time)), strftime('%b', $time));
        $template->assign_block_vars('raid_days', array('RAID' => $raid, 'DATE' => $date, 'DAY' => strftime('%a', $time), 'SUM_NOSHOW' => $raid_sums[$raid][STATUS_NOSHOW], 'SUM_OFF' => $raid_sums[$raid][STATUS_OFF], 'SUM_ON' => $num_raiders - $raid_sums[$raid][STATUS_NOSHOW] - $raid_sums[$raid][STATUS_OFF], 'S_FUTURE' => $future, 'RAID_DATA' => get_raid_data_as_string($raidData[$raid]), 'S_CANCELLED' => $attendance['__RAID__'][$raid]['status'] == STATUS_CANCELLED ? 1 : 0, 'S_FIRST_DAY_IN_WEEK' => $raid_day_number % $num_days == 0, 'S_NEXT_RAID' => $last_future != $future || strcmp($raid, $today) == 0));
        $raid_day_number++;
        $last_future = $future;
    }
    $mode = request_var('mode', 'normal');
    $is_admin = $auth->acl_get('m_') or $auth->acl_get('a_');
    $is_moderator = $is_admin && $mode == 'admin';
    $num_cols = 7 + sizeof($raids);
    $dir_sort = array(1 => $col_sort[0] == 1 ? ' v' : ($col_sort[0] == -1 ? ' ^' : ''), 2 => $col_sort[0] == 2 ? ' v' : ($col_sort[0] == -2 ? ' ^' : ''), 3 => $col_sort[0] == 3 ? ' v' : ($col_sort[0] == -3 ? ' ^' : ''), 4 => $col_sort[0] == 4 ? ' v' : ($col_sort[0] == -4 ? ' ^' : ''), 7 => $col_sort[0] == 7 ? ' v' : ($col_sort[0] == -7 ? ' ^' : ''));
    $template->assign_vars(array('NUM_COLS' => $num_cols, 'NUM_COLS_LEGEND' => $num_cols - 2, 'NUM_COLS_ACTION' => 2, 'S_RAIDATTENDANCE' => true, 'S_SUCCESS' => sizeof($success) ? true : false, 'SUCCESS_MSG' => implode('<br/>', $success), 'S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br/>', $error), 'S_MODERATOR' => $is_moderator, 'TSTAMP_NEXT' => $next_week, 'TSTAMP_PREV' => $last_week, 'MODE' => $mode, 'S_ADMIN' => $is_admin, 'MOD_VERSION' => $config['raidattendance_version'], 'RAID_ID' => $raid_id, 'SORT_ORDER' => $sort_order, 'DIR_NAME' => $dir_sort[1], 'SORT_NAME' => $dir_sort[1] == ' v' ? '-1,2,3' : '1,2,3', 'DIR_ROLE' => $dir_sort[2], 'SORT_ROLE' => $dir_sort[2] == ' v' ? '-2,4,3,1' : '2,4,3,1', 'DIR_RANK' => $dir_sort[3], 'SORT_RANK' => $dir_sort[3] == ' v' ? '-3,2,4,1' : '3,2,4,1', 'DIR_CLASS' => $dir_sort[4], 'SORT_CLASS' => $dir_sort[4] == ' v' ? '-4,2,1' : '4,2,1', 'DIR_AVAILABILITY' => $dir_sort[7], 'SORT_AVAILABILITY' => $dir_sort[7] == ' v' ? '-7,1,2,3' : '7,1,2,3', 'DUMP_START' => $dump_start, 'DUMP_END' => $dump_end, 'DUMP_MONTHS' => $dump_months, 'DEFAULT_COMMENT' => $user->lang['DEFAULT_COMMENT_' . rand(1, $user->lang['NUM_DEFAULT_COMMENTS'])]));
    $raids = get_raids();
    foreach ($raids as $raid) {
        $template->assign_block_vars('raids', array('ID' => $raid['id'], 'SELECTED' => $raid['id'] == $raid_id, 'NAME' => $raid['name']));
    }
}
/**
 * Enables sorting on the availability column
 **/
class summary_sort
{
    /**
     * Argument 1 - Array containing raider-name => array('summary_n') columns.
     * Argument 2 - Direction, if negative, it's ascending, otherwise it's descending.
     **/
    function summary_sort($sum_array, $direction)
    {
コード例 #2
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, '')));
 }