예제 #1
0
 function __construct($dob, $diff, $is_secondary, $dt_change, $partner_dob, $lang_code)
 {
     global $lang_codes;
     $this->_dob = $dob;
     $this->_partner_dob = isset($partner_dob) ? $partner_dob : $dob;
     $this->_diff = $diff;
     $this->_date = date('Y-m-d', time() + 86400 * $this->_diff);
     $this->_lang_code = in_array($lang_code, $lang_codes) ? $lang_code : 'vi';
     $this->_is_secondary = $is_secondary;
     $this->_dt_change = isset($dt_change) ? $dt_change : $this->_date;
     if ($this->_is_secondary == 0) {
         $this->_rhythms = array_filter(load_all_array('nsh_rhythms'), array(new filter($this->_is_secondary), 'filter_secondary'));
     } else {
         if ($this->_is_secondary == 1) {
             $this->_rhythms = load_all_array('nsh_rhythms');
         }
     }
     sort($this->_rhythms);
     for ($i = -14; $i <= 14; ++$i) {
         $j = $i + 14;
         $day = time() + 86400 * ($i + $diff);
         $this->_days[$j] = date('d', $day);
         $this->_dates[$j] = date('Y-m-d', $day);
     }
     $this->_rhythms_count = count($this->_rhythms);
     $this->_dates_count = count($this->_dates);
     $this->_today_index = array_search(date('Y-m-d'), $this->_dates);
     $this->_dates_json = json_encode($this->_dates);
     $this->_rhythms_json = json_encode($this->_rhythms);
     switch ($this->_lang_code) {
         case 'vi':
             $this->_title_text = 'Ngày sinh: ';
             $this->_explanation_title_text = 'Biểu đồ nhịp sinh học';
             $this->_percentage_text = 'Phần trăm';
             $this->_average_text = 'Trung bình';
             $this->_download_jpeg_text = 'Tải về tập tin JPEG';
             $this->_download_pdf_text = 'Tải về tập tin PDF';
             $this->_download_png_text = 'Tải về tập tin PNG';
             $this->_download_svg_text = 'Tải về tập tin SVG';
             $this->_print_chart_text = 'In biểu đồ';
             $this->_reset_zoom_text = 'Thiết lập lại';
             $this->_date_text = 'Ngày';
             $this->_life_path_text = 'con số cuộc đời ' . calculate_life_path($this->_dob);
             $this->_age = 'tuổi';
             $this->_news_h5 = 'Tin tức';
             $this->_info_h5 = 'Lời khuyên';
             $this->_statistics_h5 = 'Thống kê';
             $this->_compatibility_h5 = 'Độ hòa hợp với đối tác';
             $this->_lunar_h5 = 'Âm lịch';
             if (date('m-d', time() + 86400 * $this->_diff) == date('m-d', strtotime($this->_dob))) {
                 $this->_controls_h5 = 'Sinh nhật';
             } else {
                 if ($this->_diff == 0) {
                     $this->_controls_h5 = 'Hôm nay';
                 } else {
                     if ($this->_diff == 1) {
                         $this->_controls_h5 = 'Ngày mai';
                     } else {
                         if ($this->_diff == -1) {
                             $this->_controls_h5 = 'Hôm qua';
                         } else {
                             $this->_controls_h5 = 'Ngày: ' . $this->_date;
                         }
                     }
                 }
             }
             break;
         case 'en':
             $this->_title_text = 'Date of birth: ';
             $this->_explanation_title_text = 'Biorhythm chart';
             $this->_percentage_text = 'Percentage';
             $this->_average_text = 'Average';
             $this->_download_jpeg_text = 'Download JPEG file';
             $this->_download_pdf_text = 'Download PDF file';
             $this->_download_png_text = 'Download PNG file';
             $this->_download_svg_text = 'Download SVG file';
             $this->_print_chart_text = 'Print chart';
             $this->_reset_zoom_text = 'Reset zoom';
             $this->_date_text = 'Date';
             $this->_life_path_text = 'life path number ' . calculate_life_path($this->_dob);
             $this->_age = pluralize(differ_year($this->_dob, $this->_date), 'year') . ' old';
             $this->_news_h5 = 'News';
             $this->_info_h5 = 'Suggestion';
             $this->_statistics_h5 = 'Statistics';
             $this->_compatibility_h5 = 'Compatibility';
             $this->_lunar_h5 = 'Lunar';
             if (date('m-d', time() + 86400 * $this->_diff) == date('m-d', strtotime($this->_dob))) {
                 $this->_controls_h5 = 'Birthday';
             } else {
                 if ($this->_diff == 0) {
                     $this->_controls_h5 = 'Today';
                 } else {
                     if ($this->_diff == 1) {
                         $this->_controls_h5 = 'Tomorrow';
                     } else {
                         if ($this->_diff == -1) {
                             $this->_controls_h5 = 'Yesterday';
                         } else {
                             $this->_controls_h5 = 'Date: ' . $this->_date;
                         }
                     }
                 }
             }
             break;
         case 'ru':
             $this->_title_text = 'Дата рождения: ';
             $this->_explanation_title_text = 'Биоритм диаграммы';
             $this->_percentage_text = 'Процент';
             $this->_average_text = 'Среднее число';
             $this->_download_jpeg_text = 'Скачать JPEG файл';
             $this->_download_pdf_text = 'Скачать PDF файл';
             $this->_download_png_text = 'Скачать PNG файл';
             $this->_download_svg_text = 'Скачать SVG файл';
             $this->_print_chart_text = 'Печать диаграммы';
             $this->_reset_zoom_text = 'Сбросить зум';
             $this->_date_text = 'Дата';
             $this->_life_path_text = 'число Жизненный путь ' . calculate_life_path($this->_dob);
             $this->_age = 'лет';
             $this->_news_h5 = 'Новости';
             $this->_info_h5 = 'Предложение';
             $this->_statistics_h5 = 'Статистика';
             $this->_compatibility_h5 = 'Совместимость';
             $this->_lunar_h5 = 'Лунный';
             if (date('m-d', time() + 86400 * $this->_diff) == date('m-d', strtotime($this->_dob))) {
                 $this->_controls_h5 = 'День рождения';
             } else {
                 if ($this->_diff == 0) {
                     $this->_controls_h5 = 'Сегодня';
                 } else {
                     if ($this->_diff == 1) {
                         $this->_controls_h5 = 'Завтра';
                     } else {
                         if ($this->_diff == -1) {
                             $this->_controls_h5 = 'Вчерашний день';
                         } else {
                             $this->_controls_h5 = 'Дата: ' . $this->_date;
                         }
                     }
                 }
             }
             break;
         case 'es':
             $this->_title_text = 'Fecha de nacimiento: ';
             $this->_explanation_title_text = 'Biorritmo carta';
             $this->_percentage_text = 'Porcentaje';
             $this->_average_text = 'Promedio';
             $this->_download_jpeg_text = 'Descarga de archivos JPEG';
             $this->_download_pdf_text = 'Descarga de archivos PDF';
             $this->_download_png_text = 'Descarga de archivos PNG';
             $this->_download_svg_text = 'Descarga de archivos SVG';
             $this->_print_chart_text = 'Imprimir el gráfico';
             $this->_reset_zoom_text = 'Restablecer zoom';
             $this->_date_text = 'Fecha';
             $this->_life_path_text = 'vida número de camino ' . calculate_life_path($this->_dob);
             $this->_age = 'años';
             $this->_news_h5 = 'Noticias';
             $this->_info_h5 = 'Sugerencia';
             $this->_statistics_h5 = 'Estadística';
             $this->_compatibility_h5 = 'Compatibilidad';
             $this->_lunar_h5 = 'Lunar';
             if (date('m-d', time() + 86400 * $this->_diff) == date('m-d', strtotime($this->_dob))) {
                 $this->_controls_h5 = 'Cumpleaños';
             } else {
                 if ($this->_diff == 0) {
                     $this->_controls_h5 = 'Hoy';
                 } else {
                     if ($this->_diff == 1) {
                         $this->_controls_h5 = 'Mañana';
                     } else {
                         if ($this->_diff == -1) {
                             $this->_controls_h5 = 'Ayer';
                         } else {
                             $this->_controls_h5 = 'Fecha: ' . $this->_date;
                         }
                     }
                 }
             }
             break;
         case 'zh':
             $this->_title_text = '出生日期: ';
             $this->_explanation_title_text = '生物节律图';
             $this->_percentage_text = '百分比';
             $this->_average_text = '平均';
             $this->_download_jpeg_text = '下载 JPEG 文件';
             $this->_download_pdf_text = '下载 PDF 文件';
             $this->_download_png_text = '下载 PNG 文件';
             $this->_download_svg_text = '下载 SVG 文件';
             $this->_print_chart_text = '打印图表';
             $this->_reset_zoom_text = '重置缩放';
             $this->_date_text = '上';
             $this->_life_path_text = '人生道路数量 ' . calculate_life_path($this->_dob);
             $this->_age = '岁老';
             $this->_news_h5 = '新闻';
             $this->_info_h5 = '建议';
             $this->_statistics_h5 = '统计学';
             $this->_compatibility_h5 = '兼容性';
             $this->_lunar_h5 = '阴历';
             if (date('m-d', time() + 86400 * $this->_diff) == date('m-d', strtotime($this->_dob))) {
                 $this->_controls_h5 = '生辰';
             } else {
                 if ($this->_diff == 0) {
                     $this->_controls_h5 = '今天';
                 } else {
                     if ($this->_diff == 1) {
                         $this->_controls_h5 = '明天';
                     } else {
                         if ($this->_diff == -1) {
                             $this->_controls_h5 = '昨天';
                         } else {
                             $this->_controls_h5 = '上: ' . $this->_date;
                         }
                     }
                 }
             }
             break;
         case 'ja':
             $this->_title_text = '生まれた日: ';
             $this->_explanation_title_text = 'バイオリズムチャート';
             $this->_percentage_text = '百分率';
             $this->_average_text = '平均する';
             $this->_download_jpeg_text = 'ダウンロード JPEG ファイル';
             $this->_download_pdf_text = 'ダウンロード PDF ファイル';
             $this->_download_png_text = 'ダウンロード PNG ファイル';
             $this->_download_svg_text = 'ダウンロード SVG ファイル';
             $this->_print_chart_text = 'チャート印刷';
             $this->_reset_zoom_text = 'ズームをリセット';
             $this->_date_text = '日付';
             $this->_life_path_text = 'ライフパス番号 ' . calculate_life_path($this->_dob);
             $this->_age = '歳';
             $this->_news_h5 = 'ニュース';
             $this->_info_h5 = '提案';
             $this->_statistics_h5 = '統計学';
             $this->_compatibility_h5 = '互換性';
             $this->_lunar_h5 = '太陰暦';
             if (date('m-d', time() + 86400 * $this->_diff) == date('m-d', strtotime($this->_dob))) {
                 $this->_controls_h5 = 'バースデー';
             } else {
                 if ($this->_diff == 0) {
                     $this->_controls_h5 = '今日';
                 } else {
                     if ($this->_diff == 1) {
                         $this->_controls_h5 = 'あくる日';
                     } else {
                         if ($this->_diff == -1) {
                             $this->_controls_h5 = '昨日';
                         } else {
                             $this->_controls_h5 = '日付: ' . $this->_date;
                         }
                     }
                 }
             }
             break;
     }
 }
예제 #2
0
/?p=pong</loc>
		<changefreq>monthly</changefreq>
		<priority>0.8</priority>
		<mobile:mobile/>
	</url>
	<url>
		<loc>http://<?php 
echo $_SERVER['SERVER_NAME'];
?>
/?p=race</loc>
		<changefreq>monthly</changefreq>
		<priority>0.8</priority>
		<mobile:mobile/>
	</url>
<?php 
$users = load_all_array('nsh_users');
usort($users, 'sort_name_ascend');
$count = count($users);
for ($i = 0; $i < $count; ++$i) {
    ?>
	<url>
		<loc>http://<?php 
    echo $_SERVER['SERVER_NAME'];
    ?>
/?fullname=<?php 
    echo str_replace(' ', '+', $users[$i]['name']);
    ?>
&amp;dob=<?php 
    echo $users[$i]['dob'];
    ?>
</loc>
예제 #3
0
function list_rhythms()
{
    //Return list of rhythms, for admin use
    $output = '';
    $rhythms = load_all_array('nsh_rhythms');
    $output .= '<a class="button" href="/rhythm/create/">Create rhythm</a>';
    $output .= '<table class="admin">';
    $output .= '<tr><th>Rhythm ID</th><th>Rhythm name</th><th colspan="3">Operations</th></tr>';
    $count = count($rhythms);
    $output .= '<tr><td class="count" colspan="6">' . $count . ' item' . ($count > 1 ? 's' : '') . ' to display.</td></tr>';
    for ($i = 0; $i < $count; ++$i) {
        $class = 'class="' . table_row_class($i) . '"';
        $output .= '<tr ' . $class . '>';
        $output .= '<td>' . $rhythms[$i]['rid'] . '</td>';
        $output .= '<td>' . $rhythms[$i]['name'] . '</td>';
        $output .= '<td><form method="POST" action="/rhythm/edit/"><input type="hidden" name="rid" value="' . $rhythms[$i]['rid'] . '" /><input type="hidden" name="old_name" value="' . $rhythms[$i]['name'] . '" /><input type="hidden" name="old_scale" value="' . $rhythms[$i]['scale'] . '" /><input type="hidden" name="old_description_en" value="' . str_replace('"', "'", $rhythms[$i]['description_en']) . '" /><input type="hidden" name="old_description_ru" value="' . str_replace('"', "'", $rhythms[$i]['description_ru']) . '" /><input type="hidden" name="old_description_es" value="' . str_replace('"', "'", $rhythms[$i]['description_es']) . '" /><input type="hidden" name="old_description_zh" value="' . str_replace('"', "'", $rhythms[$i]['description_zh']) . '" /><input type="hidden" name="old_description_ja" value="' . str_replace('"', "'", $rhythms[$i]['description_ja']) . '" /><input name="rhythm_edit" type="submit" value="Edit"/></form></td>';
        $output .= '<td><form method="POST" action="/triggers/change_rhythm_type.php"><input type="hidden" name="rid" value="' . $rhythms[$i]['rid'] . '" /><input name="rhythm_chang_type" type="submit" title="Make rhythm ' . ($rhythms[$i]['is_secondary'] == 0 ? 'secondary' : 'primary') . '" value="' . ($rhythms[$i]['is_secondary'] == 0 ? 'Primary' : 'Secondary') . '"/></form></td>';
        $output .= '<td><form method="POST" action="/rhythm/delete/"><input type="hidden" name="rid" value="' . $rhythms[$i]['rid'] . '" /><input name="rhythm_delete" type="submit" value="Delete"/></form></td>';
        $output .= '</tr>';
    }
    $output .= '</table>';
    return $output;
}