public function __viewIndex() { $this->setTitle(__('%1$s – %2$s', array(__('Symphony'), __('Events')))); $this->appendSubheading(__('Events'), Widget::Anchor(__('Create New'), Administration::instance()->getCurrentPageURL() . '/new/', array('title' => __('Create a new event'), 'class' => 'create button'))); $eTableHead = array(array(__('Name'), 'col'), array(__('Destination'), 'col'), array(__('Type'), 'col'), array(__('Used By'), 'col')); $eTableBody = array(); $colspan = count($eTableHead); $iterator = new EventIterator(); if (!$iterator->valid()) { $eTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), array('class' => 'inactive', 'colspan' => $colspan))), array('class' => 'odd'))); } else { // Load Views so we can determine what Datasources are attached if (!self::$_loaded_views) { foreach (new ViewIterator() as $view) { self::$_loaded_views[$view->guid] = array('title' => $view->title, 'handle' => $view->handle, 'events' => $view->{'events'}); } } foreach ($iterator as $pathname) { $event = Event::load($pathname); $view_mode = $event->allowEditorToParse() == true ? 'edit' : 'info'; $handle = Event::getHandleFromFilename($pathname); $col_name = Widget::TableData(Widget::Anchor($event->about()->name, ADMIN_URL . "/blueprints/events/{$view_mode}/{$handle}/", array('title' => $event->parameters()->pathname))); $col_name->appendChild(Widget::Input("items[{$handle}]", null, 'checkbox')); // Destination $col_destination = $event->prepareDestinationColumnValue(); // Used By $fragment_views = $this->createDocumentFragment(); foreach (self::$_loaded_views as $view) { if (is_array($view['events']) && in_array($handle, $view['events'])) { if ($fragment_views->hasChildNodes()) { $fragment_views->appendChild(new DOMText(', ')); } $fragment_views->appendChild(Widget::Anchor($view['title'], ADMIN_URL . "/blueprints/views/edit/{$view['handle']}/")); } } if (!$fragment_views->hasChildNodes()) { $col_views = Widget::TableData(__('None'), array('class' => 'inactive')); } else { $col_views = Widget::TableData($fragment_views); } // Type if (is_null($event->getType())) { $col_type = Widget::TableData(__('Unknown'), array('class' => 'inactive')); } else { $col_type = Widget::TableData($this->types[$event->getType()]->name); } $eTableBody[] = Widget::TableRow(array($col_name, $col_destination, $col_type, $col_views)); } } $table = Widget::Table(Widget::TableHead($eTableHead), null, Widget::TableBody($eTableBody), array('id' => 'events-list')); $this->Form->appendChild($table); $tableActions = $this->createElement('div'); $tableActions->setAttribute('class', 'actions'); $options = array(array(null, false, __('With Selected...')), array('delete', false, __('Delete'))); $tableActions->appendChild(Widget::Select('with-selected', $options)); $tableActions->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit')); $this->Form->appendChild($tableActions); }
function __construct($id) { $this->registration = Registration::load(array('order_id' => $id)); if (!$this->registration) { error_exit("That registration does not exist"); } $this->event = Event::load(array('registration_id' => $this->registration->registration_id)); registration_add_to_menu($this->registration); }
/** * Get list for Events * @var string $pro_uid. Uid for Process * @var string $filter. * @var string $evn_uid. Uid for Process * * @access public * @author Brayan Pereyra (Cochalo) <*****@*****.**> * @copyright Colosa - Bolivia * * @return array */ public function getEvents($pro_uid, $filter = '', $evn_uid = '') { $pro_uid = $this->validateProUid($pro_uid); if ($evn_uid != '') { $evn_uid = $this->validateEvnUid($evn_uid); } $oProcess = new \Process(); if (!$oProcess->processExists($pro_uid)) { throw new \Exception(\G::LoadTranslation("ID_PROCESS_NOT_EXIST", array('pro_uid', $pro_uid))); } $sDelimiter = \DBAdapter::getStringDelimiter(); $oCriteria = new \Criteria('workflow'); $oCriteria->addSelectColumn(\EventPeer::EVN_UID); $oCriteria->addSelectColumn(\EventPeer::EVN_ACTION); $oCriteria->addSelectColumn(\EventPeer::EVN_STATUS); $oCriteria->addSelectColumn(\EventPeer::EVN_WHEN_OCCURS); $oCriteria->addSelectColumn(\EventPeer::EVN_RELATED_TO); $oCriteria->addAsColumn('EVN_DESCRIPTION', \ContentPeer::CON_VALUE); $aConditions = array(); $aConditions[] = array(\EventPeer::EVN_UID, \ContentPeer::CON_ID); $aConditions[] = array(\ContentPeer::CON_CATEGORY, $sDelimiter . 'EVN_DESCRIPTION' . $sDelimiter); $aConditions[] = array(\ContentPeer::CON_LANG, $sDelimiter . SYS_LANG . $sDelimiter); $oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN); $oCriteria->add(\EventPeer::PRO_UID, $pro_uid); if ($evn_uid != '') { $oCriteria->add(\EventPeer::EVN_UID, $evn_uid); } switch ($filter) { case 'message': $oCriteria->add(\EventPeer::EVN_ACTION, "SEND_MESSAGE"); break; case 'conditional': $oCriteria->add(\EventPeer::EVN_ACTION, "EXECUTE_CONDITIONAL_TRIGGER"); break; case 'multiple': $oCriteria->add(\EventPeer::EVN_ACTION, "EXECUTE_TRIGGER"); break; } $eventsArray = array(); $oDataset = \EventPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $oDataset->next(); while ($aRow = $oDataset->getRow()) { $oEvent = new \Event(); $aFields = $oEvent->load($aRow['EVN_UID']); $aRow = array_merge($aRow, $aFields); $eventsArray[] = array_change_key_case($aRow, CASE_LOWER); $oDataset->next(); } if ($evn_uid != '' && empty($eventsArray)) { throw new \Exception(\G::LoadTranslation("ID_ROW_DOES_NOT_EXIST")); } elseif ($evn_uid != '' && !empty($eventsArray)) { return current($eventsArray); } return $eventsArray; }
function urlclean_plugin_link(&$events) { foreach ($events as $event) { $link = $event->getLink(); // Get article link // handle these sites: feedproxy, feedsportal, 20minutes if (preg_match('#feedproxy#', $link) or preg_match('#feedsportal#', $link) or preg_match('#20minutes#', $link)) { $events_load = new Event(); $event_load = $events_load->load(array('id' => $event->getid())); // load full event //001 - feedproxy - recherche d'une url à reconstituer du type tag:site.org,2013-05-18:finurl $link_search = $event_load->getGuid(); preg_match("#tag:([a-zA-Z.]+),[0-9a-zA-Z-]+:([0-9a-zA-Z&?=./-]+)#", $link_search, $matches); if (isset($matches[0])) { $link_search = 'http://' . $matches[1] . '/' . $matches[2]; } //001 - fin $link = urlclean_plugin_link_validurl($link_search); // get article guid as link (and check its format validity) } // if (strpos($link, 'liberation.fr//') !== FALSE) { $link = null; } // fallback to crawl to real url (slowest method and unsecure to privacy) if ($link == null && function_exists('curl_init') && !ini_get('safe_mode')) { error_log('Plugin urlClean : cUrl on ' . $event->getLink()); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $event->getLink()); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // >>> anonimization curl_setopt($ch, CURLOPT_COOKIESESSION, true); curl_setopt($ch, CURLOPT_REFERER, ''); // <<< anonimization $a = curl_exec($ch); $link = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL); } $link = preg_replace("/[&#?]xtor=(.)+/", "", $link); // remove: xtor $link = preg_replace("/utm_([^&#]|(&))+&*/", "", $link); // remove: utm_ // cleanup end of url $link = preg_replace("/\\?&/", "", $link); if (isset($link[strlen($link) - 1])) { if ($link[strlen($link) - 1] == '?') { $link = substr($link, 0, strlen($link) - 1); } } $event->setLink($link); // Set new cleaned link } }
function __construct($id, $user = null) { global $lr_session; $this->event = Event::load(array('registration_id' => $id)); $this->event_types = event_types(); if (!$this->event) { error_exit("That event does not exist"); } $this->formbuilder = $this->event->load_survey(true, $user ? $user : $lr_session->user); // Other code relies on the formbuilder variable not being set if there // are no questions. if (!count($this->formbuilder->_questions)) { unset($this->formbuilder); } event_add_to_menu($this->event); }
function url_cleanup($url = null, $event) { // handle these sites: feedproxy, feedsportal, 20minutes if (preg_match('#feedproxy#', $url) or preg_match('#feedsportal#', $url) or preg_match('#20minutes#', $url)) { $events_load = new Event(); $event_load = $events_load->load(array('id' => $event->getid())); // load full event // feedproxy: lookup at url similar to tag:site.org,2013-05-18:finurl $link_search = $event_load->getGuid(); preg_match("#tag:([a-zA-Z.]+),[0-9a-zA-Z-]+:([0-9a-zA-Z&?=./-]+)#", $link_search, $matches); if (isset($matches[0])) { $link_search = 'http://' . $matches[1] . '/' . $matches[2]; } $url = validurl($link_search); // get article guid as link (and check its format validity) } // handle special url to not process if (strpos($url, 'liberation.fr//') !== FALSE) { $url = null; } // fallback to crawl to real url (slowest method and unsecure to privacy) if ($url == null && function_exists('curl_init') && !ini_get('safe_mode')) { error_log('Plugin urlClean : cUrl on ' . $event->getLink()); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $event->getLink()); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // >>> anonimization curl_setopt($ch, CURLOPT_COOKIESESSION, true); curl_setopt($ch, CURLOPT_REFERER, ''); // <<< anonimization $a = curl_exec($ch); $url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL); } return $url; }
public static function get_from_id($id) { $event = new Event(); $event->load($id); return $event; }
alias(array('Package\\Core\\Autoloader' => 'Autoloader', 'Package\\Core\\Pulse' => 'Pulse', 'Package\\Core\\Event' => 'Event', 'Package\\Core\\Config' => 'Config', 'Package\\Core\\Input' => 'Input', 'Package\\Core\\Error' => 'Error')); } } //Run the autoloader; run_autoloader(); //Set the error reporting; set_exception_handler(array('Error', 'handle')); throw new Exception('Undefined Index : 1'); ////////////////////////////////////// // Now let's load the pulse class // ////////////////////////////////////// \Pulse::init(); ///////////////////////////////////////////////////// // Let's shut the whole system down with an event; // ///////////////////////////////////////////////////// \Event::load('shutdown'); /***********************/ //////////////////////// // The base functions // //////////////////////// if (!function_exists('logger')) { function logger($level, $msg, $method = null) { if ($level > \Config::get('log_threshold')) { return false; } !class_exists('Fuel\\Core\\Log') and import('log'); !class_exists('Log') and class_alias('Fuel\\Core\\Log', 'Log'); return \Log::write($level, $msg, $method); } }
public function saveEventPosition($sEventUID = '', $iX = 110, $iY = 60) { try { $oEvents = new Event(); $aFields = $oEvents->load($sEventUID); $aFields['EVN_UID'] = $sEventUID; $aFields['EVN_POSX'] = $iX; $aFields['EVN_POSY'] = $iY; return $oEvents->update($aFields); } catch (Exception $oError) { throw $oError; } }
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; }
function parse($syncId, &$nbEvents = 0, $enableCache = true, $forceFeed = false) { $nbEvents = 0; assert('is_int($syncId) && $syncId>0'); if (empty($this->id) || 0 == $this->id) { /* Le flux ne dispose pas pas d'id !. Ça arrive si on appelle parse() sans avoir appelé save() pour un nouveau flux. @TODO: un create() pour un nouveau flux ? */ $msg = 'Empty or null id for a feed! ' . 'See ' . __FILE__ . ' on line ' . __LINE__; error_log($msg, E_USER_ERROR); die($msg); // Arrêt, sinon création événements sans flux associé. } $feed = new SimplePie(); $feed->enable_cache($enableCache); $feed->force_feed($forceFeed); $feed->set_feed_url($this->url); $feed->set_useragent('Mozilla/4.0 Leed (LightFeed Aggregator) ' . VERSION_NAME . ' by idleman http://projet.idleman.fr/leed'); if (!$feed->init()) { $this->error = $feed->error; $this->lastupdate = $_SERVER['REQUEST_TIME']; $this->save(); return false; } $feed->handle_content_type(); // UTF-8 par défaut pour SimplePie if ($this->name == '') { $this->name = $feed->get_title(); } if ($this->name == '') { $this->name = $this->url; } $this->website = $feed->get_link(); $this->description = $feed->get_description(); $items = $feed->get_items(); $eventManager = new Event(); $events = array(); $iEvents = 0; foreach ($items as $item) { // Ne retient que les 100 premiers éléments de flux. if ($iEvents++ >= 100) { break; } // Si le guid existe déjà, on évite de le reparcourir. $alreadyParsed = $eventManager->load(array('guid' => $item->get_id(), 'feed' => $this->id)); if (isset($alreadyParsed) && $alreadyParsed != false) { $events[] = $alreadyParsed->getId(); continue; } // Initialisation des informations de l'événement (élt. de flux) $event = new Event(); $event->setSyncId($syncId); $event->setGuid($item->get_id()); $event->setTitle($item->get_title()); $event->setPubdate($item->get_date()); $event->setCreator('' == $item->get_author() ? '' : $item->get_author()->name); $event->setLink($item->get_permalink()); $event->setFeed($this->id); $event->setUnread(1); // inexistant, donc non-lu //Gestion de la balise enclosure pour les podcasts et autre cochonneries :) $enclosure = $item->get_enclosure(); if ($enclosure != null && $enclosure->link != '') { $enclosureName = substr($enclosure->link, strrpos($enclosure->link, '/') + 1, strlen($enclosure->link)); $enclosureArgs = strpos($enclosureName, '?'); if ($enclosureArgs !== false) { $enclosureName = substr($enclosureName, 0, $enclosureArgs); } $enclosureFormat = isset($enclosure->handler) ? $enclosure->handler : substr($enclosureName, strrpos($enclosureName, '.') + 1); $enclosure = '<div class="enclosure"><h1>Fichier média :</h1><a href="' . $enclosure->link . '"> ' . $enclosureName . '</a> <span>(Format ' . strtoupper($enclosureFormat) . ', ' . Functions::convertFileSize($enclosure->length) . ')</span></div>'; } else { $enclosure = ''; } $event->setContent($item->get_content() . $enclosure); $event->setDescription($item->get_description() . $enclosure); if (trim($event->getDescription()) == '') { $event->setDescription(substr($event->getContent(), 0, 300) . '…<br><a href="' . $event->getLink() . '">Lire la suite de l\'article</a>'); } if (trim($event->getContent()) == '') { $event->setContent($event->getDescription()); } $event->setCategory($item->get_category()); $event->save(); $nbEvents++; } $listid = ""; foreach ($events as $item) { $listid .= ',' . $item; } $query = 'UPDATE `' . MYSQL_PREFIX . 'event` SET syncId=' . $syncId . ' WHERE id in (0' . $listid . ');'; $myQuery = $this->customQuery($query); $this->lastupdate = $_SERVER['REQUEST_TIME']; $this->save(); return true; }
* it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 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. */ global $RBAC; if ($RBAC->userCanAccess('PM_SETUP') != 1) { G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::header('location: ../login/login'); die; } $eventInstance = new Event(); $eventFields = $eventInstance->load($_POST['EVN_UID']); $proUid = $eventFields['PRO_UID']; $infoProcess = new Process(); $resultProcess = $infoProcess->load($proUid); G::auditLog('DeleteEvent', 'Delete event (' . $_POST['EVN_UID'] . ') in process "' . $resultProcess['PRO_TITLE'] . '"'); $evnUid = $_POST['EVN_UID']; require_once 'classes/model/Event.php'; $oEvent = new Event(); $oEvent->remove($evnUid);
<?php try { G::LoadClass('processMap'); $oProcessMap = new processMap(new DBConnection()); if (isset($_GET['eid'])) { //Getting available Steps Criteria that have been not selected for a particular task require_once "classes/model/Event.php"; $oEvent = new Event(); $oData = $oEvent->load($_GET['eid']); $sch_uid = $oData['EVN_ACTION']; if ($sch_uid != '') { $rows = $oProcessMap->caseNewSchedulerList($sch_uid); if ($rows['SCH_OPTION'] == '3') { $sch_start_day = explode('|', $rows['SCH_START_DAY']); $count = count($sch_start_day); switch ($count) { case 1: $rows['SCH_START_DAY'] = $sch_start_day[0]; break; case 2: $rows['SCH_START_DAY'] = $sch_start_day[0]; $rows['SCH_START_DAY_OPT_2_WEEKS'] = $sch_start_day[1]; break; case 3: $rows['SCH_START_DAY'] = $sch_start_day[0]; $rows['SCH_START_DAY_OPT_2_WEEKS'] = $sch_start_day[1]; $rows['SCH_START_DAY_OPT_2_DAYS_WEEK'] = $sch_start_day[2]; break; } }
/** * Checks information received from PayPal to ensure it's correct data. * If correct, stores updated transaction details. * * @param int $order_id Registration # of event being paid * @param float $mc_gross Amount paid by user during the PayPal checkout * @param int $paid_by User ID of player who made the payment */ function validatePayment($order_id, $mc_gross, $paid_by) { // is the item number a valid registration? $registration = Registration::load(array('order_id' => $order_id)); if (!$registration) { $status = array('status' => false, 'message' => 'Invalid Registration ID'); return $status; } // has registration been already paid? //if ($registration->payment_type == 'Paid') { // $status = array('status' => false, 'message' =>'Registration '.$order_id.' already paid in full'); // return $status; //} // is the registration attached to the correct Event $event = Event::load(array('registration_id' => $registration->registration_id)); if (!$event) { $status = array('status' => false, 'message' => 'Invalid Event ID'); return $status; } // does the price paid and registration cost match? if ($mc_gross != $event->cost) { $status = array('status' => false, 'message' => 'Amount Paid does not match Registration Cost'); return $status; } // Payment is valid, and should be saved $payment = new RegistrationPayment(); $payment->set('order_id', $registration->order_id); // TODO: PDT returns from PayPal are logged under the Paypal account. // Would be nice to find a better way to do this instead of a Paypal user account $payment->set('entered_by', 999); // assign requrired values to the RegistrationPayment from the talkback results $payment->set('payment_type', 'Full'); $payment->set('payment_amount', $mc_gross); $payment->set('payment_method', 'PayPal'); $payment->set('paid_by', $paid_by); $payment->set('date_paid', date("Y-m-d")); // Save the payment if it's not already stored in the database // It's possible that the IPN payment beats the user PDT return. // Still need to ensure user is informed correctly, while not displaying any errors. if ($registration->payment_type != 'Paid') { if (!$payment->save()) { $status = array('status' => false, message => "Couldn't save payment to database"); return $status; } // update registration in question $registration->set('payment', 'Paid'); if (!$registration->save()) { $status = array('status' => false, message => "Internal error: couldn't save changes to registration"); } } // if successful, return the $payment to handle/display to user return array('status' => true, 'message' => $payment); }
function checkCredentials($params) { require_once 'classes/model/Event.php'; require_once 'classes/model/Users.php'; require_once 'classes/model/TaskUser.php'; require_once 'classes/model/GroupUser.php'; $sPRO_UID = $params->PRO_UID; $sEVN_UID = $params->EVN_UID; $sWS_USER = trim($params->WS_USER); $sWS_PASS = trim($params->WS_PASS); if (G::is_https()) { $http = 'https://'; } else { $http = 'http://'; } $endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; @($client = new SoapClient($endpoint)); $user = $sWS_USER; $pass = $sWS_PASS; $parameters = array('userid' => $user, 'password' => $pass); $result = $client->__SoapCall('login', array($parameters)); $fields['status_code'] = $result->status_code; $fields['message'] = 'ProcessMaker WebService version: ' . $result->version . "\n" . $result->message; $fields['version'] = $result->version; $fields['time_stamp'] = $result->timestamp; $messageCode = true; $message = $result->message; G::LoadClass('Task'); //G::LoadClass ( 'Event' ); G::LoadClass('User'); G::LoadClass('TaskUser'); G::LoadClass('Groupwf'); $event = new Event(); $event->load($sEVN_UID); $sTASKS = $event->getEvnTasUidTo(); $task = new Task(); $task->load($sTASKS); $sTASKS_SEL = $task->getTasTitle(); if (!class_exists('GroupUser')) { G::LoadClass('GroupUser'); } // if the user has been authenticated, then check if has the rights or // permissions to create the webentry if ($result->status_code == 0) { $oCriteria = new Criteria('workflow'); $oCriteria->addSelectColumn(UsersPeer::USR_UID); $oCriteria->addSelectColumn(TaskUserPeer::USR_UID); $oCriteria->addSelectColumn(TaskUserPeer::TAS_UID); $oCriteria->addJoin(TaskUserPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN); $oCriteria->add(TaskUserPeer::TAS_UID, $sTASKS); $oCriteria->add(UsersPeer::USR_USERNAME, $sWS_USER); //$oCriteria->add(TaskUserPeer::TU_RELATION,1); $userIsAssigned = TaskUserPeer::doCount($oCriteria); // if the user is not assigned directly, maybe a have the task a group with the user if ($userIsAssigned < 1) { $oCriteria = new Criteria('workflow'); $oCriteria->addSelectColumn(UsersPeer::USR_UID); $oCriteria->addJoin(UsersPeer::USR_UID, GroupUserPeer::USR_UID, Criteria::LEFT_JOIN); $oCriteria->addJoin(GroupUserPeer::GRP_UID, TaskUserPeer::USR_UID, Criteria::LEFT_JOIN); $oCriteria->add(TaskUserPeer::TAS_UID, $sTASKS); $oCriteria->add(UsersPeer::USR_USERNAME, $sWS_USER); $userIsAssigned = GroupUserPeer::doCount($oCriteria); if (!($userIsAssigned >= 1)) { $messageCode = false; $message = "The User \"" . $sWS_USER . "\" doesn't have the task \"" . $sTASKS_SEL . "\" assigned."; } } } else { $messageCode = false; } $this->success = $messageCode; $this->msg = $message; }
public static function delete(Section $section) { /* TODO: Upon deletion it should update all data-sources/events attached to it. Either by deleting them, or making section $unknown. I think deletion is best because if the section is renamed, the rename() function will take care of moving the dependancies, so there should be no data-sources/events to delete anyway. However, if you delete page accidentally (hm, even though you clicked confirm), do you really want your data-sources/events to just be deleted? Verdict? */ // Remove fields: foreach ($section->fields as $field) { $field->remove(); } // Remove sync data: Symphony::Database()->delete('tbl_sections_sync', array($section->guid), '`section` = "%s"'); // Remove entry metadata Symphony::Database()->delete('tbl_entries', array($section->handle), '`section` = "%s"'); if (General::deleteFile(SECTIONS . '/' . $section->handle . '.xml')) { // Cleanup Datasources foreach (new DataSourceIterator() as $datasource) { $ds = DataSource::load($datasource); if ($ds->parameters()->section == $section->handle) { DataSource::delete($ds); } } // Cleanup Events foreach (new EventIterator() as $event) { $ev = Event::load($event); if ($ev->parameters()->source == $section->handle) { Event::delete($ev); } } } }
public function testAddUpdateDeleteEvent() { // Dal::register_query_callback("explain_query"); echo "getting a user\n"; $user = Test::get_test_user(); $testusername = $user->first_name . " " . $user->last_name; echo "test user = {$testusername}\n"; /* setup some times and time strings */ $today = mktime(0, 0, 0, date("m"), date("d"), date("Y")); $tomorrow = mktime(0, 0, 0, date("m"), date("d") + 1, date("Y")); $yesterday = mktime(0, 0, 0, date("m"), date("d") - 1, date("Y")); $lastmonth = mktime(0, 0, 0, date("m") - 1, date("d"), date("Y")); $nextmonth = mktime(0, 0, 0, date("m") + 1, date("d"), date("Y")); $nextyear = mktime(0, 0, 0, date("m"), date("d"), date("Y") + 1); $oneday = 60 * 60 * 24; $simple_dateformat = "Y-m-d"; /* use the constants in the format parameter */ // something like: Mon, 15 Aug 2005 15:12:46 UTC $now_rfc822 = date(DATE_RFC822); // something like: 2000-07-01T00:00:00+00:00 // $now_atom = date(DATE_ATOM); // create an Event echo "create and save Event\n"; $e = new Event(); $e->content_id = "http://myevent.info/1"; // anything basically $e->user_id = $user->user_id; $e->event_title = "Test Event for {$testusername}"; $now = time(); $nowplusoneday = $now + $oneday; $e->start_time = date(DATE_ATOM, $now); $e->end_time = date(DATE_ATOM, $now + 60 * 60); // duration 1h $e->event_data = array('description' => "This Event takes place to test the class Event", 'start' => $now, 'end' => $now + 60 * 60); $e->save(); // print_r($e); // see if we got it echo "Retrieving Event {$e->event_id}\n"; $e2 = new Event(); $e2->load($e->event_id); echo "Testing integrity of dates\n"; // print_r($e2); // see if the stored timestamps match $this->assertEquals($now, $e2->event_data['start']); // see if our dates survived the DB conversion roundtrip $this->assertEquals($now, strtotime($e2->start_time)); $this->assertEquals($now + 60 * 60, strtotime($e2->end_time)); // create two EventAssociations $ea1 = new EventAssociation(); $ea2 = new EventAssociation(); $ea1->user_id = $user->user_id; $ea2->user_id = $user->user_id; // user EventAssocoiation $ea1->assoc_target_type = 'user'; $ea1->assoc_target_id = $user->user_id; // could very well be other user $ea1->assoc_target_name = $testusername; $ea1->event_id = $e->event_id; $ea1->save(); // network EventAssocoiation // find a network the user is member of // $networks = Network::get_user_networks($user->user_id); $network = Network::get_mothership_info(); // use the mothership // print_r($network); $ea2->assoc_target_type = 'network'; $ea2->assoc_target_id = $network->network_id; // could very well be other user $ea2->assoc_target_name = $network->name; $ea2->event_id = $e->event_id; $ea2->save(); echo "Testing EventAssociations for Event {$e->event_id}\n"; $assoc_ids = EventAssociation::find_for_event($e->event_id); // print_r($assoc_ids); $a_cnt = count($assoc_ids); $this->assertEquals($a_cnt, 2, "expected 2 assocs, got {$a_cnt}\n"); echo "Testing EventAssociations::find_for_target_and_delta for Network\n"; $assoc_ids = EventAssociation::find_for_target_and_delta('network', $network->network_id); // find_for_target_and_delta($target_type, $target_id, $range_start = NULL, $range_end = NULL) // print_r($assoc_ids); $a_cnt = count($assoc_ids); // we expect at least one (or more, the user might have others too) $this->assertTrue($a_cnt >= 1, "expected 1 or more assocs, got {$a_cnt}\n"); echo "Testing EventAssociations::find_for_target_and_delta for Today\n"; /* echo "yesterday = " . date(DATE_ATOM, $yesterday) . "\n"; echo "today = " . date(DATE_ATOM, $today) . "\n"; echo "event start_time = " . date(DATE_ATOM, strtotime($e2->start_time)) . "\n"; echo "event end_time = " . date(DATE_ATOM, strtotime($e2->end_time)) . "\n"; echo "tomorrow = " . date(DATE_ATOM, $tomorrow) . "\n"; */ $assoc_ids = EventAssociation::find_for_target_and_delta('network', $network->network_id, date(DATE_ATOM, $today), date(DATE_ATOM, $tomorrow)); print_r($assoc_ids); /* $assocs = EventAssociation::load_in_list($assoc_ids); print_r($assocs); */ $a_cnt = count($assoc_ids); // we expect at least one (or more, the user might have others too) $this->assertTrue($a_cnt >= 1, "expected 1 or more assocs, got {$a_cnt}\n"); echo "Testing if the EventAssociations now show up in Tomorrow's Calendar\n"; $assoc_ids = EventAssociation::find_for_target_and_delta('network', $network->network_id, date(DATE_ATOM, $tomorrow), date(DATE_ATOM, $tomorrow + $oneday)); print_r($assoc_ids); $a_cnt2 = count($assoc_ids); // we expect one less than before $this->assertTrue($a_cnt2 < $a_cnt, "expected " . $a_cnt - 1 . " assocs, got {$a_cnt2}\n"); echo "Modifying original Event\n"; $e2->title = "changed title"; $e2->end_time = date(DATE_ATOM, $nextmonth); $e2->save(); // see if we got it $e3 = new Event(); $e3->load($e->event_id); echo "Testing integrity of dates again in the Event\n"; // see if our dates survived the DB conversion roundtrip $this->assertEquals($now, strtotime($e3->start_time)); $this->assertEquals(date(DATE_ATOM, strtotime($e3->end_time)), date(DATE_ATOM, $nextmonth)); echo "Testing if modified dates made it to the EventAssociations\n"; $assoc_ids = EventAssociation::find_for_event($e3->event_id); $assocs = EventAssociation::load_in_list($assoc_ids); echo "e3 end_time: " . date(DATE_ATOM, strtotime($assocs[0]->end_time)) . "\nnextmonth: " . date(DATE_ATOM, $nextmonth) . "\n"; $this->assertEquals(date(DATE_ATOM, strtotime($assocs[0]->end_time)), date(DATE_ATOM, $nextmonth)); echo "Testing if the EventAssociations now show up in Tomorrow's Calendar\n"; echo "test range: " . date(DATE_ATOM, $tomorrow) . " - " . date(DATE_ATOM, $tomorrow + $oneday) . "\n"; echo "event duration: " . date(DATE_ATOM, strtotime($e3->start_time)) . " - " . date(DATE_ATOM, strtotime($e3->end_time)) . "\n"; // print_r($e3); $assoc_ids = EventAssociation::find_for_target_and_delta('network', $network->network_id, date(DATE_ATOM, $tomorrow), date(DATE_ATOM, $tomorrow + $oneday)); print_r($assoc_ids); $a_cnt = count($assoc_ids); // we expect at least one (or more, the user might have others too) $this->assertTrue($a_cnt >= 1, "expected 1 or more assocs, got {$a_cnt}\n"); echo "Deleting Event {$e->event_id}\n"; Event::delete($e->event_id); // try loading $this->assertNull($e3->load($e->event_id)); echo "Testing if all EventAssociations have been removed\n"; $assoc_ids = EventAssociation::find_for_event($e->event_id); $a_cnt = count($assoc_ids); $this->assertEquals($a_cnt, 0, "expected 0 assocs, got {$a_cnt}\n"); }
if ($RBAC->userCanAccess('PM_SETUP') != 1) { G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::header('location: ../login/login'); die; } if (isset($_SESSION['EVN_UID'])) { $evnUid = $_SESSION['EVN_UID']; unset($_SESSION['EVN_UID']); } else { $evnUid = $_GET['EVN_UID']; } require_once 'classes/model/Event.php'; require_once 'classes/model/Triggers.php'; $oEvent = new Event(); $oTrigger = new Triggers(); $aFields = $oEvent->load($evnUid); $parameters = unserialize($oEvent->getEvnActionParameters()); //g::pr($parameters); die; $aTrigger = $oTrigger->load($aFields['TRI_UID']); $hash = md5($oTrigger->getTriWebbot()); //var_dump($hash,$parameters->hash);die; //if the hash is different, the script was edited , so we will show the trigger editor. if (isset($parameters->hash) && $hash != $parameters->hash || $aFields['EVN_ACTION'] == 'EXECUTE_TRIGGER' || $aFields['EVN_ACTION'] == 'EXECUTE_CONDITIONAL_TRIGGER') { $oTriggerParams = unserialize($aTrigger['TRI_PARAM']); // check again a hash, this time to check the trigger itself integrity if ($oTriggerParams['hash'] != $hash) { // if has changed edit manually G::LoadClass('xmlfield_InputPM'); $G_PUBLISH = new Publisher(); $G_PUBLISH->AddContent('xmlform', 'xmlform', 'triggers/triggersNarrowEdit', '', $aTrigger, '../events/triggersSave'); G::RenderPage('publish', 'raw');
/** * This function create transitions from the array transitions for the new processmap * @param array $task * @param array $routes * @param array $events * @param array $countEvents * @param array $arrayRoutes * @param array $countRoutes * @return array */ function createTransitionsPM($tasks, $routes, $events, $countEvents, $arrayRoutes, $countRoutes) { $cont = 0; $dataRoutes = ''; $endEvent = 1; $taskParallel = ''; $routeParallel = ''; $taskSecJoin = ''; $routeSecJoin = ''; $taskDiscriminator = ''; $taskEvaluate = ''; $routeEvaluate = ''; $taskParallelEv = ''; $routeParallelEv = ''; $taskSelect = ''; $routeSelect = ''; $routeEnd = ''; $arraySecJoin = array(); $position = 0; $fillColor = ''; $transitions = ''; $arrayGateways = array(); $countG = 0; $gatPosX = 0; $gatPosY = 0; foreach ($routes as $key => $row) { if ($row['ROU_TYPE'] == 'SEC-JOIN') { $arraySecJoin[$position] = array(); $arraySecJoin[$position] = $row; $position = $position + 1; unset($routes[$key]); } } $aux = $arraySecJoin; foreach ($arraySecJoin as $key => $row) { $aux[$key] = $row['ROU_NEXT_TASK']; } if (sizeof($arraySecJoin) > 0) { array_multisort($aux, SORT_ASC, $arraySecJoin); unset($aux); } foreach ($routes as $key => $row) { $uid[$key] = $row['TAS_UID']; $case[$key] = $row['ROU_CASE']; } if (sizeof($routes) > 0) { array_multisort($uid, SORT_ASC, $case, SORT_ASC, $routes); } $routes = array_merge($routes, $arraySecJoin); foreach ($routes as $key => $val) { $end = 0; $idRoute = $val['ROU_UID']; $idTask = $val['TAS_UID']; $nextTask = $val['ROU_NEXT_TASK']; $condition = htmlentities($val['ROU_CONDITION']); $toPort = $val['ROU_TO_PORT']; $fromPort = $val['ROU_FROM_PORT']; //If End Event if ($nextTask == "-1") { $end = 1; } $typeRoute = $val['ROU_TYPE']; $route = ''; //Get GAT_UID from ROUTE table based on ROU_UID $oRoute = new Route(); $aRouteDetails = $oRoute->load($idRoute); $sGateUID = $aRouteDetails['GAT_UID']; //Get Gateway details from above GAT_UID $oGateway = new Gateway(); if ($sGateUID != '') { $aGatewayDetails = $oGateway->load($sGateUID); $gatPosX = $aGatewayDetails['GAT_X']; $gatPosY = $aGatewayDetails['GAT_Y']; } //if route is of SEQUENTIAL type,assign route id to GAT_UID if ($sGateUID == '') { $sGateUID = $idRoute; } if ($typeRoute != "SEQUENTIAL") { switch ($typeRoute) { case 'PARALLEL': $coordinateX = 0; $coordinateY = 0; foreach ($tasks as $taskVal => $idVal) { if ($idVal['TAS_UID'] == $idTask) { $coordinateX = $idVal['TAS_POSX'] + 60; $coordinateY = $idVal['TAS_POSY'] + 60; $tas_width = $idVal['TAS_WIDTH']; $tas_height = $idVal['TAS_HEIGHT']; } } $positionX = $coordinateX + 62; $positionY = $coordinateY + 55; if ($idTask != $taskParallel) { $taskParallel = $idTask; $routeParallel = $sGateUID; $arrayGateways[$countG]['0'] = $sGateUID; $arrayGateways[$countG]['1'] = 'bpmnGatewayParallel'; $arrayGateways[$countG]['2'] = $gatPosX; $arrayGateways[$countG]['3'] = $gatPosY; $countG = $countG + 1; $arrayRoutes[$countRoutes]['0'] = G::generateUniqueID(); $arrayRoutes[$countRoutes]['1'] = $taskParallel; $arrayRoutes[$countRoutes]['2'] = $routeParallel; $arrayRoutes[$countRoutes]['3'] = '1'; $arrayRoutes[$countRoutes]['4'] = '2'; $countRoutes = $countRoutes + 1; $arrayRoutes[$countRoutes]['0'] = G::generateUniqueID(); $arrayRoutes[$countRoutes]['1'] = $routeParallel; $arrayRoutes[$countRoutes]['2'] = $nextTask; $arrayRoutes[$countRoutes]['3'] = '1'; $arrayRoutes[$countRoutes]['4'] = '2'; $countRoutes = $countRoutes + 1; } else { $arrayRoutes[$countRoutes]['0'] = G::generateUniqueID(); $arrayRoutes[$countRoutes]['1'] = $routeParallel; $arrayRoutes[$countRoutes]['2'] = $nextTask; $arrayRoutes[$countRoutes]['3'] = '1'; $arrayRoutes[$countRoutes]['4'] = '2'; $countRoutes = $countRoutes + 1; } break; case 'SEC-JOIN': $coordinateX = 0; $coordinateY = 0; foreach ($tasks as $taskVal => $idVal) { if ($idVal['TAS_UID'] == $nextTask) { $coordinateX = $idVal['TAS_POSX'] + 60; $coordinateY = $idVal['TAS_POSY'] + 60; $tas_width = $idVal['TAS_WIDTH']; $tas_height = $idVal['TAS_HEIGHT']; } } $positionX = $coordinateX + 60; $positionY = $coordinateY - 45; if ($nextTask != $taskSecJoin) { $taskSecJoin = $nextTask; $routeSecJoin = $sGateUID; $arrayGateways[$countG]['0'] = $sGateUID; $arrayGateways[$countG]['1'] = 'bpmnGatewayParallel'; $arrayGateways[$countG]['2'] = $gatPosX; $arrayGateways[$countG]['3'] = $gatPosY; $countG = $countG + 1; $arrayRoutes[$countRoutes]['0'] = G::generateUniqueID(); $arrayRoutes[$countRoutes]['1'] = $routeSecJoin; $arrayRoutes[$countRoutes]['2'] = $taskSecJoin; $arrayRoutes[$countRoutes]['3'] = '1'; $arrayRoutes[$countRoutes]['4'] = '2'; $countRoutes = $countRoutes + 1; $arrayRoutes[$countRoutes]['0'] = G::generateUniqueID(); $arrayRoutes[$countRoutes]['1'] = $idTask; $arrayRoutes[$countRoutes]['2'] = $routeSecJoin; $arrayRoutes[$countRoutes]['3'] = '1'; $arrayRoutes[$countRoutes]['4'] = '2'; $countRoutes = $countRoutes + 1; } else { $arrayRoutes[$countRoutes]['0'] = G::generateUniqueID(); $arrayRoutes[$countRoutes]['1'] = $idTask; $arrayRoutes[$countRoutes]['2'] = $routeSecJoin; $arrayRoutes[$countRoutes]['3'] = '1'; $arrayRoutes[$countRoutes]['4'] = '2'; $countRoutes = $countRoutes + 1; } break; case 'EVALUATE': $coordinateX = 0; $coordinateY = 0; foreach ($tasks as $taskVal => $idVal) { if ($idVal['TAS_UID'] == $idTask) { $coordinateX = $idVal['TAS_POSX'] + 60; $coordinateY = $idVal['TAS_POSY'] + 60; $tas_width = $idVal['TAS_WIDTH']; $tas_height = $idVal['TAS_HEIGHT']; } } $positionX = $coordinateX + 62; $positionY = $coordinateY + 55; if ($idTask != $taskEvaluate) { $taskEvaluate = $idTask; $routeEvaluate = $sGateUID; if ($nextTask != "-1") { $arrayGateways[$countG]['0'] = $sGateUID; $arrayGateways[$countG]['1'] = 'bpmnGatewayExclusiveData'; $arrayGateways[$countG]['2'] = $gatPosX; $arrayGateways[$countG]['3'] = $gatPosY; $countG = $countG + 1; $arrayRoutes[$countRoutes]['0'] = G::generateUniqueID(); $arrayRoutes[$countRoutes]['1'] = $taskEvaluate; $arrayRoutes[$countRoutes]['2'] = $routeEvaluate; $arrayRoutes[$countRoutes]['3'] = '1'; $arrayRoutes[$countRoutes]['4'] = '2'; $countRoutes = $countRoutes + 1; $arrayRoutes[$countRoutes]['0'] = G::generateUniqueID(); $arrayRoutes[$countRoutes]['1'] = $routeEvaluate; $arrayRoutes[$countRoutes]['2'] = $nextTask; $arrayRoutes[$countRoutes]['3'] = '1'; $arrayRoutes[$countRoutes]['4'] = '2'; $countRoutes = $countRoutes + 1; } } else { if ($nextTask != "-1") { $arrayRoutes[$countRoutes]['0'] = G::generateUniqueID(); $arrayRoutes[$countRoutes]['1'] = $routeEvaluate; $arrayRoutes[$countRoutes]['2'] = $nextTask; $arrayRoutes[$countRoutes]['3'] = '1'; $arrayRoutes[$countRoutes]['4'] = '2'; $countRoutes = $countRoutes + 1; } else { $routeEnd = $routeEvaluate; } } break; case 'PARALLEL-BY-EVALUATION': $coordinateX = 0; $coordinateY = 0; foreach ($tasks as $taskVal => $idVal) { if ($idVal['TAS_UID'] == $idTask) { $coordinateX = $idVal['TAS_POSX'] + 60; $coordinateY = $idVal['TAS_POSY'] + 60; $tas_width = $idVal['TAS_WIDTH']; $tas_height = $idVal['TAS_HEIGHT']; } } $positionX = $coordinateX + 62; $positionY = $coordinateY + 55; if ($idTask != $taskParallelEv) { $taskParallelEv = $idTask; $routeParallelEv = $sGateUID; $arrayGateways[$countG]['0'] = $sGateUID; $arrayGateways[$countG]['1'] = 'bpmnGatewayInclusive'; $arrayGateways[$countG]['2'] = $gatPosX; $arrayGateways[$countG]['3'] = $gatPosY; $countG = $countG + 1; $arrayRoutes[$countRoutes]['0'] = G::generateUniqueID(); $arrayRoutes[$countRoutes]['1'] = $taskParallelEv; $arrayRoutes[$countRoutes]['2'] = $routeParallelEv; $arrayRoutes[$countRoutes]['3'] = '1'; $arrayRoutes[$countRoutes]['4'] = '2'; $countRoutes = $countRoutes + 1; $arrayRoutes[$countRoutes]['0'] = G::generateUniqueID(); $arrayRoutes[$countRoutes]['1'] = $routeParallelEv; $arrayRoutes[$countRoutes]['2'] = $nextTask; $arrayRoutes[$countRoutes]['3'] = '1'; $arrayRoutes[$countRoutes]['4'] = '2'; $countRoutes = $countRoutes + 1; } else { $arrayRoutes[$countRoutes]['0'] = G::generateUniqueID(); $arrayRoutes[$countRoutes]['1'] = $routeParallelEv; $arrayRoutes[$countRoutes]['2'] = $nextTask; $arrayRoutes[$countRoutes]['3'] = '1'; $arrayRoutes[$countRoutes]['4'] = '2'; $countRoutes = $countRoutes + 1; } break; case 'SELECT': $coordinateX = 0; $coordinateY = 0; foreach ($tasks as $taskVal => $idVal) { if ($idVal['TAS_UID'] == $idTask) { $coordinateX = $idVal['TAS_POSX'] + 60; $coordinateY = $idVal['TAS_POSY'] + 60; $tas_width = $idVal['TAS_WIDTH']; $tas_height = $idVal['TAS_HEIGHT']; } } $positionX = $coordinateX + 60; $positionY = $coordinateY + 40; if ($idTask != $taskSelect) { $taskSelect = $idTask; $routeSelect = $sGateUID; $arrayGateways[$countG]['0'] = $sGateUID; $arrayGateways[$countG]['1'] = 'bpmnGatewayExclusiveData'; $arrayGateways[$countG]['2'] = $gatPosX; $arrayGateways[$countG]['3'] = $gatPosY; $countG = $countG + 1; $arrayRoutes[$countRoutes]['0'] = G::generateUniqueID(); $arrayRoutes[$countRoutes]['1'] = $taskSelect; $arrayRoutes[$countRoutes]['2'] = $routeSelect; $arrayRoutes[$countRoutes]['3'] = '1'; $arrayRoutes[$countRoutes]['4'] = '2'; $countRoutes = $countRoutes + 1; $arrayRoutes[$countRoutes]['0'] = G::generateUniqueID(); $arrayRoutes[$countRoutes]['1'] = $routeSelect; $arrayRoutes[$countRoutes]['2'] = $nextTask; $arrayRoutes[$countRoutes]['3'] = '1'; $arrayRoutes[$countRoutes]['4'] = '2'; $countRoutes = $countRoutes + 1; } else { if ($nextTask != "-1") { $arrayRoutes[$countRoutes]['0'] = G::generateUniqueID(); $arrayRoutes[$countRoutes]['1'] = $routeSelect; $arrayRoutes[$countRoutes]['2'] = $nextTask; $arrayRoutes[$countRoutes]['3'] = '1'; $arrayRoutes[$countRoutes]['4'] = '2'; $countRoutes = $countRoutes + 1; } else { $routeEnd = $routeSelect; } } break; case 'DISCRIMINATOR': $coordinateX = 0; $coordinateY = 0; $optional = $val['ROU_OPTIONAL']; foreach ($tasks as $taskVal => $idVal) { if ($idVal['TAS_UID'] == $nextTask) { $coordinateX = $idVal['TAS_POSX'] + 60; $coordinateY = $idVal['TAS_POSY'] + 60; $tas_width = $idVal['TAS_WIDTH']; $tas_height = $idVal['TAS_HEIGHT']; } } $positionX = $coordinateX + 60; $positionY = $coordinateY - 45; if ($nextTask != $taskDiscriminator) { $taskDiscriminator = $nextTask; $routeDiscriminator = $sGateUID; $arrayGateways[$countG]['0'] = $sGateUID; $arrayGateways[$countG]['1'] = 'bpmnGatewayComplex'; $arrayGateways[$countG]['2'] = $gatPosX; $arrayGateways[$countG]['3'] = $gatPosY; $countG = $countG + 1; $arrayRoutes[$countRoutes]['0'] = G::generateUniqueID(); $arrayRoutes[$countRoutes]['1'] = $routeDiscriminator; $arrayRoutes[$countRoutes]['2'] = $taskDiscriminator; $arrayRoutes[$countRoutes]['3'] = '1'; $arrayRoutes[$countRoutes]['4'] = '2'; $countRoutes = $countRoutes + 1; $arrayRoutes[$countRoutes]['0'] = G::generateUniqueID(); $arrayRoutes[$countRoutes]['1'] = $idTask; $arrayRoutes[$countRoutes]['2'] = $routeDiscriminator; $arrayRoutes[$countRoutes]['3'] = '1'; $arrayRoutes[$countRoutes]['4'] = '2'; $countRoutes = $countRoutes + 1; } else { $arrayRoutes[$countRoutes]['0'] = G::generateUniqueID(); $arrayRoutes[$countRoutes]['1'] = $idTask; $arrayRoutes[$countRoutes]['2'] = $routeDiscriminator; $arrayRoutes[$countRoutes]['3'] = '1'; $arrayRoutes[$countRoutes]['4'] = '2'; $countRoutes = $countRoutes + 1; } break; } } if ($end == 1) { if ($typeRoute == "SEQUENTIAL") { $coordinateX = 0; $coordinateY = 0; foreach ($tasks as $taskVal => $idVal) { if ($idVal['TAS_UID'] == $idTask) { $coordinateX = $idVal['TAS_POSX']; $coordinateY = $idVal['TAS_POSY']; $tas_width = $idVal['TAS_WIDTH']; $tas_height = $idVal['TAS_HEIGHT']; $tas_uid = $idVal['TAS_UID']; } } $positionX = $coordinateX + 92; $positionY = $coordinateY + 40; $evn_uid = $val['ROU_EVN_UID']; if ($evn_uid != '') { $oEvent = new Event(); $aEvent = $oEvent->load($evn_uid); $events[$countEvents]['0'] = $evn_uid; $events[$countEvents]['1'] = $aEvent['EVN_TYPE']; $events[$countEvents]['2'] = $positionX - 25; $events[$countEvents]['3'] = $positionY + 35; $events[$countEvents]['4'] = $tas_uid; $countEvents = $countEvents + 1; $arrayRoutes[$countRoutes]['0'] = G::generateUniqueID(); $arrayRoutes[$countRoutes]['1'] = $idTask; $arrayRoutes[$countRoutes]['2'] = $evn_uid; $arrayRoutes[$countRoutes]['3'] = $toPort; $arrayRoutes[$countRoutes]['4'] = $fromPort; $arrayRoutes[$countRoutes]['5'] = $typeRoute; $countRoutes = $countRoutes + 1; $end = 0; $endEvent = 0; } } else { $coordinateX = 0; $coordinateY = 0; foreach ($tasks as $taskVal => $idVal) { if ($idVal['TAS_UID'] == $idTask) { $coordinateX = $idVal['TAS_POSX']; $coordinateY = $idVal['TAS_POSY']; $tas_width = $idVal['TAS_WIDTH']; $tas_height = $idVal['TAS_HEIGHT']; $tas_uid = $idVal['TAS_UID']; } } $positionX = $coordinateX + $tas_width / 1.5 + 19; $positionY = $coordinateY + $tas_height / 2; $idTask = $routeEnd; $arrayRoutes[$countRoutes]['0'] = G::generateUniqueID(); $arrayRoutes[$countRoutes]['1'] = $idTask; $arrayRoutes[$countRoutes]['2'] = $idRoute; $arrayRoutes[$countRoutes]['3'] = $toPort; $arrayRoutes[$countRoutes]['4'] = $fromPort; $arrayRoutes[$countRoutes]['5'] = $typeRoute; $countRoutes = $countRoutes + 1; $events[$countEvents]['0'] = $idRoute; $events[$countEvents]['1'] = 'bpmnEventEmptyEnd'; $events[$countEvents]['2'] = $positionX - 25; $events[$countEvents]['3'] = $positionY + 35; $events[$countEvents]['4'] = $tas_uid; $countEvents = $countEvents + 1; $end = 0; $endEvent = 0; } } else { if ($typeRoute == "SEQUENTIAL") { //Will Check for Intermediate Timer $evn_uid = $val['ROU_EVN_UID']; if ($evn_uid != '') { $coordinateX = 0; $coordinateY = 0; foreach ($tasks as $taskVal => $idVal) { if ($idVal['TAS_UID'] == $idTask) { $coordinateX = $idVal['TAS_POSX']; $coordinateY = $idVal['TAS_POSY']; $tas_width = $idVal['TAS_WIDTH']; $tas_height = $idVal['TAS_HEIGHT']; } } $positionX = $coordinateX + $tas_width / 1.5 + 19; $positionY = $coordinateY + $tas_height / 2; $oEvent = new Event(); $aEvent = $oEvent->load($evn_uid); $events[$countEvents]['0'] = $evn_uid; $events[$countEvents]['1'] = $aEvent['EVN_TYPE']; $events[$countEvents]['2'] = $aEvent['EVN_POSX']; $events[$countEvents]['3'] = $aEvent['EVN_POSY']; $countEvents = $countEvents + 1; $arrayRoutes[$countRoutes]['0'] = G::generateUniqueID(); $arrayRoutes[$countRoutes]['1'] = $idTask; $arrayRoutes[$countRoutes]['2'] = $evn_uid; $arrayRoutes[$countRoutes]['3'] = '1'; $arrayRoutes[$countRoutes]['4'] = '2'; $countRoutes = $countRoutes + 1; $arrayRoutes[$countRoutes]['0'] = G::generateUniqueID(); $arrayRoutes[$countRoutes]['1'] = $evn_uid; $arrayRoutes[$countRoutes]['2'] = $nextTask; $arrayRoutes[$countRoutes]['3'] = '1'; $arrayRoutes[$countRoutes]['4'] = '2'; $countRoutes = $countRoutes + 1; } else { $arrayRoutes[$countRoutes]['0'] = $idRoute; $arrayRoutes[$countRoutes]['1'] = $idTask; $arrayRoutes[$countRoutes]['2'] = $nextTask; $arrayRoutes[$countRoutes]['3'] = $toPort; $arrayRoutes[$countRoutes]['4'] = $fromPort; $countRoutes = $countRoutes + 1; } } } } $data = array(); $data['GATEWAYS'] = $arrayGateways; $data['TRANSITION'] = $arrayRoutes; $data['EVENTS'] = $events; return $data; }
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. */ global $RBAC; if ($RBAC->userCanAccess('PM_SETUP') != 1) { G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::header('location: ../login/login'); die; } G::LoadClass('tasks'); G::LoadClass('processMap'); global $_DBArray; if (isset($_GET['EVN_UID'])) { require_once 'classes/model/Event.php'; $oEvent = new Event(); $aFields = $oEvent->load($_GET['EVN_UID']); } else { $aFields = array('PRO_UID' => $_GET['PRO_UID']); } if (!isset($_SESSION['PROCESS'])) { if (isset($aFields['PRO_UID'])) { $_SESSION['PROCESS'] = $aFields['PRO_UID']; } } $oTasks = new Tasks(); $aAux1 = $oTasks->getAllTasks($aFields['PRO_UID']); $aTasks = array(); $aTasks[] = array('TAS_UID' => 'char', 'TAS_TITLE' => 'char'); foreach ($aAux1 as $aAux2) { if ($aAux2['TAS_TYPE'] != 'SUBPROCESS') { $aTasks[] = array('TAS_UID' => $aAux2['TAS_UID'], 'TAS_TITLE' => $aAux2['TAS_TITLE']);
<?php try { G::LoadClass('processMap'); $oProcessMap = new processMap(new DBConnection()); if (isset($_GET['startInterId'])) { //Getting available Steps Criteria that have been not selected for a particular task require_once "classes/model/Event.php"; $oEvent = new Event(); $aRows = $oEvent->load($_GET['startInterId']); //$sch_uid = $oData['EVN_ACTION']; $result = G::json_encode($aRows); $result = str_replace("\\/", "/", '{success:true,data:' . $result . '}'); // unescape the slashes /*else { $result = '{failure:true}'; // unescape the slashes }*/ echo $result; } //print G::json_encode( $result ) ; } catch (Exception $e) { print G::json_encode($e->getMessage()); }
/** * Gets the Event rows from a process and returns those in an array. * * @param $sProUid string for the process Uid * @return $aEvent array */ public function getEventRow ($sProUid) { try { $aEvent = array (); $oCriteria = new Criteria( 'workflow' ); $oCriteria->add( EventPeer::PRO_UID, $sProUid ); $oDataset = EventPeer::doSelectRS( $oCriteria ); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $oDataset->next(); while ($aRow = $oDataset->getRow()) { $oEvent = new Event(); $aEvent[] = $oEvent->load( $aRow['EVN_UID'] ); $oDataset->next(); } return $aEvent; } catch (Exception $oError) { throw ($oError); } }
public function __form() { $layout = new Layout(); $left = $layout->createColumn(Layout::LARGE); $center = $layout->createColumn(Layout::LARGE); $right = $layout->createColumn(Layout::LARGE); $existing = null; $fields = array(); // Verify view exists: if ($this->_context[0] == 'edit') { if (!isset($this->_context[1]) || strlen(trim($this->_context[1])) == 0) { redirect(ADMIN_URL . '/blueprints/views/'); } $context = $this->_context; array_shift($context); $view_pathname = implode('/', $context); $existing = self::__loadExistingView($view_pathname); } // Status message: $callback = Administration::instance()->getPageCallback(); if (isset($callback['flag']) && !is_null($callback['flag'])) { switch ($callback['flag']) { case 'saved': $this->alerts()->append(__('View updated at %1$s. <a href="%2$s">Create another?</a> <a href="%3$s">View all</a>', array(DateTimeObj::getTimeAgo(__SYM_TIME_FORMAT__), ADMIN_URL . '/blueprints/views/new/', ADMIN_URL . '/blueprints/views/')), AlertStack::SUCCESS); break; case 'created': $this->alerts()->append(__('View created at %1$s. <a href="%2$s">Create another?</a> <a href="%3$s">View all</a>', array(DateTimeObj::getTimeAgo(__SYM_TIME_FORMAT__), ADMIN_URL . '/blueprints/views/new/', ADMIN_URL . '/blueprints/views/')), AlertStack::SUCCESS); break; } } // Find values: if (isset($_POST['fields'])) { $fields = $_POST['fields']; } elseif ($this->_context[0] == 'edit') { $fields = (array) $existing->about(); // Flatten the types array: $fields['types'] = (isset($fields['types']) and is_array($fields['types'])) ? implode(', ', $fields['types']) : null; // Flatten the url-parameters array: $fields['url-parameters'] = (isset($fields['url-parameters']) and is_array($fields['url-parameters'])) ? implode('/', $fields['url-parameters']) : null; $fields['parent'] = $existing->parent() instanceof View ? $existing->parent()->path : NULL; $fields['handle'] = $existing->handle; } $title = null; if (isset($fields['title'])) { $title = $fields['title']; } if (strlen(trim($title)) == 0) { $title = $existing instanceof View ? $existing->title : 'New View'; } $this->setTitle(__($title ? '%1$s – %2$s – %3$s' : '%1$s – %2$s', array(__('Symphony'), __('Views'), $title))); if ($existing instanceof View) { $template_name = $fields['handle']; $this->appendSubheading(__($title ? $title : __('New View'))); $viewoptions = array(__('Configuration') => Administration::instance()->getCurrentPageURL(), __('Template') => sprintf('%s/blueprints/views/template/%s/', ADMIN_URL, $view_pathname)); $this->appendViewOptions($viewoptions); } else { $this->appendSubheading($title ? $title : __('Untitled')); } // Fieldset ----------------------------------------------------------- $fieldset = Widget::Fieldset(__('Essentials')); // Title -------------------------------------------------------------- $label = Widget::Label(__('Title')); $label->appendChild(Widget::Input('fields[title]', isset($fields['title']) ? $fields['title'] : null)); if (isset($this->errors->title)) { $label = Widget::wrapFormElementWithError($label, $this->errors->title); } $fieldset->appendChild($label); // Type --------------------------------------------------------------- $container = $this->createElement('div'); $label = Widget::Label(__('View Type')); $label->appendChild(Widget::Input('fields[types]', isset($fields['types']) ? $fields['types'] : null)); if (isset($this->errors->types)) { $label = Widget::wrapFormElementWithError($label, $this->errors->types); } $tags = $this->createElement('ul'); $tags->setAttribute('class', 'tags'); foreach (self::__fetchAvailableViewTypes() as $t) { $tags->appendChild($this->createElement('li', $t)); } $container->appendChild($label); $container->appendChild($tags); $fieldset->appendChild($container); $left->appendChild($fieldset); // Fieldset ----------------------------------------------------------- $fieldset = Widget::Fieldset(__('URL Settings')); // Parent ------------------------------------------------------------- $label = Widget::Label(__('Parent')); $options = array(array(NULL, false, '/')); foreach (new ViewIterator() as $v) { // Make sure the current view cannot be set as either a child of itself, or a child of // another view that is already at child of the current view. if (isset($existing) && $existing instanceof View && ($v->isChildOf($existing) || $v->guid == $existing->guid)) { continue; } $options[] = array($v->path, isset($fields['parent']) and $fields['parent'] == $v->path, "/{$v->path}"); } $label->appendChild(Widget::Select('fields[parent]', $options)); $fieldset->appendChild($label); // Handle ------------------------------------------------------------- $label = Widget::Label(__('Handle')); $label->appendChild(Widget::Input('fields[handle]', isset($fields['handle']) ? $fields['handle'] : null)); if (isset($this->errors->handle)) { $label = Widget::wrapFormElementWithError($label, $this->errors->handle); } $fieldset->appendChild($label); // Parameters --------------------------------------------------------- $label = Widget::Label(__('Parameters')); $label->appendChild(Widget::Input('fields[url-parameters]', isset($fields['url-parameters']) ? $fields['url-parameters'] : null)); $fieldset->appendChild($label); $center->appendChild($fieldset); // Fieldset ----------------------------------------------------------- $fieldset = Widget::Fieldset(__('Resources')); $label = Widget::Label(__('Events')); $options = array(); foreach (new EventIterator() as $pathname) { $event = Event::load($pathname); $handle = Event::getHandleFromFilename($pathname); $options[] = array($handle, in_array($handle, (array) $fields['events']), $event->about()->name); } $label->appendChild(Widget::Select('fields[events][]', $options, array('multiple' => 'multiple'))); $fieldset->appendChild($label); // Data Sources ------------------------------------------------------- $label = Widget::Label(__('Data Sources')); $options = array(); foreach (new DataSourceIterator() as $pathname) { $ds = DataSource::load($pathname); $handle = DataSource::getHandleFromFilename($pathname); $options[] = array($handle, in_array($handle, (array) $fields['data-sources']), $ds->about()->name); } $label->appendChild(Widget::Select('fields[data-sources][]', $options, array('multiple' => 'multiple'))); $fieldset->appendChild($label); $right->appendChild($fieldset); $layout->appendTo($this->Form); // Controls ----------------------------------------------------------- $div = $this->createElement('div'); $div->setAttribute('class', 'actions'); $div->appendChild(Widget::Submit('action[save]', $this->_context[0] == 'edit' ? __('Save Changes') : __('Create View'), array('accesskey' => 's'))); if ($this->_context[0] == 'edit') { $div->appendChild(Widget::Submit('action[delete]', __('Delete'), array('class' => 'confirm delete', 'title' => __('Delete this view')))); } $this->Form->appendChild($div); }