本文整理汇总了PHP中Partner::setMonitorUsage方法的典型用法代码示例。如果您正苦于以下问题:PHP Partner::setMonitorUsage方法的具体用法?PHP Partner::setMonitorUsage怎么用?PHP Partner::setMonitorUsage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Partner
的用法示例。
在下文中一共展示了Partner::setMonitorUsage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createNewPartner
private function createNewPartner($parnter_name, $contact, $email, $ID_is_for, $SDK_terms_agreement, $description, $website_url, $password = null, $partner = null)
{
$secret = md5($this->str_makerand(5, 10, true, false, true));
$admin_secret = md5($this->str_makerand(5, 10, true, false, true));
$newPartner = new Partner();
if ($parnter_name) {
$newPartner->setPartnerName($parnter_name);
}
$newPartner->setAdminSecret($admin_secret);
$newPartner->setSecret($secret);
$newPartner->setAdminName($contact);
$newPartner->setAdminEmail($email);
$newPartner->setUrl1($website_url);
if ($ID_is_for === "commercial_use" || $ID_is_for === CommercialUseType::COMMERCIAL_USE) {
$newPartner->setCommercialUse(true);
} else {
//($ID_is_for == "non-commercial_use") || $ID_is_for === CommercialUseType::NON_COMMERCIAL_USE)
$newPartner->setCommercialUse(false);
}
$newPartner->setDescription($description);
$newPartner->setKsMaxExpiryInSeconds(86400);
$newPartner->setModerateContent(false);
$newPartner->setNotify(false);
$newPartner->setAppearInSearch(mySearchUtils::DISPLAY_IN_SEARCH_KALTURA_NETWORK);
$newPartner->setIsFirstLogin(true);
/* fix drupal5 module partner type */
//var_dump($description);
if ($this->partnerParentId) {
// this is a child partner of some VAR/partner GROUP
$newPartner->setPartnerParentId($this->partnerParentId);
$newPartner->setMonitorUsage(0);
}
if (substr_count($description, 'Drupal module|')) {
$newPartner->setType(102);
if ($partner) {
$partner->setType(102);
}
}
if ($partner) {
if ($partner->getType()) {
$newPartner->setType($partner->getType());
}
if ($partner->getContentCategories()) {
$newPartner->setContentCategories($partner->getContentCategories());
}
if ($partner->getPhone()) {
$newPartner->setPhone($partner->getPhone());
}
if ($partner->getDescribeYourself()) {
$newPartner->setDescribeYourself($partner->getDescribeYourself());
}
if ($partner->getAdultContent()) {
$newPartner->setAdultContent($partner->getAdultContent());
}
if ($partner->getDefConversionProfileType()) {
$newPartner->setDefConversionProfileType($partner->getDefConversionProfileType());
}
// new fields of registration form
if ($partner->getFirstName()) {
$newPartner->setFirstName($partner->getFirstName());
}
if ($partner->getLastName()) {
$newPartner->setLastName($partner->getLastName());
}
if ($partner->getCountry()) {
$newPartner->setCountry($partner->getCountry());
}
if ($partner->getState()) {
$newPartner->setState($partner->getState());
}
if ($partner->getAdditionalParams() && is_array($partner->getAdditionalParams()) && count($partner->getAdditionalParams())) {
$newPartner->setAdditionalParams($partner->getAdditionalParams());
}
}
$newPartner->save();
// if name was left empty - which should not happen - use id as name
if (!$parnter_name) {
$parnter_name = $newPartner->getId();
}
$newPartner->setPartnerName($parnter_name);
$newPartner->setPrefix($newPartner->getId());
$newPartner->setPartnerAlias(md5($newPartner->getId() . 'kaltura partner'));
// set default conversion profile for trial accounts
if ($newPartner->getType() == Partner::PARTNER_TYPE_KMC) {
$newPartner->setDefConversionProfileType(ConversionProfile::DEFAULT_TRIAL_COVERSION_PROFILE_TYPE);
}
$newPartner->save();
$partner_id = $newPartner->getId();
widget::createDefaultWidgetForPartner($partner_id, $this->createNewSubPartner($newPartner));
$fromPartner = PartnerPeer::retrieveByPK(kConf::get("template_partner_id"));
if (!$fromPartner) {
KalturaLog::log("Template content partner was not found!");
} else {
myPartnerUtils::copyTemplateContent($fromPartner, $newPartner, true);
}
$newPartner->setKmcVersion(kConf::get('new_partner_kmc_version'));
$newPartner->save();
return $newPartner;
}
示例2: createNewPartner
/**
* Function creates new partner, saves all the required data to it, and copies objects & filesyncs of template content to its ID.
* @param string $partner_name
* @param string $contact
* @param string $email
* @param CommercialUseType $ID_is_for
* @param string $SDK_terms_agreement
* @param string $description
* @param string $website_url
* @param string $password
* @param Partner $partner
* @param int $templatePartnerId
* @return Partner
*/
private function createNewPartner($partner_name, $contact, $email, $ID_is_for, $SDK_terms_agreement, $description, $website_url, $password = null, $newPartner = null, $templatePartnerId = null)
{
$secret = md5($this->str_makerand(5, 10, true, false, true));
$admin_secret = md5($this->str_makerand(5, 10, true, false, true));
if (!$newPartner) {
$newPartner = new Partner();
}
if ($partner_name) {
$newPartner->setPartnerName($partner_name);
}
$newPartner->setAdminSecret($admin_secret);
$newPartner->setSecret($secret);
$newPartner->setAdminName($contact);
$newPartner->setAdminEmail($email);
$newPartner->setUrl1($website_url);
if ($ID_is_for === "commercial_use" || $ID_is_for === CommercialUseType::COMMERCIAL_USE) {
$newPartner->setCommercialUse(true);
} else {
//($ID_is_for == "non-commercial_use") || $ID_is_for === CommercialUseType::NON_COMMERCIAL_USE)
$newPartner->setCommercialUse(false);
}
$newPartner->setDescription($description);
$newPartner->setKsMaxExpiryInSeconds(86400);
$newPartner->setModerateContent(false);
$newPartner->setNotify(false);
$newPartner->setAppearInSearch(mySearchUtils::DISPLAY_IN_SEARCH_PARTNER_ONLY);
$newPartner->setIsFirstLogin(true);
/* fix drupal5 module partner type */
//var_dump($description);
if ($this->partnerParentId) {
// this is a child partner of some VAR/partner GROUP
$newPartner->setPartnerParentId($this->partnerParentId);
$newPartner->setMonitorUsage(PartnerFreeTrialType::NO_LIMIT);
$parentPartner = PartnerPeer::retrieveByPK($this->partnerParentId);
$newPartner->setPartnerPackage($parentPartner->getPartnerPackage());
}
if (substr_count($description, 'Drupal module|')) {
$newPartner->setType(102);
}
$newPartner->save();
// if name was left empty - which should not happen - use id as name
if (!$partner_name) {
$partner_name = $newPartner->getId();
}
$newPartner->setPartnerName($partner_name);
$newPartner->setPrefix($newPartner->getId());
$newPartner->setPartnerAlias(md5($newPartner->getId() . 'kaltura partner'));
// set default conversion profile for trial accounts
if ($newPartner->getType() == Partner::PARTNER_TYPE_KMC) {
$newPartner->setDefConversionProfileType(ConversionProfile::DEFAULT_TRIAL_COVERSION_PROFILE_TYPE);
}
$newPartner->save();
// remove the default criteria from all peers and recreate it with the right partner id
myPartnerUtils::resetAllFilters();
myPartnerUtils::applyPartnerFilters($newPartner->getId(), true);
$partner_id = $newPartner->getId();
widget::createDefaultWidgetForPartner($partner_id, $this->createNewSubPartner($newPartner));
$fromPartner = PartnerPeer::retrieveByPK($templatePartnerId ? $templatePartnerId : kConf::get("template_partner_id"));
if (!$fromPartner) {
KalturaLog::log("Template content partner was not found!");
} else {
$newPartner->setI18nTemplatePartnerId($templatePartnerId);
myPartnerUtils::copyTemplateContent($fromPartner, $newPartner, true);
}
if ($newPartner->getType() == Partner::PARTNER_TYPE_WORDPRESS) {
kPermissionManager::setPs2Permission($newPartner);
}
$newPartner->setKmcVersion(kConf::get('new_partner_kmc_version'));
$newPartner->save();
return $newPartner;
}