本文整理汇总了PHP中functions::isInRegion方法的典型用法代码示例。如果您正苦于以下问题:PHP functions::isInRegion方法的具体用法?PHP functions::isInRegion怎么用?PHP functions::isInRegion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类functions
的用法示例。
在下文中一共展示了functions::isInRegion方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: outputNationLists
//.........这里部分代码省略.........
}
// end foreach continent
$stdout .= " <tr>\r\n" . " <td class='total'><em>Total</em></td>\r\n";
foreach ($aux["extColumns"] as $col => $dummy) {
if ($col != "any") {
$stdout .= !isset($event["continent"]["tot"][$col]) ? " <td class='total'><strong>0</strong> (0%)</td>\r\n" : " <td class='total'><strong>" . $event["continent"]["tot"][$col] . "</strong> (" . number_format(100 * ($event["continent"]["tot"][$col] + 0) / $event["summary"]["total"], $no_of_decimals) . "%)</td>\r\n";
} else {
$stdout .= " <td class='total'> </td>\r\n";
}
}
$stdout .= " </tr>\r\n" . " <tr>\r\n" . " <td class='none'><em>No country information submitted</em></td>\r\n";
foreach ($aux["extColumns"] as $col => $dummy) {
if ($col != "any") {
$stdout .= !isset($noinfo[$col]) ? " <td class='none'><strong>0</strong> (0%)</td>\r\n" : " <td class='none'><strong>" . $noinfo[$col] . "</strong> (" . number_format(100 * ($noinfo[$col] + 0) / $event["summary"]["total"], $no_of_decimals) . "%)</td>\r\n";
} else {
$stdout .= " <td class='none'> </td>\r\n";
}
}
$stdout .= " </tr>\r\n" . " </table>\r\n" . "\r\n";
}
// end if
// ------------------------
// By Continent - Piechart
// ------------------------
if (!empty($charts) && !$showOnlyNordic) {
if (true && $idx == 0 && $stattype == "applicants") {
$stdout .= " <div>\r\n";
foreach ($charts[$idx] as $col => $chartData) {
$stdout .= self::outputPiechart($idx . $col, $chartData, $aux["extColumns"][$col] . " - By Region and Continent", "370", "250", self::$palette["nbr"]);
}
$stdout .= " </div>\r\n";
}
if (true && $idx == 0 && $stattype == "events") {
$stdout .= " <div>\r\n";
foreach ($charts[$idx] as $col => $chartData) {
$stdout .= self::outputPiechart($idx . $col, $chartData, $aux["extColumns"][$col] . " - By Country", "350", "250", self::$palette["nbr"]);
}
$stdout .= " </div>\r\n";
}
}
// end if
// ------------------------
// By Country
// ------------------------
$noinfo = isset($event["country"][""]) ? $event["country"][""] : array();
if (!$showOnlyNordic) {
if ($stattype != "applicants" || $idx) {
$stdout .= " <h4>By Country:</h4>\r\n";
} else {
$stdout .= " <h4>All applicants, by Country:</h4>\r\n";
}
} elseif (!$idx) {
$stdout .= " <h4>Nordic applicants, by Country:</h4>\r\n";
}
$stdout .= $table_start;
foreach ($event["country"] as $cc => $dummy) {
if (!empty($cc) && $cc != "tot" && (!$showOnlyNordic || functions::isInRegion("nordic", array($cc), FALSE))) {
$stdout .= " <tr>\r\n" . " <th" . (!$showOnlyNordic && functions::isInRegion("nordic", array($cc), $countPolandAsBaltic) ? " class='nordic'" : (!$showOnlyNordic && functions::isInRegion("baltic", array($cc), $countPolandAsBaltic) ? " class='baltic'" : "")) . ">" . functions::fromCountryCodeTo("country", $cc, in_array("NO", $aux["conts"]) ? true : false, in_array("BA", $aux["conts"]) ? true : false) . "</th>\r\n";
foreach ($aux["extColumns"] as $col => $dummy) {
if ($cc != "" || $col != "any") {
$stdout .= !isset($event["country"][$cc][$col]) ? " <td><strong>0</strong> (0%)</td>\r\n" : " <td" . ($col == "any" ? " class='any'" : "") . "><strong>" . ($event["country"][$cc][$col] + 0) . "</strong> (" . number_format(100 * ($event["country"][$cc][$col] + 0) / $event["summary"]["total"], $no_of_decimals) . "%)</td>\r\n";
}
}
$stdout .= " </tr>\r\n";
if ($stattype == "events" && $cc == "SE") {
$stdout .= " <tr>\r\n" . " <td style='text-indent:1em;white-space:nowrap;font-style:italic'>Stockholm</td>\r\n" . " <td style='text-indent:1em;white-space:nowrap;font-style:italic'>" . $event["country"]["local"][$col] . " (" . number_format(100 * ($event["country"]["local"][$col] + 0) / $event["summary"]["total"], $no_of_decimals) . "%)</td>\r\n" . " </tr>\r\n" . " <tr>\r\n" . " <td style='text-indent:1em;white-space:nowrap;font-style:italic'>non-locals</td>\r\n" . " <td style='text-indent:1em;white-space:nowrap;font-style:italic'>" . ($event["country"]["SE"][$col] - $event["country"]["local"][$col]) . " (" . number_format(100 * ($event["country"]["SE"][$col] - $event["country"]["local"][$col]) / $event["summary"]["total"], $no_of_decimals) . "%)</td>\r\n" . " </tr>\r\n";
}
}
}
// end foreach country
$stdout .= " <tr>\r\n" . " <td><em>Total Nordic countries</em></td>\r\n";
foreach ($aux["extColumns"] as $col => $dummy) {
if ($col != "any") {
if (!isset($event["country"]["tot"][$col])) {
$stdout .= " <td class='total'><strong>0</strong> (0%)</td>\r\n";
} elseif (!$showOnlyNordic) {
$stdout .= " <td class='total'><strong>" . $event["country"]["tot"][$col] . "</strong> (" . number_format(100 * ($event["country"]["tot"][$col] + 0) / $event["summary"]["total"], $no_of_decimals) . "%)</td>\r\n";
} else {
$stdout .= " <td class='total'><strong>" . $event["continent"]["NO"][$col] . "</strong> (" . number_format(100 * ($event["continent"]["NO"][$col] + 0) / $event["summary"]["total"], $no_of_decimals) . "%)</td>\r\n";
}
} else {
$stdout .= " <td class='total'> </td>\r\n";
}
}
$stdout .= " </tr>\r\n" . " <tr>\r\n" . " <td class='none'><em>No country information submitted</em></td>\r\n";
foreach ($aux["extColumns"] as $col => $dummy) {
if ($col != "any") {
$stdout .= !isset($noinfo[$col]) ? " <td class='none'><strong>0</strong> (0%)</td>\r\n" : " <td class='none'><strong>" . $noinfo[$col] . "</strong> (" . number_format(100 * ($noinfo[$col] + 0) / $event["summary"]["total"], $no_of_decimals) . "%)</td>\r\n";
} else {
$stdout .= " <td class='none'> </td>\r\n";
}
}
$stdout .= " </tr>\r\n" . " </table>\r\n" . "\r\n";
// ------------------------
$stdout .= " </div>\r\n" . "\r\n";
}
}
// end foreach ($show as $idx => $event)
return $stdout;
}
示例2: getVisitorData
public function getVisitorData($stattype = "events", $distinguishNordic = FALSE, $distinguishBaltic = FALSE, $countPolandAsBaltic = FALSE, $onlyShowNordic = FALSE, $confids = array())
{
$from_timestamp = "UNIX_TIMESTAMP('2007-01-01 00:00:00')";
$to_timestamp = "UNIX_TIMESTAMP()";
//$from_timestamp = "UNIX_TIMESTAMP('2009-01-01 00:00:00')";
//$to_timestamp = "UNIX_TIMESTAMP('2010-12-31 00:00:00')";
if (isset($confids[0])) {
unset($confids[0]);
}
$where = $tmp = array();
if (in_array($stattype, array("visitors"))) {
$where[] = "((" . $from_timestamp . "<V.v_start) AND (V.v_start<" . $to_timestamp . "))";
}
if (!empty($confids)) {
foreach ($confids as $id) {
$tmp[] = "E.e_code='" . $id . "'";
}
$where[] = implode(" OR ", $tmp);
}
$where[] = "V.v_status <> 'STATUS_NO'";
$sql = "\nSELECT\n A.av_firstname,\n A.av_lastname,\n A.av_residentship,\n A.av_city,\n A.av_institute,\n E.e_code,\n E.e_name,\n V.v_start,\n V.v_end,\n" . "\n V.v_type\nFROM\n abs_visits AS V\n LEFT JOIN zzz_avatars AS A ON A.av_id=V.v_avid\n LEFT JOIN abs_events AS E ON E.e_code=SUBSTRING(V.v_code,1,LENGTH(E.e_code)) " . (!empty($where) ? " WHERE (" . implode(") AND (", $where) . ") " : "") . " ORDER BY\n A.av_lastname,A.av_firstname,V.v_start";
// v_type: _COLL, _RENT, _PROG
$res = $this->query($sql, IS_TESTSERVER);
// includes a call to connect
if (!$res || $this->num_rows($res) == 0) {
return array();
}
// ------------------------
// Convert search result to array of data type visitorDataRecord
// $applicant[][lastname,firstname,citizenship,residentship,ms,phd,
// cit_continent,res_continent,ms_continent,phd_continent,
// nordic,baltic,event]
// ------------------------
$applicant = array();
while ($cell = $this->next_record_assoc($res)) {
switch ($stattype) {
case "allguests":
case "events":
$select = !empty($cell["e_code"]) ? true : false;
break;
case "visitors":
$select = $cell["v_type"] == "_COLL" ? true : false;
break;
case "brief":
$select = !empty($cell["e_code"]) && $cell["v_type"] == "_COLL" ? true : false;
break;
default:
return array();
}
// end switch
if ($select) {
if (strlen($cell["av_residentship"]) > 2) {
$cell["av_residentship"] = functions::fromCountryToCodeAdHoc($cell["av_residentship"]);
} else {
if ($cell["av_residentship"] == "SX") {
$cell["av_residentship"] = "RS";
}
}
$applicant[] = array("lastname" => mb_convert_case($cell["av_lastname"], MB_CASE_TITLE, "UTF-8"), "firstname" => mb_convert_case($cell["av_firstname"], MB_CASE_TITLE, "UTF-8"), "institute" => $cell["av_institute"], "cit" => "", "res" => $cell["av_residentship"], "ms" => "", "phd" => "", "cit_continent" => "", "res_continent" => functions::fromCountryCodeTo("continentcode", $cell["av_residentship"], $distinguishNordic, $distinguishBaltic, $countPolandAsBaltic), "ms_continent" => "", "phd_continent" => "", "nordic" => functions::isInRegion("nordic", array($cell["av_residentship"]), $countPolandAsBaltic), "baltic" => functions::isInRegion("baltic", array($cell["av_residentship"]), $countPolandAsBaltic), "local" => strpos($cell["av_city"], "Stockholm") !== false ? 1 : 0, "id" => $cell["e_code"], "visit_start" => $cell["v_start"], "visit_end" => $cell["v_end"]);
}
// end if
}
// end while
return $applicant;
}
示例3: getApplicantData
function getApplicantData($stattype = "applicants", $distinguishNordic = TRUE, $distinguishBaltic = TRUE, $countPolandAsBaltic = FALSE)
{
$applicant = array();
// ------------------------
// Read CSV file to array $this->applicantDataSource[line]
// ------------------------
if (!$this->setApplicantDataSource()) {
return array();
}
//TODO: nicer error handling
// ------------------------
// Convert raw data to array
// $applicant[][lastname,firstname,citizenship,residentship,ms,phd,
// cit_continent,res_continent,ms_continent,phd_continent,
// nordic,baltic,campaign_id]
// ------------------------
$idx = 0;
foreach ($this->applicantDataSource as $line) {
if (preg_match("/^.*--- (.*)/", trim($line), $res)) {
$idx++;
} elseif (!isset($GLOBALS["beenthere"]) || !$GLOBALS["beenthere"] || isset($GLOBALS["reset"]) || isset($GLOBALS["eventindex"][$idx])) {
$arr = preg_split("/\\s?,\\s?/", str_Replace("??", "", $line));
if (count($arr) > 1) {
$applicant[] = array("lastname" => mb_convert_case($arr[4], MB_CASE_TITLE, "UTF-8"), "firstname" => mb_convert_case($arr[5], MB_CASE_TITLE, "UTF-8"), "cit" => $arr[0], "res" => $arr[1], "ms" => $arr[2], "phd" => $arr[3], "cit_continent" => functions::fromCountryCodeTo("continentcode", $arr[0], $distinguishNordic, $distinguishBaltic, $countPolandAsBaltic), "res_continent" => functions::fromCountryCodeTo("continentcode", $arr[1], $distinguishNordic, $distinguishBaltic, $countPolandAsBaltic), "ms_continent" => functions::fromCountryCodeTo("continentcode", $arr[2], $distinguishNordic, $distinguishBaltic, $countPolandAsBaltic), "phd_continent" => functions::fromCountryCodeTo("continentcode", $arr[3], $distinguishNordic, $distinguishBaltic, $countPolandAsBaltic), "nordic" => functions::isInRegion("nordic", array($arr[0], $arr[1], $arr[2], $arr[3]), $countPolandAsBaltic), "baltic" => functions::isInRegion("baltic", array($arr[0], $arr[1], $arr[2], $arr[3]), $countPolandAsBaltic), "id" => $idx, "timestamp" => 0, "timestamp" => 0);
}
}
}
return $applicant;
}