本文整理汇总了PHP中kuserPeer::retrieveByPK方法的典型用法代码示例。如果您正苦于以下问题:PHP kuserPeer::retrieveByPK方法的具体用法?PHP kuserPeer::retrieveByPK怎么用?PHP kuserPeer::retrieveByPK使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kuserPeer
的用法示例。
在下文中一共展示了kuserPeer::retrieveByPK方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendEmailAlert
public function sendEmailAlert()
{
$this->kuser = kuserPeer::retrieveByPK($this->getKuserId());
if ($this->kuser) {
kJobsManager::addMailJob(null, 0, $this->kuser->getPartnerId(), $this->getAlertType(), kMailJobData::MAIL_PRIORITY_NORMAL, kconf::get("batch_notification_sender_email"), kconf::get("batch_notification_sender_name"), $this->kuser->getEmail(), $this->getBodyParamsArray(), $this->getSubjectParamsArray());
}
}
示例2: addFavorite
/**
const SUBJECT_TYPE_KSHOW = '1';
const SUBJECT_TYPE_ENTRY = '2';
const SUBJECT_TYPE_USER = '3';
*/
public static function addFavorite(favorite $favorite)
{
self::add($favorite);
$type = $favorite->getSubjectType();
$id = $favorite->getSubjectId();
if ($type == favorite::SUBJECT_TYPE_ENTRY) {
$obj = entryPeer::retrieveByPK($id);
if ($obj) {
$v = $obj->getFavorites();
self::inc($v);
$obj->setFavorites($v);
}
} elseif ($type == favorite::SUBJECT_TYPE_KSHOW) {
$obj = kshowPeer::retrieveByPK($id);
if ($obj) {
$v = $obj->getFavorites();
self::inc($v);
$obj->setFavorites($v);
}
} elseif ($type == favorite::SUBJECT_TYPE_USER) {
$obj = kuserPeer::retrieveByPK($id);
if ($obj) {
$v = $obj->getFans();
self::inc($v);
$obj->setFans($v);
}
}
// don't forget to save the modified object
self::add($obj);
}
示例3: tearDown
/**
* Cleans up the environment after running a test.
*/
protected function tearDown()
{
kuserPeer::clearInstancePool();
UserLoginDataPeer::clearInstancePool();
kuserPeer::setDefaultCriteriaFilter(false);
UserLoginDataPeer::setUseCriteriaFilter(false);
$this->clientConfig = null;
$this->client = null;
$this->nextUserId = null;
foreach ($this->createdDbObjects as $obj) {
try {
if (get_class($obj) == 'kuser') {
$updated = kuserPeer::retrieveByPK($obj->getId());
if ($updated) {
$loginData = UserLoginDataPeer::retrieveByPK($updated->getLoginDataId());
if ($loginData) {
$loginData->delete();
}
}
}
$obj->delete();
} catch (PropelException $e) {
}
}
parent::tearDown();
}
示例4: getPuserId
/**
* @return string $puserId
*/
public function getPuserId()
{
if (!$this->puserId) {
if (!$this->getKuserId()) {
return null;
}
$kuser = kuserPeer::retrieveByPK($this->getKuserId());
$this->puserId = $kuser->getPuserId();
}
return $this->puserId;
}
示例5: createPuserKuser
/**
Returns newly created puser - after creating it's corresponding kuser.
If the puser_kuser already exists && $verify_not_exists==true , don't create a new one and return the existing one
*/
public static function createPuserKuser($partner_id, $subp_id, $puser_id, $kuser_name, $puser_name, $create_kuser = false, $kuser = null)
{
$puser_kuser = self::retrieveByPartnerAndUid($partner_id, $subp_id, $puser_id, true);
if (!$kuser) {
$kuser = kuserPeer::getKuserByPartnerAndUid($partner_id, $puser_id, true);
// don't create an existing kuser!
}
if ($puser_kuser) {
if (!$create_kuser) {
// if the puser_kuser already exists - don't re-create it
$puser_kuser->exists = true;
return $puser_kuser;
} else {
// puser_kuser exists but it's OK
// this might be the case where we don't mind creating a new one each time
}
} else {
$puser_kuser = new PuserKuser();
}
$c = new Criteria();
$c->add(self::PARTNER_ID, $partner_id);
$c->add(self::PUSER_ID, $puser_id);
$partner_puser_kuser = self::doSelectOne($c);
if ($kuser !== null) {
$kuser_id = $kuser->getId();
} else {
if ($partner_puser_kuser) {
$kuser_id = $partner_puser_kuser->getKuserId();
$kuser = kuserPeer::retrieveByPK($kuser_id);
} else {
// create kuser for this puser
$kuser = new kuser();
$kuser->setScreenName($kuser_name);
list($firstName, $lastName) = kString::nameSplit($kuser_name);
$kuser->setFirstName($firstName);
$kuser->setLastName($lastName);
$kuser->setPartnerId($partner_id);
// set puserId for forward compatibility with PS3
$kuser->setPuserId($puser_id);
$kuser->setStatus(KuserStatus::ACTIVE);
// so he won't appear in the search
$kuser->save();
$kuser_id = $kuser->getId();
}
}
$puser_kuser->setPartnerId($partner_id);
$puser_kuser->setSubpId($subp_id);
$puser_kuser->setPuserId($puser_id);
$puser_kuser->setKuserId($kuser_id);
$puser_kuser->setPuserName($puser_name);
$puser_kuser->save();
$puser_kuser->setkuser($kuser);
return $puser_kuser;
}
示例6: retrieveSubject
function retrieveSubject($type, $id)
{
switch ($type) {
case flag::SUBJECT_TYPE_ENTRY:
$entry = entryPeer::retrieveByPK($id);
return 'entry id:' . $id . '<br/>kshow:' . returnKshowLink($entry->getKshowId()) . '<br/>Name:' . $entry->getName();
case flag::SUBJECT_TYPE_USER:
$user = kuserPeer::retrieveByPK($id);
return returnUserLink($user->getScreenName());
case flag::SUBJECT_TYPE_COMMENT:
$comment = commentPeer::retrieveByPK($id);
return 'comment id:' . $id . '<br/>Commnet:' . $comment->getComment();
default:
return 'Unknown';
}
}
示例7: sendRegistrationInformationForPartner
public function sendRegistrationInformationForPartner($partner, $skip_emails, $existingUser)
{
// email the client with this info
$adminKuser = kuserPeer::retrieveByPK($partner->getAccountOwnerKuserId());
$this->sendRegistrationInformation($partner, $adminKuser, $existingUser, null, $partner->getType());
if (!$skip_emails && kConf::hasParam("report_partner_registration") && kConf::get("report_partner_registration")) {
// email the wikisupport@kaltura.com with this info
$this->sendRegistrationInformation($partner, $adminKuser, $existingUser, self::KALTURA_SUPPORT);
// if need to hook into SalesForce - this is the place
if (include_once "mySalesForceUtils.class.php") {
mySalesForceUtils::sendRegistrationInformationToSalesforce($partner);
}
// if need to hook into Marketo - this is the place
if (include_once "myMarketoUtils.class.php") {
myMarketoUtils::sendRegistrationInformation($partner);
}
}
}
示例8: testMigration
/**
* @dataProvider providerTestMigration
*/
public function testMigration($kuserId)
{
$this->assertNull($this->kuser);
$this->kuser = kuserPeer::retrieveByPK($kuserId);
$this->assertNotNull($this->kuser);
$this->assertEquals($this->kuser->getFullName(), trim($this->kuser->getFirstName() . ' ' . $this->kuser->getLastName()));
if ($this->kuser->getSalt() && $this->kuser->getSha1Password() && in_array($this->kuser->getPartnerId(), $this->loginPartnerIds)) {
$this->assertTrue($this->kuser->getLoginDataId());
$loginData1 = UserLoginDataPeer::retrieveByPK($this->kuser->getLoginDataId());
$this->assertNotNull($loginData1);
$loginData2 = UserLoginDataPeer::getByEmail($this->kuser->getEmail());
$this->assertNotNull($loginData2);
$this->assertEquals($loginData1->getId(), $loginData2->getId());
$this->assertEquals($this->kuser->getSalt(), $loginData2->getSalt());
$this->assertEquals($this->kuser->getSha1Password(), $loginData2->getSha1Password());
$this->assertEquals($this->kuser->getEmail(), $loginData2->getLoginEmail());
$c = new Criteria();
$c->addAnd(UserLoginDataPeer::LOGIN_EMAIL, $this->kuser->getEmail());
$loginDatas = UserLoginDataPeer::doSelect($c);
$this->assertEquals(count($loginDatas), 1);
$this->assertEquals($loginDatas[0]->getId(), $loginData1->getId());
$allKusers = kuserPeer::getByLoginDataAndPartner($this->kuser->getLoginDataId(), $this->kuser->getPartnerId());
$this->assertEquals(count($allKusers), 1);
} else {
if ($this->kuser->getPartnerId() != $this->adminConsolePartnerId && substr($this->kuser->getPuserId(), 0, 9) != '__ADMIN__') {
$this->assertNull($this->kuser->getLoginDataId());
}
}
if ($this->kuser->getPartnerId() == $this->adminConsolePartnerId || substr($this->kuser->getPuserId(), 0, 9) == '__ADMIN__') {
$this->assertTrue($this->kuser->getIsAdmin());
} else {
$this->assertFalse($this->kuser->getIsAdmin());
}
if ($this->kuser->getIsAdmin()) {
$this->assertTrue($this->kuser->getIsAdmin());
}
}
示例9: 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();
}
示例10: getPuserId
public function getPuserId()
{
if (!$this->puserId) {
$kuser = kuserPeer::retrieveByPK($this->getKuserId());
if ($kuser) {
$this->puserId = $kuser->getPuserId();
}
}
return $this->puserId;
}
示例11: doFromObject
public function doFromObject($dbCuePoint, KalturaDetachedResponseProfile $responseProfile = null)
{
parent::doFromObject($dbCuePoint, $responseProfile);
if ($this->shouldGet('userId', $responseProfile)) {
if ($dbCuePoint->getKuserId() !== null) {
$dbKuser = kuserPeer::retrieveByPK($dbCuePoint->getKuserId());
if ($dbKuser) {
if (!kConf::hasParam('protect_userid_in_api') || !in_array($dbCuePoint->getPartnerId(), kConf::get('protect_userid_in_api')) || !in_array(kCurrentContext::getCurrentSessionType(), array(kSessionBase::SESSION_TYPE_NONE, kSessionBase::SESSION_TYPE_WIDGET))) {
$this->userId = $dbKuser->getPuserId();
}
}
}
}
}
示例12: getAggregateDataForUsers
/**
* @param $answers
* @param $orderBy
* @return array
*/
protected function getAggregateDataForUsers($answers, $orderBy)
{
$ans = array();
$usersCorrectAnswers = array();
$usersWrongAnswers = array();
foreach ($answers as $answer) {
/**
* @var AnswerCuePoint $answer
*/
$quizUserEntryId = $answer->getQuizUserEntryId();
if ($this->isQuizUserEntrySubmitted($quizUserEntryId)) {
if ($answer->getIsCorrect()) {
if (isset($usersCorrectAnswers[$answer->getKuserId()])) {
$usersCorrectAnswers[$answer->getKuserId()]++;
} else {
$usersCorrectAnswers[$answer->getKuserId()] = 1;
}
} else {
if (isset($usersWrongAnswers[$answer->getKuserId()])) {
$usersWrongAnswers[$answer->getKuserId()]++;
} else {
$usersWrongAnswers[$answer->getKuserId()] = 1;
}
}
}
}
foreach (array_merge(array_keys($usersCorrectAnswers), array_keys($usersWrongAnswers)) as $kuserId) {
$totalAnswers = 0;
$totalCorrect = 0;
if (isset($usersCorrectAnswers[$kuserId])) {
$totalAnswers += $usersCorrectAnswers[$kuserId];
$totalCorrect = $usersCorrectAnswers[$kuserId];
}
if (isset($usersWrongAnswers[$kuserId])) {
$totalAnswers += $usersWrongAnswers[$kuserId];
}
$userId = "unknown-user";
$dbKuser = kuserPeer::retrieveByPK($kuserId);
if ($dbKuser) {
$userId = $dbKuser->getPuserId();
}
$ans[$userId] = array('user_id' => $userId, 'percentage' => $totalCorrect / $totalAnswers * 100, 'num_of_correct_answers' => $totalCorrect, 'num_of_wrong_answers' => $totalAnswers - $totalCorrect);
}
uasort($ans, $this->getSortFunction($orderBy));
$ans = array_values($ans);
return $ans;
}
示例13: Zend_Config_Ini
$loggerConfigPath = ROOT_DIR . '/scripts/logger.ini';
$config = new Zend_Config_Ini($loggerConfigPath);
KalturaLog::initLog($config);
KalturaLog::setContext(basename(__FILE__));
KalturaLog::info("Starting script");
KalturaLog::info("Initializing database...");
DbManager::setConfig(kConf::getDB());
DbManager::initialize();
KalturaLog::info("Database initialized successfully");
$syncType = 'kuser';
$dbh = myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_DWH);
$sql = "CALL get_data_for_operational('{$syncType}')";
$count = 0;
$rows = $dbh->query($sql)->fetchAll();
foreach ($rows as $row) {
$kuser = kuserPeer::retrieveByPK($row['kuser_id']);
if (is_null($kuser)) {
KalturaLog::err('Couldn\'t find kuser [' . $row['kuser_id'] . ']');
continue;
}
$kuser->setStorageSize($row['storage_size']);
$kuser->save();
$count++;
KalturaLog::debug('Successfully saved kuser [' . $row['kuser_id'] . ']');
if ($count % 500) {
kuserPeer::clearInstancePool();
}
}
$sql = "CALL mark_operational_sync_as_done('{$syncType}')";
$dbh->query($sql);
KalturaLog::debug("Done updating {$count} kusers from DWH to operational DB");
示例14: getEmailById
/**
* @param int $id
* @return string
*/
public static function getEmailById($id)
{
$kuser = kuserPeer::retrieveByPK($id);
return $kuser->getEmail();
}
示例15: getRootObjects
public function getRootObjects(IBaseObject $object)
{
return array(kuserPeer::retrieveByPK($object->getKuserId()), kuserPeer::retrieveByPK($object->getKgroupId()));
}