2016-02-26 65 views
1
$header = array(
    array('data' => t('S No'), 'field' => 't.id'), 
    array('data' => t('Country Name'), 'field' => 't.country_name'), 
    array('data' => t('Status'), 'field' => 't.status'), 
    array('data' => t('Added Date'), 'field' => 't.added_date'), 
    array('data' => t('Action'), 'field' => 't.id',), 
    array('data' => t('Action'), '',), 
); 



$limit = 10; 
    $query = db_select('countries', 't')->extend('TableSort')->extend('PagerDefault')->limit($limit)->orderby('country_name', ASC); 
    //condition(); 
    $query->fields('t'); 
    //$edit=echo '<i class="fa fa-pencil-square-o"></i>'; 
    //$edit=echo '<i class="fa fa-pencil-square-o"></i>'; 
    // Don't forget to tell the query object how to find the header information. 
    $result = $query 
     ->orderByHeader($header) 
     ->execute(); 

    $rows = array(); 
    $i=1; 

    foreach ($result as $row) { 

    $rows[] = array(
    $i, 
    //($x === 2) ? 0 : $x+1, 
    //$row->id, 
    $row->country_name, 
    //$row->status, 
    //$row->status, 
    $status = ($row->status == 0) ? 'Inactive' : 'Active', 
    date('d-m-Y H:i:s', strtotime($row->added_date)), 
    l('Edit', 'mypages/countries/'. $row->id), 
    l('Delete', 'mypages/delete/'. $row->country_name) 

    ); 
//print_r($status); 
    $i++; 
    } 

在这个数据我在哪里,从数据库中获取数据并显示它..Now我想显示为动态管理一样的状态可以修改状态,如果他需要..如何使Drupal 7的可编辑字段在表中仅管理

$status = ($row->status == 0) ? 'Inactive' : 'Active', 

在那里他可以让active or inactive

如果我们可以给降活性或非活性降低其更好..where管理员可以选择自动更新选择状态status..after .. 。 我正在显示S号作为编号,它是在第一页中工作的号码,如编号自动递增,其中编号为第二页..编号系统从最初重新开始...

什么是解决方案对于以上

回答

0

您可能必须创建另一个标题项来执行激活/停用操作,通过检查user_access。 在行中,您可以根据当前状态添加是否激活/取消激活的链接。您可以通过传递查询参数,状态和更新状态来点击激活或取消激活链接,重定向到编辑页面。

相关问题