【发布时间】:2015-09-30 05:07:25
【问题描述】:
我目前遇到了爆炸到 html 表格的问题。
我的控制器
public function idp_test()
{
$this->load->model('groups/groups_model');
$scholar_id = $this->session->userdata('scholar_id');
$groups = $this->groups_model->retrieve_groups_idp($this->scholar->level_id);
$content = array(
'groups' => $groups,
'scholar' => $this->scholar,
'page_title' => 'My individual development plan',
'page_view' => 'scholar/activities/idp_test',
'page_scripts_view' => 'scholar/inc/_choose_activities_scripts',
'sidebar_menu' => 'idp test'
);
$this->load->view("theme/base", $content);
}
我的模型
public function retrieve_groups_idp($level_id)
{
$this->db->select("groups.*, levels.name as levelname");
$this->db->join('activities', 'groups.activity_ids = activities.activity_id' );
$this->db->join('levels', 'levels.level_id = groups.level_id', 'left' );
$this->db->join('activity_types', 'activities.activity_type_id = activity_types.activity_type_id', 'left' );
$this->db->where('groups.level_id', $level_id);
$this->db->group_by('groups_name');
$this->db->order_by('groups_name');
$qr = $this->db->get('groups');
return $qr->result();
}
public function retrieve_activity_desc($activity_ids)
{
$activity_desc_arr[] = explode(', ', $activity_ids);
foreach ($activity_desc_arr as $activity_id){
$this->db->select("activity_id as activityid, CONCAT(activities.name, ' - ', activity_types.name) AS description", FALSE);
$this->db->join('activity_types', 'activities.activity_type_id = activity_types.activity_type_id');
$this->db->where_in('activities.activity_id', $activity_id);
$qr = $this->db->get('activities');
return $qr->result();
}
}
我的观点
<?php foreach ($groups as $groups): ?>
<table class="table table-vcenter">
<thead>
<tr class="active">
<th><?php echo $groups->groups_name?></th> <!--Series Header -->
<th class="text-center"><small><strong>Module Type</strong></small></th>
<th class="text-center"><small><strong>Status</strong></small></th>
<th class="text-center"><small><strong>Action</strong></small></th>
</tr>
</thead>
<tbody>
<tr>
<td><?php
$rows = $this->groups_model->retrieve_activity_desc($groups->activity_ids);
foreach ($rows as $row){
echo var_dump($row->description);
}
?></td>
<td class="text-center">belom lagi</td>
<td class="text-center">TO ATTEND</td>
<td class="text-center"><a href="javascript:void(0)" class="label label-success">View Session</a></td>
</tr>
</tbody>
</table>
<?php endforeach ?>
我无法发布图片,所以下面是目前看到的一些示例
FS 系列 1 |模块类型 |状态 |行动
系列 1 - FIL 系列 1 - CBL 系列 1 - PEL |贝隆拉吉|参加|
我需要实现的就像下面的示例视图
FS 系列 1 |模块类型 |状态 |行动
系列 1 - FIL |贝隆拉吉|参加|
系列 1 - CBL |贝隆拉吉|参加|
系列 1 - PEL |贝隆拉吉|参加|
我是 php 和 codeigniter 的新手,对不起我的英语。
谢谢
【问题讨论】:
标签: php html codeigniter