/** * Mise à jour des données d'un scenario * @param db $db */ public function update($db) { updateAction($db, $this->actidact, $this->actnuord, $this->actlbact, $this->scnidscn); }
/** * Mise a jour des donnees d'un enregistrement * @param db $db */ public function update($db) { updateAction($db, $this->actidact, $this->actidact, $this->actidpro, $this->actlbtit, $this->actnupri, toSQLDate($this->actdtcre), toSQLDate($this->actdtdem), toSQLDate($this->actdteci), toSQLDate($this->actdtecp), toSQLDate($this->actdtecr), $this->actfgcac); }
function processEdit($tweet) { global $preferences; // the action code must not be 'del' or 'edt' (ie, we can't have // already undone this action. $targetaction = getAction($tweet->in_reply_to_status_id_str); if (!$targetaction) { replyTweet($tweet, "Which tweet do you want to edit? Reply to your own tweet that contains the mistake to edit it."); return; } elseif (substr($targetaction['ActionCode'], 0, 3) == "del") { replyTweet($tweet, "You can't edit a tweet that's been undone!"); return; } elseif (substr($targetaction['ActionCode'], 0, 3) == "edt") { replyTweet($tweet, "You've already edited this tweet! Reply to the new #edit tweet instead."); return; } // if there's no content type, we use the existing one and update the tweet information // so that stuff like the content amount, which relies on the content type, is populated $editaction = $targetaction; $editinformation = $tweet->information; if (!$editinformation->contenttype) { $editinformation->contenttype = $preferences->CONTENTTYPE[substr($targetaction['ActionCode'], 4)]; updateTweetInformation($tweet, $editinformation); } // update things! $actiontaken = false; if ($editinformation->title) { $editaction['TextData'] = $tweet->information->title; $actiontaken = true; } if ($editinformation->amount) { $editaction['AmountData'] = $editinformation->amount; $actiontaken = true; } // an update tweet must actually update something if (!$actiontaken) { replyTweet($tweet, "An edit tweet must update the title or the amount."); return; } // update the existing action code to be edited updateAction($tweet->in_reply_to_status_id_str, 'edt'); // add a new action for the edit (preserving the old timestamp) and increment // the new total insertActionRecord($tweet->id_str, $editaction['ActionCode'], $editaction['EntryId'], $editaction['AmountData'], $editaction['TextData'], $editaction['Time']); $edittype = $preferences->CONTENTTYPE[substr($editaction['ActionCode'], 4)]; incrementEntryRecord($editaction['EntryId'], $preferences->ENTRYCONTENT[$edittype], $editaction['AmountData']); // roll back the previous data $targettype = $preferences->CONTENTTYPE[substr($targetaction['ActionCode'], 4)]; incrementEntryRecord($targetaction['EntryId'], $preferences->ENTRYCONTENT[$targettype], -$targetaction['AmountData']); // tell the user what happened replyTweet($tweet, "made a mistake and updated their tweet."); }
if (!isset($type) || !isset($action)) { $GLOBALS['err'] = true; $output = array(); } else { //do the things if ($action === "GET") { $output = getAction($database, $type); } else { if ($action === "PUT") { $output = putAction($database, $type); } else { if ($action === "DELETE") { $output = deleteAction($database, $type); } else { if ($action === "UPDATE") { $output = updateAction($database, $type); } else { $GLOBALS['err'] = true; $output = array(); } } } } } if ($database->isOpen()) { $database->close(); } //output will always be an array, and will always be defined. encodeResult($output); //END function deleteAction($database, $type)