public function getListResponse(KalturaFilterPager $pager, KalturaDetachedResponseProfile $responseProfile = null) { $userFilter = $this->toObject(); $c = KalturaCriteria::create(kuserPeer::OM_CLASS); $userFilter->attachToCriteria($c); if (!is_null($this->roleIdEqual)) { $roleCriteria = new Criteria(); $roleCriteria->add(KuserToUserRolePeer::USER_ROLE_ID, $this->roleIdEqual); $roleCriteria->addSelectColumn(KuserToUserRolePeer::KUSER_ID); $rs = KuserToUserRolePeer::doSelectStmt($roleCriteria); $kuserIds = $rs->fetchAll(PDO::FETCH_COLUMN); $c->add(kuserPeer::ID, $kuserIds, KalturaCriteria::IN); } if (is_null($this->typeEqual) && is_null($this->typeIn)) { $c->add(kuserPeer::TYPE, KuserType::USER, KalturaCriteria::EQUAL); } $c->addAnd(kuserPeer::PUSER_ID, NULL, KalturaCriteria::ISNOTNULL); $pager->attachToCriteria($c); $list = kuserPeer::doSelect($c); $totalCount = $c->getRecordsCount(); $newList = KalturaUserArray::fromDbArray($list, $responseProfile); $response = new KalturaUserListResponse(); $response->objects = $newList; $response->totalCount = $totalCount; return $response; }
/** * 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; }
/** * 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; }