function template_display_my_feed(&$feed_row)
{
    global $image_path, $even_bg, $sugar_config, $mod_strings;
    if (!defined('DOMIT_RSS_INCLUDE_PATH')) {
        define('DOMIT_RSS_INCLUDE_PATH', "include/domit_rss/");
    }
    require_once DOMIT_RSS_INCLUDE_PATH . 'xml_domit_rss.php';
    $rssdoc = new xml_domit_rss_document($feed_row['url'], 'cache/feeds/', $sugar_config['rss_cache_time']);
    $content = '';
    $currChannel = $rssdoc->getChannel(0);
    //        $channel_desc = $currChannel->getDescription();
    if (!method_exists($currChannel, 'getTitle')) {
        print $mod_strings['LBL_FEED_NOT_AVAILABLE'];
        // This section of the code fetches the filename of the cache required to delete and refresh
        require_once DOMIT_RSS_INCLUDE_PATH . 'php_text_cache.php';
        $cache = new php_text_cache('cache/feeds/', $sugar_config['rss_cache_time']);
        $deletecache = $cache->getCacheFileName($feed_row['url']);
        if (file_exists($deletecache)) {
            unlink($deletecache);
        }
        print "<br><a href='index.php?module=Feeds&action=index&return_module=Feeds&delete_cache='>" . $mod_strings['LBL_REFRESH_CACHE'] . "</a>";
        return;
    }
    if (method_exists($currChannel, 'getLastBuildDate')) {
        $last_build_date = $currChannel->getLastBuildDate();
    }
    $img_html = '';
    ?>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
    <td align="right"><nobr>
<a href="index.php?return_action=<?php 
    echo $_REQUEST['action'];
    ?>
&return_module=Feeds&action=MoveUp&module=Feeds&record=<?php 
    echo $feed_row['id'];
    ?>
"><?php 
    echo get_image($image_path . "uparrow", 'border="0" align="absmiddle" alt="Move Up"');
    ?>
</a>
<a href="index.php?return_action=<?php 
    echo $_REQUEST['action'];
    ?>
&return_module=Feeds&action=MoveDown&module=Feeds&record=<?php 
    echo $feed_row['id'];
    ?>
"><?php 
    echo get_image($image_path . "downarrow", 'border="0" align="absmiddle" alt="Move Down"');
    ?>
</a>
<a href="index.php?return_action=<?php 
    echo $_REQUEST['action'];
    ?>
&return_module=Feeds&action=DeleteFavorite&module=Feeds&record=<?php 
    echo $feed_row['id'];
    ?>
" class="listViewTdToolsS1"><?php 
    echo get_image($image_path . "delete", 'border="0" align="absmiddle" alt="delete from favorites"');
    ?>
</a>
</nobr></td>
</tr>
</table>

<table cellpadding="0" cellspacing="0" width="100%" border="0" class="listView">
<tr height="20"><td scope="col" width="100%" class="listViewThS1"><a href="index.php?action=DetailView&module=Feeds&record=<?php 
    echo $feed_row['id'];
    ?>
" class="listViewThLinkS1"><?php 
    echo $currChannel->getTitle();
    ?>
</a>  - <a   target="_new" href="<?php 
    echo $currChannel->getLink();
    ?>
" class="listViewThLinkS1">(<?php 
    echo $mod_strings['LBL_VISIT_WEBSITE'];
    ?>
)</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<?php 
    if (!empty($last_build_date)) {
        echo $mod_strings['LBL_LAST_UPDATED'];
        ?>
: <?php 
        echo $last_build_date;
    }
    ?>
</td>
      
</tr>
<tr>
<td scope="col" bgcolor="<?php 
    echo $even_bg;
    ?>
" class="evenListRowS1" colspan="10">

<?php 
    //get total number of items
    //$totalItems = $currChannel->getItemCount();
    $totalItems = 5;
    $topitem = $currChannel->getItem(0);
    if (!isset($topitem)) {
        ?>

No content


<?php 
    } else {
        //loop through each item
        for ($j = 0; $j < $totalItems; $j++) {
            //get reference to current item
            $currItem = $currChannel->getItem($j);
            if (!isset($currItem)) {
                continue;
            }
            $item_link = $currItem->getLink();
            $item_title = $currItem->getTitle();
            $item_date = $currItem->getPubDate();
            //$item_desc = $currItem->getDescription();
            ?>
<li> <a target="_new" href="<?php 
            echo $currItem->getLink();
            ?>
" class="listViewTdLinkS1"><?php 
            echo $currItem->getTitle();
            ?>
</a>&nbsp;&nbsp;<span class="rssItemDate"><?php 
            echo $item_date;
            ?>
</span>



<?php 
        }
    }
    ?>
</td></tr>
</table>
<?php 
}
Exemple #2
0
function template_display_my_feed(&$feed_row)
{
    global $sugar_config, $mod_strings, $current_user;
    $out = "";
    if (!defined('DOMIT_RSS_INCLUDE_PATH')) {
        define('DOMIT_RSS_INCLUDE_PATH', "include/domit_rss/");
    }
    require_once DOMIT_RSS_INCLUDE_PATH . 'xml_domit_rss.php';
    $rssdoc = new xml_domit_rss_document($feed_row['url'], $GLOBALS['sugar_config']['cache_dir'] . 'feeds/', $sugar_config['rss_cache_time']);
    $content = '';
    $currChannel = $rssdoc->getChannel(0);
    if (!method_exists($currChannel, 'getTitle')) {
        $out .= $mod_strings['LBL_FEED_NOT_AVAILABLE'];
        // This section of the code fetches the filename of the cache required to delete and refresh
        $cache = new php_text_cache($GLOBALS['sugar_config']['cache_dir'] . 'feeds/', $sugar_config['rss_cache_time']);
        $deletecache = $cache->getCacheFileName($feed_row['url']);
        if (file_exists($deletecache)) {
            unlink($deletecache);
        }
        echo "<br><a href='index.php?module=Feeds&action=index&return_module=Feeds&delete_cache='>" . $mod_strings['LBL_REFRESH_CACHE'] . "</a>";
        return;
    }
    if (method_exists($currChannel, 'getLastBuildDate')) {
        $last_build_date = $currChannel->getLastBuildDate();
        if (!empty($last_build_date)) {
            $user_preference_format = $current_user->getUserDateTimePreferences();
            $last_build_date = Date($user_preference_format['date'] . ' ' . $user_preference_format['time'], strtotime($last_build_date));
        }
    }
    $img_html = '';
    $baseURL = "index.php?return_action={$_REQUEST['action']}&return_module=Feeds&module=Feeds&record={$feed_row['id']}&action=";
    $up = SugarThemeRegistry::current()->getImage("uparrow", 'border="0" align="absmiddle" alt="' . $mod_strings['LBL_MOVE_UP'] . '"');
    $down = SugarThemeRegistry::current()->getImage("downarrow", 'border="0" align="absmiddle" alt="' . $mod_strings['LBL_MOVE_DOWN'] . '"');
    $del = SugarThemeRegistry::current()->getImage("delete", 'border="0" align="absmiddle" alt="' . $mod_strings['LBL_DELETE_FAV_BUTTON_LABEL'] . '"');
    $title = $currChannel->getTitle();
    $link = $currChannel->getLink();
    $buildDate = empty($last_build_date) ? "" : $mod_strings['LBL_LAST_UPDATED'] . ": " . $last_build_date;
    $out .= <<<eoq
\t\t<table width="100%" cellspacing="0" cellpadding="0" border="0">
\t\t\t<tr>
\t\t\t\t<td align="right">
\t\t\t\t\t<nobr>
\t\t\t\t\t<a href="{$baseURL}MoveUp">{$up}</a>
\t\t\t\t\t<a href="{$baseURL}MoveDown">{$down}</a>
\t\t\t\t\t<a href="{$baseURL}DeleteFavorite" class="listViewTdToolsS1">{$del}</a>
\t\t\t\t\t</nobr>
\t\t\t\t</td>
\t\t\t</tr>
\t\t</table>
\t\t<table cellpadding="0" cellspacing="0" width="100%" border="0" class="list view">
\t\t\t<tr height="20">
\t\t\t\t<td scope="col" width="100%" >
\t\t\t\t\t<a href="index.php?action=DetailView&module=Feeds&record={$feed_row['id']}" class="listViewThLinkS1">{$title}</a> - 
\t\t\t\t\t<a target="_new" href="{$link}" class="listViewThLinkS1">( {$mod_strings['LBL_VISIT_WEBSITE']} )</a>
\t\t\t\t\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$buildDate}
\t\t\t\t</td>
\t\t\t</tr>
\t\t\t<tr class="evenListRowS1">
\t\t\t\t<td scope="col" colspan="10">
eoq;
    $totalItems = 5;
    $topitem = $currChannel->getItem(0);
    if (!isset($topitem)) {
        $out .= "No content";
    } else {
        //loop through each item
        for ($j = 0; $j < $totalItems; $j++) {
            //get reference to current item
            $currItem = $currChannel->getItem($j);
            if (!isset($currItem)) {
                continue;
            }
            $item_link = $currItem->getLink();
            $item_title = strip_tags($currItem->getTitle());
            $item_date = $currItem->getPubDate();
            if (!empty($item_date)) {
                $user_preference_format = $current_user->getUserDateTimePreferences();
                $item_date = Date($user_preference_format['date'] . ' ' . $user_preference_format['time'], strtotime($item_date));
            }
            $out .= <<<eoq
\t\t\t\t<li><a target="_new" href="{$item_link}" >{$item_title}</a>&nbsp;&nbsp;<span class="rssItemDate">{$item_date}</span>
eoq;
        }
    }
    $out .= "</td></tr></table>";
    echo $out;
}