Exemplo n.º 1
0
 /**
  * Retreives the user interface of this object.
  *
  * Anything that overrides this method should call the parent method with
  * it's output at the END of processing.
  *
  * @return string The HTML fragment for this interface
  */
 public function getUserUI()
 {
     // Init values
     $html = '';
     $width = $this->getWidth();
     $height = $this->getHeight();
     $hyperlink_url = $this->getHyperlinkUrl();
     if (empty($width)) {
         $width = "";
     } else {
         $width = "width='{$width}'";
     }
     if (empty($height)) {
         $height = "";
     } else {
         $height = "height='{$height}'";
     }
     $inlineCssContent = null;
     if (!empty($this->maxDisplayWidth)) {
         $inlineCssContent .= " max-width: {$this->maxDisplayWidth}; ";
     }
     if (!empty($this->maxDisplayHeight)) {
         $inlineCssContent .= " max-height: {$this->maxDisplayHeight}; ";
     }
     if (!empty($inlineCssContent)) {
         $inlineCss = " style='{$inlineCssContent}' ";
     } else {
         $inlineCss = null;
     }
     // Wrap around a hyperlink tag if a URL exists.
     if (!empty($hyperlink_url)) {
         $html .= "<a href=\"" . htmlspecialchars($hyperlink_url, ENT_QUOTES) . "\"><img src='" . htmlspecialchars($this->getFileUrl()) . "' {$width} {$height} alt='" . $this->getFileName() . "' {$inlineCss}></a>";
     } else {
         $html .= "<img src='" . htmlspecialchars($this->getFileUrl()) . "' {$width} {$height} alt='" . $this->getFileName() . "' {$inlineCss}>";
     }
     /* Handle hyperlink clicktrough logging */
     $html = $this->replaceHyperLinks($html);
     $this->setUserUIMainDisplayContent($html);
     return Content::getUserUI();
 }
Exemplo n.º 2
0
 /**
  * Retreives the user interface of this object.
  *
  * Anything that overrides this method should call the parent method with
  * it's output at the END of processing.
  * @return string The HTML fragment for this interface
  */
 public function getUserUI()
 {
     // Init values
     $html = '';
     $html .= $this->getString();
     /* Handle hyperlink clicktrough logging */
     $html = $this->replaceHyperLinks($html);
     $this->setUserUIMainDisplayContent($html);
     return parent::getUserUI();
 }
Exemplo n.º 3
0
 /**
  * Retreives the user interface of this object.
  *
  * @return string The HTML fragment for this interface
  */
 public function getUserUI()
 {
     // Init values
     $html = '';
     if (!empty($this->content_group_element_row['displayed_content_id'])) {
         $displayed_content = $this->getDisplayedContent();
         // If the content group logging is disabled, all the children will inherit this property temporarly
         if ($this->getLoggingStatus() == false) {
             $displayed_content->setLoggingStatus(false);
         }
         $html .= $displayed_content->getUserUI();
     }
     $this->setUserUIMainDisplayContent($html);
     return parent::getUserUI($html);
 }
Exemplo n.º 4
0
 /**
  * Retreives the user interface of this object.
  *
  * @return string The HTML fragment for this interface
  */
 public function getUserUI()
 {
     // Init values
     $html = '';
     if (self::isContentTypeFunctional()) {
         $this->initFeedPressReview();
         try {
             $html = $this->press_review->getOutputHtml($this->content_rss_aggregator_row['number_of_display_items'], $this->getDisplayEmptyFeed(), _("See more"), _("-"));
         } catch (Exception $e) {
             $html = sprintf(_("Could not get RSS feed: %s"), $feed_row['url']);
         }
         /* Handle hyperlink clicktrough logging */
         $html = $this->replaceHyperLinks($html);
     } else {
         $html = _("RSS support is disabled");
     }
     $this->setUserUIMainDisplayContent($html);
     return parent::getUserUI();
 }
Exemplo n.º 5
0
 /** Retreives the user interface of this object.  Anything that overrides this method should call the parent method with it's output at the END of processing.
  * @return The HTML fragment for this interface */
 public function getUserUI()
 {
     $real_node = Node::getCurrentRealNode();
     //For production
     //$real_node = Node::getCurrentNode();//For testing
     $node = Node::getCurrentNode();
     $formHtml = null;
     if ($real_node) {
         $formHtml .= "<form action='" . BASE_URL_PATH . "content/ShoutBox/add_message.php'>\n";
         $formHtml .= "<input type='hidden' name='shoutbox_id' value='" . $this->getId() . "'/>\n";
         //$html .= "destination_url: ";pretty_print_r($_SERVER);
         $maxShoutChars = $this->getMaxShoutChars();
         $shoutFieldSize = $this->getShoutFieldSize();
         if ($maxShoutChars > 0) {
             $max_size = "maxlength='{$maxShoutChars}'";
             $maxShoutChars <= $shoutFieldSize ? $size = "size='{$maxShoutChars}'" : ($size = "size='{$shoutFieldSize}'");
         } else {
             $max_size = null;
             $size = "size='{$shoutFieldSize}'";
         }
         $formHtml .= "<input type='hidden' name='node_id' value='" . $node->getId() . "'/>\n";
         $formHtml .= "<input type='text' name='shout_text' id='shout_text' {$size} {$max_size} value=''/>\n";
         $onclick_content = $this->getOnClickContent();
         if ($onclick_content) {
             $onclick = "onclick=\"" . $onclick_content->getString() . "\"";
         } else {
             $onclick = null;
         }
         $formHtml .= "<input type='submit' name='shout_submit' {$onclick} value='" . _("Shout!") . "'>\n";
         $formHtml .= "</form>\n";
     } else {
         $formHtml .= "<p>" . _("Sorry, you must be at a hotspot to use the shoutbox") . "</p>\n";
     }
     $html_main = '';
     $displayNumItems = $this->getDisplayNumItems();
     $db = AbstractDb::getObject();
     if ($node) {
         $node_id = $db->escapeString($node->getId());
         if ($displayNumItems > 0) {
             $limit = "LIMIT {$displayNumItems}";
             $heading = "<em>" . sprintf(_("Last %d messages:"), $displayNumItems) . "</em>";
         } else {
             $limit = null;
             $heading = null;
         }
         $sql = "SELECT *, EXTRACT(EPOCH FROM creation_date) as creation_date_php FROM content_shoutbox_messages WHERE origin_node_id='{$node_id}' ORDER BY creation_date DESC {$limit}\n";
         $db->execSql($sql, $rows, false);
         $html_main .= "<ul>";
         $html_main .= "<li>{$formHtml}</li>";
         if ($rows) {
             //$html_main .= $heading;
             foreach ($rows as $row) {
                 $user = User::getObject($row['author_user_id']);
                 $content = Content::getObject($row['message_content_id']);
                 $html_main .= "<li>";
                 $dateStr = "<span class='date'>" . strftime('%x', $row['creation_date_php']) . "</span>\n";
                 $html_main .= $dateStr . ' ' . $user->getListUI() . ": \n";
                 $html_main .= "<div class='message'>" . $content->getListUI() . "</div>\n";
                 $html_main .= "</li>";
             }
         }
         $html_main .= "</ul>";
     } else {
         $html_main .= "<p>" . _("Sorry, I am unable to determine your current node") . "</p>\n";
     }
     $this->setUserUIMainDisplayContent($html_main);
     //$this->setUserUIMainInteractionArea($formHtml);
     return Content::getUserUI();
 }
Exemplo n.º 6
0
 /**
  * Retreives the user interface of this object.
  *
  * Anything that overrides this method should call the parent method with
  * it's output at the END of processing.
  * @return string The HTML fragment for this interface
  */
 public function getUserUI()
 {
     // Init values
     $html = '';
     $html .= "<iframe width='{$this->getWidth()}' height='{$this->getHeight()}' frameborder='1' src='{$this->getGeneratedUrl()}'>" . _("Your browser does not support IFrames.") . "</iframe>\n";
     $this->setUserUIMainDisplayContent($html);
     return parent::getUserUI();
 }
Exemplo n.º 7
0
 /**
  * Retreives the user interface of this object.
  *
  * Anything that overrides this method should call the parent method with
  * it's output at the END of processing.
  * @return string The HTML fragment for this interface
  */
 public function getUserUI()
 {
     // Init values
     $current_node = Node::getCurrentNode();
     $smarty = SmartyWifidog::getObject();
     // Set details about onlineusers
     if ($current_node) {
         // online users
         $online_users = $current_node->getOnlineUsers();
         foreach ($online_users as $online_user) {
             $online_user_array[] = $online_user->getListUI();
         }
         $num_online_users = count($online_users);
         if ($num_online_users > 0) {
             $smarty->assign('onlineUsers', $online_user_array);
         } else {
             $smarty->assign('onlineUsers', array());
         }
         // recent users
         $recent_users = $current_node->getRecentUsers();
         foreach ($recent_users as $recent_user) {
             $recent_user_array[] = $recent_user->getListUI();
         }
         $num_recent_users = count($recent_users);
         if ($num_recent_users > 0) {
             $smarty->assign('recentUsers', $recent_user_array);
         } else {
             $smarty->assign('recentUsers', array());
         }
         // active users
         $active_users = $current_node->getActiveUsers();
         foreach ($active_users as $active_user) {
             $active_user_array[] = $active_user->getListUI();
         }
         $num_active_users = count($active_users);
         if ($num_active_users > 0) {
             $smarty->assign('activeUsers', $active_user_array);
         } else {
             $smarty->assign('activeUsers', array());
         }
         // Compile HTML code
         $html = $smarty->fetch("templates/classes/UIUserList_getUserUI.tpl");
     } else {
         $html = _("The online user list must be viewed at a specific node");
     }
     $this->setUserUIMainDisplayContent($html);
     return Content::getUserUI();
 }
Exemplo n.º 8
0
 /**
  * Retreives the user interface of this object.
  *
  * @return string The HTML fragment for this interface
  */
 public function getUserUI()
 {
     // Init values
     $html = '';
     if ($this->getFileSize() > 0) {
         $append_size = " (" . $this->getFileSize(self::UNIT_KILOBYTES) . " " . _("KB") . ")";
     } else {
         $append_size = "";
     }
     $html .= "<div class='download_button'><a href='" . htmlentities($this->getFileUrl()) . "'>" . _("Download") . " " . $this->getFilename() . "{$append_size}</a></div>";
     $html = $this->replaceHyperLinks($html);
     $this->setUserUIMainDisplayContent($html);
     return parent::getUserUI();
 }
Exemplo n.º 9
0
 /**
  * Retreives the user interface of this object.
  *
  * @return string The HTML fragment for this interface
  */
 public function getUserUI()
 {
     // Init values
     $html = '';
     $embedded_content_file = null;
     $fallback_content = null;
     /* Get both objects if they exist */
     if (!empty($this->embedded_content_row['embedded_file_id'])) {
         $embedded_content_file = self::getObject($this->embedded_content_row['embedded_file_id']);
     }
     if (!empty($this->embedded_content_row['fallback_content_id'])) {
         $fallback_content = self::getObject($this->embedded_content_row['fallback_content_id']);
     }
     /**
      * @internal Example:
      *
      * <samp>
      *     <object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="400" height="316" codebase="http://www.apple.com/qtactivex/qtplugin.cab">
      *         <param name="SRC" value="/sponsors/airborne/400.mov">
      *         <param name="QTNEXT1" value="<http://stream.qtv.apple.com/qtv/endorphin/http/hydrogen3_ref.mov> T<myself>">
      *         <param name="AUTOPLAY" value="true">
      *         <param name="CONTROLLER" value="true">
      *         <embed src="/sponsors/airborne/400.mov" qtnext1="<http://stream.qtv.apple.com/qtv/endorphin/http/hydrogen3_ref.mov> T<myself>" width="400" height="316" align="left" autoplay="true" controller="true" pluginspage="http://www.apple.com/quicktime/download/">
      *         </embed>
      *     </object>
      * </samp>
      */
     if ($embedded_content_file != null) {
         $url = htmlentities($embedded_content_file->getFileUrl());
         $mime_type = $embedded_content_file->getMimeType();
         $html .= "<object type='{$mime_type}' data='{$url}' {$this->getAttributes()}>\n";
         $html .= "<param name='AUTOPLAY' value='false'>\n";
         $html .= "<param name='AUTOPLAY' value='0'>\n";
         $html .= "{$this->getParameters()}\n";
         // Spit fallback content between inside the <object> tag
         if ($fallback_content != null) {
             $html .= $fallback_content->getUserUI();
         }
         $html .= "<embed autoplay=FALSE src='{$url}'>\n";
         $html .= "<nobembed>\n";
         $html .= "<p><a href='{$url}'>" . _("Download") . " " . $embedded_content_file->getFilename() . " (" . $embedded_content_file->getFileSize(File::UNIT_KILOBYTES) . " " . _("KB") . ")</a></p>";
         $html .= "</nobembed>\n";
         $html .= "</object>\n";
     }
     $this->setUserUIMainDisplayContent($html);
     return parent::getUserUI();
 }
Exemplo n.º 10
0
 /** Retreives the user interface of this object.  Anything that overrides this method should call the parent method with it's output at the END of processing.
  * @param $subclass_admin_interface Html content of the interface element of a children
  * @param boolean $hide_elements allows the child class ( for example
  * Pattern Language) to tell the content group not to display elements ) for
  * elements that need to be hidden before subscription
  * @return The HTML fragment for this interface */
 public function getUserUI($hide_elements = false)
 {
     $html = '';
     if ($hide_elements == false) {
         $display_elements = $this->getDisplayElements();
         if (count($display_elements) > 0) {
             foreach ($display_elements as $display_element) {
                 // If the content group logging is disabled, all the children will inherit this property temporarly
                 if ($this->getLoggingStatus() == false) {
                     $display_element->setLoggingStatus(false);
                 }
                 $html .= $display_element->getUserUI();
             }
         } else {
             //$html .= '<p class="warningmsg">' . _("Sorry, this content-group is empty") . "</p>\n";
         }
     }
     $this->setUserUIMainDisplayContent($html);
     return parent::getUserUI();
 }
Exemplo n.º 11
0
 /**
  * Retreives the user interface of this object.
  *
  * Anything that overrides this method should call the parent method with
  * it's output at the END of processing.
  * @return string The HTML fragment for this interface
  */
 public function getUserUI()
 {
     // Init values
     $current_node = Node::getCurrentNode();
     $smarty = SmartyWifidog::getObject();
     $html = null;
     $user = User::getCurrentUser();
     if ($user) {
         if ($current_node) {
             $abuseControlReport = User::getAbuseControlConnectionHistory($user, null, $current_node);
             if ($abuseControlReport) {
                 //pretty_print_r($abuseControlReport);
                 $db = AbstractDb::getObject();
                 $html .= sprintf(_("During the last %s period, you transfered %s / %s and were connected %s / %s at this node.  Throughout the network, you transfered %s / %s and were connected %s / %s"), $abuseControlReport['connection_limit_window'] ? $db->GetIntervalStrFromDurationArray($db->GetDurationArrayFromIntervalStr($abuseControlReport['connection_limit_window'])) : _("Unknown"), self::formatSize($abuseControlReport['node_total_bytes']), $abuseControlReport['connection_limit_node_max_total_bytes'] ? self::formatSize($abuseControlReport['connection_limit_node_max_total_bytes']) : _("Unlimited"), $abuseControlReport['node_duration'] ? $db->GetIntervalStrFromDurationArray($db->GetDurationArrayFromIntervalStr($abuseControlReport['node_duration'])) : _("None"), $abuseControlReport['connection_limit_node_max_usage_duration'] ? $abuseControlReport['connection_limit_node_max_usage_duration'] : _("Unlimited"), self::formatSize($abuseControlReport['network_total_bytes']), $abuseControlReport['connection_limit_network_max_total_bytes'] ? self::formatSize($abuseControlReport['connection_limit_network_max_total_bytes']) : _("Unlimited"), $abuseControlReport['network_duration'] ? $db->GetIntervalStrFromDurationArray($db->GetDurationArrayFromIntervalStr($abuseControlReport['network_duration'])) : _("None"), $abuseControlReport['connection_limit_network_max_usage_duration'] ? $abuseControlReport['connection_limit_network_max_usage_duration'] : _("Unlimited"));
             } else {
                 $html .= _("Abuse control is currently disabled");
             }
         } else {
             $html .= _("Unable to retrieve node specific restrictions (you are not at a node)");
         }
         $this->setUserUIMainDisplayContent($html);
         return Content::getUserUI();
     }
 }
Exemplo n.º 12
0
 public function getUserUI($subclass_user_interface = null, $force_data_refresh = false)
 {
     // Init values
     $html = '';
     if ($this->_PhlickrAvailable) {
         $api = $this->getFlickrApi();
         if (!is_null($api)) {
             // Load cache only on the User UI side
             if ($force_data_refresh === false) {
                 $this->loadCacheFromDatabase();
             }
             try {
                 $photos = null;
                 switch ($this->getSelectionMode()) {
                     case self::SELECT_BY_GROUP:
                         if ($this->getGroupId()) {
                             $photo_pool = new Phlickr_Group($api, $this->getGroupId());
                             $photos = $photo_pool->getPhotoList($this->getPhotoBatchSize())->getPhotos();
                         }
                         break;
                     case self::SELECT_BY_TAGS:
                         if ($this->getTags()) {
                             $request = $api->createRequest('flickr.photos.search', array('tags' => $this->getTags(), 'tag_mode' => $this->getTagMode()));
                             $photo_list = new Phlickr_PhotoList($request, $this->getPhotoBatchSize());
                             $photos = $photo_list->getPhotos();
                         }
                         break;
                     case self::SELECT_BY_USER:
                         if ($this->getFlickrUserId()) {
                             $user = new Phlickr_User($api, $this->getFlickrUserId());
                             $photos = $user->getPhotoList($this->getPhotoBatchSize())->getPhotos();
                         }
                         break;
                 }
                 if (is_array($photos) && !empty($photos)) {
                     $size = $this->getPreferredSize();
                     if (empty($size)) {
                         $size = null;
                     }
                     // Preload authors ( this will be cached )
                     foreach ($photos as $cache_authors) {
                         $author = new Phlickr_User($api, $cache_authors->getUserId());
                     }
                     switch ($this->getDisplayMode()) {
                         case self::DISPLAY_GRID:
                             // If there's enough photo show a grid
                             if (count($photos) >= self::GRID_X * self::GRID_Y) {
                                 $grid_photos_idx = array();
                                 $html .= "<table>\n";
                                 for ($i = 0; $i < self::GRID_X; $i++) {
                                     $html .= "<tr>\n";
                                     for ($j = 0; $j < self::GRID_Y; $j++) {
                                         $photo = $photos[$i * self::GRID_X + $j];
                                         if (is_object($photo)) {
                                             $author = new Phlickr_User($api, $photo->getUserId());
                                             $formats = $photo->getSizes();
                                             $html .= '<td><div class="flickr_photo"><a href="' . $photo->buildUrl() . '"><img width="' . $formats[$size][0] . '" height="' . $formats[$size][1] . '" title="[' . $author->getName() . "] " . $photo->getTitle() . '" src="' . $photo->buildImgUrl($size) . '"></a></div></td>' . "\n";
                                         }
                                     }
                                     $html .= "</tr>\n";
                                 }
                                 $html .= "</table>\n";
                             }
                             break;
                         case self::DISPLAY_FEATURE:
                             // Get the last photo
                             $photo = $photos[0];
                             if (is_object($photo)) {
                                 if ($this->shouldDisplayTitle()) {
                                     $title = $photo->getTitle();
                                     if (!empty($title)) {
                                         $html .= '<div class="flickr_title"><h3>' . $photo->getTitle() . '</h3></div>' . "\n";
                                     }
                                 }
                                 /**
                                  * @todo Find a way to display tags nicely
                                  */
                                 /*
                                                                     if ($this->shouldDisplayTags())
                                                                     {
                                                                         $tags = $photo->getTags();
                                                                         if (!empty ($tags))
                                                                         {
                                                                             $html .= '<div class="flickr_tags">'."\n";
                                                                             $html .= '<h3>'._("Tags")."</h3>\n";
                                                                             $html .= '<ul>'."\n";
                                                                             foreach ($tags as $tag)
                                                                             {
                                                                                 $url_encoded_tag = urlencode($tag);
                                                                                 $html .= '<li><a href="http://www.flickr.com/photos/tags/'.$url_encoded_tag.'/">'.$tag.'</a></li>'."\n";
                                                                             }
                                                                             $html .= '</ul>'."\n";
                                                                             $html .= '</div>'."\n";
                                                                         }
                                                                     }*/
                                 /**
                                  * @todo Display author's name along with it ...
                                  */
                                 /*
                                 foreach ($photos as $cache_authors)
                                     $author = new Phlickr_User($api, $cache_authors->getUserId());
                                 $author = new Phlickr_User($api, $photo->getUserId());
                                     $html .= '<div class="flickr_description"><a href="'.$author->buildUrl().'">'.$author->getName().'</a></div>'."\n";
                                 */
                                 //$html .= "</div>\n";
                                 $html .= '<div class="flickr_photo_block">' . "\n";
                                 $html .= "<div class=\"flickr_photo\"><a href=\"{$photo->buildUrl()}\"><img src=\"{$photo->buildImgUrl($size)}\" /></a></div>\n";
                                 $html .= "</div>\n";
                             }
                             break;
                         case self::DISPLAY_FEATURE_WITH_RANDOM:
                             break;
                     }
                 } else {
                     $html .= _("No Flickr content matches the request !");
                 }
             } catch (Phlickr_ConnectionException $e) {
                 $html .= sprintf(_("Unable to connect to Flickr API: %s"), "<pre>{$e}</pre>");
             } catch (Phlickr_MethodFailureException $e) {
                 $html .= _("Some of the request parameters provided to Flickr API are invalid.");
                 $html .= "<br>" . $e->getMessage();
             } catch (Phlickr_XmlParseException $e) {
                 $html .= _("Unable to parse Flickr's response.");
             } catch (Phlickr_Exception $e) {
                 $html .= _("Could not get content from Flickr : ") . $e;
             }
             // Overwrite cache if needed
             $this->writeCacheToDatabase($force_data_refresh);
         }
     } else {
         $html .= _("PEAR::Phlickr is not installed");
     }
     /* Handle hyperlink clicktrough logging */
     $html = $this->replaceHyperLinks($html);
     $this->setUserUIMainDisplayContent($html);
     return parent::getUserUI();
 }
Exemplo n.º 13
0
 /**
  * Retreives the user interface of this object.
  *
  * Anything that overrides this method should call the parent method with
  * it's output at the END of processing.
  * @return string The HTML fragment for this interface
  */
 public function getUserUI()
 {
     // Init values
     $html = '';
     $url = $this->getString();
     if (HyperLinkUtils::validateURL($url)) {
         $html = "<a href='{$url}'>{$url}</a>\n";
     } else {
         $html = $url . " " . _("(invalid URL)") . "\n";
     }
     /* Handle hyperlink clicktrough logging */
     $html = $this->replaceHyperLinks($html);
     $this->setUserUIMainDisplayContent($html);
     return Content::getUserUI();
 }