Subversion Repositories Applications.papyrus

Compare Revisions

Ignore whitespace Rev 344 → Rev 345

/trunk/api/text/wiki_papyrus/Render/Xhtml/Plan.php
New file
0,0 → 1,77
<?php
 
class Text_Wiki_Render_Xhtml_Plan extends Text_Wiki_Render {
/**
*
* Renders a token into text matching the requested format.
*
* @access public
*
* @param array $options The "options" portion of the token (second
* element).
*
* @return string The text rendered from the token options.
*
*/
function token($options)
{
// Initialisation des variables
$sortie = '';
$sites = $options['site'];
// Récupération de l'affichage ou pas des raccourcis
if (isset($options['permalien'])) {
$permalien = $options['permalien'];
}
$tab_site = array_map('trim', explode(',', $sites));
$sortie .= '<ul class="plan_site_'.$site.'" >'."\n";
foreach ($tab_site as $cle => $site) {
$aso_menus = GEN_retournerTableauMenusSiteCodeAlpha($GLOBALS['_GEN_commun']['pear_db'], $site);
$sortie .= $this->parserTableauMenus($aso_menus, $permalien);
}
$sortie .= '</ul>'."\n";
return $sortie;
}
function parserTableauMenus($aso_menus, $permalien)
{
$sortie = '';
// Création de l'url
foreach ($aso_menus as $menu_id => $menu_valeur) {
$sortie .= '<li>';
// Création de l'url
$une_url =& new Pap_URL();
$une_url->setId($menu_id);
// Construction de l'attribut title
$title = '';
if (!empty($menu_valeur['gm_titre'])) {
$title = ' title="'.$menu_valeur['gm_titre'].'"';
} elseif (!empty($menu_valeur['gm_titre_alternatif'])) {
$title = ' title="'.$menu_valeur['gm_titre_alternatif'].'"';
}
// Construction du lien
$sortie .= '<a href="'.$une_url->getURL().'"'.$title.'>'.$menu_valeur['gm_nom'].'</a>';
// Nous affichons ou pas le permalien
if ($permalien) {
$une_url->setPermalien(true);
$sortie .= ' <span class="plan_permalien">'.'('.$une_url->getURL().')'.'</span>';
$une_url->setPermalien(false);
}
// Nous ajoutons les sous-menus s'il y en a.
$retour = $this->parserTableauMenus($menu_valeur['sous_menus'], $permalien);
if ($retour != '') {
$sortie .= "\n".'<ul>'."\n".$retour."\n".'</ul>'."\n";
}
$sortie .= '</li>'."\n";
}
return $sortie;
}
}
?>
/trunk/api/text/wiki_papyrus/Render/Xhtml/Syndication.php
New file
0,0 → 1,44
<?php
require_once PAP_CHEMIN_API_PEAR.'XML/RSS.php';
 
class Text_Wiki_Render_Xhtml_Syndication extends Text_Wiki_Render {
/**
*
* Renders a token into text matching the requested format.
*
* @access public
*
* @param array $options The "options" portion of the token (second
* element).
*
* @return string The text rendered from the token options.
*
*/
function token($options)
{
// Initialisation des variables
$sortie = '';
$urls = $options['url'];
$tab_url = array_map('trim', explode(',', $urls));
if (ini_get('allow_url_fopen') != 0) {
ini_set('allow_url_fopen', 1);
}
if (ini_get('allow_url_fopen') != 0) {
foreach ($tab_url as $cle => $url) {
$rss =& new XML_RSS($url);
$rss->parse();
$aso_info_rss = $rss->getChannelInfo();
$sortie .= '<h2>'.$aso_info_rss['title'].'</h2>';
$sortie .= '<ul class="plan_site_'.$site.'" >'."\n";
foreach ($rss->getItems() as $item) {
$sortie .= '<li><a href="'.$item['link'].'">'.$item['title'].'</a></li>'."\n";
}
$sortie .= '</ul>'."\n";
}
}
return $sortie;
}
}
?>