本文整理汇总了PHP中ApplicationPeer类的典型用法代码示例。如果您正苦于以下问题:PHP ApplicationPeer类的具体用法?PHP ApplicationPeer怎么用?PHP ApplicationPeer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ApplicationPeer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLastApplication
/**
* @return Application
*/
public function getLastApplication()
{
$c = new Criteria();
$c->add(ApplicationPeer::PROCESSED_DATE, null, Criteria::ISNOTNULL);
$c->add(ApplicationPeer::MEMBER_ID, $this->getId());
$c->addDescendingOrderByColumn(ApplicationPeer::DATE);
return ApplicationPeer::doSelectOne($c);
}
示例2: getStatusInfo
/**
* Get status info Case
*
* @param string $applicationUid Unique id of Case
* @param int $del_index {@min 1}
* @param string $userUid Unique id of User
*
* return array Return an array with status info Case, array empty otherwise
*/
public function getStatusInfo($applicationUid, $delIndex = 0, $userUid = "")
{
try {
//Verify data
$this->throwExceptionIfNotExistsCase($applicationUid, $delIndex, $this->getFieldNameByFormatFieldName("APP_UID"));
//Get data
//Status is PAUSED
$delimiter = \DBAdapter::getStringDelimiter();
$criteria = new \Criteria("workflow");
$criteria->addSelectColumn($delimiter . "PAUSED" . $delimiter . " AS APP_STATUS");
$criteria->addSelectColumn(\AppDelayPeer::APP_DEL_INDEX . " AS DEL_INDEX");
$criteria->add(\AppDelayPeer::APP_UID, $applicationUid, \Criteria::EQUAL);
$criteria->add(\AppDelayPeer::APP_TYPE, "PAUSE", \Criteria::EQUAL);
$criteria->add(
$criteria->getNewCriterion(\AppDelayPeer::APP_DISABLE_ACTION_USER, null, \Criteria::ISNULL)->addOr(
$criteria->getNewCriterion(\AppDelayPeer::APP_DISABLE_ACTION_USER, 0, \Criteria::EQUAL))
);
if ($delIndex != 0) {
$criteria->add(\AppDelayPeer::APP_DEL_INDEX, $delIndex, \Criteria::EQUAL);
}
if ($userUid != "") {
$criteria->add(\AppDelayPeer::APP_DELEGATION_USER, $userUid, \Criteria::EQUAL);
}
$rsCriteria = \AppDelayPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
if ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
//Return
return array("APP_STATUS" => $row["APP_STATUS"], "DEL_INDEX" => $row["DEL_INDEX"]);
}
//Status is TO_DO, DRAFT
$criteria = new \Criteria("workflow");
$criteria->addSelectColumn(\ApplicationPeer::APP_STATUS);
$criteria->addSelectColumn(\AppDelegationPeer::DEL_INDEX);
$arrayCondition = array();
$arrayCondition[] = array(\ApplicationPeer::APP_UID, \AppDelegationPeer::APP_UID, \Criteria::EQUAL);
$arrayCondition[] = array(\ApplicationPeer::APP_UID, \AppThreadPeer::APP_UID, \Criteria::EQUAL);
$arrayCondition[] = array(\ApplicationPeer::APP_UID, $delimiter . $applicationUid . $delimiter, \Criteria::EQUAL);
$criteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN);
$criteria->add(
$criteria->getNewCriterion(\ApplicationPeer::APP_STATUS, "TO_DO", \Criteria::EQUAL)->addAnd(
$criteria->getNewCriterion(\AppDelegationPeer::DEL_FINISH_DATE, null, \Criteria::ISNULL))->addAnd(
$criteria->getNewCriterion(\AppDelegationPeer::DEL_THREAD_STATUS, "OPEN"))->addAnd(
$criteria->getNewCriterion(\AppThreadPeer::APP_THREAD_STATUS, "OPEN"))
)->addOr(
$criteria->getNewCriterion(\ApplicationPeer::APP_STATUS, "DRAFT", \Criteria::EQUAL)->addAnd(
$criteria->getNewCriterion(\AppDelegationPeer::DEL_THREAD_STATUS, "OPEN"))->addAnd(
$criteria->getNewCriterion(\AppThreadPeer::APP_THREAD_STATUS, "OPEN"))
);
if ($delIndex != 0) {
$criteria->add(\AppDelegationPeer::DEL_INDEX, $delIndex, \Criteria::EQUAL);
}
if ($userUid != "") {
$criteria->add(\AppDelegationPeer::USR_UID, $userUid, \Criteria::EQUAL);
}
$rsCriteria = \ApplicationPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
if ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
//Return
return array("APP_STATUS" => $row["APP_STATUS"], "DEL_INDEX" => $row["DEL_INDEX"]);
}
//Status is CANCELLED, COMPLETED
$criteria = new \Criteria("workflow");
$criteria->addSelectColumn(\ApplicationPeer::APP_STATUS);
$criteria->addSelectColumn(\AppDelegationPeer::DEL_INDEX);
$arrayCondition = array();
$arrayCondition[] = array(\ApplicationPeer::APP_UID, \AppDelegationPeer::APP_UID, \Criteria::EQUAL);
$arrayCondition[] = array(\ApplicationPeer::APP_UID, $delimiter . $applicationUid . $delimiter, \Criteria::EQUAL);
$criteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN);
//.........这里部分代码省略.........
示例3: Cases
#end trigger debug session.......
//$oCase->thisIsTheCurrentUser($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], 'REDIRECT', 'cases_List');
//Save data - Start
$oCase->updateCase($_SESSION['APPLICATION'], $Fields);
//Save data - End
//Obtain previous and next step - Start
try {
$oCase = new Cases();
$aNextStep = $oCase->getNextStep($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION']);
$aPreviousStep = $oCase->getPreviousStep($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION']);
} catch (Exception $e) {
}
//Obtain previous and next step - End
try {
//Add content content step - Start
$oApp = ApplicationPeer::retrieveByPK($_SESSION['APPLICATION']);
$array['APP_NUMBER'] = $APP_NUMBER;
$sTitleCase = $oApp->getAppTitle();
$array['APP_TITLE'] = $sTitleCase;
$array['CASE'] = G::LoadTranslation('ID_CASE');
$array['TITLE'] = G::LoadTranslation('ID_TITLE');
$noShowTitle = 0;
if (isset($oProcessFieds['PRO_SHOW_MESSAGE'])) {
$noShowTitle = $oProcessFieds['PRO_SHOW_MESSAGE'];
}
switch ($_GET['TYPE']) {
case 'DYNAFORM':
if ($noShowTitle == 0) {
$G_PUBLISH->AddContent('smarty', 'cases/cases_title', '', '', $array);
}
if (!$aPreviousStep) {
示例4: newRow
public function newRow ($data, $delPreviusUsrUid, $isInitSubprocess = false, $dataPreviusApplication = array(), $isSelfService = false)
{
$removeList = true;
if (isset($data['REMOVED_LIST'])) {
$removeList = $data['REMOVED_LIST'];
unset($data['REMOVED_LIST']);
}
$data['DEL_PREVIOUS_USR_UID'] = $delPreviusUsrUid;
if (isset($data['DEL_TASK_DUE_DATE'])) {
$data['DEL_DUE_DATE'] = $data['DEL_TASK_DUE_DATE'];
}
$criteria = new Criteria();
$criteria->addSelectColumn( ApplicationPeer::APP_NUMBER );
$criteria->addSelectColumn( ApplicationPeer::APP_UPDATE_DATE );
$criteria->add( ApplicationPeer::APP_UID, $data['APP_UID'], Criteria::EQUAL );
$dataset = ApplicationPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();
$aRow = $dataset->getRow();
$data = array_merge($data, $aRow);
$criteria = new Criteria();
$criteria->addSelectColumn(ContentPeer::CON_VALUE);
$criteria->add( ContentPeer::CON_ID, $data['APP_UID'], Criteria::EQUAL );
$criteria->add( ContentPeer::CON_CATEGORY, 'APP_TITLE', Criteria::EQUAL );
$criteria->add( ContentPeer::CON_LANG, SYS_LANG, Criteria::EQUAL );
$dataset = ContentPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();
$aRow = $dataset->getRow();
$data['APP_TITLE'] = $aRow['CON_VALUE'];
$criteria = new Criteria();
$criteria->addSelectColumn(ContentPeer::CON_VALUE);
$criteria->add( ContentPeer::CON_ID, $data['PRO_UID'], Criteria::EQUAL );
$criteria->add( ContentPeer::CON_CATEGORY, 'PRO_TITLE', Criteria::EQUAL );
$criteria->add( ContentPeer::CON_LANG, SYS_LANG, Criteria::EQUAL );
$dataset = ContentPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();
$aRow = $dataset->getRow();
$data['APP_PRO_TITLE'] = $aRow['CON_VALUE'];
$criteria = new Criteria();
$criteria->addSelectColumn(ContentPeer::CON_VALUE);
$criteria->add( ContentPeer::CON_ID, $data['TAS_UID'], Criteria::EQUAL );
$criteria->add( ContentPeer::CON_CATEGORY, 'TAS_TITLE', Criteria::EQUAL );
$criteria->add( ContentPeer::CON_LANG, SYS_LANG, Criteria::EQUAL );
$dataset = ContentPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();
$aRow = $dataset->getRow();
$data['APP_TAS_TITLE'] = $aRow['CON_VALUE'];
$data['APP_PREVIOUS_USER'] = '';
if ($data['DEL_PREVIOUS_USR_UID'] != '') {
$criteria = new Criteria();
$criteria->addSelectColumn(UsersPeer::USR_USERNAME);
$criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
$criteria->addSelectColumn(UsersPeer::USR_LASTNAME);
$criteria->add( UsersPeer::USR_UID, $data['DEL_PREVIOUS_USR_UID'], Criteria::EQUAL );
$dataset = UsersPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();
$aRow = $dataset->getRow();
$data['DEL_PREVIOUS_USR_USERNAME'] = $aRow['USR_USERNAME'];
$data['DEL_PREVIOUS_USR_FIRSTNAME'] = $aRow['USR_FIRSTNAME'];
$data['DEL_PREVIOUS_USR_LASTNAME'] = $aRow['USR_LASTNAME'];
}
$users = new Users();
$criteria = new Criteria();
$criteria->addSelectColumn(SubApplicationPeer::DEL_INDEX_PARENT);
$criteria->add( SubApplicationPeer::APP_PARENT, $data['APP_UID'], Criteria::EQUAL );
$dataset = SubApplicationPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
if ($dataset->next()) {
$aSub = $dataset->getRow();
if ($aSub['DEL_INDEX_PARENT'] == $data['DEL_PREVIOUS'] && !$isSelfService) {
$users->refreshTotal($data['USR_UID'], 'add', 'inbox');
self::create($data, $isSelfService);
return 1;
}
}
if (!$isInitSubprocess) {
if ($data['APP_STATUS'] == 'DRAFT') {
$users->refreshTotal($data['USR_UID'], 'add', 'draft');
} else {
$oRow = ApplicationPeer::retrieveByPK($data['APP_UID']);
$aFields = $oRow->toArray( BasePeer::TYPE_FIELDNAME );
if ($removeList) {
if ($data['DEL_INDEX'] == 2 || $aFields['APP_STATUS'] == 'DRAFT') {
$criteria = new Criteria();
$criteria->addSelectColumn(SubApplicationPeer::APP_UID);
//.........这里部分代码省略.........
示例5: remove
/**
* Remove List Paused
*
* @param type $seqName
* @return type
* @throws type
*
*/
public function remove ($app_uid, $del_index, $data_inbox)
{
$users = new Users();
$users->refreshTotal($data_inbox['USR_UID'], 'removed', 'paused');
$oRow = ApplicationPeer::retrieveByPK($app_uid);
$aFields = $oRow->toArray( BasePeer::TYPE_FIELDNAME );
$data_inbox['APP_STATUS'] = $aFields['APP_STATUS'];
if ($data_inbox['APP_STATUS'] == 'TO_DO') {
$users->refreshTotal($data_inbox['USR_UID'], 'add', 'inbox');
}
$listInbox = new ListInbox();
$listInbox->newRow($data_inbox, $data_inbox['USR_UID']);
$con = Propel::getConnection( ListPausedPeer::DATABASE_NAME );
try {
$this->setAppUid($app_uid);
$this->setDelIndex($del_index);
$con->begin();
$this->delete();
$con->commit();
} catch (Exception $e) {
$con->rollback();
throw ($e);
}
}
示例6: populateTable
/**
* Function populateTable
* This Function fills the table
*
* @access public
* @param string $sTableName Table name
* @param string $sConnection Connection name
* @param string $sType
* @param array $aFields
* @param string $sProcessUid
* @param string $sGrid
* @return void
*/
public function populateTable($sTableName, $sConnection = 'report', $sType = 'NORMAL', $aFields = array(), $sProcessUid = '', $sGrid = '')
{
$sTableName = $this->sPrefix . $sTableName;
//we have to do the propel connection
$PropelDatabase = $this->chooseDB($sConnection);
$con = Propel::getConnection($PropelDatabase);
$stmt = $con->createStatement();
if ($sType == 'GRID') {
$aAux = explode('-', $sGrid);
$sGrid = $aAux[0];
}
try {
switch (DB_ADAPTER) {
case 'mysql':
//select cases for this Process, ordered by APP_NUMBER
$oCriteria = new Criteria('workflow');
$oCriteria->add(ApplicationPeer::PRO_UID, $sProcessUid);
$oCriteria->addAscendingOrderByColumn(ApplicationPeer::APP_NUMBER);
$oDataset = ApplicationPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$aData = unserialize($aRow['APP_DATA']);
//delete previous record from this report table ( previous records in case this is a grid )
$deleteSql = 'DELETE FROM `' . $sTableName . "` WHERE APP_UID = '" . $aRow['APP_UID'] . "'";
$rsDel = $stmt->executeQuery($deleteSql);
if ($sType == 'NORMAL') {
$sQuery = 'INSERT INTO `' . $sTableName . '` (';
$sQuery .= '`APP_UID`,`APP_NUMBER`';
foreach ($aFields as $aField) {
$sQuery .= ',`' . $aField['sFieldName'] . '`';
}
$sQuery .= ") VALUES ('" . $aRow['APP_UID'] . "'," . (int) $aRow['APP_NUMBER'];
foreach ($aFields as $aField) {
switch ($aField['sType']) {
case 'number':
$sQuery .= ',' . (isset($aData[$aField['sFieldName']]) ? (double) str_replace(',', '', $aData[$aField['sFieldName']]) : '0');
break;
case 'char':
case 'text':
if (!isset($aData[$aField['sFieldName']])) {
$aData[$aField['sFieldName']] = '';
}
$sQuery .= ",'" . (isset($aData[$aField['sFieldName']]) ? mysql_real_escape_string($aData[$aField['sFieldName']]) : '') . "'";
break;
case 'date':
$value = (isset($aData[$aField['sFieldName']]) && trim($aData[$aField['sFieldName']])) != '' ? "'" . $aData[$aField['sFieldName']] . "'" : 'NULL';
$sQuery .= "," . $value;
break;
}
}
$sQuery .= ')';
$rs = $stmt->executeQuery($sQuery);
} else {
if (isset($aData[$sGrid])) {
foreach ($aData[$sGrid] as $iRow => $aGridRow) {
$sQuery = 'INSERT INTO `' . $sTableName . '` (';
$sQuery .= '`APP_UID`,`APP_NUMBER`,`ROW`';
foreach ($aFields as $aField) {
$sQuery .= ',`' . $aField['sFieldName'] . '`';
}
$sQuery .= ") VALUES ('" . $aRow['APP_UID'] . "'," . (int) $aRow['APP_NUMBER'] . ',' . $iRow;
foreach ($aFields as $aField) {
switch ($aField['sType']) {
case 'number':
$sQuery .= ',' . (isset($aGridRow[$aField['sFieldName']]) ? (double) str_replace(',', '', $aGridRow[$aField['sFieldName']]) : '0');
break;
case 'char':
case 'text':
if (!isset($aGridRow[$aField['sFieldName']])) {
$aGridRow[$aField['sFieldName']] = '';
}
$sQuery .= ",'" . (isset($aGridRow[$aField['sFieldName']]) ? mysql_real_escape_string($aGridRow[$aField['sFieldName']]) : '') . "'";
break;
case 'date':
$value = (isset($aGridRow[$aField['sFieldName']]) && trim($aGridRow[$aField['sFieldName']])) != '' ? "'" . $aGridRow[$aField['sFieldName']] . "'" : 'NULL';
$sQuery .= "," . $value;
break;
}
}
$sQuery .= ')';
$rs = $stmt->executeQuery($sQuery);
}
}
}
$oDataset->next();
}
//.........这里部分代码省略.........
示例7: populateReportTable
/**
* Populate the report table with all case data
* @param string $sType
* @param string $sProcessUid
* @param string $sGrid
* @return number
*/
public function populateReportTable($tableName, $sConnection = 'rp', $type = 'NORMAL', $processUid = '', $gridKey = '', $addTabUid = '')
{
require_once "classes/model/Application.php";
$this->className = $this->getPHPName($tableName);
$this->classPeerName = $this->className . 'Peer';
if (!file_exists(PATH_WORKSPACE . 'classes/' . $this->className . '.php')) {
throw new Exception( "ERROR: " . PATH_WORKSPACE . 'classes/' . $this->className . '.php'
. " class file doesn't exit!");
}
require_once PATH_WORKSPACE . 'classes/' . $this->className . '.php';
//select cases for this Process, ordered by APP_NUMBER
$con = Propel::getConnection($sConnection);
$stmt = $con->createStatement();
$criteria = new Criteria('workflow');
$criteria->add(ApplicationPeer::PRO_UID, $processUid);
$criteria->addAscendingOrderByColumn(ApplicationPeer::APP_NUMBER);
$dataset = ApplicationPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while ($dataset->next()) {
$row = $dataset->getRow();
//remove old applications references
$deleteSql = "DELETE FROM $tableName WHERE APP_UID = '" . $row['APP_UID'] . "'";
$rs = $stmt->executeQuery($deleteSql);
// getting the case data
$caseData = unserialize($row['APP_DATA']);
$fieldTypes = array();
if ($addTabUid != '') {
require_once 'classes/model/Fields.php';
$criteriaField = new Criteria('workflow');
$criteriaField->add(FieldsPeer::ADD_TAB_UID, $addTabUid);
$datasetField = FieldsPeer::doSelectRS($criteriaField);
$datasetField->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while ($datasetField->next()) {
$rowfield = $datasetField->getRow();
switch ($rowfield['FLD_TYPE']) {
case 'FLOAT':
case 'DOUBLE':
case 'INTEGER':
$fieldTypes[] = array($rowfield['FLD_NAME']=>$rowfield['FLD_TYPE']);
break;
default:
break;
}
}
}
// quick fix
// map all empty values as NULL for Database
foreach ($caseData as $dKey => $dValue) {
if (!is_array($dValue)) {
foreach ($fieldTypes as $key => $fieldType) {
foreach ($fieldType as $name => $theType) {
if (strtoupper($dKey) == $name) {
$caseData[$dKey] = validateType ($dValue, $theType);
unset($name);
}
}
}
// normal fields
if (trim($dValue) === '') {
$caseData[$dKey] = null;
}
} else {
// grids
foreach ($caseData[$dKey] as $dIndex => $dRow) {
if (!is_array($dRow)) {
foreach ($dRow as $k => $v) {
if (trim($v) === '') {
$caseData[$dKey][$dIndex][$k] = null;
}
}
}
}
}
}
if ($type == 'GRID') {
list($gridName, $gridUid) = explode('-', $gridKey);
$gridData = isset($caseData[$gridName]) ? $caseData[$gridName] : array();
foreach ($gridData as $i => $gridRow) {
eval('$obj = new ' . $this->className . '();');
$obj->fromArray($caseData, BasePeer::TYPE_FIELDNAME);
$obj->setAppUid($row['APP_UID']);
$obj->setAppNumber($row['APP_NUMBER']);
if (method_exists($obj, 'setAppStatus')) {
//.........这里部分代码省略.........
示例8: getSearchAllCount
public function getSearchAllCount()
{
$criteriaCount = new Criteria('workflow');
$totalCount = ApplicationPeer::doCount($criteriaCount);
return $totalCount;
}
示例9: Publisher
*/
case 'emptyFileOptions':
global $G_PUBLISH;
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'processes/processes_FileEditCreateEmpty', '');
G::RenderPage('publish', 'raw');
break;
case "taskCases":
require_once "classes/model/Application.php";
require_once "classes/model/AppDelegation.php";
require_once "classes/model/AppDelay.php";
$criteria = new Criteria("workflow");
$criteria->addSelectColumn("COUNT(DISTINCT APPLICATION.APP_UID)");
$criteria->addJoin(ApplicationPeer::APP_UID, AppDelegationPeer::APP_UID, Criteria::LEFT_JOIN);
$criteria->addJoin(ApplicationPeer::APP_UID, AppDelayPeer::APP_UID, Criteria::LEFT_JOIN);
$criteria->add(AppDelegationPeer::TAS_UID, $oData->task_uid);
$criteria->add($criteria->getNewCriterion(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL)->addOr($criteria->getNewCriterion(AppDelayPeer::APP_DELAY_UID, null, Criteria::ISNOTNULL)->addAnd($criteria->getNewCriterion(AppDelayPeer::APP_TYPE, array("REASSIGN", "ADHOC", "CANCEL"), Criteria::NOT_IN))->addAnd($criteria->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, null, Criteria::ISNULL)->addOr($criteria->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, 0)))));
$rs = ApplicationPeer::doSelectRS($criteria);
$rs->next();
$row = $rs->getRow();
$response->casesNumRec = intval($row[0]);
$json = new Services_JSON();
$sOutput = $json->encode($response);
break;
}
if (isset($sOutput)) {
die($sOutput);
}
} catch (Exception $oException) {
die($oException->getMessage() . "\n" . $oException->getTraceAsString());
}
示例10: Cases
echo G::json_encode($result);
break;
case 'canDeleteUser':
G::LoadClass('case');
$oProcessMap = new Cases();
$USR_UID = $_POST['uUID'];
$total = 0;
$history = 0;
$c = $oProcessMap->getCriteriaUsersCases('TO_DO', $USR_UID);
$total += ApplicationPeer::doCount($c);
$c = $oProcessMap->getCriteriaUsersCases('DRAFT', $USR_UID);
$total += ApplicationPeer::doCount($c);
$c = $oProcessMap->getCriteriaUsersCases('COMPLETED', $USR_UID);
$history += ApplicationPeer::doCount($c);
$c = $oProcessMap->getCriteriaUsersCases('CANCELLED', $USR_UID);
$history += ApplicationPeer::doCount($c);
$response = '{success: true, candelete: ';
$response .= $total > 0 ? 'false' : 'true';
$response .= ', hashistory: ';
$response .= $history > 0 ? 'true' : 'false';
$response .= '}';
echo $response;
break;
case 'deleteUser':
$UID = $_POST['USR_UID'];
G::LoadClass('tasks');
$oTasks = new Tasks();
$oTasks->ofToAssignUserOfAllTasks($UID);
G::LoadClass('groups');
$oGroups = new Groups();
$oGroups->removeUserOfAllGroups($UID);
示例11: createApplication
public function createApplication($aData)
{
$c = new Criteria();
$c->clearSelectColumns();
$c->addSelectColumn('MAX(' . ApplicationPeer::APP_NUMBER . ')');
$c->add(ApplicationPeer::PRO_UID, $aData['PRO_UID']);
$result = ApplicationPeer::doSelectRS($c);
$result->next();
$row = $result->getRow();
$maxNumber = $row[0] + 1;
$this->setAppUid(G::generateUniqueID());
$this->setAppNumber($maxNumber);
$this->setAppParent(isset($aData['APP_PARENT']) ? $aData['APP_PARENT'] : 0);
$this->setAppStatus(isset($aData['APP_STATUS']) ? $aData['APP_STATUS'] : 'DRAFT');
$this->setProUid($aData['PRO_UID']);
$this->setAppProcStatus(isset($aData['APP_PROC_STATUS']) ? $aData['APP_PROC_STATUS'] : '');
$this->setAppProcCode(isset($aData['APP_PROC_CODE']) ? $aData['APP_PROC_CODE'] : '');
$this->setAppParallel(isset($aData['APP_PARALLEL']) ? $aData['APP_PARALLEL'] : 'N');
$this->setAppInitUser($aData['USR_UID']);
$this->setAppCurUser($aData['USR_UID']);
$this->setAppCreateDate(isset($aData['APP_CREATE_DATE']) ? $aData['APP_CREATE_DATE'] : 'now');
$this->setAppInitDate(isset($aData['APP_INIT_DATE']) ? $aData['APP_INIT_DATE'] : 'now');
$this->setAppUpdateDate(isset($aData['APP_UPDATE_DATE']) ? $aData['APP_UPDATE_DATE'] : 'now');
//$this->setAppData(serialize(array()));
/** Start Comment : Sets the $this->Fields['APP_DATA']
Merge between stored APP_DATA with new APP_DATA. **/
if (!$this->getAppData()) {
// if (!$this->is_new)
// {
// $this->load($fields['APP_UID']);
// }
}
$this->Fields['APP_DATA'] = isset($this->Fields['APP_DATA']) ? $this->Fields['APP_DATA'] : array();
if (isset($fields['APP_DATA']) && is_array($fields['APP_DATA'])) {
foreach ($fields['APP_DATA'] as $k => $v) {
$this->Fields['APP_DATA'][$k] = $v;
}
}
/** End Comment **/
/*
Begin Comment : Replace APP_DATA in APP_TITLE (before to serialize)
$pro = new process( $this->_dbc );
$pro->load((isset($fields['PRO_UID']) ? $fields['PRO_UID'] : $this->Fields['PRO_UID']));
$fields['APP_TITLE'] = G::replaceDataField( $pro->Fields['PRO_TITLE'], $this->Fields['APP_DATA']);
End Comment
*/
// parent::save();
// $this->Fields['APP_DATA'] = unserialize($this->Fields['APP_DATA']);
// /** Start Comment: Save in the table CONTENT */
// $this->content->saveContent('APP_TITLE',$fields);
// /** End Comment */
if ($this->validate()) {
$res = $this->save();
$this->setAppTitle('');
$this->setAppDescription('');
$this->setAppProcCode('');
} 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/>";
}
//return array ( 'codError' => -100, 'rowsAffected' => 0, 'message' => $msg );
}
return $this->getAppUid();
}
示例12: delete
/**
* Delete User
*
* @param string $usrUid Unique id of User
*
* return void
*/
public function delete($usrUid)
{
try {
//Verify data
$this->throwExceptionIfNotExistsUser($usrUid, $this->arrayFieldNameForException["usrUid"]);
\G::LoadClass('case');
$oProcessMap = new \Cases();
$USR_UID = $usrUid;
$total = 0;
$history = 0;
$c = $oProcessMap->getCriteriaUsersCases('TO_DO', $USR_UID);
$total += \ApplicationPeer::doCount($c);
$c = $oProcessMap->getCriteriaUsersCases('DRAFT', $USR_UID);
$total += \ApplicationPeer::doCount($c);
$c = $oProcessMap->getCriteriaUsersCases('COMPLETED', $USR_UID);
$history += \ApplicationPeer::doCount($c);
$c = $oProcessMap->getCriteriaUsersCases('CANCELLED', $USR_UID);
$history += \ApplicationPeer::doCount($c);
if ($total > 0) {
throw new \Exception(\G::LoadTranslation("ID_USER_CAN_NOT_BE_DELETED", array($USR_UID)));
} else {
$UID = $usrUid;
\G::LoadClass('tasks');
$oTasks = new \Tasks();
$oTasks->ofToAssignUserOfAllTasks($UID);
\G::LoadClass('groups');
$oGroups = new \Groups();
$oGroups->removeUserOfAllGroups($UID);
$this->changeUserStatus($UID, 'CLOSED');
$_GET['USR_USERNAME'] = '';
$this->updateUser(array('USR_UID' => $UID, 'USR_USERNAME' => $_GET['USR_USERNAME']), '');
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "Users.php");
$oUser = new \Users();
$aFields = $oUser->load($UID);
$aFields['USR_STATUS'] = 'CLOSED';
$aFields['USR_USERNAME'] = '';
$oUser->update($aFields);
//Delete Dashboard
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "DashletInstance.php");
$criteria = new \Criteria( 'workflow' );
$criteria->add( \DashletInstancePeer::DAS_INS_OWNER_UID, $UID );
$criteria->add( \DashletInstancePeer::DAS_INS_OWNER_TYPE , 'USER');
//.........这里部分代码省略.........
示例13: caseList
/**
* Get case list
*
* @param string $userId
* @return $result will return an object
*/
public function caseList($userId)
{
try {
$result = array();
$oCriteria = new Criteria('workflow');
$del = DBAdapter::getStringDelimiter();
$oCriteria->addSelectColumn(ApplicationPeer::APP_UID);
$oCriteria->addSelectColumn(ApplicationPeer::APP_NUMBER);
$oCriteria->addSelectColumn(ApplicationPeer::APP_STATUS);
$oCriteria->addSelectColumn(AppDelegationPeer::DEL_INDEX);
$oCriteria->addSelectColumn(ApplicationPeer::PRO_UID);
$oCriteria->addAsColumn('CASE_TITLE', 'C1.CON_VALUE');
$oCriteria->addAlias("C1", 'CONTENT');
$caseTitleConds = array();
$caseTitleConds[] = array(ApplicationPeer::APP_UID, 'C1.CON_ID');
$caseTitleConds[] = array('C1.CON_CATEGORY', $del . 'APP_TITLE' . $del);
$caseTitleConds[] = array('C1.CON_LANG', $del . SYS_LANG . $del);
$oCriteria->addJoinMC($caseTitleConds, Criteria::LEFT_JOIN);
$oCriteria->addJoin(ApplicationPeer::APP_UID, AppDelegationPeer::APP_UID, Criteria::LEFT_JOIN);
$oCriteria->add(ApplicationPeer::APP_STATUS, array('TO_DO', 'DRAFT'), Criteria::IN);
$oCriteria->add(AppDelegationPeer::USR_UID, $userId);
$oCriteria->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL);
$oCriteria->addDescendingOrderByColumn(ApplicationPeer::APP_NUMBER);
$oDataset = ApplicationPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
/*
$result[] = array(
'guid' => $aRow['APP_UID'],
'name' => $aRow['CASE_TITLE'],
'status' => $aRow['APP_STATUS'],
'delIndex' => $aRow['DEL_INDEX']
);
*/
$result[] = array('guid' => $aRow['APP_UID'], 'name' => $aRow['APP_NUMBER'], 'status' => $aRow['APP_STATUS'], 'delIndex' => $aRow['DEL_INDEX'], 'processId' => $aRow['PRO_UID']);
$oDataset->next();
}
return $result;
} catch (Exception $e) {
$result[] = array('guid' => $e->getMessage(), 'name' => $e->getMessage(), 'status' => $e->getMessage(), 'status' => $e->getMessage(), 'processId' => $e->getMessage());
return $result;
}
}
示例14: refreshTotal
public function refreshTotal ($userId, $type = 'add', $list = "inbox", $total = 1)
{
if ($userId == "") {
return;
}
$nameList = self::getNameTotal($list);
$criteria = new Criteria();
$criteria->addSelectColumn( $nameList );
$criteria->add( UsersPeer::USR_UID, $userId, Criteria::EQUAL );
$dataset = ApplicationPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();
$aRow = $dataset->getRow();
$num = $aRow[$nameList];
if ($type == 'add') {
$num++;
} else {
$num--;
}
$data = array(
'USR_UID' => $userId,
$nameList => $num
);
self::update($data);
}
示例15: executeEvents
public function executeEvents($sNow, $debug = false, &$log = array(), $cron = 0)
{
require_once 'classes/model/Configuration.php';
require_once 'classes/model/Triggers.php';
G::LoadClass('case');
$debug = 1;
$oCase = new Cases();
try {
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(AppEventPeer::APP_UID);
$oCriteria->addSelectColumn(AppEventPeer::DEL_INDEX);
$oCriteria->addSelectColumn(AppEventPeer::EVN_UID);
$oCriteria->addSelectColumn(AppEventPeer::APP_EVN_ACTION_DATE);
$oCriteria->addSelectColumn(AppEventPeer::APP_EVN_ATTEMPTS);
$oCriteria->addSelectColumn(AppEventPeer::APP_EVN_LAST_EXECUTION_DATE);
$oCriteria->addSelectColumn(AppEventPeer::APP_EVN_STATUS);
$oCriteria->addSelectColumn(EventPeer::PRO_UID);
$oCriteria->addSelectColumn(EventPeer::EVN_ACTION);
$oCriteria->addSelectColumn(EventPeer::TRI_UID);
$oCriteria->addSelectColumn(EventPeer::EVN_ACTION_PARAMETERS);
$oCriteria->addSelectColumn(EventPeer::EVN_RELATED_TO);
$oCriteria->addSelectColumn(AppDelegationPeer::TAS_UID);
$oCriteria->addSelectColumn(AppDelegationPeer::USR_UID);
$oCriteria->addSelectColumn(AppDelegationPeer::DEL_TASK_DUE_DATE);
$oCriteria->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE);
$oCriteria->addJoin(AppEventPeer::EVN_UID, EventPeer::EVN_UID, Criteria::JOIN);
$aConditions = array();
array_push($aConditions, array(AppEventPeer::APP_UID, AppDelegationPeer::APP_UID));
array_push($aConditions, array(AppEventPeer::DEL_INDEX, AppDelegationPeer::DEL_INDEX));
$oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
$oCriteria->addJoin(ApplicationPeer::APP_UID, AppEventPeer::APP_UID);
$oCriteria->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL);
//by me
$oCriteria->add(AppEventPeer::APP_EVN_STATUS, 'OPEN');
$oCriteria->add(AppEventPeer::APP_EVN_ACTION_DATE, $sNow, Criteria::LESS_EQUAL);
$oDataset = AppEventPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$c = 0;
while ($oDataset->next()) {
if ($cron == 1) {
$arrayCron = unserialize(trim(@file_get_contents(PATH_DATA . "cron")));
$arrayCron["processcTimeStart"] = time();
@file_put_contents(PATH_DATA . "cron", serialize($arrayCron));
}
$c++;
$aRow = $oDataset->getRow();
$oTrigger = new Triggers();
$aFields = $oCase->loadCase($aRow['APP_UID']);
$oAppEvent = AppEventPeer::retrieveByPK($aRow['APP_UID'], $aRow['DEL_INDEX'], $aRow['EVN_UID']);
//g::pr($aRow); //die;
if ($debug) {
require_once 'classes/model/Application.php';
$oApp = ApplicationPeer::retrieveByPk($aRow['APP_UID']);
$oEv = EventPeer::retrieveByPk($aRow['EVN_UID']);
$log[] = 'Event ' . $oEv->getEvnDescription() . ' with ID ' . $aRow['EVN_UID'];
println("\nOK+ event \"" . $oEv->getEvnDescription() . "\" with ID {} was found");
println(" - PROCESS................" . $aRow['PRO_UID']);
println(" - APPLICATION............" . $aRow['APP_UID'] . " CASE #" . $oApp->getAppNumber());
println(" - ACTION DATE............" . $aRow['APP_EVN_ACTION_DATE']);
println(" - ATTEMPTS..............." . $aRow['APP_EVN_ATTEMPTS']);
println(" - INTERVAL WITH TASKS...." . $aRow['EVN_RELATED_TO']);
}
if ($aRow['TRI_UID'] == '') {
//a rare case when the tri_uid is not set.
$log[] = " (!) Any trigger was set................................SKIPPED and will be CLOSED";
if ($debug) {
println(" (!) Any trigger was set................................SKIPPED and will be CLOSED");
}
$oAppEvent->setAppEvnStatus('CLOSE');
$oAppEvent->save();
continue;
}
$oTrigger = TriggersPeer::retrieveByPk($aRow['TRI_UID']);
if (!is_object($oTrigger)) {
//the trigger record doesn't exist..
$log[] = ' (!) The trigger ' . $aRow['TRI_UID'] . ' ' . $oTrigger->getTriTitle() . " doesn't exist.......SKIPPED and will be CLOSED";
if ($debug) {
println(" (!) The trigger {$aRow['TRI_UID']} {$oTrigger->getTriTitle()} doesn't exist.......SKIPPED and will be CLOSED");
}
$oAppEvent->setAppEvnStatus('CLOSE');
$oAppEvent->save();
continue;
}
global $oPMScript;
$oPMScript = new PMScript();
$task = new Task();
$taskFields = $task->Load($aRow['TAS_UID']);
$aFields['APP_DATA']['APP_NUMBER'] = $aFields['APP_NUMBER'];
$aFields['APP_DATA']['TAS_TITLE'] = $taskFields['TAS_TITLE'];
$aFields['APP_DATA']['DEL_TASK_DUE_DATE'] = $aRow['DEL_TASK_DUE_DATE'];
$oPMScript->setFields($aFields['APP_DATA']);
$oPMScript->setScript($oTrigger->getTriWebbot());
$oPMScript->execute();
$oAppEvent->setAppEvnLastExecutionDate(date('Y-m-d H:i:s'));
if (sizeof($_SESSION['TRIGGER_DEBUG']['ERRORS']) == 0) {
$log[] = ' - The trigger ' . $oTrigger->getTriTitle() . ' was executed successfully!';
if ($debug) {
println(" - The trigger '{$oTrigger->getTriTitle()}' was executed successfully!");
//g::pr($aFields);
}
//.........这里部分代码省略.........