Merge pull request #843 from Jennydmz/master

CODE STYLE changes...
This commit is contained in:
julceslauhub
2012-10-19 14:12:39 -07:00
11 changed files with 2458 additions and 2430 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -66,7 +66,7 @@ class pmGauge
$center_x = intval( $width / 2 );
$center_y = intval( $height / 2 );
//gauge color
//gauge color
$bgcolor = ImageColorAllocate( $im, 247, 247, 247 );
$extRing = ImageColorAllocate( $im, 214, 214, 214 );
$blueRing = ImageColorAllocate( $im, 70, 132, 238 );
@@ -85,26 +85,26 @@ class pmGauge
ImageFilledRectangle( $im, 0, 0, $width - 1, $height - 1, $white );
ImageRectangle( $im, 0, 0, $width - 1, $height - 1, $gray );
//center coords
//center coords
$cX = intval( $this->w / 2 );
//$cX = intval($this->w /4);
//$cX = intval($this->w /4);
$cY = intval( $this->h / 2 );
//diameter for gauge
//diameter for gauge
$diameter = intval( $this->h * 4 / 5 );
$this->renderGauge( $im, $cX, $cY, $diameter );
/*
//center coords
$cX = intval($this->w * 3/4);
$cY = intval($this->h /2);
//diameter for gauge
$diameter = intval( $this->h * 4/5 );
$this->renderGauge($im, $cX, $cY, $diameter);
*/
/*
//center coords
$cX = intval($this->w * 3/4);
$cY = intval($this->h /2);
//diameter for gauge
$diameter = intval( $this->h * 4/5 );
$this->renderGauge($im, $cX, $cY, $diameter);
*/
Header( "Content-type: image/png" );
ImagePng( $im );
@@ -112,7 +112,7 @@ class pmGauge
function renderGauge ($im, $cX, $cY, $diameter)
{
//gauge color
//gauge color
$bgcolor = ImageColorAllocate( $im, 247, 247, 247 );
$extRing = ImageColorAllocate( $im, 214, 214, 214 );
$blueRing = ImageColorAllocate( $im, 70, 132, 238 );
@@ -129,7 +129,7 @@ class pmGauge
$fontArial = PATH_THIRDPARTY . 'html2ps_pdf/fonts/arial.ttf';
$dX = intval( $diameter * 8 / 7 ); //for now ratio aspect is 8:7
$dX = intval( $diameter * 8 / 7 ); //for now ratio aspect is 8:7
$dY = intval( $diameter );
$dXRing = intval( $dX * 0.90 );
$dYRing = intval( $dY * 0.90 );
@@ -144,19 +144,25 @@ class pmGauge
imagefilledellipse( $im, $cX, $cY, $dXRing, $dYRing, $bgcolor );
//drawing the red arc
if ($this->redFrom > $this->maxValue)
//drawing the red arc
if ($this->redFrom > $this->maxValue) {
$this->redFrom = $this->maxValue;
if ($this->redTo > $this->maxValue)
}
if ($this->redTo > $this->maxValue) {
$this->redTo = $this->maxValue;
if ($this->yellowFrom > $this->maxValue)
}
if ($this->yellowFrom > $this->maxValue) {
$this->yellowFrom = $this->maxValue;
if ($this->yellowTo > $this->maxValue)
}
if ($this->yellowTo > $this->maxValue) {
$this->yellowTo = $this->maxValue;
if ($this->greenFrom > $this->maxValue)
}
if ($this->greenFrom > $this->maxValue) {
$this->greenFrom = $this->maxValue;
if ($this->greenTo > $this->maxValue)
}
if ($this->greenTo > $this->maxValue) {
$this->greenTo = $this->maxValue;
}
$redFrom = $this->redFrom / $this->maxValue * 300 - 240;
$redTo = $this->redTo / $this->maxValue * 300 - 240;
@@ -176,15 +182,16 @@ class pmGauge
}
imagefilledellipse( $im, $cX, $cY, $dXRingCenter, $dYRingCenter, $bgcolor );
//ticks
//ticks
$radiusX = intval( $dX * 0.42 );
$radiusY = intval( $dY * 0.42 );
$min = 5;
while ($min <= 55) {
if ($min % 5 == 0)
if ($min % 5 == 0) {
$len = $radiusX / 8;
else
} else {
$len = $radiusX / 25;
}
$ang = (2 * M_PI * $min) / 60;
$x1 = sin( $ang ) * ($radiusX - $len) + $cX;
@@ -198,7 +205,7 @@ class pmGauge
$textToDisplay = sprintf( "%d", (55 - $min) * $this->maxValue / 50 );
$bbox = imagettfbbox( 8, 0, $fontArial, $textToDisplay );
$x1 = sin( $ang ) * ($radiusX - 2.5 * $len) + $cX - $bbox[4] / 2;
$y1 = cos( $ang ) * ($radiusY - 2.5 * $len) + $cY + 2; // - abs($bbox[5]);
$y1 = cos( $ang ) * ($radiusY - 2.5 * $len) + $cY + 2; // - abs($bbox[5]);
imagettftext( $im, 8, 0, $x1, $y1, $gray, $fontArial, $textToDisplay );
}
$min ++;
@@ -215,7 +222,7 @@ class pmGauge
imagettftext( $im, 9, 0, $cX * 0.60, $cY * 1.8, $gray, $fontArial, $this->open );
imagettftext( $im, 9, 0, $cX * 1.40, $cY * 1.8, $gray, $fontArial, $this->completed );
//drawing the arrow, simple way
//drawing the arrow, simple way
$radiusX = intval( $dX * 0.35 );
$radiusY = intval( $dY * 0.35 );
@@ -224,41 +231,41 @@ class pmGauge
$y1 = cos( $ang ) * ($radiusY) + $cY;
ImageLine( $im, $cX, $cY, $x1, $y1, $arrowLine );
/*
//arrowLine
$arrowHeight = intval($dY * 0.02);
$arrowWidth = intval($dX * 0.35);
$arrowTail = intval($dX * 0.15);
$values = array(
0, -$arrowHeight,
-$arrowTail, 0,
0, $arrowHeight,
$arrowWidth, 0,
0, -$arrowHeight
);
//rotate n degrees
$n = 20;
$ang = (2 * M_PI * $n) / 60;
foreach ( $values as $k => $val ) {
if ( $k % 2 == 0 ) {
//$values[$k] = sin($ang)*$val + 20;
$values[$k] = sin($ang)*($val/$cX)*$;
$values[$k] += $cX;
}
else {
//$ys = intval(sin($sec * M_PI/30 - M_PI/2) * R);
//$values[$k] = intval(sin($n * M_PI/30 - M_PI/2) *$val);
$values[$k] = (cos($ang))*($val/$cY)*$cY;
$values[$k] += $cY;
}
}
imagefilledpolygon ($im, $values, 5, $arrowBody);
imagepolygon ($im, $values, 5, $arrowLine);
*/
//blue ring
/*
//arrowLine
$arrowHeight = intval($dY * 0.02);
$arrowWidth = intval($dX * 0.35);
$arrowTail = intval($dX * 0.15);
$values = array(
0, -$arrowHeight,
-$arrowTail, 0,
0, $arrowHeight,
$arrowWidth, 0,
0, -$arrowHeight
);
//rotate n degrees
$n = 20;
$ang = (2 * M_PI * $n) / 60;
foreach ( $values as $k => $val ) {
if ( $k % 2 == 0 ) {
//$values[$k] = sin($ang)*$val + 20;
$values[$k] = sin($ang)*($val/$cX)*$;
$values[$k] += $cX;
}
else {
//$ys = intval(sin($sec * M_PI/30 - M_PI/2) * R);
//$values[$k] = intval(sin($n * M_PI/30 - M_PI/2) *$val);
$values[$k] = (cos($ang))*($val/$cY)*$cY;
$values[$k] += $cY;
}
}
imagefilledpolygon ($im, $values, 5, $arrowBody);
imagepolygon ($im, $values, 5, $arrowLine);
*/
//blue ring
$dXBlueRing = $dX * 0.07;
$dYBlueRing = $dY * 0.07;
imagefilledellipse( $im, $cX, $cY, $dXBlueRing, $dXBlueRing, $blueRing );
@@ -273,5 +280,5 @@ class pmGauge
imagettftext( $im, 9, 0, $centerX, $centerY, $black, $fontArial, $textToDisplay );
}
}
}

View File

@@ -150,15 +150,18 @@ class propelTable
foreach ($orderFields as $field => $fieldOrder) {
$field = G::getUIDName( $field, '' );
$fieldOrder = strtoupper( $fieldOrder );
if ($fieldOrder === 'A')
if ($fieldOrder === 'A') {
$fieldOrder = 'ASC';
if ($fieldOrder === 'D')
}
if ($fieldOrder === 'D') {
$fieldOrder = 'DESC';
}
switch ($fieldOrder) {
case 'ASC':
case 'DESC':
if ($order !== '')
if ($order !== '') {
$order .= ', ';
}
$order .= $field . ' ' . $fieldOrder;
$this->aOrder[$field] = $fieldOrder;
}
@@ -175,10 +178,11 @@ class propelTable
$this->criteria->clearOrderByColumns();
}
foreach ($this->aOrder as $field => $ascending) {
if ($ascending == 'ASC')
if ($ascending == 'ASC') {
$this->criteria->addAscendingOrderByColumn( $field );
else
} else {
$this->criteria->addDescendingOrderByColumn( $field );
}
}
}
/**
@@ -215,18 +219,21 @@ class propelTable
$this->name = $xmlForm->name;
$this->id = $xmlForm->id;
//$this->sqlConnection=((isset($this->xmlForm->sqlConnection))?$this->xmlForm->sqlConnection:'');
if (isset( $_GET['page'] ))
if (isset( $_GET['page'] )) {
$this->currentPage = $_GET['page'];
else
} else {
$this->currentPage = 1;
if (isset( $_GET['order'] ))
}
if (isset( $_GET['order'] )) {
$this->orderBy = urldecode( $_GET['order'] );
else
} else {
$this->orderBy = "";
if (isset( $_GET['filter'] ))
}
if (isset( $_GET['filter'] )) {
$this->filter = urldecode( $_GET['filter'] );
else
} else {
$this->filter = "";
}
if ($xmlForm->ajaxServer != '') {
$this->ajaxServer = G::encryptLink( $xmlForm->ajaxServer );
} else {
@@ -235,12 +242,14 @@ class propelTable
$this->ownerPage = G::encryptLink( SYS_CURRENT_URI );
// Config attributes from XMLFORM file
$myAttributes = get_class_vars( get_class( $this ) );
foreach ($this->xmlForm->xmlform->tree->attribute as $atrib => $value)
foreach ($this->xmlForm->xmlform->tree->attribute as $atrib => $value) {
if (array_key_exists( $atrib, $myAttributes )) {
eval( 'settype($value, gettype($this->' . $atrib . '));' );
if ($value !== '')
if ($value !== '') {
eval( '$this->' . $atrib . '=$value;' );
}
}
}
if ($this->masterdetail != "") {
$this->masterdetail = explode( ",", $this->masterdetail );
foreach ($this->masterdetail as $keyMasterDetail => $valueMasterDetail) {
@@ -258,8 +267,9 @@ class propelTable
$r = $f;
$this->fields[$r]['Name'] = $this->xmlForm->fields[$f]->name;
$this->fields[$r]['Type'] = $this->xmlForm->fields[$f]->type;
if (isset( $this->xmlForm->fields[$f]->size ))
if (isset( $this->xmlForm->fields[$f]->size )) {
$this->fields[$r]['Size'] = $this->xmlForm->fields[$f]->size;
}
$this->fields[$r]['Label'] = $this->xmlForm->fields[$f]->label;
}
//Set the default settings
@@ -283,9 +293,11 @@ class propelTable
}
}
$totalWidth = 0;
foreach ($this->fields as $r => $rval)
if ($this->style[$r]['showInTable'] != '0')
foreach ($this->fields as $r => $rval) {
if ($this->style[$r]['showInTable'] != '0') {
$totalWidth += $this->style[$r]['colWidth'];
}
}
$this->totalWidth = $totalWidth;
}
@@ -313,13 +325,14 @@ class propelTable
{
//fix the bug about showing hidden fields in propel table.
foreach ($this->fields as $r => $rval) {
if ($this->style[$r]['type'] == 'hidden')
if ($this->style[$r]['type'] == 'hidden') {
$this->style[$r]['showInTable'] = '0';
}
}
//Render headers
$this->colCount = 0;
$this->shownFields = '[';
foreach ($this->fields as $r => $rval)
foreach ($this->fields as $r => $rval) {
if (($this->style[$r]['showInTable'] != '0') && (! (in_array( $this->fields[$r]['Name'], $this->masterdetail )))) {
//if (($this->style[$r]['showInTable'] != '0' ))
$this->tpl->newBlock( "headers" );
@@ -327,26 +340,31 @@ class propelTable
$sortOrder = (((isset( $this->aOrder[$this->fields[$r]['Name']] )) && ($this->aOrder[$this->fields[$r]['Name']] === 'DESC')) ? '' : $sortOrder);
$this->style[$r]['href'] = $this->ownerPage . '?order=' . ($sortOrder !== '' ? (G::createUID( '', $this->fields[$r]['Name'] ) . '=' . $sortOrder) : '') . '&page=' . $this->currentPage;
$this->style[$r]['onsort'] = $this->id . '.doSort("' . G::createUID( '', $this->fields[$r]['Name'] ) . '" , "' . $sortOrder . '");return false;';
if (isset( $this->style[$r]['href'] ))
if (isset( $this->style[$r]['href'] )) {
$this->tpl->assign( "href", $this->style[$r]['href'] );
if (isset( $this->style[$r]['onsort'] ))
}
if (isset( $this->style[$r]['onsort'] )) {
$this->tpl->assign( "onsort", htmlentities( $this->style[$r]['onsort'], ENT_QUOTES, 'UTF-8' ) );
}
/* BUG 8080 - erik: don't setup onclick on page table header, doesn't have sense and causing problems
if (isset($this->style[$r]['onclick']))
$this->tpl->assign( "onclick" , htmlentities( $this->style[$r]['onclick'] , ENT_QUOTES, 'UTF-8' ) );
*/
if (isset($this->style[$r]['onclick']))
$this->tpl->assign( "onclick" , htmlentities( $this->style[$r]['onclick'] , ENT_QUOTES, 'UTF-8' ) );
*/
if (isset( $this->style[$r]['colWidth'] ))
if (isset( $this->style[$r]['colWidth'] )) {
$this->tpl->assign( "width", $this->style[$r]['colWidth'] );
if (isset( $this->style[$r]['colWidth'] ))
}
if (isset( $this->style[$r]['colWidth'] )) {
$this->tpl->assign( "widthPercent", ($this->style[$r]['colWidth'] * 100 / $this->totalWidth) . "%" );
//Hook for special skin with RTL languajes
}
if (defined( 'SYS_LANG_DIRECTION' ) && SYS_LANG_DIRECTION == 'R') {
$this->style[$r]['titleAlign'] = 'right';
}
if (isset( $this->style[$r]['titleAlign'] ))
if (isset( $this->style[$r]['titleAlign'] )) {
$this->tpl->assign( "align", 'text-align:' . $this->style[$r]['titleAlign'] . ';' );
}
if ($this->style[$r]['titleVisibility'] != '0') {
$sortOrder = (((isset( $this->aOrder[$this->fields[$r]['Name']] )) && ($this->aOrder[$this->fields[$r]['Name']] === 'ASC')) ? '<img src="/images/arrow-up.gif">' : '');
$sortOrder = (((isset( $this->aOrder[$this->fields[$r]['Name']] )) && ($this->aOrder[$this->fields[$r]['Name']] === 'DESC')) ? '<img src="/images/arrow-down.gif">' : $sortOrder);
@@ -359,6 +377,7 @@ class propelTable
$this->shownFields .= ($this->shownFields !== '[') ? ',' : '';
$this->shownFields .= '"' . $r . '"';
}
}
$this->shownFields .= ']';
}
@@ -380,10 +399,11 @@ class propelTable
$styleData = $this->style[$r];
$fielDataName = $styleData['data'];
$fieldClassName = isset( $styleData['colClassName'] ) && ($styleData['colClassName']) ? $styleData['colClassName'] : $this->tdClass;
if ($fielDataName != '')
if ($fielDataName != '') {
$value = ((isset( $result[$fielDataName] )) ? $result[$fielDataName] : '');
else
} else {
$value = $this->fields[$r]['Label'];
}
$this->tpl->newBlock( "field" );
$this->tpl->assign( 'width', $this->style[$r]['colWidth'] );
$classAttr = (trim( $fieldClassName ) != '') ? " class=\"$fieldClassName\"" : '';
@@ -414,7 +434,7 @@ class propelTable
$this->xmlForm->setDefaultValues();
$this->xmlForm->setValues( $result );
//var_dump($fieldName, $fieldClass );echo '<br /><br />';
if (array_search( 'renderTable', get_class_methods( $fieldClass ) ) !== FALSE) {
if (array_search( 'renderTable', get_class_methods( $fieldClass ) ) !== false) {
$htmlField = $this->xmlForm->fields[$fieldName]->renderTable( $value, $this->xmlForm, true );
if (is_object( $value )) {
$value = '';
@@ -423,8 +443,9 @@ class propelTable
$testValue = preg_match( "/<a ?.*>(.*)<\/a>/i", $htmlField, $value );
$this->tpl->assign( "value", $htmlField );
if ($testValue > 0 && (isset( $value[1] ) && strlen( trim( $value[1] ) ) == 0)) {
if ((trim( $value[0] )) == '')
if ((trim( $value[0] )) == '') {
$this->tpl->assign( "value", "&nbsp;" );
}
// $this->tpl->assign( "value" , (preg_match('^[[:space:]]^', $value) && (substr($fieldName,0,3)!="PRO"))? str_ireplace(" ","&nbsp;",$htmlField):$htmlField );
} else {
$this->tpl->assign( "value", $htmlField );
@@ -453,51 +474,60 @@ class propelTable
$this->style[$r] = array ('showInTable' => '1','titleVisibility' => '1','colWidth' => '150','onclick' => '','event' => ''
);
//Some widths
if (! (strpos( ' date linknew ', ' ' . $this->fields[$r]['Type'] . ' ' ) === FALSE))
if (! (strpos( ' date linknew ', ' ' . $this->fields[$r]['Type'] . ' ' ) === false)) {
$this->style[$r]['colWidth'] = '70';
}
//Data source:
if (! (strpos( ' title button linknew image-text jslink ', ' ' . $this->fields[$r]['Type'] . ' ' ) === FALSE))
if (! (strpos( ' title button linknew image-text jslink ', ' ' . $this->fields[$r]['Type'] . ' ' ) === false)) {
$this->style[$r]['data'] = ''; //If the control is a link it shows the label
else
} else {
$this->style[$r]['data'] = $this->fields[$r]['Name']; //ELSE: The data value for that field
//Hidden fields
}
if (! isset( $this->style[$r]['showInTable'] )) {
if (! (strpos( ' title button endgrid2 submit password ', ' ' . $this->fields[$r]['Type'] . ' ' ) === FALSE)) {
if (! (strpos( ' title button endgrid2 submit password ', ' ' . $this->fields[$r]['Type'] . ' ' ) === false)) {
$this->style[$r]['showInTable'] = '0';
} else {
$this->style[$r]['showInTable'] = '1';
}
}
//Hidden titles
if (! (strpos( ' linknew button endgrid2 ', ' ' . $this->fields[$r]['Type'] . ' ' ) === FALSE)) {
if (! (strpos( ' linknew button endgrid2 ', ' ' . $this->fields[$r]['Type'] . ' ' ) === false)) {
$this->style[$r]['titleVisibility'] = '0';
}
//Align titles
$this->style[$r]['titleAlign'] = 'center';
//Align fields
if (defined( 'SYS_LANG_DIRECTION' ) && SYS_LANG_DIRECTION == 'R')
if (defined( 'SYS_LANG_DIRECTION' ) && SYS_LANG_DIRECTION == 'R') {
$this->style[$r]['align'] = 'right';
else
} else {
$this->style[$r]['align'] = 'left';
if (! (strpos( ' linknew date ', ' ' . $this->fields[$r]['Type'] . ' ' ) === FALSE)) {
}
if (! (strpos( ' linknew date ', ' ' . $this->fields[$r]['Type'] . ' ' ) === false)) {
$this->style[$r]['align'] = 'center';
}
}
// Adjust the columns width to prevent overflow the page width
//Render headers
$totalWidth = 0;
foreach ($this->fields as $r => $rval)
if ($this->style[$r]['showInTable'] != '0')
foreach ($this->fields as $r => $rval) {
if ($this->style[$r]['showInTable'] != '0') {
$totalWidth += $this->style[$r]['colWidth'];
}
}
$this->totalWidth = $totalWidth;
$maxWidth = 1800;
$proportion = $totalWidth / $maxWidth;
if ($proportion > 1)
if ($proportion > 1) {
$this->totalWidth = 1800;
if ($proportion > 1)
foreach ($this->fields as $r => $rval)
if ($this->style[$r]['showInTable'] != '0')
}
if ($proportion > 1) {
foreach ($this->fields as $r => $rval) {
if ($this->style[$r]['showInTable'] != '0') {
$this->style[$r]['colWidth'] = $this->style[$r]['colWidth'] / $proportion;
}
}
}
}
/**
@@ -512,12 +542,13 @@ class propelTable
{
//Render Title
$thereisnotitle = true;
foreach ($this->fields as $r => $rval)
foreach ($this->fields as $r => $rval) {
if ($this->fields[$r]['Type'] === 'title') {
$this->title = $this->fields[$r]['Label'];
unset( $this->fields[$r] );
$thereisnotitle = false;
}
}
if ($thereisnotitle) {
$this->title = '';
}
@@ -530,11 +561,12 @@ class propelTable
// verify if there are templates folders registered, template and method folders are the same
$folderTemplate = explode( '/', $this->template );
$oPluginRegistry = & PMPluginRegistry::getSingleton();
if ($oPluginRegistry->isRegisteredFolder( $folderTemplate[0] ))
if ($oPluginRegistry->isRegisteredFolder( $folderTemplate[0] )) {
$templateFile = PATH_PLUGINS . $this->template . '.html';
else
} else {
$templateFile = PATH_TPL . $this->template . '.html';
// Prepare the template
}
$this->tpl = new TemplatePower( $templateFile );
$this->tpl->prepare();
if (is_array( $fields )) {
@@ -553,8 +585,9 @@ class propelTable
$this->tpl->assign( "title", $this->title );
if (file_exists( $this->xmlForm->home . $this->filterForm . '.xml' )) {
$filterForm = new filterForm( $this->filterForm, $this->xmlForm->home );
if ($this->menu === '')
if ($this->menu === '') {
$this->menu = 'gulliver/pagedTable_Options';
}
}
if (file_exists( $this->xmlForm->home . $this->menu . '.xml' )) {
$menu = new xmlMenu( $this->menu, $this->xmlForm->home );
@@ -585,8 +618,9 @@ class propelTable
$this->tpl->assign( 'content', $filterForm->render( $template, $scriptCode ) );
$oHeadPublisher->addScriptFile( $filterForm->scriptURL );
$oHeadPublisher->addScriptCode( $scriptCode );
if (isset( $_SESSION ))
if (isset( $_SESSION )) {
$_SESSION[$filterForm->id] = $filterForm->values;
}
}
}
@@ -620,17 +654,17 @@ class propelTable
}
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
/*
print "<div class='pagedTableDefault'><table class='default'>";
$rs->next();
$row = $rs->getRow();
while ( is_array ( $row ) ) {
print "<tr class='Row1'>";
foreach ( $row as $k=>$v ) print "<td>$v</td>";
print "</tr>";
$rs->next();
$row = $rs->getRow();
}
print "</table></div>"; die;*/
print "<div class='pagedTableDefault'><table class='default'>";
$rs->next();
$row = $rs->getRow();
while ( is_array ( $row ) ) {
print "<tr class='Row1'>";
foreach ( $row as $k=>$v ) print "<td>$v</td>";
print "</tr>";
$rs->next();
$row = $rs->getRow();
}
print "</table></div>"; die;*/
$gridRows = 0;
$rs->next();
//Initialize the array of breakFields for Master Detail View
@@ -677,14 +711,16 @@ class propelTable
}
}
$this->tpl->gotoblock( "row" );
if (! isset( $rowName ))
if (! isset( $rowName )) {
$rowName = array ();
}
$this->tpl->assign( "rowName", implode( ",", $rowName ) );
}
//End Master Detail: This enable the MasterDEtail view
//Merge $result with $xmlForm values (for default valuesSettings)
if (is_array( $this->xmlForm->values ))
if (is_array( $this->xmlForm->values )) {
$result = array_merge( $this->xmlForm->values, $result );
}
foreach ($this->fields as $r => $rval) {
if (strcasecmp( $this->fields[$r]['Type'], 'cellMark' ) == 0) {
$result1 = $result;
@@ -695,8 +731,9 @@ class propelTable
$this->tdStyle = $this->xmlForm->fields[$this->fields[$r]['Name']]->tdStyle( $result1, $this->xmlForm );
$this->tdClass = $this->xmlForm->fields[$this->fields[$r]['Name']]->tdClass( $result1, $this->xmlForm );
} elseif ($this->style[$r]['showInTable'] != '0') {
if (($this->style[$r]['showInTable'] != '0') && (! (in_array( $this->fields[$r]['Name'], $this->masterdetail ))))
if (($this->style[$r]['showInTable'] != '0') && (! (in_array( $this->fields[$r]['Name'], $this->masterdetail )))) {
$this->renderField( $j + 1, $r, $result );
}
}
}
}
@@ -728,20 +765,23 @@ class propelTable
$last = "<a class='noLastPage'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>";
}
$pagesEnum = '';
for ($r = 1; $r <= $this->totPages; $r ++)
for ($r = 1; $r <= $this->totPages; $r ++) {
if (($r >= ($this->currentPage - 5)) && ($r <= ($this->currentPage + 5))) {
$pageAjax = $this->id . ".doGoToPage(" . $r . ");return false;";
if ($r != $this->currentPage)
if ($r != $this->currentPage) {
$pagesEnum .= "&nbsp;<a href=\"" . htmlentities( $this->ownerPage . '?order=' . $this->orderBy . '&page=' . $r, ENT_QUOTES, 'utf-8' ) . "\" onclick=\"" . $pageAjax . "\">" . $r . "</a>";
else
} else {
$pagesEnum .= "&nbsp;<a>" . $r . "</a>";
}
}
}
if ($this->totRows === 0) {
$this->tpl->newBlock( 'norecords' );
$this->tpl->assign( "columnCount", $this->colCount );
$noRecordsFound = 'ID_NO_RECORDS_FOUND';
if (G::LoadTranslation( $noRecordsFound ))
if (G::LoadTranslation( $noRecordsFound )) {
$noRecordsFound = G::LoadTranslation( $noRecordsFound );
}
$this->tpl->assign( "noRecordsFound", $noRecordsFound );
}
if (! $this->disableFooter) {
@@ -770,32 +810,34 @@ class propelTable
} else {
$this->tpl->assign( "fastSearchStyle", 'visibility:hidden;' );
}
if ($this->addRow)
if ($this->sqlInsert != '')
if ($this->addRow) {
if ($this->sqlInsert != '') {
$this->tpl->assign( "insert", '<a href="#" onclick="pagedTable.event=\'Insert\';popup(\'' . $this->popupPage . '\');return false;">'./*G::LoadXml('labels','ID_ADD_NEW')*/ 'ID_ADD_NEW' . '</a>' );
}
}
$this->tpl->assign( "pagesEnum", $pagesEnum );
}
?>
<script language='JavaScript'>
var <?php echo $this->id?><?php echo ($this->name != '' ? '='.$this->name : '')?>=new G_PagedTable();
<?php echo $this->id?>.id<?php echo '="'. addslashes($this->id) . '"'?>;
<?php echo $this->id?>.name<?php echo '="'. addslashes($this->name) . '"'?>;
<?php echo $this->id?>.ajaxUri<?php echo '="'. addslashes($this->ajaxServer) . '?ptID='.$this->id.'"'?>;
<?php echo $this->id?>.currentOrder<?php echo '="'. addslashes($this->orderBy) . '"'?>;
<?php echo $this->id?>.currentFilter;
<?php echo $this->id?>.currentPage<?php echo '='. $this->currentPage?>;
<?php echo $this->id?>.totalRows<?php echo '='.$this->totRows ?>;
<?php echo $this->id?>.rowsPerPage<?php echo '='.$this->rowsPerPage?>;
<?php echo $this->id?>.popupPage<?php echo '="'. addslashes($this->popupPage) . '?ptID='.$this->id.'"'?>;
<?php echo $this->id?>.onUpdateField<?php echo '="'. addslashes($this->onUpdateField) . '"'?>;
<?php echo $this->id?>.shownFields<?php echo '='.$this->shownFields ?>;
<script language='JavaScript'>
var <?php echo $this->id?><?php echo ($this->name != '' ? '='.$this->name : '')?>=new G_PagedTable();
<?php echo $this->id?>.id<?php echo '="'. addslashes($this->id) . '"'?>;
<?php echo $this->id?>.name<?php echo '="'. addslashes($this->name) . '"'?>;
<?php echo $this->id?>.ajaxUri<?php echo '="'. addslashes($this->ajaxServer) . '?ptID='.$this->id.'"'?>;
<?php echo $this->id?>.currentOrder<?php echo '="'. addslashes($this->orderBy) . '"'?>;
<?php echo $this->id?>.currentFilter;
<?php echo $this->id?>.currentPage<?php echo '='. $this->currentPage?>;
<?php echo $this->id?>.totalRows<?php echo '='.$this->totRows ?>;
<?php echo $this->id?>.rowsPerPage<?php echo '='.$this->rowsPerPage?>;
<?php echo $this->id?>.popupPage<?php echo '="'. addslashes($this->popupPage) . '?ptID='.$this->id.'"'?>;
<?php echo $this->id?>.onUpdateField<?php echo '="'. addslashes($this->onUpdateField) . '"'?>;
<?php echo $this->id?>.shownFields<?php echo '='.$this->shownFields ?>;
var panelPopup;
var popupWidth<?php echo '='.$this->popupWidth?>;
var popupHeight<?php echo '='.$this->popupHeight?>;
</script>
<?php
var panelPopup;
var popupWidth<?php echo '='.$this->popupWidth?>;
var popupHeight<?php echo '='.$this->popupHeight?>;
</script>
<?php
}
/**
* ******** CLOSE BLOCK **************
@@ -831,4 +873,5 @@ var popupHeight<?php echo '='.$this->popupHeight?>;
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', $filename, '', $data, $this->popupSubmit );
G::RenderPage( "publish", "blank" );
}
}
}

View File

@@ -2,156 +2,154 @@
class Entity_Base
{
/**
* this function check if a field is in the data sent in the constructor
* you can specify an array, and this function will use like alias
*/
protected function validateField($field, $default = false)
{
$fieldIsEmpty = true;
// this is a trick, if $fields is a string, $fields will be an array with
// one element
if (is_array ($field)) {
$fields = $field;
}
else {
$fields = array ();
$fields [] = $field;
}
// if there are aliases for this field, evaluate all aliases and take the
// first occurence
foreach ($fields as $k => $f) {
if (isset ($this->temp [$f])) {
$fieldIsEmpty = false;
return $this->temp [$f];
}
}
// field empty means the user has not sent a value for this Field, so we are
// using the default value
if ($fieldIsEmpty) {
if ($default !== false) {
return $default;
}
}
}
protected function validateRequiredFields($requiredFields = array())
{
foreach ($requiredFields as $k => $field) {
if ($this->{$field} === NULL) {
throw (new Exception ("Field $field is required in " . get_class ($this)));
die ();
}
}
}
/**
*
*
*
* Copy the values of the Entity to the array of aliases
* The array of aliases must be defined.
*
* @return Array of alias with the Entity values
*/
public function getAliasDataArray()
{
$aAlias = array ();
// get aliases from class
$className = get_class ($this);
if (method_exists ($className, 'GetAliases')) {
$aliases = call_user_func (array (
$className,
'GetAliases'
));
// $aliases = $className::GetAliases ();
foreach ($this as $field => $value)
if (isset ($aliases [$field])) {
// echo "Field exists in Aliases: " . $field . "\n";
// echo "Alias Name:" . $aliases[$field] . "\n";
// echo "Alias value:" . $value . "\n";
$aAlias [$aliases [$field]] = $value;
/**
* this function check if a field is in the data sent in the constructor
* you can specify an array, and this function will use like alias
*/
protected function validateField ($field, $default = false)
{
$fieldIsEmpty = true;
// this is a trick, if $fields is a string, $fields will be an array with
// one element
if (is_array( $field )) {
$fields = $field;
} else {
$fields = array ();
$fields[] = $field;
}
// if there are aliases for this field, evaluate all aliases and take the
// first occurence
foreach ($fields as $k => $f) {
if (isset( $this->temp[$f] )) {
$fieldIsEmpty = false;
return $this->temp[$f];
}
}
// field empty means the user has not sent a value for this Field, so we are
// using the default value
if ($fieldIsEmpty) {
if ($default !== false) {
return $default;
}
}
}
return $aAlias;
}
/**
*
*
*
* Set the data from array of alias to Entity
*
* @param $aAliasData array
* of data of aliases
*/
public function setAliasDataArray($aAliasData)
{
// get aliases from class
$className = get_class ($this);
if (method_exists ($className, 'GetAliases')) {
$aliases = call_user_func (array (
$className,
'GetAliases'
));
// $aliases = $className::GetAliases ();
foreach ($this as $field => $value)
if (isset ($aliases [$field]))
$this->{$field} = $aAliasData [$aliases [$field]];
}
}
/**
*
*
*
* Initialize object with values from $data.
* The values from data use properties or alias array.
*
* @param
* $data
*/
protected function initializeObject($data)
{
// get aliases from class
$className = get_class ($this);
$aliases = array ();
$swAliases = false;
if (method_exists ($className, 'GetAliases')) {
$aliases = call_user_func (array (
$className,
'GetAliases'
));
// $aliases = $className::GetAliases ();
$swAliases = true;
}
// use object properties or aliases to initialize
foreach ($this as $field => $value)
if (isset ($data [$field])) {
$this->$field = $data [$field];
}
elseif ($swAliases && isset ($aliases [$field]) && isset ($data [$aliases [$field]])) {
$this->$field = $data [$aliases [$field]];
}
}
public function serialize()
{
if (isset ($this->temp))
unset ($this->temp);
return serialize ($this);
}
public function unserialize($str)
{
$className = get_class ($this);
$data = unserialize ($str);
return new $className ($data);
}
}
protected function validateRequiredFields ($requiredFields = array())
{
foreach ($requiredFields as $k => $field) {
if ($this->{$field} === null) {
throw (new Exception( "Field $field is required in " . get_class( $this ) ));
die();
}
}
}
/**
*
*
*
*
* Copy the values of the Entity to the array of aliases
* The array of aliases must be defined.
*
* @return Array of alias with the Entity values
*/
public function getAliasDataArray ()
{
$aAlias = array ();
// get aliases from class
$className = get_class( $this );
if (method_exists( $className, 'GetAliases' )) {
$aliases = call_user_func( array ($className,'GetAliases'
) );
// $aliases = $className::GetAliases ();
foreach ($this as $field => $value) {
if (isset( $aliases[$field] )) {
// echo "Field exists in Aliases: " . $field . "\n";
// echo "Alias Name:" . $aliases[$field] . "\n";
// echo "Alias value:" . $value . "\n";
$aAlias[$aliases[$field]] = $value;
}
}
}
return $aAlias;
}
/**
*
*
*
*
* Set the data from array of alias to Entity
*
* @param $aAliasData array of data of aliases
*/
public function setAliasDataArray ($aAliasData)
{
// get aliases from class
$className = get_class( $this );
if (method_exists( $className, 'GetAliases' )) {
$aliases = call_user_func( array ($className,'GetAliases'
) );
// $aliases = $className::GetAliases ();
foreach ($this as $field => $value) {
if (isset( $aliases[$field] )) {
$this->{$field} = $aAliasData[$aliases[$field]];
}
}
}
}
/**
*
*
*
*
* Initialize object with values from $data.
* The values from data use properties or alias array.
*
* @param $data
*/
protected function initializeObject ($data)
{
// get aliases from class
$className = get_class( $this );
$aliases = array ();
$swAliases = false;
if (method_exists( $className, 'GetAliases' )) {
$aliases = call_user_func( array ($className,'GetAliases'
) );
// $aliases = $className::GetAliases ();
$swAliases = true;
}
// use object properties or aliases to initialize
foreach ($this as $field => $value) {
if (isset( $data[$field] )) {
$this->$field = $data[$field];
} elseif ($swAliases && isset( $aliases[$field] ) && isset( $data[$aliases[$field]] )) {
$this->$field = $data[$aliases[$field]];
}
}
}
public function serialize ()
{
if (isset( $this->temp )) {
unset( $this->temp );
}
return serialize( $this );
}
public function unserialize ($str)
{
$className = get_class( $this );
$data = unserialize( $str );
return new $className( $data );
}
}

View File

@@ -1,337 +1,358 @@
<?php
/**
* AppEvent.php
* @package workflow.engine.classes.model
*
* @package workflow.engine.classes.model
*/
require_once 'classes/model/om/BaseAppEvent.php';
/**
* Skeleton subclass for representing a row from the 'APP_EVENT' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package workflow.engine.classes.model
* @package workflow.engine.classes.model
*/
class AppEvent extends BaseAppEvent {
public function load($sApplicationUID, $iDelegation) {
try {
$oAppEvent = AppEventPeer::retrieveByPK($sApplicationUID, $iDelegation);
if (!is_null($oAppEvent)) {
$aFields = $oAppEvent->toArray(BasePeer::TYPE_FIELDNAME);
$this->fromArray($aFields, BasePeer::TYPE_FIELDNAME);
return $aFields;
}
else {
throw(new Exception('This row doesn\'t exist!'));
}
}
catch (Exception $oError) {
throw($oError);
}
}
class AppEvent extends BaseAppEvent
{
function create($aData) {
$oConnection = Propel::getConnection(AppEventPeer::DATABASE_NAME);
try {
$oAppEvent = new AppEvent();
$oAppEvent->fromArray($aData, BasePeer::TYPE_FIELDNAME);
if ($oAppEvent->validate()) {
$oConnection->begin();
$iResult = $oAppEvent->save();
$oConnection->commit();
return true;
}
else {
$sMessage = '';
$aValidationFailures = $oAppEvent->getValidationFailures();
foreach($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
public function load ($sApplicationUID, $iDelegation)
{
try {
$oAppEvent = AppEventPeer::retrieveByPK( $sApplicationUID, $iDelegation );
if (! is_null( $oAppEvent )) {
$aFields = $oAppEvent->toArray( BasePeer::TYPE_FIELDNAME );
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
return $aFields;
} else {
throw (new Exception( 'This row doesn\'t exist!' ));
}
} catch (Exception $oError) {
throw ($oError);
}
throw(new Exception('The registry cannot be created!<br />' . $sMessage));
}
}
catch (Exception $oError) {
$oConnection->rollback();
throw($oError);
}
}
function update($aData) {
$oConnection = Propel::getConnection(AppEventPeer::DATABASE_NAME);
try {
$oAppEvent = AppEventPeer::retrieveByPK($aData['APP_UID'], $aData['DEL_INDEX']);
if (!is_null($oAppEvent)) {
$oAppEvent->fromArray($aData, BasePeer::TYPE_FIELDNAME);
if ($oAppEvent->validate()) {
$oConnection->begin();
$iResult = $oAppEvent->save();
$oConnection->commit();
return $iResult;
function create ($aData)
{
$oConnection = Propel::getConnection( AppEventPeer::DATABASE_NAME );
try {
$oAppEvent = new AppEvent();
$oAppEvent->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
if ($oAppEvent->validate()) {
$oConnection->begin();
$iResult = $oAppEvent->save();
$oConnection->commit();
return true;
} else {
$sMessage = '';
$aValidationFailures = $oAppEvent->getValidationFailures();
foreach ($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
}
throw (new Exception( 'The registry cannot be created!<br />' . $sMessage ));
}
} catch (Exception $oError) {
$oConnection->rollback();
throw ($oError);
}
else {
$sMessage = '';
$aValidationFailures = $oAppEvent->getValidationFailures();
foreach($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
}
throw(new Exception('The registry cannot be updated!<br />'.$sMessage));
}
function update ($aData)
{
$oConnection = Propel::getConnection( AppEventPeer::DATABASE_NAME );
try {
$oAppEvent = AppEventPeer::retrieveByPK( $aData['APP_UID'], $aData['DEL_INDEX'] );
if (! is_null( $oAppEvent )) {
$oAppEvent->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
if ($oAppEvent->validate()) {
$oConnection->begin();
$iResult = $oAppEvent->save();
$oConnection->commit();
return $iResult;
} else {
$sMessage = '';
$aValidationFailures = $oAppEvent->getValidationFailures();
foreach ($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
}
throw (new Exception( 'The registry cannot be updated!<br />' . $sMessage ));
}
} else {
throw (new Exception( 'This row doesn\'t exist!' ));
}
} catch (Exception $oError) {
$oConnection->rollback();
throw ($oError);
}
}
else {
throw(new Exception('This row doesn\'t exist!'));
}
}
catch (Exception $oError) {
$oConnection->rollback();
throw($oError);
}
}
function remove($sApplicationUID, $iDelegation, $sEvnUid) {
$oConnection = Propel::getConnection(AppEventPeer::DATABASE_NAME);
try {
$oAppEvent = AppEventPeer::retrieveByPK($sApplicationUID, $iDelegation, $sEvnUid);
if (!is_null($oAppEvent)) {
$oConnection->begin();
$iResult = $oAppEvent->delete();
$oConnection->commit();
return $iResult;
}
else {
throw(new Exception('This row doesn\'t exist!'));
}
function remove ($sApplicationUID, $iDelegation, $sEvnUid)
{
$oConnection = Propel::getConnection( AppEventPeer::DATABASE_NAME );
try {
$oAppEvent = AppEventPeer::retrieveByPK( $sApplicationUID, $iDelegation, $sEvnUid );
if (! is_null( $oAppEvent )) {
$oConnection->begin();
$iResult = $oAppEvent->delete();
$oConnection->commit();
return $iResult;
} else {
throw (new Exception( 'This row doesn\'t exist!' ));
}
} catch (Exception $oError) {
$oConnection->rollback();
throw ($oError);
}
}
catch (Exception $oError) {
$oConnection->rollback();
throw($oError);
}
}
function getAppEventsCriteria($sProcessUid='', $sStatus = '', $EVN_ACTION='') {
function getAppEventsCriteria ($sProcessUid = '', $sStatus = '', $EVN_ACTION = '')
{
try {
require_once 'classes/model/Event.php';
$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_WHEN_OCCURS);
$oCriteria->addSelectColumn(EventPeer::EVN_ACTION);
$oCriteria->addAsColumn('EVN_DESCRIPTION', 'C1.CON_VALUE');
$oCriteria->addAsColumn('TAS_TITLE', 'C2.CON_VALUE');
$oCriteria->addAsColumn('APP_TITLE', 'C3.CON_VALUE');
$oCriteria->addAsColumn('PRO_TITLE', 'C4.CON_VALUE');
$oCriteria->addAlias('C1', 'CONTENT');
$oCriteria->addAlias('C2', 'CONTENT');
$oCriteria->addAlias('C3', 'CONTENT');
$oCriteria->addAlias('C4', 'CONTENT');
$oCriteria->addJoin(AppEventPeer::EVN_UID, EventPeer::EVN_UID, Criteria::LEFT_JOIN);
$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_WHEN_OCCURS );
$oCriteria->addSelectColumn( EventPeer::EVN_ACTION );
$oCriteria->addAsColumn( 'EVN_DESCRIPTION', 'C1.CON_VALUE' );
$oCriteria->addAsColumn( 'TAS_TITLE', 'C2.CON_VALUE' );
$oCriteria->addAsColumn( 'APP_TITLE', 'C3.CON_VALUE' );
$oCriteria->addAsColumn( 'PRO_TITLE', 'C4.CON_VALUE' );
$oCriteria->addAlias( 'C1', 'CONTENT' );
$oCriteria->addAlias( 'C2', 'CONTENT' );
$oCriteria->addAlias( 'C3', 'CONTENT' );
$oCriteria->addAlias( 'C4', 'CONTENT' );
$oCriteria->addJoin( AppEventPeer::EVN_UID, EventPeer::EVN_UID, Criteria::LEFT_JOIN );
$del = DBAdapter::getStringDelimiter();
$aConditions = array();
$aConditions[] = array(EventPeer::EVN_UID, 'C1.CON_ID');
$aConditions[] = array('C1.CON_CATEGORY', $del . 'EVN_DESCRIPTION' . $del);
$aConditions[] = array('C1.CON_LANG', $del . SYS_LANG . $del);
$oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
$aConditions = array();
$aConditions[] = array(AppEventPeer::APP_UID, AppDelegationPeer::APP_UID);
$aConditions[] = array(AppEventPeer::DEL_INDEX, AppDelegationPeer::DEL_INDEX);
$oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
$aConditions = array();
$aConditions[] = array(AppDelegationPeer::TAS_UID, 'C2.CON_ID');
$aConditions[] = array('C2.CON_CATEGORY', $del . 'TAS_TITLE' . $del);
$aConditions[] = array('C2.CON_LANG', $del . SYS_LANG . $del);
$oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
$aConditions = array();
$aConditions[] = array(AppDelegationPeer::APP_UID, 'C3.CON_ID');
$aConditions[] = array('C3.CON_CATEGORY', $del . 'APP_TITLE' . $del);
$aConditions[] = array('C3.CON_LANG', $del . SYS_LANG . $del);
$oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
$aConditions = array();
$aConditions[] = array(AppDelegationPeer::PRO_UID, 'C4.CON_ID');
$aConditions[] = array('C4.CON_CATEGORY', $del . 'PRO_TITLE' . $del);
$aConditions[] = array('C4.CON_LANG', $del . SYS_LANG . $del);
$aConditions = array ();
$aConditions[] = array (EventPeer::EVN_UID,'C1.CON_ID'
);
$aConditions[] = array ('C1.CON_CATEGORY',$del . 'EVN_DESCRIPTION' . $del
);
$aConditions[] = array ('C1.CON_LANG',$del . SYS_LANG . $del
);
$oCriteria->addJoinMC( $aConditions, Criteria::LEFT_JOIN );
$aConditions = array ();
$aConditions[] = array (AppEventPeer::APP_UID,AppDelegationPeer::APP_UID
);
$aConditions[] = array (AppEventPeer::DEL_INDEX,AppDelegationPeer::DEL_INDEX
);
$oCriteria->addJoinMC( $aConditions, Criteria::LEFT_JOIN );
$aConditions = array ();
$aConditions[] = array (AppDelegationPeer::TAS_UID,'C2.CON_ID'
);
$aConditions[] = array ('C2.CON_CATEGORY',$del . 'TAS_TITLE' . $del
);
$aConditions[] = array ('C2.CON_LANG',$del . SYS_LANG . $del
);
$oCriteria->addJoinMC( $aConditions, Criteria::LEFT_JOIN );
$aConditions = array ();
$aConditions[] = array (AppDelegationPeer::APP_UID,'C3.CON_ID'
);
$aConditions[] = array ('C3.CON_CATEGORY',$del . 'APP_TITLE' . $del
);
$aConditions[] = array ('C3.CON_LANG',$del . SYS_LANG . $del
);
$oCriteria->addJoinMC( $aConditions, Criteria::LEFT_JOIN );
$aConditions = array ();
$aConditions[] = array (AppDelegationPeer::PRO_UID,'C4.CON_ID'
);
$aConditions[] = array ('C4.CON_CATEGORY',$del . 'PRO_TITLE' . $del
);
$aConditions[] = array ('C4.CON_LANG',$del . SYS_LANG . $del
);
$oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
$oCriteria->add(AppEventPeer::EVN_UID, '', Criteria::NOT_EQUAL);
if($sProcessUid != ''){
$oCriteria->add(EventPeer::PRO_UID, $sProcessUid);
$oCriteria->addJoinMC( $aConditions, Criteria::LEFT_JOIN );
$oCriteria->add( AppEventPeer::EVN_UID, '', Criteria::NOT_EQUAL );
if ($sProcessUid != '') {
$oCriteria->add( EventPeer::PRO_UID, $sProcessUid );
}
if($EVN_ACTION != ''){
$oCriteria->add(EventPeer::EVN_ACTION, $EVN_ACTION);
if ($EVN_ACTION != '') {
$oCriteria->add( EventPeer::EVN_ACTION, $EVN_ACTION );
}
switch ($sStatus) {
case '':
//Nothing
break;
break;
case 'PENDING':
$oCriteria->add(AppEventPeer::APP_EVN_STATUS, 'OPEN');
break;
$oCriteria->add( AppEventPeer::APP_EVN_STATUS, 'OPEN' );
break;
case 'COMPLETED':
$oCriteria->add(AppEventPeer::APP_EVN_STATUS, 'CLOSE');
break;
$oCriteria->add( AppEventPeer::APP_EVN_STATUS, 'CLOSE' );
break;
}
//$oCriteria->addDescendingOrderByColumn(AppEventPeer::APP_EVN_ACTION_DATE);
return $oCriteria;
}
catch (Exception $oError) {
throw($oError);
} catch (Exception $oError) {
throw ($oError);
}
}
public function executeEvents($sNow, $debug=false, &$log=array(), $cron=0) {
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');
require_once 'classes/model/Configuration.php';
require_once 'classes/model/Triggers.php';
G::LoadClass( 'case' );
$debug = 1;
$oCase = new Cases();
$debug = 1;
$oCase = new Cases();
try {
$oCriteria = new Criteria('workflow');
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->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;
$oCriteria->addJoin(AppEventPeer::EVN_UID, EventPeer::EVN_UID, Criteria::JOIN);
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'];
$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);
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'] );
}
$oCriteria->addJoin(ApplicationPeer::APP_UID, AppEventPeer::APP_UID);
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;
}
$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);
$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;
}
$oDataset = AppEventPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
global $oPMScript;
$oPMScript = new PMScript();
$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));
$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);
}
$aFields['APP_DATA'] = $oPMScript->aFields;
$oCase->updateCase( $aRow['APP_UID'], $aFields );
$oAppEvent->setAppEvnStatus( 'CLOSE' );
} else {
if ($debug) {
$log[] = ' - The trigger ' . $aRow['TRI_UID'] . ' throw some errors!';
println( " - The trigger {$aRow['TRI_UID']} throw some errors!" );
print_r( $_SESSION['TRIGGER_DEBUG']['ERRORS'] );
}
if ($oAppEvent->getAppEvnAttempts() > 0) {
$oAppEvent->setAppEvnAttempts( $oAppEvent->getAppEvnAttempts() - 1 );
} else {
$oAppEvent->setAppEvnStatus( 'CLOSE' );
}
}
$oAppEvent->save();
}
return $c;
} catch (Exception $oError) {
$log[] = ' Error execute event : ' . $oError->getMessage();
die( $oError->getMessage() );
return $oError->getMessage();
}
$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);
$aFields['APP_DATA'] = $oPMScript->aFields;
$oCase->updateCase($aRow['APP_UID'], $aFields);
$oAppEvent->setAppEvnStatus('CLOSE');
} else {
if($debug) {
$log[] = ' - The trigger ' . $aRow['TRI_UID'] . ' throw some errors!';
println(" - The trigger {$aRow['TRI_UID']} throw some errors!");
print_r($_SESSION['TRIGGER_DEBUG']['ERRORS']);
}
if ( $oAppEvent->getAppEvnAttempts() > 0 ){
$oAppEvent->setAppEvnAttempts($oAppEvent->getAppEvnAttempts() - 1);
} else {
$oAppEvent->setAppEvnStatus('CLOSE');
}
}
$oAppEvent->save();
}
return $c;
}
catch (Exception $oError) {
$log[] = ' Error execute event : ' . $oError->getMessage();
die($oError->getMessage());
return $oError->getMessage();
function close ($APP_UID, $DEL_INDEX)
{
$aRow = $this->load( $APP_UID, $DEL_INDEX );
$aRow['APP_EVN_STATUS'] = 'CLOSE';
$this->update( $aRow );
}
}
}
// AppEvent
function close($APP_UID, $DEL_INDEX){
$aRow = $this->load($APP_UID, $DEL_INDEX);
$aRow['APP_EVN_STATUS'] = 'CLOSE';
$this->update($aRow);
}
} // AppEvent

View File

@@ -1,11 +1,11 @@
<?php
/**
* AppMessage.php
** @package workflow.engine.classes.model
*
* * @package workflow.engine.classes.model
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
@@ -13,15 +13,14 @@
*
* 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
* 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.,
* 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.
*
*/
require_once 'classes/model/om/BaseAppMessage.php';
@@ -29,93 +28,98 @@ require_once 'classes/model/om/BaseAppMessage.php';
/**
* Skeleton subclass for representing a row from the 'APP_MESSAGE' table.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package workflow.engine.classes.model
* @package workflow.engine.classes.model
*/
class AppMessage extends BaseAppMessage {
private $data_spool;
private $status_spool;
private $error_spool;
public function getSpoolStatus() {
return $this->status_spool;
}
public function getSpoolError() {
return $this->error_spool;
}
/**
* AppMessgae quick Save method
* @param Array(msg_uid, app_uid, del_index, app_msg_type, app_msg_subject, app_msg_from, app_msg_to,
* app_msg_body, app_msg_cc, app_msg_bcc, app_msg_attach, app_msg_template, app_msg_status )
*
* @author Erik Amaru Ortiz <erik@colosa.com, aortiz.erik@gmai.com>
* Date Aug 31th, 2009
*/
public function quickSave2($data_spool) {
$this->data_spool = $data_spool;
$sUID = G::generateUniqueID();
$spool = new AppMessage();
$spool->setAppMsgUid($sUID);
$spool->setMsgUid($data_spool['msg_uid']);
$spool->setAppUid($data_spool['app_uid']);
$spool->setDelIndex($data_spool['del_index']);
$spool->setAppMsgType($data_spool['app_msg_type']);
$spool->setAppMsgSubject($data_spool['app_msg_subject']);
$spool->setAppMsgFrom($data_spool['app_msg_from']);
$spool->setAppMsgTo($data_spool['app_msg_to']);
$spool->setAppMsgBody($data_spool['app_msg_body']);
$spool->setAppMsgDate(date('Y-m-d H:i:s'));
$spool->setAppMsgCc($data_spool['app_msg_cc']);
$spool->setAppMsgBcc($data_spool['app_msg_bcc']);
$spool->setappMsgAttach($data_spool['app_msg_attach']);
$spool->setAppMsgTemplate($data_spool['app_msg_template']);
$spool->setAppMsgStatus($data_spool['app_msg_status']);
if( !$spool->validate() ) {
$this->error_spool = $spool->getValidationFailures();
$this->status_spool = 'error';
$error_msg = "AppMessage::quickSave(): Validation error: \n";
foreach($errors as $key=>$value) {
$error_msg .= $value->getMessage($key) . "\n";
}
throw new Exception($error_msg);
} else {
//echo "Saving - validation ok\n";
$this->error_spool = '';
$this->status = 'success';
$spool->save();
class AppMessage extends BaseAppMessage
{
private $data_spool;
private $status_spool;
private $error_spool;
public function getSpoolStatus ()
{
return $this->status_spool;
}
return $sUID;
}
public function quickSave($aData){
if(isset($aData['app_msg_uid'])) {
$o = EmployeePeer::retrieveByPk($aData['app_msg_uid']);
public function getSpoolError ()
{
return $this->error_spool;
}
if (isset($o) && is_object($o)&& get_class($o) == 'AppMessage') {
$o->fromArray($aData, BasePeer::TYPE_FIELDNAME);
$o->setAppMsgDate(date('Y-m-d H:i:s'));
$o->save();
return $o->getAppMsgUid();
} else {
$this->fromArray($aData, BasePeer::TYPE_FIELDNAME);
$this->setAppMsgDate(date('Y-m-d H:i:s'));
$this->save();
return $this->getAppMsgUid();
/**
* AppMessgae quick Save method
*
* @param Array(msg_uid, app_uid, del_index, app_msg_type, app_msg_subject, app_msg_from, app_msg_to,
* app_msg_body, app_msg_cc, app_msg_bcc, app_msg_attach, app_msg_template, app_msg_status )
*
* @author Erik Amaru Ortiz <erik@colosa.com, aortiz.erik@gmai.com>
* Date Aug 31th, 2009
*/
public function quickSave2 ($data_spool)
{
$this->data_spool = $data_spool;
$sUID = G::generateUniqueID();
$spool = new AppMessage();
$spool->setAppMsgUid( $sUID );
$spool->setMsgUid( $data_spool['msg_uid'] );
$spool->setAppUid( $data_spool['app_uid'] );
$spool->setDelIndex( $data_spool['del_index'] );
$spool->setAppMsgType( $data_spool['app_msg_type'] );
$spool->setAppMsgSubject( $data_spool['app_msg_subject'] );
$spool->setAppMsgFrom( $data_spool['app_msg_from'] );
$spool->setAppMsgTo( $data_spool['app_msg_to'] );
$spool->setAppMsgBody( $data_spool['app_msg_body'] );
$spool->setAppMsgDate( date( 'Y-m-d H:i:s' ) );
$spool->setAppMsgCc( $data_spool['app_msg_cc'] );
$spool->setAppMsgBcc( $data_spool['app_msg_bcc'] );
$spool->setappMsgAttach( $data_spool['app_msg_attach'] );
$spool->setAppMsgTemplate( $data_spool['app_msg_template'] );
$spool->setAppMsgStatus( $data_spool['app_msg_status'] );
if (! $spool->validate()) {
$this->error_spool = $spool->getValidationFailures();
$this->status_spool = 'error';
$error_msg = "AppMessage::quickSave(): Validation error: \n";
foreach ($errors as $key => $value) {
$error_msg .= $value->getMessage( $key ) . "\n";
}
throw new Exception( $error_msg );
} else {
//echo "Saving - validation ok\n";
$this->error_spool = '';
$this->status = 'success';
$spool->save();
}
return $sUID;
}
}
} // AppMessage
public function quickSave ($aData)
{
if (isset( $aData['app_msg_uid'] )) {
$o = EmployeePeer::retrieveByPk( $aData['app_msg_uid'] );
}
if (isset( $o ) && is_object( $o ) && get_class( $o ) == 'AppMessage') {
$o->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
$o->setAppMsgDate( date( 'Y-m-d H:i:s' ) );
$o->save();
return $o->getAppMsgUid();
} else {
$this->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
$this->setAppMsgDate( date( 'Y-m-d H:i:s' ) );
$this->save();
return $this->getAppMsgUid();
}
}
}
// AppMessage

View File

@@ -1,125 +1,124 @@
<?php
/**
* CaseTracker.php
* @package workflow.engine.classes.model
*
* @package workflow.engine.classes.model
*/
require_once 'classes/model/om/BaseCaseTracker.php';
/**
* Skeleton subclass for representing a row from the 'CASE_TRACKER' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package workflow.engine.classes.model
* @package workflow.engine.classes.model
*/
class CaseTracker extends BaseCaseTracker {
public function load($sProcessUID) {
try {
$oRow = CaseTrackerPeer::retrieveByPK($sProcessUID);
if (!is_null($oRow)) {
$aFields = $oRow->toArray(BasePeer::TYPE_FIELDNAME);
$this->fromArray($aFields, BasePeer::TYPE_FIELDNAME);
$this->setNew(false);
return $aFields;
}
else {
throw(new Exception("The row '$sProcessUID' in table CASE_TRACKER doesn't exist!"));
}
}
catch (Exception $oError) {
throw($oError);
}
}
class CaseTracker extends BaseCaseTracker
{
public function create($aData) {
$oConnection = Propel::getConnection(CaseTrackerPeer::DATABASE_NAME);
try {
if (!isset($aData['CT_MAP_TYPE'])) {
$aData['CT_MAP_TYPE'] = 'PROCESSMAP';
}
$oCaseTracker = new CaseTracker();
$oCaseTracker->fromArray($aData, BasePeer::TYPE_FIELDNAME);
if ($oCaseTracker->validate()) {
$oConnection->begin();
$iResult = $oCaseTracker->save();
$oConnection->commit();
return true;
}
else {
$sMessage = '';
$aValidationFailures = $oCaseTracker->getValidationFailures();
foreach($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
public function load ($sProcessUID)
{
try {
$oRow = CaseTrackerPeer::retrieveByPK( $sProcessUID );
if (! is_null( $oRow )) {
$aFields = $oRow->toArray( BasePeer::TYPE_FIELDNAME );
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
$this->setNew( false );
return $aFields;
} else {
throw (new Exception( "The row '$sProcessUID' in table CASE_TRACKER doesn't exist!" ));
}
} catch (Exception $oError) {
throw ($oError);
}
throw(new Exception('The registry cannot be created!<br />'.$sMessage));
}
}
catch (Exception $oError) {
$oConnection->rollback();
throw($oError);
}
}
public function update($aData) {
$oConnection = Propel::getConnection(CaseTrackerPeer::DATABASE_NAME);
try {
$oCaseTracker = CaseTrackerPeer::retrieveByPK($aData['PRO_UID']);
if (!is_null($oCaseTracker))
{
$oCaseTracker->fromArray($aData, BasePeer::TYPE_FIELDNAME);
if ($oCaseTracker->validate()) {
$oConnection->begin();
$iResult = $oCaseTracker->save();
$oConnection->commit();
return $iResult;
public function create ($aData)
{
$oConnection = Propel::getConnection( CaseTrackerPeer::DATABASE_NAME );
try {
if (! isset( $aData['CT_MAP_TYPE'] )) {
$aData['CT_MAP_TYPE'] = 'PROCESSMAP';
}
$oCaseTracker = new CaseTracker();
$oCaseTracker->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
if ($oCaseTracker->validate()) {
$oConnection->begin();
$iResult = $oCaseTracker->save();
$oConnection->commit();
return true;
} else {
$sMessage = '';
$aValidationFailures = $oCaseTracker->getValidationFailures();
foreach ($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
}
throw (new Exception( 'The registry cannot be created!<br />' . $sMessage ));
}
} catch (Exception $oError) {
$oConnection->rollback();
throw ($oError);
}
else {
$sMessage = '';
$aValidationFailures = $oCaseTracker->getValidationFailures();
foreach($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
}
throw(new Exception('The registry cannot be updated!<br />'.$sMessage));
}
public function update ($aData)
{
$oConnection = Propel::getConnection( CaseTrackerPeer::DATABASE_NAME );
try {
$oCaseTracker = CaseTrackerPeer::retrieveByPK( $aData['PRO_UID'] );
if (! is_null( $oCaseTracker )) {
$oCaseTracker->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
if ($oCaseTracker->validate()) {
$oConnection->begin();
$iResult = $oCaseTracker->save();
$oConnection->commit();
return $iResult;
} else {
$sMessage = '';
$aValidationFailures = $oCaseTracker->getValidationFailures();
foreach ($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
}
throw (new Exception( 'The registry cannot be updated!<br />' . $sMessage ));
}
} else {
throw (new Exception( 'This row doesn\'t exist!' ));
}
} catch (Exception $oError) {
$oConnection->rollback();
throw ($oError);
}
}
else {
throw(new Exception('This row doesn\'t exist!'));
}
}
catch (Exception $oError) {
$oConnection->rollback();
throw($oError);
public function remove ($sProcessUID)
{
$oConnection = Propel::getConnection( CaseTrackerPeer::DATABASE_NAME );
try {
$oConnection->begin();
$this->setProUid( $sProcessUID );
$iResult = $this->delete();
$oConnection->commit();
return $iResult;
} catch (Exception $oError) {
$oConnection->rollback();
throw ($oError);
}
}
}
public function remove($sProcessUID) {
$oConnection = Propel::getConnection(CaseTrackerPeer::DATABASE_NAME);
try {
$oConnection->begin();
$this->setProUid($sProcessUID);
$iResult = $this->delete();
$oConnection->commit();
return $iResult;
function caseTrackerExists ($sUid)
{
try {
$oObj = CaseTrackerPeer::retrieveByPk( $sUid );
return (is_object( $oObj ) && get_class( $oObj ) == 'CaseTracker');
} catch (Exception $oError) {
throw ($oError);
}
}
catch (Exception $oError) {
$oConnection->rollback();
throw($oError);
}
}
function caseTrackerExists ( $sUid ) {
try {
$oObj = CaseTrackerPeer::retrieveByPk($sUid);
return (is_object($oObj) && get_class($oObj) == 'CaseTracker');
}
catch (Exception $oError) {
throw($oError);
}
}
} // CaseTracker
}
// CaseTracker

View File

@@ -1,173 +1,165 @@
<?php
/**
* CaseTrackerObject.php
* @package workflow.engine.classes.model
*
* @package workflow.engine.classes.model
*/
require_once 'classes/model/om/BaseCaseTrackerObject.php';
/**
* Skeleton subclass for representing a row from the 'CASE_TRACKER_OBJECT' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package workflow.engine.classes.model
* @package workflow.engine.classes.model
*/
class CaseTrackerObject extends BaseCaseTrackerObject {
public function load($Uid) {
try {
$oRow = CaseTrackerObjectPeer::retrieveByPK( $Uid );
if (!is_null($oRow))
{
$aFields = $oRow->toArray(BasePeer::TYPE_FIELDNAME);
$this->fromArray($aFields,BasePeer::TYPE_FIELDNAME);
$this->setNew(false);
return $aFields;
}
else {
throw( new Exception( "The row '$Uid' in table CaseTrackerObject doesn't exist!" ));
}
}
catch (Exception $oError) {
throw($oError);
}
}
class CaseTrackerObject extends BaseCaseTrackerObject
{
public function create($aData) {
$oConnection = Propel::getConnection(CaseTrackerObjectPeer::DATABASE_NAME);
try {
if (!isset($aData['CTO_UID'])) {
$aData['CTO_UID'] = G::generateUniqueID();
}
$oCaseTrackerObject = new CaseTrackerObject();
$oCaseTrackerObject->fromArray($aData, BasePeer::TYPE_FIELDNAME);
if ($oCaseTrackerObject->validate()) {
$oConnection->begin();
$iResult = $oCaseTrackerObject->save();
$oConnection->commit();
return $aData['CTO_UID'];
}
else {
$sMessage = '';
$aValidationFailures = $oCaseTrackerObject->getValidationFailures();
foreach($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
public function load ($Uid)
{
try {
$oRow = CaseTrackerObjectPeer::retrieveByPK( $Uid );
if (! is_null( $oRow )) {
$aFields = $oRow->toArray( BasePeer::TYPE_FIELDNAME );
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
$this->setNew( false );
return $aFields;
} else {
throw (new Exception( "The row '$Uid' in table CaseTrackerObject doesn't exist!" ));
}
} catch (Exception $oError) {
throw ($oError);
}
throw(new Exception('The registry cannot be created!<br />'.$sMessage));
}
}
catch (Exception $oError) {
$oConnection->rollback();
throw($oError);
}
}
public function update($aData)
{
$oConnection = Propel::getConnection(CaseTrackerObjectPeer::DATABASE_NAME);
try {
$oCaseTrackerObject = CaseTrackerObjectPeer::retrieveByPK($aData['CTO_UID']);
if (!is_null($oCaseTrackerObject))
{
$oCaseTrackerObject->fromArray($aData, BasePeer::TYPE_FIELDNAME);
if ($oCaseTrackerObject->validate()) {
$oConnection->begin();
$iResult = $oCaseTrackerObject->save();
$oConnection->commit();
return $iResult;
public function create ($aData)
{
$oConnection = Propel::getConnection( CaseTrackerObjectPeer::DATABASE_NAME );
try {
if (! isset( $aData['CTO_UID'] )) {
$aData['CTO_UID'] = G::generateUniqueID();
}
$oCaseTrackerObject = new CaseTrackerObject();
$oCaseTrackerObject->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
if ($oCaseTrackerObject->validate()) {
$oConnection->begin();
$iResult = $oCaseTrackerObject->save();
$oConnection->commit();
return $aData['CTO_UID'];
} else {
$sMessage = '';
$aValidationFailures = $oCaseTrackerObject->getValidationFailures();
foreach ($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
}
throw (new Exception( 'The registry cannot be created!<br />' . $sMessage ));
}
} catch (Exception $oError) {
$oConnection->rollback();
throw ($oError);
}
else {
$sMessage = '';
$aValidationFailures = $oCaseTrackerObject->getValidationFailures();
foreach($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
}
throw(new Exception('The registry cannot be updated!<br />'.$sMessage));
}
public function update ($aData)
{
$oConnection = Propel::getConnection( CaseTrackerObjectPeer::DATABASE_NAME );
try {
$oCaseTrackerObject = CaseTrackerObjectPeer::retrieveByPK( $aData['CTO_UID'] );
if (! is_null( $oCaseTrackerObject )) {
$oCaseTrackerObject->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
if ($oCaseTrackerObject->validate()) {
$oConnection->begin();
$iResult = $oCaseTrackerObject->save();
$oConnection->commit();
return $iResult;
} else {
$sMessage = '';
$aValidationFailures = $oCaseTrackerObject->getValidationFailures();
foreach ($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
}
throw (new Exception( 'The registry cannot be updated!<br />' . $sMessage ));
}
} else {
throw (new Exception( 'This row doesn\'t exist!' ));
}
} catch (Exception $oError) {
$oConnection->rollback();
throw ($oError);
}
}
else {
throw(new Exception('This row doesn\'t exist!'));
}
}
catch (Exception $oError) {
$oConnection->rollback();
throw($oError);
}
}
public function remove($sCTOUID) {
$oConnection = Propel::getConnection(CaseTrackerObjectPeer::DATABASE_NAME);
try {
$oCaseTobj = CaseTrackerObjectPeer::retrieveByPK($sCTOUID);
if (is_object($oCaseTobj) && get_class($oCaseTobj) == 'CaseTrackerObject')
{
$oConnection->begin();
$iResult = $oCaseTobj->delete();
$oConnection->commit();
return $iResult;
}
else {
throw( new Exception( "The row '" . $sCTOUID . "' in table CaseTrackerObject doesn't exist!" ));
}
public function remove ($sCTOUID)
{
$oConnection = Propel::getConnection( CaseTrackerObjectPeer::DATABASE_NAME );
try {
$oCaseTobj = CaseTrackerObjectPeer::retrieveByPK( $sCTOUID );
if (is_object( $oCaseTobj ) && get_class( $oCaseTobj ) == 'CaseTrackerObject') {
$oConnection->begin();
$iResult = $oCaseTobj->delete();
$oConnection->commit();
return $iResult;
} else {
throw (new Exception( "The row '" . $sCTOUID . "' in table CaseTrackerObject doesn't exist!" ));
}
} catch (Exception $oError) {
var_dump( $oError );
die();
$oConnection->rollback();
throw ($oError);
}
}
catch (Exception $oError) {var_dump($oError);die;
$oConnection->rollback();
throw($oError);
}
}
function reorderPositions($sProcessUID, $iPosition) {
try {
$oCriteria = new Criteria('workflow');
$oCriteria->add(CaseTrackerObjectPeer::PRO_UID, $sProcessUID);
$oCriteria->add(CaseTrackerObjectPeer::CTO_POSITION, $iPosition, '>');
$oDataset = CaseTrackerObjectPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$this->update(array('CTO_UID' => $aRow['CTO_UID'],
'PRO_UID' => $aRow['PRO_UID'],
'CTO_TYPE_OBJ' => $aRow['CTO_TYPE_OBJ'],
'CTO_UID_OBJ' => $aRow['CTO_UID_OBJ'],
'CTO_CONDITION' => $aRow['CTO_CONDITION'],
'CTO_POSITION' => $aRow['CTO_POSITION'] - 1));
$oDataset->next();
}
function reorderPositions ($sProcessUID, $iPosition)
{
try {
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( CaseTrackerObjectPeer::PRO_UID, $sProcessUID );
$oCriteria->add( CaseTrackerObjectPeer::CTO_POSITION, $iPosition, '>' );
$oDataset = CaseTrackerObjectPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$this->update( array ('CTO_UID' => $aRow['CTO_UID'],'PRO_UID' => $aRow['PRO_UID'],'CTO_TYPE_OBJ' => $aRow['CTO_TYPE_OBJ'],'CTO_UID_OBJ' => $aRow['CTO_UID_OBJ'],'CTO_CONDITION' => $aRow['CTO_CONDITION'],'CTO_POSITION' => $aRow['CTO_POSITION'] - 1
) );
$oDataset->next();
}
} catch (Exception $oException) {
throw $Exception;
}
}
catch (Exception $oException) {
throw $Exception;
}
}
function caseTrackerObjectExists ( $Uid ) {
try {
$oObj = CaseTrackerObjectPeer::retrieveByPk( $Uid );
if (is_object($oObj) && get_class ($oObj) == 'CaseTrackerObject' ) {
return true;
}
else {
return false;
}
function caseTrackerObjectExists ($Uid)
{
try {
$oObj = CaseTrackerObjectPeer::retrieveByPk( $Uid );
if (is_object( $oObj ) && get_class( $oObj ) == 'CaseTrackerObject') {
return true;
} else {
return false;
}
} catch (Exception $oError) {
throw ($oError);
}
}
catch (Exception $oError) {
throw($oError);
}
}
function removeByObject($sType, $sObjUid) {
try {
$oCriteria = new Criteria('workflow');
$oCriteria->add(CaseTrackerObjectPeer::CTO_TYPE_OBJ, $sType);
$oCriteria->add(CaseTrackerObjectPeer::CTO_UID_OBJ, $sObjUid);
CaseTrackerObjectPeer::doDelete($oCriteria);
function removeByObject ($sType, $sObjUid)
{
try {
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( CaseTrackerObjectPeer::CTO_TYPE_OBJ, $sType );
$oCriteria->add( CaseTrackerObjectPeer::CTO_UID_OBJ, $sObjUid );
CaseTrackerObjectPeer::doDelete( $oCriteria );
} catch (Exception $e) {
throw ($e);
}
}
catch(Exception $e) {
throw($e);
}
}
} // CaseTrackerObject
}
// CaseTrackerObject

View File

@@ -1,11 +1,12 @@
<?php
/**
* GroupUser.php
* @package workflow.engine.classes.model
*
* @package workflow.engine.classes.model
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
@@ -13,15 +14,15 @@
*
* 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
* 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.,
* 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.
*
*
*/
require_once 'classes/model/om/BaseGroupUser.php';
@@ -35,114 +36,112 @@ require_once 'classes/model/Groupwf.php';
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* application requirements. This class will only be generated as
* long as it does not already exist in the input directory.
*
* @package workflow.engine.classes.model
* @package workflow.engine.classes.model
*/
class GroupUser extends BaseGroupUser {
class GroupUser extends BaseGroupUser
{
/**
* Create the application document registry
* @param array $aData
* @return string
*/
public function create($aData)
{
$oConnection = Propel::getConnection(GroupUserPeer::DATABASE_NAME);
try {
$oGroupUser = new GroupUser();
$oGroupUser->fromArray($aData, BasePeer::TYPE_FIELDNAME);
if ($oGroupUser->validate()) {
$oConnection->begin();
$iResult = $oGroupUser->save();
$oConnection->commit();
return $iResult;
}
else {
$sMessage = '';
$aValidationFailures = $oGroupUser->getValidationFailures();
foreach($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
/**
* Create the application document registry
*
* @param array $aData
* @return string
*/
public function create ($aData)
{
$oConnection = Propel::getConnection( GroupUserPeer::DATABASE_NAME );
try {
$oGroupUser = new GroupUser();
$oGroupUser->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
if ($oGroupUser->validate()) {
$oConnection->begin();
$iResult = $oGroupUser->save();
$oConnection->commit();
return $iResult;
} else {
$sMessage = '';
$aValidationFailures = $oGroupUser->getValidationFailures();
foreach ($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
}
throw (new Exception( 'The registry cannot be created!<br />' . $sMessage ));
}
} catch (Exception $oError) {
$oConnection->rollback();
throw ($oError);
}
throw(new Exception('The registry cannot be created!<br />'.$sMessage));
}
}
catch (Exception $oError) {
$oConnection->rollback();
throw($oError);
}
}
/**
* Remove the application document registry
* @param string $sGrpUid
* @param string $sUserUid
* @return string
*/
public function remove($sGrpUid, $sUserUid)
{
$oConnection = Propel::getConnection(GroupUserPeer::DATABASE_NAME);
try {
$oGroupUser = GroupUserPeer::retrieveByPK($sGrpUid, $sUserUid);
if (!is_null($oGroupUser))
{
$oConnection->begin();
$iResult = $oGroupUser->delete();
$oConnection->commit();
return $iResult;
}
else {
throw(new Exception('This row doesn\'t exist!'));
}
}
catch (Exception $oError) {
$oConnection->rollback();
throw($oError);
}
}
function getCountAllUsersByGroup()
{
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(GroupUserPeer::GRP_UID);
$oCriteria->addSelectColumn('COUNT(*) AS CNT');
$oCriteria->addJoin(GroupUserPeer::USR_UID, UsersPeer::USR_UID, Criteria::INNER_JOIN);
$oCriteria->add(UsersPeer::USR_STATUS,'CLOSED', Criteria::NOT_EQUAL);
$oCriteria->addGroupByColumn(GroupUserPeer::GRP_UID);
$oDataset = GroupUserPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode (ResultSet::FETCHMODE_ASSOC);
$aRows = Array();
while ($oDataset->next()){
$row = $oDataset->getRow();
$aRows[$row['GRP_UID']] = $row['CNT'];
}
return $aRows;
}
function getAllUserGroups($usrUid)
{
$oCriteria = new Criteria('workflow');
$oCriteria->add(GroupUserPeer::USR_UID, $usrUid);
//$oCriteria->addGroupByColumn(GroupUserPeer::GRP_UID);
$oDataset = GroupUserPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode (ResultSet::FETCHMODE_ASSOC);
$rows = Array();
while ($oDataset->next()) {
$row = $oDataset->getRow();
$g = new Groupwf();
try {
$grpRow = $g->load($row['GRP_UID']);
$row = array_merge($row, $grpRow);
$rows[] = $row;
}
catch (Exception $e){
continue;
}
}
return $rows;
}
/**
* Remove the application document registry
*
* @param string $sGrpUid
* @param string $sUserUid
* @return string
*/
public function remove ($sGrpUid, $sUserUid)
{
$oConnection = Propel::getConnection( GroupUserPeer::DATABASE_NAME );
try {
$oGroupUser = GroupUserPeer::retrieveByPK( $sGrpUid, $sUserUid );
if (! is_null( $oGroupUser )) {
$oConnection->begin();
$iResult = $oGroupUser->delete();
$oConnection->commit();
return $iResult;
} else {
throw (new Exception( 'This row doesn\'t exist!' ));
}
} catch (Exception $oError) {
$oConnection->rollback();
throw ($oError);
}
}
function getCountAllUsersByGroup ()
{
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( GroupUserPeer::GRP_UID );
$oCriteria->addSelectColumn( 'COUNT(*) AS CNT' );
$oCriteria->addJoin( GroupUserPeer::USR_UID, UsersPeer::USR_UID, Criteria::INNER_JOIN );
$oCriteria->add( UsersPeer::USR_STATUS, 'CLOSED', Criteria::NOT_EQUAL );
$oCriteria->addGroupByColumn( GroupUserPeer::GRP_UID );
$oDataset = GroupUserPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$aRows = Array ();
while ($oDataset->next()) {
$row = $oDataset->getRow();
$aRows[$row['GRP_UID']] = $row['CNT'];
}
return $aRows;
}
function getAllUserGroups ($usrUid)
{
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( GroupUserPeer::USR_UID, $usrUid );
//$oCriteria->addGroupByColumn(GroupUserPeer::GRP_UID);
$oDataset = GroupUserPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$rows = Array ();
while ($oDataset->next()) {
$row = $oDataset->getRow();
$g = new Groupwf();
try {
$grpRow = $g->load( $row['GRP_UID'] );
$row = array_merge( $row, $grpRow );
$rows[] = $row;
} catch (Exception $e) {
continue;
}
}
return $rows;
}
}
// GroupUser
} // GroupUser

View File

@@ -1,143 +1,130 @@
<?php
/**
* LoginLog.php
* @package workflow.engine.classes.model
*
* @package workflow.engine.classes.model
*/
require_once 'classes/model/om/BaseLoginLog.php';
/**
* Skeleton subclass for representing a row from the 'LOGIN_LOG' table.
*
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package workflow.engine.classes.model
* @package workflow.engine.classes.model
*/
class LoginLog extends BaseLoginLog {
function create ($aData)
{
$con = Propel::getConnection(LoginLogPeer::DATABASE_NAME);
try
{
$this->fromArray($aData, BasePeer::TYPE_FIELDNAME);
if($this->validate())
{
$result=$this->save();
}
else
{
$e=new Exception("Failed Validation in class ".get_class($this).".");
$e->aValidationFailures=$this->getValidationFailures();
throw($e);
}
$con->commit();
return $result;
}
catch(Exception $e)
{
$con->rollback();
throw($e);
}
}
public function load($LogUid)
{
try {
$oRow = LoginLogPeer::retrieveByPK( $LogUid );
if (!is_null($oRow))
{
$aFields = $oRow->toArray(BasePeer::TYPE_FIELDNAME);
$this->fromArray($aFields,BasePeer::TYPE_FIELDNAME);
$this->setNew(false);
return $aFields;
}
else {
throw(new Exception( "The row '" . $LogUid . "' in table LOGIN_LOG doesn't exist!" ));
}
}
catch (Exception $oError) {
throw($oError);
}
}
public function update($fields)
{
$con = Propel::getConnection(LoginLogPeer::DATABASE_NAME);
try
{
$con->begin();
$this->load($fields['LOG_UID']);
$this->fromArray($fields,BasePeer::TYPE_FIELDNAME);
if($this->validate())
{
$result=$this->save();
$con->commit();
return $result;
}
else
{
$con->rollback();
throw(new Exception("Failed Validation in class ".get_class($this)."."));
}
}
catch(Exception $e)
{
$con->rollback();
throw($e);
}
}
class LoginLog extends BaseLoginLog
{
function remove($LogUid)
{
$con = Propel::getConnection(LoginLogPeer::DATABASE_NAME);
try
function create ($aData)
{
$con->begin();
$this->setWlUid($LogUid);
$result=$this->delete();
$con->commit();
return $result;
$con = Propel::getConnection( LoginLogPeer::DATABASE_NAME );
try {
$this->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
if ($this->validate()) {
$result = $this->save();
} else {
$e = new Exception( "Failed Validation in class " . get_class( $this ) . "." );
$e->aValidationFailures = $this->getValidationFailures();
throw ($e);
}
$con->commit();
return $result;
} catch (Exception $e) {
$con->rollback();
throw ($e);
}
}
catch(Exception $e)
public function load ($LogUid)
{
$con->rollback();
throw($e);
try {
$oRow = LoginLogPeer::retrieveByPK( $LogUid );
if (! is_null( $oRow )) {
$aFields = $oRow->toArray( BasePeer::TYPE_FIELDNAME );
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
$this->setNew( false );
return $aFields;
} else {
throw (new Exception( "The row '" . $LogUid . "' in table LOGIN_LOG doesn't exist!" ));
}
} catch (Exception $oError) {
throw ($oError);
}
}
}
//Added by Qennix
function getLastLoginByUser($sUID){
$c = new Criteria();
$c->addSelectColumn(LoginLogPeer::LOG_INIT_DATE);
$c->add(LoginLogPeer::USR_UID,$sUID);
$c->setLimit(1);
$c->addDescendingOrderByColumn(LoginLogPeer::LOG_INIT_DATE);
$Dat = LoginLogPeer::doSelectRS ($c);
$Dat->setFetchmode ( ResultSet::FETCHMODE_ASSOC );
$Dat->next();
$aRow = $Dat->getRow();
return isset($aRow['LOG_INIT_DATE']) ? $aRow['LOG_INIT_DATE'] : '';
}
//Added by Qennix
function getLastLoginAllUsers(){
$c = new Criteria();
$c->addSelectColumn(LoginLogPeer::USR_UID);
$c->addAsColumn('LAST_LOGIN', 'MAX(LOG_INIT_DATE)');
$c->addGroupByColumn(LoginLogPeer::USR_UID);
$Dat = LoginLogPeer::doSelectRS ($c);
$Dat->setFetchmode (ResultSet::FETCHMODE_ASSOC);
$aRows = Array();
while ($Dat->next()){
$row = $Dat->getRow();
$aRows[$row['USR_UID']] = $row['LAST_LOGIN'];
}
return $aRows;
}
} // LoginLog
public function update ($fields)
{
$con = Propel::getConnection( LoginLogPeer::DATABASE_NAME );
try {
$con->begin();
$this->load( $fields['LOG_UID'] );
$this->fromArray( $fields, BasePeer::TYPE_FIELDNAME );
if ($this->validate()) {
$result = $this->save();
$con->commit();
return $result;
} else {
$con->rollback();
throw (new Exception( "Failed Validation in class " . get_class( $this ) . "." ));
}
} catch (Exception $e) {
$con->rollback();
throw ($e);
}
}
function remove ($LogUid)
{
$con = Propel::getConnection( LoginLogPeer::DATABASE_NAME );
try {
$con->begin();
$this->setWlUid( $LogUid );
$result = $this->delete();
$con->commit();
return $result;
} catch (Exception $e) {
$con->rollback();
throw ($e);
}
}
//Added by Qennix
function getLastLoginByUser ($sUID)
{
$c = new Criteria();
$c->addSelectColumn( LoginLogPeer::LOG_INIT_DATE );
$c->add( LoginLogPeer::USR_UID, $sUID );
$c->setLimit( 1 );
$c->addDescendingOrderByColumn( LoginLogPeer::LOG_INIT_DATE );
$Dat = LoginLogPeer::doSelectRS( $c );
$Dat->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$Dat->next();
$aRow = $Dat->getRow();
return isset( $aRow['LOG_INIT_DATE'] ) ? $aRow['LOG_INIT_DATE'] : '';
}
//Added by Qennix
function getLastLoginAllUsers ()
{
$c = new Criteria();
$c->addSelectColumn( LoginLogPeer::USR_UID );
$c->addAsColumn( 'LAST_LOGIN', 'MAX(LOG_INIT_DATE)' );
$c->addGroupByColumn( LoginLogPeer::USR_UID );
$Dat = LoginLogPeer::doSelectRS( $c );
$Dat->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$aRows = Array ();
while ($Dat->next()) {
$row = $Dat->getRow();
$aRows[$row['USR_UID']] = $row['LAST_LOGIN'];
}
return $aRows;
}
}
// LoginLog

View File

@@ -1,139 +1,131 @@
<?php
/**
* ObjectPermission.php
* @package workflow.engine.classes.model
*
* @package workflow.engine.classes.model
*/
require_once 'classes/model/om/BaseObjectPermission.php';
/**
* Skeleton subclass for representing a row from the 'OBJECT_PERMISSION' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package workflow.engine.classes.model
* @package workflow.engine.classes.model
*/
class ObjectPermission extends BaseObjectPermission {
class ObjectPermission extends BaseObjectPermission
{
public function load($UID)
{
try {
$oRow = ObjectPermissionPeer::retrieveByPK( $UID );
if (!is_null($oRow))
{
$aFields = $oRow->toArray(BasePeer::TYPE_FIELDNAME);
$this->fromArray($aFields,BasePeer::TYPE_FIELDNAME);
$this->setNew(false);
return $aFields;
}
else {
throw(new Exception( "The row '" . $UsrUid . "' in table USER doesn't exist!" ));
}
}
catch (Exception $oError) {
throw($oError);
}
}
function create ($aData)
{
try
public function load ($UID)
{
$this->fromArray($aData,BasePeer::TYPE_FIELDNAME);
$result=$this->save();
return $result;
try {
$oRow = ObjectPermissionPeer::retrieveByPK( $UID );
if (! is_null( $oRow )) {
$aFields = $oRow->toArray( BasePeer::TYPE_FIELDNAME );
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
$this->setNew( false );
return $aFields;
} else {
throw (new Exception( "The row '" . $UsrUid . "' in table USER doesn't exist!" ));
}
} catch (Exception $oError) {
throw ($oError);
}
}
catch(Exception $e)
function create ($aData)
{
throw($e);
try {
$this->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
$result = $this->save();
return $result;
} catch (Exception $e) {
throw ($e);
}
}
}
function Exists ( $Uid ) {
try {
$oPro = ObjectPermissionPeer::retrieveByPk( $Uid );
if (is_object($oPro) && get_class ($oPro) == 'ObjectPermission' ) {
return true;
}
else {
return false;
}
function Exists ($Uid)
{
try {
$oPro = ObjectPermissionPeer::retrieveByPk( $Uid );
if (is_object( $oPro ) && get_class( $oPro ) == 'ObjectPermission') {
return true;
} else {
return false;
}
} catch (Exception $oError) {
throw ($oError);
}
}
catch (Exception $oError) {
throw($oError);
}
}
function remove($Uid)
{
$con = Propel::getConnection(ObjectPermissionPeer::DATABASE_NAME);
try {
$oObjPer = ObjectPermissionPeer::retrieveByPK($Uid);
if (is_object($oObjPer) && get_class($oObjPer) == 'ObjectPermission')
{
$con->begin();
$iResult = $oObjPer->delete();
$con->commit();
return $iResult;
}
else {
throw( new Exception( "The row '" . $Uid . "' in table CaseTrackerObject doesn't exist!" ));
}
function remove ($Uid)
{
$con = Propel::getConnection( ObjectPermissionPeer::DATABASE_NAME );
try {
$oObjPer = ObjectPermissionPeer::retrieveByPK( $Uid );
if (is_object( $oObjPer ) && get_class( $oObjPer ) == 'ObjectPermission') {
$con->begin();
$iResult = $oObjPer->delete();
$con->commit();
return $iResult;
} else {
throw (new Exception( "The row '" . $Uid . "' in table CaseTrackerObject doesn't exist!" ));
}
} catch (exception $e) {
$con->rollback();
throw ($e);
}
}
catch (exception $e) {
$con->rollback();
throw ($e);
}
}
function update($aFields) {
$oConnection = Propel::getConnection(ObjectPermissionPeer::DATABASE_NAME);
try {
$oConnection->begin();
$this->load($aFields['OP_UID']);
$this->fromArray($aFields, BasePeer::TYPE_FIELDNAME);
if ($this->validate()) {
$iResult = $this->save();
$oConnection->commit();
return $iResult;
}
else {
$oConnection->rollback();
throw(new Exception('Failed Validation in class ' . get_class($this) . '.'));
}
function update ($aFields)
{
$oConnection = Propel::getConnection( ObjectPermissionPeer::DATABASE_NAME );
try {
$oConnection->begin();
$this->load( $aFields['OP_UID'] );
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
if ($this->validate()) {
$iResult = $this->save();
$oConnection->commit();
return $iResult;
} else {
$oConnection->rollback();
throw (new Exception( 'Failed Validation in class ' . get_class( $this ) . '.' ));
}
} catch (Exception $e) {
$oConnection->rollback();
throw ($e);
}
}
catch(Exception $e) {
$oConnection->rollback();
throw($e);
}
}
function removeByObject($sType, $sObjUid) {
try {
$oCriteria = new Criteria('workflow');
$oCriteria->add(ObjectPermissionPeer::OP_OBJ_TYPE, $sType);
$oCriteria->add(ObjectPermissionPeer::OP_OBJ_UID, $sObjUid);
ObjectPermissionPeer::doDelete($oCriteria);
function removeByObject ($sType, $sObjUid)
{
try {
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( ObjectPermissionPeer::OP_OBJ_TYPE, $sType );
$oCriteria->add( ObjectPermissionPeer::OP_OBJ_UID, $sObjUid );
ObjectPermissionPeer::doDelete( $oCriteria );
} catch (Exception $e) {
throw ($e);
}
}
catch(Exception $e) {
throw($e);
function loadInfo ($sObjUID)
{
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( ObjectPermissionPeer::OP_OBJ_UID, $sObjUID );
$oDataset = ObjectPermissionPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
$aRow = $oDataset->getRow();
return ($aRow);
}
}
function loadInfo($sObjUID){
$oCriteria = new Criteria('workflow');
$oCriteria->add(ObjectPermissionPeer::OP_OBJ_UID, $sObjUID);
$oDataset = ObjectPermissionPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$aRow = $oDataset->getRow();
return($aRow);
}
} // ObjectPermission
}
// ObjectPermission