本文整理汇总了PHP中Facilities::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Facilities::get方法的具体用法?PHP Facilities::get怎么用?PHP Facilities::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Facilities
的用法示例。
在下文中一共展示了Facilities::get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: promo2Action
public function promo2Action()
{
header("Content-type: image/png");
$im = imagecreatefromjpeg('images/continental.jpg');
imagealphablending($im, true);
imagesavealpha($im, true);
$textcolor = imagecolorallocatealpha($im, 0, 0, 0, 0);
$shadowcolor = imagecolorallocatealpha($im, 255, 255, 255, 64);
$icon = imagecreatefrompng('images/small_green_ball.png');
$icon_width = 10;
$icon_height = 10;
$model = new Facilities();
$smodel = new Site();
$sites = $smodel->getgroupby("facility_id");
$markers = array();
foreach ($model->get() as $facility) {
$site = $sites[$facility->id][0];
//pick the first site
//create acronym
$name = $facility->name;
$name2 = str_replace("_", " ", $name);
$tokens = explode(" ", $name2);
$acro = "";
foreach ($tokens as $token) {
if ($token == "The") {
continue;
}
if ($token == "of") {
continue;
}
if ($token == "at") {
continue;
}
$acro .= $token[0];
}
$lat = $site->latitude;
$long = $site->longitude;
//merge to a site nearby
$merged = false;
if (isset($_REQUEST["acro"])) {
foreach ($markers as &$m) {
if (abs($m["longitude"] - $long) < 2.5 and abs($m["latitude"] - $lat) < 0.5) {
$m["name"] .= "/" . $name;
$m["acronym"] .= "/" . $acro;
$m["longitude"] = ($m["longitude"] + $long) / 2;
$m["latitude"] = ($m["latitude"] + $lat) / 2;
$merged = true;
break;
}
}
} else {
$acro = "";
}
//draw mark
if (!$merged) {
$marker = array("name" => $name, "acronym" => $acro, "longitude" => $long, "latitude" => $lat, "sites" => $sites[$facility->id]);
$markers[] = $marker;
}
}
//draw all markers
$font = "images/verdanab.ttf";
$font_size = 9;
foreach ($markers as $marker) {
list($x, $y) = $this->ll2xy($marker["longitude"], $marker["latitude"]);
imagecopy($im, $icon, $x, $y, 0, 0, $icon_width, $icon_height);
imagettftext($im, $font_size, 0, $x + $icon_width + 1, $y + $icon_height + 1, $shadowcolor, $font, $marker["acronym"]);
imagettftext($im, $font_size, 0, $x + $icon_width, $y + $icon_height, $textcolor, $font, $marker["acronym"]);
}
imagepng($im);
imagedestroy($im);
$this->render("none", null, true);
}