本文整理汇总了PHP中kuserPeer::doSelect方法的典型用法代码示例。如果您正苦于以下问题:PHP kuserPeer::doSelect方法的具体用法?PHP kuserPeer::doSelect怎么用?PHP kuserPeer::doSelect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kuserPeer
的用法示例。
在下文中一共展示了kuserPeer::doSelect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: providerTestMigration
public function providerTestMigration()
{
$kusers = kuserPeer::doSelect(new Criteria());
// select all
$ids = array();
foreach ($kusers as $user) {
$ids[] = array($user->getId());
}
return $ids;
}
示例2: getAdminUsers
function getAdminUsers($lastUser, $userLimitEachLoop)
{
kuserPeer::clearInstancePool();
UserRolePeer::clearInstancePool();
$c = new Criteria();
$c->addAnd(kuserPeer::ID, $lastUser, Criteria::GREATER_THAN);
$c->addAnd(kuserPeer::IS_ADMIN, true, Criteria::EQUAL);
$c->addAscendingOrderByColumn(kuserPeer::ID);
$c->setLimit($userLimitEachLoop);
kuserPeer::setUseCriteriaFilter(false);
$users = kuserPeer::doSelect($c);
kuserPeer::setUseCriteriaFilter(true);
return $users;
}
示例3: nextUser
private function nextUser()
{
$this->adminKuser = adminKuserPeer::retrieveByPK($this->curId);
$this->assertNotNull($this->adminKuser, 'Admin kuser not found with id [' . $this->curId . ']');
$cLoginData = new Criteria();
$cLoginData->addAnd(UserLoginDataPeer::LOGIN_EMAIL, $this->adminKuser->getEmail());
$loginDatas = UserLoginDataPeer::doSelect($cLoginData);
$this->assertEquals(1, count($loginDatas), 'Number of login datas found for id [' . $this->curId . ']');
$this->loginData = $loginDatas[0];
$cKuser = new Criteria();
$cKuser->addAnd(kuserPeer::LOGIN_DATA_ID, $this->loginData->getId());
$cKuser->addAnd(kuserPeer::PARTNER_ID, $this->adminKuser->getPartnerId());
$kusers = kuserPeer::doSelect($cKuser);
$this->assertEquals(1, count($kusers), 'Number of kusers found for id [' . $this->curId . ']');
$this->kuser = $kusers[0];
return true;
}
示例4: tearDown
/**
* Cleans up the environment after running a test.
*/
protected function tearDown()
{
$this->ks = null;
parent::tearDown();
foreach ($this->createdUserIds as $userId) {
// delete all kusers created during the tests
$c = new Criteria();
$c->addAnd(kuserPeer::PUSER_ID, $userId, Criteria::EQUAL);
$kusers = kuserPeer::doSelect($c);
foreach ($kusers as $kuser) {
@$kuser->delete();
}
// delete all kuser pusers created during the tests
$c = new Criteria();
$c->addAnd(PuserKuserPeer::PUSER_ID, $userId, Criteria::EQUAL);
$puserKusers = PuserKuserPeer::doSelect($c);
foreach ($puserKusers as $puserKuser) {
@$puserKuser->delete();
}
}
}
示例5: executeImpl
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
{
// the relevant puser_kuser is the one from the user_id NOT the uid (which is the logged in user investigationg
//$target_puser_kuser = PuserKuserPeer::retrieveByPartnerAndUid($partner_id , null , $user_id , true );
$page = $this->getP("page");
$page_size = $this->getP("page_size");
$detailed = $this->getP("detailed", false);
$c = new Criteria();
$c->addAnd(kuserPeer::PARTNER_ID, $partner_id, Criteria::EQUAL);
$c->setLimit($page_size);
$c->setOffset(($page - 1) * $page_size);
$users = kuserPeer::doSelect($c);
$extra_fields = array();
if ($detailed) {
$extra_fields = array("country", "state", "city", "zip", "urlList", "networkHighschool", "networkCollege", "views", "fans", "entries", "producedKshows");
}
$level = objectWrapperBase::DETAIL_LEVEL_REGULAR;
$this->addMsg("count", count($users));
$this->addMsg("page", $page);
$this->addMsg("pageSize", $page_size);
$this->addMsg("users", objectWrapperBase::getWrapperClass($users, $level, objectWrapperBase::DETAIL_VELOCITY_DEFAULT, 0, $extra_fields));
}
示例6: getListResponse
public function getListResponse(KalturaFilterPager $pager, KalturaDetachedResponseProfile $responseProfile = null)
{
$this->validateUserIdOrGroupIdFiltered();
if ($this->groupIdEqual) {
$partnerId = kCurrentContext::getCurrentPartnerId();
$c = new Criteria();
$c->add(kuserPeer::PARTNER_ID, $partnerId);
$c->add(kuserPeer::PUSER_ID, $this->groupIdEqual);
$c->add(kuserPeer::TYPE, KuserType::GROUP);
if (kCurrentContext::$ks_partner_id == Partner::BATCH_PARTNER_ID) {
//batch should be able to get categoryUser of deleted users.
kuserPeer::setUseCriteriaFilter(false);
}
// in case of more than one deleted kusers - get the last one
$c->addDescendingOrderByColumn(kuserPeer::UPDATED_AT);
$kuser = kuserPeer::doSelectOne($c);
kuserPeer::setUseCriteriaFilter(true);
if (!$kuser) {
$response = new KalturaGroupUserListResponse();
$response->objects = new KalturaGroupUserArray();
$response->totalCount = 0;
return $response;
}
$this->groupIdEqual = $kuser->getId();
}
if ($this->userIdEqual) {
$partnerId = kCurrentContext::getCurrentPartnerId();
$c = new Criteria();
$c->add(kuserPeer::PARTNER_ID, $partnerId);
$c->add(kuserPeer::PUSER_ID, $this->userIdEqual);
$c->add(kuserPeer::TYPE, KuserType::USER);
$kuser = kuserPeer::doSelectOne($c);
if (!$kuser) {
$response = new KalturaGroupUserListResponse();
$response->objects = new KalturaGroupUserArray();
$response->totalCount = 0;
return $response;
}
$this->userIdEqual = $kuser->getId();
}
if ($this->userIdIn) {
$usersIds = explode(',', $this->userIdIn);
$partnerId = kCurrentContext::getCurrentPartnerId();
$c = new Criteria();
$c->add(kuserPeer::PARTNER_ID, $partnerId, Criteria::EQUAL);
$c->add(kuserPeer::PUSER_ID, $usersIds, Criteria::IN);
$c->add(kuserPeer::TYPE, KuserType::USER);
$kusers = kuserPeer::doSelect($c);
if (!$kusers) {
$response = new KalturaGroupUserListResponse();
$response->objects = new KalturaGroupUserArray();
$response->totalCount = 0;
return $response;
}
$usersIds = array();
foreach ($kusers as $kuser) {
/* @var $kuser kuser */
$usersIds[] = $kuser->getId();
}
$this->userIdIn = implode(',', $usersIds);
}
if ($this->groupIdIn) {
$groupIdIn = explode(',', $this->groupIdIn);
$partnerId = kCurrentContext::getCurrentPartnerId();
$c = new Criteria();
$c->add(kuserPeer::PARTNER_ID, $partnerId, Criteria::EQUAL);
$c->add(kuserPeer::PUSER_ID, $groupIdIn, Criteria::IN);
$c->add(kuserPeer::TYPE, KuserType::GROUP);
$kusers = kuserPeer::doSelect($c);
if (!$kusers) {
$response = new KalturaGroupUserListResponse();
$response->objects = new KalturaGroupUserArray();
$response->totalCount = 0;
return $response;
}
$groupIdIn = array();
foreach ($kusers as $kuser) {
/* @var $kuser kuser */
$groupIdIn[] = $kuser->getId();
}
$this->groupIdIn = implode(',', $groupIdIn);
}
$kuserKgroupFilter = $this->toObject();
$c = KalturaCriteria::create(KuserKgroupPeer::OM_CLASS);
$kuserKgroupFilter->attachToCriteria($c);
$pager->attachToCriteria($c);
$c->applyFilters();
$list = KuserKgroupPeer::doSelect($c);
$newList = KalturaGroupUserArray::fromDbArray($list, $responseProfile);
$response = new KalturaGroupUserListResponse();
$response->objects = $newList;
$resultCount = count($newList);
if ($resultCount && $resultCount < $pager->pageSize) {
$totalCount = ($pager->pageIndex - 1) * $pager->pageSize + $resultCount;
} else {
KalturaFilterPager::detachFromCriteria($c);
$totalCount = KuserKgroupPeer::doCount($c);
}
$response->totalCount = $totalCount;
return $response;
//.........这里部分代码省略.........
示例7: sendNewUserMailToAdmins
public static function sendNewUserMailToAdmins(kuser $user)
{
$partnerId = $user->getPartnerId();
$creatorUserName = 'Unknown';
if (!is_null(kCurrentContext::$ks_uid)) {
$creatorUser = kuserPeer::getKuserByPartnerAndUid($partnerId, kCurrentContext::$ks_uid);
if ($creatorUser) {
$creatorUserName = $creatorUser->getFullName();
}
}
$publisherName = PartnerPeer::retrieveByPK($partnerId)->getName();
$loginEmail = $user->getEmail();
$roleName = $user->getUserRoleNames();
$puserId = $user->getPuserId();
$bodyParams = null;
$mailType = self::KALTURA_NEW_USER_EMAIL_TO_ADMINS;
//If the new user partner is -2 (admin console) then it is a admin console user
if ($partnerId == Partner::ADMIN_CONSOLE_PARTNER_ID) {
$mailType = self::KALTURA_NEW_USER_ADMIN_CONSOLE_EMAIL_TO_ADMINS;
}
// get all partner administrators
$c = new Criteria();
$c->addAnd(kuserPeer::IS_ADMIN, true, Criteria::EQUAL);
$c->addAnd(kuserPeer::PARTNER_ID, $partnerId, Criteria::EQUAL);
$adminKusers = kuserPeer::doSelect($c);
foreach ($adminKusers as $admin) {
// don't send mail to the created user
if ($admin->getId() == $user->getId()) {
continue;
}
// send email to all administrators with user management permissions
if ($admin->hasPermissionOr(array(PermissionName::ADMIN_USER_ADD, PermissionName::ADMIN_USER_UPDATE, PermissionName::ADMIN_USER_DELETE))) {
$adminName = $admin->getFullName();
if (!$adminName) {
$adminName = $admin->getPuserId();
}
$unsubscribeLink .= $admin->getEmail();
$bodyParams = null;
if ($partnerId == Partner::ADMIN_CONSOLE_PARTNER_ID) {
$bodyParams = array($adminName, $creatorUserName, $loginEmail, $roleName);
} else {
$bodyParams = array($adminName, $creatorUserName, $publisherName, $loginEmail, $publisherName, $roleName, $publisherName, $partnerId);
}
// add mail job
kJobsManager::addMailJob(null, 0, $partnerId, $mailType, kMailJobData::MAIL_PRIORITY_NORMAL, kConf::get("partner_registration_confirmation_email"), kConf::get("partner_registration_confirmation_name"), $admin->getEmail(), $bodyParams);
}
}
}
示例8: execute
public function execute()
{
$this->forceSystemAuthentication();
$source_kshow_id = $this->getP("source_kshow_id");
$target_kshow_id = $this->getP("target_kshow_id");
$kuser_names = $this->getP("kuser_names");
$reset = $this->getP("reset");
if ($reset) {
$source_kshow_id = null;
$target_kshow_id = null;
$kuser_names = null;
}
$mode = 0;
// view
if ($source_kshow_id && $target_kshow_id && $kuser_names) {
$mode = 1;
// review
$list_of_kuser_names = explode(",", $kuser_names);
foreach ($list_of_kuser_names as &$name) {
$name = trim($name);
}
$source_kshow = kshowPeer::retrieveByPK($source_kshow_id);
$target_kshow = kshowPeer::retrieveByPK($target_kshow_id);
$target_partner_id = $target_kshow->getPartnerId();
$target_subp_id = $target_kshow->getSubpId();
$c = new Criteria();
// select only the kusers of the correct partner_id
$c->add(kuserPeer::SCREEN_NAME, $list_of_kuser_names, Criteria::IN);
$c->setLimit(10);
//$c->add ( kuserPeer::PARTNER_ID , $target_partner_id );
$list_of_kusers = kuserPeer::doSelect($c);
$producer = kuserPeer::retrieveByPK($target_kshow->getProducerId());
$list_of_kusers[] = $producer;
$c->add(kuserPeer::PARTNER_ID, $target_partner_id);
$list_of_valid_kusers = kuserPeer::doSelect($c);
$list_of_valid_kusers[] = $producer;
$c = new Criteria();
$c->add(entryPeer::KSHOW_ID, $source_kshow_id);
$c->add(entryPeer::TYPE, entryType::MEDIA_CLIP);
$c->add(entryPeer::STATUS, entryStatus::READY);
$entries = entryPeer::doSelectJoinAll($c);
$entry_kusers = array();
// assign each entry to a kuser
foreach ($entries as $entry) {
$place_in_array = count($entry_kusers) % count($list_of_valid_kusers);
$kuser = $list_of_valid_kusers[$place_in_array];
$entry_kusers[$entry->getId()] = $kuser->getId();
}
$clone = $this->getP("clone");
if ($clone == 'true') {
$mode = 2;
// clone
$entry_id_map = array();
// will be used to map the source->target entries
$entry_cache = array();
// will be used to cache all relevat entries
$new_entry_list = array();
$failed_entry_list = array();
foreach ($entries as $entry) {
try {
$kuser_id = $entry_kusers[$entry->getId()];
$override_fields = $entry->copy();
$override_fields->setPartnerId($target_kshow->getPartnerId());
$override_fields->setSubpId($target_kshow->getSubpId());
$override_fields->setKuserId($kuser_id);
$override_fields->setCreatorKuserId($kuser_id);
$new_entry = myEntryUtils::deepClone($entry, $target_kshow_id, $override_fields, false);
$new_entry_list[] = $new_entry;
// will help fix the metadata entries
$entry_id_map[$entry->getId()] = $new_entry->getId();
$entry_cache[$entry->getId()] = $entry;
$entry_cache[$new_entry->getId()] = $new_entry;
} catch (Exception $ex) {
$failed_entry_list[] = $entry;
}
// echo "entry [{$entry->getId()}] copied<br>"; flush();
}
// now clone the show_entry
$new_show_entry = $target_kshow->getShowEntry();
myEntryUtils::deepCloneShowEntry($source_kshow->getShowEntry(), $new_show_entry, $entry_id_map, $entry_cache);
$new_entry_list[] = $new_show_entry;
$entries = $new_entry_list;
$entry_kusers = null;
}
// echo "ended!<bR>"; flush();
}
$this->source_kshow_id = @$source_kshow_id;
$this->target_kshow_id = @$target_kshow_id;
$this->partner_id = @$target_partner_id;
$this->source_kshow = @$source_kshow;
$this->target_kshow = @$target_kshow;
$this->kuser_names = @$kuser_names;
$this->list_of_kusers = @$list_of_kusers;
$this->entries = @$entries;
$this->mode = $mode;
$this->entry_kusers = @$entry_kusers;
// echo "going to template!<bR>"; flush();
}
示例9: execute
/**
* Gives a system applicative snapsot
*/
public function execute()
{
myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL3;
$this->forceSystemAuthentication();
$partner_id = $this->getRequestParameter('partner_id', -1);
if ($partner_id >= 0) {
myPartnerUtils::applyPartnerFilters($partner_id);
}
$this->partner_id = $partner_id;
$limit = $this->getRequestParameter('limit', '30');
if ($limit > 300) {
$limit = 300;
}
$bands_only = $this->getRequestParameter("bands", false) != null;
$modified_only = $this->getRequestParameter("modified", false) != null;
$this->bands_only = $bands_only;
$this->modified_only = $modified_only;
$this->kshows_with_new_entries = $modified_only ? dashboardUtils::getUpdatedKshows() : null;
$yesterday = mktime(0, 0, 0, date("m"), date("d") - 1, date("Y"));
$lastweek = mktime(0, 0, 0, date("m"), date("d") - 7, date("Y"));
$query_esterday = date('Y-m-d', $yesterday);
$query_lastweek = date('Y-m-d', $lastweek);
$modified_band_ids = $modified_only ? array_keys($this->kshows_with_new_entries) : null;
if ($modified_only) {
// TODO - this chunk was copied from the code bellow with minor changes - generalize !
$c = new Criteria();
// $c->add ( kshowPeer::ID , $modified_band_ids , Criteria::IN ); // search only the given IDs
$this->bandsOnly($bands_only, $modified_band_ids, $c, kshowPeer::PARTNER_ID);
$this->kshow_count = kshowPeer::doCount($c);
$criterion = $c->getNewCriterion(kshowPeer::CREATED_AT, $query_esterday, Criteria::GREATER_EQUAL);
$c->add($criterion);
$this->kshow_count1 = kshowPeer::doCount($c);
$criterion = $c->getNewCriterion(kshowPeer::CREATED_AT, $query_lastweek, Criteria::GREATER_EQUAL);
$c->add($criterion);
$this->kshow_count7 = kshowPeer::doCount($c);
$c->setLimit($limit);
//$c->hints = array(kshowPeer::TABLE_NAME => "created_at_index");
$c->addDescendingOrderByColumn(kshowPeer::CREATED_AT);
$c->remove(kshowPeer::CREATED_AT);
$c->addJoin(kshowPeer::PRODUCER_ID, kuserPeer::ID, Criteria::LEFT_JOIN);
$this->kshows = kshowPeer::doSelectJoinkuser($c);
$this->bands_only = $bands_only;
$this->entry_count = 0;
$this->entry_count1 = 0;
$this->entry_count7 = 0;
$this->entries = array();
$this->kuser_count = 0;
$this->kuser_count1 = 0;
$this->kuser_count7 = 0;
$this->kusers = array();
dashboardUtils::updateKshowsRoughcutCount($this->kshows);
return sfView::SUCCESS;
}
$c = new Criteria();
$this->bandsOnly($bands_only, $modified_band_ids, $c, kshowPeer::PARTNER_ID);
$this->kshow_count = kshowPeer::doCount($c);
$d = new Criteria();
$this->bandsOnly($bands_only, $modified_band_ids, $d, kshowPeer::PARTNER_ID);
$criterion = $c->getNewCriterion(kshowPeer::CREATED_AT, $query_esterday, Criteria::GREATER_EQUAL);
$d->add($criterion);
$this->kshow_count1 = kshowPeer::doCount($d);
$e = new Criteria();
$this->bandsOnly($bands_only, $modified_band_ids, $e, kshowPeer::PARTNER_ID);
$criterion = $c->getNewCriterion(kshowPeer::CREATED_AT, $query_lastweek, Criteria::GREATER_EQUAL);
$e->add($criterion);
$this->kshow_count7 = kshowPeer::doCount($e);
//$this->kshow_count = kshowPeer::doCount( $c );
$c->setLimit($limit);
//$c->hints = array(kshowPeer::TABLE_NAME => "created_at_index");
$c->addDescendingOrderByColumn(kshowPeer::CREATED_AT);
$c->addJoin(kshowPeer::PRODUCER_ID, kuserPeer::ID, Criteria::LEFT_JOIN);
$this->kshows = kshowPeer::doSelectJoinkuser($c);
$c = new Criteria();
$this->bandsOnly($bands_only, $modified_band_ids, $c, entryPeer::PARTNER_ID);
$this->entry_count = entryPeer::doCount($c);
$d = new Criteria();
$this->bandsOnly($bands_only, $modified_band_ids, $d, entryPeer::PARTNER_ID);
$criterion = $c->getNewCriterion(entryPeer::CREATED_AT, $query_esterday, Criteria::GREATER_EQUAL);
$d->add($criterion);
$this->entry_count1 = entryPeer::doCount($d);
$e = new Criteria();
$this->bandsOnly($bands_only, $modified_band_ids, $e, entryPeer::PARTNER_ID);
$criterion = $c->getNewCriterion(entryPeer::CREATED_AT, $query_lastweek, Criteria::GREATER_EQUAL);
$e->add($criterion);
$this->entry_count7 = entryPeer::doCount($e);
$c->setLimit($limit);
//$c->hints = array(entryPeer::TABLE_NAME => "created_at_index");
$c->addDescendingOrderByColumn(entryPeer::CREATED_AT);
$c->add(entryPeer::TYPE, entryType::MEDIA_CLIP);
// we don't want entries that
// $c->addJoin(entryPeer::KUSER_ID, kuserPeer::ID, Criteria::INNER_JOIN);
// $c->addJoin(entryPeer::KSHOW_ID, kshowPeer::ID, Criteria::INNER_JOIN);
$this->entries = entryPeer::doSelectJoinAll($c);
$c = new Criteria();
$this->bandsOnly($bands_only, $modified_band_ids, $c, kuserPeer::PARTNER_ID);
$d = new Criteria();
$this->bandsOnly($bands_only, $modified_band_ids, $d, kuserPeer::PARTNER_ID);
//.........这里部分代码省略.........
示例10: kSphinxSearchManager
}
if ($argc > 3 && is_numeric($argv[3])) {
$c->add(kuserPeer::ID, $argv[3], Criteria::GREATER_EQUAL);
}
if ($argc > 4) {
kuserPeer::setUseCriteriaFilter((bool) $argv[4]);
}
$c->addAscendingOrderByColumn(kuserPeer::UPDATED_AT);
$c->addAscendingOrderByColumn(kuserPeer::ID);
$c->setLimit(10000);
$con = myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2);
//$sphinxCon = DbManager::getSphinxConnection();
$entries = kuserPeer::doSelect($c, $con);
$sphinx = new kSphinxSearchManager();
while (count($entries)) {
foreach ($entries as $entry) {
/* @var $entry kuser */
KalturaLog::log('kuser id ' . $entry->getId() . ' updated at ' . $entry->getUpdatedAt(null));
try {
$ret = $sphinx->saveToSphinx($entry, true);
} catch (Exception $e) {
KalturaLog::err($e->getMessage());
exit - 1;
}
}
$c->setOffset($c->getOffset() + count($entries));
kMemoryManager::clearMemory();
$entries = kuserPeer::doSelect($c, $con);
}
KalturaLog::log('Done. Cureent time: ' . time());
exit(0);
示例11: findFirstValidKuser
private static function findFirstValidKuser($loginDataId, $notPartnerId = null)
{
$c = new Criteria();
$c->addAnd(kuserPeer::LOGIN_DATA_ID, $loginDataId);
$c->addAnd(kuserPeer::STATUS, KuserStatus::ACTIVE, Criteria::EQUAL);
if ($notPartnerId) {
$c->addAnd(kuserPeer::PARTNER_ID, $notPartnerId, Criteria::NOT_EQUAL);
}
$c->addAscendingOrderByColumn(kuserPeer::PARTNER_ID);
$kusers = kuserPeer::doSelect($c);
foreach ($kusers as $kuser) {
if ($kuser->getStatus() != KuserStatus::ACTIVE) {
continue;
}
$partner = PartnerPeer::retrieveByPK($kuser->getPartnerId());
if (!$partner || $partner->getStatus() != Partner::PARTNER_STATUS_ACTIVE) {
continue;
}
return $kuser;
}
return null;
}
示例12: listAction
/**
* Lists user objects that are associated with an account.
* Blocked users are listed unless you use a filter to exclude them.
* Deleted users are not listed unless you use a filter to include them.
*
* @action list
* @param KalturaUserFilter $filter A filter used to exclude specific types of users
* @param KalturaFilterPager $pager A limit for the number of records to display on a page
* @return KalturaUserListResponse The list of user objects
*/
public function listAction(KalturaUserFilter $filter = null, KalturaFilterPager $pager = null)
{
if (!$filter) {
$filter = new KalturaUserFilter();
}
if (!$pager) {
$pager = new KalturaFilterPager();
}
$userFilter = new kuserFilter();
$filter->toObject($userFilter);
$c = KalturaCriteria::create(kuserPeer::OM_CLASS);
$userFilter->attachToCriteria($c);
if (!is_null($filter->roleIdEqual)) {
$roleCriteria = new Criteria();
$roleCriteria->add(KuserToUserRolePeer::USER_ROLE_ID, $filter->roleIdEqual);
$roleCriteria->addSelectColumn(KuserToUserRolePeer::KUSER_ID);
$rs = KuserToUserRolePeer::doSelectStmt($roleCriteria);
$kuserIds = $rs->fetchAll(PDO::FETCH_COLUMN);
$c->add(kuserPeer::ID, $kuserIds, KalturaCriteria::IN);
}
$c->addAnd(kuserPeer::PUSER_ID, NULL, KalturaCriteria::ISNOTNULL);
$pager->attachToCriteria($c);
$list = kuserPeer::doSelect($c);
$totalCount = $c->getRecordsCount();
$newList = KalturaUserArray::fromUserArray($list);
$response = new KalturaUserListResponse();
$response->objects = $newList;
$response->totalCount = $totalCount;
return $response;
}
示例13: getListResponse
public function getListResponse(KalturaFilterPager $pager, KalturaDetachedResponseProfile $responseProfile = null)
{
if ($this->userIdIn) {
$usersIds = explode(',', $this->userIdIn);
$partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
$c = new Criteria();
$c->add(kuserPeer::PARTNER_ID, $partnerId, Criteria::EQUAL);
$c->add(kuserPeer::PUSER_ID, $usersIds, Criteria::IN);
$kusers = kuserPeer::doSelect($c);
$usersIds = array();
foreach ($kusers as $kuser) {
/* @var $kuser kuser */
$usersIds[] = $kuser->getId();
}
$this->userIdIn = implode(',', $usersIds);
}
if ($this->relatedGroupsByUserId) {
$partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
$userIds = array();
$c = new Criteria();
$c->add(kuserPeer::PARTNER_ID, $partnerId);
$c->add(kuserPeer::PUSER_ID, $this->relatedGroupsByUserId);
$c->add(kuserPeer::TYPE, KuserType::USER);
$kuser = kuserPeer::doSelectOne($c);
if (!$kuser) {
$response = new KalturaCategoryUserListResponse();
$response->objects = new KalturaCategoryUserArray();
$response->totalCount = 0;
return $response;
}
$kgroupIds = KuserKgroupPeer::retrieveKgroupIdsByKuserId($kuser->getId());
if (!is_null($kgroupIds) && is_array($kgroupIds)) {
$userIds = $kgroupIds;
}
$userIds[] = $kuser->getId();
// if userIdIn is also set in the filter need to intersect the two arrays.
if (isset($this->userIdIn)) {
$curUserIds = explode(',', $this->userIdIn);
$userIds = array_intersect($curUserIds, $userIds);
}
$this->userIdIn = implode(',', $userIds);
}
if ($this->userIdEqual) {
$partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
$c = new Criteria();
$c->add(kuserPeer::PARTNER_ID, $partnerId);
$c->add(kuserPeer::PUSER_ID, $this->userIdEqual);
if (kCurrentContext::$ks_partner_id == Partner::BATCH_PARTNER_ID) {
//batch should be able to get categoryUser of deleted users.
kuserPeer::setUseCriteriaFilter(false);
}
// in case of more than one deleted kusers - get the last one
$c->addDescendingOrderByColumn(kuserPeer::UPDATED_AT);
$kuser = kuserPeer::doSelectOne($c);
kuserPeer::setUseCriteriaFilter(true);
if (!$kuser) {
KalturaLog::debug('User not found');
$response = new KalturaCategoryUserListResponse();
$response->objects = new KalturaCategoryUserArray();
$response->totalCount = 0;
return $response;
}
$this->userIdEqual = $kuser->getId();
}
$categories = array();
if ($this->categoryIdEqual) {
$categories[] = categoryPeer::retrieveByPK($this->categoryIdEqual);
} elseif ($this->categoryIdIn) {
$categories = categoryPeer::retrieveByPKs(explode(',', $this->categoryIdIn));
}
$categoriesInheritanceRoot = array();
foreach ($categories as $category) {
/* @var $category category */
if (is_null($category)) {
continue;
}
if ($category->getInheritanceType() == InheritanceType::INHERIT) {
if ($this->categoryDirectMembers && kCurrentContext::$master_partner_id == Partner::BATCH_PARTNER_ID) {
$categoriesInheritanceRoot[$category->getId()] = $category->getId();
} else {
//if category inheris members - change filter to -> inherited from parent id = category->getIheritedParent
$categoriesInheritanceRoot[$category->getInheritedParentId()] = $category->getInheritedParentId();
}
} else {
$categoriesInheritanceRoot[$category->getId()] = $category->getId();
}
}
$this->categoryDirectMembers = null;
$this->categoryIdEqual = null;
$this->categoryIdIn = implode(',', $categoriesInheritanceRoot);
//if filter had categories that doesn't exists or not entitled - should return 0 objects.
if (count($categories) && !count($categoriesInheritanceRoot)) {
$response = new KalturaCategoryUserListResponse();
$response->totalCount = 0;
return $response;
}
$categoryKuserFilter = $this->toObject();
$c = KalturaCriteria::create(categoryKuserPeer::OM_CLASS);
$categoryKuserFilter->attachToCriteria($c);
$pager->attachToCriteria($c);
//.........这里部分代码省略.........
示例14: getLoggedInUserIds
/**
* Supports backward compatibility
* returns all kusers of the puser
*/
protected function getLoggedInUserIds()
{
$ret = array($this->getLoggedInPuserId());
$c = new Criteria();
$c->add(kuserPeer::PUSER_ID, $this->uid);
$kusers = kuserPeer::doSelect($c);
foreach ($kusers as $kuser) {
$ret[] = $kuser->getId();
}
return $ret;
}
示例15: listAction
/**
* List users (When not set in the filter, blocked and deleted users will be returned too)
*
* @action list
* @param KalturaUserFilter $filter
* @param KalturaFilterPager $pager
* @return KalturaUserListResponse
*/
public function listAction(KalturaUserFilter $filter = null, KalturaFilterPager $pager = null)
{
if (!$filter) {
$filter = new KalturaUserFilter();
}
if (!$pager) {
$pager = new KalturaFilterPager();
}
$userFilter = new kuserFilter();
$filter->toObject($userFilter);
$c = new Criteria();
$c->addAnd(kuserPeer::PUSER_ID, NULL, Criteria::ISNOTNULL);
$userFilter->attachToCriteria($c);
$totalCount = kuserPeer::doCount($c);
$pager->attachToCriteria($c);
$list = kuserPeer::doSelect($c);
$newList = KalturaUserArray::fromUserArray($list);
$response = new KalturaUserListResponse();
$response->objects = $newList;
$response->totalCount = $totalCount;
return $response;
}