本文整理匯總了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);