<?php
include("../public/impOpreation.php");
require_once('../library/http_call.php');

require_once('../models/dao/YoutubeLinkDAO.class.php');
require_once('../models/dto/YoutubeLink.class.php');
require_once('../models/mysql/YoutubeLinkMySqlDAO.class.php');
require_once('../models/mysql/ext/YoutubeLinkMySqlExtDAO.class.php');

$youtubeLink = new YoutubeLink();
$youtubeLinkDAO = new YoutubeLinkMySqlDAO();
$youtubeLinkEX = new YoutubeLinkMySqlExtDAO();
$do = $_GET['do'];
$today = date("Y-m-d H:i:s");
$date = date("Y-m-d");

if (empty($do)) { 
    $studentsetting = R::load('studentsetting',1);
    $smarty->assign("studentsetting",$studentsetting);
    $smarty->assign('date', $date);
    $smarty->display("header.html"); 
    $smarty->display("studentspayview/add.html");
    $smarty->assign("student", 1);
    $smarty->display("footer.html");
} elseif ($do == "show") {
    include_once("../public/authentication.php");
    $studentsetting = R::load('studentsetting',1);
    $smarty->assign("studentsetting",$studentsetting);
    $smarty->assign('date', $date);
    $youtubes = $youtubeLinkDAO->queryAll();
    $smarty->assign("youtubes", $youtubes);
    $smarty->display("header.html"); 
    $smarty->display("studentspayview/show.html");
    $smarty->assign("student", 1);
    $smarty->display("footer.html");
} elseif ($do == "edit") {
    include_once("../public/authentication.php");
    $id = filter_input(INPUT_GET, 'id');
    $detail = filter_input(INPUT_GET, 'detail');
    $studentspaydata = R::load('studentspays', $id);
    $studentsubjects = R::load('studentsubjects', $studentspaydata->studentsubjectid);
    $studentsubjectgroups = R::load('studentsubjectgroups', $studentspaydata->studentsubjectid);
    $studentspaydata->studentsubjects =$studentsubjects->subjectname.'/'.$studentsubjectgroups->subjectgroupname.'/'.$studentsubjectgroups->subjectgroupprice;
    $studentspaymentsystems = R::load('studentspaymentsystems', $studentspaydata->studentspaymentsystemid);
    $studentspaydata->studentspaymentsystems = $studentspaymentsystems->paymentname.'/'.$studentspaymentsystems->paymentprice;
    $students = R::load('students', $studentspaydata->studentid);
    $studentspaydata->students = $students->studentname.'/'.$students->studentphone;
    if($detail == 1){
      $studentspaydata->del = 2 ;
    }
  
    $smarty->assign('studentspaydata', $studentspaydata);
    $studentsetting = R::load('studentsetting',1);
    $smarty->assign("studentsetting",$studentsetting);
    $smarty->assign('student', 1);
    $smarty->display("header.html"); 
    $smarty->display("studentspayview/edit.html");
    $smarty->display("footer.html");
}else if ($do == 'savedata') {
  savedata();
}else if ($do == 'showajax') {
  showajax();
}else if ($do == 'getselectpayment') {
  getselectpayment();
}else if ($do == 'removerowstudentspays') {
  removerowstudentspays();
}else if ($do == 'studentspaysend') {
  studentspaysend();
}else if ($do == 'getpaystudent') {
  getpaystudent();
} elseif ($do == "printdata") {
    // include_once("../public/authentication.php");
    $id = filter_input(INPUT_GET, 'id');
    $studentspaydata = R::load('studentspays', $id);
    $studentsubjects = R::load('studentsubjects', $studentspaydata->studentsubjectid);
    $smarty->assign('studentsubjects', $studentsubjects);
    $studentsubjectgroups = R::load('studentsubjectgroups', $studentspaydata->studentsubjectid);
    $smarty->assign('studentsubjectgroups', $studentsubjectgroups);
    $studentspaymentsystems = R::load('studentspaymentsystems', $studentspaydata->studentspaymentsystemid);
    $smarty->assign('studentspaymentsystems', $studentspaymentsystems);
    $students = R::load('students', $studentspaydata->studentid);
    $smarty->assign('students', $students);
    $smarty->assign('studentspaydata', $studentspaydata);
   
  
 
    $smarty->display("studentspayview/printdata.html");

}else if ($do == 'getstudentid') {
  getstudentid();
}




function savedata() {
    $today = date("Y-m-d H:i:s");
    $date = date('Y-m-d');
    $userid = $_SESSION['userid'];
    $studentaddsubjectid = filter_input(INPUT_POST, 'studentaddsubjectid');
    $studentspaymentsystemid = filter_input(INPUT_POST, 'studentspaymentsystemid');
    $studentaddsubjectdetailid = filter_input(INPUT_POST, 'studentaddsubjectdetailid');
    $payenddate = filter_input(INPUT_POST, 'payenddate');
    $countmonths = filter_input(INPUT_POST, 'countmonths');
    $newprice = filter_input(INPUT_POST, 'newprice');
    $studentspayid = filter_input(INPUT_POST, 'studentspayid');
    $paytypered = filter_input(INPUT_POST, 'paytypered');
    $paykind = filter_input(INPUT_POST, 'paykind');
    $studentaddsubjects = R::load('studentaddsubjects',$studentaddsubjectid);
    $studentaddsubjectdetails = R::load('studentaddsubjectdetails',$studentaddsubjectdetailid);
    $studentsubjectgroups = R::load('studentsubjectgroups',$studentaddsubjects->studentsubjectgroupid);
    $studentspaymentsystems = R::load('studentspaymentsystems',$studentspaymentsystemid);


    if ($studentaddsubjectid && !$studentspaymentsystemid && !$newprice && !$countmonths) {
        $studentsubjects = R::load('studentsubjects',$studentaddsubjects->studentsubjectid);
        $paymonths = 1;
        $paytype = 'دفع عن طريق  الماده';
        $payprice = $studentsubjectgroups->subjectgroupprice;
        $paytypenum = 1;
        $textpay = $studentsubjects->subjectname;

     }else if ($studentaddsubjectid && $studentspaymentsystemid && !$newprice && !$countmonths) {
        $paymonths = $studentspaymentsystems->paymentmonth;
        $paytype = "نظام دفع";
        $payprice = $studentspaymentsystems->paymentprice;
        $paytypenum = 2;
        $textpay = $studentspaymentsystems->paymentname;
     }else{
        $paymonths = $countmonths;
        $paytype = 'دفع  خاص';
        $payprice = $newprice;
        $paytypenum = 3;
        $textpay = 'دفع  خاص'; 
     } 
      

    
    if (!$studentspayid) {
        $studentspays = R::dispense('studentspays');
        $studentspays->del = 0;
        $studentspays->addtoday = $today;          
        $studentspays->adduserid = $userid;
        $studentspays->deltoday = '';  
        $studentspays->deluserid = '';
    }else{
       $studentspays = R::load('studentspays',$studentspayid); 
       $studentspays->del = 1;
       $studentspays->updatetoday = $today;          
       $studentspays->updateuserid = $userid;
       $paystartdates = date('Y-m-d', strtotime("-".$studentspays->paymonths." month", strtotime($studentspays->paystartdate)));
       $payenddates = date('Y-m-d', strtotime("-".$studentspays->paymonths." month", strtotime($studentspays->payenddate)));
        R::exec("UPDATE `studentspays` SET `paystartdate`= '$paystartdates' , `payenddate`= '$payenddates' WHERE id = $studentspayid ");
    }
    $getstudentpaysubject = R::findOne('studentspays','studentid = ? and studentsubjectid = ? and del < 2 order by id desc',[$studentaddsubjectdetails->studentid,$studentaddsubjects->studentsubjectid]); 
    if ($getstudentpaysubject->id < 1 || $getstudentpaysubject->payenddate < date('Y-m-d')) {
        $paystartdate = date('Y-m-d');
    }else {
        $paystartdate = $getstudentpaysubject->payenddate;
    }

        // $payenddate = date('Y-m-d', strtotime("+".$paymonths." month", strtotime($startdate)));
    // }else if ($getstudentpaysubject->payenddate >= $startdate) {
    // $paystartdate = $getstudentpaysubject->payenddate;
    // $payenddate = date('Y-m-d', strtotime("+".$paymonths." month", strtotime($getstudentpaysubject->payenddate))); 
    // }else if ($getstudentpaysubject->payenddate < $startdate) {
    // $paystartdate = $startdate;
    // $payenddate = date('Y-m-d', strtotime("+".$paymonths." month", strtotime($startdate))); 
    // }

    $studentspays->studentaddsubjectid = $studentaddsubjectid;
    $studentspays->studentsubjectid = $studentaddsubjects->studentsubjectid;
    $studentspays->studentsubjectgroupid = $studentaddsubjects->studentsubjectgroupid;
    $studentspays->studentspaymentsystemid = $studentspaymentsystemid;
    $studentspays->studentaddsubjectdetailid = $studentaddsubjectdetailid;
    $studentspays->studentid = $studentaddsubjectdetails->studentid;
    $studentspays->paymonths  = $paymonths;
    $studentspays->paytype = $paytype;
    $studentspays->paytypenum = $paytypenum;
    $studentspays->payprice = $payprice;
    $studentspays->countmonths = $countmonths;
    $studentspays->newprice = $newprice;
    $studentspays->paystartdate  = $paystartdate;
    $studentspays->payenddate  = $payenddate;
    $studentspays->paytypered  = $paytypered;
    $studentspays->paykind  = $paykind;
    try {
        $studentspayid2 = R::store($studentspays);
        $students2 = R::load('students',$studentaddsubjectdetails->studentid);
        $students2->studentaddsubjectid = $studentaddsubjectid;
        $students2->studentsubjectid = $studentaddsubjects->studentsubjectid;
        $students2->studentsubjectgroupid = $studentaddsubjects->studentsubjectgroupid;
        $students2->studentspaymentsystemid = $studentspaymentsystemid;
        $students2->studentaddsubjectdetailid = $studentaddsubjectdetailid;
        $students2->paymonths  = $paymonths;
        $students2->paytype = $paytype;
        $students2->paytypenum = $paytypenum;
        $students2->payprice = $payprice;
        $students2->countmonths = $countmonths;
        $students2->newprice = $newprice;
        $students2->paystartdate  = $paystartdate;
        $students2->payenddate  = $payenddate;
        $students2->studentspayid  = $studentspayid2;
        R::store($students2);
        $studentsubjects = R::load('studentsubjects',$studentaddsubjects->studentsubjectid);
        $incomeName = $students2->studentname. 'دفع  ' . $textpay . 'تاريخ الانتهاء  ' .$payenddate;
        if (!$studentspayid) {
             $send_data = array(
            'clientid' => $students2->clientid,
            'saveid' => $_SESSION['saveid'],
            'Costcenterid' => -1,
            'Value' => $payprice,
            'comment' => $paytype,
            'name' => $students2->studentname. 'دفع  ' . $textpay . 'تاريخ الانتهاء  ' .$payenddate,
            'parent' => $studentsubjects->incometypeid,
            );
            CURL_IT2($send_data, 'incomeController.php?do=add');
        }else{
            $income = R::findOne("SELECT income.* FROM `income` WHERE clientid = $students2->clientid order by incomeId desc");
             $send_data = array(
            'clientid' => $students2->clientid,
            'incomeId' => $income->incomeId,
            'dailyentryid' => $income->dailyentryid,
            'saveid' => $_SESSION['saveid'],
            'Costcenterid' => -1,
            'Value' => $payprice,
            'comment' => $paytype,
            'name' =>  $students2->studentname. 'دفع  ' . $textpay . 'تاريخ الانتهاء  ' .$payenddate,
            'parent' => $studentsubjects->incometypeid,
            );
            CURL_IT2($send_data, 'incomeController.php?do=update');
        }        
        echo $studentspayid2;
    } catch (Exception $e) {
        echo 0 ;
    }
}





function showajax() {
    $columns = array('id', 'paymentname', 'studentname', 'studentphone', 'numbermonths','subjectname','subjectprice','subjectgroupname', 'paystartdate', 'payenddate', 'addtoday', 'employeename', 'id','id');
    $start_date = $_POST['start_date'];
    $end_date   = $_POST['end_date'];
    $del        = $_POST['del'];
    $data1      = $_POST['data1'];
    $data2      = $_POST['data2'];
    $data3      = $_POST['data3'];

    $searchQuery = " ";
    if($data1 != ''){
        $searchQuery .= " and studentspays.studentid = ".$data1. " ";
    }

    if($data2 != ''){
       $searchQuery .= " and studentspays.studentsubjectid = ".$data2. " "; 
    }
    if($del == ''){
       $searchQuery .= " and studentspays.del < 2 "; 
    }

    if($data3 != ''){
       $searchQuery .= " and studentspays.studentspaymentsystemid = ".$data3. " ";
    }
    
    if($start_date != '' && $end_date != ''){
       $searchQuery .='and  studentspays.addtoday  >= "' . $start_date . ' 00-00-00" and studentspays.addtoday <= "' . $end_date . ' 23-59-55" ';
    }else{
        $today = date("Y-m-d");
        $searchQuery .='and  studentspays.addtoday  >= "' . $today . ' 00-00-00" and studentspays.addtoday <= "' . $today . ' 23-59-55" ';
    }


    if (isset($_POST['search']['value']) && $_POST['search']['value'] != "") {
    $searchQuery .= "and ( studentspays.id LIKE "%'.$_POST["search"]["value"].'%" 
                    OR studentspays.paymentname LIKE "%'.$_POST["search"]["value"].'%"
                    OR studentspays.studentname LIKE "%'.$_POST["search"]["value"].'%"
                    OR studentspays.studentphone LIKE "%'.$_POST["search"]["value"].'%"
                    OR studentspays.numbermonths LIKE "%'.$_POST["search"]["value"].'%"
                    OR studentspays.subjectname LIKE "%'.$_POST["search"]["value"].'%"
                    OR studentspays.subjectgroupname LIKE "%'.$_POST["search"]["value"].'%"
                    OR studentspays.payprice LIKE "%'.$_POST["search"]["value"].'%"
                    OR studentspays.addtoday LIKE "%'.$_POST["search"]["value"].'%"
                    OR studentspays LIKE "%'.$_POST["search"]["value"].'%"
        )
     ";
    }


    if(isset($_POST["order"]))
    {
    $searchQuery .= 'ORDER BY '.$columns[$_POST['order']['0']['column']].' '.$_POST['order']['0']['dir'].'  ';
    }
    else
    {
     $searchQuery .= "ORDER BY  studentspays.id DESC ";
    }
    
          $totals = R::count('studentspays','LEFT JOIN user ON studentspays.adduserid = user.userid WHERE 1 '.$searchQuery.' ');

    if (isset($_POST['start']) && $_POST['length'] != '-1') {
       $searchQuery .= "LIMIT " . intval($_POST['start']) . ", " .
                intval($_POST['length']);
    }
    
     $rResult = R::getAll('SELECT studentspays.paytype, studentspays.paymonths, studentspays.payprice, studentspays.paystartdate, studentspays.payenddate,
     studentspays.id as id, studentspays.addtoday as addtoday, studentspays.del as del, employeename, studentid
     ,studentsubjects.del as studentsubjectsdel ,studentsubjectgroups.del as studentsubjectgroupsdel,  
 subjectname, subjectgroupname, subjectgroupprice, studentname, studentphone  FROM `studentspays` 
 LEFT JOIN user ON studentspays.adduserid = user.userid 
  LEFT JOIN studentsubjects ON studentspays.studentsubjectid = studentsubjects.id 
 LEFT JOIN studentsubjectgroups ON studentspays.studentsubjectgroupid = studentsubjectgroups.id 
 LEFT JOIN students ON studentspays.studentid = students.id 
 WHERE studentsubjects.del < 2 and studentsubjectgroups.del < 2 and students.del < 2 '.$searchQuery.' '); 
    
    $apps = count($rResult);
     
    $output = array(  
         "draw" => intval($_POST["draw"]),    
        "recordsTotal" => intval($apps),
        "recordsFiltered" => $totals,
        "data" => array()
    );
  
       foreach ($rResult as $row) {
        $date = date('Y-m-d');
        $studentspays = R::count('studentspays',"studentid = ? and del < 2 and payenddate >= '$date'",[$row['studentid']]);
        $countstudentspays = R::count('studentspays','studentid = '.$row["studentid"].' and id > '.$row["id"].' and del < 2'); 

        $sub_array = array();
        $sub_array[] = $row["id"];
        $sub_array[] = $row["paytype"];
        $sub_array[] = $row["studentname"];
        $sub_array[] = $row["studentphone"];
        $sub_array[] = $row["paymonths"];
        $sub_array[] = $row["subjectname"];
        $sub_array[] = $row["subjectgroupname"];
        $sub_array[] = $row["payprice"];
        $sub_array[] = '<input type="text" data-end="'.$row["id"] .'" id="datestart'.$row["id"].'" class="form-control changeenddate" value="'.$row["paystartdate"].'"/>';
        $sub_array[] ='<input type="text" data-end="'.$row["id"] .'" id="dateend'.$row["id"].'" class="form-control changeenddate" value="'.$row["payenddate"].'"/>';
        if ($studentspays > 0) {
            $sub_array[] = '<a href="javascript:;" data-id="'. $row["studentid"] .'" type="button" class="btn btn-default btn-lm studentspaysend"  >     نسخ  الكود  </a>';
        }else{
           $sub_array[] = 'لا يوجد';
        }
        $sub_array[] = $row["addtoday"];
        $sub_array[] = $row["employeename"];   
        // $sub_array[] = '<a href="studentsExamsController.php?do=edit&id='. $row["id"] .'&addstudent=1" type="button" class="btn btn-default btn-lm ">+</a>'; 
         if($row["del"] < 2 && $countstudentspays == 0){ 
         $sub_array[] = '<a href="studentsPay.php?do=edit&id='. $row["id"] .'" type="button" class="btn btn-default btn-lg editicon"></a>';
         $sub_array[] = '<a href="javascript:;" data-id="'. $row["id"] .'"   type="button" class="btn btn-default btn-lg deleteicon removerowstudentspays"  ></a>';
        }else if($countstudentspays > 0){
          $sub_array[] = '<a href="studentsPay.php?do=edit&id='. $row["id"] .'&detail=1" type="button" class="btn btn-default btn-lm">تفاصيل</a>';
           $sub_array[] = 'لا يوجد حذف ';

        }else{
          $sub_array[] = '<a href="studentsPay.php?do=edit&id='. $row["id"] .'" type="button" class="btn btn-default btn-lm">تفاصيل</a>';
          $sub_array[] = 'محذوف ';
        }
       
        $output['data'][] = $sub_array;
       }
    
       echo json_encode($output, JSON_UNESCAPED_SLASHES);

}

function getselectpayment() {
    $searchterm = $_POST['searchTerms']; 
    $tablesearch = $_POST['tablesearch'];
    $table = $_POST['table'];
    $del = $_POST['del'];
    $filter = $_POST['filter'];
    $parentid = $_POST['parentid'];
    $parentcol = $_POST['parentcol'];

    $search = '';
    if ($parentid) {
    $search .= " and $table.del < 2"; 
    }
    $studentsaddubjects = R::load('studentsaddubjects',$parentid); 
    $search .= " and studentsubjectid = $studentsaddubjects->studentsubjectid "; 
    

    if ($filter) {
       $search .= $filter;
    }

    $row_array = array();
    $return_arr = array();

     $allData = R::getAll("SELECT $table.id,CONCAT($tablesearch) as name
        FROM $table 
        WHERE  CONCAT($tablesearch) LIKE '%" . $searchterm . "%' $search limit 50");
    foreach ($allData as $data) {
        $row_array['id'] = $data['id'];
        $row_array['text'] = $data['name'];
        array_push($return_arr, $row_array);
    }

    echo json_encode($return_arr);
}


function removerowstudentspays() {
    $today = date("Y-m-d H:i:s");
    $date = date("Y-m-d");
    $id = filter_input(INPUT_POST, 'id');
    $studentspays = R::load('studentspays', $id);
    $studentspays->del = 2;
    $studentspays->deltoday = $today;          
    $studentspays->deluserid = $_SESSION['userid'];
    try {
        R::store($studentspays);
        $students = R::load('students',$studentspays->studentid);
         $income = R::getRow("SELECT income.* FROM `income` WHERE clientid = $students->clientid order by incomeId desc");
         $send_data = array(
        'incomeId' => $income['incomeId'],
        );
        CURL_IT2($send_data, 'incomeController.php?do=deletepost');
        $students = R::load('students',$studentspays->studentid);
        $studentspaysold = R::findOne('studentspays','studentid = ? and del < 2 order by id desc',[$students->id]); 
        $students->startdate = $studentspaysold->paystartdate;
        $students->enddate = $studentspaysold->payenddate;
        $students->paymonths  = $studentspaysold->paymonths;
        $students->paytype = $studentspaysold->paytype;
        $students->payprice = $studentspaysold->payprice;
        $students->studentspayid = $studentspaysold->id;
        R::store($students);
        echo 1;
    } catch (Exception $e) {
        echo 0;
    }
} 


function studentspaysend() {
    
    $studentid = ($_POST['studentid'] > 0) ? $_POST['studentid'] : 0;;
    $date = date("Y-m-d");
     $studentspays = R::getAll("SELECT MAX(id) AS id FROM `studentspays` where 
     studentid = $studentid and studentspays.del < 2 and payenddate > '$date' 
     group by studentspays.studentsubjectid  desc limit 6"); 
     $text ='R00'.$studentid.'?';
     $i = 1;
     foreach($studentspays as $studentspay){
         $studentspaydata = R::load('studentspays',$studentspay['id']);
         $studentsubjects = R::load('studentsubjects',$studentspaydata->studentsubjectid);
         if ($i < 7){
          $text .= $studentsubjects->deviceid.','.date('Ym', strtotime($studentspaydata->payenddate)).'?';
         }
          $i++;
        
        
     }
     $countstudentspayval = count($studentspays);
     if ($countstudentspayval < 6) {
        for ($i = $countstudentspayval; $i <= 5; $i++) {
            $text .= '00,000000?';
        } 
       
    }
    // $send_data = array();
    // $send_data['text'] = $text;
    // $response_data = HTTPRequester::HTTPPost('http://shop.gt4host.com/calendar/full/api/studentsdata', $send_data);
    // $receive_data = json_decode($response_data);
    echo trim($text);

}


function getpaystudent() {
    
    $studentid = $_POST['studentid'];
    $studentaddsubjectid = $_POST['studentaddsubjectid'];
    $paykind = $_POST['paykind'];
    $countmonth = $_POST['countmonth'];
    $studentaddsubjects = R::load('studentaddsubjects',$studentaddsubjectid);
    $getstudentpaysubject = R::findOne('studentspays','studentid = ? and studentsubjectgroupid = ? and del < 2 order by id desc',[$studentid,$studentaddsubjects->studentsubjectgroupid]); 
    if ($getstudentpaysubject->id  == '') {
        $getstudentpaysubject->payenddate = date('Y-m-d');
    }
    if ($paykind == 1) {
        $text = date('Y-m-d', strtotime("+1 month", strtotime($getstudentpaysubject->payenddate))); 
    }else if ($paykind == 2) {
        $studentspaymentsystems = R::load('studentspaymentsystems',$countmonth);
        $text = date('Y-m-d', strtotime("+".$studentspaymentsystems->paymentmonth." month",  strtotime($getstudentpaysubject->payenddate)));
    }else if($paykind == 3){
        $text = date('Y-m-d', strtotime("+".$countmonth." month",  strtotime($getstudentpaysubject->payenddate)));
    }else{
        $text = 4;

    }
    echo trim($text);

}

function getstudentid() {
    $studentspayid = $_POST['studentspayid'];
    $studentspays = R::load('studentspays',$studentspayid);
    echo $studentspays->studentid;

}


function CURL_IT2($data_arr, $url) {
    $url = 'http://' . $_SERVER['HTTP_HOST'] . explode('controllers', $_SERVER['REQUEST_URI'])[0] . 'controllers/' . $url;

    ##appending necessary data
    $data_arr['curlpost'] = '1';
    $data_arr['sessionlist'] = json_encode($_SESSION);

    $post = $data_arr;
    $ch = curl_init($url);
    //
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post); //
    //Disable CURLOPT_SSL_VERIFYHOST and CURLOPT_SSL_VERIFYPEER by
    //setting them to false.
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    //curl_setopt($ch, CURLOPT_TIMEOUT, 10); //
    // execute!
    $response = curl_exec($ch);
    if ($response === false) {
        //echo 'Error : ' . curl_error($ch);
    }

    curl_close($ch);
    return $response;
}


?>