本文整理汇总了PHP中Node::getObject方法的典型用法代码示例。如果您正苦于以下问题:PHP Node::getObject方法的具体用法?PHP Node::getObject怎么用?PHP Node::getObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Node
的用法示例。
在下文中一共展示了Node::getObject方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: switch
}
/*
* Process action requests (saving, previewing and deleting)
*/
switch ($_REQUEST['action']) {
case "save":
$object->processAdminUI();
$_REQUEST['action'] = 'edit';
break;
case "preview":
if (empty($_REQUEST['node_id'])) {
$node_id = null;
$node = null;
} else {
$node_id = $_REQUEST['node_id'];
$node = Node::getObject($node_id);
Node::setCurrentNode($node);
$html .= "<h1>" . _("Showing preview as it would appear at ") . $node->getName() . "</h1><br><br>";
}
if (!empty($_REQUEST['debug'])) {
$common_input .= "<input type='hidden' name='debug' value='true'>";
}
$common_input .= "<input type='hidden' name='object_id' value='" . $object->GetId() . "'>";
$common_input .= "<input type='hidden' name='object_class' value='" . get_class($object) . "'>";
$common_input .= "<input type='hidden' name='node_id' value='" . $node_id . "'>";
$html .= "<form action='" . GENERIC_OBJECT_ADMIN_ABS_HREF . "' target='_top' method='post'>";
$html .= $common_input;
$name = "node_id";
$html .= _("Node");
$html .= ": ";
$html .= Node::getSelectUI($name);
示例2: processSelectedNodesUI
/**
* Get the select node interface.
*/
private function processSelectedNodesUI()
{
$name = "selected_nodes";
//pretty_print_r($_REQUEST[$name]);
$this->report_selected_nodes = array();
if (!empty($_REQUEST[$name])) {
foreach ($_REQUEST[$name] as $value) {
if (!empty($value)) {
$this->report_selected_nodes[$value] = Node::getObject($value);
}
}
}
}
示例3:
} else {
$auth_message .= "| Incoming or outgoing counter is missing; counters not updated. ";
}
if ($_REQUEST['stage'] == STAGE_LOGOUT) {
$authenticator->logout($info['conn_id']);
$auth_message .= "| User is now logged out. ";
}
if ($_REQUEST['stage'] == STAGE_COUNTERS) {
if ($info['token_status'] == TOKEN_INUSE) {
/* This is for the 15 minutes validation period, the exact same code is also present when the stage is login. If you update this one don't forget to update the other one! */
if ($info['account_status'] == ACCOUNT_STATUS_VALIDATION && $info['validation_grace_time_expired'] == 't') {
$auth_response = ACCOUNT_STATUS_VALIDATION_FAILED;
$auth_message .= "| The validation grace period which began at " . $info['reg_date'] . " has now expired. ";
} else {
/* TODO: This is a bit hackish, it's a shortcut untill the Token architecture uniform connection limit calculations are in place. */
$abuseControlFault = User::isAbuseControlViolated(User::getObject($info['user_id']), $info['user_mac'], Node::getObject($info['node_id']));
if ($abuseControlFault) {
$auth_response = ACCOUNT_STATUS_DENIED;
$auth_message .= "| {$abuseControlFault} ";
$authenticator->logout($info['conn_id']);
$auth_message .= "| User is now logged out. ";
} else {
$auth_response = $info['account_status'];
}
}
} else {
$auth_response = ACCOUNT_STATUS_DENIED;
$auth_message .= "| Invalid token status: " . $token_to_text[$info['token_status']] . ". ";
}
}
} else {
示例4: processAdminUI
/**
* Processes the input of the administration interface for ContentGroupElement
*
* @return void
*/
public function processAdminUI()
{
$db = AbstractDb::getObject();
// Init values
$allowed_node_rows = null;
$errmsg = null;
parent::processAdminUI();
/* display_order */
$name = "content_group_element_" . $this->id . "_display_order";
$this->setDisplayOrder($_REQUEST[$name]);
// valid_from_timestamp
$name = "content_group_element_" . $this->id . "_valid_from";
$this->setValidFromDate(DateTimeWD::processSelectDateTimeUI($name, DateTimeWD::INTERFACE_DATETIME_FIELD)->getIso8601FormattedString());
// valid_until_timestamp
$name = "content_group_element_" . $this->id . "_valid_until";
$this->setValidUntilDate(DateTimeWD::processSelectDateTimeUI($name, DateTimeWD::INTERFACE_DATETIME_FIELD)->getIso8601FormattedString());
/* content_group_element_has_allowed_nodes */
$sql = "SELECT * FROM content_group_element_has_allowed_nodes WHERE content_group_element_id='{$this->id}'";
$db->execSql($sql, $allowed_node_rows, false);
if ($allowed_node_rows != null) {
foreach ($allowed_node_rows as $allowed_node_row) {
$node = Node::getObject($allowed_node_row['node_id']);
$name = "content_group_element_" . $this->id . "_allowed_node_" . $node->GetId() . "_remove";
if (!empty($_REQUEST[$name]) && $_REQUEST[$name] == true) {
$sql = "DELETE FROM content_group_element_has_allowed_nodes WHERE content_group_element_id='{$this->id}' AND node_id='" . $node->GetId() . "'";
$db->execSqlUpdate($sql, false);
}
}
}
$name = "content_group_element_{$this->id}_new_allowed_node_submit";
if (!empty($_REQUEST[$name]) && $_REQUEST[$name] == true) {
$name = "content_group_element_{$this->id}_new_allowed_node";
$node = Node::processSelectUI($name);
$node_id = $node->GetId();
$db->execSqlUpdate("INSERT INTO content_group_element_has_allowed_nodes (content_group_element_id, node_id) VALUES ('{$this->id}', '{$node_id}')", FALSE);
}
/* displayed_content_id */
if (empty($this->content_group_element_row['displayed_content_id'])) {
// Could be either a new content or existing content ( try both successively )
$displayed_content = Content::processNewContentUI("content_group_element_{$this->id}_new_displayed_content");
if ($displayed_content == null) {
$displayed_content = Content::processSelectExistingContentUI("content_group_element_{$this->id}_new_displayed_existing_element");
}
if ($displayed_content != null) {
$displayed_content_id = $displayed_content->GetId();
$db->execSqlUpdate("UPDATE content_group_element SET displayed_content_id = '{$displayed_content_id}' WHERE content_group_element_id = '{$this->id}'", FALSE);
}
} else {
$displayed_content = self::getObject($this->content_group_element_row['displayed_content_id']);
$name = "content_group_element_{$this->id}_erase_displayed_content";
if (!empty($_REQUEST[$name]) && $_REQUEST[$name] == true) {
if ($displayed_content->delete($errmsg) != false) {
$db->execSqlUpdate("UPDATE content_group_element SET displayed_content_id = NULL WHERE content_group_element_id = '{$this->id}'", FALSE);
} else {
echo $errmsg;
}
} else {
$displayed_content->processAdminUI();
}
}
}
示例5: Exception
if ($nodes_results == null) {
throw new Exception(_("No deployed nodes could not be found in the database"));
}
echo "<html>\n<head>\n";
echo "<title>Node Monitoring System</title>\n</head>\n";
echo "<style>\n";
echo "table {border: 1px solid black;}\n";
echo "td {padding: 4px;}\n";
echo "tr {border: 1px solid black;}\n";
echo ".alert {background: #ffaaaa;}\n";
echo "</style>";
echo "<body>\n";
echo "<p>Current server time: " . date("r") . "</p>";
echo "<table>\n<tr><th>Node</th><th>Last Heartbeat</th><th>Last IP Address</th><th>Status Message</th></tr>\n";
foreach ($nodes_results as $node_row) {
$nodeObject = Node::getObject($node_row['node_id']);
echo "<tr><td>";
echo $nodeObject->getName();
echo "</td><td>";
echo $nodeObject->getLastHeartbeatTimestamp();
echo "</td><td>";
echo $nodeObject->getLastHeartbeatIP();
echo "</td>";
try {
page_if_down_since($nodeObject, 43200);
//A month
page_if_down_since($nodeObject, 10080);
//A week
page_if_down_since($nodeObject, 1440);
//A day
page_if_down_since($nodeObject, 120);
示例6: generateConnectionToken
/** Generate a token in the connection table so the user can actually use the internet
@return true on success, false on failure
*/
function generateConnectionToken($mac = null)
{
if ($this->isUserValid()) {
$db = AbstractDb::getObject();
$session = Session::getObject();
$token = self::generateToken();
if ($_SERVER['REMOTE_ADDR']) {
$node_ip = $db->escapeString($_SERVER['REMOTE_ADDR']);
}
if ($session && $node_ip && $session->get(SESS_NODE_ID_VAR)) {
//echo "$session && $node_ip && {$session->get(SESS_NODE_ID_VAR)}";
$node_id = $db->escapeString($session->get(SESS_NODE_ID_VAR));
$abuseControlFault = User::isAbuseControlViolated($this, $mac, Node::getObject($node_id));
if ($abuseControlFault) {
throw new Exception($abuseControlFault);
}
$mac = is_null($mac) ? '' : $db->escapeString($mac);
/*
* Delete all unused tokens for this user, so we don't fill the database
* with them
*/
$sql = "DELETE FROM connections USING tokens " . "WHERE tokens.token_id=connections.token_id AND token_status='" . TOKEN_UNUSED . "' AND user_id = '" . $this->getId() . "';\n";
// TODO: Try to find a reusable token before creating a brand new one!
$sql .= "INSERT INTO tokens (token_owner, token_issuer, token_id, token_status) VALUES ('" . $this->getId() . "', '" . $this->getId() . "', '{$token}', '" . TOKEN_UNUSED . "');\n";
$sql .= "INSERT INTO connections (user_id, token_id, timestamp_in, node_id, node_ip, last_updated, user_mac) VALUES ('" . $this->getId() . "', '{$token}', CURRENT_TIMESTAMP, '{$node_id}', '{$node_ip}', CURRENT_TIMESTAMP, '{$mac}')";
$db->execSqlUpdate($sql, false);
$retval = $token;
} else {
$retval = false;
}
} else {
$retval = false;
}
return $retval;
}
示例7: elseif
* @version Subversion $Id$
* @link http://www.wifidog.org/
*/
/**
* Load common include file
*/
require_once 'admin_common.php';
require_once 'classes/Node.php';
require_once 'classes/Network.php';
require_once 'classes/AbstractGeocoder.php';
require_once 'classes/MainUI.php';
require_once 'classes/Server.php';
$ui = MainUI::getObject();
$ui->setTitle(_("Hotspot location map"));
if (!empty($_REQUEST['node_id'])) {
$node = Node::getObject($_REQUEST['node_id']);
// Add Google Maps JavaScript ( must set config values )
$html_headers = "<script src=\"http://maps.google.com/maps?file=api&v=1&key=" . VirtualHost::getCurrentVirtualHost()->getGoogleAPIKey() . "\" type=\"text/javascript\"></script>";
$ui->appendHtmlHeadContent($html_headers);
// Create HTML body
$html = _("Click anywhere on the map to extract the GIS location, then click on the button to save the data.") . "<br>";
$html .= "<div id=\"map_frame\"></div>\n";
$html .= "<input type='button' value='" . _("Use these coordinates") . "' onClick='setLocationInOriginalWindow();'>\n";
$ui->addContent('main_area_middle', $html);
if (($gisLocation = $node->getGisLocation()) !== null && $gisLocation->getLatitude() != null) {
} elseif (($gisLocation = $node->getNetwork()->getGisLocation()) !== null && $gisLocation->getLatitude() != null) {
} else {
$html .= "<div class='error'>" . _("Error: You need to set the GIS coordinates of the center of your network") . "</div\n";
$gisLocation = null;
}
if ($gisLocation !== null) {
示例8: mkdir
} else {
$verbose = false;
}
if (!is_dir(WIFIDOG_ABS_FILE_PATH . NODE_PUBLIC_STATS_DIR)) {
mkdir(WIFIDOG_ABS_FILE_PATH . NODE_PUBLIC_STATS_DIR, 0775);
}
$db = AbstractDb::getObject();
$sql = "SELECT node_id, network_id, allows_public_stats FROM nodes WHERE node_deployment_status != 'PERMANENTLY_CLOSED'";
$result = null;
$db->execSql($sql, $result, false);
$session = Session::getObject();
//print_r($result);
$statistics_object = new YearlyStats();
$session->set('current_statistics_object', $statistics_object);
foreach ($result as $row) {
$node = Node::getObject($row['node_id']);
$network = $node->getNetwork();
if ($node->getAllowsPublicStats()) {
$statistics_object->setSelectedNodes(array($node->getId() => $node));
$statistics_object->setSelectedNetworks(array($network->getId() => $network));
if ($verbose) {
print "Processing node {$node->getId()} ... mem used: " . memory_get_usage() . "\n";
}
//Make sure folder exists
if (!is_dir($node->getPublicStatsDir())) {
mkdir($node->getPublicStatsDir(), 0775);
}
//Write the index file header
$index = fopen($node->getPublicStatsDir() . $node->getPublicStatsFile(), "w");
fwrite($index, "" . '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">' . "\n" . "<html>\n<head>\n" . '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">' . "\n" . '<meta http-equiv="Pragma" content="no-cache">' . "\n" . "<title>Statistics for {$node->getName()}</title>\n" . '<link rel="stylesheet" type="text/css" href="/media/public_stats/stylesheet.css">' . "\n" . '<link rel="stylesheet" type="text/css" media="print" href="/media/base_theme/printer.css">' . "\n" . "</head>\n<body>\n" . "<h1>Statistics for {$node->getName()}</h1>\n");
//Generate reports
示例9: getOutput
/**
* Retreives the output of this object.
*
* @return void
*
* @author Benoit Grégoire <benoitg@coeus.ca>
* @author Francois Proulx <francois.proulx@gmail.com>
* @author Max Horváth <max.horvath@freenet.de>
* @copyright 2004-2006 Benoit Grégoire, Technologies Coeus inc.
* @copyright 2004-2006 Francois Proulx, Technologies Coeus inc.
* @copyright 2006 Max Horváth, Horvath Web Consulting
*/
public function getOutput()
{
$db = AbstractDb::getObject();
// Root node
$_rss = $this->_xmldoc->createElement("rss");
$this->_xmldoc->appendChild($_rss);
$_rss->setAttribute('version', '2.0');
// channel
$_channel = $this->_xmldoc->createElement("channel");
$_rss->appendChild($_channel);
/*
* Required channel elements
*/
// title
$_title = $this->_xmldoc->createElement("title");
$_title = $_channel->appendChild($_title);
$_textNode = $this->_xmldoc->createTextNode($this->_network->getName() . ": " . _("Newest Hotspots"));
$_title->appendChild($_textNode);
// link
$_link = $this->_xmldoc->createElement("link");
$_channel->appendChild($_link);
$_textNode = $this->_xmldoc->createTextNode($this->_network->getWebSiteURL());
$_link->appendChild($_textNode);
// description
$_description = $this->_xmldoc->createElement("description");
$_channel->appendChild($_description);
$_textNode = $this->_xmldoc->createTextNode(_("List of the most recent Hotspots opened by the network: ") . $this->_network->getName());
$_description->appendChild($_textNode);
/*
* Optional channel elements
*/
// language
$_language = $this->_xmldoc->createElement("language");
$_channel->appendChild($_language);
if (User::getCurrentUser() != null) {
$_textNode = $this->_xmldoc->createTextNode(substr(User::getCurrentUser()->getPreferedLocale(), 0, 5));
} else {
$_textNode = $this->_xmldoc->createTextNode("en-US");
}
$_language->appendChild($_textNode);
// copyright
$_copyright = $this->_xmldoc->createElement("copyright");
$_channel->appendChild($_copyright);
$_textNode = $this->_xmldoc->createTextNode(_("Copyright ") . $this->_network->getName());
$_copyright->appendChild($_textNode);
// webMaster
if ($this->_network->getTechSupportEmail() != "") {
$_webMaster = $this->_xmldoc->createElement("webMaster");
$_channel->appendChild($_webMaster);
$_textNode = $this->_xmldoc->createTextNode($this->_network->getTechSupportEmail());
$_webMaster->appendChild($_textNode);
}
// pubDate
$_pubDate = $this->_xmldoc->createElement("pubDate");
$_channel->appendChild($_pubDate);
$_textNode = $this->_xmldoc->createTextNode(gmdate("D, d M Y H:i:s \\G\\M\\T", time()));
$_pubDate->appendChild($_textNode);
/**
* lastBuildDate
*
* <lastBuildDate> -- The date-time the last time the content of the
* channel changed.
*
* Make a request through the database for the latest modification date
* of an object.
*
* @todo The latest modification date of an object should be an
* object property
*/
$db->execSqlUniqueRes("SELECT EXTRACT(epoch FROM MAX(creation_date)) as date_last_hotspot_opened FROM nodes WHERE network_id = '" . $db->escapeString($this->_network->getId()) . "' AND (node_deployment_status = 'DEPLOYED' OR node_deployment_status = 'NON_WIFIDOG_NODE')", $_lastHotspotRow, false);
$_lastBuildDate = $this->_xmldoc->createElement("lastBuildDate");
$_channel->appendChild($_lastBuildDate);
$_textNode = $this->_xmldoc->createTextNode(gmdate("D, d M Y H:i:s \\G\\M\\T", $_lastHotspotRow['date_last_hotspot_opened']));
$_lastBuildDate->appendChild($_textNode);
// generator
$_generator = $this->_xmldoc->createElement("generator");
$_channel->appendChild($_generator);
$_textNode = $this->_xmldoc->createTextNode(WIFIDOG_NAME . " " . WIFIDOG_VERSION);
$_generator->appendChild($_textNode);
// docs
$_docs = $this->_xmldoc->createElement("docs");
$_channel->appendChild($_docs);
$_textNode = $this->_xmldoc->createTextNode("http://blogs.law.harvard.edu/tech/rss");
$_docs->appendChild($_textNode);
// image
/*if (defined('NETWORK_LOGO_NAME') && file_exists(WIFIDOG_ABS_FILE_PATH . "local_content/common/" . constant('NETWORK_LOGO_NAME'))) {
$_image = $this->_xmldoc->createElement("image");
$_channel->appendChild($_image);
//.........这里部分代码省略.........
示例10: getReportUI
/** Get the actual report.
* Classes must override this, but must call the parent's method with what
* would otherwise be their return value and return that instead.
* @param $child_html The child method's return value
* @return A html fragment
*/
public function getReportUI($child_html = null)
{
$db = AbstractDb::getObject();
global $account_status_to_text;
global $token_to_text;
// Init values
$html = "";
$_date_from = "";
$_date_to = "";
// Process input
if (isset($_REQUEST['date_from'])) {
$_date_from = $_REQUEST['date_from'];
}
if (isset($_REQUEST['date_to'])) {
$_date_to = $_REQUEST['date_to'];
}
$selected_users = $this->stats->getSelectedUsers();
if ($selected_users) {
foreach ($selected_users as $user_id => $userObject) {
if ($userObject) {
$userinfo = null;
$user_id = $db->escapeString($user_id);
$sql = "SELECT * FROM users WHERE user_id='{$user_id}'";
$db->execSqlUniqueRes($sql, $userinfo, false);
if ($userinfo == null) {
throw new Exception(sprintf(_("User id: %s could not be found in the database"), $user_id));
}
$userinfo['account_status_description'] = $account_status_to_text[$userinfo['account_status']];
$html .= "<fieldset>\n";
$html .= "<legend>" . _("Profile") . "</legend>\n";
$html .= "<table>\n";
$html .= "<tr class='odd'>\n";
$html .= " <th>" . _("Username") . ":</th>\n";
$html .= " <td>" . $userinfo['username'] . "</td>\n";
$html .= "</tr>\n";
$html .= "<tr class='odd'>\n";
$html .= " <th>" . _("Email") . ":</th>\n";
$html .= " <td>" . $userinfo['email'] . "</td>\n";
$html .= "</tr>\n";
$html .= "<tr>\n";
$html .= " <th>" . _("Network") . ":</th>\n";
$html .= " <td><a href='?date_from={$_date_from}&date_to={$_date_to}&network_id={$userinfo['account_origin']}'>{$userinfo['account_origin']}</a></td>\n";
$html .= "</tr>\n";
$html .= "<tr class='odd'>\n";
$html .= " <th>" . _("Unique ID") . ":</th>\n";
$html .= " <td>" . $userinfo['user_id'] . "</td>\n";
$html .= "</tr>\n";
$html .= "<tr>\n";
$html .= " <th>" . _("Member since") . ":</th>\n";
$html .= " <td>" . strftime("%c", strtotime($userinfo['reg_date'])) . "</td>\n";
$html .= "</tr>\n";
$html .= "<tr class='odd'>\n";
$html .= " <th>" . _("Account Status") . ":</th>\n";
$html .= " <td>" . $userinfo['account_status_description'] . "</td>\n";
$html .= "</tr>\n";
$html .= "<tr class='odd'>\n";
$html .= " <th>" . _("Prefered Locale") . ":</th>\n";
$html .= " <td>" . $userinfo['prefered_locale'] . "</td>\n";
$html .= "</tr>\n";
$html .= "</table>\n";
$html .= "</fieldset>\n";
}
/******* Connections **********/
$html .= "<fieldset>\n";
$candidate_connections_sql = $this->stats->getSqlCandidateConnectionsQuery("*");
$sql = "{$candidate_connections_sql} ORDER BY timestamp_in DESC";
$db->execSql($sql, $connections, false);
$html .= "<legend>" . sprintf(_("%d Connections"), count($connections)) . "</legend>\n";
// Variables init
$even = 0;
$total = array();
$total['incoming'] = 0;
$total['outgoing'] = 0;
$total['time_spent'] = 0;
if (count($connections) == 0) {
$html .= _("No information found matching the report configuration");
} else {
$html .= "<table class='smaller'>\n";
$html .= "<thead>\n";
$html .= "<tr>\n";
$html .= " <th>" . _("Logged in") . "</th>\n";
$html .= " <th>" . _("Time spent") . "</th>\n";
$html .= " <th>" . _("Token status") . "</th>\n";
$html .= " <th>" . _("Node") . "</th>\n";
$html .= " <th>" . _("IP") . "</th>\n";
$html .= " <th>" . _("D") . "</th>\n";
$html .= " <th>" . _("U") . "</th>\n";
$html .= "</tr>\n";
$html .= "</thead>\n";
foreach ($connections as $connection) {
$timestamp_in = !empty($connection['timestamp_in']) ? strtotime($connection['timestamp_in']) : null;
$timestamp_out = !empty($connection['timestamp_out']) ? strtotime($connection['timestamp_out']) : null;
$nodeObject = Node::getObject($connection['node_id']);
$total['incoming'] += $connection['incoming'];
//.........这里部分代码省略.........
示例11: getOutput
/**
* Retreives the output of this object.
*
* @param bool $return_object If true this function only returns the DOM object
*
* @return string The XML output
*
* @author Benoit Grégoire <benoitg@coeus.ca>
* @author Francois Proulx <francois.proulx@gmail.com>
* @author Max Horváth <max.horvath@freenet.de>
* @copyright 2004-2006 Benoit Grégoire, Technologies Coeus inc.
* @copyright 2004-2006 Francois Proulx, Technologies Coeus inc.
* @copyright 2006 Max Horváth, Horvath Web Consulting
*/
public function getOutput($return_object = false)
{
// Root node
$_hotspotStatusRootNode = $this->_xmldoc->createElement("wifidogHotspotsStatus");
$_hotspotStatusRootNode->setAttribute('version', '1.0');
$this->_xmldoc->appendChild($_hotspotStatusRootNode);
// Document metadata
$_documentGendateNode = $this->_xmldoc->createElement("generationDateTime", gmdate("Y-m-d\\Th:m:s\\Z"));
$_hotspotStatusRootNode->appendChild($_documentGendateNode);
// Network metadata
$_networkMetadataNode = $this->_xmldoc->createElement("networkMetadata");
$_networkMetadataNode = $_hotspotStatusRootNode->appendChild($_networkMetadataNode);
$_networkUriNode = $this->_xmldoc->createElement("networkUri", htmlspecialchars($this->_network->getWebSiteURL(), ENT_QUOTES));
$_networkMetadataNode->appendChild($_networkUriNode);
$_networkNameNode = $this->_xmldoc->createElement("name", htmlspecialchars($this->_network->getName(), ENT_QUOTES));
$_networkMetadataNode->appendChild($_networkNameNode);
$_networkUrlNode = $this->_xmldoc->createElement("websiteUrl", htmlspecialchars($this->_network->getWebSiteURL(), ENT_QUOTES));
$_networkMetadataNode->appendChild($_networkUrlNode);
$_email = $this->_network->getTechSupportEmail();
if (!empty($email)) {
$_networkEmailNode = $this->_xmldoc->createElement("techSupportEmail", $_email);
$_networkMetadataNode->appendChild($_networkEmailNode);
}
$_nodesCountNode = $this->_xmldoc->createElement("hotspotsCount", count($this->_nodes));
$_networkMetadataNode->appendChild($_nodesCountNode);
$_networkValidUsersNode = $this->_xmldoc->createElement("validSubscribedUsersCount", $this->_network->getNumValidUsers());
$_networkMetadataNode->appendChild($_networkValidUsersNode);
// Get number of online users
$_networkOnlineUsersNode = $this->_xmldoc->createElement("onlineUsersCount", $this->_network->getNumOnlineUsers());
$_networkMetadataNode->appendChild($_networkOnlineUsersNode);
// Node details
if ($this->_nodes) {
// Hotspots metadata
$_hotspotsMetadataNode = $this->_xmldoc->createElement("hotspots");
$_hotspotsMetadataNode = $_hotspotStatusRootNode->appendChild($_hotspotsMetadataNode);
foreach ($this->_nodes as $_nodeData) {
$_node = Node::getObject($_nodeData['node_id']);
$this->_network = $_node->getNetwork();
$_hotspot = $this->_xmldoc->createElement("hotspot");
$_hotspot = $_hotspotsMetadataNode->appendChild($_hotspot);
// Hotspot ID
$_hotspotId = $this->_xmldoc->createElement("hotspotId", $_node->getId());
$_hotspot->appendChild($_hotspotId);
// Hotspot name
$_hotspotName = $this->_xmldoc->createElement("name", htmlspecialchars($_node->getName(), ENT_QUOTES));
$_hotspot->appendChild($_hotspotName);
/**
* (1..n) A Hotspot has many node
*
* WARNING For now, we are simply duplicating the hotspot data in node
* Until wifidog implements full abstractiong hotspot vs nodes.
*/
$_nodes = $this->_xmldoc->createElement("nodes");
$_hotspot->appendChild($_nodes);
$_nodeMetadataNode = $this->_xmldoc->createElement("node");
$_nodes->appendChild($_nodeMetadataNode);
// Node ID
$_nodeId = $this->_xmldoc->createElement("nodeId", $_node->getId());
$_nodeMetadataNode->appendChild($_nodeId);
// Online Users
$_nodeUserNum = $this->_xmldoc->createElement("numOnlineUsers", $_node->GetNumOnlineUsers());
$_nodeMetadataNode->appendChild($_nodeUserNum);
$_nodeCreationDate = $this->_xmldoc->createElement("creationDate", $_node->getCreationDate());
$_nodeMetadataNode->appendChild($_nodeCreationDate);
if ($_node->getDeploymentStatus() != 'NON_WIFIDOG_NODE') {
if ($_nodeData['is_up'] == 't') {
$_nodeStatus = $this->_xmldoc->createElement("status", "up");
} else {
$_nodeStatus = $this->_xmldoc->createElement("status", "down");
}
$_nodeMetadataNode->appendChild($_nodeStatus);
}
if (($_gisData = $_node->getGisLocation()) !== null) {
$_nodeGis = $this->_xmldoc->createElement("gisLatLong");
$_nodeGis->setAttribute("lat", $_gisData->getLatitude());
$_nodeGis->setAttribute("long", $_gisData->getLongitude());
$_nodeMetadataNode->appendChild($_nodeGis);
}
// Hotspot opening date ( for now it's called creation_date )
$_hotspotOpeningDate = $this->_xmldoc->createElement("openingDate", $_node->getCreationDate());
$_hotspot->appendChild($_hotspotOpeningDate);
// Hotspot Website URL
if ($_node->getWebSiteURL() != "") {
$_hotspotUrl = $this->_xmldoc->createElement("webSiteUrl", htmlspecialchars($_node->getWebSiteURL(), ENT_QUOTES));
$_hotspot->appendChild($_hotspotUrl);
}
//.........这里部分代码省略.........
示例12: getOutput
/**
* Retreives the output of this object.
*
* @return string The XML output
*
* @author Benoit Grégoire <benoitg@coeus.ca>
* @author Francois Proulx <francois.proulx@gmail.com>
* @author Max Horváth <max.horvath@freenet.de>
* @copyright 2004-2006 Benoit Grégoire, Technologies Coeus inc.
* @copyright 2004-2006 Francois Proulx, Technologies Coeus inc.
* @copyright 2006 Max Horváth, Horvath Web Consulting
*/
public function getOutput()
{
$this->_csv_document = "jiwire_ref, status, provider_id, provider_name, address, address2, city, state, country, postal_code, website_url, email, phone, fax, location_name, location_type_id, field17, node_type, ssid, fee_comments, equipement, standard_802_11, MAC_address, network_drop, latitude, longitude\r\n";
if ($this->_nodes) {
foreach ($this->_nodes as $_nodeData) {
$_node = Node::getObject($_nodeData['node_id']);
// No JiWire ref. number, status NEW
$this->_csv_document .= "###,NEW,";
// Provider Name = Wifidog node ID
$this->_csv_document .= $this->quoteForCsv($_node->getId()) . ",";
// Provider Id = Wifidog Network name
$this->_csv_document .= $this->quoteForCsv($this->_network->getName()) . ",";
// Address
$this->_csv_document .= $this->quoteForCsv($_node->getCivicNumber() . ", " . $_node->getStreetName()) . ",";
// Address 2 (skipped)
$this->_csv_document .= ",";
// City
$this->_csv_document .= $this->quoteForCsv($_node->getCity()) . ",";
// State
$this->_csv_document .= $this->quoteForCsv($_node->getProvince()) . ",";
// Country
$this->_csv_document .= $this->quoteForCsv($_node->getCountry()) . ",";
// Postal code
$this->_csv_document .= $this->quoteForCsv($_node->getPostalCode()) . ",";
// Web Site URL
$this->_csv_document .= $this->quoteForCsv($_node->getWebSiteURL()) . ",";
// Email
$this->_csv_document .= $this->quoteForCsv($_node->getEmail()) . ",";
// Phone number
$this->_csv_document .= $this->quoteForCsv($_node->getTelephone()) . ",";
// Fax (skipped)
$this->_csv_document .= ",";
// Node name
$this->_csv_document .= $this->quoteForCsv($_node->getName()) . ",";
// Location type (JiWite Appendix A --> 5 = Café), field17 (skipped), node_type (2 = free), SSID (skipped), fee comment (skipped), 802.11 type (b or g, skipped),
$this->_csv_document .= "5,, 2,,,,,,,";
// Latitude + longitude
$this->_csv_document .= $_node->getGisLocation()->getLatitude() . "," . $_node->getGisLocation()->getLongitude();
$this->_csv_document .= "\r\n";
}
}
echo $this->_csv_document;
}
示例13: getOutput
/**
* Displays the output of this node list.
*
* @return void
*
* @author Benoit Grégoire <benoitg@coeus.ca>
* @author Francois Proulx <francois.proulx@gmail.com>
* @author Max Horváth <max.horvath@freenet.de>
* @copyright 2004-2006 Benoit Grégoire, Technologies Coeus inc.
* @copyright 2004-2006 Francois Proulx, Technologies Coeus inc.
* @copyright 2006 Max Horváth, Horvath Web Consulting
*/
public function getOutput()
{
// Init ALL smarty values
$this->_smarty->assign('DEPRECATEDisSuperAdmin', false);
$this->_smarty->assign('GMapsEnabled', false);
$this->_smarty->assign('nodes', array());
$this->_smarty->assign('num_deployed_nodes', 0);
$this->_smarty->assign('PdfSupported', false);
$userData['preSelectedObject'] = $this->_network;
$userData['allowEmpty'] = true;
$userData['nullCaptionString'] = _("All");
$userData['onChange'] = "submit.click();";
$this->_smarty->assign('selectNetworkUI', Network::getSelectUI('network_id', $userData) . (count(Network::getAllNetworks()) > 1 ? '<input class="submit" type="submit" name="submit" value="' . _("Change network") . '">' : ""));
$this->_smarty->assign('selectedNetworkName', $this->_network === null ? _("All networks") : $this->_network->getName());
/**
* Define user security levels for the template
*
* These values are used in the default template of WiFoDog but could be used
* in a customized template to restrict certain links to specific user
* access levels.
*/
$this->_smarty->assign('DEPRECATEDisSuperAdmin', $this->_currentUser && $this->_currentUser->DEPRECATEDisSuperAdmin());
if (defined('GMAPS_HOTSPOTS_MAP_ENABLED') && GMAPS_HOTSPOTS_MAP_ENABLED == true) {
$this->_smarty->assign('GMapsEnabled', true);
}
$_html = null;
/*
* Main content
*/
// Reset ALL smarty SWITCH values
$this->_smarty->assign('sectionMAINCONTENT', false);
// Set section of Smarty template
$this->_smarty->assign('sectionMAINCONTENT', true);
// Node details
if ($this->_nodes) {
foreach ($this->_nodes as $_nodeData) {
$_node = Node::getObject($_nodeData['node_id']);
$_nodeData['num_online_users'] = $_node->getNumOnlineUsers();
$this->_smarty->append("nodes", $_nodeData);
}
}
$this->_smarty->assign("num_deployed_nodes", count($this->_nodes));
// Compile HTML code
$_html_body = $this->_smarty->fetch("templates/sites/hotspot_status.tpl");
/*
* Compile HTML output
*/
$this->_mainUI->setTitle(_("Hotspot list"));
$this->_mainUI->appendHtmlHeadContent('<link rel="alternate" type="application/rss+xml" title="' . ($this->_network === null ? _("All networks") : $this->_network->getName()) . ": " . _("Newest Hotspots") . '" href="' . BASE_SSL_PATH . 'hotspot_status.php?format=RSS">');
$this->_mainUI->addContent('left_area_middle', $_html);
$this->_mainUI->addContent('main_area_middle', $_html_body);
$this->_mainUI->display();
}
示例14: getOutput
/**
* Displays the output of this object.
*
* @return void
*
* @author Benoit Gregoire <benoitg@coeus.ca>
* @author Francois Proulx <francois.proulx@gmail.com>
* @author Max Horváth <max.horvath@freenet.de>
* @author Joe Bowser <bowserj@resist.ca>
* @copyright 2004-2006 Benoit Gregoire, Technologies Coeus inc.
* @copyright 2004-2006 Francois Proulx, Technologies Coeus inc.
* @copyright 2006 Max Horváth, Horvath Web Consulting
* @copyright 2006 Joe Bowser
*/
public function getOutput()
{
$_kml = $this->_xmldoc->createElement("kml");
$_kml->setAttribute('xmlns', 'http://earth.google.com/kml/2.0');
$this->_xmldoc->appendChild($_kml);
// Document
$_document = $this->_xmldoc->createElement("Document");
$_kml->appendChild($_document);
/*
* Style Elements (Up Nodes)
*/
$_style_up = $this->_xmldoc->createElement("Style");
$_style_up->setAttribute('id', 'node_up');
$_document->appendChild($_style_up);
$_iconStyle = $this->_xmldoc->createElement("IconStyle");
$_style_up->appendChild($_iconStyle);
/* Since scale is the same, we only have to define it once */
$_scale = $this->_xmldoc->createElement("scale");
$_iconStyle->appendChild($_scale);
$_textNode = $this->_xmldoc->createTextNode("0.5");
$_scale->appendChild($_textNode);
$_icon = $this->_xmldoc->createElement("Icon");
$_iconStyle->appendChild($_icon);
$_href = $this->_xmldoc->createElement("href");
$_icon->appendChild($_href);
$_textNode = $this->_xmldoc->createTextNode(BASE_URL_PATH . "images/HotspotStatusMap/up.png");
$_href->appendChild($_textNode);
/*
* Style Elements (Down Nodes)
*/
$_style_down = $this->_xmldoc->createElement("Style");
$_style_down->setAttribute('id', 'node_down');
$_document->appendChild($_style_down);
$_iconStyle = $this->_xmldoc->createElement("IconStyle");
$_style_down->appendChild($_iconStyle);
$_scale = $this->_xmldoc->createElement("scale");
$_iconStyle->appendChild($_scale);
$_textNode = $this->_xmldoc->createTextNode("0.5");
$_scale->appendChild($_textNode);
$_iconStyle->appendChild($_scale);
$_icon = $this->_xmldoc->createElement("Icon");
$_iconStyle->appendChild($_icon);
$_href = $this->_xmldoc->createElement("href");
$_icon->appendChild($_href);
$_textNode = $this->_xmldoc->createTextNode(BASE_URL_PATH . "images/HotspotStatusMap/down.png");
$_href->appendChild($_textNode);
/*
* Style Elements (Unknown Nodes)
*/
$_style_unknown = $this->_xmldoc->createElement("Style");
$_style_unknown->setAttribute('id', 'node_unknown');
$_document->appendChild($_style_unknown);
$_iconStyle = $this->_xmldoc->createElement("IconStyle");
$_style_unknown->appendChild($_iconStyle);
$_scale = $this->_xmldoc->createElement("scale");
$_iconStyle->appendChild($_scale);
$_textNode = $this->_xmldoc->createTextNode("0.5");
$_scale->appendChild($_textNode);
$_icon = $this->_xmldoc->createElement("Icon");
$_iconStyle->appendChild($_icon);
$_href = $this->_xmldoc->createElement("href");
$_icon->appendChild($_href);
$_textNode = $this->_xmldoc->createTextNode(BASE_URL_PATH . "images/HotspotStatusMap/unknown.png");
$_href->appendChild($_textNode);
/*
* Creating the Folder
*/
$_folder = $this->_xmldoc->createElement("Folder");
$_document->appendChild($_folder);
$_name = $this->_xmldoc->createElement("name");
$_folder->appendChild($_name);
$_textNode = $this->_xmldoc->createTextNode($this->_network->getName());
$_name->appendChild($_textNode);
/*
* Creating the Placemarks (Nodes)
*/
if ($this->_nodes) {
foreach ($this->_nodes as $_nodeData) {
$_node = Node::getObject($_nodeData['node_id']);
$this->_network = $_node->getNetwork();
$_placemark = $this->_xmldoc->createElement("Placemark");
$_folder->appendChild($_placemark);
// Hotspot name
$_hotspotName = $this->_xmldoc->createElement("name", htmlspecialchars($_node->getName(), ENT_QUOTES));
$_placemark->appendChild($_hotspotName);
$_html_data = "<b>" . _("Address") . ":</b><br />" . $_node->getCivicNumber() . " " . $_node->getStreetName() . "<br />" . $_node->getCity() . "," . $_node->getProvince() . "<br />" . $_node->getCountry() . "<br />" . $_node->getPostalCode() . "<br /><br /> <b>" . _("URL") . ":</b> <a href='" . $_node->getWebSiteURL() . "'>" . $_node->getWebSiteURL() . "</a> <br /> <b> " . _("Email") . ":</b> <a href='mailto:" . $_node->getEmail() . "'>" . $_node->getEmail() . "</a>";
//.........这里部分代码省略.........