Commit 656e7b03 by Trần Văn Minh

select nhạc sĩ

parent ab73e782
...@@ -49,6 +49,7 @@ class CmsTrack extends CI_Controller ...@@ -49,6 +49,7 @@ class CmsTrack extends CI_Controller
public function editTrack($contest_id) public function editTrack($contest_id)
{ {
$this->_data['contest'] = $contest = $this->track_model->getById($contest_id); $this->_data['contest'] = $contest = $this->track_model->getById($contest_id);
$this->_data['list_single'] = $list_single = $this->track_model->getListSingle();
// Kiểm tra trùng giá trị nếu thay đổi ở form // Kiểm tra trùng giá trị nếu thay đổi ở form
// Thiết lập validate // Thiết lập validate
...@@ -110,4 +111,12 @@ class CmsTrack extends CI_Controller ...@@ -110,4 +111,12 @@ class CmsTrack extends CI_Controller
} }
} }
function search()
{
$q = $this->input->get('q');
$data = $this->track_model->searchSingle($q);
echo json_encode($data);
}
} }
\ No newline at end of file
...@@ -25,8 +25,10 @@ class Track_model extends CI_Model ...@@ -25,8 +25,10 @@ class Track_model extends CI_Model
public function getById($id) public function getById($id)
{ {
$this->db->select($this->_table . '.*'); $this->db->select($this->_table . '.*, track_user.name AS name_single, track_user.id AS id_single, track_artists.name AS artist, track_artists.clear_name AS clear_artists');
$this->db->from($this->_table); $this->db->from($this->_table);
$this->db->join('track_user', 'track_user.track_id = tracks.id', 'left');
$this->db->join('track_artists', 'track_artists.track_id = tracks.id', 'left');
$this->db->where($this->_table . '.id', $id); $this->db->where($this->_table . '.id', $id);
$query = $this->db->get(); $query = $this->db->get();
return $query->result_array(); return $query->result_array();
...@@ -97,6 +99,21 @@ class Track_model extends CI_Model ...@@ -97,6 +99,21 @@ class Track_model extends CI_Model
return $query->result_array(); return $query->result_array();
} }
public function getListSingle()
{
$this->db->select('*');
$this->db->from('track_user');
$query = $this->db->get();
return $query->result_array();
}
public function searchSingle($name)
{
$this->db->select('*');
$this->db->like('name', $name);
$query = $this->db->get('track_user');
return $query->result_array();
}
} }
/* End of file welcome.php */ /* End of file welcome.php */
......
...@@ -18,6 +18,7 @@ $action = $CI->router->fetch_method(); ...@@ -18,6 +18,7 @@ $action = $CI->router->fetch_method();
<link rel="stylesheet" href="<?php echo base_url('public/assets/font-awesome/4.2.0/css/font-awesome.min.css') ?>"/> <link rel="stylesheet" href="<?php echo base_url('public/assets/font-awesome/4.2.0/css/font-awesome.min.css') ?>"/>
<link rel="stylesheet" href="<?php echo base_url('public/assets/css/datepicker.min.css') ?>" /> <link rel="stylesheet" href="<?php echo base_url('public/assets/css/datepicker.min.css') ?>" />
<link rel="stylesheet" href="<?php echo base_url().'public/assets/css/daterangepicker.min.css' ?>" /> <link rel="stylesheet" href="<?php echo base_url().'public/assets/css/daterangepicker.min.css' ?>" />
<link rel="stylesheet" href="<?php echo base_url().'public/assets/css/chosen.min.css' ?>"/>
<!-- text fonts --> <!-- text fonts -->
<link rel="stylesheet" href="<?php echo base_url().'public/assets/fonts/fonts.googleapis.com.css' ?>"/> <link rel="stylesheet" href="<?php echo base_url().'public/assets/fonts/fonts.googleapis.com.css' ?>"/>
<!-- ace styles --> <!-- ace styles -->
...@@ -35,8 +36,10 @@ $action = $CI->router->fetch_method(); ...@@ -35,8 +36,10 @@ $action = $CI->router->fetch_method();
<!-- ace settings handler --> <!-- ace settings handler -->
<script src="<?php echo base_url().'public/assets/js/ace-extra.min.js' ?>"></script> <script src="<?php echo base_url().'public/assets/js/ace-extra.min.js' ?>"></script>
<script src="<?php echo base_url().'public/assets/js/jquery.1.11.1.min.js' ?>"></script> <!-- <script src="<?php echo base_url().'public/assets/js/jquery.1.11.1.min.js' ?>"></script> -->
<script src="<?php echo base_url().'public/assets/js/jquery.2.1.1.min.js' ?>"></script>
<script src="<?php echo base_url().'public/assets/js/bootstrap.min.js' ?>"></script> <script src="<?php echo base_url().'public/assets/js/bootstrap.min.js' ?>"></script>
<script src="<?php echo base_url().'public/assets/js/chosen.jquery.min.js' ?>"></script>
<script src="<?php echo base_url().'public/fckeditor/ckfinder/ckfinder.js' ?>"></script> <script src="<?php echo base_url().'public/fckeditor/ckfinder/ckfinder.js' ?>"></script>
</head> </head>
......
...@@ -2,33 +2,30 @@ ...@@ -2,33 +2,30 @@
$input_title = array( $input_title = array(
'name' => 'title', 'name' => 'title',
'type' => 'text', 'type' => 'text',
'value' => ($title) ? $title : $contest[0]['title'], 'value' => isset($title) ? $title : $contest[0]['title'],
'placeholder' => '', 'placeholder' => '',
'class' => '', 'class' => '',
'style' => 'width: 100%', 'style' => 'width: 100%',
'min' => 1, 'min' => 1,
'max' => 50 'max' => 50
); );
$input_date_limit = array( $input_single = array(
'name' => 'date_limit', 'name' => 'single',
'type' => 'number', 'type' => 'text',
'value' => ($date_limit) ? $date_limit : $contest[0]['date_limit'], 'value' => isset($date_limit) ? $date_limit : $contest[0]['name_single'],
'placeholder' => '', 'placeholder' => '',
'class' => '', 'class' => '',
'style' => 'width: 100%', 'style' => 'width: 100%',
'min' => 1, 'min' => 1,
'max' => 50 'max' => 50
); );
$input_date_from = array( $input_artist = array(
'name' => 'date_from', 'name' => 'artist',
'type' => 'text', 'type' => 'text',
'value' => ($date_from) ? $date_from : $contest[0]['date_from'], 'value' => isset($artist) ? $artist : ($contest[0]['userid'] == 0) ? $contest[0]['artist'] : $contest[0]['clear_artists'],
'placeholder' => '', 'placeholder' => '',
'class' => 'date-picker', 'class' => '',
'id' => 'id-date_from',
'style' => 'width: 100%', 'style' => 'width: 100%',
'readonly' => true,
'data-date-format' => "yyyy-mm-dd"
); );
?> ?>
...@@ -62,27 +59,42 @@ $input_date_from = array( ...@@ -62,27 +59,42 @@ $input_date_from = array(
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-lg-3">Số ngày triển khai (>= 7) (*)</label> <label class="col-lg-3">Tên ca sĩ (*)</label>
<div class="col-lg-3"> <div class="col-lg-3">
<?php <?php
echo form_input($input_date_limit); echo form_input($input_single);
if(validation_errors()){echo form_error('date_limit', '<div class="error">', '</div>');} if(validation_errors()){echo form_error('date_limit', '<div class="error">', '</div>');}
?> ?>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-lg-3">Ngày bắt đầu (>= Ngày hiện tại) (*)</label> <label class="col-lg-3">Tên nhạc sĩ (*)</label>
<div class="col-lg-3"> <div class="col-lg-3">
<?php <?php
echo form_input($input_date_from); echo form_input($input_artist);
if(validation_errors()){echo form_error('date_from', '<div class="error">', '</div>');} if(validation_errors()){echo form_error('date_from', '<div class="error">', '</div>');}
?> ?>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-lg-3">Tên nhạc sĩ (*)</label>
<div class="col-lg-3">
<select id='form-field-select-3' style='width: 200px;' class="chosen-select form-control"
data-placeholder="Choose a State...">
<?php foreach ($list_single as $single): ?>
<option value="<?php echo $single['id']; ?>"
<?php echo ($single['id'] == $contest[0]['id_single']) ? 'selected': ''; ?>>
<?php echo $single['name']; ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="form-group">
<div class="col-lg-3"> <div class="col-lg-3">
<a href="<?php echo base_url().'backend/cmsSetting/listGroup'?>" onclick="return confirm('Bạn có chắc chắn muốn quay lại Danh sách không?')"> <a href="<?php echo base_url().'backend/cmsSetting/listGroup'?>"
onclick="return confirm('Bạn có chắc chắn muốn quay lại Danh sách không?')">
<button type="button" class="btn btn-sm btn-default"> <button type="button" class="btn btn-sm btn-default">
<i class="ace-icon fa fa-arrow-left"></i>Quay lại <i class="ace-icon fa fa-arrow-left"></i>Quay lại
</button> </button>
...@@ -103,12 +115,29 @@ $input_date_from = array( ...@@ -103,12 +115,29 @@ $input_date_from = array(
</div> </div>
</div><!-- /.row --> </div><!-- /.row -->
<script> <script>
$(document).ready(function(){ $(document).ready(function() {
$('.date-picker').datepicker({ $('.chosen-select').chosen({
autoclose: true, allow_single_deselect: true
todayHighlight: true, });
minDate: '<?php echo date('Y-m-d')?>' $(window)
.off('resize.chosen')
.on('resize.chosen', function() {
$('.chosen-select').each(function() {
var $this = $(this);
$this.next().css({
'width': $this.parent().width()
});
})
}).trigger('resize.chosen');
//resize chosen on sidebar collapse/expand
$(document).on('settings.ace.chosen', function(e, event_name, event_val) {
if (event_name != 'sidebar_collapsed') return;
$('.chosen-select').each(function() {
var $this = $(this);
$this.next().css({
'width': $this.parent().width()
});
}) })
}); });
});
</script> </script>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment