CODE STYLE changes...

FILES:
gulliver/system/class.table.php
workflow/engine/classes/class.propelTable.php
workflow/engine/classes/entities/Base.php
workflow/engine/classes/model/AppEvent.php
This commit is contained in:
jennylee
2012-10-19 16:48:46 -04:00
parent 87c3641314
commit 74082729f2
4 changed files with 1738 additions and 1690 deletions

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* class.table.php * class.table.php
* *
@@ -29,6 +30,8 @@
* *
* *
* *
*
*
* Table class definition * Table class definition
* Render table * Render table
* *
@@ -151,8 +154,9 @@ class Table
global $HTTP_GET_VARS; global $HTTP_GET_VARS;
global $HTTP_SESSION_VARS; global $HTTP_SESSION_VARS;
$stOrderByDir = $this->DefaultOrderDir; $stOrderByDir = $this->DefaultOrderDir;
if (isset( $HTTP_SESSION_VARS['OrderDir'] ) && ($HTTP_SESSION_VARS['OrderDir'] == 'DESC' || $HTTP_SESSION_VARS['OrderDir'] == 'ASC')) if (isset( $HTTP_SESSION_VARS['OrderDir'] ) && ($HTTP_SESSION_VARS['OrderDir'] == 'DESC' || $HTTP_SESSION_VARS['OrderDir'] == 'ASC')) {
$stOrderByDir = $HTTP_SESSION_VARS['OrderDir']; $stOrderByDir = $HTTP_SESSION_VARS['OrderDir'];
}
$stQry = $this->_source; $stQry = $this->_source;
if ($this->WhereClause != "") { if ($this->WhereClause != "") {
@@ -688,7 +692,6 @@ class Table
$res .= "&nbsp;"; $res .= "&nbsp;";
} }
break; break;
case "currency2": case "currency2":
if ($val != "") { if ($val != "") {
$res .= G::NumberToCurrency( $val ); $res .= G::NumberToCurrency( $val );
@@ -696,7 +699,6 @@ class Table
$res .= "$ 0.00"; $res .= "$ 0.00";
} }
break; break;
case "percentage2": case "percentage2":
if ($val != "") { if ($val != "") {
$res .= G::NumberToPercentage( $val ); $res .= G::NumberToPercentage( $val );
@@ -704,7 +706,6 @@ class Table
$res .= "0.00 %"; $res .= "0.00 %";
} }
break; break;
case "percentage": case "percentage":
if ($val != "") { if ($val != "") {
$res .= htmlentities( number_format( (float) $val, 2, ".", "," ) . " %", ENT_QUOTES, 'utf-8' ); $res .= htmlentities( number_format( (float) $val, 2, ".", "," ) . " %", ENT_QUOTES, 'utf-8' );
@@ -712,7 +713,6 @@ class Table
$res .= "&nbsp;"; $res .= "&nbsp;";
} }
break; break;
case "date": case "date":
if ($val != "" && $val != '0000-00-00 00:00:00') { if ($val != "" && $val != '0000-00-00 00:00:00') {
$part = explode( ' ', $val ); $part = explode( ' ', $val );
@@ -732,12 +732,10 @@ class Table
$res .= formatDate( '$M $d $Y', $val ); $res .= formatDate( '$M $d $Y', $val );
break; break;
} }
} else { } else {
$res .= "&nbsp;"; $res .= "&nbsp;";
} }
break; break;
case "email": case "email":
if ($val != "") { if ($val != "") {
$res .= "<a href=\"mailto:" . $val . "\">"; $res .= "<a href=\"mailto:" . $val . "\">";
@@ -747,7 +745,6 @@ class Table
$res .= "&nbsp;"; $res .= "&nbsp;";
} }
break; break;
case "ifpdf": case "ifpdf":
if ($val == '1') { if ($val == '1') {
$image = "<img border=0 src='/images/pdf.gif'>"; $image = "<img border=0 src='/images/pdf.gif'>";
@@ -761,7 +758,6 @@ class Table
$res .= "&nbsp;"; $res .= "&nbsp;";
} }
break; break;
case "ifimg": case "ifimg":
$image = "<img border=0 src='" . $col['Extra'] . "' >"; $image = "<img border=0 src='" . $col['Extra'] . "' >";
if ($val == '1') { if ($val == '1') {
@@ -774,7 +770,6 @@ class Table
$res .= "&nbsp;"; $res .= "&nbsp;";
} }
break; break;
case "ifrtf": case "ifrtf":
if ($val == '1') { if ($val == '1') {
$image = "<img border=0 src='/images/word.gif'>"; $image = "<img border=0 src='/images/word.gif'>";
@@ -788,11 +783,9 @@ class Table
$res .= "&nbsp;"; $res .= "&nbsp;";
} }
break; break;
case "image": case "image":
if (is_array( $col["Condition"] )) {
if (is_array( $col["Condition"] )) //By JHL to enable Condition to display a image -- New parameter Condition in Addrawcolumn //By JHL to enable Condition to display a image -- New parameter Condition in Addrawcolumn
{
$field_compare = $col["Condition"]['field']; $field_compare = $col["Condition"]['field'];
$tlabel = substr( $field_compare, 0, 1 ); $tlabel = substr( $field_compare, 0, 1 );
switch ($tlabel) { switch ($tlabel) {
@@ -806,8 +799,6 @@ class Table
$val = "<img border=0 src='$fieldname'>"; $val = "<img border=0 src='$fieldname'>";
} }
// break; // break;
case "textimage": case "textimage":
$AAS = $col['Extra']; $AAS = $col['Extra'];
$val1 = " <img border=0 src='$AAS' align='middle'>"; $val1 = " <img border=0 src='$AAS' align='middle'>";
@@ -834,14 +825,14 @@ class Table
} }
} }
$res .= "\"><span class='txtin3'>" . strtoupper( $fieldname ) . "$val</span></a>"; $res .= "\"><span class='txtin3'>" . strtoupper( $fieldname ) . "$val</span></a>";
} else } else {
$val2 = "<span class='txtin3'>" . strtoupper( $fieldname ) . "</span>"; $val2 = "<span class='txtin3'>" . strtoupper( $fieldname ) . "</span>";
}
// break; // break;
case "link": case "link":
if ($val == "") if ($val == "") {
$res .= "&nbsp;"; $res .= "&nbsp;";
}
$title = ''; $title = '';
if ($col["Type"] == 'link' && trim( isset( $this->_row_values['TOOLTIP'] ) ? $this->_row_values['TOOLTIP'] : '' )) if ($col["Type"] == 'link' && trim( isset( $this->_row_values['TOOLTIP'] ) ? $this->_row_values['TOOLTIP'] : '' ))
; ;
@@ -921,10 +912,10 @@ class Table
$res .= "</a" . $col['Extra'] . ">"; $res .= "</a" . $col['Extra'] . ">";
} }
break; break;
case "linknew": case "linknew":
if ($val == "") if ($val == "") {
$res .= "&nbsp;"; $res .= "&nbsp;";
}
if ($col["Content"] != "") { if ($col["Content"] != "") {
$tlabel = substr( $col["Content"], 0, 1 ); $tlabel = substr( $col["Content"], 0, 1 );
switch ($tlabel) { switch ($tlabel) {
@@ -964,7 +955,6 @@ class Table
$res .= "</a" . $col['Extra'] . ">"; $res .= "</a" . $col['Extra'] . ">";
} }
break; break;
case "iflink": case "iflink":
if ($col["Content"] != "") { if ($col["Content"] != "") {
$tlabel = substr( $col["Content"], 0, 1 ); $tlabel = substr( $col["Content"], 0, 1 );
@@ -999,10 +989,8 @@ class Table
$res .= "</a" . $col['Extra'] . ">"; $res .= "</a" . $col['Extra'] . ">";
} }
break; break;
case "jsimglink": case "jsimglink":
$val = "<img border=0 src='$fieldname'>"; $val = "<img border=0 src='$fieldname'>";
case "jslink": case "jslink":
if ($val == "") { if ($val == "") {
$val .= "<span class='txtin3'> " . $col['Name'] . '<span>'; $val .= "<span class='txtin3'> " . $col['Name'] . '<span>';
@@ -1020,7 +1008,6 @@ class Table
$res .= $val; $res .= $val;
$res .= "</a" . $col['Extra'] . ">"; $res .= "</a" . $col['Extra'] . ">";
break; break;
case "$": case "$":
$vname = substr( $col["Content"], 1, (strlen( $col["Content"] ) - 1) ); $vname = substr( $col["Content"], 1, (strlen( $col["Content"] ) - 1) );
$lval = $HTTP_SESSION_VARS[$vname]; $lval = $HTTP_SESSION_VARS[$vname];
@@ -1028,7 +1015,6 @@ class Table
$res .= $val; $res .= $val;
$res .= "</a" . $col['Extra'] . ">"; $res .= "</a" . $col['Extra'] . ">";
break; break;
case '_': case '_':
$Values = explode( ',', substr( $col['Content'], 1, strlen( $col['Content'] ) ) ); $Values = explode( ',', substr( $col['Content'], 1, strlen( $col['Content'] ) ) );
$res .= "<a class='$strClassLink' href=\"javascript:" . $col["Target"] . "("; $res .= "<a class='$strClassLink' href=\"javascript:" . $col["Target"] . "(";
@@ -1048,7 +1034,6 @@ class Table
$res .= $val; $res .= $val;
$res .= "</a" . $col['Extra'] . ">"; $res .= "</a" . $col['Extra'] . ">";
break; break;
default: default:
$res .= "<a class='$strClassLink' href=\"javascript:" . $col["Target"] . "('" . $val . "')\"" . $col['Extra'] . ">"; $res .= "<a class='$strClassLink' href=\"javascript:" . $col["Target"] . "('" . $val . "')\"" . $col['Extra'] . ">";
$res .= $col["Content"]; $res .= $col["Content"];
@@ -1061,7 +1046,6 @@ class Table
$res .= "</a" . $col['Extra'] . ">"; $res .= "</a" . $col['Extra'] . ">";
} }
break; break;
case "checkbox": case "checkbox":
$res .= "<input type='checkbox' name=\"form[" . $fieldname . "][" . $val . "]\" "; $res .= "<input type='checkbox' name=\"form[" . $fieldname . "][" . $val . "]\" ";
if ($val == '1' || $val == 'TRUE' || $val == 'yes') { if ($val == '1' || $val == 'TRUE' || $val == 'yes') {
@@ -1107,7 +1091,6 @@ class Table
if (is_array( $this->contexto )) { if (is_array( $this->contexto )) {
$this->contexto[0][] = $contexto; $this->contexto[0][] = $contexto;
$this->contexto[1][] = $nombre; $this->contexto[1][] = $nombre;
} else { } else {
$this->contexto = array (); $this->contexto = array ();
$this->contexto[0][] = $contexto; $this->contexto[0][] = $contexto;
@@ -1183,7 +1166,7 @@ class Table
$token = ''; $token = '';
$i = 0; $i = 0;
While ($i <= $len and $i <= $number) { while ($i <= $len and $i <= $number) {
$car = substr( $value, $i, 1 ); $car = substr( $value, $i, 1 );
$br = strtoupper( substr( $value, $i, 4 ) ); $br = strtoupper( substr( $value, $i, 4 ) );
if ($car == '<') { if ($car == '<') {
@@ -1192,16 +1175,19 @@ class Table
if ($car == '>') { if ($car == '>') {
$Flag = 1; $Flag = 1;
} }
if ($br == '<BR>' || $br == '</P>') if ($br == '<BR>' || $br == '</P>') {
$token .= "<BR>"; $token .= "<BR>";
}
if (($Flag == 1) && ($car != '>')) { if (($Flag == 1) && ($car != '>')) {
$token .= $car; $token .= $car;
if ($i == $number) if ($i == $number) {
$token .= "... "; $token .= "... ";
} }
}
$i = $i + 1; $i = $i + 1;
} }
return $token; return $token;
} }
} }

View File

@@ -150,15 +150,18 @@ class propelTable
foreach ($orderFields as $field => $fieldOrder) { foreach ($orderFields as $field => $fieldOrder) {
$field = G::getUIDName( $field, '' ); $field = G::getUIDName( $field, '' );
$fieldOrder = strtoupper( $fieldOrder ); $fieldOrder = strtoupper( $fieldOrder );
if ($fieldOrder === 'A') if ($fieldOrder === 'A') {
$fieldOrder = 'ASC'; $fieldOrder = 'ASC';
if ($fieldOrder === 'D') }
if ($fieldOrder === 'D') {
$fieldOrder = 'DESC'; $fieldOrder = 'DESC';
}
switch ($fieldOrder) { switch ($fieldOrder) {
case 'ASC': case 'ASC':
case 'DESC': case 'DESC':
if ($order !== '') if ($order !== '') {
$order .= ', '; $order .= ', ';
}
$order .= $field . ' ' . $fieldOrder; $order .= $field . ' ' . $fieldOrder;
$this->aOrder[$field] = $fieldOrder; $this->aOrder[$field] = $fieldOrder;
} }
@@ -175,12 +178,13 @@ class propelTable
$this->criteria->clearOrderByColumns(); $this->criteria->clearOrderByColumns();
} }
foreach ($this->aOrder as $field => $ascending) { foreach ($this->aOrder as $field => $ascending) {
if ($ascending == 'ASC') if ($ascending == 'ASC') {
$this->criteria->addAscendingOrderByColumn( $field ); $this->criteria->addAscendingOrderByColumn( $field );
else } else {
$this->criteria->addDescendingOrderByColumn( $field ); $this->criteria->addDescendingOrderByColumn( $field );
} }
} }
}
/** /**
* Add limits * Add limits
*/ */
@@ -215,18 +219,21 @@ class propelTable
$this->name = $xmlForm->name; $this->name = $xmlForm->name;
$this->id = $xmlForm->id; $this->id = $xmlForm->id;
//$this->sqlConnection=((isset($this->xmlForm->sqlConnection))?$this->xmlForm->sqlConnection:''); //$this->sqlConnection=((isset($this->xmlForm->sqlConnection))?$this->xmlForm->sqlConnection:'');
if (isset( $_GET['page'] )) if (isset( $_GET['page'] )) {
$this->currentPage = $_GET['page']; $this->currentPage = $_GET['page'];
else } else {
$this->currentPage = 1; $this->currentPage = 1;
if (isset( $_GET['order'] )) }
if (isset( $_GET['order'] )) {
$this->orderBy = urldecode( $_GET['order'] ); $this->orderBy = urldecode( $_GET['order'] );
else } else {
$this->orderBy = ""; $this->orderBy = "";
if (isset( $_GET['filter'] )) }
if (isset( $_GET['filter'] )) {
$this->filter = urldecode( $_GET['filter'] ); $this->filter = urldecode( $_GET['filter'] );
else } else {
$this->filter = ""; $this->filter = "";
}
if ($xmlForm->ajaxServer != '') { if ($xmlForm->ajaxServer != '') {
$this->ajaxServer = G::encryptLink( $xmlForm->ajaxServer ); $this->ajaxServer = G::encryptLink( $xmlForm->ajaxServer );
} else { } else {
@@ -235,12 +242,14 @@ class propelTable
$this->ownerPage = G::encryptLink( SYS_CURRENT_URI ); $this->ownerPage = G::encryptLink( SYS_CURRENT_URI );
// Config attributes from XMLFORM file // Config attributes from XMLFORM file
$myAttributes = get_class_vars( get_class( $this ) ); $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 )) { if (array_key_exists( $atrib, $myAttributes )) {
eval( 'settype($value, gettype($this->' . $atrib . '));' ); eval( 'settype($value, gettype($this->' . $atrib . '));' );
if ($value !== '') if ($value !== '') {
eval( '$this->' . $atrib . '=$value;' ); eval( '$this->' . $atrib . '=$value;' );
} }
}
}
if ($this->masterdetail != "") { if ($this->masterdetail != "") {
$this->masterdetail = explode( ",", $this->masterdetail ); $this->masterdetail = explode( ",", $this->masterdetail );
foreach ($this->masterdetail as $keyMasterDetail => $valueMasterDetail) { foreach ($this->masterdetail as $keyMasterDetail => $valueMasterDetail) {
@@ -258,8 +267,9 @@ class propelTable
$r = $f; $r = $f;
$this->fields[$r]['Name'] = $this->xmlForm->fields[$f]->name; $this->fields[$r]['Name'] = $this->xmlForm->fields[$f]->name;
$this->fields[$r]['Type'] = $this->xmlForm->fields[$f]->type; $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]['Size'] = $this->xmlForm->fields[$f]->size;
}
$this->fields[$r]['Label'] = $this->xmlForm->fields[$f]->label; $this->fields[$r]['Label'] = $this->xmlForm->fields[$f]->label;
} }
//Set the default settings //Set the default settings
@@ -283,9 +293,11 @@ class propelTable
} }
} }
$totalWidth = 0; $totalWidth = 0;
foreach ($this->fields as $r => $rval) foreach ($this->fields as $r => $rval) {
if ($this->style[$r]['showInTable'] != '0') if ($this->style[$r]['showInTable'] != '0') {
$totalWidth += $this->style[$r]['colWidth']; $totalWidth += $this->style[$r]['colWidth'];
}
}
$this->totalWidth = $totalWidth; $this->totalWidth = $totalWidth;
} }
@@ -313,13 +325,14 @@ class propelTable
{ {
//fix the bug about showing hidden fields in propel table. //fix the bug about showing hidden fields in propel table.
foreach ($this->fields as $r => $rval) { foreach ($this->fields as $r => $rval) {
if ($this->style[$r]['type'] == 'hidden') if ($this->style[$r]['type'] == 'hidden') {
$this->style[$r]['showInTable'] = '0'; $this->style[$r]['showInTable'] = '0';
} }
}
//Render headers //Render headers
$this->colCount = 0; $this->colCount = 0;
$this->shownFields = '['; $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') && (! (in_array( $this->fields[$r]['Name'], $this->masterdetail )))) {
//if (($this->style[$r]['showInTable'] != '0' )) //if (($this->style[$r]['showInTable'] != '0' ))
$this->tpl->newBlock( "headers" ); $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); $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]['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;'; $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'] ); $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' ) ); $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 /* BUG 8080 - erik: don't setup onclick on page table header, doesn't have sense and causing problems
if (isset($this->style[$r]['onclick'])) if (isset($this->style[$r]['onclick']))
$this->tpl->assign( "onclick" , htmlentities( $this->style[$r]['onclick'] , ENT_QUOTES, 'UTF-8' ) ); $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'] ); $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) . "%" ); $this->tpl->assign( "widthPercent", ($this->style[$r]['colWidth'] * 100 / $this->totalWidth) . "%" );
//Hook for special skin with RTL languajes //Hook for special skin with RTL languajes
}
if (defined( 'SYS_LANG_DIRECTION' ) && SYS_LANG_DIRECTION == 'R') { if (defined( 'SYS_LANG_DIRECTION' ) && SYS_LANG_DIRECTION == 'R') {
$this->style[$r]['titleAlign'] = 'right'; $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'] . ';' ); $this->tpl->assign( "align", 'text-align:' . $this->style[$r]['titleAlign'] . ';' );
}
if ($this->style[$r]['titleVisibility'] != '0') { 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']] === '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); $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 .= ($this->shownFields !== '[') ? ',' : '';
$this->shownFields .= '"' . $r . '"'; $this->shownFields .= '"' . $r . '"';
} }
}
$this->shownFields .= ']'; $this->shownFields .= ']';
} }
@@ -380,10 +399,11 @@ class propelTable
$styleData = $this->style[$r]; $styleData = $this->style[$r];
$fielDataName = $styleData['data']; $fielDataName = $styleData['data'];
$fieldClassName = isset( $styleData['colClassName'] ) && ($styleData['colClassName']) ? $styleData['colClassName'] : $this->tdClass; $fieldClassName = isset( $styleData['colClassName'] ) && ($styleData['colClassName']) ? $styleData['colClassName'] : $this->tdClass;
if ($fielDataName != '') if ($fielDataName != '') {
$value = ((isset( $result[$fielDataName] )) ? $result[$fielDataName] : ''); $value = ((isset( $result[$fielDataName] )) ? $result[$fielDataName] : '');
else } else {
$value = $this->fields[$r]['Label']; $value = $this->fields[$r]['Label'];
}
$this->tpl->newBlock( "field" ); $this->tpl->newBlock( "field" );
$this->tpl->assign( 'width', $this->style[$r]['colWidth'] ); $this->tpl->assign( 'width', $this->style[$r]['colWidth'] );
$classAttr = (trim( $fieldClassName ) != '') ? " class=\"$fieldClassName\"" : ''; $classAttr = (trim( $fieldClassName ) != '') ? " class=\"$fieldClassName\"" : '';
@@ -414,7 +434,7 @@ class propelTable
$this->xmlForm->setDefaultValues(); $this->xmlForm->setDefaultValues();
$this->xmlForm->setValues( $result ); $this->xmlForm->setValues( $result );
//var_dump($fieldName, $fieldClass );echo '<br /><br />'; //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 ); $htmlField = $this->xmlForm->fields[$fieldName]->renderTable( $value, $this->xmlForm, true );
if (is_object( $value )) { if (is_object( $value )) {
$value = ''; $value = '';
@@ -423,8 +443,9 @@ class propelTable
$testValue = preg_match( "/<a ?.*>(.*)<\/a>/i", $htmlField, $value ); $testValue = preg_match( "/<a ?.*>(.*)<\/a>/i", $htmlField, $value );
$this->tpl->assign( "value", $htmlField ); $this->tpl->assign( "value", $htmlField );
if ($testValue > 0 && (isset( $value[1] ) && strlen( trim( $value[1] ) ) == 0)) { 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", "&nbsp;" );
}
// $this->tpl->assign( "value" , (preg_match('^[[:space:]]^', $value) && (substr($fieldName,0,3)!="PRO"))? str_ireplace(" ","&nbsp;",$htmlField):$htmlField ); // $this->tpl->assign( "value" , (preg_match('^[[:space:]]^', $value) && (substr($fieldName,0,3)!="PRO"))? str_ireplace(" ","&nbsp;",$htmlField):$htmlField );
} else { } else {
$this->tpl->assign( "value", $htmlField ); $this->tpl->assign( "value", $htmlField );
@@ -453,52 +474,61 @@ class propelTable
$this->style[$r] = array ('showInTable' => '1','titleVisibility' => '1','colWidth' => '150','onclick' => '','event' => '' $this->style[$r] = array ('showInTable' => '1','titleVisibility' => '1','colWidth' => '150','onclick' => '','event' => ''
); );
//Some widths //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'; $this->style[$r]['colWidth'] = '70';
}
//Data source: //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 $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 $this->style[$r]['data'] = $this->fields[$r]['Name']; //ELSE: The data value for that field
//Hidden fields //Hidden fields
}
if (! isset( $this->style[$r]['showInTable'] )) { 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'; $this->style[$r]['showInTable'] = '0';
} else { } else {
$this->style[$r]['showInTable'] = '1'; $this->style[$r]['showInTable'] = '1';
} }
} }
//Hidden titles //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'; $this->style[$r]['titleVisibility'] = '0';
} }
//Align titles //Align titles
$this->style[$r]['titleAlign'] = 'center'; $this->style[$r]['titleAlign'] = 'center';
//Align fields //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'; $this->style[$r]['align'] = 'right';
else } else {
$this->style[$r]['align'] = 'left'; $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'; $this->style[$r]['align'] = 'center';
} }
} }
// Adjust the columns width to prevent overflow the page width // Adjust the columns width to prevent overflow the page width
//Render headers //Render headers
$totalWidth = 0; $totalWidth = 0;
foreach ($this->fields as $r => $rval) foreach ($this->fields as $r => $rval) {
if ($this->style[$r]['showInTable'] != '0') if ($this->style[$r]['showInTable'] != '0') {
$totalWidth += $this->style[$r]['colWidth']; $totalWidth += $this->style[$r]['colWidth'];
}
}
$this->totalWidth = $totalWidth; $this->totalWidth = $totalWidth;
$maxWidth = 1800; $maxWidth = 1800;
$proportion = $totalWidth / $maxWidth; $proportion = $totalWidth / $maxWidth;
if ($proportion > 1) if ($proportion > 1) {
$this->totalWidth = 1800; $this->totalWidth = 1800;
if ($proportion > 1) }
foreach ($this->fields as $r => $rval) if ($proportion > 1) {
if ($this->style[$r]['showInTable'] != '0') foreach ($this->fields as $r => $rval) {
if ($this->style[$r]['showInTable'] != '0') {
$this->style[$r]['colWidth'] = $this->style[$r]['colWidth'] / $proportion; $this->style[$r]['colWidth'] = $this->style[$r]['colWidth'] / $proportion;
} }
}
}
}
/** /**
* Function renderTable * Function renderTable
@@ -512,12 +542,13 @@ class propelTable
{ {
//Render Title //Render Title
$thereisnotitle = true; $thereisnotitle = true;
foreach ($this->fields as $r => $rval) foreach ($this->fields as $r => $rval) {
if ($this->fields[$r]['Type'] === 'title') { if ($this->fields[$r]['Type'] === 'title') {
$this->title = $this->fields[$r]['Label']; $this->title = $this->fields[$r]['Label'];
unset( $this->fields[$r] ); unset( $this->fields[$r] );
$thereisnotitle = false; $thereisnotitle = false;
} }
}
if ($thereisnotitle) { if ($thereisnotitle) {
$this->title = ''; $this->title = '';
} }
@@ -530,11 +561,12 @@ class propelTable
// verify if there are templates folders registered, template and method folders are the same // verify if there are templates folders registered, template and method folders are the same
$folderTemplate = explode( '/', $this->template ); $folderTemplate = explode( '/', $this->template );
$oPluginRegistry = & PMPluginRegistry::getSingleton(); $oPluginRegistry = & PMPluginRegistry::getSingleton();
if ($oPluginRegistry->isRegisteredFolder( $folderTemplate[0] )) if ($oPluginRegistry->isRegisteredFolder( $folderTemplate[0] )) {
$templateFile = PATH_PLUGINS . $this->template . '.html'; $templateFile = PATH_PLUGINS . $this->template . '.html';
else } else {
$templateFile = PATH_TPL . $this->template . '.html'; $templateFile = PATH_TPL . $this->template . '.html';
// Prepare the template // Prepare the template
}
$this->tpl = new TemplatePower( $templateFile ); $this->tpl = new TemplatePower( $templateFile );
$this->tpl->prepare(); $this->tpl->prepare();
if (is_array( $fields )) { if (is_array( $fields )) {
@@ -553,9 +585,10 @@ class propelTable
$this->tpl->assign( "title", $this->title ); $this->tpl->assign( "title", $this->title );
if (file_exists( $this->xmlForm->home . $this->filterForm . '.xml' )) { if (file_exists( $this->xmlForm->home . $this->filterForm . '.xml' )) {
$filterForm = new filterForm( $this->filterForm, $this->xmlForm->home ); $filterForm = new filterForm( $this->filterForm, $this->xmlForm->home );
if ($this->menu === '') if ($this->menu === '') {
$this->menu = 'gulliver/pagedTable_Options'; $this->menu = 'gulliver/pagedTable_Options';
} }
}
if (file_exists( $this->xmlForm->home . $this->menu . '.xml' )) { if (file_exists( $this->xmlForm->home . $this->menu . '.xml' )) {
$menu = new xmlMenu( $this->menu, $this->xmlForm->home ); $menu = new xmlMenu( $this->menu, $this->xmlForm->home );
$this->tpl->newBlock( 'headerBlock' ); $this->tpl->newBlock( 'headerBlock' );
@@ -585,9 +618,10 @@ class propelTable
$this->tpl->assign( 'content', $filterForm->render( $template, $scriptCode ) ); $this->tpl->assign( 'content', $filterForm->render( $template, $scriptCode ) );
$oHeadPublisher->addScriptFile( $filterForm->scriptURL ); $oHeadPublisher->addScriptFile( $filterForm->scriptURL );
$oHeadPublisher->addScriptCode( $scriptCode ); $oHeadPublisher->addScriptCode( $scriptCode );
if (isset( $_SESSION )) if (isset( $_SESSION )) {
$_SESSION[$filterForm->id] = $filterForm->values; $_SESSION[$filterForm->id] = $filterForm->values;
} }
}
} }
@@ -677,14 +711,16 @@ class propelTable
} }
} }
$this->tpl->gotoblock( "row" ); $this->tpl->gotoblock( "row" );
if (! isset( $rowName )) if (! isset( $rowName )) {
$rowName = array (); $rowName = array ();
}
$this->tpl->assign( "rowName", implode( ",", $rowName ) ); $this->tpl->assign( "rowName", implode( ",", $rowName ) );
} }
//End Master Detail: This enable the MasterDEtail view //End Master Detail: This enable the MasterDEtail view
//Merge $result with $xmlForm values (for default valuesSettings) //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 ); $result = array_merge( $this->xmlForm->values, $result );
}
foreach ($this->fields as $r => $rval) { foreach ($this->fields as $r => $rval) {
if (strcasecmp( $this->fields[$r]['Type'], 'cellMark' ) == 0) { if (strcasecmp( $this->fields[$r]['Type'], 'cellMark' ) == 0) {
$result1 = $result; $result1 = $result;
@@ -695,11 +731,12 @@ class propelTable
$this->tdStyle = $this->xmlForm->fields[$this->fields[$r]['Name']]->tdStyle( $result1, $this->xmlForm ); $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 ); $this->tdClass = $this->xmlForm->fields[$this->fields[$r]['Name']]->tdClass( $result1, $this->xmlForm );
} elseif ($this->style[$r]['showInTable'] != '0') { } 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 ); $this->renderField( $j + 1, $r, $result );
} }
} }
} }
}
$this->tpl->assign( '_ROOT.gridRows', '=' . $gridRows ); //number of rows in the current page $this->tpl->assign( '_ROOT.gridRows', '=' . $gridRows ); //number of rows in the current page
$this->tpl->newBlock( 'rowTag' ); $this->tpl->newBlock( 'rowTag' );
$this->tpl->assign( 'rowId', 'insertAtLast' ); $this->tpl->assign( 'rowId', 'insertAtLast' );
@@ -728,20 +765,23 @@ class propelTable
$last = "<a class='noLastPage'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>"; $last = "<a class='noLastPage'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>";
} }
$pagesEnum = ''; $pagesEnum = '';
for ($r = 1; $r <= $this->totPages; $r ++) for ($r = 1; $r <= $this->totPages; $r ++) {
if (($r >= ($this->currentPage - 5)) && ($r <= ($this->currentPage + 5))) { if (($r >= ($this->currentPage - 5)) && ($r <= ($this->currentPage + 5))) {
$pageAjax = $this->id . ".doGoToPage(" . $r . ");return false;"; $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>"; $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>"; $pagesEnum .= "&nbsp;<a>" . $r . "</a>";
} }
}
}
if ($this->totRows === 0) { if ($this->totRows === 0) {
$this->tpl->newBlock( 'norecords' ); $this->tpl->newBlock( 'norecords' );
$this->tpl->assign( "columnCount", $this->colCount ); $this->tpl->assign( "columnCount", $this->colCount );
$noRecordsFound = 'ID_NO_RECORDS_FOUND'; $noRecordsFound = 'ID_NO_RECORDS_FOUND';
if (G::LoadTranslation( $noRecordsFound )) if (G::LoadTranslation( $noRecordsFound )) {
$noRecordsFound = G::LoadTranslation( $noRecordsFound ); $noRecordsFound = G::LoadTranslation( $noRecordsFound );
}
$this->tpl->assign( "noRecordsFound", $noRecordsFound ); $this->tpl->assign( "noRecordsFound", $noRecordsFound );
} }
if (! $this->disableFooter) { if (! $this->disableFooter) {
@@ -770,9 +810,11 @@ class propelTable
} else { } else {
$this->tpl->assign( "fastSearchStyle", 'visibility:hidden;' ); $this->tpl->assign( "fastSearchStyle", 'visibility:hidden;' );
} }
if ($this->addRow) if ($this->addRow) {
if ($this->sqlInsert != '') 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( "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 ); $this->tpl->assign( "pagesEnum", $pagesEnum );
} }
?> ?>
@@ -832,3 +874,4 @@ var popupHeight<?php echo '='.$this->popupHeight?>;
G::RenderPage( "publish", "blank" ); G::RenderPage( "publish", "blank" );
} }
} }

View File

@@ -15,8 +15,7 @@ class Entity_Base
// one element // one element
if (is_array( $field )) { if (is_array( $field )) {
$fields = $field; $fields = $field;
} } else {
else {
$fields = array (); $fields = array ();
$fields[] = $field; $fields[] = $field;
} }
@@ -42,7 +41,7 @@ class Entity_Base
protected function validateRequiredFields ($requiredFields = array()) protected function validateRequiredFields ($requiredFields = array())
{ {
foreach ($requiredFields as $k => $field) { foreach ($requiredFields as $k => $field) {
if ($this->{$field} === NULL) { if ($this->{$field} === null) {
throw (new Exception( "Field $field is required in " . get_class( $this ) )); throw (new Exception( "Field $field is required in " . get_class( $this ) ));
die(); die();
} }
@@ -53,6 +52,7 @@ class Entity_Base
* *
* *
* *
*
* Copy the values of the Entity to the array of aliases * Copy the values of the Entity to the array of aliases
* The array of aliases must be defined. * The array of aliases must be defined.
* *
@@ -64,12 +64,10 @@ class Entity_Base
// get aliases from class // get aliases from class
$className = get_class( $this ); $className = get_class( $this );
if (method_exists( $className, 'GetAliases' )) { if (method_exists( $className, 'GetAliases' )) {
$aliases = call_user_func (array ( $aliases = call_user_func( array ($className,'GetAliases'
$className,
'GetAliases'
) ); ) );
// $aliases = $className::GetAliases (); // $aliases = $className::GetAliases ();
foreach ($this as $field => $value) foreach ($this as $field => $value) {
if (isset( $aliases[$field] )) { if (isset( $aliases[$field] )) {
// echo "Field exists in Aliases: " . $field . "\n"; // echo "Field exists in Aliases: " . $field . "\n";
// echo "Alias Name:" . $aliases[$field] . "\n"; // echo "Alias Name:" . $aliases[$field] . "\n";
@@ -77,6 +75,7 @@ class Entity_Base
$aAlias[$aliases[$field]] = $value; $aAlias[$aliases[$field]] = $value;
} }
} }
}
return $aAlias; return $aAlias;
} }
@@ -85,36 +84,36 @@ class Entity_Base
* *
* *
* *
*
* Set the data from array of alias to Entity * Set the data from array of alias to Entity
* *
* @param $aAliasData array * @param $aAliasData array of data of aliases
* of data of aliases
*/ */
public function setAliasDataArray ($aAliasData) public function setAliasDataArray ($aAliasData)
{ {
// get aliases from class // get aliases from class
$className = get_class( $this ); $className = get_class( $this );
if (method_exists( $className, 'GetAliases' )) { if (method_exists( $className, 'GetAliases' )) {
$aliases = call_user_func (array ( $aliases = call_user_func( array ($className,'GetAliases'
$className,
'GetAliases'
) ); ) );
// $aliases = $className::GetAliases (); // $aliases = $className::GetAliases ();
foreach ($this as $field => $value) foreach ($this as $field => $value) {
if (isset ($aliases [$field])) if (isset( $aliases[$field] )) {
$this->{$field} = $aAliasData[$aliases[$field]]; $this->{$field} = $aAliasData[$aliases[$field]];
} }
} }
}
}
/** /**
* *
* *
* *
*
* Initialize object with values from $data. * Initialize object with values from $data.
* The values from data use properties or alias array. * The values from data use properties or alias array.
* *
* @param * @param $data
* $data
*/ */
protected function initializeObject ($data) protected function initializeObject ($data)
{ {
@@ -123,27 +122,26 @@ class Entity_Base
$aliases = array (); $aliases = array ();
$swAliases = false; $swAliases = false;
if (method_exists( $className, 'GetAliases' )) { if (method_exists( $className, 'GetAliases' )) {
$aliases = call_user_func (array ( $aliases = call_user_func( array ($className,'GetAliases'
$className,
'GetAliases'
) ); ) );
// $aliases = $className::GetAliases (); // $aliases = $className::GetAliases ();
$swAliases = true; $swAliases = true;
} }
// use object properties or aliases to initialize // use object properties or aliases to initialize
foreach ($this as $field => $value) foreach ($this as $field => $value) {
if (isset( $data[$field] )) { if (isset( $data[$field] )) {
$this->$field = $data[$field]; $this->$field = $data[$field];
} } elseif ($swAliases && isset( $aliases[$field] ) && isset( $data[$aliases[$field]] )) {
elseif ($swAliases && isset ($aliases [$field]) && isset ($data [$aliases [$field]])) {
$this->$field = $data[$aliases[$field]]; $this->$field = $data[$aliases[$field]];
} }
} }
}
public function serialize () public function serialize ()
{ {
if (isset ($this->temp)) if (isset( $this->temp )) {
unset( $this->temp ); unset( $this->temp );
}
return serialize( $this ); return serialize( $this );
} }
@@ -153,5 +151,5 @@ class Entity_Base
$data = unserialize( $str ); $data = unserialize( $str );
return new $className( $data ); return new $className( $data );
} }
} }

View File

@@ -1,12 +1,12 @@
<?php <?php
/** /**
* AppEvent.php * AppEvent.php
*
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
require_once 'classes/model/om/BaseAppEvent.php'; require_once 'classes/model/om/BaseAppEvent.php';
/** /**
* Skeleton subclass for representing a row from the 'APP_EVENT' table. * Skeleton subclass for representing a row from the 'APP_EVENT' table.
* *
@@ -18,25 +18,27 @@ require_once 'classes/model/om/BaseAppEvent.php';
* *
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class AppEvent extends BaseAppEvent { class AppEvent extends BaseAppEvent
public function load($sApplicationUID, $iDelegation) { {
public function load ($sApplicationUID, $iDelegation)
{
try { try {
$oAppEvent = AppEventPeer::retrieveByPK( $sApplicationUID, $iDelegation ); $oAppEvent = AppEventPeer::retrieveByPK( $sApplicationUID, $iDelegation );
if (! is_null( $oAppEvent )) { if (! is_null( $oAppEvent )) {
$aFields = $oAppEvent->toArray( BasePeer::TYPE_FIELDNAME ); $aFields = $oAppEvent->toArray( BasePeer::TYPE_FIELDNAME );
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME ); $this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
return $aFields; return $aFields;
} } else {
else {
throw (new Exception( 'This row doesn\'t exist!' )); throw (new Exception( 'This row doesn\'t exist!' ));
} }
} } catch (Exception $oError) {
catch (Exception $oError) {
throw ($oError); throw ($oError);
} }
} }
function create($aData) { function create ($aData)
{
$oConnection = Propel::getConnection( AppEventPeer::DATABASE_NAME ); $oConnection = Propel::getConnection( AppEventPeer::DATABASE_NAME );
try { try {
$oAppEvent = new AppEvent(); $oAppEvent = new AppEvent();
@@ -46,8 +48,7 @@ class AppEvent extends BaseAppEvent {
$iResult = $oAppEvent->save(); $iResult = $oAppEvent->save();
$oConnection->commit(); $oConnection->commit();
return true; return true;
} } else {
else {
$sMessage = ''; $sMessage = '';
$aValidationFailures = $oAppEvent->getValidationFailures(); $aValidationFailures = $oAppEvent->getValidationFailures();
foreach ($aValidationFailures as $oValidationFailure) { foreach ($aValidationFailures as $oValidationFailure) {
@@ -55,14 +56,14 @@ class AppEvent extends BaseAppEvent {
} }
throw (new Exception( 'The registry cannot be created!<br />' . $sMessage )); throw (new Exception( 'The registry cannot be created!<br />' . $sMessage ));
} }
} } catch (Exception $oError) {
catch (Exception $oError) {
$oConnection->rollback(); $oConnection->rollback();
throw ($oError); throw ($oError);
} }
} }
function update($aData) { function update ($aData)
{
$oConnection = Propel::getConnection( AppEventPeer::DATABASE_NAME ); $oConnection = Propel::getConnection( AppEventPeer::DATABASE_NAME );
try { try {
$oAppEvent = AppEventPeer::retrieveByPK( $aData['APP_UID'], $aData['DEL_INDEX'] ); $oAppEvent = AppEventPeer::retrieveByPK( $aData['APP_UID'], $aData['DEL_INDEX'] );
@@ -73,8 +74,7 @@ class AppEvent extends BaseAppEvent {
$iResult = $oAppEvent->save(); $iResult = $oAppEvent->save();
$oConnection->commit(); $oConnection->commit();
return $iResult; return $iResult;
} } else {
else {
$sMessage = ''; $sMessage = '';
$aValidationFailures = $oAppEvent->getValidationFailures(); $aValidationFailures = $oAppEvent->getValidationFailures();
foreach ($aValidationFailures as $oValidationFailure) { foreach ($aValidationFailures as $oValidationFailure) {
@@ -82,18 +82,17 @@ class AppEvent extends BaseAppEvent {
} }
throw (new Exception( 'The registry cannot be updated!<br />' . $sMessage )); throw (new Exception( 'The registry cannot be updated!<br />' . $sMessage ));
} }
} } else {
else {
throw (new Exception( 'This row doesn\'t exist!' )); throw (new Exception( 'This row doesn\'t exist!' ));
} }
} } catch (Exception $oError) {
catch (Exception $oError) {
$oConnection->rollback(); $oConnection->rollback();
throw ($oError); throw ($oError);
} }
} }
function remove($sApplicationUID, $iDelegation, $sEvnUid) { function remove ($sApplicationUID, $iDelegation, $sEvnUid)
{
$oConnection = Propel::getConnection( AppEventPeer::DATABASE_NAME ); $oConnection = Propel::getConnection( AppEventPeer::DATABASE_NAME );
try { try {
$oAppEvent = AppEventPeer::retrieveByPK( $sApplicationUID, $iDelegation, $sEvnUid ); $oAppEvent = AppEventPeer::retrieveByPK( $sApplicationUID, $iDelegation, $sEvnUid );
@@ -102,18 +101,17 @@ class AppEvent extends BaseAppEvent {
$iResult = $oAppEvent->delete(); $iResult = $oAppEvent->delete();
$oConnection->commit(); $oConnection->commit();
return $iResult; return $iResult;
} } else {
else {
throw (new Exception( 'This row doesn\'t exist!' )); throw (new Exception( 'This row doesn\'t exist!' ));
} }
} } catch (Exception $oError) {
catch (Exception $oError) {
$oConnection->rollback(); $oConnection->rollback();
throw ($oError); throw ($oError);
} }
} }
function getAppEventsCriteria($sProcessUid='', $sStatus = '', $EVN_ACTION='') { function getAppEventsCriteria ($sProcessUid = '', $sStatus = '', $EVN_ACTION = '')
{
try { try {
require_once 'classes/model/Event.php'; require_once 'classes/model/Event.php';
$oCriteria = new Criteria( 'workflow' ); $oCriteria = new Criteria( 'workflow' );
@@ -138,28 +136,42 @@ class AppEvent extends BaseAppEvent {
$oCriteria->addJoin( AppEventPeer::EVN_UID, EventPeer::EVN_UID, Criteria::LEFT_JOIN ); $oCriteria->addJoin( AppEventPeer::EVN_UID, EventPeer::EVN_UID, Criteria::LEFT_JOIN );
$del = DBAdapter::getStringDelimiter(); $del = DBAdapter::getStringDelimiter();
$aConditions = array (); $aConditions = array ();
$aConditions[] = array(EventPeer::EVN_UID, 'C1.CON_ID'); $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); $aConditions[] = array ('C1.CON_CATEGORY',$del . 'EVN_DESCRIPTION' . $del
);
$aConditions[] = array ('C1.CON_LANG',$del . SYS_LANG . $del
);
$oCriteria->addJoinMC( $aConditions, Criteria::LEFT_JOIN ); $oCriteria->addJoinMC( $aConditions, Criteria::LEFT_JOIN );
$aConditions = array (); $aConditions = array ();
$aConditions[] = array(AppEventPeer::APP_UID, AppDelegationPeer::APP_UID); $aConditions[] = array (AppEventPeer::APP_UID,AppDelegationPeer::APP_UID
$aConditions[] = array(AppEventPeer::DEL_INDEX, AppDelegationPeer::DEL_INDEX); );
$aConditions[] = array (AppEventPeer::DEL_INDEX,AppDelegationPeer::DEL_INDEX
);
$oCriteria->addJoinMC( $aConditions, Criteria::LEFT_JOIN ); $oCriteria->addJoinMC( $aConditions, Criteria::LEFT_JOIN );
$aConditions = array (); $aConditions = array ();
$aConditions[] = array(AppDelegationPeer::TAS_UID, 'C2.CON_ID'); $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); $aConditions[] = array ('C2.CON_CATEGORY',$del . 'TAS_TITLE' . $del
);
$aConditions[] = array ('C2.CON_LANG',$del . SYS_LANG . $del
);
$oCriteria->addJoinMC( $aConditions, Criteria::LEFT_JOIN ); $oCriteria->addJoinMC( $aConditions, Criteria::LEFT_JOIN );
$aConditions = array (); $aConditions = array ();
$aConditions[] = array(AppDelegationPeer::APP_UID, 'C3.CON_ID'); $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); $aConditions[] = array ('C3.CON_CATEGORY',$del . 'APP_TITLE' . $del
);
$aConditions[] = array ('C3.CON_LANG',$del . SYS_LANG . $del
);
$oCriteria->addJoinMC( $aConditions, Criteria::LEFT_JOIN ); $oCriteria->addJoinMC( $aConditions, Criteria::LEFT_JOIN );
$aConditions = array (); $aConditions = array ();
$aConditions[] = array(AppDelegationPeer::PRO_UID, 'C4.CON_ID'); $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 ('C4.CON_CATEGORY',$del . 'PRO_TITLE' . $del
);
$aConditions[] = array ('C4.CON_LANG',$del . SYS_LANG . $del
);
$oCriteria->addJoinMC( $aConditions, Criteria::LEFT_JOIN ); $oCriteria->addJoinMC( $aConditions, Criteria::LEFT_JOIN );
$oCriteria->add( AppEventPeer::EVN_UID, '', Criteria::NOT_EQUAL ); $oCriteria->add( AppEventPeer::EVN_UID, '', Criteria::NOT_EQUAL );
@@ -182,13 +194,13 @@ class AppEvent extends BaseAppEvent {
} }
//$oCriteria->addDescendingOrderByColumn(AppEventPeer::APP_EVN_ACTION_DATE); //$oCriteria->addDescendingOrderByColumn(AppEventPeer::APP_EVN_ACTION_DATE);
return $oCriteria; return $oCriteria;
} } catch (Exception $oError) {
catch (Exception $oError) {
throw ($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/Configuration.php';
require_once 'classes/model/Triggers.php'; require_once 'classes/model/Triggers.php';
@@ -217,12 +229,13 @@ class AppEvent extends BaseAppEvent {
$oCriteria->addSelectColumn( AppDelegationPeer::DEL_TASK_DUE_DATE ); $oCriteria->addSelectColumn( AppDelegationPeer::DEL_TASK_DUE_DATE );
$oCriteria->addSelectColumn( AppDelegationPeer::DEL_FINISH_DATE ); $oCriteria->addSelectColumn( AppDelegationPeer::DEL_FINISH_DATE );
$oCriteria->addJoin( AppEventPeer::EVN_UID, EventPeer::EVN_UID, Criteria::JOIN ); $oCriteria->addJoin( AppEventPeer::EVN_UID, EventPeer::EVN_UID, Criteria::JOIN );
$aConditions = array (); $aConditions = array ();
array_push($aConditions, Array(AppEventPeer::APP_UID, AppDelegationPeer::APP_UID)); array_push( $aConditions, Array (AppEventPeer::APP_UID,AppDelegationPeer::APP_UID
array_push($aConditions, Array(AppEventPeer::DEL_INDEX, AppDelegationPeer::DEL_INDEX)); ) );
array_push( $aConditions, Array (AppEventPeer::DEL_INDEX,AppDelegationPeer::DEL_INDEX
) );
$oCriteria->addJoinMC( $aConditions, Criteria::LEFT_JOIN ); $oCriteria->addJoinMC( $aConditions, Criteria::LEFT_JOIN );
$oCriteria->addJoin( ApplicationPeer::APP_UID, AppEventPeer::APP_UID ); $oCriteria->addJoin( ApplicationPeer::APP_UID, AppEventPeer::APP_UID );
@@ -250,6 +263,7 @@ class AppEvent extends BaseAppEvent {
//g::pr($aRow); //die; //g::pr($aRow); //die;
if ($debug) { if ($debug) {
require_once 'classes/model/Application.php'; require_once 'classes/model/Application.php';
$oApp = ApplicationPeer::retrieveByPk( $aRow['APP_UID'] ); $oApp = ApplicationPeer::retrieveByPk( $aRow['APP_UID'] );
@@ -267,7 +281,9 @@ class AppEvent extends BaseAppEvent {
if ($aRow['TRI_UID'] == '') { if ($aRow['TRI_UID'] == '') {
//a rare case when the tri_uid is not set. //a rare case when the tri_uid is not set.
$log[] = " (!) Any trigger was set................................SKIPPED and will be CLOSED"; $log[] = " (!) Any trigger was set................................SKIPPED and will be CLOSED";
if($debug) println(" (!) 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->setAppEvnStatus( 'CLOSE' );
$oAppEvent->save(); $oAppEvent->save();
continue; continue;
@@ -277,7 +293,9 @@ class AppEvent extends BaseAppEvent {
if (! is_object( $oTrigger )) { if (! is_object( $oTrigger )) {
//the trigger record doesn't exist.. //the trigger record doesn't exist..
$log[] = ' (!) The trigger ' . $aRow['TRI_UID'] . ' ' . $oTrigger->getTriTitle() . " doesn't exist.......SKIPPED and will be CLOSED"; $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"); if ($debug) {
println( " (!) The trigger {$aRow['TRI_UID']} {$oTrigger->getTriTitle()} doesn't exist.......SKIPPED and will be CLOSED" );
}
$oAppEvent->setAppEvnStatus( 'CLOSE' ); $oAppEvent->setAppEvnStatus( 'CLOSE' );
$oAppEvent->save(); $oAppEvent->save();
continue; continue;
@@ -300,8 +318,10 @@ class AppEvent extends BaseAppEvent {
if (sizeof( $_SESSION['TRIGGER_DEBUG']['ERRORS'] ) == 0) { if (sizeof( $_SESSION['TRIGGER_DEBUG']['ERRORS'] ) == 0) {
$log[] = ' - The trigger ' . $oTrigger->getTriTitle() . ' was executed successfully!'; $log[] = ' - The trigger ' . $oTrigger->getTriTitle() . ' was executed successfully!';
if($debug) println(" - The trigger '{$oTrigger->getTriTitle()}' was executed successfully!"); if ($debug) {
println( " - The trigger '{$oTrigger->getTriTitle()}' was executed successfully!" );
//g::pr($aFields); //g::pr($aFields);
}
$aFields['APP_DATA'] = $oPMScript->aFields; $aFields['APP_DATA'] = $oPMScript->aFields;
$oCase->updateCase( $aRow['APP_UID'], $aFields ); $oCase->updateCase( $aRow['APP_UID'], $aFields );
$oAppEvent->setAppEvnStatus( 'CLOSE' ); $oAppEvent->setAppEvnStatus( 'CLOSE' );
@@ -320,18 +340,19 @@ class AppEvent extends BaseAppEvent {
$oAppEvent->save(); $oAppEvent->save();
} }
return $c; return $c;
} } catch (Exception $oError) {
catch (Exception $oError) {
$log[] = ' Error execute event : ' . $oError->getMessage(); $log[] = ' Error execute event : ' . $oError->getMessage();
die( $oError->getMessage() ); die( $oError->getMessage() );
return $oError->getMessage(); return $oError->getMessage();
} }
} }
function close($APP_UID, $DEL_INDEX){ function close ($APP_UID, $DEL_INDEX)
{
$aRow = $this->load( $APP_UID, $DEL_INDEX ); $aRow = $this->load( $APP_UID, $DEL_INDEX );
$aRow['APP_EVN_STATUS'] = 'CLOSE'; $aRow['APP_EVN_STATUS'] = 'CLOSE';
$this->update( $aRow ); $this->update( $aRow );
} }
}
// AppEvent
} // AppEvent