function saveUserData() { $json = new Services_JSON(); $debug = ''; foreach ($_GET as $key => $value) { $debug .= "{$key}: {$value}<br />"; } //Validate incoming User Data if ($_GET['Email'] == NULL || $_GET['Email'] == '') { $message = array('type' => 'bad', 'text' => 'Please Enter an Email Address'); $json_data = array('message' => $message, 'debug' => $debug); $output = $json->encode($json_data); return $output; } //Save User Data $userupdate = new AMP_User_Profile(AMP_Registry::getDbcon(), $_GET['Id']); $userdata = array('First_Name' => $_GET['First_Name'], 'Last_Name' => $_GET['Last_Name'], 'Company' => $_GET['Company'], 'Phone' => $_GET['Phone'], 'City' => $_GET['City'], 'Country' => $_GET['Country'], 'custom1' => $_GET['custom1'], 'custom4' => $_GET['custom4'], 'Email' => $_GET['Email']); if ($_GET['custom2'] != NULL || $_GET['custom2'] != '') { $userdata['custom2'] = $_GET['custom2']; } $userupdate->mergeData($userdata); $success = $userupdate->save(); //Check to see if save was successful, return $json_data = array(); if ($success == true) { $json_data['message'] = array('type' => 'good', 'text' => 'Changes Successfully Saved'); $json_data['success'] = true; } else { $json_data['message'] = array('type' => 'bad', 'text' => 'Save Failed'); } $json_data['debug'] = $debug; $output = $json->encode($json_data); return $output; }
function saveUserData($imageName) { $json = new Services_JSON(); $filefield = 'custom4upload'; $debug = ''; foreach ($_POST as $key => $value) { $debug .= "{$key}: {$value}<br />"; } //Save User Data $userupdate = new AMP_User_Profile(AMP_Registry::getDbcon(), $_POST['Id']); $userdata = array('custom4' => $imageName); $userupdate->mergeData($userdata); $success = $userupdate->save(); }
function addHours($basecampID,$gtdEst,$gtdStaff,$hours,$desc,$date){ $item = new AMP_User_Profile(AMP_Registry::getDbcon()); $mergeData = array( 'modin' => '62', 'custom4'=> $gtdStaff, 'custom11' => $basecampID, 'custom5'=> $date, 'custom2' => $gtdEst, 'custom3'=> $desc, 'custom6' => $hours ); $item->mergeData($mergeData); $success = $item->save(); }