[Phphtmllib-devel] SF.net SVN: phphtmllib:[3179] trunk/open2300/lib/modules
Status: Beta
Brought to you by:
hemna
From: <he...@us...> - 2008-11-07 06:39:57
|
Revision: 3179 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3179&view=rev Author: hemna Date: 2008-11-07 06:39:50 +0000 (Fri, 07 Nov 2008) Log Message: ----------- added Added Paths: ----------- trunk/open2300/lib/modules/api/ trunk/open2300/lib/modules/api/RemoteUpdate.inc Added: trunk/open2300/lib/modules/api/RemoteUpdate.inc =================================================================== --- trunk/open2300/lib/modules/api/RemoteUpdate.inc (rev 0) +++ trunk/open2300/lib/modules/api/RemoteUpdate.inc 2008-11-07 06:39:50 UTC (rev 3179) @@ -0,0 +1,43 @@ +<?php +/** + * This is a target that + * is called to add a new entry to the + * database from a remote wx box. + */ + +class RemoteUpdate extends Container { + + function __construct() { + + } + + function render($indent_level=0, $output_debug=0) { + $GLOBALS['log']->debug('RemoteUpdate called'); + $r = Request::singleton(); + + //first lets make sure we don't already have this entry + //in the db + $datetime = $r->get('datetime'); + if (!is_null($datetime)) { + $wx = weatherDataObject::find("datetime = :time", array(":time"=> $datetime)); + $GLOBALS['log']->debug('RemoteUpdate -- Dupe.'); + return "Duplicate"; + } + + $wx = new weatherDataObject(); + $meta = $wx->get_meta_data(); + + foreach($meta as $key => $val) { + //look for the request var + $method = "set_".$key; + $r_val = $r->get($key); + call_user_method($method, $wx, $r_val); + } + + //now save it to the db + $wx->save(); + $GLOBALS['log']->debug('RemoteUpdate -- saved new entry.'); + + } +} +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |