Пример #1
0
function GetQuestInfo(&$data, $dataflag = QUEST_DATAFLAG_MINIMUM)
{
    global $DB, $quest_class, $quest_faction_reward;
    // Локализация
    if ($dataflag & QUEST_DATAFLAG_LOCALE && $_SESSION['locale'] > 0) {
        $loc = $_SESSION['locale'];
        $row = $DB->selectRow('
				SELECT
					Title_loc?d AS Title_loc,
					Details_loc?d AS Details_loc,
					Objectives_loc?d AS Objectives_loc,
					OfferRewardText_loc?d AS OfferRewardText_loc,
					RequestItemsText_loc?d AS RequresItemsText_loc,
					EndText_loc?d AS EndText_loc,
					ObjectiveText1_loc?d AS ObjectiveText1_loc,
					ObjectiveText2_loc?d AS ObjectiveText2_loc,
					ObjectiveText3_loc?d AS ObjectiveText3_loc,
					ObjectiveText4_loc?d AS ObjectiveText4_loc
				FROM locales_quest
				WHERE Id = ?d
				LIMIT 1
			', $loc, $loc, $loc, $loc, $loc, $loc, $loc, $loc, $loc, $loc, $data['entry']);
        if ($row) {
            $data = @array_merge($data, $row);
        }
    }
    // Минимальные данные
    // ID квеста
    $data['Id'] = $data['Id'];
    // Имя квеста
    $data['Title'] = GetQuestTitle($data);
    // Описания
    if ($dataflag & QUEST_DATAFLAG_STRINGS) {
        GetQuestStrings($data);
    }
    // Свойства
    if ($dataflag & QUEST_DATAFLAG_PROPS) {
        // Уровень квеста
        $data['Level'] = $data['Level'];
        // Требуемый уровень квеста
        $data['MinLevel'] = $data['MinLevel'];
        // Доступен расам
        $data['side'] = races($data['RequiredRaces']);
        // Флаги
        $data['Flags'] = $data['Flags'];
        // Ежедневный квест?
        if ($data['Flags'] & QUEST_FLAGS_DAILY) {
            $data['Daily'] = true;
        }
        // Тип квеста
        $data['type'] = $data['Type'];
        global $quest_type;
        if (isset($quest_type[$data['type']])) {
            $data['typename'] = $quest_type[$data['type']];
        } else {
            $data['typename'] = $data['type'];
        }
        // Путь к этому разделу (главная категория)
        foreach ($quest_class as $i => $class) {
            if (in_array($data['ZoneOrSort'], $class)) {
                $data['maincat'] = $i;
                break;
            }
        }
        // Категория 1
        $data['category'] = $data['ZoneOrSort'];
        // Категория 2 ???
        $data['category2'] = $data['Flags'];
        // Требуемое пати
        if ($data['SuggestedPlayers'] > 1) {
            $data['splayers'] = $data['SuggestedPlayers'];
        }
        // Лимит времени
        if ($data['LimitTime'] > 0) {
            $data['LimitTime'] = sec_to_time($data['LimitTime']);
        } else {
            unset($data['LimitTime']);
        }
        if ($data['Flags'] & QUEST_FLAGS_SHARABLE) {
            $data['Sharable'] = true;
        }
        if ($data['SpecialFlags'] & QUEST_SPECIALFLAGS_REPEATABLE) {
            $data['Repeatable'] = true;
        }
        if ($data['RewardTitleId'] > 0) {
            $data['titlereward'] = $DB->selectCell('SELECT name_loc' . $_SESSION['locale'] . ' FROM ?_char_titles WHERE id=?d LIMIT 1', $data['RewardTitleId']);
        }
    }
    // Награды и задания
    if ($dataflag & QUEST_DATAFLAG_REWARDS) {
        // Опыт/деньги@70
        $data['xp'] = GetQuestXpOrMoney($data);
        // Награды вещей
        for ($j = 0; $j <= 6; ++$j) {
            if ($data['RewardChoiceItemId' . $j] != 0 and $data['RewardChoiceItemCount' . $j] != 0) {
                $data['itemchoices'][] = @array_merge(allitemsinfo($data['RewardChoiceItemId' . $j], 0), array('count' => $data['RewardChoiceItemCount' . $j]));
            }
        }
        for ($j = 0; $j <= 4; ++$j) {
            if ($data['RewardItemId' . $j] != 0 and $data['RewardItemCount' . $j] != 0) {
                $data['itemrewards'][] = @array_merge(allitemsinfo($data['RewardItemId' . $j], 0), array('count' => $data['RewardItemCount' . $j]));
            }
        }
        // Вознаграждение репутацией
        for ($j = 1; $j <= 5; $j++) {
            if ($data['RewardFactionValueId' . $j] != 0) {
                $value = $data['RewardFactionValueId' . $j];
                $id = $data['RewardFactionId' . $j];
                if (!$value && isset($quest_faction_reward[$id])) {
                    $value = $quest_faction_reward[$id];
                }
                if ($value) {
                    $data['reprewards'][] = @array_merge(factioninfo($data['RewardFactionValueId' . $j]), array('value' => $value));
                }
            }
        }
        // Вознаграждение деньгами
        if ($data['RewardOrRequiredMoney'] > 0) {
            $data['money'] = money2coins($data['RewardOrRequiredMoney']);
        } elseif ($data['RewardOrRequiredMoney'] < 0) {
            $data['moneyreq'] = money2coins(-$data['RewardOrRequiredMoney']);
        }
        if ($data['RewardMoneyMaxLevel']) {
            $data['moneymaxlevel'] = money2coins($data['RewardMoneyMaxLevel']);
        }
    }
    // Последовательность квестов, требования, цепочки
    if ($dataflag & QUEST_DATAFLAG_SERIES) {
        // не используется для вычисления самих сериесов, исключительно для внесения соответствующих полей в массив информации
    }
    // Все ОК. Это не обязательный return, но в некоторых функциях нужен.
    return $data;
}
Пример #2
0
echo '<li><a class="clock inactive" href="index.php?c=' . $i . '">+</a></li>';
echo '</ul>';
echo '</div>';
echo '<div class="container">';
echo '<div class="stats">';
echo '<div class="b">';
echo '<label>start <span>' . ($c['start'] == '0000-00-00 00:00:00' ? null : strftime("%a %d %b", strtotime($c['start']))) . '</span></label>';
echo '<input type="text" readonly="readonly" style="margin-right:10px;" class="block start help" title="..." value="' . ($c['start'] == '0000-00-00 00:00:00' ? null : strftime("%H:%M:%S", strtotime($c['start']))) . '" />';
echo '</div>';
echo '<div class="b">';
echo '<label>end <span>' . ($c['end'] == '0000-00-00 00:00:00' ? null : strftime("%a %d %b", strtotime($c['end']))) . '</span></label>';
echo '<input type="text" readonly="readonly" class="block end help" title="..." value="' . ($c['end'] == '0000-00-00 00:00:00' ? null : strftime("%H:%M:%S", strtotime($c['end']))) . '" />';
echo '</div>';
echo '<div class="b">';
echo '<label>duration</label>';
echo '<input type="text" readonly="readonly" style="margin-right:10px;" class="block diff' . ($c['status'] != 1 ? ' ' : ' active') . '" value="' . sec_to_time($c['elapsed']) . '" />';
echo '</div>';
echo '<div class="b">';
echo '<label>decimal</label>';
echo '<input type="text" readonly="readonly" class="block dec' . ($c['status'] != 1 || empty($printable_decimal_time) ? ' ' : ' active') . '" value="' . printable_decimal_time($c['elapsed']) . '" />';
echo '</div>';
echo '</div>';
echo '<form method="get" id="change">';
echo '<input type="hidden" name="c" value="' . $current . '" />';
echo '<input type="text" name="desc" class="desc help" id="desc" value="' . $c['desc'] . '" title="a descriptive name." maxlength="12" /><br />';
echo '<input type="submit" class="btn" name="action" value="update"' . ($c['status'] == 1 ? ' disabled="disabled"' : null) . ' />';
echo '<input type="submit" class="btn" name="action" value="reset"' . ($c['status'] == 1 ? ' disabled="disabled"' : null) . ' /> ';
if ($c['start'] != '0000-00-00 00:00:00' && $c['end'] != '0000-00-00 00:00:00' && $c['status'] == 0) {
    echo '<input class="btn big" type="submit" name="action" value="continue" />';
} else {
    echo '<input class="btn big' . ($sw == 'pause' ? ' hot' : null) . '" type="submit" name="action" value="' . $sw . '" />';
Пример #3
0
 function get_daily_program_report($date)
 {
     $sql = "select * from tb_kategori_daily_program order by id";
     $result = $this->db->query($sql)->result();
     foreach ($result as $key => $value) {
         $sql_child = "select d.*, ff.id as id_ff, ff.id_daily_program, ff.callsign, CONCAT_WS(' ',k.kode, jl.kode) as excercise, ff.freq, k.warna, TIME_TO_SEC(TIMEDIFF(d.time_end, d.time_start))/60 as selisih, \r\n                (TIME_TO_SEC(TIMEDIFF(d.time_start, '00:00:00'))/60)-(TIME_TO_SEC(TIMEDIFF((select awal from tb_daily_time where tanggal = '" . $date . "'), '00:00:00'))/60) as start \r\n                from tb_daily_program d\r\n                left join tb_flight_formasi ff on (ff.id_daily_program = d.id)\r\n                left join tb_kode_latihan k on (ff.id_kode_latihan = k.id)\r\n                left join tb_jenis_latihan jl on (ff.id_jenis_latihan = jl.id)\r\n                where d.id_kategori = '" . $value->id . "' \r\n                    and d.tanggal = '" . $date . "' ORDER BY d.time_start";
         //echo $sql_child."<br/>";
         $child = $this->db->query($sql_child)->result();
         $result[$key]->program = $child;
         foreach ($child as $key2 => $value2) {
             $sql_child2 = "select c.id, pf.kode_dragon, pf.nama as nama_fs, p.kode_tail, c.jam_ops_total,\r\n                    TIME_TO_SEC(c.jam_ops_total) as total_sec, pf.id as id_penerbang_fs, pb.id as id_penerbang_bs,\r\n                    pb.kode_dragon as kd_dragon_bs, pb.nama as nama_bs, pf.kode_nrp as nrp_front, pb.kode_nrp as nrp_back\r\n                    from tb_configuration c\r\n                    join tb_pesawat p on (c.id_pesawat = p.id)\r\n                    join tb_penerbang pf on (c.id_penerbang_fs = pf.id)\r\n                    left join tb_penerbang pb on (c.id_penerbang_bs = pb.id)\r\n                    where c.id_flight_formasi = '" . $value2->id_ff . "'\r\n                    ";
             $child2 = $this->db->query($sql_child2)->result();
             $result[$key]->program[$key2]->program = $child2;
             foreach ($child2 as $key3 => $value3) {
                 $sql_child3a = "select warna, total_resiko from tb_hurt \r\n                        where id_configuration = '" . $value3->id . "' \r\n                            and id_penerbang = '" . $value3->id_penerbang_fs . "'";
                 $child3a = $this->db->query($sql_child3a)->result();
                 $result[$key]->program[$key2]->program[$key3]->hurt_fs = $child3a;
                 $sql_child3b = "select warna, total_resiko from tb_hurt \r\n                        where id_configuration = '" . $value3->id . "' \r\n                            and id_penerbang = '" . $value3->id_penerbang_bs . "'";
                 $child3b = $this->db->query($sql_child3b)->result();
                 $result[$key]->program[$key2]->program[$key3]->hurt_bs = $child3b;
                 // CEK BENTROK PENERBANG
                 $sql_child3c = "select count(*) as jumlah_bentrok \r\n                        from tb_configuration c\r\n                        join tb_flight_formasi ff on (c.id_flight_formasi = ff.id)\r\n                        join tb_daily_program dp on (ff.id_daily_program = dp.id)\r\n                        where c.id_penerbang_fs = '" . $value3->id_penerbang_fs . "'\r\n                        and ff.tanggal = '" . $date . "'\r\n                        and dp.id != '" . $value2->id . "'\r\n                        and \r\n                            ('" . $value2->time_start . "' between dp.time_start and dp.time_end\r\n                            or '" . $value2->time_end . "' between dp.time_start and dp.time_end)\r\n                        ";
                 //echo $sql_child3c; die;
                 $child3c = $this->db->query($sql_child3c)->row()->jumlah_bentrok;
                 $result[$key]->program[$key2]->program[$key3]->bentrok_fs = $child3c;
                 $sql_child3d = "select count(*) as jumlah_bentrok \r\n                        from tb_configuration c\r\n                        join tb_flight_formasi ff on (c.id_flight_formasi = ff.id)\r\n                        join tb_daily_program dp on (ff.id_daily_program = dp.id)\r\n                        where c.id_penerbang_bs = '" . $value3->id_penerbang_bs . "'\r\n                        and ff.tanggal = '" . $date . "'\r\n                        and dp.id != '" . $value2->id . "'\r\n                        and \r\n                            ('" . $value2->time_start . "' between dp.time_start and dp.time_end\r\n                            or '" . $value2->time_end . "' between dp.time_start and dp.time_end)\r\n                        ";
                 //echo $sql_child3d; die;
                 $child3d = $this->db->query($sql_child3d)->row()->jumlah_bentrok;
                 $result[$key]->program[$key2]->program[$key3]->bentrok_bs = $child3d;
             }
             $sql_child3 = "select SUM(TIME_TO_SEC(c.jam_ops_total)) as total\r\n                    from tb_configuration c\r\n                    join tb_pesawat p on (c.id_pesawat = p.id)\r\n                    join tb_penerbang pf on (c.id_penerbang_fs = pf.id)\r\n                    left join tb_penerbang pb on (c.id_penerbang_bs = pb.id)\r\n                    where c.id_flight_formasi = '" . $value2->id_ff . "'\r\n                    ";
             $result[$key]->program[$key2]->total_ops = $this->db->query($sql_child3)->row()->total;
             $start = time_to_second($value2->time_start) + 60;
             $sql_child4 = "select count(*) as jumlah\r\n                    from tb_daily_program \r\n                    where '" . time_formation(sec_to_time($start)) . ':00' . "' between time_start and time_end\r\n                    and tanggal = '" . $value2->tanggal . "' \r\n                    and id_kategori = '" . $value->id . "'\r\n                    and id != '" . $value2->id . "' \r\n                    and (time_start < '" . time_formation(sec_to_time($start)) . ':00' . "' or id < '" . $value2->id . "')\r\n                    ";
             $result[$key]->program[$key2]->bentrok = $this->db->query($sql_child4)->row()->jumlah;
         }
     }
     //die(json_encode($result));
     return $result;
 }
Пример #4
0
function event_description($entry)
{
    global $DB;
    $result = event_infoline(array(array('eventEntry' => $entry)));
    if (is_array($result) && count($result) > 0) {
        $result = reset($result);
    } else {
        return NULL;
    }
    $result['period'] = sec_to_time(intval($result['occurence']) * 60);
    $result['npcs_guid'] = $DB->selectCol('SELECT guid FROM game_event_creature WHERE eventEntry=?d OR eventEntry=?d', $entry, -$entry);
    $result['objects_guid'] = $DB->selectCol('SELECT guid FROM game_event_gameobject WHERE eventEntry=?d OR eventEntry=?d', $entry, -$entry);
    $result['creatures_quests_id'] = $DB->select('SELECT id AS creature, quest FROM game_event_creature_quest WHERE eventEntry=?d OR eventEntry=?d GROUP BY quest', $entry, -$entry);
    $result['exdesc'] = $DB->selectCell('SELECT name_loc?d FROM aowow_events WHERE id=?d', $_SESSION['locale'], $entry);
    $result['exdescimg'] = $DB->selectCell('SELECT img FROM aowow_events WHERE id=?d', $entry);
    $icon = $DB->selectCell('SELECT icon FROM aowow_events WHERE id=?d', $entry);
    $result['icon'] = '/images/events/' . $icon;
    return $result;
}
Пример #5
0
		', $_SESSION['locale'], $_SESSION['locale'], array(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST), $quest['Id'], $_SESSION['locale']);
    if ($rows) {
        $quest['criteria_of'] = array();
        foreach ($rows as $row) {
            allachievementsinfo2($row['id']);
            $quest['criteria_of'][] = achievementinfo2($row);
        }
    }
    // Награды и благодарности, присылаемые почтой
    if ($quest['RewardMailTemplateId']) {
        if (!($quest['mailrewards'] = loot('mail_loot_template', $quest['RewardMailTemplateId']))) {
            unset($quest['mailrewards']);
        }
    }
    if ($quest['RewardMailDelay']) {
        $quest['maildelay'] = sec_to_time($quest['RewardMailDelay']);
    }
    save_cache(QUEST_PAGE, $cache_key, $quest);
}
global $page;
$page = array('Mapper' => false, 'Book' => false, 'Title' => $quest['Title'] . ' - ' . $smarty->get_config_vars('Quests'), 'tab' => 0, 'type' => 5, 'typeid' => $quest['Id'], 'username' => $_SESSION['username'], 'path' => path(0, 5));
$smarty->assign('page', $page);
// Комментарии
$smarty->assign('comments', getcomments($page['type'], $page['typeid']));
$smarty->assign('screenshots', getscreenshots($page['type'], $page['typeid']));
$smarty->assign('reputation', getreputation($page['username']));
// Данные о квесте
$smarty->assign('quest', $quest);
// Количество MySQL запросов
$smarty->assign('mysql', $DB->getStatistics());
// Загружаем страницу
        ?>
</td>
                    <td align="center"><?php 
        echo time_formation(sec_to_time(abs($ttl_bulan)));
        ?>
</td>
                    <td align="center"><?php 
        echo $start_pm_thn < 0 ? '-' : '';
        ?>
</td>
                    <td align="center"><?php 
        echo time_formation(sec_to_time(abs($start_pm_thn)));
        ?>
</td>
                    <td align="center"><?php 
        echo time_formation(sec_to_time(abs($ttl_thn_yll)));
        ?>
</td>
                    <td align="center"><?php 
        echo $value['sorties'];
        ?>
</td>
                    <td align="center"><?php 
        echo $sorties;
        ?>
</td>
                    <td align="center"><?php 
        echo $ttl_ytll;
        ?>
</td>
                </tr>
Пример #7
0
 public function home_user()
 {
     // We are gathering the data for the insert
     $location = $this->session->userdata('logged_in');
     $messages = '';
     if ($this->input->post('calcvalues') != NULL) {
         $clerk = $this->input->post('calcvalues');
         $action = $this->input->post('action');
         $date = date('Y-m-d');
         $time = date('H:i:s');
         $clerk_id = $this->load_file->get_data_extend_where('clerk', 'clerk_id, clerk_name', 'secret_no =' . $clerk);
         // Check if the clerk exists or not
         if ($clerk_id != NULL) {
             $temp = array('locations' => $location['name']);
             $location_id = $this->load_file->get_data_extend_where('locations', 'location_id', $temp);
             // we get the time margins for the clock in and out of this particular clerk
             $temp = $this->load_file->get_clerks($clerk_id[0]['clerk_id']);
             $time_in_margin = $temp[0]['in_time_margin'];
             $time_out_margin = $temp[0]['out_time_margin'];
             // We check if the database has any data for this clerk at this date
             $check = $this->load_file->get_data_extend_where('clerks_check', 'clerk_id, status, time', 'clerk_id =' . $clerk_id[0]['clerk_id'], $date);
             // we build the array
             $data_for = array('clerk_id' => $clerk_id[0]['clerk_id'], 'location_id' => $location_id[0]['location_id'], 'sign_time' => $time, 'status' => $action, 'date' => $date, 'time' => $time);
             // set defaults for the check in case that they don't exist
             if (!isset($check[0])) {
                 $check[0] = array('clerk_id' => -1, 'status' => 'not set');
             }
             if (!isset($check[1])) {
                 $check[1] = array('clerk_id' => -1, 'status' => 'not set');
             }
             if ($data_for['status'] == 'out' && ($check[0]['status'] == 'out' || $check[0]['status'] == 'not set')) {
                 $messages = '<h4 class="error_msg">You need to clock in first ' . $clerk_id[0]['clerk_name'] . '!</h4>';
                 // with that condition we prevent someone to clock out first
             } else {
                 if ($action == 'in') {
                     ######################################################
                     ##             clock IN condition                   ##
                     ######################################################
                     if ($check[0]['clerk_id'] == $clerk_id[0]['clerk_id'] && $check[0]['status'] == $action) {
                         if ($check[0]['status'] == 'in' && $check[1]['status'] == 'out') {
                             $messages = '<h4 class="error_msg">You have finished your shift for today ' . $clerk_id[0]['clerk_name'] . '!</h4>';
                         } else {
                             $messages = '<h4 class="error_msg">You are already clocked in ' . $clerk_id[0]['clerk_name'] . '!</h4>';
                         }
                     } else {
                         // check the rota first
                         $cond = array('clerk_id' => $clerk_id[0]['clerk_id']);
                         $cond3 = array('status_id' => 1);
                         // Get the rota from the database
                         $time_check = $this->load_file->get_data_extend_where('clerks_list_rota', 'location_id, rota_from, status_id', $cond, $date);
                         // we check if it exists
                         if ($time_check != NULL) {
                             // this is for testing later is gonna be from database
                             $time_margin = '- ' . $time_in_margin . ' minutes';
                             // debug msg
                             echo 'the real time in is: ' . $data_for['sign_time'] . '<br>';
                             // we put the margin to the current time, and we move the time some minutes earlier
                             $data_for['sign_time'] = date('H:i:s', strtotime($time_margin));
                             $clock_in_time = time_to_sec($data_for['sign_time']);
                             $rota_in_time = time_to_sec($time_check[0]['rota_from']);
                             // We check the times to see if we gonna add deductions
                             if ($clock_in_time <= $rota_in_time) {
                                 ##
                                 ## NOTE: You can use this in order to set early clock ins
                                 ##
                                 $messages = $messages . '<br><h4 class="norm_msg">Great! ' . $clerk_id[0]['clerk_name'] . ' are on time! ;) </h4><br>';
                                 $data_for['sign_time'] = '00:00:00';
                             } else {
                                 // debug msg //
                                 echo 'the calculated time in is: ' . $data_for['sign_time'] . '<br>';
                                 // We calculate how many the deductions would be and we put them to the variable for the insert
                                 $deduction = time_filter(sec_to_time(abs($clock_in_time - $rota_in_time)));
                                 $data_for['sign_time'] = $deduction;
                                 $messages = $messages . '<br><h4 class="error_msg">You late for ' . $deduction . ' ' . $clerk_id[0]['clerk_name'] . '!</h4><br>';
                             }
                         } else {
                             $messages = '<h4 class="error_msg">Rota for ' . $clerk_id[0]['clerk_name'] . ' not found!</h4><br>';
                             $data_for['sign_time'] = '00:00:00';
                         }
                         // insert to database
                         $this->load_file->insert_data('clerks_check', $data_for);
                         $data_temp = array('clerk_id' => $clerk_id[0]['clerk_id'], 'location_id' => $location_id[0]['location_id'], 'sign_time' => '00:00:00', 'status' => 'out', 'date' => $date, 'time' => '00:00:00');
                         $this->load_file->insert_data('clerks_check', $data_temp);
                         $messages = $messages . '<h4 class="norm_msg">You clocked in Successfuly ' . $clerk_id[0]['clerk_name'] . '!</h4>';
                     }
                 } else {
                     ######################################################
                     ##             clock OUT condition                  ##
                     ######################################################
                     if ($check[1]['clerk_id'] == $clerk_id[0]['clerk_id'] && $check[1]['status'] == $action && $check[1]['time'] != '00:00:00') {
                         if ($check[0]['status'] == 'in' && $check[1]['status'] == 'out') {
                             $messages = '<h4 class="error_msg">You have finished your shift for today ' . $clerk_id[0]['clerk_name'] . '!</h4>';
                         } else {
                             $messages = '<h4 class="error_msg">You are already clocked out ' . $clerk_id[0]['clerk_name'] . '!</h4>';
                         }
                     } else {
                         // check the rota first
                         $cond = array('clerk_id' => $clerk_id[0]['clerk_id']);
                         $cond3 = array('status_id' => 1);
                         // Get the rota from the database
                         $time_check = $this->load_file->get_data_extend_where('clerks_list_rota', 'location_id, rota_to, status_id', $cond, $date);
                         // we check if it exists
                         if ($time_check != NULL) {
                             // this is for testing later is gonna be from database
                             $time_margin = '+ ' . $time_in_margin . ' minutes';
                             // debug msg
                             echo 'the real time in is: ' . $data_for['sign_time'] . '<br>';
                             // we put the margin to the current time, and we move the time some minutes earlier
                             $data_for['sign_time'] = date('H:i:s', strtotime($time_margin));
                             $clock_out_time = time_to_sec($data_for['sign_time']);
                             $rota_out_time = time_to_sec($time_check[0]['rota_to']);
                             // debug msg //
                             echo 'the calculated time in is: ' . $data_for['sign_time'] . '<br>';
                             echo $clock_out_time . ' clock out time in sec <br>';
                             echo $rota_out_time . ' rota out time in sec <br>';
                             // We check the times to see if we gonna add overtime or not
                             if ($clock_out_time <= $rota_out_time) {
                                 $data_for['sign_time'] = '00:00:00';
                                 ##
                                 ## NOTE: You can use this in order to set early clock outs
                                 ##
                                 //$messages = $messages . '<br> Great! ' . $clerk_id[0]['clerk_name'] . ' are on time! ;) <br>';
                             } else {
                                 $overtime = time_filter(sec_to_time(abs($rota_out_time - $clock_out_time)));
                                 $data_for['sign_time'] = $overtime;
                                 $messages = $messages . '<br><h4 class="norm_msg">Your overtime is: ' . $overtime . ' ' . $clerk_id[0]['clerk_name'] . '!</h4><br>';
                             }
                         } else {
                             $messages = '<h4 class="error_msg">Rota for ' . $clerk_id[0]['clerk_name'] . ' not found!</h4><br>';
                             $data_for['sign_time'] = '00:00:00';
                         }
                         // insert to database
                         $field = array('clerk_id' => $clerk_id[0]['clerk_id'], 'date' => $date, 'status' => 'out');
                         $this->load_file->update_data('clerks_check', $data_for, $field);
                         $messages = $messages . '<h4 class="norm_msg">You clocked out Successfuly ' . $clerk_id[0]['clerk_name'] . '!</h4>';
                     }
                 }
             }
         } else {
             // In case that the clerk doesn't exist
             $messages = "<h4 class='error_msg'>This Clerk doesn't exist!</h4>";
         }
     }
     // Get the data for this week selected rota
     // Get the week dates
     $week_start = date('z', strtotime('this week'));
     $week_end = date('z', strtotime('next week'));
     for ($i = $week_start; $i < $week_end; $i++) {
         $date_this[] = date('D d M', strtotime("January 1st +" . $i . " days"));
     }
     //query the database
     $this_week = $this->load_file->get_clerks_date('*', date('Y-m-d', strtotime($date_this[0])), date('Y-m-d', strtotime($date_this[6])), $location['id']);
     // Prepare data for the form
     $data = array('name' => $location['name'], 'message_display' => $messages, 'rota' => $this_week, 'dates' => $date_this, 'property' => '');
     // Load the view as a result and check if the user is logged in
     if ($this->login_database->is_logged()) {
         $this->load->view('user_page', $data);
     } else {
         $this->load->view('login_form', $data);
     }
 }
Пример #8
0
function transform_point($at, $point)
{
    $result = $point;
    $result['x'] = round(100 - ($point['y'] - $at['y_min']) / (($at['y_max'] - $at['y_min']) / 100), 2);
    $result['y'] = round(100 - ($point['x'] - $at['x_min']) / (($at['x_max'] - $at['x_min']) / 100), 2);
    if (isset($point['spawntimesecs'])) {
        $result['r'] = sec_to_time($point['spawntimesecs']);
    }
    unset($result['spawntimesecs']);
    return $result;
}
Пример #9
0
     $approval[] = form_hidden($value2['id']) . form_checkbox($value2['id'], $value2['approval'], $value2['approval']);
 }
 $this->table->set_heading($dates);
 $this->table->add_row($time);
 $this->table->add_row($real_time);
 $this->table->add_row($approval);
 echo $this->table->generate();
 unset($dates);
 unset($time);
 unset($real_time);
 unset($approval);
 echo '<hr>';
 // DEDUCTIONS SECTION ################################################################
 $this->table->set_caption('Deductions');
 $dates[] = 'Total';
 $time[] = sec_to_time($clerk_list[$key]['total_deductions']);
 $real_time[] = '';
 $approval[] = '';
 foreach ($clerk_list[$key]['deductions'] as $key_over => $value2) {
     $dates[] = date('d-m-Y', strtotime($value2['date']));
     $time[] = $value2['time'];
     $real_time[] = $value2['real_time'];
     $approval[] = form_hidden($value2['id']) . form_checkbox($value2['id'], $value2['approval'], $value2['approval']);
 }
 $this->table->set_heading($dates);
 $this->table->add_row($time);
 $this->table->add_row($real_time);
 $this->table->add_row($approval);
 echo $this->table->generate();
 echo '<br>';
 unset($dates);
        <tr>
            <td colspan="2" align="center"><b>TOTAL</b></td>
            <td align="center"><?php 
echo time_formation($total_rencana);
?>
</td>
            <td align="center"><?php 
echo time_formation(sec_to_time($total_bln_ini));
?>
</td>
            <td align="center"><?php 
echo time_formation(sec_to_time($total_bln_bf));
?>
</td>
            <td align="center"><?php 
echo time_formation(sec_to_time($total_bln));
?>
</td>
            <td align="center"><?php 
echo round2Two($persen_tercapai);
?>
 %</td>
            <td></td>
        </tr>
    </tfoot>
</table>
<table>
    <tr>
        <td colspan="5"></td>
        <td colspan="3" align="center">Komandan Skadron Udara 3</td>
    </tr>
Пример #11
0
 function get_list_jam_logbook($id_penerbang, $bulan)
 {
     $q = NULL;
     if (!empty($bulan) and $bulan !== 'undefined') {
         $bulan = explode('-', $bulan);
         $bln = $bulan[0] . '-' . $bulan[1];
         $q .= " and f.tanggal like ('%{$bln}%')";
     }
     $sql = "select f.*, jl.nama as exercise,\r\n            " . $id_penerbang . " as id_pnbf, pb1.id as id_nrp1, pb1.nama as nrp1, IFNULL(pb2.id, '') as id_nrp2, \r\n            IFNULL(pb2.nama,'') as nrp2, pb1. yll, pb1.dff, pb1.dfd, pb1.nff, pb1.nfd,\r\n            p.nama as pesawat, p.kode_tail, IFNULL(SUBSTR(c.jam_ops_total,1,5),'-') as total\r\n            from tb_configuration c\r\n            join tb_flight_formasi f on (c.id_flight_formasi = f.id)\r\n            join tb_daily_program d on (f.id_daily_program = d.id)\r\n            join tb_pesawat p on (c.id_pesawat = p.id)\r\n            join tb_penerbang pb1 on (c.id_penerbang_fs = pb1.id)\r\n            left join tb_penerbang pb2 on (c.id_penerbang_bs = pb2.id)\r\n            join tb_kode_latihan kl on (f.id_kode_latihan = kl.id)\r\n            join tb_jenis_latihan jl on (f.id_jenis_latihan = jl.id)\r\n            left join tb_rencana_jam_lat_ops rj on (rj.id_kode_latihan = kl.id)\r\n            where (c.id_penerbang_bs = '" . $id_penerbang . "' or c.id_penerbang_fs = '" . $id_penerbang . "')\r\n                and c.jam_ops_total != '00:00:00' and c.jam_ops_total is not NULL\r\n            {$q} order by f.tanggal asc\r\n            ";
     //echo "<pre>".$sql."</pre>"; die;
     $result = $this->db->query($sql)->result();
     foreach ($result as $key => $value) {
         $sql_child = "select IFNULL(SUBSTR(SEC_TO_TIME(SUM(TIME_TO_SEC(c.jam_ops_total))),1,5),'-') as total\r\n            from tb_configuration c\r\n            join tb_flight_formasi f on (c.id_flight_formasi = f.id)\r\n            join tb_daily_program dp on (f.id_daily_program = dp.id)\r\n            join tb_pesawat p on (c.id_pesawat = p.id)\r\n            join tb_penerbang pb1 on (c.id_penerbang_fs = pb1.id)\r\n            where f.tanggal = '" . $value->tanggal . "' \r\n                and pb1.id = '" . $value->id_pnbf . "'\r\n                and dp.time_start between '07:00' and '17:00'\r\n                and f.id = '" . $value->id . "'\r\n                ";
         $result[$key]->day_first = $this->db->query($sql_child)->row()->total;
         $sql_child2 = "select IFNULL(SUBSTR(SEC_TO_TIME(SUM(TIME_TO_SEC(c.jam_ops_total))),1,5),'-') as total\r\n            from tb_configuration c\r\n            join tb_flight_formasi f on (c.id_flight_formasi = f.id)\r\n            join tb_daily_program dp on (f.id_daily_program = dp.id)\r\n            join tb_pesawat p on (c.id_pesawat = p.id)\r\n            join tb_penerbang pb1 on (c.id_penerbang_bs = pb1.id)\r\n            where f.tanggal = '" . $value->tanggal . "' \r\n                and pb1.id = '" . $value->id_pnbf . "'\r\n                and dp.time_start between '07:00' and '17:00'\r\n                and f.id = '" . $value->id . "'\r\n                ";
         //echo $sql_child2; die;
         $result[$key]->day_dual = $this->db->query($sql_child2)->row()->total;
         $sql_child3 = "select IFNULL(SUBSTR(SEC_TO_TIME(SUM(TIME_TO_SEC(c.jam_ops_total))),1,5),'-') as total\r\n            from tb_configuration c\r\n            join tb_flight_formasi f on (c.id_flight_formasi = f.id)\r\n            join tb_daily_program dp on (f.id_daily_program = dp.id)\r\n            join tb_pesawat p on (c.id_pesawat = p.id)\r\n            join tb_penerbang pb1 on (c.id_penerbang_fs = pb1.id)\r\n            where f.tanggal = '" . $value->tanggal . "' \r\n                and pb1.id = '" . $value->id_pnbf . "'\r\n                and (dp.time_start between '17:00' and '24:00' or dp.time_start between '00:01' and '05:00')\r\n                and f.id = '" . $value->id . "'\r\n                ";
         $result[$key]->night_first = $this->db->query($sql_child3)->row()->total;
         $sql_child4 = "select IFNULL(SUBSTR(SEC_TO_TIME(SUM(TIME_TO_SEC(c.jam_ops_total))),1,5),'-') as total\r\n            from tb_configuration c\r\n            join tb_flight_formasi f on (c.id_flight_formasi = f.id)\r\n            join tb_daily_program dp on (f.id_daily_program = dp.id)\r\n            join tb_pesawat p on (c.id_pesawat = p.id)\r\n            join tb_penerbang pb1 on (c.id_penerbang_bs = pb1.id)\r\n            where f.tanggal = '" . $value->tanggal . "' \r\n                and pb1.id = '" . $value->id_pnbf . "'\r\n                and (dp.time_start between '17:00' and '24:00' or dp.time_start between '00:01' and '05:00')\r\n                and f.id = '" . $value->id . "'\r\n                ";
         $result[$key]->night_dual = $this->db->query($sql_child4)->row()->total;
         /*TOTAL ALL AS FIRST PILOT*/
         $sql_child5 = "select IFNULL(SUBSTR(SEC_TO_TIME(SUM(TIME_TO_SEC(c.jam_ops_total))),1,5),'-') as total\r\n            from tb_configuration c\r\n            join tb_flight_formasi f on (c.id_flight_formasi = f.id)\r\n            join tb_daily_program dp on (f.id_daily_program = dp.id)\r\n            join tb_pesawat p on (c.id_pesawat = p.id)\r\n            join tb_penerbang pb1 on (c.id_penerbang_fs = pb1.id)\r\n            where f.tanggal = '" . $value->tanggal . "' \r\n                and pb1.id = '" . $value->id_pnbf . "'\r\n                and f.id = '" . $value->id . "'\r\n                ";
         $result[$key]->all_first = $this->db->query($sql_child5)->row()->total;
         $sql_child6 = "select IFNULL(SUBSTR(SEC_TO_TIME(SUM(TIME_TO_SEC(c.inst_sim))),1,5),'00:00') as total\r\n            from tb_configuration c\r\n            join tb_flight_formasi f on (c.id_flight_formasi = f.id)\r\n            join tb_jenis_latihan jl on (f.id_jenis_latihan = jl.id)\r\n            join tb_daily_program dp on (f.id_daily_program = dp.id)\r\n            join tb_pesawat p on (c.id_pesawat = p.id)\r\n            join tb_penerbang pb1 on (c.id_penerbang_fs = pb1.id)\r\n            where f.tanggal = '" . $value->tanggal . "' \r\n                and pb1.id = '" . $value->id_pnbf . "'\r\n                and f.id = '" . $value->id . "'\r\n                ";
         $result[$key]->instrumen_sim = $this->db->query($sql_child6)->row()->total;
         $sql_child6a = "select IFNULL(SUBSTR(SEC_TO_TIME(SUM(TIME_TO_SEC(c.inst_act))),1,5),'00:00') as total\r\n            from tb_configuration c\r\n            join tb_flight_formasi f on (c.id_flight_formasi = f.id)\r\n            join tb_jenis_latihan jl on (f.id_jenis_latihan = jl.id)\r\n            join tb_daily_program dp on (f.id_daily_program = dp.id)\r\n            join tb_pesawat p on (c.id_pesawat = p.id)\r\n            join tb_penerbang pb1 on (c.id_penerbang_fs = pb1.id)\r\n            where f.tanggal = '" . $value->tanggal . "' \r\n                and pb1.id = '" . $value->id_pnbf . "'\r\n                and f.id = '" . $value->id . "'\r\n                ";
         $result[$key]->instrumen_act = $this->db->query($sql_child6a)->row()->total;
         // GET Instruktor
         $sql_check_instruktor = "select id_penerbang_inst as id from tb_instruksi_penerbang where id_flight_formasi = '" . $value->id . "'";
         $get_instruktor = $this->db->query($sql_check_instruktor)->row();
         $sql_child7 = "select ip.id_penerbang_inst, IFNULL(concat(floor(SUM(TIME_TO_SEC(ip.jam_ops_total))/3600),':',floor(SUM(TIME_TO_SEC(ip.jam_ops_total ))/60)%60),'00:00') as total\r\n                from tb_instruksi_penerbang ip\r\n                join tb_flight_formasi f on (ip.id_flight_formasi = f.id)\r\n                join tb_daily_program dp on (f.id_daily_program = dp.id)\r\n                join tb_pesawat p on (ip.id_pesawat = p.id)\r\n                where f.tanggal = '" . $value->tanggal . "' \r\n                    and dp.time_start between '07:00' and '17:00'\r\n                    and f.id = '" . $value->id . "'\r\n                    ";
         // backup // and (ip.id_penerbang_inst = '".$value->id_nrp1."' or ip.id_penerbang_inst = '".$value->id_nrp2."')
         $where_instruktor = NULL;
         $result[$key]->instruktor_day = '00:00';
         $result[$key]->id_instruktor_day = $this->db->query($sql_child7 . $where_instruktor)->row()->id_penerbang_inst;
         if (isset($get_instruktor->id) and $get_instruktor->id === $id_penerbang) {
             $where_instruktor = " and ip.id_penerbang_inst = '" . $id_penerbang . "'";
             $result[$key]->instruktor_day = $this->db->query($sql_child7 . $where_instruktor)->row()->total;
         }
         $sql_child8 = "select ip.id_penerbang_inst, IFNULL(concat(floor(SUM(TIME_TO_SEC(ip.jam_ops_total))/3600),':',floor(SUM(TIME_TO_SEC(ip.jam_ops_total ))/60)%60),'00:00') as total\r\n                from tb_instruksi_penerbang ip\r\n                join tb_flight_formasi f on (ip.id_flight_formasi = f.id)\r\n                join tb_daily_program dp on (f.id_daily_program = dp.id)\r\n                join tb_pesawat p on (ip.id_pesawat = p.id)\r\n                where f.tanggal = '" . $value->tanggal . "' \r\n                    and (dp.time_start between '17:00' and '24:00' or dp.time_start between '00:01' and '05:00')\r\n                    and f.id = '" . $value->id . "'\r\n                    and (ip.id_penerbang_inst = '" . $value->id_nrp1 . "' or ip.id_penerbang_inst = '" . $value->id_nrp2 . "')";
         if ($key === 23) {
             //echo $value->tanggal.' '.$sql_child8; die;
         }
         $result[$key]->instruktor_night = '00:00';
         $result[$key]->id_instruktor_night = $this->db->query($sql_child8 . $where_instruktor)->row()->id_penerbang_inst;
         if (isset($get_instruktor->id) and $get_instruktor->id === $id_penerbang) {
             $where_instruktor = " and ip.id_penerbang_inst = '" . $id_penerbang . "'";
             $result[$key]->instruktor_night = $this->db->query($sql_child8 . $where_instruktor)->row()->total;
         }
     }
     $data['data'] = $result;
     /*DETAIL BULAN SEBELUMNYA*/
     $date = explode('-', $bln);
     $lm = mktime(0, 0, 0, $date[1] - 1, date("01"), $date[0]);
     // last month
     $bulan_lalu = date("Y-m-d", $lm);
     $sql_before = "select *, SUM(dff+dfd+nff+nfd) as total\r\n        from tb_logbook_carried_forward\r\n        where bulan = '" . $bulan_lalu . "'\r\n            and id_penerbang = '" . $id_penerbang . "'";
     $dflm = $this->db->query($sql_before)->row();
     $data['day_first_lm'] = sec_to_time($dflm->dff);
     $data['day_dual_lm'] = sec_to_time($dflm->dfd);
     $data['night_first_lm'] = sec_to_time($dflm->nff);
     $data['night_dual_lm'] = sec_to_time($dflm->nfd);
     $data['flight_lm'] = sec_to_time($dflm->total);
     $data['first_lm'] = sec_to_time($dflm->dff + $dflm->nff);
     $sql_before7 = "select IFNULL(concat(floor(TIME_TO_SEC(pb1.inst_sim)/3600),':',floor(TIME_TO_SEC(pb1.inst_sim )/60)%60),'00:00') as inst_sim, \r\n            IFNULL(concat(floor(SUM(TIME_TO_SEC(c.inst_sim))/3600),':',floor(SUM(TIME_TO_SEC(c.inst_sim ))/60)%60),'00:00') as total\r\n        from tb_configuration c\r\n        join tb_flight_formasi f on (c.id_flight_formasi = f.id)\r\n        join tb_jenis_latihan jl on (f.id_jenis_latihan = jl.id)\r\n        join tb_daily_program dp on (f.id_daily_program = dp.id)\r\n        join tb_pesawat p on (c.id_pesawat = p.id)\r\n        join tb_penerbang pb1 on (c.id_penerbang_fs = pb1.id)\r\n        where f.tanggal < '" . $bln . "-01' \r\n            and pb1.id = '" . $id_penerbang . "'\r\n                ";
     //echo $sql_before7;
     $inst_sim = $this->db->query($sql_before7)->row();
     $data['instrumen_lm_sim'] = sec_to_time(detik($inst_sim->total) + detik($inst_sim->inst_sim));
     $sql_before7a = "select IFNULL(concat(floor(TIME_TO_SEC(pb1.inst_act)/3600),':',floor(TIME_TO_SEC(pb1.inst_act )/60)%60),'00:00') as inst_act, IFNULL(concat(floor(SUM(TIME_TO_SEC(c.inst_act))/3600),':',floor(SUM(TIME_TO_SEC(c.inst_act ))/60)%60),'00:00') as total\r\n        from tb_configuration c\r\n        join tb_flight_formasi f on (c.id_flight_formasi = f.id)\r\n        join tb_jenis_latihan jl on (f.id_jenis_latihan = jl.id)\r\n        join tb_daily_program dp on (f.id_daily_program = dp.id)\r\n        join tb_pesawat p on (c.id_pesawat = p.id)\r\n        join tb_penerbang pb1 on (c.id_penerbang_fs = pb1.id)\r\n        where f.tanggal < '" . $bln . "-01' \r\n            and pb1.id = '" . $id_penerbang . "'\r\n                ";
     $inst_act = $this->db->query($sql_before7a)->row();
     $data['instrumen_lm_act'] = sec_to_time(detik($inst_act->total) + detik($inst_act->inst_act));
     $sql_before8 = "select IFNULL(concat(floor(SUM(TIME_TO_SEC(ip.jam_ops_total))/3600),':',floor(SUM(TIME_TO_SEC(ip.jam_ops_total ))/60)%60),'00:00') as total,\r\n            (select instruksi_day from tb_penerbang where id = '" . $id_penerbang . "') as inst_init\r\n        from tb_instruksi_penerbang ip\r\n        join tb_flight_formasi f on (ip.id_flight_formasi = f.id)\r\n        join tb_daily_program dp on (f.id_daily_program = dp.id)\r\n        join tb_pesawat p on (ip.id_pesawat = p.id)\r\n        where f.tanggal < '" . $bln . "-01' \r\n            and dp.time_start between '07:00' and '17:00'\r\n            and ip.id_penerbang_inst = '" . $id_penerbang . "'";
     $inst_day = $this->db->query($sql_before8)->row();
     $data['day_instruktor_lm'] = sec_to_time(detik($inst_day->total) + $inst_day->inst_init);
     $sql_before9 = "select IFNULL(concat(floor(SUM(TIME_TO_SEC(ip.jam_ops_total))/3600),':',floor(SUM(TIME_TO_SEC(ip.jam_ops_total ))/60)%60),'00:00') as total,\r\n            (select instruksi_night from tb_penerbang where id = '" . $id_penerbang . "') as inst_init\r\n        from tb_instruksi_penerbang ip\r\n        join tb_flight_formasi f on (ip.id_flight_formasi = f.id)\r\n        join tb_daily_program dp on (f.id_daily_program = dp.id)\r\n        join tb_pesawat p on (ip.id_pesawat = p.id)\r\n        where f.tanggal < '" . $bln . "-01' \r\n            and (dp.time_start between '17:00' and '24:00' or dp.time_start between '00:01' and '05:00')\r\n            and ip.id_penerbang_inst = '" . $id_penerbang . "'";
     //echo $sql_before9;
     $inst_night = $this->db->query($sql_before9)->row();
     $data['night_instruktor_lm'] = sec_to_time(detik($inst_night->total) + $inst_night->inst_init);
     /*TOTAL LICA*/
     $sql_total = "select IFNULL(concat(floor(SUM(TIME_TO_SEC(c.jam_ops_total))/3600),':',floor(SUM(TIME_TO_SEC(c.jam_ops_total ))/60)%60),'00:00') as total\r\n        from tb_configuration c\r\n        join tb_flight_formasi f on (c.id_flight_formasi = f.id)\r\n        join tb_daily_program dp on (f.id_daily_program = dp.id)\r\n        join tb_pesawat p on (c.id_pesawat = p.id)\r\n        join tb_penerbang pb1 on (c.id_penerbang_fs = pb1.id)\r\n        where f.tanggal <= '" . $bln . "-31' \r\n            and dp.time_start between '07:00' and '17:00'\r\n            and pb1.id = '" . $id_penerbang . "'";
     $data['day_first_total'] = $this->db->query($sql_total)->row()->total;
     $sql_total2 = "select IFNULL(concat(floor(SUM(TIME_TO_SEC(c.jam_ops_total))/3600),':',floor(SUM(TIME_TO_SEC(c.jam_ops_total ))/60)%60),'00:00') as total\r\n        from tb_configuration c\r\n        join tb_flight_formasi f on (c.id_flight_formasi = f.id)\r\n        join tb_daily_program dp on (f.id_daily_program = dp.id)\r\n        join tb_pesawat p on (c.id_pesawat = p.id)\r\n        join tb_penerbang pb1 on (c.id_penerbang_bs = pb1.id)\r\n        where f.tanggal <= '" . $bln . "-31' \r\n            and dp.time_start between '07:00' and '17:00'\r\n            and pb1.id = '" . $id_penerbang . "'";
     $data['day_dual_total'] = $this->db->query($sql_total2)->row()->total;
     $sql_total3 = "select IFNULL(concat(floor(SUM(TIME_TO_SEC(c.jam_ops_total))/3600),':',floor(SUM(TIME_TO_SEC(c.jam_ops_total ))/60)%60),'00:00') as total\r\n        from tb_configuration c\r\n        join tb_flight_formasi f on (c.id_flight_formasi = f.id)\r\n        join tb_daily_program dp on (f.id_daily_program = dp.id)\r\n        join tb_pesawat p on (c.id_pesawat = p.id)\r\n        join tb_penerbang pb1 on (c.id_penerbang_fs = pb1.id)\r\n        where f.tanggal <= '" . $bln . "-31' \r\n            and (dp.time_start between '17:00' and '24:00' or dp.time_start between '00:01' and '05:00')\r\n            and pb1.id = '" . $id_penerbang . "'";
     $data['night_first_total'] = $this->db->query($sql_total3)->row()->total;
     $sql_total4 = "select IFNULL(concat(floor(SUM(TIME_TO_SEC(c.jam_ops_total))/3600),':',floor(SUM(TIME_TO_SEC(c.jam_ops_total ))/60)%60),'00:00') as total\r\n        from tb_configuration c\r\n        join tb_flight_formasi f on (c.id_flight_formasi = f.id)\r\n        join tb_daily_program dp on (f.id_daily_program = dp.id)\r\n        join tb_pesawat p on (c.id_pesawat = p.id)\r\n        join tb_penerbang pb1 on (c.id_penerbang_bs = pb1.id)\r\n        where f.tanggal <= '" . $bln . "-31' \r\n            and (dp.time_start between '17:00' and '24:00' or dp.time_start between '00:01' and '05:00')\r\n            and pb1.id = '" . $id_penerbang . "'";
     $data['night_dual_total'] = $this->db->query($sql_total4)->row()->total;
     $sql_total5 = "select IFNULL(concat(floor(SUM(TIME_TO_SEC(c.jam_ops_total))/3600),':',floor(SUM(TIME_TO_SEC(c.jam_ops_total ))/60)%60),'00:00') as total\r\n        from tb_configuration c\r\n        join tb_flight_formasi f on (c.id_flight_formasi = f.id)\r\n        join tb_daily_program dp on (f.id_daily_program = dp.id)\r\n        join tb_pesawat p on (c.id_pesawat = p.id)\r\n        join tb_penerbang pb1 on (c.id_penerbang_fs = pb1.id)\r\n        left join tb_penerbang pb2 on (c.id_penerbang_bs = pb2.id)\r\n        where f.tanggal <= '" . $bln . "-31' \r\n            and (pb1.id = '" . $id_penerbang . "' or pb2.id = '" . $id_penerbang . "')";
     $data['flight_total'] = $this->db->query($sql_total5)->row()->total;
     $sql_total6 = "select IFNULL(concat(floor(SUM(TIME_TO_SEC(c.jam_ops_total))/3600),':',floor(SUM(TIME_TO_SEC(c.jam_ops_total ))/60)%60),'00:00') as total\r\n        from tb_configuration c\r\n        join tb_flight_formasi f on (c.id_flight_formasi = f.id)\r\n        join tb_daily_program dp on (f.id_daily_program = dp.id)\r\n        join tb_pesawat p on (c.id_pesawat = p.id)\r\n        join tb_penerbang pb1 on (c.id_penerbang_fs = pb1.id)\r\n        where f.tanggal <= '" . $bln . "-31' \r\n            and pb1.id = '" . $id_penerbang . "'";
     $data['first_total'] = $this->db->query($sql_total6)->row()->total;
     $sql_total7 = "select IFNULL(concat(floor(SUM(TIME_TO_SEC(c.inst_sim))/3600),':',floor(SUM(TIME_TO_SEC(c.inst_sim ))/60)%60),'00:00') as total\r\n        from tb_configuration c\r\n        join tb_flight_formasi f on (c.id_flight_formasi = f.id)\r\n        join tb_jenis_latihan jl on (f.id_jenis_latihan = jl.id)\r\n        join tb_daily_program dp on (f.id_daily_program = dp.id)\r\n        join tb_pesawat p on (c.id_pesawat = p.id)\r\n        join tb_penerbang pb1 on (c.id_penerbang_fs = pb1.id)\r\n        where f.tanggal <= '" . $bln . "-31' \r\n            and pb1.id = '" . $id_penerbang . "'\r\n                ";
     $data['instrumen_total_sim'] = $this->db->query($sql_total7)->row()->total;
     $sql_total7a = "select IFNULL(concat(floor(SUM(TIME_TO_SEC(c.inst_act))/3600),':',floor(SUM(TIME_TO_SEC(c.inst_act))/60)%60),'00:00') as total\r\n        from tb_configuration c\r\n        join tb_flight_formasi f on (c.id_flight_formasi = f.id)\r\n        join tb_jenis_latihan jl on (f.id_jenis_latihan = jl.id)\r\n        join tb_daily_program dp on (f.id_daily_program = dp.id)\r\n        join tb_pesawat p on (c.id_pesawat = p.id)\r\n        join tb_penerbang pb1 on (c.id_penerbang_fs = pb1.id)\r\n        where f.tanggal <= '" . $bln . "-31' \r\n            and pb1.id = '" . $id_penerbang . "'\r\n                ";
     $data['instrumen_total_act'] = $this->db->query($sql_total7a)->row()->total;
     $sql_total8 = "select IFNULL(concat(floor(SUM(TIME_TO_SEC(ip.jam_ops_total))/3600),':',floor(SUM(TIME_TO_SEC(ip.jam_ops_total ))/60)%60),'00:00') as total\r\n        from tb_instruksi_penerbang ip\r\n        join tb_flight_formasi f on (ip.id_flight_formasi = f.id)\r\n        join tb_daily_program dp on (f.id_daily_program = dp.id)\r\n        join tb_pesawat p on (ip.id_pesawat = p.id)\r\n        where f.tanggal <= '" . $bln . "-31' \r\n            and dp.time_start between '07:00' and '17:00'\r\n            and ip.id_penerbang_inst = '" . $id_penerbang . "'";
     $data['day_instruktor_total'] = $this->db->query($sql_total8)->row()->total;
     $sql_total9 = "select IFNULL(concat(floor(SUM(TIME_TO_SEC(ip.jam_ops_total))/3600),':',floor(SUM(TIME_TO_SEC(ip.jam_ops_total ))/60)%60),'00:00') as total\r\n        from tb_instruksi_penerbang ip\r\n        join tb_flight_formasi f on (ip.id_flight_formasi = f.id)\r\n        join tb_daily_program dp on (f.id_daily_program = dp.id)\r\n        join tb_pesawat p on (ip.id_pesawat = p.id)\r\n        where f.tanggal <= '" . $bln . "-31' \r\n            and (dp.time_start between '17:00' and '24:00' or dp.time_start between '00:01' and '05:00')\r\n            and ip.id_penerbang_inst = '" . $id_penerbang . "'";
     $data['night_instruktor_total'] = $this->db->query($sql_total9)->row()->total;
     $data['penerbang'] = $this->db->get_where('tb_penerbang', array('id' => $id_penerbang))->row();
     //die(json_encode($data));
     return $data;
 }
Пример #12
0
function event_description($entry)
{
    global $DB;
    $result = event_infoline(array(array('eventEntry' => $entry)));
    if (is_array($result) && count($result) > 0) {
        $result = reset($result);
    } else {
        return NULL;
    }
    $result['period'] = sec_to_time(intval($result['occurence']) * 60);
    $result['npcs_guid'] = $DB->selectCol('SELECT guid FROM game_event_creature WHERE eventEntry=?d OR eventEntry=?d', $entry, -$entry);
    $result['objects_guid'] = $DB->selectCol('SELECT guid FROM game_event_gameobject WHERE eventEntry=?d OR eventEntry=?d', $entry, -$entry);
    $result['creatures_quests_id'] = $DB->select('SELECT id AS creature, quest FROM game_event_creature_quest WHERE eventEntry=?d OR eventEntry=?d GROUP BY quest', $entry, -$entry);
    return $result;
}
    ?>
</td>
            <td align="center"><?php 
    echo time_formation(sec_to_time($value->total_yll));
    ?>
</td>
            <td align="center"><?php 
    echo time_formation(sec_to_time($value->total_jet));
    ?>
</td>
            <td align="center"><?php 
    echo time_formation(sec_to_time($value->total_propeler));
    ?>
</td>
            <td align="center"><?php 
    echo time_formation(sec_to_time($value->total_jet + $value->total_propeler));
    ?>
</td>
            <td><?php 
    echo $value->jabatan;
    ?>
</td>
        </tr>
        <?php 
}
?>
    </tbody>
</table>
<table>
    <tr>
        <td colspan="14"></td>
Пример #14
0
ActiveForm::end();
?>
</div>
<div class="clearfix"></div>
<?php 
echo Highcharts::widget(['options' => ['title' => false, 'xAxis' => ['categories' => ArrayHelper::getColumn($returt->row, function ($element) {
    return date('d.m', strtotime($element['date']));
})], 'yAxis' => ['title' => ['text' => 'Количество']], 'series' => [['name' => 'Визиты', 'data' => ArrayHelper::getColumn($returt->row, function ($element) {
    return (int) $element['visits'];
})], ['name' => 'Просмотры', 'data' => ArrayHelper::getColumn($returt->row, function ($element) {
    return (int) $element['page_views'];
})], ['name' => 'Посетители', 'data' => ArrayHelper::getColumn($returt->row, function ($element) {
    return (int) $element['visitors'];
})], ['name' => 'Новые посетители', 'data' => ArrayHelper::getColumn($returt->row, function ($element) {
    return (int) $element['new_visitors'];
})]]]]);
function sec_to_time($seconds)
{
    $hours = floor($seconds / 3600);
    $minutes = floor($seconds % 3600 / 60);
    $seconds = $seconds % 60;
    return sprintf("%d:%02d:%02d", $hours, $minutes, $seconds);
}
ArrayHelper::multisort($returt->row, 'id', SORT_DESC);
echo GridView::widget(['dataProvider' => new ArrayDataProvider(['allModels' => $returt->row]), 'columns' => [['attribute' => 'date', 'header' => 'Дата', 'value' => function ($model) {
    return strftime('%e %b %Y', strtotime($model['date']));
}], ['attribute' => 'visits', 'header' => 'Визиты<br/><div style="font-size: 12px;font-weight: normal;">Всего: <strong style="float: right;">' . $returt->totals['visits'] . '</strong></div>'], ['attribute' => 'page_views', 'header' => 'Просмотры<br/><div style="font-size: 12px;font-weight: normal;">Всего:<strong style="float: right;">' . $returt->totals['page_views'] . '</strong></div>'], ['attribute' => 'visitors', 'header' => 'Посетители<br/><div style="font-size: 12px;font-weight: normal;">Всего:<strong style="float: right;">' . $returt->totals['visitors'] . '</strong></div>'], ['attribute' => 'new_visitors', 'header' => 'Новые посетители<br/><div style="font-size: 12px;font-weight: normal;">Всего:<strong style="float: right;">' . $returt->totals['new_visitors'] . '</strong></div>'], ['attribute' => 'denial', 'header' => 'Отказы<br/><div style="font-size: 12px;font-weight: normal;">Среднее:<strong style="float: right;">' . (double) str_replace(",", ".", $returt->totals['denial']) * 100 . '%</strong></div>', 'value' => function ($model) {
    return (double) str_replace(",", ".", $model['denial']) * 100 . '%';
}], ['attribute' => 'depth', 'header' => 'Глубина просмотра<br/><div style="font-size: 12px;font-weight: normal;">Среднее:<strong style="float: right;">' . $returt->totals['depth'] . '</strong></div>'], ['attribute' => 'visit_time', 'header' => 'Время на сайте<br/><div style="font-size: 12px;font-weight: normal;">Всего:<strong style="float: right;">' . $returt->totals['visit_time'] . '</strong></div>', 'value' => function ($model) {
    return sec_to_time($model['visit_time']);
}]]]);
Пример #15
0
		', $_SESSION['locale'], $_SESSION['locale'], array(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST), $quest['entry'], $_SESSION['locale']);
    if ($rows) {
        $quest['criteria_of'] = array();
        foreach ($rows as $row) {
            allachievementsinfo2($row['id']);
            $quest['criteria_of'][] = achievementinfo2($row);
        }
    }
    // Награды и благодарности, присылаемые почтой
    if ($quest['RewMailTemplateId']) {
        if (!($quest['mailrewards'] = loot('mail_loot_template', $quest['RewMailTemplateId']))) {
            unset($quest['mailrewards']);
        }
    }
    if ($quest['RewMailDelaySecs']) {
        $quest['maildelay'] = sec_to_time($quest['RewMailDelaySecs']);
    }
    save_cache(QUEST_PAGE, $cache_key, $quest);
}
global $page;
$page = array('Mapper' => false, 'Book' => false, 'Title' => $quest['Title'] . ' - ' . $smarty->get_config_vars('Quests'), 'tab' => 0, 'type' => 5, 'typeid' => $quest['entry'], 'path' => path(0, 5));
$smarty->assign('page', $page);
// Комментарии
$smarty->assign('comments', getcomments($page['type'], $page['typeid']));
$smarty->assign('screenshots', getscreenshots($page['type'], $page['typeid']));
// Данные о квесте
$smarty->assign('quest', $quest);
// Количество MySQL запросов
$smarty->assign('mysql', $DB->getStatistics());
// Загружаем страницу
$smarty->display('quest.tpl');
Пример #16
0
echo time_formation(sec_to_time($nig_dual_total));
?>
</td>
            <td align="center"><?php 
echo time_formation($flight_total);
?>
</td>
            <td align="center"><?php 
echo time_formation(sec_to_time($first_total));
?>
</td>
            <td align="center"><?php 
echo time_formation(sec_to_time($inst_sim_total));
?>
</td>
            <td align="center"><?php 
echo time_formation(sec_to_time($inst_act_total));
?>
</td>
            <td align="center"><?php 
echo time_formation(sec_to_time($inst_fly_day));
?>
</td>
            <td align="center"><?php 
echo time_formation(sec_to_time($inst_fly_night));
?>
</td>
        </tr>
    </tbody>
    <tfoot></tfoot>
</table>
Пример #17
0
function mass_coord(&$data)
{
    // Карты
    global $map_images;
    $guids = array();
    // Объявляем новый массив с преобразованными данными
    $xdata = array();
    // Перебираем по порядку все координаты, посланные функции
    //  Если таких же координат (уже преобразованных) ещё нет, добавляем в новый массив
    foreach ($data as $ndata) {
        // Если помимо координат есть ещё данные о респауне, преобразуем их к удобочитаемому виду:
        if (isset($ndata['spawntimesecs'])) {
            $tmp = array_merge(coord_mangos2wow($ndata['m'], $ndata['x'], $ndata['y'], false), array('r' => sec_to_time($ndata['spawntimesecs'])));
        } else {
            $tmp = coord_mangos2wow($ndata['m'], $ndata['x'], $ndata['y'], false);
        }
        $tmp['t'] = $ndata['type'];
        $xdata[] = $tmp;
    }
    // Освобождаем всю память выделенную под карты
    if ($map_images) {
        foreach ($map_images as $map_image) {
            imagedestroy($map_image);
        }
    }
    // Возвращаем новый массив
    return $xdata;
}
Пример #18
0
/**
 * Given the stats, add a total line
 *
 * @param array The result set from the database
 * @return array The result set plus a total row
 */
function get_stats_total($rs)
{
    $completions = 0;
    $calls = 0;
    $totaltime = 0;
    $calltime = 0;
    foreach ($rs as $r) {
        $completions += $r['completions'];
        $calls += $r['totalcalls'];
        $totaltime += $r['callattempttotaltime'];
        $calltime += $r['calltotaltime'];
    }
    if ($totaltime == 0) {
        $effectiveness = 0;
        $cph = 0;
        $callsph = 0;
    } else {
        $effectiveness = round($calltime / $totaltime, 4);
        $cph = round($completions / ($totaltime / 3600), 4);
        $callsph = round($calls / ($totaltime / 3600), 4);
    }
    $rs[] = array("effectiveness" => '<b>' . $effectiveness . '</b>', "completions" => '<b>' . $completions . '</b>', "time" => '<b>' . sec_to_time($totaltime) . '</b>', "totalcalls" => '<b>' . $calls . '</b>', "callt" => '<b>' . sec_to_time($calltime) . '</b>', "CPH" => '<b>' . $cph . '</b>', "CALLSPH" => '<b>' . $callsph . '</b>');
    return $rs;
}