Exemplo n.º 1
0
    $template = $this->GetParameter("template");
    if (empty($template)) {
        $template = 'tools/syndication/templates/twitter.tpl.html';
    } else {
        $template = 'tools/syndication/templates/' . $this->GetParameter("template");
        if (!file_exists($template)) {
            echo 'Le fichier template: "' . $template . '" n\'existe pas, on utilise le template twitter.tpl.html par défaut.';
            $template = 'tools/syndication/templates/twitter.tpl.html';
        }
    }
    $tweets = array();
    if ($rssfeed) {
        // Gestion du nombre de pages syndiquees
        $i = 0;
        foreach ($rssfeed->items as $item) {
            $i++;
            $tweets[$i]['title'] = str_replace("–", "—", $item['title']);
            $tweets[$i]['title'] = preg_replace("/(http:\\/\\/|(www\\.))(([^\\s<]{4,68})[^\\s<]*)/", '<a href="http://$2$3" target="_blank">$1$2$4</a>', $tweets[$i]['title']);
            $tweets[$i]['title'] = str_replace("{$username}: ", "", $tweets[$i]['title']);
            $tweets[$i]['title'] = preg_replace("/@(\\w+)/", "<a href=\"https://twitter.com/#!/\\1\" target=\"_blank\">@\\1</a>", $tweets[$i]['title']);
            $tweets[$i]['title'] = html_entity_decode($tweets[$i]['title']);
            $tweets[$i]['title'] = utf8_decode(preg_replace('/\\s+#(\\w+)/', ' <a href="http://search.twitter.com/search?q=%23$1">#$1</a>', $tweets[$i]['title']));
            $tweets[$i]['username'] = '';
            include_once 'tools/syndication/libs/syndication.lib.php';
            $tweets[$i]['date'] = getRelativeDate($item['pubdate']);
        }
        include $template;
    } else {
        echo '<p class="alert alert-danger">' . _t('ERROR') . ' : ' . magpie_error() . '</p>' . "\n";
    }
}
Exemplo n.º 2
0
function printCalendar($AID)
{
    echo "<table class='CalendarTable'>";
    echo "<tr>";
    echo "<td class='CalendarHead'><b>Mon</td>";
    echo "<td class='CalendarHead'><b>Tue</td>";
    echo "<td class='CalendarHead'><b>Wed</td>";
    echo "<td class='CalendarHead'><b>Thu</td>";
    echo "<td class='CalendarHead'><b>Fri</td>";
    echo "</tr>";
    echo "<tr>";
    $today = 0;
    $today -= getTodayinWeek() - 1;
    $workingDate = getRelativeDate($today);
    for ($x = 0; $x < 5; $x++) {
        $workingDate = getRelativeDate($today + $x);
        $array = getTodaysTask($AID, $workingDate);
        $arrayN = count($array) / 3;
        echo "<td class='CalendarBody'>";
        for ($v = 0; $v < $arrayN; $v = $v++) {
            $z = $v * 3;
            $CusN = $array[$z + 2];
            $task = $array[$z + 1];
            $taskN = $array[$z];
            echo "<form action='action.php' method='post'><input type='submit' value='{$taskN} {$CusN}'><input type='text' name='mode' value='ViewTask' hidden><input type='text' name='TID' value='{$task}' hidden></form>";
        }
        echo "</td>";
    }
    echo "</tr>";
    echo "<tr>";
    for ($x = 7; $x < 12; $x++) {
        $workingDate = getRelativeDate($today + $x);
        $array = getTodaysTask($AID, $workingDate);
        $arrayN = count($array) / 3;
        echo "<td class='CalendarBody'>";
        for ($v = 0; $v < $arrayN; $v = $v++) {
            $z = $v * 3;
            $CusN = $array[$z + 2];
            $task = $array[$z + 1];
            $taskN = $array[$z];
            echo "<form action='action.php' method='post'><input type='submit' value='{$taskN} {$CusN}'><input type='text' name='mode' value='ViewTask' hidden><input type='text' name='TID' value='{$task}' hidden></form>";
        }
        echo "</td>";
    }
    echo "</tr>";
    echo "</table>";
}