public function getEventChangeImpact($params) { include_once './' . CHURCHCAL . '/churchcal_db.php'; return churchcal_getEventChangeImpact($params); }
/** * Checking the depending changes in other modules * For single events splitDate is the origin startdate * @param [type] $params with newEvent, originEvent, splitDate, untilEnd_yn */ public function getEventChangeImpact($params) { return churchcal_getEventChangeImpact($params); }
function churchcal_saveSplittedEvent($params) { global $user; $res = new stdClass(); // if no splitDate given it is a new event without impact if (!isset($params["splitDate"])) { throw new CTException("saveSplittedEvent: splitDate not given!"); } $splitDate = new DateTime($params["splitDate"]); $untilEnd_yn = $params["untilEnd_yn"]; $pastEventId = $params["pastEvent"]["id"]; // Get originEvent out of Database $dummy = churchcal_getCalPerCategory(array("category_ids" => array(0 => $params["pastEvent"]["category_id"]))); $originEvent = (array) $dummy[$params["pastEvent"]["category_id"]][$params["newEvent"]["old_id"]]; // Copy all entries from past to new event, cause CR und CS does not have all infos and doesn't need it :) $pastEventDB = db_query("SELECT bezeichnung, ort, notizen, link, intern_yn, category_id " . "FROM {cc_cal} WHERE id = :id ", array(":id" => $pastEventId))->fetch(); if ($pastEventDB != false) { foreach ($pastEventDB as $key => $entry) { if (empty($params["pastEvent"][$key])) { $params["pastEvent"][$key] = $entry; } if (empty($params["newEvent"][$key])) { $params["newEvent"][$key] = $entry; } } } // Save new Event without impact on CS and CR ... $res = churchcal_createEvent($params["newEvent"], false, true); // ... and now bind related bookings and services to the new event $newEventId = $res["id"]; $params["newEvent"]["id"] = $newEventId; if (churchcore_isModuleActivated("churchservice")) { include_once './' . CHURCHSERVICE . '/churchservice_db.php'; churchservice_rebindServicesToNewEvent($pastEventId, $newEventId, $splitDate, $untilEnd_yn); $params["newEvent"]["cal_id"] = $newEventId; $startdate = new Datetime($params["newEvent"]["startdate"]); if ($splitDate->format("Y-m-d H:i") != $startdate->format("Y-m-d H:i")) { $params["newEvent"]["old_startdate"] = $splitDate; } churchservice_operateEventFromChurchCal($params["newEvent"]); } // Save old Event churchcal_updateEvent($params["pastEvent"], false, true); if (getVar("informCreator", "true", $params["newEvent"]) == "true" && $originEvent["modified_pid"] != $user->id) { $data = (array) churchcal_getEventChangeImpact(array("newEvent" => $params["newEvent"], "originEvent" => $originEvent, "pastEvent" => $params["pastEvent"])); $data["caption"] = $params["newEvent"]["bezeichnung"]; $data["startdate"] = churchcore_stringToDateDe($params["newEvent"]["startdate"]); $p = db_query("SELECT name, vorname, IF(spitzname, spitzname, vorname) AS nickname\n FROM {cdb_person}\n WHERE id=:id", array(":id" => $originEvent["modified_pid"]))->fetch(); $data["p"] = $p; // get populated template and send email $lang = getUserLanguage($params["modified_pid"]); $content = getTemplateContent('email/informCreator', 'churchcal', $data, null, $lang); churchcore_sendEMailToPersonIDs($originEvent["modified_pid"], "[" . getConf('site_name') . "] " . t2($lang, 'information.for.your.event'), $content, null, true); } return array("id" => $newEventId, "bookingIds" => $res["bookingIds"]); }