/** * 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(); }
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!')); } }
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"; } }
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); }
* 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()); }
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; }
$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; }
$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); }
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; }
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')); }
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')); }
<?php /** * Mise à jour des informations d'un événement * * PHP version 5 * * @category Ajax * @package LeQG * @author Damien Senger <*****@*****.**> * @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; }
/** * 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; }
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; }
/** * Set value in WE_DATA * * @param string $webEntryUid Unique id of Web Entry * * return void */ public function setWeData($webEntryUid) { try { //Verify data $this->throwExceptionIfNotExistsWebEntry($webEntryUid, $this->arrayFieldNameForException["webEntryUid"]); //Set variables $arrayWebEntryData = $this->getWebEntry($webEntryUid, true); $processUid = $arrayWebEntryData["PRO_UID"]; $taskUid = $arrayWebEntryData["TAS_UID"]; $dynaFormUid = $arrayWebEntryData["DYN_UID"]; $webEntryMethod = $arrayWebEntryData["WE_METHOD"]; $webEntryInputDocumentAccess = $arrayWebEntryData["WE_INPUT_DOCUMENT_ACCESS"]; $webEntryData = ""; $wsRoundRobin = 0; //0, 1 //0 - Cyclical Assignment $pathDataPublicProcess = PATH_DATA_PUBLIC . $processUid; //Delete previous files if (trim($arrayWebEntryData["WE_DATA"]) != "") { $fileName = str_replace(".php", "", trim($arrayWebEntryData["WE_DATA"])); $file = $pathDataPublicProcess . PATH_SEP . $fileName . ".php"; if (is_file($file) && file_exists($file)) { unlink($file); unlink($pathDataPublicProcess . PATH_SEP . $fileName . "Post.php"); } } //Create files \G::mk_dir($pathDataPublicProcess, 0777); $http = \G::is_https() ? "https://" : "http://"; switch ($webEntryMethod) { case "WS": require_once PATH_RBAC . "model" . PATH_SEP . "RbacUsers.php"; $user = new \RbacUsers(); $arrayUserData = $user->load($arrayWebEntryData["USR_UID"]); $usrUsername = $arrayUserData["USR_USERNAME"]; $usrPassword = $arrayUserData["USR_PASSWORD"]; $dynaForm = new \Dynaform(); $arrayDynaFormData = $dynaForm->Load($arrayWebEntryData["DYN_UID"]); //Creating sys.info; $sitePublicPath = ""; if (file_exists($sitePublicPath . "")) { } //Creating the first file $weTitle = $this->sanitizeFilename($arrayWebEntryData["WE_TITLE"]); $fileName = $weTitle; $fileContent = "<?php\n"; $fileContent .= "global \$_DBArray;\n"; $fileContent .= "if (!isset(\$_DBArray)) {\n"; $fileContent .= " \$_DBArray = array();\n"; $fileContent .= "}\n"; $fileContent .= "\$_SESSION[\"PROCESS\"] = \"" . $processUid . "\";\n"; $fileContent .= "\$_SESSION[\"CURRENT_DYN_UID\"] = \"" . $dynaFormUid . "\";\n"; $fileContent .= "\$G_PUBLISH = new Publisher();\n"; $fileContent .= "G::LoadClass(\"pmDynaform\");\n"; $fileContent .= "\$a = new pmDynaform(array(\"CURRENT_DYNAFORM\" => \"" . $arrayWebEntryData["DYN_UID"] . "\"));\n"; $fileContent .= "if (\$a->isResponsive()) {"; $fileContent .= " \$a->printWebEntry(\"" . $fileName . "Post.php\");"; $fileContent .= "} else {"; $fileContent .= " \$G_PUBLISH->AddContent(\"dynaform\", \"xmlform\", \"" . $processUid . PATH_SEP . $dynaFormUid . "\", \"\", array(), \"" . $fileName . "Post.php\");\n"; $fileContent .= " G::RenderPage(\"publish\", \"blank\");"; $fileContent .= "}"; file_put_contents($pathDataPublicProcess . PATH_SEP . $fileName . ".php", $fileContent); //Creating the second file, the post file who receive the post form. $pluginTpl = PATH_TPL . "processes" . PATH_SEP . "webentryPost.tpl"; $template = new \TemplatePower($pluginTpl); $template->prepare(); $template->assign("wsdlUrl", $http . $_SERVER["HTTP_HOST"] . "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/services/wsdl2"); $template->assign("wsUploadUrl", $http . $_SERVER["HTTP_HOST"] . "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/services/upload"); $template->assign("processUid", $processUid); $template->assign("dynaformUid", $dynaFormUid); $template->assign("taskUid", $taskUid); $template->assign("wsUser", $usrUsername); $template->assign("wsPass", \Bootstrap::getPasswordHashType() . ':' . $usrPassword); $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; } }
/** * Launch an email tracking * * @param array $result Send email result * @param string $numero Send numero * @param int $contact Person ID * * @return void **/ public function tracking(array $result, $numero = null, $contact = null) { switch ($this->_campaign['type']) { case 'email': switch ($result['status']) { case 'rejected': $query = Core::query('campaign-tracking-reject'); $query->bindValue(':campaign', $this->_campaign['id'], PDO::PARAM_INT); $query->bindValue(':id', $result['_id']); $query->bindValue(':email', $result['email']); $query->bindValue(':status', $result['status']); $query->bindValue(':reject', $result['reject_reason']); $query->execute(); break; default: $query = Core::query('campaign-tracking'); $query->bindValue(':campaign', $this->_campaign['id'], PDO::PARAM_INT); $query->bindValue(':id', $result['_id']); $query->bindValue(':email', $result['email']); $query->bindValue(':status', $result['status']); $query->execute(); $query = Core::query('contact-by-email'); $query->bindValue(':coord', $result['email']); $query->execute(); $contact = $query->fetch(PDO::FETCH_ASSOC); $event = Event::create($contact['contact']); $event = new Event($event); $event->update('historique_type', 'email'); $event->update('historique_objet', $this->_campaign['objet']); $event->update('historique_date', date('Y-m-d')); $event->update('campagne_id', $this->_campaign['id']); $e = new Evenement($contact['contact'], false, true); $e->modification('historique_type', 'email'); $e->modification('campagne_id', $this->_campaign['id']); $e->modification('historique_objet', $this->_campaign['objet']); break; } break; case 'sms': $query = Core::query('campaign-sms-tracking'); $query->bindValue(':campaign', $this->_campaign['id'], PDO::PARAM_INT); $query->bindValue(':numero', $numero); $query->bindValue(':id', $result->id()); $query->execute(); $event = Event::create($contact); $event = new Event($event); $event->update('historique_type', 'sms'); $event->update('historique_objet', $this->_campaign['titre']); $event->update('historique_notes', $this->_campaign['message']); $event->update('historique_date', date('Y-m-d')); $event->update('campagne_id', $this->_campaign['id']); break; } }
$campaign->update('titre', $campagne['titre']); $campaign->update('message', $campagne['message']); $var = $_GET; $var['criteres'] = trim($var['criteres'], ';'); $contacts = People::listing($var, 0, false); $fichier = array(); $nomFichier = 'publi-' . md5($campaign->get('id')) . '.csv'; $file = fopen('exports/' . $nomFichier, 'w+'); $entete = array('nom', 'nom_usage', 'prenoms', 'numero', 'rue', 'cp', 'ville', 'pays', 'origine'); fputcsv($file, $entete, ';', '"'); foreach ($contacts as $contact) { $person = new People($contact); $address = $person->postal_array(); if (isset($address['reel'])) { $address = $address['reel']; $origine = 'declaree'; } else { $address = $address['officiel']; $origine = 'liste-electorale'; } $_fichier = array($person->get('nom'), $person->get('nom_usage'), $person->get('prenoms'), $address['building'], $address['street'], $address['zipcode'], $address['city'], $address['country'], $origine); if (fputcsv($file, $_fichier, ';', '"')) { $event = Event::create($person->get('id')); $event = new Event($event); $event->update('historique_type', 'publi'); $event->update('historique_objet', $campaign->get('titre')); $event->update('historique_notes', $campaign->get('message')); $event->update('historique_date', date('Y-m-d')); $event->update('campagne_id', $campaign->get('id')); } }
function save($params) { require_once 'classes/model/Event.php'; global $G_FORM; $sPRO_UID = $params->pro_uid; $sEVN_UID = $params->evn_uid; $sDYNAFORM = $params->initDyna; $sWS_USER = trim($params->username); $sWS_PASS = trim($params->password); $sWS_ROUNDROBIN = ''; $sWE_USR = ''; $xDYNA = $params->dynaform; if ($xDYNA != '') { $pro_uid = $params->pro_uid; $filename = $xDYNA; $filename = $filename . '.php'; unlink(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $pro_uid . PATH_SEP . $filename); unlink(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $pro_uid . PATH_SEP . str_replace(".php", "Post", $filename) . ".php"); } //return $params; G::LoadClass("system"); $pathProcess = PATH_DATA_SITE . 'public' . PATH_SEP . $sPRO_UID . PATH_SEP; G::mk_dir($pathProcess, 0777); $oEvent = new Event(); $oEvent->load($sEVN_UID); $sTASKS = $oEvent->getEvnTasUidTo(); $oTask = new Task(); $oTask->load($sTASKS); $tas_title = $oTask->getTasTitle(); if (G::is_https()) { $http = 'https://'; } else { $http = 'http://'; } $sContent = ''; $SITE_PUBLIC_PATH = ''; if (file_exists($SITE_PUBLIC_PATH . '')) { } require_once 'classes/model/Dynaform.php'; $oDynaform = new Dynaform(); $aDynaform = $oDynaform->load($sDYNAFORM); $dynTitle = str_replace(' ', '_', str_replace('/', '_', $aDynaform['DYN_TITLE'])); $sContent = "<?php\n"; $sContent .= "global \$_DBArray;\n"; $sContent .= "if (!isset(\$_DBArray)) {\n"; $sContent .= " \$_DBArray = array();\n"; $sContent .= "}\n"; $sContent .= "\$_SESSION['PROCESS'] = '" . $sPRO_UID . "';\n"; $sContent .= "\$_SESSION['CURRENT_DYN_UID'] = '" . $sDYNAFORM . "';\n"; $sContent .= "\$G_PUBLISH = new Publisher;\n"; $sContent .= "\$G_PUBLISH->AddContent('dynaform', 'xmlform', '" . $sPRO_UID . '/' . $sDYNAFORM . "', '', array(), '" . $dynTitle . 'Post.php' . "');\n"; $sContent .= "G::RenderPage('publish', 'blank');"; file_put_contents($pathProcess . $dynTitle . '.php', $sContent); //creating the second file, the post file who receive the post form. $pluginTpl = PATH_CORE . 'templates' . PATH_SEP . 'processes' . PATH_SEP . 'webentryPost.tpl'; $template = new TemplatePower($pluginTpl); $template->prepare(); $template->assign('wsdlUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'); $template->assign('wsUploadUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/upload'); $template->assign('processUid', $sPRO_UID); $template->assign('dynaformUid', $sDYNAFORM); $template->assign('taskUid', $sTASKS); $template->assign('wsUser', $sWS_USER); $template->assign('wsPass', 'md5:' . md5($sWS_PASS)); $template->assign('wsRoundRobin', $sWS_ROUNDROBIN); if ($sWE_USR == "2") { $template->assign('USR_VAR', "\$cInfo = ws_getCaseInfo(\$caseId);\n\t \$USR_UID = \$cInfo->currentUsers->userId;"); } else { $template->assign('USR_VAR', '$USR_UID = -1;'); } $template->assign('dynaform', $dynTitle); $template->assign('timestamp', date('l jS \\of F Y h:i:s A')); $template->assign('ws', SYS_SYS); $template->assign('version', System::getVersion()); $fileName = $pathProcess . $dynTitle . 'Post.php'; file_put_contents($fileName, $template->getOutputContent()); //creating the third file, only if this wsClient.php file doesn't exists. $fileName = $pathProcess . 'wsClient.php'; $pluginTpl = PATH_CORE . 'test' . PATH_SEP . 'unit' . PATH_SEP . 'ws' . PATH_SEP . 'wsClient.php'; if (file_exists($fileName)) { if (filesize($fileName) != filesize($pluginTpl)) { @copy($fileName, $pathProcess . 'wsClient.php.bck'); @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()); } require_once 'classes/model/Event.php'; $oEvent = new Event(); $aDataEvent = array(); $aDataEvent['EVN_UID'] = $sEVN_UID; $aDataEvent['EVN_RELATED_TO'] = 'MULTIPLE'; $aDataEvent['EVN_ACTION'] = $sDYNAFORM; $aDataEvent['EVN_CONDITIONS'] = $sWS_USER; $output = $oEvent->update($aDataEvent); $link = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $sPRO_UID . '/' . $dynTitle . '.php'; $this->success = true; $this->msg = G::LoadTranslation('ID_WEB_ENTRY_SUCCESS_NEW'); $this->W_LINK = $link; $this->TAS_TITLE = $tas_title; $this->DYN_TITLE = $dynTitle; $this->USR_UID = $sWS_USER; }
} } $msg = MSG_ADD; $url = 'index.php?file=Events&AX=Yes' . $qs . '&var_msg=' . $msg; header("Location:" . $url); exit; } else { if ($mode == "Update") { $sql_check = "SELECT eStatus FROM Event WHERE iEventId='" . $iEventId . "' "; $check_status = $obj->select($sql_check); $check = $check_status[0]['eStatus']; if ($check == 'Inactive' && $eStatus == "Active") { $user_emails = $userObj->getNotificationUsers($iSGroupId); if (is_Array($user_emails) && count($user_emails) > 0) { for ($i = 0; $i < count($user_emails); $i++) { // $emailObj->send_add_eventmail($user_emails[$i]['vUsername'],$vEventTitle,$user_emails['admin_email'],$user_emails[$i]['vEmail']); $sql_insert = "INSERT INTO `cron_email` (`vEmail` ,`vUsername` ,`vName` ,`vAdmin_email` ,`vCategoryName` ,`eType` ,`iID`)\n\t\t\t\t\tVALUES ('" . $user_emails[$i]['vEmail'] . "', '" . $user_emails[$i]['vUsername'] . "', '" . $vEventTitle . "', '" . $user_emails['admin_email'] . "', '" . $catagery_Array[0]['vCategoryName'] . "', 'Event', '" . $iEventId . "')"; //echo $sql_insert;exit; $id = $obj->insert($sql_insert); } } } $eventObj->setdEventDateTime($dEventDateTime); $eventObj->setiSGroupId($iSGroupId); $eventObj->update($iEventId); $msg = MSG_UPDATE; $url = 'index.php?file=Events&AX=Yes' . $qs . '&var_msg=' . $msg; header("Location:" . $url); exit; } }
} $aData['SCH_TIME_NEXT_RUN'] = $aData['SCH_START_TIME']; } if (trim($_POST['SCH_END_DATE']) != '') { $aData['SCH_END_DATE'] = $_POST['SCH_END_DATE']; } if (!empty($_POST['SCH_REPEAT_TASK_CHK'])) { $nOptEvery = $_POST['SCH_REPEAT_EVERY_OPT']; if ($nOptEvery == 2) { $aData['SCH_REPEAT_EVERY'] = $_POST['SCH_REPEAT_EVERY'] * 60; } else { $aData['SCH_REPEAT_EVERY'] = $_POST['SCH_REPEAT_EVERY']; } } //$aData['SCH_END_DATE'] = "2020-12-30"; if (empty($_POST['SCH_UID'])) { $oCaseScheduler->create($aData); } else { $oCaseScheduler->update($aData); } //Save Scheduler_uid in the Event Table for Start Timer. $oData['EVN_UID'] = $_POST['EVN_UID']; $oData['EVN_ACTION'] = $aData['SCH_UID']; require_once "classes/model/Event.php"; $oEvent = new Event(); $oEvent->update($oData); echo "{success: true}"; //G::header('location: cases_Scheduler_List'); } catch (Exception $oException) { die($oException->getMessage()); }
/** * Save Event Post Put * * @param string $evn_uid * * @access public * @author Brayan Pereyra (Cochalo) <*****@*****.**> * @copyright Colosa - Bolivia * * @return array */ public function saveEvents($pro_uid, $dataEvent, $create = false) { $pro_uid = $this->validateProUid($pro_uid); if (!$create) { $dataEvent['evn_uid'] = $this->validateEvnUid($dataEvent['evn_uid']); } if ($pro_uid == '' || count($dataEvent) == 0) { return false; } $dataEvent = array_change_key_case($dataEvent, CASE_UPPER); if ($dataEvent['EVN_RELATED_TO'] == 'SINGLE') { if (empty($dataEvent['TAS_UID'])) { throw new \Exception(\G::LoadTranslation("ID_FIELD_REQUIRED", array('tas_uid'))); } $this->validateTasUid($dataEvent['TAS_UID']); } else { if (empty($dataEvent['EVN_TAS_UID_FROM'])) { throw new \Exception(\G::LoadTranslation("ID_FIELD_REQUIRED", array('evn_tas_uid_from'))); } $this->validateTasUid($dataEvent['EVN_TAS_UID_FROM']); $dataEvent['TAS_UID'] = $dataEvent['EVN_TAS_UID_FROM']; if (empty($dataEvent['EVN_TAS_UID_TO'])) { throw new \Exception(\G::LoadTranslation("ID_FIELD_REQUIRED", array('evn_tas_uid_to'))); } $this->validateTasUid($dataEvent['EVN_TAS_UID_TO']); } $this->validateTriUid($dataEvent['TRI_UID']); if ($create && isset($dataEvent['EVN_UID'])) { unset($dataEvent['EVN_UID']); } $dataEvent['PRO_UID'] = $pro_uid; $oEvent = new \Event(); if ($create) { $uidNewEvent = $oEvent->create($dataEvent); $dataEvent = $this->getEvents($pro_uid, '', $uidNewEvent); $dataEvent = array_change_key_case($dataEvent, CASE_LOWER); return $dataEvent; } else { $oEvent->update($dataEvent); $uidNewEvent = $dataEvent['EVN_UID']; } }
file_put_contents($fileName, $template->getOutputContent()); } } else { $template = new TemplatePower($pluginTpl); $template->prepare(); file_put_contents($fileName, $template->getOutputContent()); } require_once 'classes/model/Event.php'; $oEvent = new Event(); $aDataEvent = array(); $aDataEvent['EVN_UID'] = $WE_EVN_UID; //$oData->WE_EVN_UID; $aDataEvent['EVN_RELATED_TO'] = 'MULTIPLE'; $aDataEvent['EVN_ACTION'] = $sDYNAFORM; $aDataEvent['EVN_CONDITIONS'] = $sWS_USER; $output = $oEvent->update($aDataEvent); //Show link $link = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $sPRO_UID . '/' . $dynTitle . '.php'; print $link; //print "\n<a href='$link' target='_new' > $link </a>"; } else { $G_FORM = new Form($sPRO_UID . '/' . $sDYNAFORM, 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_CORE . 'templates/' . '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_CORE . 'templates' . PATH_SEP . 'processes' . PATH_SEP . 'webentry.tpl'; $template = new TemplatePower($pluginTpl); $template->prepare();
function save($params) { require_once 'classes/model/CaseScheduler.php'; $oCaseScheduler = new CaseScheduler(); $aData['SCH_UID'] = G::generateUniqueID(); $aData['SCH_NAME'] = $params->fDescription; //$_POST['form']['SCH_NAME']; $aData['SCH_DEL_USER_NAME'] = $params->fUser; //$_POST['form']['SCH_USER_NAME']; $aData['SCH_DEL_USER_PASS'] = G::encryptOld($params->fPassword); $aData['SCH_DEL_USER_UID'] = $params->usr_uid; //$_POST['form']['SCH_USER_UID']; $aData['PRO_UID'] = $params->pro_uid; //$_POST['form']['PRO_UID']; $aData['TAS_UID'] = $params->tas_uid; //$_POST['form']['TAS_UID']; $aData['SCH_STATE'] = 'ACTIVE'; $aData['SCH_LAST_STATE'] = 'CREATED'; // 'ACTIVE'; $aData['USR_UID'] = $_SESSION['USER_LOGGED']; $sOption = $params->fType; //$_POST['form']['SCH_OPTION']; switch ($sOption) { case 'Daily': $sOption = '1'; break; case 'Weekly': $sOption = '2'; break; case 'Monthly': $sOption = '3'; break; default: $sOption = '4'; break; } $aData['SCH_OPTION'] = $sOption; // if ($_POST['form']['SCH_START_DATE']!=''){ // $sDateTmp = $_POST['form']['SCH_START_DATE']; // } else { // $sDateTmp = date('Y-m-d'); // } $sDateTmp = $params->SCH_START_DATE; $sTimeTmp = $params->SCH_START_TIME; //$_POST['form']['SCH_START_TIME']; $aData['SCH_START_TIME'] = date('Y-m-d', strtotime($sDateTmp)) . ' ' . date('H:i:s', strtotime($sTimeTmp)); $aData['SCH_START_DATE'] = date('Y-m-d', strtotime($sDateTmp)) . ' ' . date('H:i:s', strtotime($sTimeTmp)); //g::pr($aData); $nActualTime = $sTimeTmp; //date("Y-m-d H:i:s"); // time(); //$nActualDate = date("Y-m-d H:i:s"); $sValue = ''; $sDaysPerformTask = ''; $sWeeks = ''; $sMonths = ''; $sMonths = ''; $sStartDay = ''; $nSW = 0; switch ($sOption) { case '1': // Option 1 $sValue = isset($params->SCH_DAYS_PERFORM_TASK) ? $params->SCH_DAYS_PERFORM_TASK : '1'; //$_POST['form']['SCH_DAYS_PERFORM_TASK']; switch ($sValue) { case '1': $aData['SCH_DAYS_PERFORM_TASK'] = $sValue . '|1'; break; case '2': $aData['SCH_OPTION'] = '2'; $aData['SCH_EVERY_DAYS'] = '1'; $aData['SCH_WEEK_DAYS'] = '1|2|3|4|5|'; break; case '3': // Every [n] Days $sDaysPerformTask = $params->SCH_DAYS_PERFORM_TASK_OPT_3; $aData['SCH_DAYS_PERFORM_TASK'] = $params->SCH_DAYS_PERFORM_TASK . '|' . $params->SCH_DAYS_PERFORM_TASK_OPT_3; break; } break; case '2': // If the option is zero, set by default 1 $sWeeks = ''; if (isset($params->W1)) { if ($sWeeks != '') { $sWeeks .= '|'; } $sWeeks .= '1'; } if (isset($params->W2)) { if ($sWeeks != '') { $sWeeks .= '|'; } $sWeeks .= '2'; } if (isset($params->W3)) { if ($sWeeks != '') { $sWeeks .= '|'; } $sWeeks .= '3'; } if (isset($params->W4)) { if ($sWeeks != '') { $sWeeks .= '|'; } $sWeeks .= '4'; } if (isset($params->W5)) { if ($sWeeks != '') { $sWeeks .= '|'; } $sWeeks .= '5'; } if (isset($params->W6)) { if ($sWeeks != '') { $sWeeks .= '|'; } $sWeeks .= '6'; } if (isset($params->W7)) { if ($sWeeks != '') { $sWeeks .= '|'; } $sWeeks .= '7'; } $sStartTime = $params->SCH_START_TIME; $aData['SCH_WEEK_DAYS'] = $sWeeks; $aData['SCH_START_DAY'] = ''; // break; case '3': $nStartDay = $params->SCH_START_DAY; if ($nStartDay == 'Day of Month') { $nStartDay = 1; } if ($nStartDay == 'The Day') { $nStartDay = 2; } if ($nStartDay == 1) { $aData['SCH_START_DAY'] = $nStartDay . '|' . $params->SCH_START_DAY_OPT_1; } else { $opt2weeks = $params->SCH_START_DAY_OPT_2_WEEKS; switch ($opt2weeks) { case 'First': $opt2weeks = 1; break; case 'Second': $opt2weeks = 2; break; case 'Third': $opt2weeks = 3; break; case 'Fourth': $opt2weeks = 4; break; case 'Last': $opt2weeks = 5; break; } $opt2days = $params->SCH_START_DAY_OPT_2_DAYS_WEEK; switch ($opt2days) { case 'Monday': $opt2days = 1; break; case 'Tuesday': $opt2days = 2; break; case 'Wednesday': $opt2days = 3; break; case 'Thursday': $opt2days = 4; break; case 'Friday': $opt2days = 5; break; case 'Saturday': $opt2days = 6; break; case 'Sunday': $opt2days = 7; break; } $aData['SCH_START_DAY'] = $nStartDay . '|' . $opt2weeks . '|' . $opt2days; } $sMonths = ''; if (isset($params->M1)) { if ($sMonths != '') { $sMonths .= '|'; } $sMonths .= '1'; } if (isset($params->M2)) { if ($sMonths != '') { $sMonths .= '|'; } $sMonths .= '2'; } if (isset($params->M3)) { if ($sMonths != '') { $sMonths .= '|'; } $sMonths .= '3'; } if (isset($params->M4)) { if ($sMonths != '') { $sMonths .= '|'; } $sMonths .= '4'; } if (isset($params->M5)) { if ($sMonths != '') { $sMonths .= '|'; } $sMonths .= '5'; } if (isset($params->M6)) { if ($sMonths != '') { $sMonths .= '|'; } $sMonths .= '6'; } if (isset($params->M7)) { if ($sMonths != '') { $sMonths .= '|'; } $sMonths .= '7'; } if (isset($params->M8)) { if ($sMonths != '') { $sMonths .= '|'; } $sMonths .= '8'; } if (isset($params->M9)) { if ($sMonths != '') { $sMonths .= '|'; } $sMonths .= '9'; } if (isset($params->M10)) { if ($sMonths != '') { $sMonths .= '|'; } $sMonths .= '10'; } if (isset($params->M11)) { if ($sMonths != '') { $sMonths .= '|'; } $sMonths .= '11'; } if (isset($params->M12)) { if ($sMonths != '') { $sMonths .= '|'; } $sMonths .= '12'; } // if(!empty($params->SCH_MONTHS)){ // $aMonths = $params->SCH_MONTHS; // foreach($aMonths as $value) { // $sMonths = $sMonths . $value . '|' ; // } // } // if(!empty($params->SCH_MONTHS_2)){ // $aMonths2 = $params->SCH_MONTHS_2; // foreach($aMonths2 as $value) { // $sMonths = $sMonths . $value . '|' ; // } // } // if(!empty($params->SCH_MONTHS_3)){ // $aMonths3 = $params->SCH_MONTHS_3; // foreach($aMonths3 as $value) { // $sMonths = $sMonths . $value . '|' ; // } // } $aData['SCH_MONTHS'] = $sMonths; $sStartDay = $aData['SCH_START_DAY']; $sValue = $nStartDay; break; } if ($sOption != '1' && $sOption != '4') { if ($sStartDay == '') { $sStartDay = date('Y-m-d'); } // echo $sOption."*". $sValue."*". $nActualTime."*". $sDaysPerformTask."*". $sWeeks."*". $sStartDay ."*". $sMonths."<br>"; $dCurrentDay = date("d"); $dCurrentMonth = date("m"); $aStartDay = explode("|", $aData['SCH_START_DAY']); if ($sOption == '3' && $aStartDay[0] == '1') { $monthsArray = explode("|", $sMonths); foreach ($monthsArray as $row) { if ($dCurrentMonth == $row && $dCurrentDay < $aStartDay[1]) { $startTime = $params->SCH_START_TIME . ":00"; $aData['SCH_TIME_NEXT_RUN'] = date('Y') . '-' . $row . '-' . $aStartDay[1] . ' ' . $startTime; break; } else { $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->updateNextRun($sOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp); } } } else { $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->updateNextRun($sOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp); } // print_r ($aData['SCH_TIME_NEXT_RUN']); // die; } else { if ($sOption == '4') { $aData['SCH_END_DATE'] = $aData['SCH_START_TIME']; } $aData['SCH_TIME_NEXT_RUN'] = $aData['SCH_START_TIME']; } if (isset($params->SCH_END_DATE)) { if (trim($params->SCH_END_DATE) != '') { $aData['SCH_END_DATE'] = $params->SCH_END_DATE; } } if (!empty($params->SCH_REPEAT_TASK_CHK)) { $nOptEvery = $params->SCH_REPEAT_EVERY_OPT; if ($nOptEvery == 2) { $aData['SCH_REPEAT_EVERY'] = $params->SCH_REPEAT_EVERY_OPT * 60; } else { $aData['SCH_REPEAT_EVERY'] = $params->SCH_REPEAT_EVERY_OPT; } } if (isset($_POST['form']['CASE_SH_PLUGIN_UID']) && $_POST['form']['CASE_SH_PLUGIN_UID'] != "") { $aData['CASE_SH_PLUGIN_UID'] = $_POST['form']['CASE_SH_PLUGIN_UID']; } //$aData['SCH_END_DATE'] = "2020-12-30"; //g::pr($aData); $sch_uid = $params->sch_uid; if ($sch_uid != '') { $aData['SCH_UID'] = $sch_uid; $oCaseScheduler->Update($aData); $sw_update = true; } else { $oCaseScheduler->create($aData); $sch_uid = $oCaseScheduler->getSchUid(); $sw_update = false; } if (isset($_POST['form']['CASE_SH_PLUGIN_UID']) && $_POST['form']['CASE_SH_PLUGIN_UID'] != "") { $params = explode("--", $_REQUEST['form']['CASE_SH_PLUGIN_UID']); $oPluginRegistry =& PMPluginRegistry::getSingleton(); $activePluginsForCaseScheduler = $oPluginRegistry->getCaseSchedulerPlugins(); foreach ($activePluginsForCaseScheduler as $key => $caseSchedulerPluginDetail) { if ($caseSchedulerPluginDetail->sNamespace == $params[0] && $caseSchedulerPluginDetail->sActionId == $params[1]) { $caseSchedulerSelected = $caseSchedulerPluginDetail; } } if (isset($caseSchedulerSelected) && is_object($caseSchedulerSelected)) { //Save the form $oData = $_POST['pluginFields']; $oData['SCH_UID'] = $aData['SCH_UID']; $oPluginRegistry->executeMethod($caseSchedulerPluginDetail->sNamespace, $caseSchedulerPluginDetail->sActionSave, $oData); } } //Added by Qennix //Update Start Time Event in BPMN require_once 'classes/model/Event.php'; require_once 'classes/model/Task.php'; $oTask = new Task(); $oTask->load($params->tas_uid); $evn_uid = $oTask->getStartingEvent(); $tas_name = $oTask->getTasTitle(); $event = new Event(); $editEvent = array(); $editEvent['EVN_UID'] = $evn_uid; $editEvent['EVN_ACTION'] = $sch_uid; $event->update($editEvent); //End Adding $sch = new CaseScheduler(); $sch->load($sch_uid); $this->success = true; $this->SCH_UID = $sch_uid; $this->NEXT = $sch->getSchTimeNextRun(); $this->DESCRIPTION = $sch->getSchName(); $this->TAS_NAME = $tas_name; if ($sw_update) { $this->msg = G::LoadTranslation('ID_SCHEDULER_SUCCESS_UPDATE'); } else { $this->msg = G::LoadTranslation('ID_SCHEDULER_SUCCESS_NEW'); } }
$oEvent = new Event(); $oRoute = new Route(); switch ($aData['ROU_TYPE']) { case 'SEQUENTIAL': case 'SEC-JOIN': $aFields['PRO_UID'] = $aData['PROCESS']; $aFields['TAS_UID'] = $aData['TASK'][0]; $aFields['ROU_NEXT_TASK'] = $aData['ROU_NEXT_TASK'][0]; $aFields['ROU_TYPE'] = $aData['ROU_TYPE']; if (isset($aData['ROU_EVN_UID']) && $aData['ROU_EVN_UID'] != '') { $aFields['ROU_EVN_UID'] = $aData['ROU_EVN_UID']; $aDataEvent = array(); $aDataEvent['EVN_UID'] = $aData['ROU_EVN_UID']; $aDataEvent['EVN_TAS_UID_FROM'] = $aData['TASK'][0]; $aDataEvent['EVN_RELATED_TO'] = 'MULTIPLE'; $oEvent->update($aDataEvent); } if (isset($aData['PORT_NUMBER_IP'])) { $aFields['ROU_TO_PORT'] = $aData['PORT_NUMBER_IP']; } if (isset($aData['PORT_NUMBER_OP'])) { $aFields['ROU_FROM_PORT'] = $aData['PORT_NUMBER_OP']; } $rou_id = $oRoute->create($aFields); break; case 'SELECT': foreach ($aData['GRID_SELECT_TYPE'] as $iKey => $aRow) { $aFields['PRO_UID'] = $aData['PROCESS']; $aFields['TAS_UID'] = $aData['TASK']; $aFields['ROU_NEXT_TASK'] = $aRow; $aFields['ROU_CASE'] = $iKey;
function event_controller() { global $mysqli, $redis, $user, $session, $route, $timestore_adminkey; global $feed; include "Modules/feed/feed_model.php"; $feed = new Feed($mysqli, $redis, $timestore_adminkey); require "Modules/event/event_model.php"; $event = new Event($mysqli, $redis); $userid = $session['userid']; if ($route->action == 'add' && $session['write']) { $eventfeed = intval(get('eventfeed')); $eventtype = intval(get('eventtype')); $eventvalue = floatval(get('eventvalue')); $action = intval(get('action')); $setfeed = intval(get('setfeed')); $setemail = get('setemail'); $setvalue = floatval(get('setvalue')); $callcurl = get('callcurl'); $mutetime = get('mutetime'); $priority = get('priority'); $message = get('message'); $mqtttopic = get('mqtttopic'); $mqttqos = get('mqttqos'); $event->add($userid, $eventfeed, $eventtype, $eventvalue, $action, $setfeed, $setemail, $setvalue, $callcurl, $message, $mutetime, $priority, $mqtttopic, $mqttqos); $result = "Event added"; } if ($route->action == 'edit' && $session['write']) { $eventid = intval(get('eventid')); $eventfeed = intval(get('eventfeed')); $eventtype = intval(get('eventtype')); $eventvalue = floatval(get('eventvalue')); $action = intval(get('action')); $setfeed = intval(get('setfeed')); $setemail = get('setemail'); $setvalue = floatval(get('setvalue')); $callcurl = get('callcurl'); $mutetime = get('mutetime'); $priority = get('priority'); $message = get('message'); $mqtttopic = get('mqtttopic'); $mqttqos = get('mqttqos'); $event->update($userid, $eventid, $eventfeed, $eventtype, $eventvalue, $action, $setfeed, $setemail, $setvalue, $callcurl, $message, $mutetime, $priority, $mqtttopic, $mqttqos); $result = "Event updated"; } else { if ($route->action == 'delete' && $session['write']) { $id = intval(get('id')); $event->delete($userid, $id); $result = "Event deleted"; } else { if ($route->action == 'status' && $session['write']) { $id = intval(get('id')); $status = intval(get('status')); $event->set_status($userid, $id, $status); $result = "Event deleted"; } else { if ($route->action == 'test' && $session['write']) { $id = intval(get('id')); $feedid = intval(get('feedid')); $event->test($userid, $id, $feedid); $result = "Event Test Sent"; } else { if ($route->action == 'settings' && $session['write']) { $settings = $event->get_settings($session['userid']); $result = view("Modules/event/event_settings_view.php", array('settings' => $settings)); } else { if ($route->action == 'savesettings' && $session['write']) { // Store userlang in database $prowlkey = post('prowlkey'); $nmakey = post('nmakey'); $smtpserver = post('smtpserver'); $smtpuser = post('smtpuser'); $salt = $user->get_salt($session['userid']); $smtppassword = trim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $salt, post('smtppassword'), MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND)))); $smtpport = preg_replace('/[^\\w\\s-]/', '', post('smtpport')); $consumerkey = post('consumerkey'); $consumersecret = post('consumersecret'); $usertoken = post('usertoken'); $usersecret = post('usersecret'); $mqttbrokerip = post('mqttbrokerip'); $mqttbrokerport = post('mqttbrokerport'); $mqttusername = post('mqttusername'); $mqttpassword = trim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $salt, post('mqttpassword'), MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND)))); $result = $event->set_settings($session['userid'], $prowlkey, $consumerkey, $consumersecret, $usertoken, $usersecret, $smtpserver, $smtpuser, $smtppassword, $smtpport, $nmakey, $mqttbrokerip, $mqttbrokerport, $mqttusername, $mqttpassword); } else { if ($session['write']) { $list = $event->eventlist($userid); $feeds = $feed->get_user_feeds($userid); $result = view("Modules/event/event_list.php", array('event_list' => $list, 'feeds' => $feeds)); } } } } } } } return array('content' => $result); }