C:\xampp\htdocs\kptv\backup_ro\voting2.tpl.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
<?php 
    
require_once("../common/database.php");
    require_once(
"func/vote.php");
?>

<script>
    var VOTE_URL = '<?php echo $BASE_URL."ajax/"?>';
</script>

<?php
    
include('config.php');
    
$datenow date("Y-m-d");
    
$ip $_SERVER['REMOTE_ADDR'];
    
    if(!isset(
$_GET["type_of_list"]) ){
        
$_GET["type_of_list"] = 1;
    }
    
$type_of_song $_GET["type_of_list"];

    
$vote = new Vote();
    
$dbHandler $vote->getDBHandler();
    
    
$countvote $vote->getNumberOfVoteBySongType($ip$datenow$type_of_song);
    
$countvoteplus $vote->getNumberOfVotePlusBySongType($ip$datenow$type_of_song);
    
//echo $countvote." / ".$countvoteplus;
?>

<?php 
    
function getStateImage($up$prev$mit) {
        global 
$BASE_URL;
        
//         if($mit == 1 || ($mit == 0 && $up == 0)) {

        
if($up == 0) {
            return 
"<span class = 'new_text'>NEW</span>";
        } else {
            
            if ( (
$up $prev) && ($prev !=0) ) { 
                return  
"<img src='".$BASE_URL."voting/images/down.png' border='0'>";
            } else if ( (
$up == $prev) && ($prev 0) ) { 
                return 
"<img src='".$BASE_URL."voting/images/stationare.png' border='0'>"
            } else if ( (
$prev == && $up == 0) ) { 
                return 
"<span class = 'new_text'>NEW</span>"
            } else if (
$up $prev) {
                return 
"<img src='".$BASE_URL."voting/images/up.png' border='0'>";
            } 
        }
    }
    
    function 
ellipsizeText($text$limit) {
        if(
strlen($text) < $limit
            return 
$text;
        
        return 
substr($text0$limit-3)."...";
    }
    
    function 
drawRow($id$artist$song$cover$mp3$prev$prev2$up$monthsintop$sid$ip$datenow$i$mCount$isInTop$type_of_song$separator){
    
        global 
$BASE_URL;
        global 
$vote;
    
        
$html "<div class = 'track_tow'>";
            
$html .= "<div class = 'toplist_number'>";
                
$html .= "<span class = 'track_order'>".$i."</span>";
            
$html .= "</div>";
            if(
$isInTop) {
                
$html .= "<div class='toplist_arrows'>".getStateImage($prev2$i$monthsintop)."</div>";                
            }
            else {
                
$html .= "<div class='toplist_arrows'>".getStateImage(00$monthsintop)."</div>";
            }
            if(
$cover == "" || !file_exists("images/top20/".$cover)) {
                
$cover $BASE_URL."voting/images/kptv_no_cover.png";
            } else {
                
$cover $BASE_URL."ro/images/top20/".$cover;
            }
            
            
$html .= "<div class = 'cover_container'>
                        <img  class = 'voting_cover' src = '"
.$cover."' />
                     </div>"
;
            
$html .= "<div class='toplist_song'>";
                
$html .= "<p class = 'artist'>".ellipsizeText($artist22)."</p>";
                
$html .= "<p class = 'song'>".ellipsizeText($song35)."</p>";
                
$html .= "<div class = 'prev_player player_container_".($isInTop "vote":"voteplus").$i."'></div>";
            
$html .="</div>";
            
$html .= "<div class = 'vote_container'>";
                
                
$count $vote->getNrOfVotesBySong($isInTop "vote":"voteplus"$ip$datenow$sid);
                
$html .= "<div class = 'vote_btn_container'>";
                    
$html .= "<div class = 'current_vote_state'>";
                        
$html .= Vote::getSymbolHTML($up, ($isInTop "vote":"voteplus").$i."_sym");
                    
$html .= "</div>";
                    if(
$count 0) { 
                        
$html .= "<a disabled class='vote btn_vote voted' id='".$sid."' data-type='".$type_of_song."' name='up'>VOTAT</a>";
                    } else {
                        
$html .= "<a class='vote btn_vote' data-type='".$type_of_song."' data-ind='".$i."' id='".$sid."' name='".(($isInTop) ? "up":"upplus")."'>VOTEAZA</a>";
                    }
                
$html .= "</div>";
                if(
$mp3 == "" || !file_exists("music/".$mp3)) {
                    
$id = -1;
                }
                
                
$mp3Path = (($mp3 == "") ? "NULL" $BASE_URL."ro/music/".$mp3);
                
                
$html .= "<a class = 'preview_btn' onClick = 'prevPlay(\"".$mp3Path."\",".$i.", \"".($isInTop "vote":"voteplus")."\");'><img src = '".$BASE_URL."images/img_top/play_preview.png' /></a>";
                
                if(
$isInTop) {
                    
$html .= "<span class = 'week'>". (($monthsintop == 0) ? "-" $monthsintop) ."</span>";
                     
$html .= "<span class = 'last_week'>" . (($prev2 == 0) ? "-"$prev2) ."</span>";
                    
//$html .= "<span class = 'last_week'>" . (($prev2 == 0) ? "-": $prev2) ."</span>";
                
}
                
$html .= "<div style = 'clear:both;margin:0;padding:0;'></div>";
            
$html .= "</div>";
            
$html .= "<div style = 'clear:both;margin:0;padding:0;'></div>";
        
$html .= "</div>";
        
        if(
$i != $mCount) {
            
$html .= "<div style = 'background: ".$separator."' class = 'separator'></div>";
        }
                
        return 
$html;
    }
?>

<?php 
    
require_once("../conf_/siteconf_.php");
    require_once(
"../admin/dbconn.php");

    if(
$dbConn) {
        
$ra_page$db->Select($TBL_PAGESnull, array("ID"), array('18'));
        if(
count($ra_page))
        
$page $ra_page[0]->ContentRO;
    }
    
$title .=" - ".$ra_page[0]->NameRO;
?>
<!-- Top20 -->
<td width="589" valign="top" style="border-right: 1px solid #5D5C5C">
    <div>
    <?php 
        $res2 
$dbHandler->select($table "toplistcategories");
        foreach (
$res2 as $row){
            echo 
'<a href="index.php?pg=voting2&type_of_list='.$row['ID'].'" style="color:#000;margin:0 10px;text-decoration:0;">'.$row['title'].'</a>';
        }
    
?>
    </div>
    <div class = "top_separator"></div>
    <div class = 'title_container'>
        <h1>Radio KPTV &#8226; TOP 20</h1>
        <h2>The Classic and New Rock Chart</h2>
    </div>
    <div class = "subtitle_separator"></div>
    
    <div class = 'top_header'>
        <div class = 'top_header_first_col'>
            <span class = 'tw'>TM</span>
            <span class = 'st'>ST</span>
        </div>
        <div class = 'top_header_secont_col'>
            <span>ARTIST / PIESA / ANUL</span>
        </div>
        <div class = 'top_header_third_col'>
            <span class = 'lw'>LM</span>
            <span>M</span>
        </div>
        <div style = 'clear: both; margin:0; padding:0'></div>
    </div>
    <?php
        
// $j = 0;
//         $res_2 = $dbHandler->selectByConditions($table = "top20", $conditions = array("active"=>1,"type_of_list"=>$_GET['type_of_list']), $other = " ORDER BY up desc, months_in_top desc, total desc LIMIT 20");
//         $count_2 = count($res_2);
        
        
        
$i 0;
        if(!isset(
$_GET["type_of_list"]) ){
            
$_GET["type_of_list"] = 1;
        }
        
        
$res $dbHandler->selectByConditions($table "top20"$conditions = array("active"=>1,"type_of_list"=>$_GET['type_of_list']), $other " ORDER BY  prev_month=0, prev_month asc, months_in_top desc, total desc LIMIT 20");
        
$count count($res);
        
        foreach(
$res AS $row) {
            
$i=$i+1;
            
//$j=$j+1;        
            
$sid$row['ID'];
            
$artist $row['artist'];
            
$song $row['song'];
            
$up $row['up'];
            
$prev $row['prev_month'];
            
$prev2 $row['prev_month_2'];
            
$monthsintop $row['months_in_top'];
            
$mp3 $row['mp3'];
            
$cover $row['coverimg'];
            
$type_of_song $row['type_of_list'];
            
// $current_month_pos = $res_2[$j]['up'];
            //echo $res_2[$j]['artist'] ;

        
        
            
echo drawRow($sid$artist$song$cover$mp3,  $prev$prev2$up$monthsintop$sid$ip$datenow$i$counttrue$type_of_song"#FFFFFF");
        }
    
?>
    <div class = 'prop_header'>
        <span>PROPUNERI:</span>
    </div>
    <?php
        $i 
0
        
$res $dbHandler->selectByConditions($table "top20plus"$conditions = array("active"=>1"type_of_list"=>$_GET['type_of_list']), $other "ORDER BY total DESC LIMIT 3");
        
$count count($res);
        foreach(
$res AS $row) {
            
$i=$i+1;
            
$msg=$row['artist'];
            
$mes_id=$row['id'];
            
$up=$row['up'];

            
$sid$row['ID'];
            
$artist $row['artist'];
            
$song $row['song'];
            
$up $row['up'];
            
$prev $row['prev_month'];
            
$prev2 $row['prev_month'];
            
$monthsintop $row['months_in_top'];
            
$mp3 $row['mp3'];
            
$cover $row['coverimg'];
            
$type_of_song $row['type_of_list'];
            
            echo 
drawRow($sid$artist$song$cover$mp3$prev$prev2$up$monthsintop$sid$ip$datenow$i$countfalse$type_of_song"#987A00");
        }
    
?>
    
    <div class = "page-content">
        <?php 
            
echo $page;
        
?>
    </div>
</td>

<script stye = 'text/javascript' src = "<?php echo $BASE_URL."js/voting_new.js" ?>"></script>
<script type="text/javascript">
$(document).ready(function() {
    var numberOfVotes = <?= $countvote ?>;
    var numberOfVotesPlus = <?= $countvoteplus ?>;

    $(".vote").click(function(){
        var id = $(this).attr("id");
        var name = $(this).attr("name");
        var ind = $(this).attr("data-ind");
        var type_of_song = $(this).attr("data-type");
        
        var dataString = 'id='+ id + '&type_of_song=' + type_of_song;
        var parent = $(this);
        
        console.log(ind);
        
        if(!parent.hasClass('voted')) {
            if(name == 'up' && numberOfVotes < 17){
              voteUP(parent, dataString, ind, type_of_song);
              numberOfVotes++;
            } else if (name == "upplus" && numberOfVotesPlus < 2) {
              votePlus(parent, dataString, ind, type_of_song);
              numberOfVotesPlus++;
            } 
        }
        
        return false;
    });
});
</script>


x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586