本文整理汇总了PHP中DepartmentPeer::doSelectRS方法的典型用法代码示例。如果您正苦于以下问题:PHP DepartmentPeer::doSelectRS方法的具体用法?PHP DepartmentPeer::doSelectRS怎么用?PHP DepartmentPeer::doSelectRS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DepartmentPeer
的用法示例。
在下文中一共展示了DepartmentPeer::doSelectRS方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: existsTitle
/**
* Verify if exists the title of a Department
*
* @param string $departmentTitle Title
* @param string $departmentUidExclude Unique id of Department to exclude
*
* return bool Return true if exists the title of a Department, false otherwise
*/
public function existsTitle($departmentTitle, $departmentUidExclude = "")
{
try {
$delimiter = \DBAdapter::getStringDelimiter();
$criteria = new \Criteria("workflow");
$criteria->addSelectColumn(\DepartmentPeer::DEP_UID);
$criteria->addAlias("CT", \ContentPeer::TABLE_NAME);
$arrayCondition = array();
$arrayCondition[] = array(\DepartmentPeer::DEP_UID, "CT.CON_ID", \Criteria::EQUAL);
$arrayCondition[] = array("CT.CON_CATEGORY", $delimiter . "DEPO_TITLE" . $delimiter, \Criteria::EQUAL);
$arrayCondition[] = array("CT.CON_LANG", $delimiter . SYS_LANG . $delimiter, \Criteria::EQUAL);
$criteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN);
if ($departmentUidExclude != "") {
$criteria->add(\DepartmentPeer::DEP_UID, $departmentUidExclude, \Criteria::NOT_EQUAL);
}
$criteria->add("CT.CON_VALUE", $departmentTitle, \Criteria::EQUAL);
$rsCriteria = \DepartmentPeer::doSelectRS($criteria);
return $rsCriteria->next() ? true : false;
} catch (\Exception $e) {
throw $e;
}
}
示例2: getOwnersByType
public function getOwnersByType($data)
{
$this->setResponseType('json');
$result = new stdclass();
$result->status = 'OK';
try {
switch ($data->type) {
case 'EVERYBODY':
$result->total = 0;
$result->owners = array();
break;
case 'USER':
require_once 'classes/model/Users.php';
$users = array();
$usersInstance = new Users();
$allUsers = $usersInstance->getAll();
foreach ($allUsers->data as $user) {
$users[] = array('OWNER_UID' => $user['USR_UID'], 'OWNER_NAME' => $user['USR_FIRSTNAME'] . ' ' . $user['USR_LASTNAME']);
}
usort($users, function ($str1, $str2) {
return strcmp(strtolower($str1["OWNER_NAME"]), strtolower($str2["OWNER_NAME"]));
});
$result->total = $allUsers->totalCount;
$result->owners = $users;
break;
case 'DEPARTMENT':
require_once 'classes/model/Department.php';
require_once 'classes/model/Content.php';
$departments = array();
//SELECT
$criteria = new Criteria('workflow');
$criteria->setDistinct();
$criteria->addSelectColumn(DepartmentPeer::DEP_UID);
$criteria->addSelectColumn(ContentPeer::CON_VALUE);
//FROM
$conditions = array();
$conditions[] = array(DepartmentPeer::DEP_UID, ContentPeer::CON_ID);
$conditions[] = array(ContentPeer::CON_CATEGORY, DBAdapter::getStringDelimiter() . 'DEPO_TITLE' . DBAdapter::getStringDelimiter());
$conditions[] = array(ContentPeer::CON_LANG, DBAdapter::getStringDelimiter() . 'en' . DBAdapter::getStringDelimiter());
$criteria->addJoinMC($conditions, Criteria::LEFT_JOIN);
//WHERE
$criteria->add(DepartmentPeer::DEP_STATUS, 'ACTIVE');
//ORDER BY
$criteria->addAscendingOrderByColumn(ContentPeer::CON_VALUE);
$dataset = DepartmentPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();
while ($row = $dataset->getRow()) {
$departments[] = array('OWNER_UID' => $row['DEP_UID'], 'OWNER_NAME' => $row['CON_VALUE']);
$dataset->next();
}
$result->total = DepartmentPeer::doCount($criteria);
$result->owners = $departments;
break;
case 'GROUP':
require_once 'classes/model/Groupwf.php';
require_once 'classes/model/Content.php';
$groups = array();
//SELECT
$criteria = new Criteria('workflow');
$criteria->setDistinct();
$criteria->addSelectColumn(GroupwfPeer::GRP_UID);
$criteria->addSelectColumn(ContentPeer::CON_VALUE);
//FROM
$conditions = array();
$conditions[] = array(GroupwfPeer::GRP_UID, ContentPeer::CON_ID);
$conditions[] = array(ContentPeer::CON_CATEGORY, DBAdapter::getStringDelimiter() . 'GRP_TITLE' . DBAdapter::getStringDelimiter());
$conditions[] = array(ContentPeer::CON_LANG, DBAdapter::getStringDelimiter() . 'en' . DBAdapter::getStringDelimiter());
$criteria->addJoinMC($conditions, Criteria::LEFT_JOIN);
//WHERE
$criteria->add(GroupwfPeer::GRP_STATUS, 'ACTIVE');
//ORDER BY
$criteria->addAscendingOrderByColumn(ContentPeer::CON_VALUE);
$dataset = GroupwfPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();
while ($row = $dataset->getRow()) {
$groups[] = array('OWNER_UID' => $row['GRP_UID'], 'OWNER_NAME' => $row['CON_VALUE']);
$dataset->next();
}
$result->total = GroupwfPeer::doCount($criteria);
$result->owners = $groups;
break;
}
} catch (Exception $error) {
$result->status = 'ERROR';
$result->message = $error->getMessage();
}
return $result;
}
示例3: departmentList
/**
* get all department
*
* @param none
* @return $result will return an object
*/
public function departmentList ()
{
try {
$result = array ();
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( DepartmentPeer::DEP_STATUS, 'ACTIVE' );
$oDataset = DepartmentPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$oDepartment = new Department();
$aDepartment = $oDepartment->Load( $aRow['DEP_UID'] );
$node['guid'] = $aRow['DEP_UID'];
$node['name'] = $aDepartment['DEPO_TITLE'];
$node['parentUID'] = $aDepartment['DEP_PARENT'];
$node['dn'] = $aDepartment['DEP_LDAP_DN'];
//get the users from this department
$c = new Criteria();
$c->clearSelectColumns();
$c->addSelectColumn( 'COUNT(*)' );
$c->add( UsersPeer::DEP_UID, $aRow['DEP_UID'] );
$rs = UsersPeer::doSelectRS( $c );
$rs->next();
$row = $rs->getRow();
$count = $row[0];
$node['users'] = $count;
$result[] = $node;
$oDataset->next();
}
return $result;
} catch (Exception $e) {
$result[] = array ('guid' => $e->getMessage(),'name' => $e->getMessage()
);
return $result;
}
}
示例4: doSelect
public static function doSelect(Criteria $criteria, $con = null)
{
return DepartmentPeer::populateObjects(DepartmentPeer::doSelectRS($criteria, $con));
}
示例5: Department
*
* 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_USERS")) != 1) {
return $RBAC_Response;
}
require_once 'classes/model/Department.php';
require_once 'classes/model/Users.php';
$oDpto = new Department();
if (!isset($_POST['DEP_UID'])) {
return;
}
$ocriteria = new Criteria('workflow');
$ocriteria->addSelectColumn(DepartmentPeer::DEP_MANAGER);
$ocriteria->add(DepartmentPeer::DEP_UID, $_POST['DEP_UID']);
$oDataset = DepartmentPeer::doSelectRS($ocriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$aRow = $oDataset->getRow();
$oCriteria1 = new Criteria('workflow');
$oCriteria1->add(UsersPeer::USR_REPORTS_TO, $aRow['DEP_MANAGER'], Criteria::EQUAL);
$oCriteria2 = new Criteria('workflow');
$oCriteria2->add(UsersPeer::USR_REPORTS_TO, '');
BasePeer::doUpdate($oCriteria1, $oCriteria2, Propel::getConnection('workflow'));
$oCriteriaA = new Criteria('workflow');
$oCriteriaA->add(UsersPeer::DEP_UID, $_POST['DEP_UID'], Criteria::EQUAL);
$oCriteriaB = new Criteria('workflow');
$oCriteriaB->add(UsersPeer::DEP_UID, '');
BasePeer::doUpdate($oCriteriaA, $oCriteriaB, Propel::getConnection('workflow'));
$oDpto->remove(urldecode($_POST['DEP_UID']));
示例6: getDepartmentsForUser
public function getDepartmentsForUser($userUid)
{
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(UsersPeer::DEP_UID);
$criteria->addAsColumn('DEP_TITLE', 'C.CON_VALUE');
$criteria->addAlias('C', 'CONTENT');
$criteria->addJoin(UsersPeer::DEP_UID, DepartmentPeer::DEP_UID, Criteria::LEFT_JOIN);
$delimiter = DBAdapter::getStringDelimiter();
$conditions = array();
$conditions[] = array(DepartmentPeer::DEP_UID, 'C.CON_ID');
$conditions[] = array('C.CON_CATEGORY', $delimiter . 'DEPO_TITLE' . $delimiter);
$conditions[] = array('C.CON_LANG', $delimiter . SYS_LANG . $delimiter);
$criteria->addJoinMC($conditions, Criteria::LEFT_JOIN);
$criteria->add(UsersPeer::USR_UID, $userUid);
$criteria->add(UsersPeer::DEP_UID, '', Criteria::NOT_EQUAL);
$dataset = DepartmentPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();
$departments = array();
while ($row = $dataset->getRow()) {
if (!isset($departments[$row['DEP_UID']])) {
$departments[$row['DEP_UID']] = $row;
}
$dataset->next();
}
return $departments;
}
示例7: doCountJoinAll
public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null)
{
$criteria = clone $criteria;
$criteria->clearSelectColumns()->clearOrderByColumns();
if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->addSelectColumn(DepartmentPeer::COUNT_DISTINCT);
} else {
$criteria->addSelectColumn(DepartmentPeer::COUNT);
}
foreach ($criteria->getGroupByColumns() as $column) {
$criteria->addSelectColumn($column);
}
$rs = DepartmentPeer::doSelectRS($criteria, $con);
if ($rs->next()) {
return $rs->getInt(1);
} else {
return 0;
}
}