Deikerreko koordenatuak erantsi
<?php
if(!user_access('toponimo admin')){
drupal_access_denied();
exit;
}
if(isset($_GET['ekin'])){
db_set_active('old');
$result = db_query('SELECT TOP_COORDENADAS_1 x, TOP_COORDENADAS_2 y, `Erreferentzia kartografikoa` ref_kart FROM netkamco_toponimia.`bergara-deiker,normalizados` WHERE TOP_COORDENADAS_1 > 0 AND TOP_COORDENADAS_2 > 0');
db_set_active();
while($row = db_fetch_object($result)){
db_query('UPDATE toponimo SET utmx = %f, utmy = %f WHERE ref_karto = "%s"', $row->x, $row->y, $row->ref_kart);
}
} else {
print '<p>DEIKEReko taulako koordenatuak erantsi, erreferentzia kartografikoaren arabera (erne, toponimoen kokapenari eragingo dion aldaketa da!): '.l('ekin', $_GET['q'], array(), 'ekin=1').'</p>';
}
?>
Gaurko bera eta EK desberdina duten sarrerak bilatu
<?php
$output = '<p></p>';
// $result = db_query('SELECT n.title, t1.nid, t1.ref_karto FROM toponimo t1 LEFT JOIN node n ON t1.nid = n.nid LEFT JOIN toponimo t2 ON t1.gako = t2.gako WHERE t1.ref_karto != t2.ref_karto AND t1.gako != "?" GROUP BY t1.nid ORDER BY t1.gako');
// arinagoa
$result = db_query('SELECT n.title, t1.nid, t1.ref_karto FROM toponimo t1, toponimo t2 LEFT JOIN node n ON t1.nid = n.nid WHERE t1.gako = t2.gako AND t1.ref_karto != t2.ref_karto AND t1.gako != "?" GROUP BY t1.nid ORDER BY t1.gako');
if($result){
while($row = db_fetch_object($result)){
$row->nid = l(('edit'), 'node/'.$row->nid.'/edit', array('target' => '_blank'));
$rows[$row->title][] = array($row->nid, $row->ref_karto);
}
foreach($rows as $k => $v){
$headers = array('', $k);
$output .= theme('table', $headers, $rows[$k]);
}
} else {
$output .= '<p>Ez dago baldintza horiek betetzen dituen sarrerarik.</p>';
}
return $output;
?>
Bilatu sintaxi egitura betetzen ez duten erreferentzia kartografikoak
<?php
$output = '<p>Ezarritako patroia (regexp) hau da:<br /><span style="display:block; margin: 10px; text-align:center; border: 1px solid silver; padding:2px; word-spacing: nowrap">^([+/;]?[0-9]{2}-[0-9]{2}-(A|B|D|E),[0-9]{3}\\\\*?)*$</span></p>';
$result = mysql_query($gld = "SELECT n.title, t.ref_karto, t.nid FROM toponimo t LEFT JOIN node n ON t.nid = n.nid WHERE ref_karto NOT REGEXP '^([+/;]?[0-9]{2}-[0-9]{2}-(A|B|D|E),[0-9]{3}\\\\*?)*$'");
if($result){
$headers = array('ID', 'Toponimo', 'Erref.Kart.');
while($row = db_fetch_array($result)){
$row['nid'] = l(t('edit'), "node/{$row['nid']}/edit", array('target' => '_blank'));
$rows[] = $row;
}
} else {
$output .= '<p>Ez dago baldintza horiek betetzen dituen sarrerarik.</p>';
}
return $output . theme('table', $headers, $rows);
?>
Bilatu erreferentzia kartografiko bera eta izen desberdina duten sarrerak
<?php
$result = db_query('SELECT ref_karto, count(*) zenbat FROM {toponimo} GROUP BY ref_karto HAVING zenbat > 1');
while($row = db_fetch_object($result)){
$refs[] = $row->ref_karto;
}
$result = db_query('SELECT toponimo.*, node.* FROM {toponimo} LEFT JOIN node ON toponimo.nid = node.nid WHERE ref_karto IN ("'. join($refs, '","') .'")');
if($result){
$output = '<table>';
$output .= '<tr><th>Toponimoa</th><th>Erref. Kartografikoa</th><th></th></tr>';
while($row = db_fetch_object($result)){
$output .= '<tr><td>'. $row->title .'</td><td>'. $row->ref_karto .'</td><td>'. l('editatu', 'node/'.$row->nid) .'</td></tr>';
}
}
$output .= '</table>';
return $output;
?>