fault('RSS currently only supports the get_entry_list method');
ob_clean();
$this->generateResponseHeader($input['result_count']);
$this->generateItems($input);
$this->generateResponseFooter();
} // fn
function generateResponseHeader($count){
$date = gmdate("D, d M Y H:i:s") . " GMT";
echo'
SugarCRM RSS Feed
http://cnn.com
' . $count. ' records found
' . $date . '
SugarCRM
' . $count . '
';
}
function generateItems($input){
if(!empty($input['entry_list'])){
foreach($input['entry_list'] as $item){
$this->generateItem($item);
}
}
}
function generateItem($item){
echo "- \n";
$name = !empty($item['name_value_list']['name'])?htmlentities( $item['name_value_list']['name']): '';
echo "$name\n";
echo "". $GLOBALS['sugar_config']['site_url'] . htmlentities('/index.php?module=' . $item['module_name']. '&record=' . $item['id']) . "\n";
echo "$v){
if($k =='name')continue;
if($k == 'date_modified')continue;
if($displayFieldNames) echo '' .htmlentities( $k) . ': ';
echo htmlentities( $v) . "\n
";
}
echo "]]>\n";
if(!empty($item['name_value_list']['date_modified'])){
$date = date("D, d M Y H:i:s", strtotime($item['name_value_list']['date_modified'])) . " GMT";
echo "$date";
}
echo "" . $item['id']. "\n";
echo " \n";
}
function generateResponseFooter(){
echo'';
}
/**
* This method calls functions on the implementation class and returns the output or Fault object in case of error to client
*
* @return unknown
*/
function serve(){
$this->fault('RSS is not a valid input_type');
} // fn
function fault($faultObject){
ob_clean();
$this->generateResponseHeader();
echo '- ';
if(is_object($errorObject)){
$error = $errorObject->number . ': ' . $errorObject->name . '
' . $errorObject->description;
$GLOBALS['log']->error($error);
}else{
$GLOBALS['log']->error(var_export($errorObject, true));
$error = var_export($errorObject, true);
} // else
echo $error;
echo ' ';
$this->generateResponseFooter();
}
} // clazz