提交 4b699f05 编写于 作者: G gongfuxiang

前台-学生关联列表+解除

上级 5a2366d1
......@@ -114,6 +114,7 @@ return array(
'common_operation_cancel' => '取消',
'common_operation_update' => '更新',
'common_operation_test' => '测试',
'common_operation_cut' => '解除',
'common_operation_success' => '操作成功',
'common_operation_error' => '操作失败',
'common_operation_add_success' => '新增成功',
......
......@@ -33,9 +33,89 @@ class StudentController extends CommonController
*/
public function Index()
{
// 获取列表
$where = array('us.user_id'=>$this->user['id']);
$list = $this->SetDataHandle(M('UserStudent')->alias('us')->join('__STUDENT__ AS s ON s.id=us.student_id ')->field('s.*, us.id AS user_student_id,us.add_time AS bundled_time')->where($where)->select());
// 数据列表
$this->assign('list', $list);
//print_r($list);
$this->display('Index');
}
/**
* [SetDataHandle 数据处理]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-29T21:27:15+0800
* @param [array] $data [学生数据]
* @return [array] [处理好的数据]
*/
private function SetDataHandle($data)
{
if(!empty($data))
{
$c = M('Class');
$r = M('Region');
$s = M('Semester');
foreach($data as $k=>$v)
{
// 班级
$tmp_class = $c->field(array('pid', 'name'))->find($v['class_id']);
if(!empty($tmp_class))
{
$p_name = ($tmp_class['pid'] > 0) ? $c->where(array('id'=>$tmp_class['pid']))->getField('name') : '';
$data[$k]['class_name'] = empty($p_name) ? $tmp_class['name'] : $p_name.'-'.$tmp_class['name'];
} else {
$data[$k]['class_name'] = '';
}
// 地区
$data[$k]['region_name'] = $r->where(array('id'=>$v['region_id']))->getField('name');
// 学期
$data[$k]['semester_text'] = $s->where(array('id'=>$v['semester_id']))->getField('name');
// 出生
$data[$k]['birthday'] = date('Y-m-d', $v['birthday']);
// 报名时间
$data[$k]['add_time'] = date('Y-m-d H:i:s', $v['add_time']);
// 更新时间
$data[$k]['upd_time'] = date('Y-m-d H:i:s', $v['upd_time']);
// 绑定时间
$data[$k]['bundled_time'] = date('Y-m-d H:i:s', $v['bundled_time']);
// 性别
$data[$k]['gender'] = L('common_gender_list')[$v['gender']]['name'];
// 状态
$data[$k]['state'] = L('common_student_state_list')[$v['state']]['name'];
// 缴费状态
$data[$k]['tuition_state_text'] = L('common_tuition_state_list')[$v['tuition_state']]['name'];
}
}
return $data;
}
/**
* [ScoreInfo 成绩查询]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2017-03-22T22:39:04+0800
*/
public function ScoreInfo()
{
$this->display('ScoreInfo');
}
/**
* [PolyInfo 学生关联-页面]
* @author Devil
......@@ -48,6 +128,29 @@ class StudentController extends CommonController
$this->display('PolyInfo');
}
/**
* [Delete 学生关联-解除]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-25T22:36:12+0800
*/
public function Delete()
{
if(!IS_AJAX)
{
$this->error(L('common_unauthorized_access'));
}
// 数据删除
if(M('UserStudent')->where(array('id'=>I('id'), 'user_id'=>$this->user['id']))->delete())
{
$this->ajaxReturn(L('common_operation_delete_success'));
} else {
$this->ajaxReturn(L('common_operation_delete_error'), -100);
}
}
/**
* [Poly 学生关联]
* @author Devil
......
......@@ -17,5 +17,13 @@ return array(
'student_accounts_format' => '手机/邮箱格式有误',
'student_accounts_on_exist_error' => '帐号不存在',
'student_join_accounts_exist_tips' => '该账户已关联',
'student_class_text' => '班级',
'student_birthday_text' => '出生日期',
'student_my_mobile_name' => '学生手机',
'student_tuition_state_text' => '缴费状态',
'student_sign_up_name' => '报名时间',
'common_bundled_time_name' => '绑定时间',
'student_semester_text' => '学期',
'student_score_text' => '查成绩',
);
?>
\ No newline at end of file
......@@ -19,6 +19,114 @@
<a href="{{:U('Home/Student/PolyInfo')}}" class="am-btn am-btn-secondary am-radius am-btn-xs am-icon-plus"> {{:L('student_operation_poly_add')}}</a>
</div>
<!-- operation end -->
<!-- list start -->
<table class="am-table am-table-striped am-table-hover am-text-middle m-t-10 m-l-5">
<thead>
<tr>
<th>{{:L('student_username_name')}}</th>
<th class="am-hide-sm-only">{{:L('common_view_student_number_text')}}</th>
<th>{{:L('common_view_gender_name')}}</th>
<th class="am-hide-sm-only">{{:L('student_class_text')}}</th>
<th class="am-hide-sm-only">{{:L('common_view_student_state_name')}}</th>
<th>{{:L('common_more_name')}}</th>
<th>{{:L('common_operation_name')}}</th>
</tr>
</thead>
<tbody>
<if condition="!empty($list)">
<foreach name="list" item="v">
<tr id="data-list-{{$v.user_student_id}}">
<td>{{$v.username}}</td>
<td class="am-hide-sm-only">{{$v.number}}</td>
<td>{{$v.gender}}</td>
<td class="am-hide-sm-only">{{$v.class_name}}</td>
<td class="am-hide-sm-only">{{$v.state}}</td>
<td>
<span class="am-icon-caret-down c-p" data-am-modal="{target: '#my-popup{{$v.user_student_id}}'}"> {{:L('common_see_more_name')}}</span>
<div class="am-popup am-radius" id="my-popup{{$v.user_student_id}}">
<div class="am-popup-inner">
<div class="am-popup-hd">
<h4 class="am-popup-title">{{:L('common_detail_content')}}</h4>
<span data-am-modal-close class="am-close">&times;</span>
</div>
<div class="am-popup-bd">
<dl class="dl-content">
<dt>{{:L('student_username_name')}}</dt>
<dd>{{$v.username}}</dd>
<dt>{{:L('common_view_student_number_text')}}</dt>
<dd>{{$v.number}}</dd>
<dt>{{:L('common_view_id_card_text')}}</dt>
<dd>{{$v.id_card}}</dd>
<dt>{{:L('common_address_text')}}</dt>
<dd>{{$v.region_name}} {{$v.address}}</dd>
<dt>{{:L('common_view_gender_name')}}</dt>
<dd>{{$v.gender}}</dd>
<dt>{{:L('student_birthday_text')}}</dt>
<dd>{{$v.birthday}}</dd>
<dt>{{:L('common_view_tel_name')}}</dt>
<dd>{{$v.tel}}</dd>
<dt>{{:L('student_my_mobile_name')}}</dt>
<dd>{{$v.my_mobile}}</dd>
<dt>{{:L('common_view_parent_mobile_name')}}</dt>
<dd>{{$v.parent_mobile}}</dd>
<dt>{{:L('common_email_name')}}</dt>
<dd>{{$v.email}}</dd>
<dt>{{:L('student_class_text')}}</dt>
<dd>{{$v.class_name}}</dd>
<dt>{{:L('student_semester_text')}}</dt>
<dd>{{$v.semester_text}}</dd>
<dt>{{:L('student_tuition_state_text')}}</dt>
<dd>{{$v.tuition_state_text}}</dd>
<dt>{{:L('common_view_student_state_name')}}</dt>
<dd>{{$v.state}}</dd>
<dt>{{:L('student_sign_up_name')}}</dt>
<dd>{{$v.add_time}}</dd>
<dt>{{:L('common_upd_time_name')}}</dt>
<dd>{{$v.upd_time}}</dd>
<dt>{{:L('common_bundled_time_name')}}</dt>
<dd>{{$v.bundled_time}}</dd>
</dl>
</div>
</div>
</div>
</td>
<td class="view-operation">
<a href="{{:U('Home/Student/ScoreInfo', array('id'=>$v['id']))}}">
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-mortar-board" data-am-popover="{content: '{{:L('student_score_text')}}', trigger: 'hover focus'}"></button>
</a>
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-cut submit-delete" data-url="{{:U('Home/Student/Delete')}}" data-am-popover="{content: '{{:L('common_operation_cut')}}', trigger: 'hover focus'}" data-id="{{$v.user_student_id}}"></button>
</td>
</tr>
</foreach>
<else />
<tr><td colspan="10" class="table-no">{{:L('common_not_data_tips')}}</td></tr>
</if>
</tbody>
</table>
<!-- list end -->
<!-- page start -->
<if condition="!empty($list)">
{{$page_html}}
</if>
<!-- page end -->
</div>
</div>
<!-- content end -->
......
......@@ -349,10 +349,4 @@ ul {margin-top:0;}
html, body {
overflow-x: hidden;
}
}
/* 公共dl样式 */
.dl-content dt { float: left; padding-left: 5px; overflow: hidden; clear: left;
width: 30%; }
.dl-content dd { border-bottom: 1px solid #efefef; padding-left: 30%; }
.dl-content dt, .dl-content dd { font-weight: normal !important; text-align: left; margin-top: 0px; line-height: 35px; min-height: 35px; }
\ No newline at end of file
}
\ No newline at end of file
......@@ -39,6 +39,12 @@ input:hover, select:hover, textarea:hover, .chosen-choices:hover, .chosen-single
.left-menu-more-ico-rotate {-webkit-transform: rotate(-90deg);transform: rotate(-90deg);-webkit-transition: all 300ms;transition: all 300ms;}
.am-icon-angle-down {-webkit-transition: all 300ms;transition: all 300ms;}
/* 公共dl样式 */
.dl-content dt { float: left; padding-left: 5px; overflow: hidden; clear: left;
width: 30%; }
.dl-content dd { border-bottom: 1px solid #efefef; padding-left: 30%; }
.dl-content dt, .dl-content dd { font-weight: normal !important; text-align: left; margin-top: 0px; line-height: 35px; min-height: 35px; }
/**
* 表单光标
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册