رفتن به مطلب

شمسی کردن اسکریپت


AmiRoo

پست های پیشنهاد شده

درود دوستان من یه اسکریپت دارم که فارسی و شمسی شده اما چند قیمت تاریخش شمسی نشده ممنون میشم راهنمایی کنید.

نمونه قسمت شمسی شده:

<table cellpadding="0" cellspacing="0" border="0" class="table table-bordered">
        <thead>
            <tr>
                <th><?php echo get_phrase('select_date');?></th>
                <th><?php echo get_phrase('select_month');?></th>
                <th><?php echo get_phrase('select_year');?></th>
                <th><?php echo get_phrase('select_class');?></th>
                <th><?php echo get_phrase('select_date');?></th>
           </tr>
       </thead>
        <tbody>
            <form method="post" action="<?php echo base_url();?>index.php?teacher/attendance_selector" class="form">
                <tr class="gradeA">
                    <td>
                        <select name="date" class="form-control">
                            <?php for($i=1;$i<=31;$i++):?>
                                <option value="<?php echo $i;?>"
                                    <?php if(isset($date) && $date==$i)echo 'selected="selected"';?>>
                                        <?php echo $i;?>
                                            </option>
                            <?php endfor;?>
                        </select>
                    </td>
                    <td>
                        <select name="month" class="form-control">
                            <?php
                            for($i=1;$i<=12;$i++):
                                if($i==1)$m='january';
                                else if($i==2)$m='february';
                                else if($i==3)$m='march';
                                else if($i==4)$m='april';
                                else if($i==5)$m='may';
                                else if($i==6)$m='june';
                                else if($i==7)$m='july';
                                else if($i==8)$m='august';
                                else if($i==9)$m='september';
                                else if($i==10)$m='october';
                                else if($i==11)$m='november';
                                else if($i==12)$m='december';
                            ?>
                                <option value="<?php echo $i;?>"
                                    <?php if($month==$i)echo 'selected="selected"';?>>
                                        <?php echo $m;?>
                                            </option>
                            <?php
                            endfor;
                            ?>
                        </select>
                    </td>
                    <td>
                        <select name="year" class="form-control">
                            <?php for($i=2020;$i>=2010;$i--):?>
                                <option value="<?php echo $i;?>"
                                    <?php if(isset($year) && $year==$i)echo 'selected="selected"';?>>
                                        <?php echo $i;?>
                                            </option>
                            <?php endfor;?>
                        </select>
                    </td>
                    <td>
                        <select name="class_id" class="form-control">
                            <?php
                            $classes    =    $this->db->get('class')->result_array();
                            foreach($classes as $row):?>
                            <option value="<?php echo $row['class_id'];?>"
                                <?php if(isset($class_id) && $class_id==$row['class_id'])echo 'selected="selected"';?>>
                                    <?php echo $row['name'];?>
                                          </option>
                            <?php endforeach;?>
                        </select>

                    </td>
                    <td align="center"><input type="submit" value="<?php echo get_phrase('manage_attendance');?>" class="btn btn-info"/></td>
                </tr>
            </form>
        </tbody>
    </table>

<?php if($date!='' && $month!='' && $year!='' && $class_id!=''):?>

<center>
    <div class="row">
        <div class="col-sm-offset-4 col-sm-4">
        
            <div class="tile-stats tile-white-gray">
                <div class="icon"><i class="entypo-suitcase"></i></div>
                <?php
                   $full_date    =    $year.'-'.$month.'-'.$date;
                    $timestamp = strtotime($full_date);
                    $day = strtolower(date('l', $timestamp));
                 ?>
                <h2><?php echo ucwords($day);?></h2>
                
                <h3>Attendance of class <?php echo ($class_id);?></h3>
                <p><?php echo $date.'-'.$month.'-'.$year;?></p>
            </div>
        </div>
    </div>
</center>






<div class="row">
<div class="col-sm-offset-3 col-md-6">
    <table  class="table table-bordered">
        <thead>
            <tr class="gradeA">
                <th><?php echo get_phrase('roll');?></th>
                <th><?php echo get_phrase('name');?></th>
                <th><?php echo get_phrase('status');?></th>
            </tr>
        </thead>
        <tbody>
                
            <?php
            //STUDENTS ATTENDANCE
            $students    =    $this->db->get_where('student' , array('class_id'=>$class_id))->result_array();
                
            foreach($students as $row)
            {
                ?>
                <tr class="gradeA">
                    <td><?php echo $row['roll'];?></td>
                    <td><?php echo $row['name'];?></td>
                    <td align="center">
                        <?php
                        //inserting blank data for students attendance if unavailable
                        $verify_data    =    array(    'student_id' => $row['student_id'],
                                                    'date' => $full_date);
                        $query = $this->db->get_where('attendance' , $verify_data);
                        if($query->num_rows() < 1)
                        $this->db->insert('attendance' , $verify_data);
                        
                        //showing the attendance status editing option
                        $attendance = $this->db->get_where('attendance' , $verify_data)->row();
                        $status        = $attendance->status;
                        ?>
                        
                        <form method="post" action="<?php echo base_url();?>index.php?teacher/manage_attendance/<?php echo $date.'/'.$month.'/'.$year.'/'.$class_id;?>">
                            <select name="status" class="form-control" style="width:100px; float:left;">
                                <option value="0" <?php if($status == 0)echo 'selected="selected"';?>></option>
                                <option value="1" <?php if($status == 1)echo 'selected="selected"';?>>Present</option>
                                <option value="2" <?php if($status == 2)echo 'selected="selected"';?>>Absent</option>
                            </select>
                            <input type="hidden" name="student_id"             value="<?php echo $row['student_id'];?>" />
                            <input type="hidden" name="date"                     value="<?php echo $full_date;?>" />
                            <input type="submit" class="btn btn-default"     value="save" style="float:left; margin:0px 10px;">
                        </form>
                    </td>
                </tr>
                <?php
            }
            ?>
    </table>
</div>
</div>
<?php endif;?>[/PHP]


نمونه قسمت شمسینشده (میخوام شمسی کنم این صفحه را)

[PHP]<head>
    <script src="jdate.js" type="text/javascript" charset="utf-8"></script>
    <script src="jdate.min.js" type="text/javascript" charset="utf-8"></script>
</head>
<hr />
<?php echo form_open(base_url() . 'index.php?parents/attendance_report_selector/'.$student_id); ?>
<div class="row">

    <div class="col-md-offset-3 col-md-2">
         <div class="form-group">
            <label class="control-label" style="margin-bottom: 5px;"><?php echo get_phrase('month'); ?></label>
            <select name="month" class="form-control selectboxit">
                <?php
                for ($i = 1; $i <= 12; $i++):
                    if ($i == 1)
                        $m = 'january';
                    else if ($i == 2)
                        $m = 'february';
                    else if ($i == 3)
                        $m = 'march';
                    else if ($i == 4)
                        $m = 'april';
                    else if ($i == 5)
                        $m = 'may';
                    else if ($i == 6)
                        $m = 'june';
                    else if ($i == 7)
                        $m = 'july';
                    else if ($i == 8)
                        $m = 'august';
                    else if ($i == 9)
                        $m = 'september';
                    else if ($i == 10)
                        $m = 'october';
                    else if ($i == 11)
                        $m = 'november';
                    else if ($i == 12)
                        $m = 'december';
                    ?>
                    <option value="<?php echo $i; ?>"
                          <?php if($month == $i) echo 'selected'; ?>  >
                                <?php echo get_phrase($m); ?>
                    </option>
                    <?php
                endfor;
                ?>
            </select>
         </div>
    </div>

    <div class="col-md-2">
        <div class="form-group">
            <label class="control-label" style="margin-bottom: 5px;"><?php echo get_phrase('sessional_year'); ?></label>
            <select class="form-control selectboxit" name="sessional_year" disabled>
                <?php
                $sessional_year_options = explode('-', $running_year); ?>
                <option value="<?php echo $sessional_year_options[0]; ?>"><?php echo $sessional_year_options[0]; ?></option>
                <option value="<?php echo $sessional_year_options[1]; ?>"><?php echo $sessional_year_options[1]; ?></option>
            </select>
        </div>
    </div>

    <input type="hidden" name="operation" value="selection">
    <input type="hidden" name="year" value="<?php echo $running_year;?>">

    <div class="col-md-2" style="margin-top: 20px;">
        <button type="submit" class="btn btn-info"><?php echo get_phrase('show_report');?></button>
    </div>
</div>

<?php echo form_close(); ?>


<!-- Attendance Table starts from here -->
<?php if ($class_id != '' && $section_id != '' && $month != '' && $sessional_year != '' && $student_id != ''): ?>

    <br>
    <div class="row">
        <div class="col-md-4"></div>
        <div class="col-md-4" style="text-align: center;">
            <div class="tile-stats tile-gray">
                <div class="icon"><i class="entypo-docs"></i></div>
                <h3 style="color: #696969;">
                    <?php
                    $section_name = $this->db->get_where('section', array('section_id' => $section_id))->row()->name;
                    $class_name = $this->db->get_where('class', array('class_id' => $class_id))->row()->name;
                    if ($month == 1)
                        $m = 'January';
                    else if ($month == 2)
                        $m = 'February';
                    else if ($month == 3)
                        $m = 'March';
                    else if ($month == 4)
                        $m = 'April';
                    else if ($month == 5)
                        $m = 'May';
                    else if ($month == 6)
                        $m = 'June';
                    else if ($month == 7)
                        $m = 'July';
                    else if ($month == 8)
                        $m = 'August';
                    else if ($month == 9)
                        $m = 'Sepetember';
                    else if ($month == 10)
                        $m = 'October';
                    else if ($month == 11)
                        $m = 'November';
                    else if ($month == 12)
                        $m = 'December';
                    echo get_phrase('attendance_sheet');
                    ?>
                </h3>
                <h4 style="color: #696969;">
    <?php echo get_phrase('class') . ' ' . $class_name; ?> : <?php echo get_phrase('section');?> <?php echo $section_name; ?><br>
    <?php echo $m . ', ' . $sessional_year; ?>
                </h4>
            </div>
        </div>
        <div class="col-md-4"></div>
    </div>


    <hr />

    <div class="row">
        <div class="col-md-12">
            <table class="table table-bordered" id="my_table">
                <thead>
                    <tr>
                        <td style="text-align: center;">
    <?php echo get_phrase('students'); ?> <i class="entypo-down-thin"></i> | <?php echo get_phrase('date'); ?> <i class="entypo-right-thin"></i>
                        </td>
                        <?php
                        //inserting blank data for students attendance if unavailable
                        $verify_data    =    array(    'student_id' => $row['student_id'],
                                                    'date' => $full_date);
                        $query = $this->db->get_where('attendance' , $verify_data);
                        if($query->num_rows() < 1)
                        $this->db->insert('attendance' , $verify_data);
                       
                        //showing the attendance status editing option
                        $attendance = $this->db->get_where('attendance' , $verify_data)->row();
                        $status        = $attendance->status;
                        ?>
                            <td style="text-align: center;"><?php echo $i; ?></td>
                    <?php } ?>

                    </tr>
                </thead>

                <tbody>
                            <?php
                            $jdata = array();

                            $students = $this->db->get_where('enroll', array('student_id' => $student_id,'class_id' => $class_id, 'year' => $running_year, 'section_id' => $section_id))->result_array();
                            if (sizeof($students) > 0):
                            foreach ($students as $row):
                                ?>
                        <tr>
                            <td style="text-align: center;">
                            <?php echo $this->db->get_where('student', array('student_id' => $row['student_id']))->row()->name; ?>
                            </td>
                            <?php
                            $status = 0;
                            for ($i = 1; $i <= $days; $i++) {
                                $timestamp = strtotime($i . '-' . $month . '-' . $sessional_year);
                                $this->db->group_by('timestamp');
                                $attendance = $this->db->get_where('attendance', array('section_id' => $section_id, 'class_id' => $class_id, 'year' => $running_year, 'timestamp' => $timestamp, 'student_id' => $row['student_id']))->result_array();


                                foreach ($attendance as $row1):
                                    $month_dummy = date('d', $row1['timestamp']);

                                    if ($i == $month_dummy)
                                    $status = $row1['status'];


                                endforeach;
                                ?>
                                <td style="text-align: center;">
            <?php if ($status == 1) { ?>
                                        <i class="entypo-record" style="color: #00a651;"></i>
                            <?php  } if($status == 2)  { ?>
                                        <i class="entypo-record" style="color: #ee4749;"></i>
            <?php  } $status =0;?>


                                </td>

        <?php } ?>
    <?php endforeach; ?>
  <?php endif; ?>

                    </tr>

    <?php ?>

                </tbody>
            </table>
            <center>
                <a href="https://go.20script.ir/index.php?url=<?php echo base_url(); ?>index.php?parents/attendance_report_print_view/<?php echo $class_id; ?>/<?php echo $section_id; ?>/<?php echo $month; ?>/<?php echo $sessional_year; ?>/<?php echo $student_id; ?>"
                   class="btn btn-primary" target="_blank">
    <?php echo get_phrase('print_attendance_sheet'); ?>
                </a>
            </center>
        </div>
    </div>
<?php endif; ?>
[/PHP]

ممنون میشم راهنمایی کنید.
 
لینک به دیدگاه
به اشتراک گذاری در سایت های دیگر

اگر افزونه رو شمسی کردید خب دسترسی کلی برای تبدیل تاریخ دارید

از کد کهنمیشه فهمید کجا براتون مشکل داره کجا نداره ولی بطور کلی کد قسمتی که به درستی نمایش داده رو در بیارید

ببینید با چه متدی تاریخ شمسی فراخوانی شده

و برعکس کد محل میلادی رو در بیارید و متد فراخوانی رو برسی کنید که درصورت تفاوت باید از اون مقادیر بخش شمسی استفاده کنید

لینک به دیدگاه
به اشتراک گذاری در سایت های دیگر

بایگانی شده

این موضوع بایگانی و قفل شده و دیگر امکان ارسال پاسخ نیست.

مهمان
این موضوع برای عدم ارسال قفل گردیده است.
×
×
  • اضافه کردن...