function update_supporter_groups($supporter_groups_KEY, $data) { global $db, $DIA; $d = $data; $d['$supporter_groups_KEY'] = $supporter_KEY; $d['key'] = $supporter_groups_KEY; $DIA->save('supporter_groups', $d); sync_object_monsterpants_recent('supporter_groups'); }
function save() { global $DIA; if ($this->data[$this::$id_field]) { $this->data['key'] = $this->data[$this::$id_field]; } $this->data['key'] = $DIA->save($this::$table_name, $this->data); $this->data[$this::$id_field] = $this->data['key']; if ($this::$sync_method == 'supporter') { sync_person_monsterpants($this->data[$this::$id_field]); } else { sync_object_monsterpants_recent($this::$table_name); } }
function save_action_page($_REQUEST) { global $DIA; $a = $_REQUEST; echo '<pre>'; #print_r($a); $action = $a['action']; #requested fields $action['Request'] = implode(",", $action['Request']); $action['Required'] = implode(",", $action['Required']); $action['add_to_groups_KEYS'] = '0,' . implode(",", $action['add_to_groups_KEYS']); $action['optionally_add_to_groups_KEYS'] = '0,' . implode(",", $action['optionally_add_to_groups_KEYS']); if ($action['personal_petition_emal_trigger_KEYS']) { $action['personal_petition_emal_trigger_KEYS'] = '0,' . implode(",", $action['personal_petition_emal_trigger_KEYS']); } $action['key'] = $action['action_KEY']; #print_r($action); $DIA->save('action', $action); sync_object_monsterpants_recent('action'); if ($a['tell_a_friend']['key']) { $tell_a_friend = $a['tell_a_friend']; #print_r($tell_a_friend); $DIA->save('tell_a_friend', $tell_a_friend); sync_object_monsterpants_recent('tell_a_friend'); } if ($a['email_trigger']) { foreach ($a['email_trigger'] as $i) { $email_trigger = $i; #print_r($email_trigger); $DIA->save('email_trigger', $email_trigger); } sync_object_monsterpants_recent('email_trigger'); } if ($action['action_content_detail_KEY']) { $action_content_detail['key'] = $action['action_content_detail_KEY']; $action_content_detail['Recommended_Subject'] = $action['Recommended_Subject']; $action_content_detail['Recommended_Content'] = $action['Recommended_Content']; #$print_r($action_content_detail); $DIA->save('action_content_detail', $action_content_detail); sync_object_monsterpants('action_content_detail'); } #$action_target = $a['action_target']; #$DIA->save('action_target',$action_target); #sync_object_monsterpants_recent('action_target'); #$recipiant = $a['recipiant']; #$DIA->save('recipiant',$recipiant); #sync_object_monsterpants_recent('recipiant'); #echo '</pre>'; header("Location: ../action.php?action_KEY=" . $action['action_KEY']); }
function update_object_salsa($table, $key, $value, $items, $field) { global $db, $DIA; $x = 0; foreach ($items as $i) { $d[$field] = $value; $d['key'] = $i; #$where= $key.' = '.$i; #print_r($d); #$db->AutoExecute($table,$d,'UPDATE',$where); $d['Last_Modified'] = date('Y-m-d H:i:s'); $out = $DIA->save($table, $d); $x++; } sync_object_monsterpants_recent($table); echo '<br>' . $x . ' items updated'; }
<?php require_once '../_header.php'; if ($_REQUEST['date']) { $date = '/' . $_REQUEST['date']; } if ($_REQUEST['action'] == 'sync_supporter') { echo sync_person_monsterpants($_REQUEST['supporter_KEY']); echo 'Person Synced'; } if ($_REQUEST['action'] == 'sync_object') { sync_object_monsterpants($_REQUEST['object'], $date); } if ($_REQUEST['action'] == 'sync_object_recent') { sync_object_monsterpants_recent($_REQUEST['object']); } if ($_REQUEST['action'] == 'sync_all') { sync_all_monsterpants($_REQUEST['object'], $date); } echo $contents; ?> <h1>Sync the local databases</h1> <h3>Sync A Supporter</h3> <p>Put the supporter's supporter key to sync the supporter and all related objects to that supporter</p> <form action="<?php echo $_SERVER["PHP_SELF"]; ?> " method="post"> <input type="hidden" name="action" value="sync_supporter"> Supporter KEY: <input name="supporter_KEY" value="">