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
<?php if($this->session->flashdata('success')): ?>
<div class="row">
<div class="alert alert-block alert-success" style="margin-bottom: 5px">
<button type="button" class="close" data-dismiss="alert">
<i class="ace-icon fa fa-times"></i>
</button>
<i class="ace-icon fa fa-check green"></i>
<?php echo $this->session->flashdata('success'); ?>
</div>
</div>
<?php endif; ?>
<?php if($this->session->flashdata('error')): ?>
<div class="row">
<div class="alert alert-block alert-danger" style="margin-bottom: 5px">
<button type="button" class="close" data-dismiss="alert">
<i class="ace-icon fa fa-times"></i>
</button>
<i class="ace-icon fa fa-times"></i>
<?php echo $this->session->flashdata('error'); ?>
</div>
</div>
<?php endif; ?>
<?php if(isset($track[0])): ?>
<div class="row">
<div class="col-lg-12">
<a class="btn btn-sm btn-success" href="<?php echo base_url('backend/cmsTrack/addSinger/'.$track[0]['id']);?>">
<i class="glyphicon-plus"></i> Cập nhật Ca sĩ
</a>
<a class="btn btn-sm btn-primary" href="<?php echo base_url('backend/cmsTrack/addComposer/'.$track[0]['id']);?>">
<i class="glyphicon-plus"></i> Cập nhật Nhạc sĩ
</a>
<a class="btn btn-sm btn-warning" href="<?php echo base_url('backend/cmsTrack/updateTrackImage/'.$track[0]['id'].'/null');?>">
<i class="glyphicon-plus"></i> Cập nhật ảnh bài hát
</a>
</div>
</div>
<br>
<div class="row">
<div class="profile-user-info profile-user-info-striped">
<div class="profile-info-row">
<div class="profile-info-name"> ID </div>
<div class="profile-info-value">
<span>#<?php echo $track[0]['id']?></span>
</div>
</div>
<div class="profile-info-row">
<div class="profile-info-name">Ảnh</div>
<div class="profile-info-value">
<span>
<img src="<?php echo MyHelper::getArtByTrack($track[0]['art'], false, $track[0]['art_type']) ?>"
style="max-width: 200px; max-height: 200px">
</span>
</div>
</div>
<div class="profile-info-row">
<div class="profile-info-name">Tên Bài hát</div>
<div class="profile-info-value">
<span><?php echo $track[0]['title']; ?></span>
</div>
</div>
<div class="profile-info-row">
<div class="profile-info-name">Sáng tác</div>
<div class="profile-info-value">
<span><?php echo $track[0]['artist']; ?></span>
</div>
</div>
<div class="profile-info-row">
<div class="profile-info-name">Số người biểu diễn</div>
<div class="profile-info-value">
<span><?php echo count($singers); ?></span>
</div>
</div>
<div class="profile-info-row">
<div class="profile-info-name">Biểu diễn</div>
<div class="profile-info-value">
<?php if(count($singers) > 0) : ?>
<?php foreach ($singers as $key => $singer) : ?>
<div style="<?php if(count($track) >1 ) : echo 'width: 50%; float:left; text-align: left;'; endif; if(count($track) -1 > $key) : echo 'border-right: solid #dddddd 2px;'; endif; ?>">
<?php echo $singer['name_singer']; ?>
<a href="<?php echo base_url('backend/cmsTrack/removeSinger/'.$track[0]['id'].'/'.$singer['id_singer']); ?>"
title="Click để xóa Ca sĩ">
<i class="ace-icon fa fa-trash bigger-150" style="color: red;"></i>
</a>
</div>
<?php endforeach; ?>
<?php else: echo '<span class="text-danger">Chưa có, cập nhật </span> <a href="' . base_url('backend/cmsTrack/addSinger/'.$track[0]['id']) .'">tại đây.</a>'; ?>
<?php endif ?>
</div>
</div>
<div class="profile-info-row">
<div class="profile-info-name color-red" style="color: red">Không lấy lượt nghe ở trang nào thì tích chọn</div>
<div class="profile-info-value">
<label>
<input type="checkbox" value="zing" id="chk_zing"
onclick="updateBlacklistByAjax(<?php echo $track[0]['id'] ?>, '<?php echo str_replace(["'", '"'], [","], $track[0]['title']); ?>', 'zing')"
<?php echo (in_array('zing', $blacklist) ? 'checked' : '') ?>> Zing
</label><br>
<label>
<input type="checkbox" value="nct" id="chk_nct"
onclick="updateBlacklistByAjax(<?php echo $track[0]['id'] ?>, '<?php echo str_replace(["'", '"'], [","], $track[0]['title']); ?>', 'nct')"
<?php echo (in_array('nct', $blacklist) ? 'checked' : '') ?>> NCT
</label><br>
<label>
<input type="checkbox" value="keeng" id="chk_keeng"
onclick="updateBlacklistByAjax(<?php echo $track[0]['id'] ?>, '<?php echo str_replace(["'", '"'], [","], $track[0]['title']); ?>', 'keeng')"
<?php echo (in_array('keeng', $blacklist) ? 'checked' : '') ?>> Keeng
</label>
</div>
</div>
</div>
</div>
<br>
<div class="row">
<div class="col-lg-3">
<a href="<?php echo base_url('backend/cmsTrack/listTrack');?>">
<button type="button" class="btn btn-sm btn-default">
<i class="ace-icon fa fa-arrow-left"></i>Quay lại
</button>
</a>
</div>
</div>
<?php else: ?>
<p>Không tìm thấy thông tin Bài hát!</p>
<?php endif; ?>
<script>
function updateBlacklistByAjax(track_id, title, src) {
var selected = 0;
if ($('#chk_' + src).is(":checked")) {
selected = 1;
} else {
selected = 0;
}
callAjax(track_id, title, src, selected);
}
function callAjax(track_id, title, src, selected) {
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>';
var url = '<?php echo base_url("backend/cmsTrack/updateBlacklistByAjax"); ?>';
var dataReq = {
csrf_name: csrf_value,
track_id: track_id,
title: title,
src: src,
selected: selected
};
//Ajax
$.ajax({
type: "POST",
url: url,
data: dataReq,
dataType: "JSON",
cache: false,
success: function(data) {
console.log(data);
//$('#data-loading').hide();
}
});
}
</script>