如何从SQL表发布数据

时间:2018-11-09 13:28:47

标签: php html mysql sql wordpress

尝试开发与学校管理相关的Wordpress插件。对我来说不幸的是,卖方没有答复或提供支持,这使我对代码有所了解。

我想做的是,每当学生缺席,在场甚至迟到时,父母都必须阅读其背后的原因。 这是老师的出勤面板:

Teacher Panel

现在,每当父母要检查孩子时,这就是他所看到的:

Parent panel

如您所见,我添加了一条注释,希望我也可以抓住$ comment但失败了。 添加以下代码段:

echo '<td>';
        echo $comment;
        echo '</td>';

根本没有帮助。

以下是代码:

<?php 
$obj_mark = new Marks_Manage();


?>
<script>
$(document).ready(function() {
    $('#student_list').DataTable({
        responsive: true
    });
} );
</script>
<!-- POP up code -->
<div class="popup-bg">
    <div class="overlay-content">

     <div class="result"></div>
      <div class="view-parent"></div>
       <div class="view-attendance"></div>

    </div> 
</div>
<?php if(isset($_REQUEST['attendance']) && $_REQUEST['attendance'] == 1)
{
    ?>
    <div class="panel-body panel-white">
 <ul class="nav nav-tabs panel_tabs" role="tablist">
      <li class="active">
          <a href="#child" role="tab" data-toggle="tab">
             <i class="fa fa-align-justify"></i> <?php _e('Attendance', 'school-mgt'); ?></a>
          </a>
      </li>
</ul>


<div class="tab-content">

            <div class="panel-body">
<form name="wcwm_report" action="" method="post">
<input type="hidden" name="attendance" value=1> 
<input type="hidden" name="user_id" value=<?php echo $_REQUEST['student_id'];?>>       
    <div class="form-group col-md-3">
        <label for="exam_id"><?php _e('Strat Date','school-mgt');?></label>


                <input type="text"  class="form-control" name="sdate" value="<?php if(isset($_REQUEST['sdate'])) echo $_REQUEST['sdate'];else echo date('Y-m-d');?>">

    </div>
    <div class="form-group col-md-3">
        <label for="exam_id"><?php _e('End Date','school-mgt');?></label>
            <input type="text"  class="form-control" name="edate" value="<?php if(isset($_REQUEST['edate'])) echo $_REQUEST['edate'];else echo date('Y-m-d');?>">

    </div>
    <div class="form-group col-md-3 button-possition">
        <label for="subject_id">&nbsp;</label>
        <input type="submit" name="view_attendance" Value="<?php _e('Go','school-mgt');?>"  class="btn btn-info"/>
    </div>  
</form>
<div class="clearfix"></div>
<?php if(isset($_REQUEST['view_attendance']))
{
    $start_date = $_REQUEST['sdate'];
    $end_date = $_REQUEST['edate'];
    $user_id = $_REQUEST['user_id'];
    $comment = $_REQUEST['comment'];
    $attendance = smgt_view_student_attendance($start_date,$end_date,$user_id,$comment);

    $curremt_date =$start_date;
    ?>
     <div class="table-responsive">
    <table class="table col-md-12">
    <tr>
    <th width="200px"><?php _e('Date','school-mgt');?></th>
    <th><?php _e('Day','school-mgt');?></th>
    <th><?php _e('Attendance','school-mgt');?></th>
    <th><?php _e('Comment', 'school-mgt');?></th>
    </tr>
    <?php 
    while ($end_date >= $curremt_date)
    {
        echo '<tr>';
        echo '<td>';
        echo $curremt_date;
        echo '</td>';

        $attendance_status = smgt_get_attendence($user_id,$curremt_date);
        echo '<td>';
        echo date("D", strtotime($curremt_date));
        echo '</td>';

        if(!empty($attendance_status))
        {
            echo '<td>';
            echo smgt_get_attendence($user_id,$curremt_date);
            echo '</td>';
        }
        else 
        {
            echo '<td>';
            echo __('Absent','school-mgt');
            echo '</td>';
        }

            echo '<td>';
            echo $comment;
            echo '</td>';

        echo '</tr>';
        $curremt_date = strtotime("+1 day", strtotime($curremt_date));
        $curremt_date = date("Y-m-d", $curremt_date);
    }
?>
</table>
</div>
<?php }?>
</div>
</div>
</div>
    <?php 
}
else 
{?>
<div class="panel-body panel-white">
 <ul class="nav nav-tabs panel_tabs" role="tablist">
      <li class="active">
          <a href="#child" role="tab" data-toggle="tab">
             <i class="fa fa-align-justify"></i> <?php _e('Child List', 'school-mgt'); ?></a>
          </a>
      </li>
</ul>


<div class="tab-content">

            <div class="panel-body">
<form name="wcwm_report" action="" method="post">
     <div class="table-responsive">
        <table id="student_list" class="display dataTable" cellspacing="0" width="100%">
             <thead>
            <tr>
                <th width="75px"><?php  _e( 'Photo', 'school-mgt' ) ;?></th>
                <th><?php echo _e( 'Child Name', 'school-mgt' ) ;?></th>
                <th><?php _e('Roll No.','school-mgt');?></th>
                <th> <?php echo _e( 'Class', 'school-mgt' ) ;?></th>
                <th> <?php echo _e( 'Child Email', 'school-mgt' ) ;?></th>
                <th><?php echo _e( 'Action', 'school-mgt' ) ;?></th>
            </tr>
        </thead>

        <tfoot>
            <tr>
               <th><?php echo _e( 'Photo', 'school-mgt' ) ;?></th>
               <th><?php echo _e( 'Child Name', 'school-mgt' ) ;?></th>
                <th><?php _e('Roll No.','school-mgt');?></th>
                <th> <?php echo _e( 'Class', 'school-mgt' ) ;?></th>
                <th> <?php echo _e( 'Child Email', 'school-mgt' ) ;?></th>

                 <th><?php echo _e( 'Action', 'school-mgt' ) ;?></th>

            </tr>
        </tfoot>

        <tbody>
         <?php 

            if(!empty($school_obj->child_list))
            {
                foreach ($school_obj->child_list as $child_id){ 
                $retrieved_data= get_userdata($child_id);
                if($retrieved_data)
                {

         ?>
            <tr>
                <td class="user_image text-center"><?php $uid=$retrieved_data->ID;
                            $umetadata=get_user_image($uid);
                            if(empty($umetadata['meta_value']))
                                //echo get_avatar($retrieved_data->ID,'46');
                                echo '<img src='.get_option( 'smgt_student_thumb' ).' height="50px" width="50px" class="img-circle" />';
                            else
                            echo '<img src='.$umetadata['meta_value'].' height="50px" width="50px" class="img-circle"/>';
                ?></td>
                <td class="name"><?php echo $retrieved_data->display_name;?></td>
                <td><?php echo get_user_meta($retrieved_data->ID, 'roll_id',true);?></td>
                <td class="name"><?php $class_id=get_user_meta($retrieved_data->ID, 'class_name',true);
                                    echo $classname=    get_class_name($class_id);
                ?></td>
                <td class="email"><?php echo $retrieved_data->user_email;?></td>

                <td class="action"> 
                                    <a href="?dashboard=user&page=student&action=result&student_id=<?php echo $retrieved_data->ID;?>" class="show-popup btn btn-default"  
                                    idtest="<?php echo $retrieved_data->ID; ?>"><i class="fa fa-bar-chart"></i> <?php _e('View Result','school-mgt');?></a> 
                                    <a href="?dashboard=user&page=student&tab=studentlist&action=showparent&student_id=<?php echo $retrieved_data->ID;?>" class="show-parent btn btn-default"  
                                    idtest="<?php echo $retrieved_data->ID; ?>"><i class="fa fa-user"></i><?php _e('View Parent','school-mgt');?> </a>
                                    <a href="?dashboard=user&page=child&student_id=<?php echo $retrieved_data->ID;?>&attendance=1" class="btn btn-default"  
                                    idtest="<?php echo $retrieved_data->ID; ?>"><i class="fa fa-eye"></i> <?php _e('View Attendance','school-mgt');?> </a>
                </td>

            </tr>
                <?php  }
                } 
            }
            ?>

        </tbody>

        </table>
       </div>

</form>
</div>
</div>
</div>
<?php 
}
?>

0 个答案:

没有答案