本文整理汇总了PHP中Event::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Event::update方法的具体用法?PHP Event::update怎么用?PHP Event::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Event
的用法示例。
在下文中一共展示了Event::update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* update
*/
public function update()
{
$res = new Response();
if (!get_class($this->params)) {
$res->data = array();
foreach ($this->params as $data) {
if ($rec = Event::update($data->id, $data)) {
array_push($res->data, $rec->to_hash());
}
}
$res->success = true;
$res->message = "Updated " . count($res->data) . " records";
} else {
if ($rec = Event::update($this->id, $this->params)) {
$res->data = $rec;
//->to_hash();
$res->success = true;
$res->message = "Updated record";
} else {
$res->message = "Failed to update record " . $this->params->id;
$res->success = false;
}
}
return $res->to_json();
}
示例2: update
public static function update($id)
{
$params = $_POST;
$attributes = array('id' => $id, 'description' => $params['description'], 'time' => $params['time'], 'place' => $params['place']);
$Event = new Event($attributes);
$errors = $Event->errors();
if (count($errors) != 0) {
View::make('/Event/edit.html', array('errors' => $errors, 'attributes' => $attributes));
} else {
$Event->update();
Redirect::to('/event/' . $Event->id, array('message' => 'Tapahtumaa on muokattu onnistuneesti!'));
}
}
示例3: editEvent
function editEvent()
{
global $lang;
$page_lang = scandir('inc/lang/' . $_SESSION['lang']);
foreach ($page_lang as $file) {
if ($file != '.' && $file != '..') {
$parts = explode(".", $file);
$page = $parts[0];
if ($page == 'content') {
$page_file = $file;
}
}
}
include_once 'inc/lang/' . $_SESSION['lang'] . '/' . $page_file;
if ($_SESSION['access']->events > 1) {
$results = array();
if (isset($_POST['saveChanges'])) {
$_POST['id'] = $_POST['editId'];
unset($_POST['editId']);
// User has posted the content edit form: save the content changes
if (!($event = Event::getById((int) $_POST['id']))) {
header("Location: index.php?action=listEvent&error=eventNotFound");
return;
}
$event = new Event();
$event->storeFormValues($_POST);
$event->update();
header("Location: index.php?action=listEvent&success=changesSaved");
} elseif (isset($_POST['cancel'])) {
// User has cancelled their edits: return to the events list
header("Location: index.php?action=listEvent");
} else {
if (!($event = Event::getById((int) $_GET['editId']))) {
header("Location: index.php?action=listEvent&error=eventNotFound");
return;
}
// User has not submitted the event edit form: display the form
$results['event'] = Event::getById((int) $_GET['editId']);
require "inc/layout/editEvent.php";
}
} else {
require "inc/layout/noAccess.php";
}
}
示例4: _ops_update
function _ops_update()
{
$OID = max(0, intval($_POST['OID']));
$CID = max(0, intval($_POST['CID']));
$msg = '';
loginRequireMgmt();
if (!loginCheckPermission(USER::TEST_EVENT)) {
redirect("errors/401");
}
$itemName = "Event";
$urlPrefix = "test_event";
$object = new Event();
if ($OID) {
$object->retrieve($OID, $CID);
if (!$object->exists()) {
$msg = "{$itemName} not found!";
} else {
transactionBegin();
$object->merge($_POST);
if ($object->update()) {
transactionCommit();
$msg = "{$itemName} updated!";
} else {
transactionRollback();
$msg = "{$itemName} update failed";
}
}
} else {
$object->merge($_POST);
transactionBegin();
if ($object->create()) {
transactionCommit();
$msg = "{$itemName} created!";
} else {
transactionRollback();
$msg = "{$itemName} Create failed";
}
}
redirect("{$urlPrefix}/manage", $msg);
}
示例5: foreach
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
try {
$oJSON = new Services_JSON();
if (isset($_POST['sData'])) {
$oData = $oJSON->decode($_POST['sData']);
}
//Convert Object into Array
foreach ($oData as $key => $value) {
$aData[$key] = $value;
}
require_once 'classes/model/Event.php';
$oEvent = new Event();
if (!isset($aData['EVN_UID']) && $aData['EVN_UID'] == '') {
$sEventUid = $oEvent->create($aData);
} else {
$sEventUid = $oEvent->update($aData);
}
$_SESSION['EVN_UID'] = $sEventUid;
echo "{success: true,data:'.{$sEventUid}.'}";
//G::header('location: cases_Scheduler_List');
} catch (Exception $oException) {
die($oException->getMessage());
}
示例6: replaceQuotes
unset($_POST['form']['EVN_MESSAGE_TO_TO']);
unset($_POST['form']['EVN_MESSAGE_TO_CC']);
unset($_POST['form']['EVN_MESSAGE_TO_BCC']);
unset($_POST['form']['EVN_MESSAGE_TEMPLATE']);
}
unset($_POST['form']['SAVE']);
require_once 'classes/model/Event.php';
$oEvent = new Event();
if ($_POST['form']['EVN_UID'] == '') {
//this is probably not used, because the creation of one Event is done directly in EventsNewAction
$oEvent->create($_POST['form']);
} else {
/*
*if($_POST['form']['EVN_ACTION'] == 'SEND_MESSAGE' && $ev->getTriUid() != trim($_POST['form']['TRI_UID']) ){
$oEvnActionParameters = unserialize($ev->getEvnActionParameters());
prit_r($oEvnActionParameters);
if( isset($oEvnActionParameters->TRI_UID) ){
$_POST['form']['TRI_UID'] = $oEvnActionParameters->TRI_UID;
}
}
*/
$oEvent->update($_POST['form']);
}
function replaceQuotes($aData)
{
for ($i = 0; $i < sizeof($aData); $i++) {
$aData[$i] = str_replace(""e;", '"', $aData[$i]);
}
return $aData;
}
示例7: People
$query = $link->prepare($query);
$query->bindParam(':id', $_POST['adresse']);
$query->execute();
$adresse = $query->fetch(PDO::FETCH_ASSOC);
$adresse = $adresse['coordonnee_email'];
// On ouvre la fiche du contact concerné
$contact = new People($_POST['contact']);
// On charge le système de mail
$mail = Configuration::read('mail');
// On prépare le message
$message = array('html' => nl2br($_POST['message']), 'subject' => $_POST['objet'], 'from_email' => Configuration::read('mail.sender.mail'), 'from_name' => Configuration::read('mail.sender.name'), 'to' => array(array('email' => $adresse, 'name' => $contact->get('nom_complet'), 'type' => 'to')), 'headers' => array('Reply-To' => Configuration::read('mail.replyto')), 'track_opens' => true, 'auto_text' => true, 'subaccount' => Configuration::read('client'));
// mode asynchrone d'envoi du mail
$async = true;
// on lance l'envoi du mail
$result = $mail->messages->send($message, $async);
// On met à jour le tracking avec les informations retournées
$campaign = 0;
$query = Core::query('campaign-tracking');
$query->bindValue(':campaign', $campaign, PDO::PARAM_INT);
$query->bindValue(':id', $result[0]['_id']);
$query->bindValue(':email', $result[0]['email']);
$query->bindValue(':status', $result[0]['status']);
$query->execute();
$event = Event::create($contact->get('id'));
$event = new Event($event);
$event->update('historique_type', 'courriel');
$event->update('historique_objet', $_POST['objet']);
$event->update('historique_notes', $_GET['message']);
} else {
return false;
}
示例8: basename
$uploadOk = 1;
$msg = '';
if ($newImage != "") {
if (move_uploaded_file($_FILES["image"]["tmp_name"], $targetImage)) {
$msg .= "The file " . basename($_FILES["image"]["name"]) . " has been uploaded.";
$status = 'ok';
if (file_exists(MEDIA_FILES_PATH . "event/" . $oldImage)) {
unlink(MEDIA_FILES_PATH . "event/" . $oldImage);
}
$uploadOk = 1;
} else {
$uploadOk = 0;
}
}
if ($uploadOk == 1) {
echo $eventObj->update();
} else {
$msg = " Sorry, there was an error uploading your event logo. ERROR: " . $msg;
$json = array("status" => 0, "msg" => $msg);
$dbObj->close();
//Close Database Connection
header('Content-type: application/json');
echo json_encode($json);
}
} else {
$json = array("status" => 0, "msg" => $errorArr);
$dbObj->close();
//Close Database Connection
header('Content-type: application/json');
echo json_encode($json);
}
示例9: saveExtEvents
public function saveExtEvents($oData)
{
$oTask = new Task();
$oEvent = new Event();
$sEvn_uid = '';
$sEvn_type = $oData->evn_type;
$output = 0;
$aDataEvent = array();
$aDataTask = array();
$aDataEvent['EVN_UID'] = $oData->evn_uid;
$aDataEvent['EVN_RELATED_TO'] = 'MULTIPLE';
$aDataEvent['EVN_TYPE'] = $oData->evn_type;
if (preg_match("/Start/", $sEvn_type)) {
if (isset($oData->tas_uid) && $oData->tas_uid != '') {
$aDataTask['TAS_UID'] = $oData->tas_uid;
$aDataTask['TAS_START'] = $oData->tas_start;
$aDataTask['EVN_TYPE'] = $oData->evn_type;
$aDataTask['TAS_EVN_UID'] = $oData->evn_uid;
$oTask->update($aDataTask);
$aDataEvent['EVN_TAS_UID_TO'] = $oData->tas_uid;
$output = $oEvent->update($aDataEvent);
}
} elseif (preg_match("/Inter/", $sEvn_type)) {
$aDataEvent['EVN_TAS_UID_FROM'] = $oData->tas_from;
$aDataEvent['EVN_TAS_UID_TO'] = $oData->tas_to;
$output = $oEvent->update($aDataEvent);
}
return $output;
}
示例10: save_order
public function save_order()
{
$event_array = $_POST['event_id'];
$order_array = $_POST['order'];
$event = new Event();
foreach ($event_array as $key => $value) {
$event_id = $value;
$event_order = $order_array[$key];
$event->update('Event', array('sequence' => $event_order), 'id=' . $event_id);
}
Flash::set('success', __('This event sequence has been saved.'));
redirect(get_url('event'));
}
示例11: save_order
public function save_order()
{
$event_array = $_POST['event_id'];
$order_array = $_POST['order'];
$event = new Event();
foreach ($event_array as $key => $value) {
$event_id = $value;
$event_order = $order_array[$key];
$event->update('Event', array('sequence' => $event_order), 'id=' . $event_id);
}
redirect(get_url('event'));
}
示例12: Event
<?php
/**
* Mise à jour des informations d'un événement
*
* PHP version 5
*
* @category Ajax
* @package LeQG
* @author Damien Senger <hi@hiwelo.co>
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License 3.0
* @link http://leqg.info
*/
// On regarde si on a bien les informations nécessaires
if (isset($_POST['evenement'], $_POST['info'], $_POST['value'])) {
$event = new Event($_POST['evenement']);
$event->update($_POST['info'], $_POST['value']);
} else {
return false;
}
示例13: cancelEventAction
/**
* Allows a user to cancel an event
*
*/
public function cancelEventAction()
{
$get = Zend_Registry::get('getFilter');
if (!isset($get->eventId)) {
throw new Ot_Exception_Input('msg-error-eventIdNotSet');
}
$workshop = new Workshop();
$event = new Event();
$location = new Location();
$thisEvent = $event->find($get->eventId);
if (is_null($thisEvent)) {
throw new Ot_Exception_Data('msg-error-noEvent');
}
$i = new Event_Instructor();
$where = $i->getAdapter()->quoteInto('eventId = ?', $get->eventId);
$results = $i->fetchAll($where);
$currentInstructors = array();
foreach ($results as $r) {
$currentInstructors[] = $r->accountId;
}
if (!$this->_helper->hasAccess('view-all-instructor-pages') && !in_array(Zend_Auth::getInstance()->getIdentity()->accountId, $currentInstructors)) {
throw new Ot_Exception_Access('msg-error-noWorkshopAccess');
}
$thisEvent = $thisEvent->toArray();
$thisEvent['startTime'] = strftime('%l:%M %p', strtotime($thisEvent['startTime']));
$thisEvent['endTime'] = strftime('%l:%M %p', strtotime($thisEvent['endTime']));
$thisEvent['location'] = $location->find($thisEvent['locationId'])->toArray();
$thisEvent['workshop'] = $workshop->find($thisEvent['workshopId'])->toArray();
$this->view->event = $thisEvent;
$form = Ot_Form_Template::delete('eventDelete', 'workshop-schedule-cancelEvent:cancel');
if ($this->_request->isPost() && $form->isValid($_POST)) {
$dba = $event->getAdapter();
$dba->beginTransaction();
$where = $dba->quoteInto('eventId = ?', $get->eventId);
$data = array('status' => 'canceled');
try {
$result = $event->update($data, $where);
} catch (Exception $e) {
$dba->rollback();
throw $e;
}
$attendee = new Event_Attendee();
try {
$attendee->update($data, $where);
} catch (Exception $e) {
$dba->rollback();
throw $e;
}
$dba->commit();
$this->_helper->flashMessenger->addMessage('msg-info-eventCanceled');
$date = explode('-', $thisEvent['date']);
$this->_helper->redirector->gotoUrl('/workshop/schedule?startYear=' . $date[0] . '&startMonth=' . (int) $date[1]);
}
$this->_helper->pageTitle('workshop-schedule-cancelEvent:title');
$this->view->form = $form;
}
示例14: cancelReservation
public function cancelReservation($accountId, $eventId)
{
$event = new Event();
$status = $event->getStatusOfUserForEvent($accountId, $eventId);
if ($status == 'restricted') {
throw new Ot_Exception_Data('Reservation not made because class is restricted');
}
if ($status == 'instructor') {
throw new Ot_Exception_Data('Reservation not made because user is an instructor for this class');
}
if ($status == '') {
throw new Ot_Exception_Data('User is not on the role for this class');
}
$thisEvent = $event->find($eventId);
$eventTime = strtotime($thisEvent->date . ' ' . $thisEvent->startTime);
if ($eventTime < time()) {
throw new Ot_Exception_Data('The signup for this class is closed');
}
$dba = $this->getAdapter();
$inTransaction = false;
try {
$dba->beginTransaction();
} catch (Exception $e) {
$inTransaction = true;
}
$data = array('eventId' => $eventId, 'accountId' => $accountId, 'status' => 'canceled');
try {
$this->update($data, null);
} catch (Exception $e) {
if (!$inTransaction) {
$dba->rollBack();
}
throw $e;
}
$data = array('eventId' => $eventId);
if ($status == 'attending') {
$data['roleSize'] = $thisEvent->roleSize - 1;
} else {
$data['waitlistTotal'] = $thisEvent->waitlistTotal - 1;
}
try {
$event->update($data, null);
} catch (Exception $e) {
if (!$inTransaction) {
$dba->rollBack();
}
throw $e;
}
if (!$inTransaction) {
$dba->commit();
}
return $status;
}
示例15: setWeData
//.........这里部分代码省略.........
$template->assign("wsRoundRobin", $wsRoundRobin);
if ($webEntryInputDocumentAccess == 0) {
//Restricted to process permissions
$template->assign("USR_VAR", "\$cInfo = ws_getCaseInfo(\$caseId);\n\t \$USR_UID = \$cInfo->currentUsers->userId;");
} else {
//No Restriction
$template->assign("USR_VAR", "\$USR_UID = -1;");
}
$template->assign("dynaform", $arrayDynaFormData["DYN_TITLE"]);
$template->assign("timestamp", date("l jS \\of F Y h:i:s A"));
$template->assign("ws", SYS_SYS);
$template->assign("version", \System::getVersion());
$fileName = $pathDataPublicProcess . PATH_SEP . $weTitle . "Post.php";
file_put_contents($fileName, $template->getOutputContent());
//Creating the third file, only if this wsClient.php file doesn't exist.
$fileName = $pathDataPublicProcess . PATH_SEP . "wsClient.php";
$pluginTpl = PATH_CORE . "templates" . PATH_SEP . "processes" . PATH_SEP . "wsClient.php";
if (file_exists($fileName)) {
if (filesize($fileName) != filesize($pluginTpl)) {
copy($fileName, $pathDataPublicProcess . PATH_SEP . "wsClient.php.bak");
unlink($fileName);
$template = new \TemplatePower($pluginTpl);
$template->prepare();
file_put_contents($fileName, $template->getOutputContent());
}
} else {
$template = new \TemplatePower($pluginTpl);
$template->prepare();
file_put_contents($fileName, $template->getOutputContent());
}
//Event
$task = new \Task();
$arrayTaskData = $task->load($arrayWebEntryData["TAS_UID"]);
$weEventUid = $task->getStartingEvent();
if ($weEventUid != "") {
$event = new \Event();
$arrayEventData = array();
$arrayEventData["EVN_UID"] = $weEventUid;
$arrayEventData["EVN_RELATED_TO"] = "MULTIPLE";
$arrayEventData["EVN_ACTION"] = $dynaFormUid;
$arrayEventData["EVN_CONDITIONS"] = $usrUsername;
$result = $event->update($arrayEventData);
}
//WE_DATA
$webEntryData = $weTitle . ".php";
break;
case "HTML":
global $G_FORM;
if (!class_exists("Smarty")) {
$loader = \Maveriks\Util\ClassLoader::getInstance();
$loader->addClass("Smarty", PATH_THIRDPARTY . "smarty" . PATH_SEP . "libs" . PATH_SEP . "Smarty.class.php");
}
$G_FORM = new \Form($processUid . "/" . $dynaFormUid, PATH_DYNAFORM, SYS_LANG, false);
$G_FORM->action = $http . $_SERVER["HTTP_HOST"] . "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/services/cases_StartExternal.php";
$scriptCode = "";
$scriptCode = $G_FORM->render(PATH_TPL . "xmlform" . ".html", $scriptCode);
$scriptCode = str_replace("/controls/", $http . $_SERVER["HTTP_HOST"] . "/controls/", $scriptCode);
$scriptCode = str_replace("/js/maborak/core/images/", $http . $_SERVER["HTTP_HOST"] . "/js/maborak/core/images/", $scriptCode);
//Render the template
$pluginTpl = PATH_TPL . "processes" . PATH_SEP . "webentry.tpl";
$template = new \TemplatePower($pluginTpl);
$template->prepare();
$step = new \Step();
$sUidGrids = $step->lookingforUidGrids($processUid, $dynaFormUid);
$template->assign("URL_MABORAK_JS", \G::browserCacheFilesUrl("/js/maborak/core/maborak.js"));
$template->assign("URL_TRANSLATION_ENV_JS", \G::browserCacheFilesUrl("/jscore/labels/" . SYS_LANG . ".js"));
$template->assign("siteUrl", $http . $_SERVER["HTTP_HOST"]);
$template->assign("sysSys", SYS_SYS);
$template->assign("sysLang", SYS_LANG);
$template->assign("sysSkin", SYS_SKIN);
$template->assign("processUid", $processUid);
$template->assign("dynaformUid", $dynaFormUid);
$template->assign("taskUid", $taskUid);
$template->assign("dynFileName", $processUid . "/" . $dynaFormUid);
$template->assign("formId", $G_FORM->id);
$template->assign("scriptCode", $scriptCode);
if (sizeof($sUidGrids) > 0) {
foreach ($sUidGrids as $k => $v) {
$template->newBlock("grid_uids");
$template->assign("siteUrl", $http . $_SERVER["HTTP_HOST"]);
$template->assign("gridFileName", $processUid . "/" . $v);
}
}
//WE_DATA
$html = str_replace("</body>", "</form></body>", str_replace("</form>", "", $template->getOutputContent()));
$webEntryData = $html;
break;
}
//Update
//Update where
$criteriaWhere = new \Criteria("workflow");
$criteriaWhere->add(\WebEntryPeer::WE_UID, $webEntryUid);
//Update set
$criteriaSet = new \Criteria("workflow");
$criteriaSet->add(\WebEntryPeer::WE_DATA, $webEntryData);
\BasePeer::doUpdate($criteriaWhere, $criteriaSet, \Propel::getConnection("workflow"));
} catch (\Exception $e) {
throw $e;
}
}