CODE STYLE class.groups.php
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* class.groups.php
|
||||
*
|
||||
* @package workflow.engine.ProcessMaker
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
@@ -29,6 +30,7 @@ require_once 'classes/model/Users.php';
|
||||
|
||||
/**
|
||||
* Groups - Groups class
|
||||
*
|
||||
* @package workflow.engine.ProcessMaker
|
||||
* @copyright 2007 COLOSA
|
||||
*/
|
||||
@@ -38,6 +40,7 @@ class Groups
|
||||
|
||||
/**
|
||||
* Get the assigned users of a group
|
||||
*
|
||||
* @param string $sGroupUID
|
||||
* @return array
|
||||
*/
|
||||
@@ -58,14 +61,14 @@ class Groups
|
||||
$oDataset->next();
|
||||
}
|
||||
return $aUsers;
|
||||
}
|
||||
catch (exception $oError) {
|
||||
} catch (exception $oError) {
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the active groups for an user
|
||||
*
|
||||
* @param string $sUserUID
|
||||
* @return array
|
||||
*/
|
||||
@@ -90,14 +93,14 @@ class Groups
|
||||
$aRow = $oDataset->getRow();
|
||||
}
|
||||
return $aGroups;
|
||||
}
|
||||
catch (exception $oError) {
|
||||
} catch (exception $oError) {
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a user to group
|
||||
*
|
||||
* @param string $GrpUid, $UsrUid
|
||||
* @return array
|
||||
*/
|
||||
@@ -113,8 +116,7 @@ class Groups
|
||||
$oGrp->setUsrUid( $UsrUid );
|
||||
$oGrp->Save();
|
||||
}
|
||||
}
|
||||
catch (exception $oError) {
|
||||
} catch (exception $oError) {
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
@@ -132,6 +134,7 @@ class Groups
|
||||
|
||||
/**
|
||||
* get all groups
|
||||
*
|
||||
* @param none
|
||||
* @return $objects
|
||||
*/
|
||||
@@ -143,13 +146,14 @@ class Groups
|
||||
$con = Propel::getConnection( GroupwfPeer::DATABASE_NAME );
|
||||
$objects = GroupwfPeer::doSelect( $criteria, $con );
|
||||
return $objects;
|
||||
}
|
||||
catch (exception $e) {
|
||||
} catch (exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get all the groups from a single user
|
||||
*
|
||||
* @param $sUserUid user uid
|
||||
* @return an array of group objects
|
||||
*/
|
||||
@@ -164,20 +168,21 @@ class Groups
|
||||
$con = Propel::getConnection( GroupwfPeer::DATABASE_NAME );
|
||||
$objects = GroupwfPeer::doSelect( $criteria, $con );
|
||||
return $objects;
|
||||
}
|
||||
catch (exception $e) {
|
||||
} catch (exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Available Groups for a single user
|
||||
*
|
||||
* @author Qennix
|
||||
* @param string $sUserUid
|
||||
* @return object
|
||||
*/
|
||||
|
||||
function getAvailableGroupsCriteria($sUserUid, $filter=''){
|
||||
function getAvailableGroupsCriteria ($sUserUid, $filter = '')
|
||||
{
|
||||
try {
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
$oCriteria->addSelectColumn( GroupUserPeer::GRP_UID );
|
||||
@@ -206,20 +211,21 @@ class Groups
|
||||
}
|
||||
|
||||
return $oCriteria;
|
||||
}
|
||||
catch(exception $e){
|
||||
} catch (exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Assigned Groups for a single user
|
||||
*
|
||||
* @author Qennix
|
||||
* @param string $sUserUid
|
||||
* @return object
|
||||
*/
|
||||
|
||||
function getAssignedGroupsCriteria($sUserUid, $filter=''){
|
||||
function getAssignedGroupsCriteria ($sUserUid, $filter = '')
|
||||
{
|
||||
try {
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
$oCriteria->addSelectColumn( GroupwfPeer::GRP_UID );
|
||||
@@ -238,13 +244,13 @@ class Groups
|
||||
}
|
||||
|
||||
return $oCriteria;
|
||||
}
|
||||
catch(exception $e){
|
||||
} catch (exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
function getGroupsForUser($usrUid) {
|
||||
function getGroupsForUser ($usrUid)
|
||||
{
|
||||
$criteria = $this->getAssignedGroupsCriteria( $usrUid );
|
||||
$criteria->addAscendingOrderByColumn( ContentPeer::CON_VALUE );
|
||||
$dataset = GroupwfPeer::doSelectRS( $criteria );
|
||||
@@ -262,6 +268,7 @@ class Groups
|
||||
|
||||
/**
|
||||
* Remove a user from all groups
|
||||
*
|
||||
* @param string $sUsrUid
|
||||
* @return void
|
||||
*/
|
||||
@@ -271,14 +278,14 @@ class Groups
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
$oCriteria->add( GroupUserPeer::USR_UID, $sUserUID );
|
||||
GroupUserPeer::doDelete( $oCriteria );
|
||||
}
|
||||
catch (exception $oError) {
|
||||
} catch (exception $oError) {
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a criteria object of all users from group
|
||||
*
|
||||
* @param string $sGroupUID
|
||||
* @return array
|
||||
*/
|
||||
@@ -298,14 +305,14 @@ class Groups
|
||||
$oCriteria->add( GroupUserPeer::GRP_UID, $sGroupUID );
|
||||
$oCriteria->add( UsersPeer::USR_STATUS, 'ACTIVE' );
|
||||
return $oCriteria;
|
||||
}
|
||||
catch (exception $oError) {
|
||||
} catch (exception $oError) {
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a criteria object of all groups from user
|
||||
*
|
||||
* @param string $sGroupUID
|
||||
* @return array
|
||||
*/
|
||||
@@ -323,14 +330,14 @@ class Groups
|
||||
$oCriteria->add( GroupUserPeer::GRP_UID, $sUserUID );
|
||||
$oCriteria->add( UsersPeer::USR_STATUS, 'ACTIVE' );
|
||||
return $oCriteria;
|
||||
}
|
||||
catch (exception $oError) {
|
||||
} catch (exception $oError) {
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of groups
|
||||
*
|
||||
* @param string $sGroupUid
|
||||
* @return integer $cnt
|
||||
*/
|
||||
@@ -343,14 +350,14 @@ class Groups
|
||||
$cnt ++;
|
||||
}
|
||||
return $cnt;
|
||||
}
|
||||
catch (exception $oError) {
|
||||
} catch (exception $oError) {
|
||||
print_r( $oError );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the available users list criteria object
|
||||
*
|
||||
* @param string $sGroupUID
|
||||
* @return object
|
||||
*/
|
||||
@@ -377,14 +384,14 @@ class Groups
|
||||
$oCriteria->add( UsersPeer::USR_UID, $aUIDs, Criteria::NOT_IN );
|
||||
$oCriteria->add( UsersPeer::USR_STATUS, 'ACTIVE' );
|
||||
return $oCriteria;
|
||||
}
|
||||
catch (exception $oError) {
|
||||
} catch (exception $oError) {
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if a user is assigned to a group
|
||||
*
|
||||
* @param $GrpUid group Uid
|
||||
* @param $UsrUid user Uid
|
||||
* @return 1/0 if it's or not assigned
|
||||
@@ -398,14 +405,14 @@ class Groups
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
catch (exception $oError) {
|
||||
} catch (exception $oError) {
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify the existence of a Group
|
||||
*
|
||||
* @param $sGroupUid group Uid
|
||||
* @return 1/0 if exist or not
|
||||
*/
|
||||
@@ -425,19 +432,20 @@ class Groups
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
catch (exception $oError) {
|
||||
} catch (exception $oError) {
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load all the data of a group with a search based on it uid
|
||||
*
|
||||
* @param $GrpUid group uid
|
||||
* @return an array of objects/false/exception object
|
||||
*
|
||||
*/
|
||||
public function load($GrpUid){
|
||||
public function load ($GrpUid)
|
||||
{
|
||||
try {
|
||||
$criteria = new Criteria();
|
||||
$criteria->add( GroupwfPeer::GRP_UID, $GrpUid, Criteria::EQUAL );
|
||||
@@ -448,8 +456,7 @@ class Groups
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (exception $e) {
|
||||
} catch (exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user