本文整理汇总了PHP中PMPluginRegistry类的典型用法代码示例。如果您正苦于以下问题:PHP PMPluginRegistry类的具体用法?PHP PMPluginRegistry怎么用?PHP PMPluginRegistry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PMPluginRegistry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pluginCaseSchedulerForm
function pluginCaseSchedulerForm()
{
if (!isset($_REQUEST['selectedOption'])) {
die;
}
$G_PUBLISH = new Publisher();
$params = explode("--", $_REQUEST['selectedOption']);
$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)) {
//Render the form
if (isset($_REQUEST['sch_uid']) && $_REQUEST['sch_uid'] != "") {
//$oData=$oPluginRegistry->executeMethod( $caseSchedulerPluginDetail->sNamespace, $caseSchedulerPluginDetail->sActionGetFields, array("SCH_UID"=>$_REQUEST['sch_uid']) );
$oData = array("SCH_UID" => $_REQUEST['sch_uid'], "PRO_UID" => $_REQUEST['pro_uid']);
} else {
$oData = array("PRO_UID" => $_REQUEST['pro_uid']);
}
$oPluginRegistry->executeMethod($caseSchedulerPluginDetail->sNamespace, $caseSchedulerPluginDetail->sActionForm, $oData);
}
}
示例2: __construct
/**
* __construct
*
* @return void
*/
function __construct()
{
//Initialize the Library and register the Default
$this->registerFunctionsFileToLibrary(PATH_CORE . "classes" . PATH_SEP . "class.pmFunctions.php", "ProcessMaker Functions");
//Register all registered PLugin Functions
if (class_exists('folderData')) {
//$folderData = new folderData($sProUid, $proFields['PRO_TITLE'], $sAppUid, $Fields['APP_TITLE'], $sUsrUid);
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$aAvailablePmFunctions = $oPluginRegistry->getPmFunctions();
foreach ($aAvailablePmFunctions as $key => $class) {
$filePlugin = PATH_PLUGINS . $class . PATH_SEP . 'classes' . PATH_SEP . 'class.pmFunctions.php';
if (file_exists($filePlugin) && !is_dir($filePlugin)) {
$this->registerFunctionsFileToLibrary($filePlugin, "ProcessMaker Functions");
}
}
}
//Add External Triggers
$dir = G::ExpandPath("classes") . 'triggers';
$filesArray = array();
if (file_exists($dir)) {
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && !is_dir($dir . PATH_SEP . $file)) {
$this->registerFunctionsFileToLibrary($dir . PATH_SEP . $file, "ProcessMaker External Functions");
}
}
closedir($handle);
}
}
}
示例3: create
public function create($data)
{
// setting defaults
$data['PRO_UID'] = array_key_exists('PRO_UID', $data) ? $data['PRO_UID'] : Common::generateUID();
$data['USR_UID'] = array_key_exists('PRO_CREATE_USER', $data) ? $data['PRO_CREATE_USER'] : null;
$data['PRO_TITLE'] = array_key_exists('PRO_TITLE', $data) ? trim($data['PRO_TITLE']) : "";
$data['PRO_CATEGORY'] = array_key_exists('PRO_CATEGORY', $data) ? $data['PRO_CATEGORY'] : "";
try {
self::log("Create Process with data:", $data);
//validate if process with specified name already exists
if (Process::existsByProTitle($data["PRO_TITLE"])) {
throw new Exception\ProjectAlreadyExists($this, $data["PRO_TITLE"]);
}
// Create project
$process = new Process();
$this->proUid = $process->create($data, false);
// Call Plugins
$pluginData['PRO_UID'] = $this->proUid;
$pluginData['PRO_TEMPLATE'] = empty($data["PRO_TEMPLATE"]) ? "" : $data["PRO_TEMPLATE"];
$pluginData['PROCESSMAP'] = null;
$pluginRegistry = \PMPluginRegistry::getSingleton();
$pluginRegistry->executeTriggers(PM_NEW_PROCESS_SAVE, $pluginData);
// Save Calendar ID for this process
if (!empty($data["PRO_CALENDAR"])) {
//G::LoadClass( "calendar" );
$calendar = new \Calendar();
$calendar->assignCalendarTo($this->proUid, $data["PRO_CALENDAR"], 'PROCESS');
}
self::log("Create Process Success!");
} catch (\Exception $e) {
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
throw $e;
}
}
示例4: saveProcess
public function saveProcess()
{
try {
require_once 'classes/model/Task.php';
G::LoadClass('processMap');
$oProcessMap = new ProcessMap();
if (!isset($_POST['PRO_UID'])) {
if (Process::existsByProTitle($_POST['PRO_TITLE'])) {
$result = array('success' => false, 'msg' => 'Process Save Error', 'errors' => array('PRO_TITLE' => G::LoadTranslation('ID_PROCESSTITLE_ALREADY_EXISTS', SYS_LANG, $_POST)));
print G::json_encode($result);
exit(0);
}
$processData['USR_UID'] = $_SESSION['USER_LOGGED'];
$processData['PRO_TITLE'] = $_POST['PRO_TITLE'];
$processData['PRO_DESCRIPTION'] = $_POST['PRO_DESCRIPTION'];
$processData['PRO_CATEGORY'] = $_POST['PRO_CATEGORY'];
$sProUid = $oProcessMap->createProcess($processData);
//call plugins
$oData['PRO_UID'] = $sProUid;
$oData['PRO_TEMPLATE'] = isset($_POST['PRO_TEMPLATE']) && $_POST['PRO_TEMPLATE'] != '' ? $_POST['form']['PRO_TEMPLATE'] : '';
$oData['PROCESSMAP'] = $oProcessMap;
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry->executeTriggers(PM_NEW_PROCESS_SAVE, $oData);
} else {
//$oProcessMap->updateProcess($_POST['form']);
$sProUid = $_POST['PRO_UID'];
}
//Save Calendar ID for this process
if (isset($_POST['PRO_CALENDAR'])) {
G::LoadClass("calendar");
$calendarObj = new Calendar();
$calendarObj->assignCalendarTo($sProUid, $_POST['PRO_CALENDAR'], 'PROCESS');
}
$result->success = true;
$result->PRO_UID = $sProUid;
$result->msg = G::LoadTranslation('ID_CREATE_PROCESS_SUCCESS');
} catch (Exception $e) {
$result->success = false;
$result->msg = $e->getMessage();
}
print G::json_encode($result);
}
示例5: getRegisteredDashboards
function getRegisteredDashboards()
{
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$dashBoardPages = $oPluginRegistry->getDashboardPages();
print_r(G::json_encode($dashBoardPages));
}
示例6: getAvailableSteps
//.........这里部分代码省略.........
$criteria->addAsColumn("DYN_DESCRIPTION", "CD.CON_VALUE");
$criteria->addAlias("CT", \ContentPeer::TABLE_NAME);
$criteria->addAlias("CD", \ContentPeer::TABLE_NAME);
$arrayCondition = array();
$arrayCondition[] = array(\DynaformPeer::DYN_UID, "CT.CON_ID", \Criteria::EQUAL);
$arrayCondition[] = array("CT.CON_CATEGORY", $delimiter . "DYN_TITLE" . $delimiter, \Criteria::EQUAL);
$arrayCondition[] = array("CT.CON_LANG", $delimiter . SYS_LANG . $delimiter, \Criteria::EQUAL);
$criteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN);
$arrayCondition = array();
$arrayCondition[] = array(\DynaformPeer::DYN_UID, "CD.CON_ID", \Criteria::EQUAL);
$arrayCondition[] = array("CD.CON_CATEGORY", $delimiter . "DYN_DESCRIPTION" . $delimiter, \Criteria::EQUAL);
$arrayCondition[] = array("CD.CON_LANG", $delimiter . SYS_LANG . $delimiter, \Criteria::EQUAL);
$criteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN);
$criteria->add(\DynaformPeer::PRO_UID, $processUid, \Criteria::EQUAL);
$criteria->add(\DynaformPeer::DYN_UID, $arrayUid, \Criteria::NOT_IN);
$criteria->add(\DynaformPeer::DYN_TYPE, "xmlform", \Criteria::EQUAL);
$rsCriteria = \DynaformPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
if ($row["DYN_TITLE"] . "" == "") {
//There is no transaltion for this Document name, try to get/regenerate the label
$row["DYN_TITLE"] = \Content::Load("DYN_TITLE", "", $row["DYN_UID"], SYS_LANG);
}
$arraydbStep[] = array($this->getFieldNameByFormatFieldName("OBJ_UID") => $row["DYN_UID"], $this->getFieldNameByFormatFieldName("OBJ_TITLE") => $row["DYN_TITLE"], $this->getFieldNameByFormatFieldName("OBJ_DESCRIPTION") => $row["DYN_DESCRIPTION"], $this->getFieldNameByFormatFieldName("OBJ_TYPE") => "DYNAFORM");
}
//InputDocuments
$criteria = new \Criteria("workflow");
$criteria->addSelectColumn(\InputDocumentPeer::INP_DOC_UID);
$criteria->addAsColumn("INP_DOC_TITLE", "CT.CON_VALUE");
$criteria->addAsColumn("INP_DOC_DESCRIPTION", "CD.CON_VALUE");
$criteria->addAlias("CT", \ContentPeer::TABLE_NAME);
$criteria->addAlias("CD", \ContentPeer::TABLE_NAME);
$arrayCondition = array();
$arrayCondition[] = array(\InputDocumentPeer::INP_DOC_UID, "CT.CON_ID", \Criteria::EQUAL);
$arrayCondition[] = array("CT.CON_CATEGORY", $delimiter . "INP_DOC_TITLE" . $delimiter, \Criteria::EQUAL);
$arrayCondition[] = array("CT.CON_LANG", $delimiter . SYS_LANG . $delimiter, \Criteria::EQUAL);
$criteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN);
$arrayCondition = array();
$arrayCondition[] = array(\InputDocumentPeer::INP_DOC_UID, "CD.CON_ID", \Criteria::EQUAL);
$arrayCondition[] = array("CD.CON_CATEGORY", $delimiter . "INP_DOC_DESCRIPTION" . $delimiter, \Criteria::EQUAL);
$arrayCondition[] = array("CD.CON_LANG", $delimiter . SYS_LANG . $delimiter, \Criteria::EQUAL);
$criteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN);
$criteria->add(\InputDocumentPeer::PRO_UID, $processUid, \Criteria::EQUAL);
$criteria->add(\InputDocumentPeer::INP_DOC_UID, $arrayUid, \Criteria::NOT_IN);
$rsCriteria = \InputDocumentPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
if ($row["INP_DOC_TITLE"] . "" == "") {
//There is no transaltion for this Document name, try to get/regenerate the label
$row["INP_DOC_TITLE"] = \Content::Load("INP_DOC_TITLE", "", $row["INP_DOC_UID"], SYS_LANG);
}
$arraydbStep[] = array($this->getFieldNameByFormatFieldName("OBJ_UID") => $row["INP_DOC_UID"], $this->getFieldNameByFormatFieldName("OBJ_TITLE") => $row["INP_DOC_TITLE"], $this->getFieldNameByFormatFieldName("OBJ_DESCRIPTION") => $row["INP_DOC_DESCRIPTION"], $this->getFieldNameByFormatFieldName("OBJ_TYPE") => "INPUT_DOCUMENT");
}
//OutputDocuments
$criteria = new \Criteria("workflow");
$criteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_UID);
$criteria->addAsColumn("OUT_DOC_TITLE", "CT.CON_VALUE");
$criteria->addAsColumn("OUT_DOC_DESCRIPTION", "CD.CON_VALUE");
$criteria->addAlias("CT", \ContentPeer::TABLE_NAME);
$criteria->addAlias("CD", \ContentPeer::TABLE_NAME);
$arrayCondition = array();
$arrayCondition[] = array(\OutputDocumentPeer::OUT_DOC_UID, "CT.CON_ID", \Criteria::EQUAL);
$arrayCondition[] = array("CT.CON_CATEGORY", $delimiter . "OUT_DOC_TITLE" . $delimiter, \Criteria::EQUAL);
$arrayCondition[] = array("CT.CON_LANG", $delimiter . SYS_LANG . $delimiter, \Criteria::EQUAL);
$criteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN);
$arrayCondition = array();
$arrayCondition[] = array(\OutputDocumentPeer::OUT_DOC_UID, "CD.CON_ID", \Criteria::EQUAL);
$arrayCondition[] = array("CD.CON_CATEGORY", $delimiter . "OUT_DOC_DESCRIPTION" . $delimiter, \Criteria::EQUAL);
$arrayCondition[] = array("CD.CON_LANG", $delimiter . SYS_LANG . $delimiter, \Criteria::EQUAL);
$criteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN);
$criteria->add(\OutputDocumentPeer::PRO_UID, $processUid, \Criteria::EQUAL);
$criteria->add(\OutputDocumentPeer::OUT_DOC_UID, $arrayUid, \Criteria::NOT_IN);
$rsCriteria = \OutputDocumentPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
if ($row["OUT_DOC_TITLE"] . "" == "") {
//There is no transaltion for this Document name, try to get/regenerate the label
$row["OUT_DOC_TITLE"] = \Content::Load("OUT_DOC_TITLE", "", $row["OUT_DOC_UID"], SYS_LANG);
}
$arraydbStep[] = array($this->getFieldNameByFormatFieldName("OBJ_UID") => $row["OUT_DOC_UID"], $this->getFieldNameByFormatFieldName("OBJ_TITLE") => $row["OUT_DOC_TITLE"], $this->getFieldNameByFormatFieldName("OBJ_DESCRIPTION") => $row["OUT_DOC_DESCRIPTION"], $this->getFieldNameByFormatFieldName("OBJ_TYPE") => "OUTPUT_DOCUMENT");
}
//Call plugin
$pluginRegistry =& \PMPluginRegistry::getSingleton();
$externalSteps = $pluginRegistry->getSteps();
if (is_array($externalSteps) && count($externalSteps) > 0) {
foreach ($externalSteps as $key => $value) {
$arraydbStep[] = array($this->getFieldNameByFormatFieldName("OBJ_UID") => $value->sStepId, $this->getFieldNameByFormatFieldName("OBJ_TITLE") => $value->sStepTitle, $this->getFieldNameByFormatFieldName("OBJ_DESCRIPTION") => "", $this->getFieldNameByFormatFieldName("OBJ_TYPE") => "EXTERNAL");
}
}
if (!empty($arraydbStep)) {
$arraydbStep = Util\ArrayUtil::sort($arraydbStep, array($this->getFieldNameByFormatFieldName("OBJ_TYPE"), $this->getFieldNameByFormatFieldName("OBJ_TITLE")), SORT_ASC);
}
return $arraydbStep;
} catch (\Exception $e) {
throw $e;
}
}
示例7: dispatchRestService
/**
* This method allow dispatch rest services using 'Restler' thirdparty library
*
* @author Erik Amaru Ortiz <aortiz.erik@gmail.com>
*/
public function dispatchRestService($uri, $config, $apiClassesPath = '')
{
require_once 'restler/restler.php';
$rest = new Restler();
$rest->setSupportedFormats('JsonFormat', 'XmlFormat');
// getting all services class
$restClasses = array();
$restClassesList = G::rglob('*', 0, PATH_CORE . 'services/');
foreach ($restClassesList as $classFile) {
if (substr($classFile, -4) === '.php') {
$restClasses[str_replace('.php', '', basename($classFile))] = $classFile;
}
}
if (!empty($apiClassesPath)) {
$pluginRestClasses = array();
$restClassesList = G::rglob('*', 0, $apiClassesPath . 'services/');
foreach ($restClassesList as $classFile) {
if (substr($classFile, -4) === '.php') {
$pluginRestClasses[str_replace('.php', '', basename($classFile))] = $classFile;
}
}
$restClasses = array_merge($restClasses, $pluginRestClasses);
}
// hook to get rest api classes from plugins
if (class_exists('PMPluginRegistry')) {
$pluginRegistry =& PMPluginRegistry::getSingleton();
$pluginClasses = $pluginRegistry->getRegisteredRestClassFiles();
$restClasses = array_merge($restClasses, $pluginClasses);
}
foreach ($restClasses as $key => $classFile) {
if (!file_exists($classFile)) {
unset($restClasses[$key]);
continue;
}
//load the file, and check if exist the class inside it.
require_once $classFile;
$namespace = 'Services_Rest_';
$className = str_replace('.php', '', basename($classFile));
// if the core class does not exists try resolve the for a plugin
if (!class_exists($namespace . $className)) {
$namespace = 'Plugin_Services_Rest_';
// Couldn't resolve the class name, just skipp it
if (!class_exists($namespace . $className)) {
unset($restClasses[$key]);
continue;
}
}
// verify if there is an auth class implementing 'iAuthenticate'
$classNameAuth = $namespace . $className;
$reflClass = new ReflectionClass($classNameAuth);
// that wasn't from plugin
if ($reflClass->implementsInterface('iAuthenticate') && $namespace != 'Plugin_Services_Rest_') {
// auth class found, set as restler authentication class handler
$rest->addAuthenticationClass($classNameAuth);
} else {
// add api class
$rest->addAPIClass($classNameAuth);
}
}
//end foreach rest class
// resolving the class for current request
$uriPart = explode('/', $uri);
$requestedClass = '';
if (isset($uriPart[1])) {
$requestedClass = ucfirst($uriPart[1]);
}
if (class_exists('Services_Rest_' . $requestedClass)) {
$namespace = 'Services_Rest_';
} elseif (class_exists('Plugin_Services_Rest_' . $requestedClass)) {
$namespace = 'Plugin_Services_Rest_';
} else {
$namespace = '';
}
// end resolv.
// Send additional headers (if exists) configured on rest-config.ini
if (array_key_exists('HEADERS', $config)) {
foreach ($config['HEADERS'] as $name => $value) {
header("{$name}: {$value}");
}
}
// to handle a request with "OPTIONS" method
if (!empty($namespace) && $_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
$reflClass = new ReflectionClass($namespace . $requestedClass);
// if the rest class has not a "options" method
if (!$reflClass->hasMethod('options')) {
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS, HEADERS');
header('Access-Control-Allow-Headers: authorization, content-type');
header("Access-Control-Allow-Credentials", "false");
header('Access-Control-Max-Age: 60');
exit;
}
}
// override global REQUEST_URI to pass to Restler library
$_SERVER['REQUEST_URI'] = '/' . strtolower($namespace) . ltrim($uri, '/');
// handle the rest request
//.........这里部分代码省略.........
示例8: caseSchedulerCron
//.........这里部分代码省略.........
"PRO_UID" => $processId,
"TAS_UID" => $taskId,
"SCH_UID" => $caseSchedulerUid,
"USR_NAME" => $user,
"RESULT" => "",
"EXEC_DATE" => date("Y-m-d"),
"EXEC_HOUR" => date("H:i:s"),
"WS_CREATE_CASE_STATUS" => "",
"WS_ROUTE_CASE_STATUS" => ""
);
$paramsLogResult = "FAILED";
$paramsRouteLogResult = "FAILED";
if ($result->status_code == 0) {
eprintln(" OK", "green");
$sessionId = $result->message;
$params = array("sessionId" => $sessionId, "processId" => $processId, "taskId" => $taskId, "variables" => array());
//If this Job was was registered to be performed by a plugin
if (isset($row["CASE_SH_PLUGIN_UID"]) && $row["CASE_SH_PLUGIN_UID"] != "") {
//Check if the plugin is active
$pluginParts = explode("--", $row["CASE_SH_PLUGIN_UID"]);
if (count($pluginParts) == 2) {
//Plugins
G::LoadClass("plugin");
//Here we are loading all plugins registered
//The singleton has a list of enabled plugins
$sSerializedFile = PATH_DATA_SITE . "plugin.singleton";
$oPluginRegistry = &PMPluginRegistry::getSingleton();
if (file_exists($sSerializedFile)) {
$oPluginRegistry->unSerializeInstance(file_get_contents($sSerializedFile));
}
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$activePluginsForCaseScheduler = $oPluginRegistry->getCaseSchedulerPlugins();
foreach ($activePluginsForCaseScheduler as $key => $caseSchedulerPlugin) {
if (isset($caseSchedulerPlugin->sNamespace) && $caseSchedulerPlugin->sNamespace == $pluginParts[0] && isset($caseSchedulerPlugin->sActionId) && $caseSchedulerPlugin->sActionId == $pluginParts[1]) {
$caseSchedulerSelected = $caseSchedulerPlugin;
}
}
}
}
//If there is a trigger that is registered to do this then transfer control
if (isset($caseSchedulerSelected) && is_object($caseSchedulerSelected)) {
eprintln(" - Transfering control to a Plugin: " . $caseSchedulerSelected->sNamespace . "/" . $caseSchedulerSelected->sActionId, "green");
$oData = array();
$oData["OBJ_SOAP"] = $client;
$oData["SCH_UID"] = $row["SCH_UID"];
$oData["params"] = $params;
$oData["sessionId"] = $sessionId;
$oData["userId"] = $user;
$paramsLogResultFromPlugin = $oPluginRegistry->executeMethod($caseSchedulerSelected->sNamespace, $caseSchedulerSelected->sActionExecute, $oData);
$paramsLog["WS_CREATE_CASE_STATUS"] = $paramsLogResultFromPlugin["WS_CREATE_CASE_STATUS"];
$paramsLog["WS_ROUTE_CASE_STATUS"] = $paramsLogResultFromPlugin["WS_ROUTE_CASE_STATUS"];
$paramsLogResult = $paramsLogResultFromPlugin["paramsLogResult"];
示例9: createAppDelegation
//.........这里部分代码省略.........
public function createAppDelegation($sProUid, $sAppUid, $sTasUid, $sUsrUid, $sAppThread, $iPriority = 3, $isSubprocess = false, $sPrevious = -1, $sNextTasParam = null)
{
if (!isset($sProUid) || strlen($sProUid) == 0) {
throw new Exception('Column "PRO_UID" cannot be null.');
}
if (!isset($sAppUid) || strlen($sAppUid) == 0) {
throw new Exception('Column "APP_UID" cannot be null.');
}
if (!isset($sTasUid) || strlen($sTasUid) == 0) {
throw new Exception('Column "TAS_UID" cannot be null.');
}
if (!isset($sUsrUid)) {
throw new Exception('Column "USR_UID" cannot be null.');
}
if (!isset($sAppThread) || strlen($sAppThread) == 0) {
throw new Exception('Column "APP_THREAD" cannot be null.');
}
//Get max DEL_INDEX
$criteria = new Criteria("workflow");
$criteria->add(AppDelegationPeer::APP_UID, $sAppUid);
$criteria->add(AppDelegationPeer::DEL_LAST_INDEX, 1);
$criteriaIndex = clone $criteria;
$rs = AppDelegationPeer::doSelectRS($criteriaIndex);
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$delIndex = 1;
if ($rs->next()) {
$row = $rs->getRow();
$delIndex = isset($row["DEL_INDEX"]) ? $row["DEL_INDEX"] + 1 : 1;
} else {
$criteriaDelIndex = new Criteria("workflow");
$criteriaDelIndex->addSelectColumn(AppDelegationPeer::DEL_INDEX);
$criteriaDelIndex->addSelectColumn(AppDelegationPeer::DEL_DELEGATE_DATE);
$criteriaDelIndex->add(AppDelegationPeer::APP_UID, $sAppUid);
$criteriaDelIndex->addDescendingOrderByColumn(AppDelegationPeer::DEL_DELEGATE_DATE);
$rsCriteriaDelIndex = AppDelegationPeer::doSelectRS($criteriaDelIndex);
$rsCriteriaDelIndex->setFetchmode(ResultSet::FETCHMODE_ASSOC);
if ($rsCriteriaDelIndex->next()) {
$row = $rsCriteriaDelIndex->getRow();
$delIndex = isset($row["DEL_INDEX"]) ? $row["DEL_INDEX"] + 1 : 1;
}
}
//Update set
$criteriaUpdate = new Criteria('workflow');
$criteriaUpdate->add(AppDelegationPeer::DEL_LAST_INDEX, 0);
BasePeer::doUpdate($criteria, $criteriaUpdate, Propel::getConnection('workflow'));
$this->setAppUid($sAppUid);
$this->setProUid($sProUid);
$this->setTasUid($sTasUid);
$this->setDelIndex($delIndex);
$this->setDelLastIndex(1);
$this->setDelPrevious($sPrevious == -1 ? 0 : $sPrevious);
$this->setUsrUid($sUsrUid);
$this->setDelType('NORMAL');
$this->setDelPriority($iPriority != '' ? $iPriority : '3');
$this->setDelThread($sAppThread);
$this->setDelThreadStatus('OPEN');
$this->setDelDelegateDate('now');
//The function return an array now. By JHL
$delTaskDueDate = $this->calculateDueDate($sNextTasParam);
$this->setDelTaskDueDate($delTaskDueDate['DUE_DATE']);
// Due date formatted
if (defined("DEBUG_CALENDAR_LOG") && DEBUG_CALENDAR_LOG) {
$this->setDelData($delTaskDueDate['DUE_DATE_LOG']);
// Log of actions made by Calendar Engine
} else {
$this->setDelData('');
}
// this condition assures that an internal delegation like a subprocess dont have an initial date setted
if ($delIndex == 1 && !$isSubprocess) {
//the first delegation, init date this should be now for draft applications, in other cases, should be null.
$this->setDelInitDate('now');
}
if ($this->validate()) {
try {
$res = $this->save();
} catch (PropelException $e) {
throw $e;
}
} else {
// Something went wrong. We can now get the validationFailures and handle them.
$msg = '';
$validationFailuresArray = $this->getValidationFailures();
foreach ($validationFailuresArray as $objValidationFailure) {
$msg .= $objValidationFailure->getMessage() . "<br/>";
}
throw new Exception('Failed Data validation. ' . $msg);
}
$delIndex = $this->getDelIndex();
// Hook for the trigger PM_CREATE_NEW_DELEGATION
if (defined('PM_CREATE_NEW_DELEGATION')) {
$data = new stdclass();
$data->TAS_UID = $sTasUid;
$data->APP_UID = $sAppUid;
$data->DEL_INDEX = $delIndex;
$data->USR_UID = $sUsrUid;
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry->executeTriggers(PM_CREATE_NEW_DELEGATION, $data);
}
return $delIndex;
}
示例10: renderExtJs
/**
* Function renderExtJs
* this function returns the content rendered using ExtJs
* extJsContent have an array, and we iterate this array to draw the content
*
* @author Fernando Ontiveros <fernando@colosa.com>
* @access public
* @return string
*/
public function renderExtJs()
{
$body = '';
if (isset($this->extJsContent) && is_array($this->extJsContent)) {
foreach ($this->extJsContent as $key => $file) {
$sPath = PATH_TPL;
//if the template file doesn't exists, then try with the plugins folders
if (!is_file($sPath . $file . ".html")) {
$aux = explode(PATH_SEP, $file);
//check if G_PLUGIN_CLASS is defined, because publisher can be called without an environment
if (count($aux) == 2 && defined('G_PLUGIN_CLASS')) {
$oPluginRegistry =& PMPluginRegistry::getSingleton();
if ($oPluginRegistry->isRegisteredFolder($aux[0])) {
$sPath = PATH_PLUGINS;
}
}
}
$template = new TemplatePower($sPath . $file . '.html');
$template->prepare();
foreach ($this->getVars() as $k => $v) {
$template->assign($k, $v);
}
$body .= $template->getOutputContent();
}
}
return $body;
}
示例11: Load
/**
* Load menu options
*
* @author Fernando Ontiveros Lira <fernando@colosa.com>
* @access public
* @param $strMenuName name of menu
* @return void
*/
function Load($strMenuName)
{
global $G_TMP_MENU;
$G_TMP_MENU = null;
$G_TMP_MENU = new Menu();
$fMenu = G::ExpandPath("menus") . $strMenuName . ".php";
//if the menu file doesn't exists, then try with the plugins folders
if (!is_file($fMenu)) {
$aux = explode(PATH_SEP, $strMenuName);
if (count($aux) == 2) {
$oPluginRegistry =& PMPluginRegistry::getSingleton();
if ($oPluginRegistry->isRegisteredFolder($aux[0])) {
$fMenu = PATH_PLUGINS . $aux[0] . PATH_SEP . $aux[1] . ".php";
}
}
}
if (!is_file($fMenu)) {
return;
}
include $fMenu;
//this line will add options to current menu.
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry->getMenus($strMenuName);
//?
$c = 0;
for ($i = 0; $i < count($G_TMP_MENU->Options); $i++) {
if ($G_TMP_MENU->Enabled[$i] == 1) {
$this->Options[$c] = $G_TMP_MENU->Options[$i];
$this->Labels[$c] = $G_TMP_MENU->Labels[$i];
$this->Icons[$c] = $G_TMP_MENU->Icons[$i];
$this->JS[$c] = $G_TMP_MENU->JS[$i];
$this->Types[$c] = $G_TMP_MENU->Types[$i];
$this->Enabled[$c] = $G_TMP_MENU->Enabled[$i];
$this->Id[$c] = $G_TMP_MENU->Id[$i];
$this->Classes[$c] = $G_TMP_MENU->Classes[$i];
$this->ElementClass[$c] = $G_TMP_MENU->ElementClass[$i];
$c++;
} else {
if ($i == $this->optionOn) {
$this->optionOn = -1;
} elseif ($i < $this->optionOn) {
$this->optionOn--;
} elseif ($this->optionOn > 0) {
$this->optionOn--;
}
//added this line
}
}
$G_TMP_MENU = null;
}
示例12: getStep
/**
* Get data of a Step
*
* @param string $stepUid Unique id of Step
*
* return array Return an array with data of a Step
*/
public function getStep($stepUid)
{
try {
$arrayStep = array();
//Verify data
$this->throwExceptionIfNotExistsStep($stepUid);
//Get data
//Call plugin
$pluginRegistry = &\PMPluginRegistry::getSingleton();
$externalSteps = $pluginRegistry->getSteps();
$criteria = new \Criteria("workflow");
$criteria->add(\StepPeer::STEP_UID, $stepUid, \Criteria::EQUAL);
$rsCriteria = \StepPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$rsCriteria->next();
$row = $rsCriteria->getRow();
$titleObj = "";
$descriptionObj = "";
switch ($row["STEP_TYPE_OBJ"]) {
case "DYNAFORM":
$dynaform = new \Dynaform();
$arrayData = $dynaform->load($row["STEP_UID_OBJ"]);
$titleObj = $arrayData["DYN_TITLE"];
$descriptionObj = $arrayData["DYN_DESCRIPTION"];
break;
case "INPUT_DOCUMENT":
$inputDocument = new \InputDocument();
$arrayData = $inputDocument->getByUid($row["STEP_UID_OBJ"]);
if ($arrayData === false) {
return $arrayStep;
}
$titleObj = $arrayData["INP_DOC_TITLE"];
$descriptionObj = $arrayData["INP_DOC_DESCRIPTION"];
break;
case "OUTPUT_DOCUMENT":
$outputDocument = new \OutputDocument();
$arrayData = $outputDocument->getByUid($row["STEP_UID_OBJ"]);
if ($arrayData === false) {
return $arrayStep;
}
$titleObj = $arrayData["OUT_DOC_TITLE"];
$descriptionObj = $arrayData["OUT_DOC_DESCRIPTION"];
break;
case "EXTERNAL":
$titleObj = "unknown " . $row["STEP_UID"];
if (is_array($externalSteps) && count($externalSteps) > 0) {
foreach ($externalSteps as $key => $value) {
if ($value->sStepId == $row["STEP_UID_OBJ"]) {
$titleObj = $value->sStepTitle;
}
}
}
break;
}
//Return
$arrayStep = array(
$this->getFieldNameByFormatFieldName("STEP_UID") => $stepUid,
$this->getFieldNameByFormatFieldName("STEP_TYPE_OBJ") => $row["STEP_TYPE_OBJ"],
$this->getFieldNameByFormatFieldName("STEP_UID_OBJ") => $row["STEP_UID_OBJ"],
$this->getFieldNameByFormatFieldName("STEP_CONDITION") => $row["STEP_CONDITION"],
$this->getFieldNameByFormatFieldName("STEP_POSITION") => (int)($row["STEP_POSITION"]),
$this->getFieldNameByFormatFieldName("STEP_MODE") => $row["STEP_MODE"],
$this->getFieldNameByFormatFieldName("OBJ_TITLE") => $titleObj,
$this->getFieldNameByFormatFieldName("OBJ_DESCRIPTION") => $descriptionObj
);
return $arrayStep;
} catch (\Exception $e) {
throw $e;
}
}
示例13: run_addon_core_install
function run_addon_core_install($args)
{
try {
if (!extension_loaded("mysql")) {
if (strtoupper(substr(PHP_OS, 0, 3)) === "WIN") {
dl("mysql.dll");
} else {
dl("mysql.so");
}
}
///////
/*
if (!CLI2) {
$args = $opts;
}
*/
$workspace = $args[0];
$storeId = $args[1];
$addonName = $args[2];
if (!defined("SYS_SYS")) {
define("SYS_SYS", $workspace);
}
if (!defined("PATH_DATA_SITE")) {
define("PATH_DATA_SITE", PATH_DATA . "sites/" . SYS_SYS . "/");
}
if (!defined("DB_ADAPTER")) {
define("DB_ADAPTER", $args[3]);
}
///////
//***************** Plugins **************************
G::LoadClass("plugin");
//Here we are loading all plugins registered
//the singleton has a list of enabled plugins
$sSerializedFile = PATH_DATA_SITE . "plugin.singleton";
$oPluginRegistry =& PMPluginRegistry::getSingleton();
if (file_exists($sSerializedFile)) {
$oPluginRegistry->unSerializeInstance(file_get_contents($sSerializedFile));
}
///////
//echo "** Installation starting... (workspace: $workspace, store: $storeId, id: $addonName)\n";
$ws = new workspaceTools($workspace);
$ws->initPropel(false);
require_once PATH_CORE . 'methods' . PATH_SEP . 'enterprise' . PATH_SEP . 'enterprise.php';
require_once PATH_CORE . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'AddonsManagerPeer.php';
$addon = AddonsManagerPeer::retrieveByPK($addonName, $storeId);
if ($addon == null) {
throw new Exception("Id {$addonName} not found in store {$storeId}");
}
//echo "Downloading...\n";
$download = $addon->download();
//echo "Installing...\n";
$addon->install();
if ($addon->isCore()) {
$ws = new workspaceTools($workspace);
$ws->initPropel(false);
$addon->setState("install-finish");
} else {
$addon->setState();
}
} catch (Exception $e) {
$addon->setState("error");
//fwrite(STDERR, "\n[ERROR: {$e->getMessage()}]\n");
//fwrite(STDOUT, "\n[ERROR: {$e->getMessage()}]\n");
}
//echo "** Installation finished\n";
}
示例14: activateFeatures
public function activateFeatures()
{
//Get a list of all Enterprise plugins and active/inactive them
if (file_exists(PATH_PLUGINS . 'enterprise/data/default')) {
if ($this->result == "OK") {
//Disable
if (file_exists(PATH_PLUGINS . 'enterprise/data/data')) {
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$aPlugins = unserialize(trim(file_get_contents(PATH_PLUGINS . 'enterprise/data/data')));
foreach ($aPlugins as $aPlugin) {
$sClassName = substr($aPlugin['sFilename'], 0, strpos($aPlugin['sFilename'], '-'));
require_once PATH_PLUGINS . $sClassName . '.php';
$oDetails = $oPluginRegistry->getPluginDetails($sClassName . '.php');
$oPluginRegistry->disablePlugin($oDetails->sNamespace);
file_put_contents(PATH_DATA_SITE . 'plugin.singleton', $oPluginRegistry->serializeInstance());
}
unlink(PATH_PLUGINS . 'enterprise/data/data');
}
//Enable
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$aPlugins = unserialize(trim(file_get_contents(PATH_PLUGINS . "enterprise/data/default")));
foreach ($aPlugins as $aPlugin) {
if ($aPlugin["bActive"]) {
$sClassName = substr($aPlugin["sFilename"], 0, strpos($aPlugin["sFilename"], "-"));
require_once PATH_PLUGINS . $sClassName . ".php";
$oDetails = $oPluginRegistry->getPluginDetails($sClassName . ".php");
$oPluginRegistry->enablePlugin($oDetails->sNamespace);
file_put_contents(PATH_DATA_SITE . 'plugin.singleton', $oPluginRegistry->serializeInstance());
}
}
if (file_exists(PATH_DATA_SITE . "ee")) {
$aPlugins = unserialize(trim(file_get_contents(PATH_DATA_SITE . 'ee')));
$aDenied = array();
foreach ($aPlugins as $aPlugin) {
$sClassName = substr($aPlugin['sFilename'], 0, strpos($aPlugin['sFilename'], '-'));
if (!in_array($sClassName, $this->features)) {
if (file_exists(PATH_PLUGINS . $sClassName . '.php')) {
require_once PATH_PLUGINS . $sClassName . '.php';
$oDetails = $oPluginRegistry->getPluginDetails($sClassName . '.php');
$oPluginRegistry->disablePlugin($oDetails->sNamespace);
file_put_contents(PATH_DATA_SITE . 'plugin.singleton', $oPluginRegistry->serializeInstance());
$aDenied[] = $oDetails->sNamespace;
}
}
}
if (!empty($aDenied)) {
if (SYS_COLLECTION == "enterprise" && SYS_TARGET == "pluginsList") {
G::SendMessageText("The following plugins were restricted due to your enterprise license: " . implode(", ", $aDenied), "INFO");
}
}
}
} else {
//Disable
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$aPlugins = unserialize(trim(file_get_contents(PATH_PLUGINS . 'enterprise/data/default')));
foreach ($aPlugins as $aPlugin) {
$sClassName = substr($aPlugin['sFilename'], 0, strpos($aPlugin['sFilename'], '-'));
//To avoid self disable
if ($sClassName != "pmLicenseManager" && $sClassName != "pmTrial" && $sClassName != "enterprise") {
require_once PATH_PLUGINS . $sClassName . '.php';
$oDetails = $oPluginRegistry->getPluginDetails($sClassName . '.php');
$oPluginRegistry->disablePlugin($oDetails->sNamespace);
} else {
//Enable default and required plugins
require_once PATH_PLUGINS . $sClassName . '.php';
$oDetails = $oPluginRegistry->getPluginDetails($sClassName . '.php');
$oPluginRegistry->enablePlugin($oDetails->sNamespace);
}
}
if (file_exists(PATH_DATA_SITE . 'ee')) {
$aPlugins = unserialize(trim(file_get_contents(PATH_DATA_SITE . 'ee')));
foreach ($aPlugins as $aPlugin) {
$sClassName = substr($aPlugin['sFilename'], 0, strpos($aPlugin['sFilename'], '-'));
if (strlen($sClassName) > 0) {
if (!class_exists($sClassName)) {
require_once PATH_PLUGINS . $sClassName . '.php';
}
$oDetails = $oPluginRegistry->getPluginDetails($sClassName . '.php');
if ($oDetails) {
$oPluginRegistry->disablePlugin($oDetails->sNamespace);
}
}
}
}
file_put_contents(PATH_DATA_SITE . 'plugin.singleton', $oPluginRegistry->serializeInstance());
}
}
}
示例15: PMFGenerateOutputDocument
//.........这里部分代码省略.........
}
} else {
////No versioning so Update a current Output or Create new if no exist
if ($aRow = $oDataset->getRow()) {
//Update
$aFields = array('APP_DOC_UID' => $aRow['APP_DOC_UID'], 'APP_UID' => $sApplication, 'DEL_INDEX' => $index, 'DOC_UID' => $outputID, 'DOC_VERSION' => $lastDocVersion, 'USR_UID' => $sUserLogged, 'APP_DOC_TYPE' => 'OUTPUT', 'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'), 'APP_DOC_FILENAME' => $sFilename, 'FOLDER_UID' => $folderId, 'APP_DOC_TAGS' => $fileTags);
$oAppDocument = new AppDocument();
$oAppDocument->update($aFields);
$sDocUID = $aRow['APP_DOC_UID'];
} else {
//we are creating the appdocument row
//create
if ($lastDocVersion == 0) {
$lastDocVersion++;
}
$aFields = array('APP_UID' => $sApplication, 'DEL_INDEX' => $index, 'DOC_UID' => $outputID, 'DOC_VERSION' => $lastDocVersion, 'USR_UID' => $sUserLogged, 'APP_DOC_TYPE' => 'OUTPUT', 'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'), 'APP_DOC_FILENAME' => $sFilename, 'FOLDER_UID' => $folderId, 'APP_DOC_TAGS' => $fileTags);
$oAppDocument = new AppDocument();
$aFields['APP_DOC_UID'] = $sDocUID = $oAppDocument->create($aFields);
}
}
$sFilename = $aFields['APP_DOC_UID'] . "_" . $lastDocVersion;
$pathOutput = PATH_DOCUMENT . G::getPathFromUID($sApplication) . PATH_SEP . 'outdocs' . PATH_SEP;
//G::pr($sFilename);die;
G::mk_dir($pathOutput);
$aProperties = array();
if (!isset($aOD['OUT_DOC_MEDIA'])) {
$aOD['OUT_DOC_MEDIA'] = 'Letter';
}
if (!isset($aOD['OUT_DOC_LEFT_MARGIN'])) {
$aOD['OUT_DOC_LEFT_MARGIN'] = '15';
}
if (!isset($aOD['OUT_DOC_RIGHT_MARGIN'])) {
$aOD['OUT_DOC_RIGHT_MARGIN'] = '15';
}
if (!isset($aOD['OUT_DOC_TOP_MARGIN'])) {
$aOD['OUT_DOC_TOP_MARGIN'] = '15';
}
if (!isset($aOD['OUT_DOC_BOTTOM_MARGIN'])) {
$aOD['OUT_DOC_BOTTOM_MARGIN'] = '15';
}
$aProperties['media'] = $aOD['OUT_DOC_MEDIA'];
$aProperties['margins'] = array('left' => $aOD['OUT_DOC_LEFT_MARGIN'], 'right' => $aOD['OUT_DOC_RIGHT_MARGIN'], 'top' => $aOD['OUT_DOC_TOP_MARGIN'], 'bottom' => $aOD['OUT_DOC_BOTTOM_MARGIN']);
if (isset($aOD['OUT_DOC_REPORT_GENERATOR'])) {
$aProperties['report_generator'] = $aOD['OUT_DOC_REPORT_GENERATOR'];
}
$oOutputDocument->generate($outputID, $Fields['APP_DATA'], $pathOutput, $sFilename, $aOD['OUT_DOC_TEMPLATE'], (bool) $aOD['OUT_DOC_LANDSCAPE'], $aOD['OUT_DOC_GENERATE'], $aProperties);
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
//G::LoadClass('plugin');
$oPluginRegistry =& PMPluginRegistry::getSingleton();
if ($oPluginRegistry->existsTrigger(PM_UPLOAD_DOCUMENT) && class_exists('uploadDocumentData')) {
$triggerDetail = $oPluginRegistry->getTriggerInfo(PM_UPLOAD_DOCUMENT);
$aFields['APP_DOC_PLUGIN'] = $triggerDetail->sNamespace;
$oAppDocument1 = new AppDocument();
$oAppDocument1->update($aFields);
$sPathName = PATH_DOCUMENT . G::getPathFromUID($sApplication) . PATH_SEP;
$oData['APP_UID'] = $sApplication;
$oData['ATTACHMENT_FOLDER'] = true;
switch ($aOD['OUT_DOC_GENERATE']) {
case "BOTH":
$documentData = new uploadDocumentData($sApplication, $sUserLogged, $pathOutput . $sFilename . '.pdf', $sFilename . '.pdf', $sDocUID, $oAppDocument->getDocVersion());
$documentData->sFileType = "PDF";
$documentData->bUseOutputFolder = true;
$uploadReturn = $oPluginRegistry->executeTriggers(PM_UPLOAD_DOCUMENT, $documentData);
if ($uploadReturn) {
//Only delete if the file was saved correctly
unlink($pathOutput . $sFilename . '.pdf');
}
$documentData = new uploadDocumentData($sApplication, $sUserLogged, $pathOutput . $sFilename . '.doc', $sFilename . '.doc', $sDocUID, $oAppDocument->getDocVersion());
$documentData->sFileType = "DOC";
$documentData->bUseOutputFolder = true;
$uploadReturn = $oPluginRegistry->executeTriggers(PM_UPLOAD_DOCUMENT, $documentData);
if ($uploadReturn) {
//Only delete if the file was saved correctly
unlink($pathOutput . $sFilename . '.doc');
}
break;
case "PDF":
$documentData = new uploadDocumentData($sApplication, $sUserLogged, $pathOutput . $sFilename . '.pdf', $sFilename . '.pdf', $sDocUID, $oAppDocument->getDocVersion());
$documentData->sFileType = "PDF";
$documentData->bUseOutputFolder = true;
$uploadReturn = $oPluginRegistry->executeTriggers(PM_UPLOAD_DOCUMENT, $documentData);
if ($uploadReturn) {
//Only delete if the file was saved correctly
unlink($pathOutput . $sFilename . '.pdf');
}
break;
case "DOC":
$documentData = new uploadDocumentData($sApplication, $sUserLogged, $pathOutput . $sFilename . '.doc', $sFilename . '.doc', $sDocUID, $oAppDocument->getDocVersion());
$documentData->sFileType = "DOC";
$documentData->bUseOutputFolder = true;
$uploadReturn = $oPluginRegistry->executeTriggers(PM_UPLOAD_DOCUMENT, $documentData);
if ($uploadReturn) {
//Only delete if the file was saved correctly
unlink($pathOutput . $sFilename . '.doc');
}
break;
}
}
$g->sessionVarRestore();
}