I create my custom module but the data from database cannot show.
The module's name is mod_ballreport
The table 's name in database is mod_ballreport
The source code of the mod_ballreport.php is
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
require_once('data/SugarBean.php');
require_once('include/utils.php');
class mod_ballreport extends SugarBean {
var $id;
var $description;
var $report_sql;
var $name;
var $assigned_user_id;
var $date_modified;
var $deleted;
var $table_name = "mod_ballreport";
var $module_dir = "mod_ballreport";
var $track_on_save=true;
var $object_name = "mod_ballreport";
function mod_ballreport()
{
parent::SugarBean();
}
}
?>
The code of vardefs.php is
<?php
#Ensure that the file can only be accessed via SugarCRM
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
#Define the dictionary
$dictionary['mod_ballreport'] = array(
#Define the table to be used, their data types, labels, etc
'table' => 'ppi_reports',
'unified_search' => true,
'comment' => 'Reports',
#Define the fields to be used
'fields' => array(
'id' => array(
'name' => 'id',
'vname' => 'LBL_ID',
'required' => true,
'type' => 'id',
'reportable'=>false,
'comment' => 'Unique identifier'
),
'description' => array(
'name' => 'description',
'vname' => 'LBL_DESCRIPTION',
'required' => false,
'type' => 'text',
'comment' => 'Report description'
),
'report_sql' => array(
'name' => 'report_sql',
'vname' => 'LBL_REPORT_SQL',
'required' => false,
'type' => 'text',
'comment' => 'Report SQL'
),
'name' => array(
'name' => 'name',
'vname' => 'LBL_NAME',
'required' => true,
'dbType' => 'varchar',
'type' => 'name',
'len' => 50,
'unified_search' => true,
'comment' => 'Report name'
),
'assigned_user_id' => array(
'name' => 'assigned_user_id',
'rname' => 'user_name',
'id_name' => 'assigned_user_id',
'type' => 'assigned_user_name',
'vname' => 'LBL_ASSIGNED_USER_ID',
'required' => false,
'len' => 36,
'dbType' => 'id',
'table' => 'users',
'isnull' => false,
'reportable'=>true,
'comment' => 'User assigned to this report'
),
'date_modified' => array (
'name' => 'date_modified',
'vname' => 'LBL_DATE_MODIFIED',
'type' => 'datetime',
'required' => false,
'comment' => 'Date record last modified'
),
'deleted' => array (
'name' => 'deleted',
'vname' => 'LBL_DELETED',
'type' => 'bool',
'required' => true,
'reportable'=>false,
'comment' => 'Record deletion indicator',
),
),
);
?>
The code of listviewdef.php is
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
$listViewDefs['mod_ballreport'] = array(
'NAME' => array(
'width' => '50',
'label' => 'LBL_NAME',
'default' => true
),
'DESCRIPTION' => array(
'width' => '50',
'label' => 'LBL_DESCRIPTION',
'default' => true
),
'REPORT_SQL' => array(
'width' => '50',
'label' => 'LBL_REPORT_SQL',
'default' => true),
);
?>
The code of listview.php is
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
require_once ('modules/mod_ballreport/mod_ballreport.php');
require_once('include/ListView/ListViewSmarty.php');
require_once('modules/mod_ballreport/metadata/listviewdefs.php');
$seedmod_ballreport = new mod_ballreport();
$lv = new ListViewSmarty();
$lv->displayColumns = $listViewDefs['mod_ballreport'];
$lv->setup($seedmod_ballreport,'include/ListView/ListViewGeneric.tpl', $where,$listViewDefs['mod_ballreport']);
echo $lv->display();
?>
The output is
![]()


LinkBack URL
About LinkBacks




Reply With Quote
Bookmarks