本文整理汇总了PHP中Div::addDataElement方法的典型用法代码示例。如果您正苦于以下问题:PHP Div::addDataElement方法的具体用法?PHP Div::addDataElement怎么用?PHP Div::addDataElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Div
的用法示例。
在下文中一共展示了Div::addDataElement方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
<table id="maptable" style="font-size: 12px;">
<tr>
<td style="vertical-align: top;width: 300px">
<?php
$cities_link = array();
$cities_link[] = "transitcompass.com/nyc";
$cities_link[] = "transitcompass.com/boston";
$cities = array();
$nyc = new Location2("NYC", 40.71451, -74.00714000000001, "New York City", null, null, "New York City", "NY", null, "USA", null);
$cities[] = $nyc;
$boston = new Location2("Boston", 42.35864, -71.05665999999999, "Boston", null, null, "Boston", "MA", null, "USA", null);
$cities[] = $boston;
$cities_div = new Div("cities", "<b>Available Cities</b>");
// build the table
$cities_table = new Table(null, "info_table");
$cities_div->addDataElement($cities_table);
// create the header
$header_row = new Row(null, "header_row");
$cities_table->addRow($header_row);
$header_row->addCell(new Cell("header_cell", "<b>Show</b>"));
$header_row->addCell(new Cell("header_cell", "<b>City</b>"));
$header_row->addCell(new Cell("header_cell", "<b>Site Link</b>"));
$highlight = false;
for ($i = 0; $i < count($cities); $i++) {
if ($highlight) {
$class_name = "stationRowHighlight";
$highlight = false;
} else {
$class_name = "stationRow";
$highlight = true;
}
示例2: displayStationChoices
/**
Displays the station choices for choosing alternate stations when using direction finding.
@param $url<String> the URL for the form
@param $start_location<Location> the starting point for the search
@param $end_location<Location> the ending point for the search
@param $path_array[]<Segment> the path found in the original search
*/
function displayStationChoices($url, $start_location, $end_location, $path_array)
{
global $website, $station_marker_img;
$debug = false;
if ($debug) {
echo $start_location->desc . " to " . $end_location->desc . "<br/>";
}
// list alternate start stations
$start_table = new Table(null, "choicetable");
$div = new Div("alternate_choices", "<b>Start Station Choices</b><br/>\n");
$div->addDataElement($start_table);
$div->addDataElement("<br/>\n");
$header_row = new Row(null, "header_row");
$header_row->addCell(new Cell("header_cell", "Show"));
$header_row->addCell(new Cell("header_cell", "Station Name"));
$header_row->addCell(new Cell("header_cell", "Subway Lines"));
$header_row->addCell(new Cell("header_cell"));
$start_table->addRow($header_row);
$start_stations = findNearestStations2($start_location);
$start_station_marker = $path_array[0]->m2;
if ($debug) {
echo "start_station_marker->id = " . $start_station_marker->id . "<br/>";
}
$i = 0;
foreach ($start_stations as $station) {
$station_marker = $station->marker;
$station_lng = $station_marker->getLng();
$station_lat = $station_marker->getLat();
if (isEven($i)) {
$class_name = "rowHighlight";
} else {
$class_name = "row";
}
$station_row = new Row($station_marker->id, $class_name);
// station marker link
$station_row->addCell(new Cell("step_cell", new Link("javascript:focusOn(new GLatLng({$station_lat},{$station_lng}), map.getZoom());", new Image("images/{$station_marker_img}", "0"))));
$station_row->addCell(new Cell("instruction", $station_marker->name));
// build lines cell
$lines = $station_marker->getLines();
$lines_cell = new Cell("instruction");
foreach ($lines as $line) {
$line_img = $line->img;
$line_url = $website . $line->url;
$lines_cell->addData(new Link("javascript:void(0);", new Image(null, "images/{$line_img}", $line->name, null, "20"), "window.open('{$line_url}');"));
}
$station_row->addCell($lines_cell);
if ($start_station_marker->id == $station_marker->id) {
$cell_data = "<input type=\"radio\" name=\"start\" value=\"{$station_marker->id}\" checked=\"true\"/>";
} else {
$cell_data = "<input type=\"radio\" name=\"start\" value=\"{$station_marker->id}\" />";
}
$station_row->addCell(new Cell("step_cell", $cell_data));
$start_table->addRow($station_row);
$i++;
}
// list alternate end stations
$div->addDataElement("<b>End Station Choices</b><br/>\n");
$end_table = new Table(null, "choicetable");
$div->addDataElement($end_table);
$end_table->addRow($header_row);
$end_stations = findNearestStations2($end_location);
$end_station_marker = $path_array[count($path_array) - 1]->m1;
if ($debug) {
echo "end_station_marker->id = " . $end_station_marker->id . "<br/>";
}
$i = 0;
foreach ($end_stations as $station) {
$station_marker = $station->marker;
$station_lng = $station_marker->getLng();
$station_lat = $station_marker->getLat();
if (isEven($i)) {
$class_name = "rowHighlight";
} else {
$class_name = "row";
}
$station_row = new Row($station_marker->id, $class_name);
// station marker link
$station_row->addCell(new Cell("step_cell", new Link("javascript:focusOn(new GLatLng({$station_lat},{$station_lng}), map.getZoom());", new Image("images/{$station_marker_img}", "0"))));
$station_row->addCell(new Cell("instruction", $station_marker->name));
// build lines cell
$lines = $station_marker->getLines();
$lines_cell = new Cell("instruction");
foreach ($lines as $line) {
$line_img = $line->img;
$line_url = $website . $line->url;
$lines_cell->addData(new Link("javascript:void(0);", new Image(null, "images/{$line_img}", $line->name, null, "20"), "window.open('{$line_url}');"));
}
$station_row->addCell($lines_cell);
if ($end_station_marker->id == $station_marker->id) {
$cell_data = "<input type=\"radio\" name=\"end\" value=\"{$station_marker->id}\" checked=\"true\"/>";
} else {
$cell_data = "<input type=\"radio\" name=\"end\" value=\"{$station_marker->id}\" />";
//.........这里部分代码省略.........
示例3: fixSearchString
<body>
<?php
// set the type
$type = $_GET['type'];
if ($debug) {
echo "type = " . $type . "<br/>";
}
// this file does the search functions
include $oop . '/search.php';
if (count($locations) == 1) {
if ($locations[0]->name == null && $_GET['n'] != null) {
$locations[0]->name = fixSearchString($_GET['n']);
}
}
$poweredByDiv = new Div("about", "noselect", null, "uses ");
$poweredByDiv->addDataElement(new Link("http://maps.google.com", "Google Maps"));
$affiliateDiv = new Div(null, "noselect", "font-size:7pt;color:#CCCCCC;", "(not affiliated with Google)");
$poweredByDiv->addDataElement($affiliateDiv);
echo $poweredByDiv->toString();
?>
<table id="header"><tr>
<?php
$logo_img = new Image("logo", null, "images/logo.png", "transitcompass", null, null);
$logo_link = new Link($link, $logo_img);
$logo_data = new Cell("logo", null, "color:#008000", $logo_link);
echo $logo_data->toString();
?>
<!--<td>transit<b>compass</b> <i style="font-size:10px;position:relative;left:-110px;top:-20px;width:100px">NYC Edition</i></td>-->
<td width="100%">
<table class="form" width="100%">
<tr>
示例4: Div
echo $marker_link->toString();
if ($loc->name != null || $loc->name != "") {
echo "<b>" . $loc->name . "</b><br/>";
}
if ($loc->phone != null || $loc->phone != "") {
echo " (" . $loc->phone . ")<br/>";
}
$address_string = $loc->getAddressString();
if ($address_string != "") {
echo $address_string . "\n<br/>";
}
echo "<br/>";
$stations_div = new Div("closest_stations", "<b>The Three Closest Stations</b>");
// build the table
$stations_table = new Table(null, "info_table");
$stations_div->addDataElement($stations_table);
// create the header
$header_row = new Row(null, "header_row");
$stations_table->addRow($header_row);
$header_row->addCell(new Cell("header_cell", "<b>Show</b>"));
$header_row->addCell(new Cell("header_cell", "<b>Station Name</b>"));
$header_row->addCell(new Cell("header_cell", "<b>Subway Lines</b>"));
$highlight = false;
foreach ($stations as $station) {
if ($highlight) {
$class_name = "stationRowHighlight";
$highlight = false;
} else {
$class_name = "stationRow";
$highlight = true;
}