当前位置: 首页>>代码示例>>PHP>>正文


PHP Network::getAllNetworks方法代码示例

本文整理汇总了PHP中Network::getAllNetworks方法的典型用法代码示例。如果您正苦于以下问题:PHP Network::getAllNetworks方法的具体用法?PHP Network::getAllNetworks怎么用?PHP Network::getAllNetworks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Network的用法示例。


在下文中一共展示了Network::getAllNetworks方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

// Set section of Smarty template
$smarty->assign('sectionTOOLCONTENT', true);
// Compile HTML code
$html = $smarty->fetch("templates/sites/lost_password.tpl");
/*
 * Main content
 */
// Reset ALL smarty SWITCH values
$smarty->assign('sectionTOOLCONTENT', false);
$smarty->assign('sectionMAINCONTENT', false);
// Set section of Smarty template
$smarty->assign('sectionMAINCONTENT', true);
// Add the auth servers list to smarty variables
$sources = array();
// Preserve keys
$network_array = Network::getAllNetworks();
foreach ($network_array as $network) {
    if ($network->getAuthenticator()->isRegistrationPermitted()) {
        $sources[$network->getId()] = $network->getName();
    }
}
if (isset($sources)) {
    $smarty->assign('auth_sources', $sources);
}
// Pass the account_origin along, if it's set
if (isset($_REQUEST["auth_source"])) {
    $smarty->assign('selected_auth_source', $_REQUEST["auth_source"]);
}
if (Server::getServer()->getUseGlobalUserAccounts()) {
    $default_network_param = Network::getDefaultNetwork()->getId();
    $smarty->assign('SelectNetworkUI', "<input type=\"hidden\" name=\"auth_source\" value='{$default_network_param}' />");
开发者ID:cnlangzi,项目名称:wifidog-auth,代码行数:31,代码来源:lost_password.php

示例2: switch

    $nodes_list[] = $node_row;
}
// Sort using PHP
if ($sort_by_using_sql === false) {
    // Using natural-sort algorithm .
    switch ($sort_by_param) {
        case "node_id":
            Utils::natsort2d($nodes_list, "node_id");
            break;
        case "num_online_users":
            Utils::natsort2d($nodes_list, "num_online_users");
            break;
    }
}
// Pass values to Smarty
$smarty->assign('selectNetworkUI', Network::getSelectUI('network_id', array('preSelectedObject' => $network, 'allowEmpty' => true, 'nullCaptionString' => _("All"), 'onChange' => "submit.click();")) . (count(Network::getAllNetworks()) > 1 ? '<input class="submit" type="submit" name="submit" value="' . _("Change network") . '">' : ""));
if ($network !== null) {
    $smarty->assign('selectedNetwork', $network->getName());
} else {
    $smarty->assign('allNetworks', _("All networks"));
}
$smarty->assign("nodes", $nodes_list);
$smarty->assign("sort_by_param", $sort_by_param);
require_once 'classes/MainUI.php';
$ui = MainUI::getObject();
$ui->addContent('main_area_middle', $smarty->fetch("templates/node_list.html"));
$ui->display();
/*
 * Local variables:
 * tab-width: 4
 * c-basic-offset: 4
开发者ID:soitun,项目名称:wifidog-auth,代码行数:31,代码来源:node_list.php

示例3: getLoginUI

 /**
  * Get the login interface
  *  @param string $userData=null Array of contextual data optionally sent to the method.
  *  The function must still function if none of it is present.
  *
  *      * This method understands:
  *  $userData['preSelectedUser'] An optional User object.
  * @return HTML markup
  */
 public static function getLoginUI($userData = null)
 {
     require_once 'classes/SmartyWifidog.php';
     $networkUserData = null;
     if (!empty($userData['preSelectedUser'])) {
         $selectedUser = $userData['preSelectedUser'];
         $networkUserData['preSelectedObject'] = $selectedUser;
     } else {
         $selectedUser = null;
     }
     $smarty = SmartyWiFiDog::getObject();
     // Set network selector
     $network_array = Network::getAllNetworks();
     $default_network = Network::getDefaultNetwork();
     foreach ($network_array as $network) {
         if ($network->getName() == $default_network->getName()) {
             $default_network_param = $network->getId();
         }
     }
     if (Server::getServer()->getUseGlobalUserAccounts()) {
         $smarty->assign('selectNetworkUI', "<input type=\"hidden\" name=\"auth_source\" value='{$default_network_param}' />");
     } else {
         $smarty->assign('selectNetworkUI', Network::getSelectUI('auth_source', $networkUserData));
     }
     // Set user details
     $smarty->assign('user_id', $selectedUser ? $selectedUser->getId() : "");
     $smarty->assign('username', $selectedUser ? $selectedUser->getUsername() : "");
     // Set error message
     $smarty->assign('error', self::$_loginLastError);
     // Check if one of the network allow signup
     $network_array = Network::getAllNetworks();
     $networksAllowingSignup = null;
     foreach ($network_array as $network) {
         if ($network->getAuthenticator()->isRegistrationPermitted()) {
             $networksAllowingSignup[] = $network;
         }
     }
     //pretty_print_r($networksAllowingSignup);
     if (count($networksAllowingSignup) > 0) {
         //FIXME:  This is far from ideal, it assumes that all networks use the same signup URL, or that only one network allows signup.
         $smarty->assign('signupUrl', $networksAllowingSignup[0]->getAuthenticator()->getSignupUrl());
     }
     // Compile HTML code
     $html = self::ArrayToHiddenInput($_POST);
     //This must remain BEFORE the actual form. It allws repeating the request if the login attempt is causes by a session timeout or insufficient permissions.
     $html .= $smarty->fetch("templates/classes/Authenticator_getLoginForm.tpl");
     return $html;
 }
开发者ID:soitun,项目名称:wifidog-auth,代码行数:57,代码来源:Authenticator.php

示例4: Exception

if (!($vhost = VirtualHost::getCurrentVirtualHost())) {
    throw new Exception(_("Unable to get the google API key, because I couldn't find a vhost matching the current hostname"));
}
$html_headers = "<script src='http://maps.google.com/maps?file=api&amp;v=2&amp;&key=" . $vhost->getGoogleAPIKey() . "' type='text/javascript'></script>";
$html_headers .= "<script src='js/hotspots_status_map.js' type='text/javascript'></script>";
$html = null;
/*
 * Main content
 */
// Set section of Smarty template
$smarty->assign('sectionMAINCONTENT', true);
// Set network selector
$preSelectedObject = !empty($_REQUEST['network_map']) ? Network::getObject($_REQUEST['network_map']) : Network::getCurrentNetwork();
//$selectNetworkUI = Network::getSelectUI('network_map', array('preSelectedObject' => $preSelectedObject, 'onChange' => "javascript: document.lang_form.submit();"));
$selectNetworkUI = Network::getSelectUI('network_map', array('preSelectedObject' => $preSelectedObject, 'onChange' => "submit.click();"));
$smarty->assign('selectNetworkUI', $selectNetworkUI . (count(Network::getAllNetworks()) > 1 ? '<input class="submit" type="submit" name="submit" value="' . _("Change network") . '">' : ""));
// Compile HTML code
$html_body = $smarty->fetch("templates/sites/hotspots_map.tpl");
/*
 * Footer JavaScripts
 */
// Get GIS data to set
if (!empty($_REQUEST['network_map'])) {
    $network = Network::getObject($_REQUEST['network_map']);
} else {
    $network = Network::getCurrentNetwork();
}
$gis_data = $network->getGisLocation();
// The onLoad code should only be called once all DIV are created.
$script = "<script type=\"text/javascript\">//<![CDATA[\n";
$script .= "    function toggleOverlay(name)\n";
开发者ID:cnlangzi,项目名称:wifidog-auth,代码行数:31,代码来源:hotspots_map.php

示例5: 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();
 }
开发者ID:cnlangzi,项目名称:wifidog-auth,代码行数:65,代码来源:NodeListHTML.php


注:本文中的Network::getAllNetworks方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。