Fix code style CASESCHEDULER, FILESMANAGER, PROJECTUSER, ASSIGNEE, PMUSER

This commit is contained in:
Freddy Daniel Rojas Valda
2014-02-14 09:39:24 -04:00
parent 96e51f5e5b
commit e6a93a902a
7 changed files with 41 additions and 28 deletions

View File

@@ -464,7 +464,7 @@ class CaseScheduler
$sStartDay = date('Y-m-d');
} else {
$size = strlen($aData['SCH_START_DAY']);
if ( $size > 4 ) {
if ($size > 4) {
$aaStartDay = explode( "|", $aData['SCH_START_DAY'] );
$aaStartDay[0] = $aaStartDay[0];
$aaStartDay[1] = $aaStartDay[1];
@@ -754,7 +754,7 @@ class CaseScheduler
$sStartDay = date('Y-m-d');
} else {
$size = strlen($aData['SCH_START_DAY']);
if ( $size > 4 ) {
if ($size > 4) {
$aaStartDay = explode( "|", $aData['SCH_START_DAY'] );
$aaStartDay[0] = $aaStartDay[0];
$aaStartDay[1] = $aaStartDay[1];

View File

@@ -45,7 +45,7 @@ class FilesManager
{
try {
$sMainDirectory = current(explode("/", $path));
if(strstr($path,'/')){
if (strstr($path,'/')) {
$sSubDirectory = substr($path, strpos($path, "/")+1). PATH_SEP ;
} else {
$sSubDirectory = '';
@@ -82,8 +82,7 @@ class FilesManager
}
foreach ($aFiles as $aFile) {
$extention = end(explode(".", $aFile['FILE']));
if ($extention == 'docx' || $extention == 'doc' || $extention == 'html' || $extention == 'php' || $extention == 'jsp' ||
$extention == 'xlsx' || $extention == 'xls' || $extention == 'js' || $extention == 'css' || $extention == 'txt') {
if ($extention == 'docx' || $extention == 'doc' || $extention == 'html' || $extention == 'php' || $extention == 'jsp' || $extention == 'xlsx' || $extention == 'xls' || $extention == 'js' || $extention == 'css' || $extention == 'txt') {
$sEditable = true;
} else {
$sEditable = false;
@@ -118,7 +117,7 @@ class FilesManager
if ($sMainDirectory != 'public' && $sMainDirectory != 'templates') {
throw (new \Exception( 'invalid value specified for `prf_path`. Expecting `templates/` or `public/`'));
}
if(strstr($aData['path'],'/')){
if (strstr($aData['path'],'/')) {
$sSubDirectory = substr($aData['path'], strpos($aData['path'], "/")+1) ;
} else {
$sSubDirectory = '';
@@ -136,7 +135,7 @@ class FilesManager
default:
$sDirectory = PATH_DATA_MAILTEMPLATES . $sProcessUID . PATH_SEP . $sSubDirectory . $aData['file_name'];
break;
}
}
$extention = end(explode(".", $aData['file_name']));
if ($extention == 'docx' || $extention == 'doc' || $extention == 'html' || $extention == 'php' || $extention == 'jsp' ||
$extention == 'xlsx' || $extention == 'xls' || $extention == 'js' || $extention == 'css' || $extention == 'txt') {
@@ -238,7 +237,7 @@ class FilesManager
if ($sMainDirectory != 'public' && $sMainDirectory != 'templates') {
throw (new \Exception( 'invalid value specified for `prf_path`. Expecting `templates/` or `public/`'));
}
if(strstr($path,'/')){
if (strstr($path,'/')) {
$sSubDirectory = substr($path, strpos($path, "/")+1) ;
} else {
$sSubDirectory = '';
@@ -254,9 +253,9 @@ class FilesManager
default:
$sDirectory = PATH_DATA_MAILTEMPLATES . $sProcessUID . PATH_SEP . $aData['file_name'];
break;
}
}
$arrayTaskUid = $this->getFileManagerUid($sDirectory);
if (!$arrayTaskUid){
if (!$arrayTaskUid) {
throw (new \Exception( 'invalid value specified for `path`.'));
}
$extention = end(explode(".", $aData['file_name']));
@@ -317,7 +316,7 @@ class FilesManager
}
$sfile = end(explode("/",$path));
$sSubDirectorytemp = substr($path, strpos($path, "/")+1);
if(strstr($sSubDirectorytemp,'/')){
if (strstr($sSubDirectorytemp,'/')) {
$sSubDirectory = str_replace('/'.$sfile,"",$sSubDirectorytemp);
$sSubDirectoryCheck = str_replace($sfile,"",$sSubDirectorytemp);
} else {
@@ -335,7 +334,7 @@ class FilesManager
default:
$sDirectory = PATH_DATA_MAILTEMPLATES . $sProcessUID . PATH_SEP . $sfile;
break;
}
}
$arrayTaskUid = $this->getFileManagerUid($sDirectory);
if (!$arrayTaskUid){
throw (new \Exception( 'invalid value specified for `path`.'));
@@ -373,7 +372,7 @@ class FilesManager
}
$sfile = end(explode("/",$path));
$sSubDirectorytemp = substr($path, strpos($path, "/")+1);
if(strstr($sSubDirectorytemp,'/')){
if (strstr($sSubDirectorytemp,'/')) {
$sSubDirectory = str_replace('/'.$sfile,"",$sSubDirectorytemp);
$sSubDirectoryCheck = str_replace($sfile,"",$sSubDirectorytemp);
} else {
@@ -391,9 +390,9 @@ class FilesManager
default:
$sDirectory = PATH_DATA_MAILTEMPLATES . $sProcessUID . PATH_SEP . $sfile;
break;
}
}
$arrayTaskUid = $this->getFileManagerUid($sDirectory);
if (!$arrayTaskUid){
if (!$arrayTaskUid) {
throw (new \Exception( 'invalid value specified for `path`.'));
}
/*

View File

@@ -81,10 +81,11 @@ class ProjectUser
$exclude = array("");
for ($i = 0; $i<=count($aUsers)-1; $i++) {
if (!in_array(trim($aUsers[$i]["usr_uid"]) ,$exclude)) {
$aUsersGroups[] = $aUsers[$i]; $exclude[] = trim($aUsers[$i]["usr_uid"]);
$aUsersGroups[] = $aUsers[$i];
$exclude[] = trim($aUsers[$i]["usr_uid"]);
}
}
return $aUsersGroups;
return $aUsersGroups;
} catch (Exception $e) {
throw $e;
}
@@ -177,7 +178,7 @@ class ProjectUser
\G::LoadClass( 'case' );
$oCase = new \Cases();
$startTasks = $oCase->getStartCases($sUserUID);
if (sizeof($startTasks) > 1){
if (sizeof($startTasks) > 1) {
foreach ($startTasks as $task) {
if ((isset( $task['pro_uid'] )) && ($task['pro_uid'] == $sProcessUID)) {
$taskValue = explode( '(', $task['value'] );

View File

@@ -1808,7 +1808,8 @@ class Task
*
* @return string
*/
public function validateProUid ($pro_uid) {
public function validateProUid ($pro_uid)
{
$pro_uid = trim($pro_uid);
if ($pro_uid == '') {
throw (new \Exception("The project with prj_uid: '', does not exist."));
@@ -1829,7 +1830,8 @@ class Task
*
* @return string
*/
public function validateActUid($act_uid) {
public function validateActUid($act_uid)
{
$act_uid = trim($act_uid);
if ($act_uid == '') {
throw (new \Exception("The activity with act_uid: '', does not exist."));

View File

@@ -12,7 +12,7 @@ class User
* return id
*/
public function createUser($aData)
{
{
require_once (PATH_RBAC_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "RbacUsers.php");
$this->userObj = new \RbacUsers();
if (class_exists('PMPluginRegistry')) {
@@ -196,7 +196,7 @@ class User
$this->aUserInfo[$sSystem]['PERMISSIONS'] = $fieldsPermissions;
return $fieldsPermissions;
}
/**
* Create User
*
@@ -294,7 +294,7 @@ class User
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$aRow = $oDataset->getRow();
if ($oDataset->getRow()){
if ($oDataset->getRow()) {
$aData['USR_ROLE'] = $form['USR_ROLE'];
} else {
throw new \Exception('`usr_role`. Invalid value for field.');
@@ -373,7 +373,7 @@ class User
}
}
if ($countPermission != 1) {
throw new \Exception('This user: '.$usrLoggedUid. ', can`t update the data.');
throw new \Exception('This user: '.$usrLoggedUid. ', can`t update the data.');
}
if (isset($usrUid)) {
$form['USR_UID'] = $usrUid;
@@ -489,7 +489,6 @@ class User
}
}
if ($form['USR_DUE_DATE'] != '') {
// throw new \Exception('`usr_due_date`. '.\G::LoadTranslation('ID_MSG_ERROR_DUE_DATE'));
$dueDate = explode("-", $form['USR_DUE_DATE']);
if (ctype_digit($dueDate[0])) {
if (checkdate($dueDate[1], $dueDate[2], $dueDate[0]) == false) {
@@ -512,7 +511,7 @@ class User
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$aRow = $oDataset->getRow();
if ($oDataset->getRow()){
if ($oDataset->getRow()) {
$aData['USR_ROLE'] = $form['USR_ROLE'];
} else {
throw new \Exception('`usr_role`. Invalid value for field.');

View File

@@ -61,11 +61,13 @@ class FilesManager extends Api
/**
* @param string $prjUid {@min 32} {@max 32}
*
* @header Accept: application/octet-stream
* @url POST /:prjUid/process-file-manager/upload
*/
public function doPostProcessFilesManagerUpload($prjUid)
{
try {
//echo $request_data; die();
$userUid = $this->getUserId();
$filesManager = new \BusinessModel\FilesManager();
$arrayData = $filesManager->uploadProcessFilesManager($prjUid, $userUid);
@@ -168,3 +170,11 @@ class ProcessFilesManagerStructurePut
public $content;
}
class ProcessFilesManagerStructureUpload
{
/**
* @var string {@from body}
*/
public $url;
}

View File

@@ -48,7 +48,8 @@ class User extends Api
*
* @status 201
*/
public function doPostUser($request_data) {
public function doPostUser($request_data)
{
try {
$user = new \BusinessModel\User();
$arrayData = $user->create($request_data);
@@ -66,7 +67,8 @@ class User extends Api
* @param string $usr_uid {@min 32}{@max 32}
* @param array $request_data
*/
public function doPutUser($usr_uid, $request_data) {
public function doPutUser($usr_uid, $request_data)
{
try {
$userLoggedUid = $this->getUserId();
$user = new \BusinessModel\User();