<?php include("parent/callMe.php"); ?>

<?php  include("sessioncheck.php"); 



// code start script for admin dashboard access



$usrID=$_SESSION['user_id'];

$b=$_SESSION['branch'];



// it will be check tab access against user

$chekUserAccess="SELECT acc.page_id,acc.module_id,acc.user_id,acc.branch_id,acc.page_tab_id FROM eduportal_page_tab_access as acc WHERE acc.branch_id='$b' and acc.user_id = '$usrID' and acc.page_id='51'";

$UserAccess=$m->query($chekUserAccess);





// it will be check allow access this page (admin dashboard) against user



$UserPrivilege="SELECT * FROM users_privilege_detail WHERE branch_id='$b' and user_id = '$usrID' and page_id='51'"; 

$UserPri=$m->query($UserPrivilege);





if (count($UserAccess) == 0 && count($UserPri) > 0 ) {

    

    $lin="SELECT *  FROM eduportal_page_tabe_links WHERE page_id='51'";   

    $links = $m->query($lin);



    foreach ($links as $link) {



        $data = array(



        'page_id' => $link['page_id'],



        'module_id' => $link['module_id'],



        'user_id' => $usrID,



        'branch_id' => $_SESSION['branch'],     



        'page_tab_id' => $link['page_tab_id']);



       // echo "<pre>"; print_r($data); echo "</pre>";





        $m->insert ('eduportal_page_tab_access', $data);

       

    }





}







// code to update the credit limit at every new month

$branch_details=getBranch($m);

if(date("d")==01 || date("d")==1 || date("d")=="01" || date("d")=="1" && $branch_details[0]['payment_type']=="Monthly" ){    



   // echo "==".date("d")."==";

    $data = array('sms_limit' => $branch_details[0]['monthly_credit']);

    $m->where("branch_id", $_SESSION['branch']);

    $result =  $m->update ('edu_branch_config', $data);



}  // ending if    





// code to update the whatsapp credit limit at every day



if(date('h:i')=="06:15" ){    



   // echo "==".date("d")."==";

    $data = array('whatsapp_remaining_sms' => $branch_details[0]['whatsapp_sms_limit']);

    $m->where("branch_id", $_SESSION['branch']);

    $result =  $m->update ('edu_branch_config', $data);



}  // ending if 



    $m->where("session_id", $_SESSION['current_session']);

    $sessionname = $m->get("edu_session_config");

    $yr=explode("-",$sessionname[0]['session_year']);



    $branch=$_SESSION['branch'];





    $usrID=$_SESSION['user_id'];

$b=$_SESSION['branch'];

$chekUserAccess="SELECT acc.page_id,acc.module_id,acc.user_id,acc.branch_id,acc.page_tab_id, link.page_id,link.module_id,link.tab_title,link.tab_link FROM eduportal_page_tab_access as acc, eduportal_page_tabe_links as link WHERE acc.page_tab_id=link.page_tab_id and acc.branch_id='$b' and acc.user_id = '$usrID' and acc.page_id='51'"; 

 

   $UserAccess=$m->query($chekUserAccess);

   

?>

<!DOCTYPE html>

<html lang="en">

  <head>

    <title> Dashboard | EduPortal </title>

    <!-- bootstrap-progressbar -->

    <link href="../vendors/bootstrap-progressbar/css/bootstrap-progressbar-3.3.4.min.css" rel="stylesheet">

    <?php include('RootMe/css_links.php');?>

    <script src="https://cdn.zingchart.com/zingchart.min.js"></script>

    <script src="https://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>



     <!-- Flaticon CSS -->

    <link rel="stylesheet" href="fonts/flaticon.css">

       

    <link rel="stylesheet" href="stylebox.css">





<style>



@media only screen and (max-width: 768px) {



    /* For mobile phones: */



     .quiklink{

      width: 48%;

      float: left;

    }



}



@media (min-width:801px)  { /* tablet, landscape iPad, lo-res laptops ands desktops */



  .quiklink{

      width: 12%;

      float: left;

      margin-bottom: 10px;

    }



  }



ul.widget_tally .month {

    width: 70%;

    float: left;

    text-align: left;

}

#myChart {

  height:100%;

  width:100%;

  min-height:400px;

}



.zc-ref {

  display: none;

}

zing-grid[loading]{height:450px;}</style>

  </head>

  <style type="text/css">

      .tile-stats .icon i{

        font-size: 35px; 

      }

    </style>

  <style>

.vl {

  border-left: 1px solid lightgray;

  height: 40px;

  position: absolute;

  left: 50%;

  margin-left: -3px;

  margin-top: 24px;

}

</style>



  

  <body class="nav-md" onload="loadDoc();">

    <div class="container body">

      <div class="main_container">

        <div class="col-md-3 left_col">

     

       <div ><?php include("RootMe/sidebar.php"); ?> </div>

       <div ><?php include("RootMe/header.php"); ?> </div>

       

     

        <!-- page content -->

        <div class="right_col" role="main">

          <div class="">

            <div class="row top_tiles">







<?php if ($brid[0]['sms_service']== 1 && $brid[0]['sms_service_remarks']!=NULL) { ?>  

<div class="col-md-12 tile-stats" style="background-color: #C82333; color: white; margin-bottom: 10px;">

<marquee style="padding-top: 8px;" width="100%" direction="left" height="30px" onmouseover="this.stop();"

onmouseout="this.start();">

<?php echo $brid[0]['sms_service_remarks']; ?>

</marquee>

</div>

<?php  } ?>





    <?php

foreach ($UserAccess as $key) {



if ($key['tab_title'] == 'Short Link') { ?>



<div style="background-color: white; margin-bottom: 10px;">



  <!-- <a href="more_statistics.php" class="btn btn-round btn-primary quiklink"style="font-size:12px;">Adm & Attendance Stats</a> -->

  <a href="students_reports.php" class="btn btn-round btn-info quiklink">Students Report</a>

  <a href="mark_attendance_list.php" class="btn btn-round btn-primary quiklink">Mark Attendance</a>

  <a href="new_sms.php" class="btn btn-round btn-success quiklink">New SMS</a>

  <a href="sent_sms.php" class="btn btn-round btn-dark quiklink">Sent SMS</a>

  <a href="pay_fee.php" class="btn btn-round btn-primary quiklink">Student Pay Fee</a>

  <!-- <a href="view_challan.php" class="btn btn-round btn-info quiklink">View Challan</a> -->

  <a href="families.php" class="btn btn-round btn-warning quiklink">Families</a>

  <a href="monthly_attendance.php" class="btn btn-round btn-danger quiklink">Emp Attendance</a>

  <a href="view_emp.php" class="btn btn-round btn-primary quiklink">View Emp</a>

  <a href="print_daily_income_exp_report.php" class="btn btn-round btn-warning quiklink" >

  Daily Closing</a>

  <a href="add_expenses.php" class="btn btn-round btn-dark quiklink">Expenses</a>

  <a href="print_profitloss_report.php" class="btn btn-round btn-info quiklink">Monthly Closing</a>

  <a href="user_audit_report.php" class="btn btn-round btn-danger quiklink">Users Activities</a>  

  <a href="fee_reporting.php" class="btn btn-round btn-info quiklink">Fee Reports</a>

  <a href="add_marksheet.php" class="btn btn-round btn-success quiklink">Add Marks</a>  

  <a href="parents_id.php" class="btn btn-round btn-info quiklink">View Parents IDs</a>

  <a href="old_student_profile.php" class="btn btn-round btn-dark quiklink">Old Students</a>

  

  



</div>



<?php } 



} ?>



   <div id="boxes"><?php include("RootMe/box_stats.php"); ?></div>





                

    </div>

    </div>

          

            </div>

          </div>

        </div>

        <!-- /page content -->

  



    <?php include('RootMe/js_linksscript.php');?>



  </body>

</html>

