function processEvent(&$event)
 {
     $db =& $this->_getDB();
     list($gridimage_id, $old_grid_reference, $new_grid_reference) = explode(',', $event['event_param']);
     //invalidate any cached maps
     require_once 'geograph/mapmosaic.class.php';
     $mosaic = new GeographMapMosaic();
     $user_id = $db->getOne("select user_id from gridimage where gridimage_id = {$gridimage_id}");
     list($x, $y, $user_id) = $db->getRow("select x,y from gridsquare where grid_reference = '{$old_grid_reference}'");
     $mosaic->expirePosition($x, $y, $user_id);
     list($x, $y, $user_id) = $db->getRow("select x,y from gridsquare where grid_reference = '{$new_grid_reference}'");
     $mosaic->expirePosition($x, $y, $user_id);
     //update placename cached column
     //we can disable this for now as placename_id is unused
     //to reable, will need to load up a gridsquare _with_ nateastings (a square created by gridimage)
     #todo $this->updatePlaceNameId($newsq);
     //return true to signal completed processing
     //return false to have another attempt later
     return true;
 }
Exemplo n.º 2
0
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
require_once 'geograph/global.inc.php';
require_once 'geograph/gridimage.class.php';
require_once 'geograph/gridsquare.class.php';
require_once 'geograph/map.class.php';
require_once 'geograph/mapmosaic.class.php';
require_once 'geograph/image.inc.php';
init_session();
$smarty = new GeographPage();
$db = NewADOConnection($GLOBALS['DSN']);
if (isset($_POST['inv'])) {
    $square = new GridSquare();
    $grid_ok = $square->setGridRef($_POST['gridref']);
    if ($grid_ok) {
        $x = $square->x;
        $y = $square->y;
        require_once 'geograph/mapmosaic.class.php';
        $mosaic = new GeographMapMosaic();
        $mosaic->expirePosition($x, $y);
        $smarty->assign('gridref', $_POST['gridref']);
    } else {
        $smarty->assign('errormsg', $square->errormsg);
    }
}
$smarty->assign('invalid_maps', $db->GetOne("select count(*) from mapcache where age > 0 and type_or_user >= 0"));
$smarty->display('recreatemaps.tpl');
Exemplo n.º 3
0
                $gridsquare = $matches[1];
                $eastings = $matches[2];
                $northings = $matches[3];
                $sql = "select * from gridprefix where prefix='{$gridsquare}'";
                $prefix = $db->GetRow($sql);
                if (count($prefix)) {
                    $x = $prefix['origin_x'] + $eastings;
                    $y = $prefix['origin_y'] + $northings;
                    $sql = "insert into gridsquare(x,y,percent_land,grid_reference,reference_index,point_xy) \n\t\t\t\t\t\tvalues({$x},{$y},-1,'{$gridref}',{$prefix['reference_index']},GeomFromText('POINT({$x} {$y})') )";
                    $db->Execute($sql);
                    $gridsquare_id = $db->Insert_ID();
                    $smarty->assign('status', "New gridsquare {$gridref} created with new land percentage of {$percent} %");
                    $db->Execute("REPLACE INTO mapfix_log SET user_id = {$USER->user_id}, gridsquare_id = {$gridsquare_id}, new_percent_land='{$percent}', old_percent_land='{$sq['percent_land']}',created=now(),comment=" . $db->Quote($_GET['comment']));
                    require_once 'geograph/mapmosaic.class.php';
                    $mosaic = new GeographMapMosaic();
                    $mosaic->expirePosition($x, $y, 0, true);
                }
            }
            $smarty->assign('percent_land', $percent);
        }
    } else {
        $smarty->assign_by_ref('gridref', strip_tags($_GET['gridref']));
        $smarty->assign('gridref_error', "Bad grid reference");
    }
    $smarty->assign('gridref_ok', $ok ? 1 : 0);
}
if ($_GET['save'] == 'quick') {
    //return nice simple result
    $status = $smarty->get_template_vars('status');
    echo "Status: {$status}";
} else {
Exemplo n.º 4
0
            $smarty->display('admin_recreatemaps.tpl');
            exit;
        }
        $x = $square->x;
        $y = $square->y;
        print "<h3>{$gridref}</h3>";
        if (count($squares) < 5) {
            $sql = "select * from mapcache \n\t\t\t\t\twhere {$x} between map_x and (map_x+image_w/pixels_per_km-1) and \n\t\t\t\t\t{$y} between map_y and (map_y+image_h/pixels_per_km-1) {$and_crit}";
            $recordSet =& $db->Execute("{$sql}");
            while (!$recordSet->EOF) {
                print implode(', ', array_values($recordSet->fields)) . "<br/>";
                $recordSet->MoveNext();
            }
            $recordSet->Close();
        }
        $mosaic->expirePosition($x, $y, $user_id, $basemap);
    }
    $smarty->display('_std_end.tpl');
    exit;
    //do some processing?
} else {
    if (isset($_POST['go'])) {
        if (isset($_POST['limit']) && preg_match("/^\\d+(,\\d+|)?\$/", $_POST['limit'])) {
            $limit = $_POST['limit'];
        } else {
            $limit = 10;
        }
        //this takes a long time, so we output a header first of all
        $smarty->display('_std_begin.tpl');
        echo "<h3><a href=\"recreatemaps.php\">&lt;&lt;</a> Re-Creating Maps...</h3>";
        flush();