Subversion Repositories cheapmusic

Rev

Rev 133 | Rev 136 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 133 Rev 134
Line 811... Line 811...
811
    $xh->close(); // ul
811
    $xh->close(); // ul
812
    $xh->add_attribute("class", "ml-auto");
812
    $xh->add_attribute("class", "ml-auto");
813
    $xh->tag('span');
813
    $xh->tag('span');
814
    if ($_SESSION["currentLayout"] == 'CardView') {
814
    if ($_SESSION["currentLayout"] == 'CardView') {
815
        $xh->add_attribute("id", "resultViewToggle");
815
        $xh->add_attribute("id", "resultViewToggle");
816
        $xh->add_attribute("name", "submit");
816
        $xh->add_attribute("name", "submitBtn");
817
        $xh->add_attribute("value", "TableView");
817
        $xh->add_attribute("value", "TableView");
818
        $xh->add_attribute("type", "submit");
818
        $xh->add_attribute("type", "submit");
819
        $xh->add_attribute("class", "btn btn-sm btn-rounded filterButton btn-info p-0 m-0 active");
819
        $xh->add_attribute("class", "btn btn-sm btn-rounded filterButton btn-info p-0 m-0 active");
820
        $xh->add_attribute("data-toggle", "tooltip");
820
        $xh->add_attribute("data-toggle", "tooltip");
821
        $xh->add_attribute("title", "Table View");
821
        $xh->add_attribute("title", "Table View");
Line 824... Line 824...
824
        $xh->add_attribute("class", "material-icons md-36");
824
        $xh->add_attribute("class", "material-icons md-36");
825
        $xh->tag('i', "view_list");
825
        $xh->tag('i', "view_list");
826
        $xh->close(); // button
826
        $xh->close(); // button
827
    } else {
827
    } else {
828
        $xh->add_attribute("id", "resultViewToggle");
828
        $xh->add_attribute("id", "resultViewToggle");
829
        $xh->add_attribute("name", "submit");
829
        $xh->add_attribute("name", "submitBtn");
830
        $xh->add_attribute("value", "CardView");
830
        $xh->add_attribute("value", "CardView");
831
        $xh->add_attribute("type", "submit");
831
        $xh->add_attribute("type", "submit");
832
        $xh->add_attribute("class", "btn btn-sm btn-rounded filterButton btn-info p-0 m-0 active");
832
        $xh->add_attribute("class", "btn btn-sm btn-rounded filterButton btn-info p-0 m-0 active");
833
        $xh->add_attribute("data-toggle", "tooltip");
833
        $xh->add_attribute("data-toggle", "tooltip");
834
        $xh->add_attribute("title", "Card View");
834
        $xh->add_attribute("title", "Card View");
Line 1024... Line 1024...
1024
 
1024
 
1025
    $xh->close(); // div
1025
    $xh->close(); // div
1026
    $xh->add_attribute("class", "p-2");
1026
    $xh->add_attribute("class", "p-2");
1027
    $xh->tag('div');
1027
    $xh->tag('div');
1028
    $xh->add_attribute("type", "submit");
1028
    $xh->add_attribute("type", "submit");
-
 
1029
    $xh->add_attribute("id", "detailTabSubmit");
1029
    $xh->add_attribute("class", "btn btn-success detailFilterButton");
1030
    $xh->add_attribute("class", "btn btn-success detailFilterButton");
1030
    $xh->add_attribute("name", "submit");
1031
    $xh->add_attribute("name", "submitBtn");
1031
    $xh->add_attribute("value", "Apply");
1032
    $xh->add_attribute("value", "Apply");
1032
    $xh->tag('button', "Apply");
1033
    $xh->tag('button', "Apply");
1033
    $xh->add_attribute("type", "submit");
1034
    $xh->add_attribute("type", "submit");
-
 
1035
    $xh->add_attribute("id", "detailTabReset");
1034
    $xh->add_attribute("class", "btn btn-danger detailFilterButton");
1036
    $xh->add_attribute("class", "btn btn-danger detailFilterButton");
1035
    $xh->add_attribute("name", "submit");
1037
    $xh->add_attribute("name", "submitBtn");
1036
    $xh->add_attribute("value", "Reset");
1038
    $xh->add_attribute("value", "Reset");
1037
    $xh->tag('button', "Reset");
1039
    $xh->tag('button', "Reset");
1038
    $xh->close(); // div
1040
    $xh->close(); // div
1039
    $xh->close(); // form
1041
    $xh->close(); // form
1040
 
1042
 
Line 1475... Line 1477...
1475
    $conn = MySessionHandler::getDBSessionId();
1477
    $conn = MySessionHandler::getDBSessionId();
1476
 
1478
 
1477
    if ($result = mysqli_query($conn, $sql)) {
1479
    if ($result = mysqli_query($conn, $sql)) {
1478
        if (mysqli_num_rows($result) > 0) {
1480
        if (mysqli_num_rows($result) > 0) {
1479
            $xh->add_attribute("class", "container py-4 border bg-light");
1481
            $xh->add_attribute("class", "container py-4 border bg-light");
-
 
1482
            $xh->add_attribute("id", "couponList");
1480
            $xh->tag('div');
1483
            $xh->tag('div');
1481
            while ($row = mysqli_fetch_assoc($result)) {
1484
            while ($row = mysqli_fetch_assoc($result)) {
1482
                if ($row["advertiser"] != $lastAdvertiser) {
1485
                if ($row["advertiser"] != $lastAdvertiser) {
1483
                    if (!empty($lastAdvertiser)) {
1486
                    if (!empty($lastAdvertiser)) {
1484
                        $xh->close(); // ul
1487
                        $xh->close(); // ul
Line 1490... Line 1493...
1490
                    $lastAdvertiser = $row["advertiser"];
1493
                    $lastAdvertiser = $row["advertiser"];
1491
                }
1494
                }
1492
                if (!empty($row["url"])) {
1495
                if (!empty($row["url"])) {
1493
                    $xh->add_attribute("class", "list-group-item");
1496
                    $xh->add_attribute("class", "list-group-item");
1494
                    $xh->tag('li');
1497
                    $xh->tag('li');
1495
                        $xh->add_attribute("class", "btn btn-link text-left");
1498
                        $xh->add_attribute("class", "btn btn-link text-left coupon-link");
1496
                        $xh->add_attribute("target", "_blank");
1499
                        $xh->add_attribute("target", "_blank");
1497
                        $xh->add_attribute("href", htmlentities($row["url"]));
1500
                        $xh->add_attribute("href", htmlentities($row["url"]));
1498
                        $xh->add_attribute("rel", "nofollow noreferrer noopener");
1501
                        $xh->add_attribute("rel", "nofollow noreferrer noopener");
-
 
1502
                        $xh->add_attribute("data-advertiser", $row["advertiser"]);
1499
                        $xh->tag('a');
1503
                        $xh->tag('a');
1500
                            $str = '<strong>' . $row["description"] . '</strong> until ' . $row["enddate"];
1504
                            $str = '<strong>' . $row["description"] . '</strong> until ' . $row["enddate"];
1501
                            if (!empty($row["couponcode"])) {
1505
                            if (!empty($row["couponcode"])) {
1502
                                $str .= ' (Use Coupon Code "' . $row["couponcode"] . '")';
1506
                                $str .= ' (Use Coupon Code "' . $row["couponcode"] . '")';
1503
                            }
1507
                            }
Line 1517... Line 1521...
1517
            }
1521
            }
1518
            
1522
            
1519
            if (!empty($lastAdvertiser)) {
1523
            if (!empty($lastAdvertiser)) {
1520
                $xh->close(); // ul
1524
                $xh->close(); // ul
1521
            }
1525
            }
-
 
1526
 
-
 
1527
    $xh->add_attribute("nonce", base64_encode($_SESSION["nonce"]));
-
 
1528
    $xh->tag('script');
-
 
1529
        $str  = trim('document.addEventListener("DOMContentLoaded", function() {');
-
 
1530
        $str .= trim('    document.getElementById("couponList").addEventListener("click", function(event) {');
-
 
1531
        $str .= trim('        e = event.target.closest("a");');
-
 
1532
        $str .= trim('        if (e && e.classList.contains("coupon-link")) {');
-
 
1533
        $str .= trim('            window.dataLayer.push({ "event" : "trackEvent", "eventCategory" : "Coupon", "eventAction" : "Click", "eventLabel" : e.getAttribute("data-advertiser")});');
-
 
1534
        $str .= trim('        }');
-
 
1535
        $str .= trim('    });');
-
 
1536
        $str .= trim('});');
-
 
1537
    $xh->insert_code($str);
-
 
1538
    $xh->close(); // script
-
 
1539
 
1522
            $xh->close(); // div
1540
            $xh->close(); // div
1523
        }
1541
        }
1524
    }
1542
    }
1525
    else if (mysqli_errno($conn)) {
1543
    else if (mysqli_errno($conn)) {
1526
        $xh->add_attribute("class", "container bg-info text-center py-3");
1544
        $xh->add_attribute("class", "container bg-info text-center py-3");