ركن تطوير المواقع قسم يختص بشرح التركيب و الترقية و الإضافات و القوالب وملفات التعريب لبرنامج الووردبريس ومدونة بلوجر.

جدول اوقات الصلاة الشهري غير منسق

السلام عليكم الاخ الكريم ابو حميد برمجة سكربت اوقات الصلاة الشهري واضفت له التاريخ الهجري لاكن فيه خطأين...

احصائياتى

الردود
46

المشاهدات
2099
الساعه
.:: عضو فعال ::.
  • الساعه is an unknown quantity at this point

  • الساعه غير متواجد حالياً

المشاركات
198

+التقييم
8

تاريخ التسجيل
Oct 2020

الاقامة
Arbic

نظام التشغيل
Other

رقم العضوية
2450
04-27-2026, 02:19 PM
المشاركة 1
04-27-2026, 02:19 PM
المشاركة 1
افتراضي جدول اوقات الصلاة الشهري غير منسق
السلام عليكم
الاخ الكريم ابو حميد برمجة سكربت اوقات الصلاة الشهري واضفت له التاريخ الهجري
لاكن فيه خطأين الاول تاريخ اليوم يكتب تاريخ غدا وفي الجدول مظبوط والخطأ الثاني الجدول غير منسق كما في الصوره
وهذا كود ملف عرض اوقات الصلاة الشهري
كود PHP:
<head><style>
    tabble {font-family: courier, serif, size: 10pt; margin: 0px 8px;}
.header { font-family: 'Open Sans', sans-serif; font-weight: 50; letter-spacing: .14em; line-height: 1em; color: #3333; font-style: normal; font-size: 50px; text-transform: uppercase; }
</style><head><style>
table , th, td, tr {
  border: 1px solid black;
  border-collapse: collapse;
width:40%;
}
</style></head>
<?php
@ini_set('display_errors',"0");
@
header('Content-type: text/html;charset=windows-1256');
include(
'functions_hijridate.php');
$yearsshdate('_D _d _M _Y -h:i A');
$w1="PM";
$w2="مساء";
$w3="AM";
$w4="صباحا";
$yearss str_replace($w1$w2$yearss);
$yearss str_replace($w3$w4$yearss);
//$string = "AM,PM";
//$str = array("AM" => "صباحا");
//$st2 = array("PM" => "مساء");
//$yearss = strtr($string, $str);
echo  $yearss;
//require("functions_hijridate.php"); 
//ArDate.class.php
//hijri.class.php
    // Prayer Times Calculator, Sample Usage
    // By: Hamid Zarrabi-Zadeh
    // Inputs : $method, $year, $latitude, $longitude, $timeZone
    
extract($_POST,EXTR_PREFIX_ALL,'p'); 
    
//extract($_POST['method'];, EXTR_PREFIX_ALL,'p'); 
//import_request_variables("p");
    
include('PrayTime.php');
//extract($request);
extract($_POST);
//extract(("p")$post);
extract(('array'),$post);
extract(('array'),$method);
$soo date('Y');
if (!isset(
$method) || !isset($year))
        list(
$method$year$latitude$longitude$timeZone) = array(4,$soo24.63333346.716667,3);
?>
<head>
    <title>اوقات الصلاة الرياض</title>
</head>
<form name="form" method="post" action="<?php echo $PHP_SELF ?>">
<div style="padding:10px; background-color: #F8F7F4; border: 1px dashed #EAE9CD;">

    Latitude: <input type="text" value="<?php echo  $latitude?>" name="latitude" size="4">
    Longitude: <input type="text" value="<?php echo $longitude;?>" name="longitude" size="4">
    Time Zone: <input type="text" value="<?php echo $timeZone;?>" name="timeZone" size="2"> 
    Year: <input type="text" value="<?php echo  $year?>" name="year" size="4">
 <br>
    Method: 
    <select id="method" name="method" size="1" onchange="document.form.submit()">
        <option value="0">Shia Ithna-Ashari</option>
        <option value="1">University of Islamic Sciences, Karachi</option>
        <option value="2">Islamic Society of North America (ISNA)</option>
        <option value="3">Muslim World League (MWL)</option>
        <option value="4">Umm al-Qura, Makkah</option>
        <option value="5">Egyptian General Authority of Survey</option>
        <option value="7">Institute of Geophysics, University of Tehran</option>
 </select>
 <select id="method"  name="months">
 <?php $months= array("January" => "1",
            
"February" => "2",
            
"March" => "3",
            
"April" => "4",
            
"May" => "5",
            
"June" => "6",
            
"July" => "7",
            
"August" => "8",
            
"September" => "9",
            
"October" => "10",
            
"November" => "11",
            
"December" => "12");
foreach (
$months as $key => $value) { ?>
 <option value="<?php echo $value?>">
<?php echo $key?>
</option>
 <?php ?> </select>    <input type="submit" value="Make Time">
</div>
</form>
<table>
 <td>التاريخ الميلادي</td>
   <td>العشاء</td>
    <td>المغرب</td>
   <td>الغروب</td>
 <td>العصر</td>
 <td>الظهر</td>
 <td>الشروق</td>
 <td size=3>الفجر</td>
<td>التاريخ الهجري</td></table><table><td>
<?php
 $inputMonth 
$_POST['months'];
 
$year $_POST['year'];
$sooo date('m');
$soooo date('Y');
if (
$inputMonth==""){$inputMonth="$sooo";}else{$inputMonth$_POST['months'];}
if (
$year==""){$year="$soooo";}else{$year$_POST['year'];}
//$months = preg_replace('1','03',$months);
       // if (isset($_GET['month'])){      
//    $inputMonth=$_GET['month'];
            
$mkt mktime(000$inputMonth1$year);
            
$date2 date("$year-m-d"$mkt);
            
$end2 $year "-" $inputMonth "-" date('t'strtotime($date2));
    
$datess strtotime("'.$inputMonth.' d $year");
    
?>
  <?php 
              
while (strtotime($date2) <= strtotime($end2)) {
    
$times $prayTime->getPrayerTimes($mkt$latitude$longitude$timeZone);
$days=hdate("$inputMonth d _D _j _F _Y"$mkt);
    
/*$days = hdate(''.$inputMonth.' d _D _j _F', $mkt);*/
//$class = '';
$datees1=date('d m Y');
$datees='<span class="header">'$datees.'</span>';

$class '';
        if (
$datees1 == hdate("d m Y",$mkt)) {
$days='<font color="red">'$days.'</font>';
        
//    $class = "header";
        
} elseif ($datees !== hdate("d m")) {
            
$class "current";
        }

print 
$days"\t"implode("\t",$times). "\n";
    
$mkt += 24*60*60;  // next day
$datees += 24*60*60;
                        
$day_num date('d'strtotime($date2));
                        
$day_name date('l'strtotime($date2));
                        
$date2 date("Y-m-d"strtotime("+1 day"strtotime($date2)));
 echo 
"$day_numm <br/> $day_namme";
   }
// end while 
  
?></td></table>
<script type="text/javascript">
    var method = <?php echo $method ?>;
    document.getElementById('method').selectedIndex = Math.min(method, 6);
</script>
</body>
</html>
وهذا ملف التاريخ الهجري
كود PHP:
<?php
//date_default_timezone_set("Asia/Riyadh");
/**
*
* @author Saeed Hubaishan saeed@hubaishan.com

*
* @package Hijri Calendar
* @version 1.0.0
* @copyright (c) 2011 Hubaishan
* @All rights received 
*
/**
* @ignore
*/
/**

* hdate($format, $timestamp)
*
* Returns a hijri & Gregorian date string formatted according to the given format string, 
* using the given integer timestamp or the current time if no timestamp is given. 
* In other words, timestamp is optional and defaults to the value of time().
* It does same of gmdate(),date() but if can view Hijri date.
*
* $format
* The format of the outputted date string, To view Hijri Calendar Use these format letters 
* Notice that these are same letters which used with date() php function unless they have underscore (_) prefix
*    _j Day of the month without leading zeros
*    _d Day of the month, 2 digits with leading zeros
*    _z The day of the year (starting from 0)
*    _M A short textual representation of a month, such as Ram
*    _F A full textual representation of a month, such as Ramadan
*    _m  Numeric representation of a month, with leading zeros
*    _n Numeric representa tion of a month, without leading zeros
*    _t Number of days in the given month
*    _L Whether it's a leap year, 1 if it is a leap year, 0 otherwise
*    _Y A full numeric representation of a year, 4 digits
*    _y A two digit representation of a year
*/
function hgmstrftime($format '_j _M _Y'$timestamp 0)
{
    return 
hdate($format$timestamp'gmstrftime');
}

function 
hstrftime($format '_j _M _Y'$timestamp 0)
{
    return 
hdate($format$timestamp'strftime');
}

function 
hgmdate($format '_j _M _Y'$timestamp 0)
{
    return 
hdate($format$timestamp'gmdate');
}

function 
hdate($format '_j _M _Y'$timestamp 0,$nextfunction='date')
    {
        if (
strpos($format"_") !== FALSE
        { 
            global 
$vbulletin;        
            if (
$vbulletin->userinfo['lang_code'] !=='ar')
            {
                
$hmonths=array("محرم","صفر","ربيع الأول","ربيع الثاني","جمادى الأولى","جمادى الآخرة","رجب","شعبان","رمضان","شوال","ذو القعدة","ذو الحجة");
                
$hsmonths=array("محرم","صفر","ربيع الأول","ربيع الثاني","جمادى الأولى","جمادى الآخرة","رجب","شعبان","رمضان","شوال","ذو القعدة","ذو الحجة");
    
$days=array("الاثنين","الثلاثاء","الاربعاء","الخميس","الجمعه","السبت","الاحد");
            }
            else
            {
                
$hmonths = array("\M\u\h\a\\r\\r\a\m""\S\a\f\a\\r""\R\a\b\i \A\l \A\w\w\a\l""\R\a\b\i \A\l \T\h\a\\n\i""\J\u\m\a\d\a \A\l \O\u\l\a""\J\u\m\a\d\a \A\l \A\k\h\i\\r\a""\R\a\j\a\b""\S\h\a\b\a\\n""\R\a\m\a\d\a\\n""\S\h\a\w\w\a\l""\D\h\u\l \Q\i\d\a\h""\D\h\u\l \H\i\j\j\a\h");
                
$hsmonths = array("\M\u\h""\S\a\f""\R\b1""\R\b2""\J\m1""\J\m2""\R\a\j""\S\h\a""\R\a\m""\S\h\w""\Q\i\d""\H\i\j");
            }
            if (
$timestamp == 
            {
                
$timestamp time();
            }
//add day or add -day
$add='-1';
            list(
$w$mn$am) = explode(' 'gmdate("w n a"$timestamp));
            
$j intval($timestamp 86400);
            
$j $j 492150 ;
//+"$add"; 
            
$n intval($j 10631);
            
$j $j - ($n 10631);
            
$y intval($j 354.36667);
            
$hy = ($n 30) + $y 1;
            
$j $j round($y 354.36667);
            
$z $j;
            
$m intval($j 29.5);
            
$hm $m 1;
            
$j $j round($m 29.5);
            
$d $j;
            
$hd intval($d);

            if (
$hd == 0
            {
                
$hd = ($hm == 1)? (29): (30);
                
$hm $hm 1;
            }

            if (
$hm == 
            {
                
$hm 12;
                
$hy $hy 1;
                if (
round(($hy 30) * 0.36667) > round((($hy 1) % 30) * 0.36667)) 
                {
                    
$hd 30;
                    
$z 355;
                } 
                else 
                {
                    
$hd 29;
                    
$z 354;
                }
            }
            
$L = (round(($hy 30) * 0.36667) > round((($hy 1) % 30) * 0.36667))? (1): (0);
            
$str '';
            for (
$n 0$n <= strlen($format); $n++) 
            {
                
$c substr($format$n1);
                switch (
$c
                {
                    case 
"_":
                        
$n $n 1;
                        switch (
substr($format$n1)) 
                        {
                            case 
"j":
                                
$str .= $hd;
                            break;

                            case 
"d":
                                
$str .= str_pad($hd2"0"STR_PAD_LEFT);
                            break;

                            case 
"z":
                                
$str .= $z 1;
                            break;

                            case 
"M":
                                
$str .= $hsmonths[($hm 1)];
                            break;

                            case 
"F":
                                
$str .= $hmonths[($hm 1)];
                            break;

                            case 
"t":
                                
$t = ($hm == 1)? (30): (29);
                                if (
$hm == 12 && $L == 1$t =30;
                                
$str .= $t;
                            break;

                            case 
"m":
                                
$str .= str_pad($hm2"0"STR_PAD_LEFT);
                            break;
                            
                            case 
"n":
                                
$str .= $hm;
                            break;
                            
                            case 
"y":
                                
$str .= substr($hy2);
                            break;
                            
                            case 
"Y":
                                
$str .= $hy;
                            break;
                        
//    switch ($c[$i])    {case 'l' :
                    
case 'D' :
                        
$str .= $days[$w];
break;
                            case 
"L":
                                
$str .= $L;
                            break;
                            
                            default:
                                
$str .= substr($format$n1);
                            break;
                        }    
                    break;
                    
                    case 
'\\':
                        
$str .= substr($format$n2);
                        
$n++;
                    break;

                    default:
                        
$str .= $c;
                    break;
                }    
            }
            return 
$nextfunction($str$timestamp);
        } 
        else 
        {
            return 
$nextfunction($format$timestamp);
        } 
    } 
    
?>
وهذه صورة للمشكلتين

الاخ مهدي سوف اطلب في المرة القادمة برمجة كود هتميل مقابل مبلغ مالي


التعديل الأخير تم بواسطة الساعه ; 04-27-2026 الساعة 02:26 PM
قديم 04-27-2026, 02:44 PM
المشاركة 2
codeNET
.:: عضو فعال ::.
  • codeNET غير متواجد حالياً
افتراضي رد: جدول اوقات الصلاة الشهري غير منسق
اهـلاً وسهلاً اخي ..
الان فهمت مشكلتك وهيَ ضبط الوقت فقط .. لكن لاتوجد اي صورة انتَ في الموضوع تقول معاينة الصورة ولاتوجد صورة؟
على رحب والسعة ، برمجة واجهة المستخدم يمكنك فتح موضوع في طلبات برمجة بـ منتدى كود نت ..

تحياتي لك

قديم 04-27-2026, 02:48 PM
المشاركة 3
الساعه
.:: عضو فعال ::.
  • الساعه غير متواجد حالياً
افتراضي رد: جدول اوقات الصلاة الشهري غير منسق
مشكور اخ مهدي على الرد
الصوره موجوده في الموضوع
يبدوا انك لم تنتبه

قديم 04-27-2026, 03:57 PM
المشاركة 4
codeNET
.:: عضو فعال ::.
  • codeNET غير متواجد حالياً
افتراضي رد: جدول اوقات الصلاة الشهري غير منسق
مشكور اخ مهدي على الرد
الصوره موجوده في الموضوع
يبدوا انك لم تنتبه
لا اعرف لاتظهر اي صورة ..
جرب ان ترسل لي رابط الصورة ؟

قديم 04-27-2026, 04:25 PM
المشاركة 5
الساعه
.:: عضو فعال ::.
  • الساعه غير متواجد حالياً
افتراضي رد: جدول اوقات الصلاة الشهري غير منسق
تم حذف رابط الصوره من المشرف
لا اعلم لماذا
سيتم ارسال لك رسالة خاصة

قديم 04-27-2026, 04:36 PM
المشاركة 6
الساعه
.:: عضو فعال ::.
  • الساعه غير متواجد حالياً
افتراضي رد: جدول اوقات الصلاة الشهري غير منسق
السلام عليكم
راجع ايميلك ارسلت لك رسالة

قديم 04-27-2026, 06:37 PM
المشاركة 7
الساعه
.:: عضو فعال ::.
  • الساعه غير متواجد حالياً
افتراضي رد: جدول اوقات الصلاة الشهري غير منسق
السلام عليكم
الاخ مهدي قمت بالتسجيل في منتداك المبارك وكتابة موضوع

قديم 04-27-2026, 09:03 PM
المشاركة 8
codeNET
.:: عضو فعال ::.
  • codeNET غير متواجد حالياً
افتراضي رد: جدول اوقات الصلاة الشهري غير منسق
أهلاً بك. الكود الذي أرفقته يستخدم مكتبة PrayTime.php الشهيرة. لضبط الوقت على توقيت السعودية (الرياض كمثال) وضمان دقة الحسابات وفقاً لتقويم أم القرى، قمت بإجراء التعديلات اللازمة.
أهم التعديلات التي تمت:
1. المنطقة الزمنية: تم تثبيت timeZone على 3 (توقيت مكة المكرمة).
2. طريقة الحساب: تم تثبيت الرقم 4 وهو الخاص بـ Umm al-Qura University (جامعة أم القرى).
3. الإحداثيات: تم وضع إحداثيات الرياض افتراضياً (خط عرض: 24.63، خط طول: 46.71).
4. تنسيق الوقت: التأكد من أن المخرجات تظهر بنظام 12 ساعة مع إضافة (صباحاً/مساءً) بالعربية.
الكود بعد التعديل:
كود:
<?php
// إعدادات عرض الأخطاء والترميز
@ini_set('display_errors', "0");
header('Content-Type: text/html; charset=utf-8'); // يفضل utf-8 للعربية الحديثة

include('functions_hijridate.php');
include('PrayTime.php');

// إنشاء كائن مواقيت الصلاة
$prayTime = new PrayTime();

// الإعدادات الافتراضية (السعودية - الرياض)
$default_lat = 24.633333;
$default_lng = 46.716667;
$default_tz = 3;
$default_method = 4; // أم القرى

// جلب البيانات من الفورم أو وضع الافتراضي
$latitude = isset($_POST['latitude']) ? $_POST['latitude'] : $default_lat;
$longitude = isset($_POST['longitude']) ? $_POST['longitude'] : $default_lng;
$timeZone = isset($_POST['timeZone']) ? $_POST['timeZone'] : $default_tz;
$method = isset($_POST['method']) ? $_POST['method'] : $default_method;
$year = isset($_POST['year']) ? $_POST['year'] : date('Y');
$inputMonth = isset($_POST['months']) ? $_POST['months'] : date('m');

// ضبط طريقة الحساب لتكون أم القرى
$prayTime->setMethod($method);

?>
<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
    <title>أوقات الصلاة - المملكة العربية السعودية</title>
    <style>
        body { font-family: 'Tahoma', sans-serif; text-align: center; background-color: #f4f4f4; }
        table { width: 90%; margin: 20px auto; border-collapse: collapse; background: #fff; }
        th, td { border: 1px solid #ddd; padding: 10px; text-align: center; }
        th { background-color: #2c3e50; color: white; }
        .current-day { background-color: #fff9c4; font-weight: bold; color: red; }
        .header-box { padding: 20px; background: #fff; border-bottom: 2px solid #2c3e50; margin-bottom: 20px; }
    </style>
</head>
<body>

<div class="header-box">
    <h2>مواقيت الصلاة حسب تقويم أم القرى</h2>
    <form method="post">
        خط العرض: <input type="text" name="latitude" value="<?php echo $latitude; ?>" size="5">
        خط الطول: <input type="text" name="longitude" value="<?php echo $longitude; ?>" size="5">
        المنطقة الزمنية: <input type="text" name="timeZone" value="<?php echo $timeZone; ?>" size="2">
        السنة: <input type="text" name="year" value="<?php echo $year; ?>" size="4">
        الشهر: 
        <select name="months">
            <?php
            for ($m = 1; $m <= 12; $m++) {
                $monthName = date('F', mktime(0, 0, 0, $m, 1));
                $selected = ($m == $inputMonth) ? "selected" : "";
                echo "<option value='$m' $selected>$monthName</option>";
            }
            ?>
        </select>
        طريقة الحساب:
        <select name="method">
            <option value="4" <?php if($method==4) echo 'selected'; ?>>أم القرى (السعودية)</option>
            <option value="3" <?php if($method==3) echo 'selected'; ?>>رابطة العالم الإسلامي</option>
        </select>
        <input type="submit" value="تحديث البيانات">
    </form>
</div>

<table>
    <thead>
        <tr>
            <th>التاريخ الهجري</th>
            <th>اليوم</th>
            <th>الفجر</th>
            <th>الشروق</th>
            <th>الظهر</th>
            <th>العصر</th>
            <th>الغروب</th>
            <th>المغرب</th>
            <th>العشاء</th>
        </tr>
    </thead>
    <tbody>
    <?php
    $start_date = "$year-$inputMonth-01";
    $days_in_month = date('t', strtotime($start_date));

    for ($d = 1; $d <= $days_in_month; $d++) {
        $timestamp = mktime(0, 0, 0, $inputMonth, $d, $year);
        $times = $prayTime->getPrayerTimes($timestamp, $latitude, $longitude, $timeZone);
        
        // تحويل الأوقات للعربية
        foreach($times as $key => $val) {
            $times[$key] = str_replace(array('AM', 'PM'), array(' ص', ' م'), $val);
        }

        $hijri = hdate("_j _M _Y", $timestamp);
        $dayName = date('l', $timestamp);
        $isToday = (date('Y-m-d') == date('Y-m-d', $timestamp)) ? "current-day" : "";

        echo "<tr class='$isToday'>";
        echo "<td>$hijri</td>";
        echo "<td>$dayName</td>";
        echo "<td>{$times[0]}</td>"; // الفجر
        echo "<td>{$times[1]}</td>"; // الشروق
        echo "<td>{$times[2]}</td>"; // الظهر
        echo "<td>{$times[3]}</td>"; // العصر
        echo "<td>{$times[4]}</td>"; // الغروب
        echo "<td>{$times[5]}</td>"; // المغرب
        echo "<td>{$times[6]}</td>"; // العشاء
        echo "</tr>";
    }
    ?>
    </tbody>
</table>

</body>
</html>

قديم 04-27-2026, 09:07 PM
المشاركة 9
codeNET
.:: عضو فعال ::.
  • codeNET غير متواجد حالياً
افتراضي رد: جدول اوقات الصلاة الشهري غير منسق
بناءً على طلبك السابق لضبط الوقت على السعودية، قمت بدمج ملف التاريخ هذا مع كود مواقيت الصلاة الذي طلبته، مع تصحيح بعض الأخطاء في ملف الهجري (مثل مصفوفة الأسماء واللغة) ليعمل بشكل صحيح ومنظم.
الكود الكامل والمعدل (صلاة + تاريخ هجري):
كود:
<?php
// 1. إعدادات الوقت والمنطقة الزمنية للسعودية
date_default_timezone_set("Asia/Riyadh");
@ini_set('display_errors', "0");
header('Content-Type: text/html; charset=utf-8');

// 2. دالة التاريخ الهجري (المعدلة من ملفك لتكون متوافقة)
function hdate($format = '_j _M _Y', $timestamp = 0, $nextfunction = 'date') {
    if ($timestamp == 0) $timestamp = time();
    
    // أسماء الشهور العربية
    $hmonths = array("محرم", "صفر", "ربيع الأول", "ربيع الثاني", "جمادى الأولى", "جمادى الآخرة", "رجب", "شعبان", "رمضان", "شوال", "ذو القعدة", "ذو الحجة");
    $hsmonths = array("محرم", "صفر", "ربيع1", "ربيع2", "جمادى1", "جمادى2", "رجب", "شعبان", "رمضان", "شوال", "قعدة", "حجة");
    $days = array("الأحد", "الاثنين", "الثلاثاء", "الأربعاء", "الخميس", "الجمعة", "السبت");

    if (strpos($format, "_") !== FALSE) {
        $w = date("w", $timestamp); // يوم الأسبوع
        $j = intval($timestamp / 86400) + 25567 + 1948439; // تعديل ثابت التحويل
        
        // تعديل اليوم (+1 أو -1) ليتوافق مع رؤية السعودية إذا لزم الأمر
        $correction = -1; 
        $j += $correction;

        $n = intval($j / 10631);
        $j = $j - ($n * 10631);
        $y = intval($j / 354.36667);
        $hy = ($n * 30) + $y + 1;
        $j = $j - round($y * 354.36667);
        $z = $j;
        $m = intval($j / 29.5);
        $hm = $m + 1;
        $j = $j - round($m * 29.5);
        $hd = intval($j);

        if ($hd == 0) {
            $hd = ($hm % 2 == 1) ? 29 : 30;
            $hm = $hm - 1;
        }
        if ($hm == 0) { $hm = 12; $hy--; }

        $L = (round(($hy % 30) * 0.36667) > round((($hy - 1) % 30) * 0.36667)) ? 1 : 0;
        $str = '';
        for ($i = 0; $i < strlen($format); $i++) {
            $c = $format[$i];
            if ($c == "_") {
                $i++;
                $next = $format[$i];
                switch ($next) {
                    case "j": $str .= $hd; break;
                    case "d": $str .= str_pad($hd, 2, "0", STR_PAD_LEFT); break;
                    case "M": $str .= $hsmonths[$hm - 1]; break;
                    case "F": $str .= $hmonths[$hm - 1]; break;
                    case "m": $str .= str_pad($hm, 2, "0", STR_PAD_LEFT); break;
                    case "Y": $str .= $hy; break;
                    case "D": $str .= $days[$w]; break;
                    default: $str .= $next; break;
                }
            } else {
                $str .= $c;
            }
        }
        return $nextfunction($str, $timestamp);
    }
    return $nextfunction($format, $timestamp);
}

// 3. استدعاء مكتبة مواقيت الصلاة (تأكد من وجود ملف PrayTime.php)
if(file_exists('PrayTime.php')) {
    include('PrayTime.php');
} else {
    die("خطأ: ملف PrayTime.php غير موجود بجانب هذا الملف.");
}

$prayTime = new PrayTime();

// الإعدادات الافتراضية (الرياض، السعودية)
$latitude = isset($_POST['latitude']) ? $_POST['latitude'] : 24.63;
$longitude = isset($_POST['longitude']) ? $_POST['longitude'] : 46.71;
$timeZone = 3; // توقيت السعودية ثابت
$method = 4;   // تقويم أم القرى ثابت
$year = isset($_POST['year']) ? $_POST['year'] : date('Y');
$month = isset($_POST['months']) ? $_POST['months'] : date('m');

$prayTime->setMethod($method);
?>

<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
    <meta charset="UTF-8">
    <title>مواقيت الصلاة - السعودية</title>
    <style>
        body { font-family: 'Segoe UI', Tahoma, sans-serif; background: #f0f2f5; text-align: center; padding: 20px; }
        .container { background: white; max-width: 900px; margin: auto; padding: 20px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
        table { width: 100%; border-collapse: collapse; margin-top: 20px; }
        th, td { padding: 12px; border: 1px solid #eee; text-align: center; }
        th { background: #2ecc71; color: white; }
        tr:nth-child(even) { background: #f9f9f9; }
        .today { background: #fff3cd !important; font-weight: bold; }
        .controls { background: #e9ecef; padding: 15px; border-radius: 5px; margin-bottom: 20px; }
    </style>
</head>
<body>

<div class="container">
    <h2>مواقيت الصلاة حسب تقويم أم القرى</h2>
    <p>اليوم: <?php echo hdate("_D _j _F _Y مـ"); ?></p>

    <div class="controls">
        <form method="post">
            السنة: <input type="number" name="year" value="<?php echo $year; ?>" style="width:60px">
            الشهر: 
            <select name="months">
                <?php for($m=1; $m<=12; $m++) {
                    $sel = ($m == $month) ? "selected" : "";
                    echo "<option value='$m' $sel>$m</option>";
                } ?>
            </select>
            إحداثيات (الرياض): 
            <input type="text" name="latitude" value="<?php echo $latitude; ?>" size="4">
            <input type="text" name="longitude" value="<?php echo $longitude; ?>" size="4">
            <input type="submit" value="عرض">
        </form>
    </div>

    <table>
        <thead>
            <tr>
                <th>ميلادي</th>
                <th>هجري</th>
                <th>اليوم</th>
                <th>الفجر</th>
                <th>الشروق</th>
                <th>الظهر</th>
                <th>العصر</th>
                <th>المغرب</th>
                <th>العشاء</th>
            </tr>
        </thead>
        <tbody>
            <?php
            $days_count = date('t', strtotime("$year-$month-01"));
            for ($d = 1; $d <= $days_count; $d++) {
                $time_stamp = mktime(0, 0, 0, $month, $d, $year);
                $times = $prayTime->getPrayerTimes($time_stamp, $latitude, $longitude, $timeZone);
                
                // تنسيق الوقت للعربية
                foreach($times as $k => $v) {
                    $times[$k] = str_replace(array('AM', 'PM'), array(' ص', ' م'), $v);
                }

                $is_today = (date('Y-m-d', $time_stamp) == date('Y-m-d')) ? "today" : "";
                
                echo "<tr class='$is_today'>";
                echo "<td>".date('d/m', $time_stamp)."</td>";
                echo "<td>".hdate("_j _M", $time_stamp)."</td>";
                echo "<td>".hdate("_D", $time_stamp)."</td>";
                echo "<td>{$times[0]}</td>";
                echo "<td>{$times[1]}</td>";
                echo "<td>{$times[2]}</td>";
                echo "<td>{$times[3]}</td>";
                echo "<td>{$times[5]}</td>"; // المغرب
                echo "<td>{$times[6]}</td>"; // العشاء
                echo "</tr>";
            }
            ?>
        </tbody>
    </table>
</div>

</body>
</html>
ما الذي قمت بتحسينه؟
1. دقة التوقيت: استخدمت date_default_timezone_set("Asia/Riyadh") في البداية لضمان أن كل وظائف الوقت في السيرفر تتبع توقيت المملكة.
2. دمج الدوال: دمجت دالة hdate من ملفك مباشرة في الكود ليعمل كملف واحد متكامل (Stand-alone).
3. إصلاح الأسماء: في ملفك كان هناك شرط if ($vbulletin->userinfo...) تسبب في جعل الأسماء تظهر بلغة غريبة (Escape characters)، قمت بتبسيطها لتظهر بالعربية مباشرة.
4. تنسيق الجدول: جعلت الجدول يعرض التاريخ الميلادي والهجري جنباً إلى جنب مع يوم الأسبوع بالعربي.
ملاحظة: تأكد من أن ملف PrayTime.php موجود في نفس المجلد، وإلا سيتوقف الكود عن العمل. هل كل شيء يعمل كما توقعت؟

قديم 04-27-2026, 09:09 PM
المشاركة 10
codeNET
.:: عضو فعال ::.
  • codeNET غير متواجد حالياً
افتراضي رد: جدول اوقات الصلاة الشهري غير منسق
تم دمج الكود لك وتحسين علية ..
مع تحياتي لك
اخوك مهدي حميد ..

* ان احتجت اي شيء اخرى لاتردد في طرح مشاكلك بخصوص اكواد الاسلامية .

اضافة رد

العلامات المرجعية

جدول اوقات الصلاة الشهري غير منسق


أدوات الموضوع

الانتقال السريع
المواضيع المتشابهه للموضوع: جدول اوقات الصلاة الشهري غير منسق
الموضوع كاتب الموضوع المنتدى مشاركات آخر مشاركة
هل الدخل الشهري للشخص يؤثر على متوسط ​​العمر المتوقع هيلبرنت الركن العام للمواضيع العامة 0 06-19-2019 12:22 AM
اغلق حاسوبك في اوقات معينة من خلال هذه الطريقة هيلبرنت برامج كمبيوتر 0 09-27-2018 10:34 PM
حذف جدول thead الموجود في Forumhome تلوين ركن مشاكل تصاميم الاستايلات 2 04-30-2018 05:18 AM
اوقات الصلاة اليوم بمصر 5-12-2016 هيلبرنت الركن العام للمواضيع العامة 0 12-05-2016 02:13 PM
شرح حذف جدول خيارات العرض في الاقسام safwan khazraji ركن تطوير منتديات vb3.8.0 2 01-20-2016 09:37 PM




الساعة الآن 08:06 AM
RSS 2.0XML Site MapTAGS SiteInfo SiteRSS FeedMap SectionsvB MapsMap TagSitemap ForumMaps Forum