本文整理汇总了PHP中Summit::listFromRegion方法的典型用法代码示例。如果您正苦于以下问题:PHP Summit::listFromRegion方法的具体用法?PHP Summit::listFromRegion怎么用?PHP Summit::listFromRegion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Summit
的用法示例。
在下文中一共展示了Summit::listFromRegion方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: define
/**
* This script retrieves summits, huts and climbing sites in France and generates CSV files used to export to other sites.
*/
define('SF_ROOT_DIR', realpath(dirname(__FILE__) . '/..'));
define('SF_APP', 'frontend');
define('SF_ENVIRONMENT', 'prod');
define('SF_DEBUG', false);
define('GP_DIR', SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'tmp/');
require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . SF_APP . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php';
// needed for doctrine connection to work
$context = sfContext::getInstance();
$region_id = 1234;
$buffer = 10;
// summits
$summits = Summit::listFromRegion($region_id, $buffer, 'summits', 'AND summit_type != 5');
$csv = '';
foreach ($summits as $summit) {
$csv .= sprintf('"%s";"%s";"%s";"http://www.camptocamp.org/summits/popup/%d/fr";"%d"' . "\n", $summit['name'], $summit['lon'], $summit['lat'], $summit['id'], $summit['elevation']);
}
file_put_contents(GP_DIR . 'sommets_c2c.csv', $csv);
$nb_summits = count($summits);
echo "Summits exported: {$nb_summits}\n";
// huts
$huts = Hut::listFromRegion($region_id, $buffer);
$csv = '';
foreach ($huts as $hut) {
$csv .= sprintf('"%s";"%s";"%s";"http://www.camptocamp.org/huts/popup/%d/fr";"%d"' . "\n", $hut['name'], $hut['lon'], $hut['lat'], $hut['id'], $hut['elevation']);
}
file_put_contents(GP_DIR . 'refuges_c2c.csv', $csv);
$nb_huts = count($huts);