BUG 0000 Adjustment for the standardization of code. CODE_STYLE
This commit is contained in:
@@ -35,35 +35,32 @@
|
||||
* date Aug 31th, 2010
|
||||
* @copyright (C) 2002 by Colosa Development Team.
|
||||
*/
|
||||
|
||||
class i18n_PO
|
||||
{
|
||||
|
||||
private $_file = null;
|
||||
private $_string = '';
|
||||
private $_meta;
|
||||
private $_fp;
|
||||
private $_fileComments;
|
||||
|
||||
protected $_editingHeader;
|
||||
protected $_fileLine;
|
||||
|
||||
protected $flagEndHeaders;
|
||||
protected $flagError;
|
||||
protected $flagInit;
|
||||
protected $lineNumber;
|
||||
|
||||
public $translatorComments;
|
||||
public $extractedComments;
|
||||
public $references;
|
||||
public $flags;
|
||||
public $previousUntranslatedStrings;
|
||||
|
||||
function __construct ($file)
|
||||
public function __construct($file)
|
||||
{
|
||||
$this->file = $file;
|
||||
}
|
||||
|
||||
function buildInit ()
|
||||
public function buildInit()
|
||||
{
|
||||
$this->_fp = fopen($this->file, 'w');
|
||||
|
||||
@@ -85,7 +82,7 @@ class i18n_PO
|
||||
$this->_editingHeader = true;
|
||||
}
|
||||
|
||||
function readInit ()
|
||||
public function readInit()
|
||||
{
|
||||
$this->_fp = fopen($this->file, 'r');
|
||||
|
||||
@@ -104,7 +101,7 @@ class i18n_PO
|
||||
$this->previousUntranslatedStrings = Array();
|
||||
}
|
||||
|
||||
function addHeader ($id, $value)
|
||||
public function addHeader($id, $value)
|
||||
{
|
||||
if ($this->_editingHeader) {
|
||||
$meta = '"' . trim($id) . ': ' . trim($value) . '\n"';
|
||||
@@ -112,42 +109,42 @@ class i18n_PO
|
||||
}
|
||||
}
|
||||
|
||||
function addTranslatorComment ($str)
|
||||
public function addTranslatorComment($str)
|
||||
{
|
||||
$this->headerStroke();
|
||||
$comment = '# ' . trim($str);
|
||||
$this->_writeLine($comment);
|
||||
}
|
||||
|
||||
function addExtractedComment ($str)
|
||||
public function addExtractedComment($str)
|
||||
{
|
||||
$this->headerStroke();
|
||||
$comment = '#. ' . trim($str);
|
||||
$this->_writeLine($comment);
|
||||
}
|
||||
|
||||
function addReference ($str)
|
||||
public function addReference($str)
|
||||
{
|
||||
$this->headerStroke();
|
||||
$reference = '#: ' . trim($str);
|
||||
$this->_writeLine($reference);
|
||||
}
|
||||
|
||||
function addFlag ($str)
|
||||
public function addFlag($str)
|
||||
{
|
||||
$this->headerStroke();
|
||||
$flag = '#, ' . trim($str);
|
||||
$this->_writeLine($flag);
|
||||
}
|
||||
|
||||
function addPreviousUntranslatedString ($str)
|
||||
public function addPreviousUntranslatedString($str)
|
||||
{
|
||||
$this->headerStroke();
|
||||
$str = '#| ' . trim($str);
|
||||
$this->_writeLine($str);
|
||||
}
|
||||
|
||||
function addTranslation ($msgid, $msgstr)
|
||||
public function addTranslation($msgid, $msgstr)
|
||||
{
|
||||
$this->headerStroke();
|
||||
$this->_writeLine('msgid "' . $this->prepare($msgid, true) . '"');
|
||||
@@ -155,44 +152,40 @@ class i18n_PO
|
||||
$this->_writeLine('');
|
||||
}
|
||||
|
||||
function _writeLine ($str)
|
||||
public function _writeLine($str)
|
||||
{
|
||||
$this->_write($str . "\n");
|
||||
}
|
||||
|
||||
function _write ($str)
|
||||
public function _write($str)
|
||||
{
|
||||
fwrite($this->_fp, $str);
|
||||
}
|
||||
|
||||
function prepare ($string, $reverse = false)
|
||||
public function prepare($string, $reverse = false)
|
||||
{
|
||||
//$string = str_replace('\"', '"', $string);
|
||||
//$string = stripslashes($string);
|
||||
|
||||
|
||||
if ($reverse) {
|
||||
$smap = array ('"',"\n","\t","\r"
|
||||
);
|
||||
$rmap = array ('\"','\\n"' . "\n" . '"','\\t','\\r'
|
||||
);
|
||||
$smap = array('"', "\n", "\t", "\r");
|
||||
$rmap = array('\"', '\\n"' . "\n" . '"', '\\t', '\\r');
|
||||
return (string) str_replace($smap, $rmap, $string);
|
||||
} else {
|
||||
$string = preg_replace('/"\s+"/', '', $string);
|
||||
$smap = array ('\\n','\\r','\\t','\"'
|
||||
);
|
||||
$rmap = array ("\n","\r","\t",'"'
|
||||
);
|
||||
$smap = array('\\n', '\\r', '\\t', '\"');
|
||||
$rmap = array("\n", "\r", "\t", '"');
|
||||
return (string) str_replace($smap, $rmap, $string);
|
||||
}
|
||||
}
|
||||
|
||||
function headerStroke ()
|
||||
public function headerStroke()
|
||||
{
|
||||
if ($this->_editingHeader) {
|
||||
$this->_editingHeader = false;
|
||||
$this->_writeLine('');
|
||||
;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,10 +214,9 @@ class i18n_PO
|
||||
|
||||
while (!$this->flagError && !$this->flagEndHeaders) {
|
||||
|
||||
if ($this->flagInit) { //in first instance
|
||||
if ($this->flagInit) {
|
||||
//in first instance
|
||||
$this->flagInit = false; //unset init flag
|
||||
|
||||
|
||||
//read the first and second line of the file
|
||||
$firstLine = fgets($this->_fp);
|
||||
$secondLine = fgets($this->_fp);
|
||||
@@ -260,8 +252,6 @@ class i18n_PO
|
||||
break;
|
||||
}
|
||||
} //end looking for headeers
|
||||
|
||||
|
||||
//verifying the headers data
|
||||
if (!isset($this->_meta['X-Poedit-Language'])) {
|
||||
if (!isset($this->_meta['Language'])) {
|
||||
@@ -293,7 +283,7 @@ class i18n_PO
|
||||
}
|
||||
}
|
||||
|
||||
function getHeaders ()
|
||||
public function getHeaders()
|
||||
{
|
||||
return $this->_meta;
|
||||
}
|
||||
@@ -403,12 +393,11 @@ class i18n_PO
|
||||
g::pr($match);
|
||||
die; */
|
||||
|
||||
return Array ('msgid' => trim( $msgid ),'msgstr' => trim( $msgstr )
|
||||
);
|
||||
return Array('msgid' => trim($msgid), 'msgstr' => trim($msgstr));
|
||||
}
|
||||
|
||||
//garbage
|
||||
function __destruct ()
|
||||
public function __destruct()
|
||||
{
|
||||
if ($this->_fp) {
|
||||
fclose($this->_fp);
|
||||
|
||||
@@ -34,11 +34,11 @@
|
||||
*/
|
||||
class Xml_Node
|
||||
{
|
||||
var $name = '';
|
||||
var $type = '';
|
||||
var $value = ''; //maybe not necesary
|
||||
var $attributes = array ();
|
||||
var $children = array ();
|
||||
public $name = '';
|
||||
public $type = '';
|
||||
public $value = ''; //maybe not necesary
|
||||
public $attributes = array ();
|
||||
public $children = array ();
|
||||
|
||||
/**
|
||||
* Function Xml_Node
|
||||
@@ -51,7 +51,7 @@ class Xml_Node
|
||||
* @param eter string attributes
|
||||
* @return string
|
||||
*/
|
||||
function Xml_Node ($name, $type, $value, $attributes = array())
|
||||
public function Xml_Node ($name, $type, $value, $attributes = array())
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->type = $type;
|
||||
@@ -68,7 +68,7 @@ class Xml_Node
|
||||
* @param eter string value
|
||||
* @return string
|
||||
*/
|
||||
function addAttribute ($name, $value)
|
||||
public function addAttribute ($name, $value)
|
||||
{
|
||||
$this->attributes[$name] = $value;
|
||||
return true;
|
||||
@@ -82,7 +82,7 @@ class Xml_Node
|
||||
* @param eter string childNode
|
||||
* @return string
|
||||
*/
|
||||
function addChildNode ($childNode)
|
||||
public function addChildNode ($childNode)
|
||||
{
|
||||
if (is_object( $childNode ) && strcasecmp( get_class( $childNode ), 'Xml_Node' ) == 0) {
|
||||
$this->type = 'open';
|
||||
@@ -101,7 +101,7 @@ class Xml_Node
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
function toTree ()
|
||||
public function toTree ()
|
||||
{
|
||||
$arr = new Xml_Node( $this->name, $this->type, $this->value, $this->attributes );
|
||||
unset( $arr->parent );
|
||||
@@ -112,7 +112,7 @@ class Xml_Node
|
||||
return $arr;
|
||||
}
|
||||
|
||||
function toArray ($obj = null)
|
||||
public function toArray ($obj = null)
|
||||
{
|
||||
$arr = array ();
|
||||
if (! isset( $obj )) {
|
||||
@@ -136,7 +136,7 @@ class Xml_Node
|
||||
* @param eter string xpath
|
||||
* @return string
|
||||
*/
|
||||
function &findNode ($xpath)
|
||||
public function &findNode ($xpath)
|
||||
{
|
||||
$n = null;
|
||||
$p = explode( '/', $xpath );
|
||||
@@ -180,7 +180,7 @@ class Xml_Node
|
||||
* @param eter string xpath
|
||||
* @return string
|
||||
*/
|
||||
function getXML ()
|
||||
public function getXML ()
|
||||
{
|
||||
switch ($this->type) {
|
||||
case 'open':
|
||||
@@ -237,7 +237,7 @@ class Xml_Node
|
||||
return $xml;
|
||||
}
|
||||
|
||||
function getCDATAValue ()
|
||||
public function getCDATAValue ()
|
||||
{
|
||||
$cdata = htmlentities( $this->value, ENT_QUOTES, 'utf-8' );
|
||||
if ($this->value === $cdata) {
|
||||
@@ -257,7 +257,7 @@ class Xml_Node
|
||||
*/
|
||||
class Xml_document extends Xml_Node
|
||||
{
|
||||
var $currentNode;
|
||||
public $currentNode;
|
||||
|
||||
/**
|
||||
* Function Xml_document
|
||||
@@ -266,7 +266,7 @@ class Xml_document extends Xml_Node
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
function Xml_document ()
|
||||
public function Xml_document ()
|
||||
{
|
||||
$this->currentNode = &$this;
|
||||
}
|
||||
@@ -280,7 +280,7 @@ class Xml_document extends Xml_Node
|
||||
* @param eter string content
|
||||
* @return string
|
||||
*/
|
||||
function parseXmlFile ($filename, $content = "")
|
||||
public function parseXmlFile ($filename, $content = "")
|
||||
{ //$content is a new variable, if it has any value then use it instead of the file content.
|
||||
if ($content == "") {
|
||||
if (! file_exists( $filename )) {
|
||||
@@ -333,7 +333,7 @@ class Xml_document extends Xml_Node
|
||||
* @param eter string xpath
|
||||
* @return string
|
||||
*/
|
||||
function &findNode ($xpath)
|
||||
public function &findNode ($xpath)
|
||||
{
|
||||
if (substr( $xpath, 0, 1 ) == '/') {
|
||||
return parent::findNode( substr( $xpath, 1 ) );
|
||||
@@ -357,7 +357,7 @@ class Xml_document extends Xml_Node
|
||||
* @access public
|
||||
* @return string $xml
|
||||
*/
|
||||
function getXML ()
|
||||
public function getXML ()
|
||||
{
|
||||
$xml = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
|
||||
$xml .= $this->children[0]->getXML();
|
||||
@@ -370,7 +370,7 @@ class Xml_document extends Xml_Node
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function save ($filename)
|
||||
public function save ($filename)
|
||||
{
|
||||
$xml = $this->getXML();
|
||||
$fp = fopen( $filename, 'w' );
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* class.dates.php
|
||||
*
|
||||
@@ -30,7 +31,6 @@
|
||||
*
|
||||
* @author David Callizaya <davidsantos@colosa.com>
|
||||
*/
|
||||
|
||||
require_once ("classes/model/TaskPeer.php");
|
||||
require_once ("classes/model/HolidayPeer.php");
|
||||
|
||||
@@ -40,6 +40,7 @@ require_once ("classes/model/HolidayPeer.php");
|
||||
*/
|
||||
class dates
|
||||
{
|
||||
|
||||
private $holidays = array();
|
||||
private $weekends = array();
|
||||
private $range = array();
|
||||
@@ -47,7 +48,6 @@ class dates
|
||||
private $calendarDays = false; //by default we are using working days
|
||||
private $hoursPerDay = 8; //you should change this
|
||||
|
||||
|
||||
/**
|
||||
* Function that calculate a final date based on $sInitDate and $iDuration
|
||||
* This function also uses a Calendar component (class.calendar.php) where all the definition of
|
||||
@@ -70,7 +70,7 @@ class dates
|
||||
*
|
||||
*
|
||||
*/
|
||||
function calculateDate ($sInitDate, $iDuration, $sTimeUnit, $iTypeDay, $UsrUid = NULL, $ProUid = NULL, $TasUid = NULL)
|
||||
public function calculateDate($sInitDate, $iDuration, $sTimeUnit, $iTypeDay, $UsrUid = null, $ProUid = null, $TasUid = null)
|
||||
{
|
||||
//$oldDate=$this->calculateDate_noCalendar( $sInitDate, $iDuration, $sTimeUnit, $iTypeDay, $UsrUid, $ProUid, $TasUid);
|
||||
//Set Calendar when the object is instanced in this order/priority (Task, User, Process, Default)
|
||||
@@ -175,8 +175,7 @@ class dates
|
||||
* @return integer timestamp of the result
|
||||
* @deprecated renamed by Hugo Loza (see calculateDate new function)
|
||||
*/
|
||||
|
||||
function calculateDate_noCalendar ($sInitDate, $iDuration, $sTimeUnit, $iTypeDay, $UsrUid = NULL, $ProUid = NULL, $TasUid = NULL)
|
||||
public function calculateDate_noCalendar($sInitDate, $iDuration, $sTimeUnit, $iTypeDay, $UsrUid = null, $ProUid = null, $TasUid = null)
|
||||
{
|
||||
//load in class variables the config of working days, holidays etc..
|
||||
$this->prepareInformation($UsrUid, $ProUid, $TasUid);
|
||||
@@ -195,12 +194,14 @@ class dates
|
||||
}
|
||||
$addSign = ($iDuration >= 0) ? '+' : '-';
|
||||
$iInitDate = strtotime($sInitDate);
|
||||
if ($iTypeDay == 1) { // working days
|
||||
if ($iTypeDay == 1) {
|
||||
// working days
|
||||
// if there are days calculate the days,
|
||||
$iEndDate = $this->addDays($iInitDate, $iDays, $addSign);
|
||||
// if there are hours calculate the hours, and probably add a day if the quantity of hours for last day > 8 hours
|
||||
$iEndDate = $this->addHours($iEndDate, $iHours, $addSign);
|
||||
} else { // $task->getTasTypeDay() == 2 // calendar days
|
||||
} else {
|
||||
// $task->getTasTypeDay() == 2 // calendar days
|
||||
$iEndDate = strtotime($addSign . $iDays . ' days ', $iInitDate);
|
||||
$iEndDate = strtotime($addSign . $iHours . ' hours ', $iEndDate);
|
||||
}
|
||||
@@ -218,7 +219,7 @@ class dates
|
||||
* @return int
|
||||
*
|
||||
*/
|
||||
function calculateDuration ($sInitDate, $sEndDate = '', $UsrUid = NULL, $ProUid = NULL, $TasUid = NULL)
|
||||
public function calculateDuration($sInitDate, $sEndDate = '', $UsrUid = null, $ProUid = null, $TasUid = null)
|
||||
{
|
||||
$this->prepareInformation($UsrUid, $ProUid, $TasUid);
|
||||
if ((string) $sEndDate == '') {
|
||||
@@ -239,12 +240,10 @@ class dates
|
||||
$fHours1 = 0.0;
|
||||
$fHours2 = 0.0;
|
||||
if (count($aInitDate) != 3) {
|
||||
$aInitDate = array (0,0,0
|
||||
);
|
||||
$aInitDate = array(0, 0, 0);
|
||||
}
|
||||
if (count($aEndDate) != 3) {
|
||||
$aEndDate = array (0,0,0
|
||||
);
|
||||
$aEndDate = array(0, 0, 0);
|
||||
}
|
||||
if ($aInitDate !== $aEndDate) {
|
||||
while (!$bFinished && ($i < 10000)) {
|
||||
@@ -283,7 +282,7 @@ class dates
|
||||
* @param string $TasUid
|
||||
* @return void
|
||||
*/
|
||||
function prepareInformation ($UsrUid = NULL, $ProUid = NULL, $TasUid = NULL)
|
||||
public function prepareInformation($UsrUid = null, $ProUid = null, $TasUid = null)
|
||||
{
|
||||
// setup calendarDays according the task
|
||||
if (isset($TasUid)) {
|
||||
@@ -296,12 +295,12 @@ class dates
|
||||
//get an array with all holidays.
|
||||
$aoHolidays = HolidayPeer::doSelect(new Criteria());
|
||||
$holidays = array();
|
||||
foreach ($aoHolidays as $holiday)
|
||||
foreach ($aoHolidays as $holiday) {
|
||||
$holidays[] = strtotime($holiday->getHldDate());
|
||||
}
|
||||
|
||||
// by default the weekdays are from monday to friday
|
||||
$this->weekends = array (0,6
|
||||
);
|
||||
$this->weekends = array(0, 6);
|
||||
$this->holidays = $holidays;
|
||||
return;
|
||||
}
|
||||
@@ -312,7 +311,7 @@ class dates
|
||||
* @param $bSkipEveryYear
|
||||
* @return void
|
||||
*/
|
||||
function setSkipEveryYear ($bSkipEveryYear)
|
||||
public function setSkipEveryYear($bSkipEveryYear)
|
||||
{
|
||||
$this->skipEveryYear = $bSkipEveryYear === true;
|
||||
}
|
||||
@@ -323,13 +322,14 @@ class dates
|
||||
* @param data $sDate
|
||||
* @return void
|
||||
*/
|
||||
function addHoliday ($sDate)
|
||||
public function addHoliday($sDate)
|
||||
{
|
||||
if ($date = strtotime( $sDate ))
|
||||
if ($date = strtotime($sDate)) {
|
||||
$this->holidays[] = self::truncateTime($date);
|
||||
else
|
||||
} else {
|
||||
throw new Exception("Invalid date: $sDate.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set all the holidays
|
||||
@@ -337,11 +337,12 @@ class dates
|
||||
* @param date/array $aDate must be an array of (strtotime type) dates
|
||||
* @return void
|
||||
*/
|
||||
function setHolidays ($aDates)
|
||||
public function setHolidays($aDates)
|
||||
{
|
||||
foreach ($aDates as $sDate)
|
||||
foreach ($aDates as $sDate) {
|
||||
$this->holidays = $aDates;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set all the weekends
|
||||
@@ -351,7 +352,7 @@ class dates
|
||||
* 7=Saturday
|
||||
* @return void
|
||||
*/
|
||||
function setWeekends ($aWeekends)
|
||||
public function setWeekends($aWeekends)
|
||||
{
|
||||
$this->weekends = $aWeekends;
|
||||
}
|
||||
@@ -364,10 +365,11 @@ class dates
|
||||
* 7=Saturday
|
||||
* @return void
|
||||
*/
|
||||
function skipDayOfWeek ($iDayNumber)
|
||||
public function skipDayOfWeek($iDayNumber)
|
||||
{
|
||||
if ($iDayNumber < 1 || $iDayNumber > 7)
|
||||
if ($iDayNumber < 1 || $iDayNumber > 7) {
|
||||
throw new Exception("The day of week must be a number from 1 to 7.");
|
||||
}
|
||||
$this->weekends[] = $iDayNumber;
|
||||
}
|
||||
|
||||
@@ -378,24 +380,24 @@ class dates
|
||||
* @param date $sDateB must be a (strtotime type) dates
|
||||
* @return void
|
||||
*/
|
||||
function addNonWorkingRange ($sDateA, $sDateB)
|
||||
public function addNonWorkingRange($sDateA, $sDateB)
|
||||
{
|
||||
if ($date = strtotime( $sDateA ))
|
||||
if ($date = strtotime($sDateA)) {
|
||||
$iDateA = self::truncateTime($date);
|
||||
else
|
||||
} else {
|
||||
throw new Exception("Invalid date: $sDateA.");
|
||||
if ($date = strtotime( $sDateB ))
|
||||
}
|
||||
if ($date = strtotime($sDateB)) {
|
||||
$iDateB = self::truncateTime($date);
|
||||
else
|
||||
} else {
|
||||
throw new Exception("Invalid date: $sDateB.");
|
||||
}
|
||||
if ($iDateA > $iDateB) {
|
||||
$s = $iDateA;
|
||||
$iDateA = $iDateB;
|
||||
$iDateB = $s;
|
||||
}
|
||||
;
|
||||
$this->range[] = array ($iDateA,$iDateB
|
||||
);
|
||||
$this->range[] = array($iDateA, $iDateB);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -414,9 +416,10 @@ class dates
|
||||
for ($r = 1; $r <= $iDaysCount; $r++) {
|
||||
$iEndDate = strtotime($addSign . "1 day", $iEndDate);
|
||||
$dayOfWeek = idate('w', $iEndDate); //now sunday=0
|
||||
if (array_search( $dayOfWeek, $this->weekends ) !== false)
|
||||
if (array_search($dayOfWeek, $this->weekends) !== false) {
|
||||
$r--; //continue loop, but we are adding one more day.
|
||||
}
|
||||
}
|
||||
return $iEndDate;
|
||||
}
|
||||
|
||||
@@ -428,7 +431,6 @@ class dates
|
||||
* @param string $addSign
|
||||
* @return $iEndDate
|
||||
*/
|
||||
|
||||
private function addHours($sInitDate, $iHoursCount, $addSign = '+')
|
||||
{
|
||||
$iEndDate = strtotime($addSign . $iHoursCount . " hours", $sInitDate);
|
||||
@@ -451,9 +453,10 @@ class dates
|
||||
$rang[0] = self::changeYear($rang[0], $iYear);
|
||||
$rang[1] = self::changeYear($rang[1], $iYear + $deltaYears);
|
||||
}
|
||||
if (($iDate >= $rang[0]) && ($iDate <= $rang[1]))
|
||||
if (($iDate >= $rang[0]) && ($iDate <= $rang[1])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -476,8 +479,7 @@ class dates
|
||||
*/
|
||||
private function getTime($iDate)
|
||||
{
|
||||
return array (idate( 'H', $iDate ),idate( 'm', $iDate ),idate( 's', $iDate )
|
||||
);
|
||||
return array(idate('H', $iDate), idate('m', $iDate), idate('s', $iDate));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -528,4 +530,4 @@ class dates
|
||||
return $iDate;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
try {
|
||||
$form = $_POST['form'];
|
||||
$FolderUid = $form['FOLDER_UID'];
|
||||
@@ -24,8 +25,7 @@
|
||||
if ($tr->validate()) {
|
||||
// we save it, since we get no validation errors, or do whatever else you like.
|
||||
$res = $tr->save();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// Something went wrong. We can now get the validationFailures and handle them.
|
||||
$msg = '';
|
||||
$validationFailuresArray = $tr->getValidationFailures();
|
||||
@@ -35,16 +35,12 @@
|
||||
//return array ( 'codError' => -100, 'rowsAffected' => 0, 'message' => $msg );
|
||||
}
|
||||
//return array ( 'codError' => 0, 'rowsAffected' => $res, 'message' => '');
|
||||
|
||||
//to do: uniform coderror structures for all classes
|
||||
|
||||
//if ( $res['codError'] < 0 ) {
|
||||
// G::SendMessageText ( $res['message'] , 'error' );
|
||||
//}
|
||||
G::Header('location: appFolderList');
|
||||
|
||||
}
|
||||
catch ( Exception $e ) {
|
||||
} catch (Exception $e) {
|
||||
$G_PUBLISH = new Publisher;
|
||||
$aMessage['MESSAGE'] = $e->getMessage();
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage);
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
* @author Erik Amaru Ortiz <erik@colosa.com>
|
||||
* @date Jan 3th, 2010
|
||||
*/
|
||||
|
||||
//require_once 'classes/model/Application.php';
|
||||
//require_once 'classes/model/Users.php';
|
||||
//require_once 'classes/model/AppThread.php';
|
||||
@@ -462,7 +461,6 @@ class Ajax
|
||||
$result->data = $case->getUsersToReassign($_SESSION['TASK'], $_SESSION['USER_LOGGED']);
|
||||
|
||||
print G::json_encode($result);
|
||||
|
||||
}
|
||||
|
||||
public function reassignCase()
|
||||
@@ -603,8 +601,6 @@ class Ajax
|
||||
//!dataInput
|
||||
$idHistory = $_REQUEST["idHistory"];
|
||||
//!dataInput
|
||||
|
||||
|
||||
//!dataSytem
|
||||
$idHistoryArray = explode("_", $idHistory);
|
||||
$_REQUEST["PRO_UID"] = $idHistoryArray[0];
|
||||
@@ -732,11 +728,11 @@ class Ajax
|
||||
showDynaformHistoryGlobal.idHistory = idHistory;
|
||||
showDynaformHistoryGlobal.dynDate = dynDate;
|
||||
|
||||
var url = "caseHistory_Ajax.php?actionAjax=showDynaformHistoryGetNomDynaform_JXP&idDin="+idDin+"&dynDate="+dynDate;ajaxPostRequest(url, 'showDynaformHistoryGetNomDynaform_RSP');
|
||||
var url = "caseHistory_Ajax.php?actionAjax=showDynaformHistoryGetNomDynaform_JXP&idDin=" + idDin + "&dynDate=" + dynDate;
|
||||
ajaxPostRequest(url, 'showDynaformHistoryGetNomDynaform_RSP');
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
|
||||
G::RenderPage('publish', 'raw');
|
||||
|
||||
$result->success = true;
|
||||
@@ -761,7 +757,8 @@ class Ajax
|
||||
leimnud.browser = {};
|
||||
leimnud.browser.isIphone = "";
|
||||
leimnud.iphone = {};
|
||||
leimnud.iphone.make = function () {};
|
||||
leimnud.iphone.make = function() {
|
||||
};
|
||||
function ajax_function(ajax_server, funcion, parameters, method)
|
||||
{
|
||||
}
|
||||
@@ -840,3 +837,4 @@ $action = $_REQUEST['action'];
|
||||
unset($_REQUEST['action']);
|
||||
|
||||
$ajax->$action($_REQUEST);
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* processes/ajaxListener.php Ajax Listener for Cases rpc requests
|
||||
*
|
||||
@@ -21,13 +22,11 @@
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Erik Amaru Ortiz <erik@colosa.com>
|
||||
* @date Jan 10th, 2010
|
||||
*/
|
||||
|
||||
$action = $_REQUEST['action'];
|
||||
unset($_REQUEST['action']);
|
||||
|
||||
@@ -37,37 +36,34 @@ $ajax->$action( $_REQUEST );
|
||||
class Ajax
|
||||
{
|
||||
|
||||
function categoriesList ()
|
||||
public function categoriesList()
|
||||
{
|
||||
require_once "classes/model/ProcessCategory.php";
|
||||
|
||||
$processCategory = new ProcessCategory();
|
||||
$defaultOption = Array();
|
||||
$defaultOption[] = Array ('CATEGORY_UID' => '<reset>','CATEGORY_NAME' => G::LoadTranslation( 'ID_ALL' )
|
||||
);
|
||||
$defaultOption[] = Array ('CATEGORY_UID' => '','CATEGORY_NAME' => G::LoadTranslation( 'ID_PROCESS_NO_CATEGORY' )
|
||||
);
|
||||
$defaultOption[] = Array('CATEGORY_UID' => '<reset>', 'CATEGORY_NAME' => G::LoadTranslation('ID_ALL'));
|
||||
$defaultOption[] = Array('CATEGORY_UID' => '', 'CATEGORY_NAME' => G::LoadTranslation('ID_PROCESS_NO_CATEGORY'));
|
||||
|
||||
$response->rows = array_merge($defaultOption, $processCategory->getAll('array'));
|
||||
|
||||
echo G::json_encode($response);
|
||||
}
|
||||
|
||||
function processCategories ()
|
||||
public function processCategories()
|
||||
{
|
||||
require_once "classes/model/ProcessCategory.php";
|
||||
|
||||
$processCategory = new ProcessCategory();
|
||||
$defaultOption = Array();
|
||||
$defaultOption[] = Array ('CATEGORY_UID' => '','CATEGORY_NAME' => G::LoadTranslation( 'ID_PROCESS_NO_CATEGORY' )
|
||||
);
|
||||
$defaultOption[] = Array('CATEGORY_UID' => '', 'CATEGORY_NAME' => G::LoadTranslation('ID_PROCESS_NO_CATEGORY'));
|
||||
|
||||
$response->rows = array_merge($defaultOption, $processCategory->getAll('array'));
|
||||
|
||||
echo G::json_encode($response);
|
||||
}
|
||||
|
||||
function saveProcess ()
|
||||
public function saveProcess()
|
||||
{
|
||||
try {
|
||||
require_once 'classes/model/Task.php';
|
||||
@@ -77,8 +73,10 @@ class Ajax
|
||||
if (!isset($_POST['PRO_UID'])) {
|
||||
|
||||
if (Process::existsByProTitle($_POST['PRO_TITLE'])) {
|
||||
$result = array ('success' => false,'msg' => 'Process Save Error','errors' => array ('PRO_TITLE' => G::LoadTranslation( 'ID_PROCESSTITLE_ALREADY_EXISTS', SYS_LANG, $_POST )
|
||||
)
|
||||
$result = array(
|
||||
'success' => false,
|
||||
'msg' => 'Process Save Error',
|
||||
'errors' => array('PRO_TITLE' => G::LoadTranslation('ID_PROCESSTITLE_ALREADY_EXISTS', SYS_LANG, $_POST))
|
||||
);
|
||||
print G::json_encode($result);
|
||||
exit(0);
|
||||
@@ -98,7 +96,6 @@ class Ajax
|
||||
|
||||
$oPluginRegistry = & PMPluginRegistry::getSingleton();
|
||||
$oPluginRegistry->executeTriggers(PM_NEW_PROCESS_SAVE, $oData);
|
||||
|
||||
} else {
|
||||
//$oProcessMap->updateProcess($_POST['form']);
|
||||
$sProUid = $_POST['PRO_UID'];
|
||||
@@ -122,31 +119,33 @@ class Ajax
|
||||
print G::json_encode($result);
|
||||
}
|
||||
|
||||
function changeStatus ()
|
||||
public function changeStatus()
|
||||
{
|
||||
$ids = explode(',', $_REQUEST['UIDS']);
|
||||
|
||||
G::LoadClass('processes');
|
||||
$oProcess = new Processes();
|
||||
if (count($ids) > 0) {
|
||||
foreach ($ids as $id)
|
||||
foreach ($ids as $id) {
|
||||
$oProcess->changeStatus($id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function changeDebugMode ()
|
||||
public function changeDebugMode()
|
||||
{
|
||||
$ids = explode(',', $_REQUEST['UIDS']);
|
||||
|
||||
G::LoadClass('processes');
|
||||
$oProcess = new Processes();
|
||||
if (count($ids) > 0) {
|
||||
foreach ($ids as $id)
|
||||
foreach ($ids as $id) {
|
||||
$oProcess->changeDebugMode($id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getUsers ($params)
|
||||
public function getUsers($params)
|
||||
{
|
||||
require_once 'classes/model/Users.php';
|
||||
G::LoadClass('configuration');
|
||||
@@ -156,13 +155,12 @@ class Ajax
|
||||
$users = Users::getAll($params['start'], $params['limit'], $search);
|
||||
|
||||
foreach ($users->data as $i => $user) {
|
||||
$users->data[$i]['USER'] = $conf->getEnvSetting( 'format', Array ('userName' => $user['USR_USERNAME'],'firstName' => $user['USR_FIRSTNAME'],'lastName' => $user['USR_LASTNAME']
|
||||
) );
|
||||
$users->data[$i]['USER'] = $conf->getEnvSetting('format', Array('userName' => $user['USR_USERNAME'], 'firstName' => $user['USR_FIRSTNAME'], 'lastName' => $user['USR_LASTNAME']));
|
||||
}
|
||||
print G::json_encode($users);
|
||||
}
|
||||
|
||||
function getGroups ($params)
|
||||
public function getGroups($params)
|
||||
{
|
||||
require_once 'classes/model/Groupwf.php';
|
||||
$search = isset($params['search']) ? $params['search'] : null;
|
||||
@@ -171,7 +169,7 @@ class Ajax
|
||||
print G::json_encode($groups);
|
||||
}
|
||||
|
||||
function assignUsersTask ($param)
|
||||
public function assignUsersTask($param)
|
||||
{
|
||||
try {
|
||||
require_once 'classes/model/TaskUser.php';
|
||||
@@ -181,22 +179,20 @@ class Ajax
|
||||
$TU_TYPE = 1;
|
||||
|
||||
foreach ($UIDS as $UID) {
|
||||
if ($_POST['TU_RELATION'] == 1)
|
||||
$oTaskUser->create( array ('TAS_UID' => $param['TAS_UID'],'USR_UID' => $UID,'TU_TYPE' => $TU_TYPE,'TU_RELATION' => 1
|
||||
) );
|
||||
else
|
||||
$oTaskUser->create( array ('TAS_UID' => $param['TAS_UID'],'USR_UID' => $UID,'TU_TYPE' => $TU_TYPE,'TU_RELATION' => 2
|
||||
) );
|
||||
if ($_POST['TU_RELATION'] == 1) {
|
||||
$oTaskUser->create(array('TAS_UID' => $param['TAS_UID'], 'USR_UID' => $UID, 'TU_TYPE' => $TU_TYPE, 'TU_RELATION' => 1));
|
||||
} else {
|
||||
$oTaskUser->create(array('TAS_UID' => $param['TAS_UID'], 'USR_UID' => $UID, 'TU_TYPE' => $TU_TYPE, 'TU_RELATION' => 2));
|
||||
}
|
||||
}
|
||||
$task = TaskPeer::retrieveByPk($param['TAS_UID']);
|
||||
|
||||
$result->success = true;
|
||||
if (count( $UIDS ) > 1)
|
||||
$result->msg = __( 'ID_ACTORS_ASSIGNED_SUCESSFULLY', SYS_LANG, Array (count( $UIDS ),$task->getTasTitle()
|
||||
) );
|
||||
else
|
||||
$result->msg = __( 'ID_ACTOR_ASSIGNED_SUCESSFULLY', SYS_LANG, Array ('tas_title' => $task->getTasTitle()
|
||||
) );
|
||||
if (count($UIDS) > 1) {
|
||||
$result->msg = __('ID_ACTORS_ASSIGNED_SUCESSFULLY', SYS_LANG, Array(count($UIDS), $task->getTasTitle()));
|
||||
} else {
|
||||
$result->msg = __('ID_ACTOR_ASSIGNED_SUCESSFULLY', SYS_LANG, Array('tas_title' => $task->getTasTitle()));
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$result->success = false;
|
||||
$result->msg = $e->getMessage();
|
||||
@@ -205,7 +201,7 @@ class Ajax
|
||||
print G::json_encode($result);
|
||||
}
|
||||
|
||||
function removeUsersTask ($param)
|
||||
public function removeUsersTask($param)
|
||||
{
|
||||
try {
|
||||
require_once 'classes/model/TaskUser.php';
|
||||
@@ -218,7 +214,6 @@ class Ajax
|
||||
if ($TU_RELATIONS[$i] == 1) {
|
||||
|
||||
$oTaskUser->remove($param['TAS_UID'], $USR_UID, $TU_TYPE, 1);
|
||||
|
||||
} else {
|
||||
$oTaskUser->remove($param['TAS_UID'], $USR_UID, $TU_TYPE, 2);
|
||||
}
|
||||
@@ -234,7 +229,7 @@ class Ajax
|
||||
print G::json_encode($result);
|
||||
}
|
||||
|
||||
function getUsersTask ($param)
|
||||
public function getUsersTask($param)
|
||||
{
|
||||
require_once 'classes/model/TaskUser.php';
|
||||
G::LoadClass('configuration');
|
||||
@@ -251,8 +246,9 @@ class Ajax
|
||||
$usersTaskListItem['USR_USERNAME'] = $userTask['USR_USERNAME'];
|
||||
$usersTaskListItem['USR_FIRSTNAME'] = $userTask['USR_FIRSTNAME'];
|
||||
$usersTaskListItem['USR_LASTNAME'] = $userTask['USR_LASTNAME'];
|
||||
} else
|
||||
} else {
|
||||
$usersTaskListItem['NAME'] = $userTask['GRP_TITLE'];
|
||||
}
|
||||
|
||||
$usersTaskListItem['TU_RELATION'] = $userTask['TU_RELATION'];
|
||||
$usersTaskListItem['USR_UID'] = $userTask['USR_UID'];
|
||||
@@ -266,7 +262,7 @@ class Ajax
|
||||
print G::json_encode($result);
|
||||
}
|
||||
|
||||
function getProcessDetail ($param)
|
||||
public function getProcessDetail($param)
|
||||
{
|
||||
require_once 'classes/model/Process.php';
|
||||
|
||||
@@ -300,7 +296,7 @@ class Ajax
|
||||
print G::json_encode($treeDetail);
|
||||
}
|
||||
|
||||
function getProperties ($param)
|
||||
public function getProperties($param)
|
||||
{
|
||||
switch ($param['type']) {
|
||||
case 'process':
|
||||
@@ -324,7 +320,6 @@ class Ajax
|
||||
$result->sucess = true;
|
||||
$result->prop = $properties;
|
||||
break;
|
||||
|
||||
case 'task':
|
||||
require_once 'classes/model/Task.php';
|
||||
$task = new Task();
|
||||
@@ -344,7 +339,7 @@ class Ajax
|
||||
print G::json_encode($result);
|
||||
}
|
||||
|
||||
function saveProperties ($param)
|
||||
public function saveProperties($param)
|
||||
{
|
||||
try {
|
||||
$result->sucess = true;
|
||||
@@ -389,7 +384,6 @@ class Ajax
|
||||
$oProcessMap->updateProcess($process);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'task':
|
||||
require_once 'classes/model/Task.php';
|
||||
$oTask = new Task();
|
||||
@@ -424,34 +418,32 @@ class Ajax
|
||||
print G::json_encode($result);
|
||||
}
|
||||
|
||||
function getCategoriesList ()
|
||||
public function getCategoriesList()
|
||||
{
|
||||
require_once "classes/model/ProcessCategory.php";
|
||||
|
||||
$processCategory = new ProcessCategory();
|
||||
$defaultOption = Array();
|
||||
$defaultOption[] = Array ('CATEGORY_UID' => '','CATEGORY_NAME' => ''
|
||||
);
|
||||
$defaultOption[] = Array('CATEGORY_UID' => '', 'CATEGORY_NAME' => '');
|
||||
|
||||
$response->rows = array_merge($defaultOption, $processCategory->getAll('array'));
|
||||
|
||||
print G::json_encode($response);
|
||||
}
|
||||
|
||||
function getCaledarList ()
|
||||
public function getCaledarList()
|
||||
{
|
||||
G::LoadClass('calendar');
|
||||
$calendar = new CalendarDefinition();
|
||||
$calendarObj = $calendar->getCalendarList(true, true);
|
||||
$calendarObj['array'][0] = Array ('CALENDAR_UID' => '','CALENDAR_NAME' => ''
|
||||
);
|
||||
$calendarObj['array'][0] = Array('CALENDAR_UID' => '', 'CALENDAR_NAME' => '');
|
||||
|
||||
$response->rows = $calendarObj['array'];
|
||||
|
||||
print G::json_encode($response);
|
||||
}
|
||||
|
||||
function getPMVariables ($param)
|
||||
public function getPMVariables($param)
|
||||
{
|
||||
G::LoadClass('processMap');
|
||||
$oProcessMap = new processMap(new DBConnection());
|
||||
@@ -461,7 +453,5 @@ class Ajax
|
||||
}
|
||||
print G::json_encode($response);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* tools/ajaxListener.php Ajax Listener for Cases rpc requests
|
||||
*
|
||||
@@ -21,13 +22,11 @@
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Erik Amaru Ortiz <erik@colosa.com>
|
||||
* @date Jan 10th, 2010
|
||||
*/
|
||||
|
||||
require "classes/model/Translation.php";
|
||||
|
||||
$action = $_REQUEST['action'];
|
||||
@@ -38,7 +37,7 @@ $ajax->$action( $_REQUEST );
|
||||
class Ajax
|
||||
{
|
||||
|
||||
function getList ($params)
|
||||
public function getList($params)
|
||||
{
|
||||
$search = isset($params['search']) ? $params['search'] : null;
|
||||
$params['dateFrom'] = str_replace('T00:00:00', '', $params['dateFrom']);
|
||||
@@ -54,7 +53,7 @@ class Ajax
|
||||
echo G::json_encode($result);
|
||||
}
|
||||
|
||||
function save ()
|
||||
public function save()
|
||||
{
|
||||
try {
|
||||
require_once ("classes/model/Translation.php");
|
||||
@@ -69,7 +68,6 @@ class Ajax
|
||||
$result->success = true;
|
||||
$result->msg = 'Label ' . $id . ' saved Successfully!';
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
$result->success = false;
|
||||
$result->msg = $e->getMessage();
|
||||
@@ -77,7 +75,7 @@ class Ajax
|
||||
print G::json_encode($result);
|
||||
}
|
||||
|
||||
function delete ()
|
||||
public function delete()
|
||||
{
|
||||
require_once ("classes/model/Translation.php");
|
||||
$ids = explode(',', $_POST['IDS']);
|
||||
@@ -93,7 +91,6 @@ class Ajax
|
||||
|
||||
$result->success = true;
|
||||
$result->msg = 'Deleted Successfully!';
|
||||
|
||||
} catch (Exception $e) {
|
||||
$result->success = false;
|
||||
$result->msg = $e->getMessage();
|
||||
@@ -101,14 +98,13 @@ class Ajax
|
||||
print G::json_encode($result);
|
||||
}
|
||||
|
||||
function rebuild ()
|
||||
public function rebuild()
|
||||
{
|
||||
try {
|
||||
require_once ("classes/model/Translation.php");
|
||||
$t = new Translation();
|
||||
$result = Translation::generateFileTranslation('en');
|
||||
$result['success'] = true;
|
||||
|
||||
} catch (Exception $e) {
|
||||
$result->success = false;
|
||||
$result->msg = $e->getMessage();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* triggers_WizardSave.php
|
||||
*
|
||||
@@ -21,7 +22,6 @@
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*/
|
||||
|
||||
if (($RBAC_Response = $RBAC->userCanAccess("PM_FACTORY")) != 1) {
|
||||
return $RBAC_Response;
|
||||
}
|
||||
@@ -84,13 +84,11 @@ foreach ($aInfoFunction as $k => $v) {
|
||||
$option = (is_numeric($aDataTriggers[$sOptionTrigger]) || is_bool($aDataTriggers[$sOptionTrigger]) ) ? trim($aDataTriggers[$sOptionTrigger]) : (strstr($aDataTriggers[$sOptionTrigger], "array")) ? trim($aDataTriggers[$sOptionTrigger]) : "'" . trim($aDataTriggers[$sOptionTrigger]) . "'";
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
$option = "''";
|
||||
}
|
||||
$methodParamsFinal[] = $option;
|
||||
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* triggers_WizardUpdate.php
|
||||
*
|
||||
@@ -21,7 +22,6 @@
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*/
|
||||
|
||||
if (($RBAC_Response = $RBAC->userCanAccess("PM_FACTORY")) != 1) {
|
||||
return $RBAC_Response;
|
||||
}
|
||||
@@ -87,13 +87,11 @@ foreach ($aInfoFunction as $k => $v) {
|
||||
$option = (is_numeric($aDataTriggers[$sOptionTrigger]) || is_bool($aDataTriggers[$sOptionTrigger]) ) ? trim($aDataTriggers[$sOptionTrigger]) : (strstr($aDataTriggers[$sOptionTrigger], "array")) ? trim($aDataTriggers[$sOptionTrigger]) : "'" . trim($aDataTriggers[$sOptionTrigger]) . "'";
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
$option = "' '";
|
||||
}
|
||||
$methodParamsFinal[] = $option;
|
||||
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user