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


PHP LANG::l_方法代码示例

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


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

示例1: output

    /**
     * This function produces the html output for the homepage
     */
    function output()
    {
        //calculate operatorstring
        if ($this->operator_distance > 0) {
            $operator_string = "";
            arsort($this->operator);
            foreach ($this->operator as $a => $b) {
                $operator_string .= $a . " (" . round($b / $this->relation_distance * 100, 1) . " %), ";
            }
            if ($this->operator_distance < $this->relation_distance) {
                $operator_string .= LANG::l_('N/A') . " (" . round(($this->relation_distance - $this->operator_distance) / $this->relation_distance * 100, 1) . " %)";
            } else {
                //delete comma
                $operator_string = substr($operator_string, 0, strlen($operator_string) - 2);
            }
        } else {
            $operator_string = LANG::l_('N/A') . " (100 %)";
        }
        // calculate trafficmodes string
        $trafficmode_string = LANG::l_('Unknown');
        //default
        if ($this->trafficmode_distance > 0) {
            arsort($this->trafficmode);
            $trafficmode_string = "";
            $trafficmode_name = array("mixed" => LANG::l_('mixed traffic'), "passenger" => LANG::l_('passenger traffic'), "freight" => LANG::l_('freight traffic'));
            foreach ($this->trafficmode as $a => $b) {
                if (isset($trafficmode_name[$a])) {
                    $trafficmode_string .= $trafficmode_name[$a] . " (" . round($b / $this->relation_distance * 100, 1) . " %), ";
                } else {
                    $this->trafficmode_distance -= $b;
                    //remove from trafficmode_distance
                }
            }
            if ($this->trafficmode_distance < $this->relation_distance) {
                $trafficmode_string .= LANG::l_('N/A') . " (" . round(($this->relation_distance - $this->trafficmode_distance) / $this->relation_distance * 100, 1) . " %)";
            } else {
                //delete comma
                $trafficmode_string = substr($trafficmode_string, 0, strlen($trafficmode_string) - 2);
            }
        } else {
            $trafficmode_string = LANG::l_('N/A') . " (100 %)";
        }
        // calculate electrified distances
        if ($this->electrified_distance > 0) {
            arsort($this->electrified);
            $electrified_string = "";
            foreach ($this->electrified as $a => $b) {
                if ($a == "no") {
                    $electrified_string .= LANG::l_('not electrified') . " (" . round($b / $this->relation_distance * 100, 1) . " %), ";
                } else {
                    $volfre = explode(";", $a);
                    if ($volfre[0] == LANG::l_('N/A')) {
                        $voltage = LANG::l_('N/A');
                    } else {
                        $voltage = $volfre[0];
                    }
                    if ($volfre[1] == LANG::l_('N/A')) {
                        $frequency = LANG::l_('N/A');
                    } elseif ($volfre[1] == "0") {
                        $frequency = LANG::l_('DC');
                    } else {
                        $frequency = $volfre[1] . " Hz " . LANG::l_('AC');
                    }
                    if ($voltage == LANG::l_('N/A') && $frequency == LANG::l_('N/A')) {
                        $electrified_string .= LANG::l_('electrified with unknown voltage') . " (" . round($b / $this->relation_distance * 100, 1) . " %), ";
                    } else {
                        $electrified_string .= $voltage . " V / " . $frequency . " (" . round($b / $this->relation_distance * 100, 1) . " %), ";
                    }
                }
            }
            if ($this->electrified_distance < $this->relation_distance) {
                $electrified_string .= LANG::l_('N/A') . " (" . round(($this->relation_distance - $this->electrified_distance) / $this->relation_distance * 100, 1) . " %)";
            } else {
                //delete comma
                $electrified_string = substr($electrified_string, 0, strlen($electrified_string) - 2);
            }
        } else {
            $electrified_string = LANG::l_('N/A') . " (100 %)";
        }
        // calculate structures
        if ($this->building_distance > 0) {
            $building_string = "";
            if ($this->tunnel_distance > 0) {
                $building_string .= round($this->tunnel_distance, 1) . " km " . LANG::l_('in tunnels') . " (" . round($this->tunnel_distance / $this->relation_distance * 100, 1) . " %), ";
            }
            if ($this->bridge_distance > 0) {
                $building_string .= round($this->bridge_distance, 1) . " km " . LANG::l_('on bridges') . " (" . round($this->bridge_distance / $this->relation_distance * 100, 1) . " %), ";
            }
            if ($this->embankment_distance > 0) {
                $building_string .= round($this->embankment_distance, 1) . " km " . LANG::l_('on embankments') . " (" . round($this->embankment_distance / $this->relation_distance * 100, 1) . " %), ";
            }
            if ($this->cutting_distance > 0) {
                $building_string .= round($this->cutting_distance, 1) . " km " . LANG::l_('in cuttings') . " (" . round($this->cutting_distance / $this->relation_distance * 100, 1) . " %), ";
            }
            //check whether there is a ground level part
            if ($this->relation_distance != $this->building_distance) {
                $building_string .= round($this->relation_distance - $this->building_distance, 1) . " km " . LANG::l_('on ground level') . " (" . round(($this->relation_distance - $this->building_distance) / $this->relation_distance * 100, 1) . " %)";
//.........这里部分代码省略.........
开发者ID:bigbug21,项目名称:OSMTrainRouteAnalysis,代码行数:101,代码来源:getData.php


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