本文整理汇总了PHP中Cell类的典型用法代码示例。如果您正苦于以下问题:PHP Cell类的具体用法?PHP Cell怎么用?PHP Cell使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Cell类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: equals
public function equals(Cell $dst)
{
if ($this == $dst) {
return true;
}
return $this->ch == $dst->getCh() && $this->fg == $dst->getFg() && $this->bg == $dst->getBg();
}
示例2: addCell
public function addCell(\Cell $cell)
{
if ($this->cellExists($cell->getX(), $cell->getY())) {
throw new \LogicException('tato bunka jiz na hraci plose existuje');
}
$this->cells[$cell->getX()][$cell->getY()] = $cell;
}
示例3: draw
/**
* Draw HTML output
*/
function draw()
{
global $c, $sid;
echo '<td colspan="' . $this->cells . '"><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr>';
$widget = new Cell("clc", "", 1, $this->width, 40);
$widget->draw();
echo "</tr><tr>\n";
$widget = new Label("lbl", $this->headline, "headbox", 1);
$widget->draw();
echo "</tr><tr>\n";
$widget = new FormImage($c["docroot"] . "modules/stats/widgets/statsimage.php?sid={$sid}&diagram=" . $this->diagramType . "&width=" . $this->width . "&height=" . $this->height . "&spid=" . $this->spid, $this->width, $this->height, 1);
$widget->draw();
// Draw Legend...
echo "</tr><tr>\n";
$widget = new Cell("clc", "", 1, $this->width, 10);
$widget->draw();
$colors[0] = __RED;
$colors[1] = __BLUE;
$colors[2] = __YELLOW;
$colors[3] = __GREEN;
for ($i = 0; $i < count($this->legend); $i++) {
echo "</tr><tr><td>";
echo '<table width="100%" border="0" cellpadding="2" cellspacing="0"><tr>';
echo '<td width="10">' . ($i + 1) . '.</td>';
echo '<td width="11">';
echo '<table width="11" height="11" border="0" cellspacing="0" cellpadding="0"><tr><td style="background-color:' . $colors[$i] . ';">' . drawSpacer(11, 11) . '</td></tr></table>';
echo '</td>';
echo '<td>' . $this->legend[$i] . '</td>';
echo '</tr></table></td>';
}
echo "</tr></table></td>";
return $this->cells;
}
示例4: 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;
}
示例5: testBorderSize
/**
* Test border size
*/
public function testBorderSize()
{
$object = new Cell();
$value = 120;
$expected = array($value, $value, $value, $value);
$object->setStyleValue('borderSize', $value);
$this->assertEquals($expected, $object->getBorderSize());
}
示例6: testCellWithFourNighbours
public function testCellWithFourNighbours()
{
$cell = new Cell();
$cell->livingStatus(true);
$cell->addNighbours(4);
$newCell = $cell->nextGen();
$this->assertFalse($cell->isAlive(), 'This test is okay');
}
示例7: view_row
function view_row()
{
echo "<tr>";
for ($i = 0; $i <= $this->end_array; $i++) {
$cell_table = new Cell($this->row_array[text][$i], $this->row_array[col][$i], $this->row_array[row][$i], $this->row_array[font][$i]);
$cell_table->view_cell();
}
echo "</tr>";
}
示例8: bindValue
/**
* Bind value to a cell
*
* @param Cell $cell Cell to bind value to
* @param mixed $value Value to bind in cell
* @return boolean
*/
public function bindValue(Cell $cell, $value = null)
{
// sanitize UTF-8 strings
if (is_string($value)) {
$value = Shared_String::SanitizeUTF8($value);
}
// Set value explicit
$cell->setValueExplicit($value, Cell_DataType::dataTypeForValue($value));
// Done!
return true;
}
示例9: draw
/**
* Draw HTML output
*/
function draw()
{
global $c, $sid;
echo '<td colspan="' . $this->cells . '"><table width="600" border="0" cellpadding="0" cellspacing="0"><tr>';
$widget = new Cell("clc", "", 2, $this->width, 20);
$widget->draw();
echo "</tr><tr>\n";
$widget = new Label("lbl", '<br><h3>' . $this->headline . '</h3>', '', 2);
$widget->draw();
echo "</tr>\n";
echo $this->container;
echo "</tr></table></td>";
return $this->cells;
}
示例10: draw
/**
* Draw HTML output
*/
function draw()
{
global $c, $sid;
echo '<td colspan="' . $this->cells . '" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr>';
$widget = new Cell("clc", "", 4, $this->width, 20);
$widget->draw();
echo "</tr><tr>\n";
$widget = new Label("lbl", $this->headline, "stats_headline", 4);
$widget->draw();
echo "</tr>\n";
echo $this->container;
echo "</tr></table></td>";
return $this->cells;
}
示例11: getNeighboursByCell
/**
* Calculates the neighbours of a given cell.
* @param Cell $cell The cell the neighbours should be calculated for.
* @return int Amount of neighbours.
*/
public function getNeighboursByCell(Cell $cell)
{
$y = $cell->getCoordY();
$x = $cell->getCoordX();
$neighbours = 0;
for ($nY = $y - 1; $nY <= $y + 1; $nY++) {
for ($nX = $x - 1; $nX <= $x + 1; $nX++) {
if ($this->getCellByCoords($nX, $nY) && !($nX == $x && $nY == $y)) {
if ($this->getCellByCoords($nX, $nY)->isAlive()) {
$neighbours++;
}
}
}
}
return $neighbours;
}
示例12: createFromString
public static function createFromString($string)
{
$lines = explode('\\n', $string);
$rows = count($lines);
$cols = strlen($lines[0]);
$player = new Player($cols, $rows);
foreach ($lines as $y => $line) {
foreach (str_split($line) as $x => $char) {
if ($char == '*') {
$cell = new Cell();
$cell->setMature();
$player->university->setObjTo($x, $y, $cell);
}
}
}
return $player;
}
示例13: __do_response_reply_count
function __do_response_reply_count($response)
{
global $config, $speak, $segment;
$e = File::E($response->path);
$replies = count(glob(COMMENT . DS . '*_*_' . Date::slug($response->id) . '.{txt,hold}', GLOB_NOSORT | GLOB_BRACE));
$t = Jot::icon('reply-all') . ' ' . $replies;
$tt = array('title' => $replies . ' ' . ($replies === 1 ? $speak->{$segment[0] . '_reply'} : $speak->{$segment[0] . '_replies'}));
echo ($e === 'hold' || $replies === 0 ? Cell::span($t, $tt) : Cell::a($config->manager->slug . '/' . $segment[0] . '?filter=parent%3A' . $response->id, $t, null, $tt)) . ' · ';
}
示例14: expand
/**
* Include specified cell
* @param Cell $cell
* @return Range
*/
public function expand(Cell $cell)
{
if ($cell->getRow() > $this->rowTo) {
$this->setRowTo($cell->getRow());
}
if ($cell->getCol() > $this->colTo) {
$this->setColTo($cell->getCol());
}
return $this;
}
示例15: setNextStatesForDeathCellsInNeigbohrOfLiveCells
private function setNextStatesForDeathCellsInNeigbohrOfLiveCells()
{
$cells = $this->desk->getCells();
foreach ($cells as $cell) {
$x = $cell->getX();
$y = $cell->getY();
foreach ($this->desk->getNeigbohrsCoordinates($x, $y) as $coords) {
if (!$this->desk->cellExists($coords[0], $coords[1])) {
$countOfAliveNeighbors = $this->desk->getCountOfLiveCellsInNeigbohr($coords[0], $coords[1]);
$nextStateOfNonExistingCell = $this->rules->getNextState($countOfAliveNeighbors, false);
if ($nextStateOfNonExistingCell === true) {
$newLiveCell = new \Cell($coords[0], $coords[1], false);
$newLiveCell->setNextState($nextStateOfNonExistingCell);
$this->desk->addCell($newLiveCell);
}
}
}
}
}