本文整理汇总了PHP中Groups::getUsersGroupCriteria方法的典型用法代码示例。如果您正苦于以下问题:PHP Groups::getUsersGroupCriteria方法的具体用法?PHP Groups::getUsersGroupCriteria怎么用?PHP Groups::getUsersGroupCriteria使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Groups
的用法示例。
在下文中一共展示了Groups::getUsersGroupCriteria方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PMFGetUserEmailAddress
/**
* @method
*
* Returns a list or user.
*
* @name PMFGetUserEmailAddress
* @label PMF Get User Email Address
* @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#PMFGetUserEmailAddress.28.29
*
* @param string(32) or Array | $id | Case ID | Id of the case.
* @param string(32) | $APP_UID = null | Application ID | Id of the Application.
* @param string(32) | $prefix = "usr" | prefix | Id of the task.
* @return array | $aRecipient | Array of the Recipient | Return an Array of the Recipient.
*
*/
function PMFGetUserEmailAddress($id, $APP_UID = null, $prefix = 'usr')
{
require_once 'classes/model/UsersPeer.php';
require_once 'classes/model/AppDelegation.php';
G::LoadClass('case');
if (is_string($id) && trim($id) == "") {
return false;
}
if (is_array($id) && count($id) == 0) {
return false;
}
//recipient to store the email addresses
$aRecipient = array();
$aItems = array();
/*
* First at all the $id user input can be by example erik@colosa.com
* 2.this $id param can be a array by example Array('000000000001','000000000002') in this case $prefix is necessary
* 3.this same param can be a array by example Array('usr|000000000001', 'usr|-1', 'grp|2245141479413131441')
*/
/*
* The second thing is that the return type will be configurated depend of the input type (using $retType)
*/
if (is_array($id)) {
$aItems = $id;
$retType = 'array';
} else {
$retType = 'string';
if (strpos($id, ",") !== false) {
$aItems = explode(',', $id);
} else {
array_push($aItems, $id);
}
}
foreach ($aItems as $sItem) {
//cleaning for blank spaces into each array item
$sItem = trim($sItem);
if (strpos($sItem, "|") !== false) {
// explode the parameter because always will be compose with pipe separator to indicate
// the type (user or group) and the target mai
list($sType, $sID) = explode('|', $sItem);
$sType = trim($sType);
$sID = trim($sID);
} else {
$sType = $prefix;
$sID = $sItem;
}
switch ($sType) {
case 'ext':
if (G::emailAddress($sID)) {
array_push($aRecipient, $sID);
}
break;
case 'usr':
if ($sID == '-1') {
// -1: Curent user, load from user record
if (isset($APP_UID)) {
$oAppDelegation = new AppDelegation();
$aAppDel = $oAppDelegation->getLastDeleration($APP_UID);
if (isset($aAppDel)) {
$oUserRow = UsersPeer::retrieveByPK($aAppDel['USR_UID']);
if (isset($oUserRow)) {
$sID = $oUserRow->getUsrEmail();
} else {
throw new Exception('User with ID ' . $oAppDelegation->getUsrUid() . 'doesn\'t exist');
}
if (G::emailAddress($sID)) {
array_push($aRecipient, $sID);
}
}
}
} else {
$oUserRow = UsersPeer::retrieveByPK($sID);
if ($oUserRow != null) {
$sID = $oUserRow->getUsrEmail();
if (G::emailAddress($sID)) {
array_push($aRecipient, $sID);
}
}
}
break;
case 'grp':
G::LoadClass('groups');
$oGroups = new Groups();
$oCriteria = $oGroups->getUsersGroupCriteria($sID);
$oDataset = GroupwfPeer::doSelectRS($oCriteria);
//.........这里部分代码省略.........
示例2: Groups
*/
if (($RBAC_Response = $RBAC->userCanAccess("PM_USERS")) != 1) {
return $RBAC_Response;
}
G::LoadInclude('ajax');
$_POST['action'] = get_ajax_value('action');
switch ($_POST['action']) {
case 'showUsers':
G::LoadClass('groups');
$oGroups = new Groups();
$oGroup = new Groupwf();
$aFields = $oGroup->load($_POST['sGroupUID']);
global $G_PUBLISH;
$G_PUBLISH = new Publisher();
//$G_PUBLISH->AddContent('xmlform', 'xmlform', 'groups/groups_UsersListTitle', '', array('GRP_NAME' => $aFields['GRP_TITLE']));
$G_PUBLISH->AddContent('propeltable', 'groups/paged-table2', 'groups/groups_UsersList', $oGroups->getUsersGroupCriteria($_POST['sGroupUID']), array('GRP_UID' => $_POST['sGroupUID'], 'GRP_NAME' => $aFields['GRP_TITLE']));
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addScriptCode("groupname=\"{$aFields["GRP_TITLE"]}\";");
G::RenderPage('publish', 'raw');
break;
case 'assignUser':
G::LoadClass('groups');
$oGroup = new Groups();
$oGroup->addUserToGroup($_POST['GRP_UID'], $_POST['USR_UID']);
break;
case 'assignAllUsers':
G::LoadClass('groups');
$oGroup = new Groups();
$aUsers = explode(',', $_POST['aUsers']);
for ($i = 0; $i < count($aUsers); $i++) {
$oGroup->addUserToGroup($_POST['GRP_UID'], $aUsers[$i]);
示例3: executeCron
//.........这里部分代码省略.........
$logResults = sprintf("- Groups -> Existing users: %d, moved: %d, impossible: %d, created: %d, removed: %d", $this->gAlready, $this->gMoved, $this->gImpossible, $this->gCreated, $this->gRemoved);
$plugin->frontEndShow("TEXT", $logResults);
$plugin->log(null, $logResults);
//Manager
$plugin->clearManager($this->managersToClear);
if (isset($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["DEPARTMENTS_TO_UNASSIGN"])) {
if (is_array($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["DEPARTMENTS_TO_UNASSIGN"])) {
foreach ($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["DEPARTMENTS_TO_UNASSIGN"] as $departmentUID) {
// Delete manager assignments
$criteriaSet = new Criteria("workflow");
$criteriaSet->add(UsersPeer::USR_REPORTS_TO, "");
$criteriaWhere = new Criteria("workflow");
$criteriaWhere->add(UsersPeer::DEP_UID, $departmentUID);
$criteriaWhere->add(UsersPeer::USR_REPORTS_TO, "", Criteria::NOT_EQUAL);
$this->deletedManager = BasePeer::doUpdate($criteriaWhere, $criteriaSet, Propel::getConnection("workflow"));
// Delete department assignments
$criteriaSet = new Criteria("workflow");
$criteriaSet->add(UsersPeer::DEP_UID, "");
$criteriaWhere = new Criteria("workflow");
$criteriaWhere->add(UsersPeer::DEP_UID, $departmentUID);
$this->dMoved += UsersPeer::doCount($criteriaWhere);
BasePeer::doUpdate($criteriaWhere, $criteriaSet, Propel::getConnection("workflow"));
}
}
unset($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["DEPARTMENTS_TO_UNASSIGN"]);
$rbac =& RBAC::getSingleton();
$rbac->authSourcesObj->update($arrayAuthenticationSourceData);
}
if (isset($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["GROUPS_TO_UNASSIGN"])) {
if (is_array($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["GROUPS_TO_UNASSIGN"])) {
foreach ($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["GROUPS_TO_UNASSIGN"] as $groupUID) {
// Delete manager assignments
$groupsInstance = new Groups();
$criteria = $groupsInstance->getUsersGroupCriteria($groupUID);
$dataset = UsersPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();
$users = array();
while ($row = $dataset->getRow()) {
$users[] = $row["USR_UID"];
$dataset->next();
}
$criteriaSet = new Criteria("workflow");
$criteriaSet->add(UsersPeer::USR_REPORTS_TO, "");
$criteriaWhere = new Criteria("workflow");
$criteriaWhere->add(UsersPeer::USR_UID, $users, Criteria::IN);
$criteriaWhere->add(UsersPeer::USR_REPORTS_TO, "", Criteria::NOT_EQUAL);
$this->deletedManager = BasePeer::doUpdate($criteriaWhere, $criteriaSet, Propel::getConnection("workflow"));
// Delete group assignments
$criteria = new Criteria("workflow");
$criteria->add(GroupUserPeer::GRP_UID, $groupUID);
$this->gMoved += GroupUserPeer::doCount($criteria);
BasePeer::doDelete($criteria, Propel::getConnection("workflow"));
}
}
unset($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["GROUPS_TO_UNASSIGN"]);
$rbac =& RBAC::getSingleton();
$rbac->authSourcesObj->update($arrayAuthenticationSourceData);
}
// Delete the managers that not exists in PM
$criteria = new Criteria("rbac");
$criteria->addSelectColumn(RbacUsersPeer::USR_AUTH_USER_DN);
$criteria->add(RbacUsersPeer::USR_AUTH_USER_DN, "", Criteria::NOT_EQUAL);
$dataset = RbacUsersPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();