Hi
I have a create a custom module to list all the data from my db in a tabular format. I have have used the concept of theme('table', $header, $rows). With this concept i have got the exact output what i was hoping for. While the form has been called directly in the tpl page to print the form. But now along with it i need to add pagination in my custom module. I have referred the creating the pagination in the custom module from here: http://programmingbulls.com/how-write-simple-pagerquery-drupal-sortable.
Now my question is why my theme('pager', NULL, 2, 0); function is not working.
Please check the source code below:
<?php
function report_listing_perm() {
return array('create report_listing entries', 'delete own report_listing entries', 'delete any report_listing entry', 'edit own report_listing entries', 'edit any report_listing entry');
}
function report_listing_init() {
global $user;
}
function report_listing_form($form) {
$form['report'] = array('#type' => 'markup',
// '#value' => t('Report List'),
'#prefix' => '
'#suffix' => '
',
);
$form['documentlisting'] = array('#type' => 'markup',
'#value' => listing(),
'#prefix' => '
'#suffix' => '
',
);
return $form;
}
function listing(){
$header = array();
$rows[]=array();
$header = array('data' => t('Document Name'));
$sqlQry1 = "select nid from {node} where type ='teacherupload'";
$sqlDBExecRes = db_query($sqlQry1);
$list_admin1 = '';
while ($sqlDBExecData = db_fetch_array($sqlDBExecRes)) {
$sqlQry2 = "SELECT f.fid,f.filename,f.filesize,f.uid,f.filemime, f.filepath, FROM_UNIXTIME (n.created,'%D %M %Y') as created FROM content_type_teacherupload as cntType, files as f , node as n WHERE cntType.nid IN ({$sqlDBExecData['nid']}) AND cntType.nid=n.nid AND f.fid=cntType.field_document_upload_fid";
$sqlCountQry ="SELECT COUNT(*) FROM content_type_teacherupload as cntType, files as f , node as n WHERE cntType.nid IN ({$sqlDBExecData['nid']}) AND cntType.nid=n.nid AND f.fid=cntType.field_document_upload_fid";
$result_set = pager_query($sqlQry2, 2, 0, $sqlCountQry);
while ($data = db_fetch_object( $result_set)){
$rows[]= array(array('data'=> t($data->filename)));
}
}
$output = theme('table', $header, $rows);
$output .= theme('pager', NULL, 2, 0);
print $output;
//return $output1.$output;
}
Looking for the help..
Comments
hi
I am still looking of the help
hi
m still struggling with this topic.