CODE STYLE class.dashletProcessMakerCommunity.php class.dashletProcessMakerEnterprise.php class.dashletRssReader.php
This commit is contained in:
@@ -2,25 +2,30 @@
|
|||||||
|
|
||||||
require_once 'classes/interfaces/dashletInterface.php';
|
require_once 'classes/interfaces/dashletInterface.php';
|
||||||
|
|
||||||
class dashletProcessMakerCommunity implements DashletInterface {
|
class dashletProcessMakerCommunity implements DashletInterface
|
||||||
|
{
|
||||||
|
|
||||||
const version = '1.0';
|
const version = '1.0';
|
||||||
|
|
||||||
public static function getAdditionalFields($className) {
|
public static function getAdditionalFields ($className)
|
||||||
|
{
|
||||||
$additionalFields = array ();
|
$additionalFields = array ();
|
||||||
|
|
||||||
return $additionalFields;
|
return $additionalFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getXTemplate($className) {
|
public static function getXTemplate ($className)
|
||||||
|
{
|
||||||
return "<iframe src=\"{page}?DAS_INS_UID={id}\" width=\"{width}\" height=\"207\" frameborder=\"0\"></iframe>";
|
return "<iframe src=\"{page}?DAS_INS_UID={id}\" width=\"{width}\" height=\"207\" frameborder=\"0\"></iframe>";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setup($config) {
|
public function setup ($config)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render ($width = 300) {
|
public function render ($width = 300)
|
||||||
|
{
|
||||||
$html = "
|
$html = "
|
||||||
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">
|
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">
|
||||||
|
|
||||||
|
|||||||
@@ -2,25 +2,30 @@
|
|||||||
|
|
||||||
require_once 'classes/interfaces/dashletInterface.php';
|
require_once 'classes/interfaces/dashletInterface.php';
|
||||||
|
|
||||||
class dashletProcessMakerEnterprise implements DashletInterface {
|
class dashletProcessMakerEnterprise implements DashletInterface
|
||||||
|
{
|
||||||
|
|
||||||
const version = '1.0';
|
const version = '1.0';
|
||||||
|
|
||||||
public static function getAdditionalFields($className) {
|
public static function getAdditionalFields ($className)
|
||||||
|
{
|
||||||
$additionalFields = array ();
|
$additionalFields = array ();
|
||||||
|
|
||||||
return $additionalFields;
|
return $additionalFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getXTemplate($className) {
|
public static function getXTemplate ($className)
|
||||||
|
{
|
||||||
return "<iframe src=\"{page}?DAS_INS_UID={id}\" width=\"{width}\" height=\"207\" frameborder=\"0\"></iframe>";
|
return "<iframe src=\"{page}?DAS_INS_UID={id}\" width=\"{width}\" height=\"207\" frameborder=\"0\"></iframe>";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setup($config) {
|
public function setup ($config)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render ($width = 300) {
|
public function render ($width = 300)
|
||||||
|
{
|
||||||
$html = "
|
$html = "
|
||||||
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">
|
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,13 @@
|
|||||||
|
|
||||||
require_once 'classes/interfaces/dashletInterface.php';
|
require_once 'classes/interfaces/dashletInterface.php';
|
||||||
|
|
||||||
class dashletRssReader implements DashletInterface {
|
class dashletRssReader implements DashletInterface
|
||||||
|
{
|
||||||
|
|
||||||
const version = '1.0';
|
const version = '1.0';
|
||||||
|
|
||||||
public static function getAdditionalFields($className) {
|
public static function getAdditionalFields ($className)
|
||||||
|
{
|
||||||
$additionalFields = array ();
|
$additionalFields = array ();
|
||||||
|
|
||||||
$urlFrom = new stdclass();
|
$urlFrom = new stdclass();
|
||||||
@@ -22,16 +24,19 @@ class dashletRssReader implements DashletInterface {
|
|||||||
return $additionalFields;
|
return $additionalFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getXTemplate($className) {
|
public static function getXTemplate ($className)
|
||||||
|
{
|
||||||
return "<iframe src=\"{page}?DAS_INS_UID={id}\" width=\"{width}\" height=\"207\" frameborder=\"0\"></iframe>";
|
return "<iframe src=\"{page}?DAS_INS_UID={id}\" width=\"{width}\" height=\"207\" frameborder=\"0\"></iframe>";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setup($config) {
|
public function setup ($config)
|
||||||
|
{
|
||||||
$this->urlFrom = isset( $config['DAS_URL'] ) ? $config['DAS_URL'] : "http://license.processmaker.com/syspmLicenseSrv/en/green/services/rssAP";
|
$this->urlFrom = isset( $config['DAS_URL'] ) ? $config['DAS_URL'] : "http://license.processmaker.com/syspmLicenseSrv/en/green/services/rssAP";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render ($width = 300) {
|
public function render ($width = 300)
|
||||||
|
{
|
||||||
$pCurl = curl_init();
|
$pCurl = curl_init();
|
||||||
curl_setopt( $pCurl, CURLOPT_URL, $this->urlFrom );
|
curl_setopt( $pCurl, CURLOPT_URL, $this->urlFrom );
|
||||||
curl_setopt( $pCurl, CURLOPT_RETURNTRANSFER, true );
|
curl_setopt( $pCurl, CURLOPT_RETURNTRANSFER, true );
|
||||||
@@ -58,35 +63,35 @@ class dashletRssReader implements DashletInterface {
|
|||||||
if ($sysConf['proxy_user'] != '') {
|
if ($sysConf['proxy_user'] != '') {
|
||||||
curl_setopt( $pCurl, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : '') );
|
curl_setopt( $pCurl, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : '') );
|
||||||
}
|
}
|
||||||
curl_setopt($pCurl, CURLOPT_HTTPHEADER, array('Expect:'));
|
curl_setopt( $pCurl, CURLOPT_HTTPHEADER, array ('Expect:'
|
||||||
|
) );
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->rss = @simplexml_load_string( curl_exec( $pCurl ) );
|
$self->rss = @simplexml_load_string( curl_exec( $pCurl ) );
|
||||||
if($self->rss)
|
if ($self->rss) {
|
||||||
{
|
|
||||||
$index = 0;
|
$index = 0;
|
||||||
$render = '';
|
$render = '';
|
||||||
$self->items = $self->rss->channel->item;
|
$self->items = $self->rss->channel->item;
|
||||||
if (count( $self->rss->channel ) != 0) {
|
if (count( $self->rss->channel ) != 0) {
|
||||||
$status = 'true';
|
$status = 'true';
|
||||||
foreach($self->items as $self->item)
|
foreach ($self->items as $self->item) {
|
||||||
{
|
|
||||||
$self->title = $self->item->title;
|
$self->title = $self->item->title;
|
||||||
$self->link = $self->item->link;
|
$self->link = $self->item->link;
|
||||||
|
|
||||||
$self->des = $self->item->description;
|
$self->des = $self->item->description;
|
||||||
$render[] = array('link' => '<a href="'.$self->link.'" target="_blank">'.$self->title.'</a><br/>','description' => $self->des.'<br/><hr>');
|
$render[] = array ('link' => '<a href="' . $self->link . '" target="_blank">' . $self->title . '</a><br/>','description' => $self->des . '<br/><hr>'
|
||||||
|
);
|
||||||
$index ++;
|
$index ++;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$status = 'Error';
|
$status = 'Error';
|
||||||
$render[] =array('link' => 'Error', 'description' =>"Unable to parse XML");
|
$render[] = array ('link' => 'Error','description' => "Unable to parse XML"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$status = 'Error';
|
$status = 'Error';
|
||||||
$render[] =array('link' => 'Error', 'description' =>"Unable to parse XML");
|
$render[] = array ('link' => 'Error','description' => "Unable to parse XML"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
G::verifyPath( PATH_SMARTY_C, true );
|
G::verifyPath( PATH_SMARTY_C, true );
|
||||||
$smarty = new Smarty();
|
$smarty = new Smarty();
|
||||||
@@ -97,8 +102,7 @@ class dashletRssReader implements DashletInterface {
|
|||||||
$smarty->assign( 'url', $this->urlFrom );
|
$smarty->assign( 'url', $this->urlFrom );
|
||||||
$smarty->assign( 'render', $render );
|
$smarty->assign( 'render', $render );
|
||||||
$smarty->assign( 'status', $status );
|
$smarty->assign( 'status', $status );
|
||||||
}
|
} catch (Exception $ex) {
|
||||||
catch (Exception $ex) {
|
|
||||||
print $item->key;
|
print $item->key;
|
||||||
}
|
}
|
||||||
$smarty->display( 'dashletRssReaderTemplate.html', null, null );
|
$smarty->display( 'dashletRssReaderTemplate.html', null, null );
|
||||||
|
|||||||
Reference in New Issue
Block a user