From 468bf903c5bd97c8528ea643b2a34e035166c438 Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Tue, 7 Dec 2010 11:48:25 -0500 Subject: [PATCH] Move initial twitter client layout to a Horde_View --- horde/lib/Block/twitter_timeline.php | 21 ++++++++++----------- horde/templates/block/twitter-layout.html.php | 23 +++++++++++++++++++++++ 2 files changed, 33 insertions(+), 11 deletions(-) create mode 100644 horde/templates/block/twitter-layout.html.php diff --git a/horde/lib/Block/twitter_timeline.php b/horde/lib/Block/twitter_timeline.php index 63ab2b945..175ca697c 100644 --- a/horde/lib/Block/twitter_timeline.php +++ b/horde/lib/Block/twitter_timeline.php @@ -161,17 +161,16 @@ EOT; $latestStatus = htmlspecialchars($this->_profile->status->text); /* Build the UI */ - $html = '
' - . '
' - . '' . _("Tweet") . '140 ' - . Horde::img('loading.gif', '', array('id' => $instance . '_loading', 'style' => 'display:none;')); - $html .= '
' . _("Latest") . ' ' . $latestStatus . ' - ' . Horde_Date_Utils::relativeDateTime(strtotime($this->_profile->status->created_at), $GLOBALS['prefs']->getValue('date_format'), ($GLOBALS['prefs']->getValue('twentyFour') ? "%H:%M" : "%I:%M %P")) . '
'; - $html .= '
'; - $html .= '
'; - $html .= '
'; - $html .= '
'; - - return $html; + $view = new Horde_View(array('templatePath' => HORDE_TEMPLATES . '/block')); + $view->addHelper('Tag'); + $view->instance = $instance; + $view->defaultText = $defaultText; + $view->loadingImg = Horde::img('loading.gif', '', array('id' => $instance . '_loading', 'style' => 'display:none;')); + $view->latestStatus = $latestStatus; + $view->latestDate = Horde_Date_Utils::relativeDateTime(strtotime($this->_profile->status->created_at), $GLOBALS['prefs']->getValue('date_format'), ($GLOBALS['prefs']->getValue('twentyFour') ? "%H:%M" : "%I:%M %P")); + $view->bodyHeight = empty($this->_params['height']) ? 350 : $this->_params['height']; + + return $view->render('twitter-layout'); } private function _getTwitterObject() diff --git a/horde/templates/block/twitter-layout.html.php b/horde/templates/block/twitter-layout.html.php new file mode 100644 index 000000000..589122663 --- /dev/null +++ b/horde/templates/block/twitter-layout.html.php @@ -0,0 +1,23 @@ +instance + * ->defaultText + * ->loadingImg + * ->latestStatus + * ->latestDate + * ->bodyHeight + */ +?> +
+
+ + 140 + + loadingImg ?> +
'latestStatus ?> - latestDate ?>
+
+
+
">
+
\ No newline at end of file -- 2.11.0