本文整理汇总了PHP中kString::nameSplit方法的典型用法代码示例。如果您正苦于以下问题:PHP kString::nameSplit方法的具体用法?PHP kString::nameSplit怎么用?PHP kString::nameSplit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kString
的用法示例。
在下文中一共展示了kString::nameSplit方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: setFullName
public function setFullName($v)
{
// full_name column is deprecated
KalturaLog::ALERT('Field [full_name] on object [kuser] is deprecated');
list($firstName, $lastName) = kString::nameSplit($v);
$this->setFirstName($firstName);
$this->setLastName($lastName);
}
示例3: kuser
}
$lastUser = $user->getId();
KalturaLog::log('-- admin kuser id ' . $lastUser);
if ($user->getPartnerId() == PartnerPeer::GLOBAL_PARTNER) {
KalturaLog::log('Skipping partner 0');
continue;
}
$new_kuser = new kuser();
$new_login_data = new UserLoginData();
$partner = PartnerPeer::retrieveByPK($user->getPartnerId());
if (!$partner) {
KalturaLog::alert('!!! ERROR - Partner ID [' . $user->getPartnerId() . '] not found on DB but set for admin user id [' . $lastUser . '] !!!');
echo '!!! ERROR - Partner ID [' . $user->getPartnerId() . '] not found on DB but set for admin user id [' . $lastUser . '] !!!';
continue;
}
list($firstName, $lastName) = kString::nameSplit($user->getFullName());
$c = new Criteria();
$c->addAnd(UserLoginDataPeer::LOGIN_EMAIL, $user->getEmail());
$existing_login_data = UserLoginDataPeer::doSelectOne($c);
if ($existing_login_data) {
if ($user->getPartnerId() === $existing_login_data->getConfigPartnerId()) {
$checkKuser = kuserPeer::getByLoginDataAndPartner($existing_login_data->getId(), $user->getPartnerId());
if ($checkKuser && $checkKuser->getIsAdmin()) {
KalturaLog::notice('!!! NOTICE - Existing ADMIN login data found with id [' . $existing_login_data->getId() . '] partner [' . $existing_login_data->getConfigPartnerId() . '] - skipping user id [' . $lastUser . '] of partner [' . $user->getPartnerId() . '] since this was probably caused by a bug');
echo '!!! NOTICE - Existing ADMIN login data found with id [' . $existing_login_data->getId() . '] partner [' . $existing_login_data->getConfigPartnerId() . '] - skipping user id [' . $lastUser . '] of partner [' . $user->getPartnerId() . '] since this was probably caused by a bug';
continue;
}
}
KalturaLog::alert('!!! ERROR - Existing login data found with id [' . $existing_login_data->getId() . '] partner [' . $existing_login_data->getConfigPartnerId() . '] - skipping user id [' . $lastUser . '] of partner [' . $user->getPartnerId() . '] !!!!');
echo '!!! ERROR - Existing login data found with id [' . $existing_login_data->getId() . '] partner [' . $existing_login_data->getConfigPartnerId() . '] - skipping user id [' . $lastUser . '] of partner [' . $user->getPartnerId() . '] !!!!';
continue;
示例4: toObject
public function toObject($dbObject = null, $skip = array())
{
if (is_null($dbObject)) {
$dbObject = new kuser();
}
parent::toObject($dbObject, $skip);
// full name is deprecated and was split to firstName + lastName
// this is for backward compatibility with older clients
if ($this->fullName && !$this->firstName) {
list($firstName, $lastName) = kString::nameSplit($this->fullName);
$dbObject->setFirstName($firstName);
$dbObject->setLastName($lastName);
}
return $dbObject;
}
示例5: createNewAdminKuser
private function createNewAdminKuser($newPartner, $existing_password)
{
// generate a new password if not given
if ($existing_password != null) {
$password = $existing_password;
} else {
$password = UserLoginDataPeer::generateNewPassword();
}
// create the user
$kuser = new kuser();
$kuser->setEmail($newPartner->getAdminEmail());
list($firstName, $lastName) = kString::nameSplit($newPartner->getAdminName());
$kuser->setFirstName($firstName);
$kuser->setLastName($lastName);
$kuser->setPartnerId($newPartner->getId());
$kuser->setIsAdmin(true);
$kuser->setPuserId($newPartner->getAdminEmail());
$kuser = kuserPeer::addUser($kuser, $password, false, false);
//this also saves the kuser and adds a user_login_data record
$loginData = UserLoginDataPeer::retrieveByPK($kuser->getLoginDataId());
return array($password, $loginData->getPasswordHashKey(), $kuser->getId());
}