* @copyright 2005-2006 Francois Proulx, Technologies Coeus inc. * @version Subversion $Id$ * @link http://www.wifidog.org/ */ /** * Load required files */ require_once('../../include/common.php'); require_once('include/common_interface.php'); require_once('classes/User.php'); require_once('classes/Content/PatternLanguage.php'); require_once('classes/MainUI.php'); $smarty = SmartyWifidog::getObject(); $session = Session::getObject(); // This trick is done to allow displaying of Pattern Language right away if there is only one available. if(!empty($_REQUEST['content_id'])) { $content_id = $_REQUEST['content_id']; $pattern_language = PatternLanguage::getObject($content_id); } else { $content_id = ""; $pattern_languages = PatternLanguage :: getAllContent(); if(count($pattern_languages) >= 1) $pattern_language = $pattern_languages[0]; else exit; } // The Pattern Language toolbar $tool_html = "

{$pattern_language->getTitle()->__toString()}

"; $tool_html .= ''."\n"; $tool_html .= "
"; $tool_html .= $pattern_language->getSponsorInfo()->__toString(); $tool_html .= "
"; // Body $body_html = "\n"; $body_html .= "

"._("Pattern Language Subscription")."

\n"; $body_html .= "
\n"; $current_user = User::getCurrentUser(); if($current_user) { if(!empty($_REQUEST['subscribe']) || !empty($_REQUEST['unsubscribe'])) { if(!empty($_REQUEST['subscribe'])) { $pattern_language = PatternLanguage::getObject($_REQUEST['content_id']); if(!$pattern_language->isUserSubscribed($current_user)) { $pattern_language->subscribe($current_user); $body_html .= _("Thank you for subscribing"); $node_id = $session->get(SESS_NODE_ID_VAR); if(!empty($node_id)) $body_html .= "

"._("Go back to this hotspot portal page").""; } } else if(!empty($_REQUEST['unsubscribe'])) { $pattern_language = PatternLanguage::getObject($_REQUEST['content_id']); if($pattern_language->isUserSubscribed($current_user)) $pattern_language->unsubscribe($current_user); $body_html .= _("You are now unsubscribed"); $node_id = $session->get(SESS_NODE_ID_VAR); if(!empty($node_id)) $body_html .= "

"._("Go back to this hotspot portal page").""; } } else { if(!$pattern_language->isUserSubscribed($current_user)) { // Subscription $body_html .= _("Subscribe to Pattern Language by clicking the link below. Once you have subscribed you will receive a fragment of text each time you log in to a participating hotspot in the city of Montreal. These text fragments will accumulate to form a unique narrative for every user. You can read your narrative anytime by clicking on \"Read Narrative\", or you can read the narratives generated by other users by going to \"Archives\"."); $body_html .= "
"._("Subscribe now").""; } else { // Unsubscription $body_html .= _("You are already subscribed to Pattern Language, you can terminate your participation by clicking below."); $body_html .= "
"._("Unsubscribe now").""; } } } else { $body_html .= _("You must be logged in to subscribe !"); } $body_html .= "

\n"; $ui = MainUI::getObject(); $ui->addContent('left_area_middle', $tool_html); $ui->setTitle(_("Pattern Language - Subscription")); $ui->addContent('main_area_middle', $body_html); $ui->display(); /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * c-hanging-comment-ender-p: nil * End: */ ?>