本文整理汇总了PHP中Partner::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Partner::save方法的具体用法?PHP Partner::save怎么用?PHP Partner::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Partner
的用法示例。
在下文中一共展示了Partner::save方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
public function store()
{
$partner = new Partner();
$partner->location_id = Auth::user()->location_id;
$partner->name = Input::get('name');
$partner->address = Input::get('address');
$partner->contact = Input::get('contact');
$partner->email = Input::get('email');
$partner->save();
Session::flash('message', 'Berhasil menambahkan Mitra Baru!');
}
示例2: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Partner();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Partner'])) {
$model->attributes = $_POST['Partner'];
if ($model->save()) {
$this->redirect(Yii::app()->request->baseUrl . '/partner/admin');
}
}
$this->render('create', array('model' => $model));
}
示例3: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Partner();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Partner'])) {
$model->attributes = $_POST['Partner'];
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->id));
}
}
$this->render('create', array('model' => $model));
}
示例4: testGetNumPrevPassToKeep
/**
* Tests UserLoginData->getNumPrevPassToKeep()
*/
public function testGetNumPrevPassToKeep()
{
$this->dummyPartner->setNumPrevPassToKeep(null);
$this->dummyPartner->save();
$this->assertEquals(kConf::get('user_login_num_prev_passwords_to_keep'), $this->UserLoginData->getNumPrevPassToKeep());
$this->dummyPartner->setNumPrevPassToKeep(5);
$this->dummyPartner->save();
$this->assertEquals(5, $this->UserLoginData->getNumPrevPassToKeep());
$this->dummyPartner->setNumPrevPassToKeep(null);
$this->dummyPartner->save();
$this->assertEquals(kConf::get('user_login_num_prev_passwords_to_keep'), $this->UserLoginData->getNumPrevPassToKeep());
$this->dummyPartner->setNumPrevPassToKeep(3);
$this->dummyPartner->save();
$this->assertEquals(3, $this->UserLoginData->getNumPrevPassToKeep());
}
示例5: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Partner();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model,'partner-form');
if (isset($_POST['Partner'])) {
$model->attributes = $_POST['Partner'];
if ($model->save()) {
$model->addDropboxFiles($this->uploadsession);
Yii::app()->session->remove($this->uploadsession);
$this->redirect(array('index'));
}
}
$this->render('create', array('model' => $model));
}
示例6: copyAccessControls
public static function copyAccessControls(Partner $fromPartner, Partner $toPartner)
{
$copiedList = array();
KalturaLog::log("Copying access control profiles from partner [" . $fromPartner->getId() . "] to partner [" . $toPartner->getId() . "]");
$c = new Criteria();
$c->add(accessControlPeer::PARTNER_ID, $fromPartner->getId());
$accessControls = accessControlPeer::doSelect($c);
foreach ($accessControls as $accessControl) {
$newAccessControl = $accessControl->copy();
$newAccessControl->setPartnerId($toPartner->getId());
$newAccessControl->save();
KalturaLog::log("Copied [" . $accessControl->getId() . "], new id is [" . $newAccessControl->getId() . "]");
$copiedList[$accessControl->getId()] = $newAccessControl->getId();
}
$toPartner->save();
// make sure access control profile is set on the new partner
if (!$toPartner->getDefaultAccessControlId()) {
$fromPartnerAccessControl = $fromPartner->getDefaultAccessControlId();
if ($fromPartnerAccessControl && key_exists($fromPartnerAccessControl, $copiedList)) {
$toPartner->setDefaultAccessControlId($copiedList[$fromPartnerAccessControl]);
$toPartner->save();
}
}
}
示例7: doSave
/**
* Performs the work of inserting or updating the row in the database.
*
* If the object is new, it inserts it; otherwise an update is performed.
* All related objects are also updated in this method.
*
* @param PropelPDO $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @see save()
*/
protected function doSave(PropelPDO $con)
{
$affectedRows = 0;
// initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
// We call the save method on the following object(s) if they
// were passed to this object by their coresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
if ($this->aLiveChannelSegmentRelatedByTriggerSegmentId !== null) {
if ($this->aLiveChannelSegmentRelatedByTriggerSegmentId->isModified() || $this->aLiveChannelSegmentRelatedByTriggerSegmentId->isNew()) {
$affectedRows += $this->aLiveChannelSegmentRelatedByTriggerSegmentId->save($con);
}
$this->setLiveChannelSegmentRelatedByTriggerSegmentId($this->aLiveChannelSegmentRelatedByTriggerSegmentId);
}
if ($this->aPartner !== null) {
if ($this->aPartner->isModified() || $this->aPartner->isNew()) {
$affectedRows += $this->aPartner->save($con);
}
$this->setPartner($this->aPartner);
}
if ($this->aentryRelatedByChannelId !== null) {
if ($this->aentryRelatedByChannelId->isModified() || $this->aentryRelatedByChannelId->isNew()) {
$affectedRows += $this->aentryRelatedByChannelId->save($con);
}
$this->setentryRelatedByChannelId($this->aentryRelatedByChannelId);
}
if ($this->aentryRelatedByEntryId !== null) {
if ($this->aentryRelatedByEntryId->isModified() || $this->aentryRelatedByEntryId->isNew()) {
$affectedRows += $this->aentryRelatedByEntryId->save($con);
}
$this->setentryRelatedByEntryId($this->aentryRelatedByEntryId);
}
if ($this->isNew()) {
$this->modifiedColumns[] = LiveChannelSegmentPeer::ID;
}
// If this object has been modified, then save it to the database.
$this->objectSaved = false;
if ($this->isModified()) {
if ($this->isNew()) {
$pk = LiveChannelSegmentPeer::doInsert($this, $con);
$affectedRows += 1;
// we are assuming that there is only 1 row per doInsert() which
// should always be true here (even though technically
// BasePeer::doInsert() can insert multiple rows).
$this->setId($pk);
//[IMV] update autoincrement primary key
$this->setNew(false);
$this->objectSaved = true;
} else {
$affectedObjects = LiveChannelSegmentPeer::doUpdate($this, $con);
if ($affectedObjects) {
$this->objectSaved = true;
}
$affectedRows += $affectedObjects;
}
$this->resetModified();
// [HL] After being saved an object is no longer 'modified'
}
if ($this->collLiveChannelSegmentsRelatedByTriggerSegmentId !== null) {
foreach ($this->collLiveChannelSegmentsRelatedByTriggerSegmentId as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
$this->alreadyInSave = false;
}
return $affectedRows;
}
示例8: testListAction
/**
* Tests UserService->listAction()
*/
public function testListAction()
{
// check list by isAdmin and loginEnabled
$this->dummyPartner->setAdminLoginUsersQuota(30);
$this->dummyPartner->save();
$this->startSession(KalturaSessionType::ADMIN, null);
$adminLoginNum = 2;
$normalNoLoginNum = 3;
$normalLoginNum = 4;
$adminLogin = array();
for ($i = 0; $i < $adminLoginNum; $i++) {
$newUser = $this->createUser(true, true, 'adminLogin');
$this->addUser($newUser);
$adminLogin[] = $newUser;
}
$normalNoLogin = array();
for ($i = 0; $i < $normalNoLoginNum; $i++) {
$newUser = $this->createUser(false, false, 'normalNoLogin');
$this->addUser($newUser);
$normalNoLogin[] = $newUser;
}
$normalLogin = array();
for ($i = 0; $i < $normalLoginNum; $i++) {
$newUser = $this->createUser(true, false, 'normalLogin');
$this->addUser($newUser);
$normalLogin[] = $newUser;
}
$adminNoLoginFilter = new KalturaUserFilter();
$adminNoLoginFilter->isAdminEqual = true;
$adminNoLoginFilter->loginEnabledEqual = false;
$adminLoginFilter = new KalturaUserFilter();
$adminLoginFilter->isAdminEqual = true;
$adminLoginFilter->loginEnabledEqual = true;
$normalNoLoginFilter = new KalturaUserFilter();
$normalNoLoginFilter->isAdminEqual = false;
$normalNoLoginFilter->loginEnabledEqual = false;
$normalLoginFilter = new KalturaUserFilter();
$normalLoginFilter->isAdminEqual = false;
$normalLoginFilter->loginEnabledEqual = true;
$adminNoLoginList = $this->client->user->listAction($adminNoLoginFilter);
$adminLoginList = $this->client->user->listAction($adminLoginFilter);
$normalNoLoginList = $this->client->user->listAction($normalNoLoginFilter);
$normalLoginList = $this->client->user->listAction($normalLoginFilter);
// verify number of users
$this->assertEquals(0, count($adminNoLoginList->objects));
$this->assertEquals(0, $adminNoLoginList->totalCount);
$this->assertEquals($adminLoginNum + 1, count($adminLoginList->objects));
// 1 admin login user already existed
$this->assertEquals($adminLoginNum + 1, $adminLoginList->totalCount);
$this->assertEquals($normalNoLoginNum, count($normalNoLoginList->objects));
$this->assertEquals($normalNoLoginNum, $normalNoLoginList->totalCount);
$this->assertEquals($normalLoginNum, count($normalLoginList->objects));
$this->assertEquals($normalLoginNum, $normalLoginList->totalCount);
for ($i = 0; $i < $adminLoginNum; $i++) {
//$this->assertEquals($adminLogin[$i]->id, $adminLoginList->objects[$i+1]->id);
}
for ($i = 0; $i < $normalNoLoginNum; $i++) {
$this->assertEquals($normalNoLogin[$i]->id, $normalNoLoginList->objects[$i]->id);
}
for ($i = 0; $i < $normalLoginNum; $i++) {
$this->assertEquals($normalLogin[$i]->id, $normalLoginList->objects[$i]->id);
}
$listResponse = $this->client->user->listAction();
$allUsers = $listResponse->objects;
foreach ($allUsers as $user) {
// check that all returned users are of type KalturaUser
$this->assertType('KalturaUser', $user);
// check that only current partner's users were returned
$this->assertEquals(self::TEST_PARTNER_ID, $user->partnerId);
// check that deleted users are not returned
$this->assertNotEquals(KalturaUserStatus::DELETED, $user->status);
}
// check that total count is right
$this->assertEquals(count($allUsers), $listResponse->totalCount);
}
示例9: 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;
}
示例10: 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;
}