40 lines
1.4 KiB
PHP
40 lines
1.4 KiB
PHP
|
|
<?php if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||
|
|
require_once('include/generic/SugarWidgets/SugarWidgetField.php');
|
||
|
|
class SugarWidgetSubPanelMediaartNewField extends SugarWidgetField //payattention to the name of class here
|
||
|
|
{
|
||
|
|
function displayHeaderCell(&$layout_def){
|
||
|
|
if(!empty($layout_def['displayHeaderCell']) && $layout_def['displayHeaderCell'] == false) {
|
||
|
|
return ' ';
|
||
|
|
}
|
||
|
|
else {
|
||
|
|
return parent::displayHeaderCell($layout_def);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
function displayList(&$layout_def){
|
||
|
|
global $focus;
|
||
|
|
if(isset($layout_def['varname']))
|
||
|
|
{
|
||
|
|
$key = strtoupper($layout_def['varname']);
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
$key = $this->_get_column_alias($layout_def);
|
||
|
|
$key = strtoupper($key);
|
||
|
|
}
|
||
|
|
//////////////////////////////////////////////////////////////////////////
|
||
|
|
// Current ProductTemplate record (in current subpanel row)
|
||
|
|
$module = $layout_def['module'];
|
||
|
|
$record = $layout_def['fields']['ID']; //id contract
|
||
|
|
$contractName = $layout_def['fields']['NAME']; //name contract
|
||
|
|
|
||
|
|
$parent_id=$_REQUEST['record']; //id account-a
|
||
|
|
//Here you define your logic, my quary to the database and the return from this function will be displayed in subpanel
|
||
|
|
//So for example you can do
|
||
|
|
$db = DBManagerFactory::getInstance();
|
||
|
|
$query = "SELECT * FROM contracts WHERE id = '$record' and account_id = '$parent_id'";
|
||
|
|
$result = $db->query($query, true,"greska");
|
||
|
|
$result = $db->fetchByAssoc($result);
|
||
|
|
$quantity = $result['broj_slucajeva'];
|
||
|
|
return $quantity; //value of this cariable will be shown in subpanel
|
||
|
|
}
|
||
|
|
} ?>
|