| Server IP : 210.245.233.93 / Your IP : 216.73.216.226 Web Server : Apache/2.2.15 (CentOS) System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64 User : apache ( 48) PHP Version : 5.3.3 Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/hkosl.com/m.musiccircle/ |
Upload File : |
<?php
include('_init.php');
//unset($_SESSION["popup"]);
if ($_GET["reset"] && $_GET["reset"] == 1) {
unset($_GET);
}
$where_clause = "";
$parameters = array(1, 0, 1, 4, 0, 1);
if (!empty($_GET)) {
if (!empty($_GET["category_id"]) && $_GET["category_id"] != "ANY") {
$where_clause .= " and student_postjob.mas_instrument = ?";
$parameters[] = $_GET["category_id"];
}
if (!empty($_GET["location"]) && $_GET["location"] != "ANY") {
$where_clause .= " and student_postjoblearndistrict.mas_teachareacode = ?";
$parameters[] = $_GET["location"];
}
if (!empty($_GET["level_of_grade"]) && $_GET["level_of_grade"] != "ANY") {
$where_clause .= " and student_postjob.level = ?";
$parameters[] = $_GET["level_of_grade"];
}
}
//update completed flag
$sql2 = "select * from `order` where deleted = ? and status = ? and (order_type = ? or order_type = ?)";
$parameters2 = array(0, "paid", "try", "formal");
$orders = bind_pdo($sql2, $parameters2, "selectall");
if (!empty($orders)) {
foreach ($orders as $row) {
$sql3 = "update student_postjob set completed_flag = ? where completed_flag = ? and id = ?";
$parameters3 = array(1, 0, $row["job_id"]);
bind_pdo($sql3, $parameters3);
}
}
$sql = "select *,student_postjob.id as student_postjob_id, master_type_code.name_" . $langcode . " as instrument_name from student_postjob
INNER JOIN student_main ON student_main.id = student_postjob.studentmain_id
INNER JOIN student_postjoblearndistrict ON student_postjoblearndistrict.studentpostjob_id = student_postjob.id
INNER JOIN master_type_code ON master_type_code.id = student_postjob.mas_instrument
where student_postjob.status = ? and student_postjob.deleted = ? and student_postjob.approved = ? and student_main.status = ? and student_main.deleted = ? and student_main.approved = ? {$where_clause}
group by student_postjob.id
order by student_postjob.completed_flag ASC, student_postjob.createdate DESC
";
$jobs = bind_pdo($sql, $parameters, "selectall");
//find min fee of job
$budget_array = array("30mins_min_budget", "30mins_max_budget", "45mins_min_budget", "45mins_max_budget", "60mins_min_budget", "60mins_max_budget",);
foreach ($jobs as $key => $row) {
$min_fee = 99999;
foreach ($budget_array as $budget) {
if (!empty($row[$budget]) && $row[$budget] < $min_fee) {
$min_fee = $row["$budget"];
}
}
$jobs[$key]["min_fee"] = $min_fee;
}
$instrument_categories = get_master_type_code("INSTRUMENT_TYPE");
$locations = get_master_type_code("TEACH_POSITIONCODE");
$level_of_grades = get_master_type_code("LEVEL_OF_GRADE");
//update tutor job app_notification to read
$sql = "update app_notification_user set read_date = ? where app_notification_user.cmsloginid = ? and app_notification_user.success = ? and app_notification_user.read_date is null";
$parameters = array(date("Y-m-d H:i:s"), $_SESSION["cmsloginid"], 1);
bind_pdo($sql, $parameters);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php include('_head.php'); ?>
<link href="css/style_k.css?v=<?= time(); ?>" type="text/css" rel="stylesheet">
</head>
<body>
<?php include('_header.php') ?>
<?php include('_dialog.php') ?>
<div class="container" style="margin-top: 50px; margin-bottom: 50px;">
<div class="row">
<div class="col-md-12">
<form action="job.php" method="post" id="job_filter_form" style="margin-bottom: 10px;">
<div class="row" style="background-color: #fff;">
<div class="col-xs-4" style="">
<select class="SelectBox" name="category_id" id="category_id" >
<option value=""><?= _lang("Musical Instrument") ?></option>
<option value="ANY"><?= _lang("Any") ?></option>
<?php
foreach ($instrument_categories as $row) {
echo '<optgroup label="' . $row["name_" . $langcode] . '" >';
$sql = "select * from master_type_code where typeid = ? and extra1 = ? and deleted = ? order by sort asc";
$parameters = array('INSTRUMENT', $row['code'], 0);
$rows_instrument = bind_pdo($sql, $parameters, "selectall");
foreach ($rows_instrument as $row2) {
echo '<option value="' . $row2["id"] . '" ' . ($_GET["category_id"] == $row2["id"] ? "selected" : "") . '>' . $row2["name_" . $langcode] . '</option>';
}
echo '</optgroup>';
}
?>
</select>
</div>
<div class="col-xs-4" style="">
<select class="SelectBox" name="level_of_grade" id="level_of_grade">
<option value="ANY">
<?= _lang("Level") ?>
</option>
<?php
foreach ($level_of_grades as $row) {
echo '<option value="' . $row["code"] . '" ' . ($_GET["level_of_grade"] == $row["code"] ? "selected" : "") . '>' . $row["name_" . $langcode] . '</option>';
}
?>
</select>
</div>
<div class="col-xs-4" style="">
<select class="SelectBox" name="location[]" id="location">
<option value="ANY" <?= empty($_GET["location"]) || $_GET["location"][0] == "ANY" ? "selected" : "" ?>><?= _lang("District") ?></option>
<?php
foreach ($locations as $row) {
$selected = "";
foreach ($_GET["location"] as $location_id) {
if ($location_id == $row["id"]) {
$selected = "selected";
break;
}
}
echo '<option value="' . $row["id"] . '" ' . $selected . '>' . $row["name_" . $langcode] . '</option>';
}
?>
</select>
</div>
</div>
</form>
<?php
if (!empty($jobs)){
foreach ($jobs as $row) {
if (!empty($row["student_post_gender"])) {
$row["gender"] = $row["student_post_gender"];
}
//check if student has paid trial fee
$has_order = false;
$sql = "select * from `order` where job_id = ? and deleted = ? and status = ?";
$parameters = array($row["student_postjob_id"], 0, "paid");
$order = bind_pdo($sql, $parameters, "selectone");
if (!empty($order)) {
$has_order = true;
}
//budget
$_30mins = "";
$_45mins = "";
$_60mins = "";
if (!empty($row["30mins_min_budget"]) && !empty($row["30mins_max_budget"])) {
$_30mins = "30" . _lang("mins") . ": $" . $row["30mins_min_budget"] . ' - ' . $row["30mins_max_budget"] . ', ';
} else {
if (!empty($row["30mins_min_budget"]) && empty($row["30mins_max_budget"])) {
$_30mins = "30" . _lang("mins") . ": " . _lang("Above") . " $" . $row["30mins_min_budget"] . ', ';
}
if (empty($row["30mins_min_budget"]) && !empty($row["30mins_max_budget"])) {
$_30mins = "30" . _lang("mins") . ": " . _lang("Below") . " $" . $row["30mins_max_budget"] . ', ';
}
}
if (!empty($row["45mins_min_budget"]) && !empty($row["45mins_max_budget"])) {
$_45mins = "45" . _lang("mins") . ": $" . $row["45mins_min_budget"] . ' - ' . $row["45mins_max_budget"] . ', ';
} else {
if (!empty($row["45mins_min_budget"]) && empty($row["45mins_max_budget"])) {
$_45mins = "45" . _lang("mins") . ": " . _lang("Above") . " $" . $row["45mins_min_budget"] . ', ';
}
if (empty($row["45mins_min_budget"]) && !empty($row["45mins_max_budget"])) {
$_45mins = "45" . _lang("mins") . ": " . _lang("Below") . " $" . $row["45mins_max_budget"] . ', ';
}
}
if (!empty($row["60mins_min_budget"]) && !empty($row["60mins_max_budget"])) {
$_60mins = "60" . _lang("mins") . ": $" . $row["60mins_min_budget"] . ' - ' . $row["60mins_max_budget"] . ', ';
} else {
if (!empty($row["60mins_min_budget"]) && empty($row["60mins_max_budget"])) {
$_60mins = "60" . _lang("mins") . ": " . _lang("Above") . " $" . $row["60mins_min_budget"] . ', ';
}
if (empty($row["60mins_min_budget"]) && !empty($row["60mins_max_budget"])) {
$_60mins = "60" . _lang("mins") . ": " . _lang("Below") . " $" . $row["60mins_max_budget"] . ', ';
}
}
//district
$sql = "select * from student_postjoblearndistrict
INNER JOIN master_type_code ON master_type_code.id = student_postjoblearndistrict.mas_teachareacode
where student_postjoblearndistrict.deleted = ? and student_postjoblearndistrict.studentpostjob_id = ?";
$parameters = array(0, $row["student_postjob_id"]);
$result = bind_pdo($sql, $parameters, "selectall");
$student_postjoblearndistrict_master = array();
$student_postjoblearndistrict_master_text = "";
if (!empty($result)) {
foreach ($result as $row2) {
$teachareacode = get_master_type_code("TEACH_AREACODE", $row2["extra1"]);
$teachareacode = $teachareacode["name_" . $langcode];
if (!in_array($teachareacode, $student_postjoblearndistrict_master)) {
$student_postjoblearndistrict_master[] = $teachareacode;
}
}
}
if (!empty($student_postjoblearndistrict_master)) {
foreach ($student_postjoblearndistrict_master as $key3 => $row3) {
$student_postjoblearndistrict_master_text .= $row3;
if (($key3 + 1) != count($student_postjoblearndistrict_master)) {
$student_postjoblearndistrict_master_text .= " / ";
}
}
} else {
$student_postjoblearndistrict_master_text = _lang("N/A");
}
?>
<div class="JobSection row" style="padding-bottom: 0; width: auto; min-width: 100%;" id="job_<?= $row["student_postjob_id"] ?>">
<!--<div class="ProfileSectionTitle"></div>-->
<?php
echo "<div class='col-xs-4' style='padding: 0; margin-bottom: 15px;'><a href='job_detail.php?id=" . $row["student_postjob_id"] . "'><img src='" . $site_info["url"] . "img/instrument/" . $row["extra3"] . "' style='width: 100%;'></a> </div>";
echo "<div class='col-xs-8 short_info' style='margin-bottom: 15px;'>";
echo "<span style='color: #c11c2c'>"._lang("Musical Instrument") . ": " . $row["instrument_name"] . "</span><br>";
echo _lang("Learning Level") . ": " . $row["level"] . "<br>";
echo _lang("Tutorial Budget") . ": " . $_30mins . $_45mins . $_60mins . "<br>";
echo _lang("Expected Tutorial District") . ": " . $student_postjoblearndistrict_master_text;
echo "<div class='row' style='margin-top: 10px;'>";
echo '<div class="col-xs-6 tl nowrap "><a href="job_detail.php?id=' . $row["student_postjob_id"] . '"><button class="ContactTutorBTN" type="button" style="cursor: default; background-color: #fff; color: #000; border: 1px solid #000; padding: 9px 16px;">' . _lang("Detail") . '</button></a></div>';
if ($has_order === true || $row["completed_flag"] == 1) {
echo '<div class="col-xs-6 tr nowrap padding0"><button class="ContactTutorBTN" type="button" style="cursor: default; background-color: #575656;">' . _lang("Matched") . '</button></div>';
} else {
echo '<div class="col-xs-6 tr nowrap padding0"><button class="ContactTutorBTN" type="button" onclick="contact_student(' . $row["student_postjob_id"] . ', ' . (int)$_SESSION["member_login"] . ');" style="">' . _lang("Contact Student") . '</button></div>';
}
echo '</div>';
echo '<div style="clear:both"></div>';
?>
</div>
</div>
<?php }
} else {
echo _lang("No Job.");
} ?>
</div>
</div>
<?php if (isset($_SESSION["cmsloginid"]) && isset($_SESSION["is_tutor"]) && $_SESSION["is_tutor"] == 1) { ?>
<div id="contact_student_chat_box" style="display: none; overflow-x: hidden;">
<div class="row">
<div class="col-md-12">
<h3 class="tc"><?= _lang("Leave Message for Student") ?></h3>
<textarea style="width:100%;" rows="5" name="content" id="content" placeholder="<?= _lang("Please note the tips below.") ?>"></textarea>
<div class="tl">
<div style="font-size: 12px; color: red;"><?= _lang("Mobile no, email address and any contact is not allowed during the conversation.") ?></div>
<button class="ContactTutorBTN" type="button" id="contact_student_submit" onclick="contact_student_submit();" style="margin-top: 10px;"><?= _lang("Submit") ?></button>
</div>
<?php /*if ($_SESSION["wlangcode"] == "en") { ?>
<p style="color: #0012ff;font-size:12px; font-weight:100;">*Tips:<br> 1) Before confirmation and
payment for trial lesson, the tutor and student will only have 5 conversation chances <br> 2) We
suggest both parties to chat based on the following topics: <br>
<span style="padding-left: 20px;"></span>a) Learning location b) Lesson time
c) Music background d) Learning objective e)
e) Arrangement of instrument and teaching material
</p>
<?php } else { ?>
<p style="color: #0012ff;font-size:12px; font-weight:100;">*提示:<br> 1)於付款確定試堂前,導師與學生有5次來回對話機會 <br>
2)我們建議雙方於對話中就以下內容進行商討: <br> <span style="padding-left: 20px;"></span>a) 教學地點 b)
上課時間 c) 履歷及背景 d) 學習目的 e) 教材及樂器安排
</p>
<?php }*/ ?>
</div>
</div>
</div>
<?php } ?>
<?php if ($_SESSION["is_tutor"] == 1 && empty($_SESSION["popup"])) {
$tutor = get_tutor($_SESSION["member_login"]);
echo '<div id="popup" style="display: none; text-align: center; color: #00ADEF; font-weight: bold;padding-top: 30px;"><div id="popup_content" style="cursor: pointer;">';
if ($tutor["status"] < 4) {
echo '請快快入去「我的履歷」完成導師註冊程序,<br>
你就可以在「學生配對」中直接跟同學對話。';
}
if ($tutor["status"] == 4 && $tutor["approved"] != 1) {
echo '管理員正在審查你「我的履歷」中,
完成審查後你的檔案就可以在「導師搜尋」
出現。';
}
echo '</div></div>';
} ?>
<? include('_footer.php') ?>
<link rel="stylesheet" href="js/fancybox/jquery.fancybox.css?v=2.1.5" type="text/css" media="screen"/>
<script type="text/javascript" src="js/fancybox/jquery.fancybox.pack.js?v=2.1.5"></script>
<script type="text/javascript">
function contact_student(job_id, tutor_id) {
//check if user login
<?php
if(!isset($_SESSION["cmsloginid"])){
echo "alert('" . _lang("Please login first. If you have any problem, you can call 9446 0817 with Whatsapp to contact us.") . "'); return;";
}else if(!isset($_SESSION["is_tutor"]) || $_SESSION["is_tutor"] == 0){
echo "alert('" . _lang("You are not a tutor. You cannot contact student.") . "'); return;";
}else {
?>
jQuery.ajax({
url: '_ajax.php',
type: 'POST',
data: {
ajax: "check_contact",
job_id: job_id,
tutor_id: tutor_id,
},
dataType: 'html', //dataType (default: Intelligent Guess (xml, json, script, or html))
timeout: 1000,
error: function (result) {
//alert('Error Occur. Please refresh and try again.');
console.log(result.responseText);
},
success: function (result) {
//$('#loading').slideUp(100);
//console.log(result);
var json = result,
obj = JSON.parse(json);
if (obj.error == 1) {
alert("Missing job id or tutor id.");
} else {
if (obj.matched_musical_instrument) {
if (parseInt(obj.count_chat) > 0) {
location.href = "webadmin/chat_index.php?type=1&first_chat_id=" + obj.first_chat_id;
} else {
//popup box
$.fancybox({
//settings
'type': 'inline',
'maxWidth': 800,
'fitToView': false,
'width': '90%',
'height': '45%',
'autoSize': false,
'closeClick': false,
'openEffect': 'none',
'closeEffect': 'none',
'href': '#contact_student_chat_box'
});
$("#contact_student_submit").attr("onclick", 'contact_student_submit(' + job_id + ')');
}
} else {
alert("<?=_lang("The musical instrument you are teaching do not match job requirement of student. You do not allow to chat with student.")?>");
}
}
//alert(result);
}
});
<?php } ?>
}
function contact_student_submit(job_id) {
var content = $("#content").val();
if (!content) {
alert("<?=_lang("Please enter message.");?>");
return;
}
if (!job_id) {
alert("<?=_lang("Please select job.");?>");
return;
}
jQuery.ajax({
url: '_ajax.php',
type: 'POST',
data: {
ajax: "contact_student_submit",
job_id: job_id,
content: content,
},
dataType: 'html', //dataType (default: Intelligent Guess (xml, json, script, or html))
timeout: 1000,
error: function (result) {
alert('Error Occur. Please try again.');
//console.log(result.responseText);
},
success: function (result) {
//$('#loading').slideUp(100);
//console.log(result);
alert(result);
$.fancybox.close();
}
});
}
$(function () {
$("#popup_content").on("click", function () {
window.location.href='tutor_profile.php';
});
//filter onchange
$("select").on("change", function () {
console.log(1);
var category_id = $("#category_id").val();
var level_of_grade = $("#level_of_grade").val();
var location = $("#location").val();
window.location.href='job.php?category_id='+category_id+'&level_of_grade='+level_of_grade+'&location='+location;
});
<?php if($_SESSION["is_tutor"] == 1 && empty($_SESSION["popup"]) && ($tutor["status"] < 4 || ($tutor["status"] == 4 && $tutor["approved"] != 1) )){ ?>
$.fancybox({
//settings
'type': 'inline',
'fitToView': false,
'maxWidth': 800,
'maxHeight': 80,
'width': '90%',
'height': '80%',
'autoSize': false,
'closeClick': false,
'openEffect': 'none',
'closeEffect': 'none',
'href': '#popup',
});
<?php $_SESSION["popup"] = 1; } ?>
$(".full_info").hide();
$(".close_expand").hide();
$(".expand").on("click", function () {
$(this).hide();
$(this).closest(".JobSection").find(".close_expand").show();
$(this).closest(".JobSection").find(".short_info").hide();
$(this).closest(".JobSection").find(".full_info").show();
});
$(".close_expand").on("click", function () {
$(this).hide();
$(this).closest(".JobSection").find(".expand").show();
$(this).closest(".JobSection").find(".short_info").show();
$(this).closest(".JobSection").find(".full_info").hide();
});
<?php if(!empty($_GET["id"])) { ?>
$("#job_<?=(int)$_GET["id"]?>").find(".short_info").hide();
$("#job_<?=(int)$_GET["id"]?>").find(".full_info").show();
$("#job_<?=(int)$_GET["id"]?>").find(".expand").hide();
$("#job_<?=(int)$_GET["id"]?>").find(".close_expand").show();
$("#job_<?=(int)$_GET["id"]?>").css("border", "1px solid #CC1342");
$('html, body').animate({
//scrollTop: $(window.location.hash).offset().top - 105
scrollTop: $("#job_<?=(int)$_GET["id"]?>").offset().top - 180
});
<?php } ?>
})
</script>
<script type="text/javascript" src="js/jquery.sticky.js"></script>
<script src="js/select2/select2.min.js"></script>
<link href="js/select2/select2.min.css" rel="stylesheet">
<script type="text/javascript">
$(function () {
$("#job_filter_form").sticky({topSpacing: 45});
//change select
/*$("#category_id").select2({
width: "100%"
});
$("#location").select2({
width: "100%",
});
$("#level_of_grade").select2({
width: "100%"
});*/
/*$("#sort_by").select2({
width: "100%"
});*/
});
</script>
</body>
</html>