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


PHP Cell::addData方法代码示例

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


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

示例1: createStationTableRow

/**
    @param $station<Station>
*/
function createStationTableRow($station, $marker_img, $class_name)
{
    global $website;
    $station_marker = $station->marker;
    $station_name = $station_marker->name;
    $marker_link = new MarkerLink($station_marker->getLat(), $station_marker->getLng(), new Image("images/{$marker_img}", 0));
    #echo $marker_link->toString() . "<br/>";
    $station_row = new Row($station_name, $class_name);
    //$station_cell = new Cell(null, null, null, $marker_link);
    #echo $station_cell->toString();
    #$station_row->addCell($station_cell);
    $station_row->addCell(new Cell(null, "stationMarkerLink", "text-align: center", $marker_link));
    $station_row->addCell(new Cell("stationName", $station_name));
    $lines_cell = new Cell("stationLines");
    $lines = $station_marker->getLines();
    foreach ($lines as $line) {
        foreach ($line->getConnections() as $connection) {
            if ($connection->type != "transfer") {
                $line_img = $line->img;
                $line_url = $website . $line->url;
                $link = new Link("javascript:void(0);", new Image(null, null, "images/{$line_img}", $line->name, null, 20), "window.open('{$line_url}');");
                //echo $link->toString();
                $lines_cell->addData($link);
                break;
            }
        }
    }
    $station_row->addCell($lines_cell);
    #echo "<!--" . $station_row->toString() . "-->";
    return $station_row;
}
开发者ID:abc2mit,项目名称:abc2mit.github.io,代码行数:34,代码来源:display_functions.php

示例2: fixSearchString

if (count($locations) == 1) {
    if ($locations[0]->name == null && $_GET['n'] != null) {
        $locations[0]->name = fixSearchString($_GET['n']);
    }
}
//$affiliateDiv = new Div(null, "noselect", "font-size:7pt;color:#CCCCCC;", "(not affiliated with Google)");
//$poweredByDiv->addDataElement($affiliateDiv);
echo $linksDiv->toString();
?>
<table id="header">
<tr>
<?php 
$logoDiv = new Div(null, "logo", new Link($link, new Image("logo", "images/{$logo}", "Go To {$link}", "55", "150")));
$headerLogoTD = new Cell("header_logo", null, null, $logoDiv);
$sloganDiv = new Div("slogan", null, $slogan);
$headerLogoTD->addData($sloganDiv);
echo $headerLogoTD->toString();
?>
    <td width="100%">
        <div id="printheader"></div>
        <table class="form" width="100%">
            <tr>
                <td class="menu">
                <?php 
if ($type == 's2s') {
    $s2s = "selected";
} else {
    if ($type == 'location') {
        $station = "selected";
    } else {
        $dir = "selected";
开发者ID:abc2mit,项目名称:abc2mit.github.io,代码行数:31,代码来源:main.php

示例3: 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}\" />";
//.........这里部分代码省略.........
开发者ID:abc2mit,项目名称:abc2mit.github.io,代码行数:101,代码来源:functions.php

示例4: printPath

/**
    This method displays the path instructions on the left side of the screen.
    
    @param $path<array[Segment]> the path found by the algorithm
*/
function printPath($path, $path_time)
{
    global $website;
    $debug = false;
    $count = count($path);
    if ($debug) {
        echo "[display_functions.php:printPath()]<br/>\n";
        echo "path count = {$count}<br/>\n";
        if ($count > 1) {
            print_r($path);
        } else {
            echo "path = {$path}<br/>";
        }
    }
    $old_lines = null;
    if ($count > 0) {
        // print consolidated path
        $directions_table = new Table(null, "info_table");
        $header_row = new Row(null, "header_row");
        $directions_table->addRow($header_row);
        $header_row->addCell(new Cell("header_cell", "Step"));
        $header_row->addCell(new Cell("header_cell", "Instructions"));
        $header_row->addCell(new Cell("header_cell", "Time"));
        for ($x = 0; $x < $count; $x++) {
            // create the row object
            if (isEven($x)) {
                $row_class = "rowHighlight";
            } else {
                $row_class = "row";
            }
            $row = new Row(null, $row_class);
            $y = $x + 1;
            // grab the segment and all its variables
            $segment = $path[$x];
            if ($debug) {
                echo $segment . "<br/>";
                echo "segment = " . $segment->toString() . "<br/>";
            }
            $marker = $segment->m1;
            $m1_name = $marker->name;
            $m1lat = $marker->getLat();
            $m1lng = $marker->getLng();
            $m2_name = $segment->m2->name;
            $connection = $segment->connection;
            $step_cell = new Cell("step_cell", new Link("javascript:focusOn(new GLatLng({$m1lat},{$m1lng}), map.getZoom());", "[ {$y} ]"));
            $instruction_cell = new Cell("instruction");
            $rawTime = $segment->t;
            $time_cell = new Cell("step_cell", getTimeString($rawTime));
            if ($connection == "walking") {
                $instruction_cell->addData("Walk from <b>{$m1_name}</b> to <b>{$m2_name}</b>.");
            } else {
                if ($connection == "transfer") {
                    $lines = $segment->lines;
                    $from_string = "";
                    $to_string = "";
                    for ($i = 0; $i < count($old_lines); $i++) {
                        $from_string .= "<img width=\"20\" src=\"images/" . $old_lines[$i]->img . "\"/>";
                    }
                    for ($i = 0; $i < count($lines); $i++) {
                        $to_string .= "<img width=\"20\" src=\"images/" . $lines[$i]->img . "\"/>";
                    }
                    $instruction_cell->addData("Transfer from <b>{$m1_name}</b> {$from_string} to <b>{$m2_name}</b> {$to_string}");
                } else {
                    // this is a regular segment
                    $output_string = "Take ";
                    $lines = $segment->lines;
                    for ($i = 0; $i < count($lines); $i++) {
                        $output_string .= "<a href=\"javascript:void(0);\" onclick=\"window.open('{$website}" . $lines[$i]->url . "');\"><img width=\"20\" src=\"images/" . $lines[$i]->img . "\"/></a>";
                    }
                    $output_string .= " from <b>{$m1_name}</b> to <b>{$m2_name}</b>.";
                    $instruction_cell->addData($output_string);
                    $old_lines = $lines;
                }
            }
            $row->addCell($step_cell);
            $row->addCell($instruction_cell);
            $row->addCell($time_cell);
            $directions_table->addRow($row);
        }
        $row = new Row(null, "total_row");
        $row->addCell(new Cell(null, ""));
        $row->addCell(new Cell("total", "Total Time:"));
        $row->addCell(new Cell("total_time", getTimeString($path_time)));
        $directions_table->addRow($row);
        echo $directions_table->toString();
    } else {
        echo "Sorry. No path found.<br/>\n";
    }
}
开发者ID:abc2mit,项目名称:abc2mit.github.io,代码行数:94,代码来源:display_functions.php


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