本文整理汇总了PHP中Event::load方法的典型用法代码示例。如果您正苦于以下问题:PHP Event::load方法的具体用法?PHP Event::load怎么用?PHP Event::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Event
的用法示例。
在下文中一共展示了Event::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __viewIndex
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);
}
示例2: __construct
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);
}
示例3: getEvents
/**
* 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) <brayan@colosa.com>
* @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;
}
示例4: urlclean_plugin_link
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
}
}
示例5: __construct
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);
}
示例6: url_cleanup
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;
}
示例7: get_from_id
public static function get_from_id($id)
{
$event = new Event();
$event->load($id);
return $event;
}
示例8: alias
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);
}
}
示例9: saveEventPosition
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;
}
}
示例10: save
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);
//.........这里部分代码省略.........
示例11: parse
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;
}
示例12: Event
* 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);
示例13: processMap
<?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;
}
}
示例14: validatePayment
/**
* 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);
}
示例15: checkCredentials
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;
}