• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ExplicitReadWriteModelPermissionsUtil类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中ExplicitReadWriteModelPermissionsUtil的典型用法代码示例。如果您正苦于以下问题:PHP ExplicitReadWriteModelPermissionsUtil类的具体用法?PHP ExplicitReadWriteModelPermissionsUtil怎么用?PHP ExplicitReadWriteModelPermissionsUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ExplicitReadWriteModelPermissionsUtil类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: makeReportBySavedCalendar

 /**
  * @param $savedCalendar
  * @return Report
  */
 public static function makeReportBySavedCalendar(SavedCalendar $savedCalendar)
 {
     $report = new Report();
     if ($savedCalendar->id > 0) {
         $report->setId((int) $savedCalendar->id);
     }
     $report->setDescription($savedCalendar->description);
     if ($savedCalendar->moduleClassName != null) {
         $report->setModuleClassName($savedCalendar->moduleClassName);
     }
     if ($savedCalendar->name != null) {
         $report->setName($savedCalendar->name);
     }
     $report->setOwner($savedCalendar->owner);
     $report->setType(Report::TYPE_ROWS_AND_COLUMNS);
     $explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem($savedCalendar);
     $report->setExplicitReadWriteModelPermissions($explicitReadWriteModelPermissions);
     if ($savedCalendar->serializedData != null) {
         $unserializedData = unserialize($savedCalendar->serializedData);
         if (isset($unserializedData['filtersStructure'])) {
             $report->setFiltersStructure($unserializedData['filtersStructure']);
         }
         CalendarUtil::makeComponentFormAndPopulateReportFromData($unserializedData[ComponentForReportForm::TYPE_FILTERS], $report, 'Filter');
     }
     return $report;
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:30,代码来源:SavedCalendarToReportAdapter.php


示例2: resolveAndMakeExplicitReadWriteModelPermissions

 protected static function resolveAndMakeExplicitReadWriteModelPermissions($sanitizedData, $model)
 {
     if ($model instanceof SecurableItem) {
         return ExplicitReadWriteModelPermissionsUtil::resolveByPostDataAndModelThenMake($sanitizedData, $model);
     } else {
         return null;
     }
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:8,代码来源:ZurmoControllerUtil.php


示例3: getExplicitReadWriteModelPermissions

 protected function getExplicitReadWriteModelPermissions()
 {
     if ($this->explicitReadWriteModelPermissions != null) {
         return $this->explicitReadWriteModelPermissions;
     }
     $this->explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem($this->model);
     return $this->explicitReadWriteModelPermissions;
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:8,代码来源:DerivedExplicitReadWriteModelPermissionsElement.php


示例4: __construct

 public function __construct(Import $import, ImportDataProvider $dataProvider)
 {
     $unserializedData = unserialize($import->serializedData);
     $this->import = $import;
     $this->mappingData = $unserializedData['mappingData'];
     $this->importRules = ImportRulesUtil::makeImportRulesByType($unserializedData['importRulesType']);
     $this->dataProvider = $dataProvider;
     if (isset($unserializedData['explicitReadWriteModelPermissions'])) {
         $this->explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeByMixedPermitablesData($unserializedData['explicitReadWriteModelPermissions']);
     } else {
         $this->explicitReadWriteModelPermissions = new ExplicitReadWriteModelPermissions();
     }
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:13,代码来源:ImportCreateUpdateModelsSequentialProcess.php


示例5: setContactModelPermissionsByContactWebForm

 public static function setContactModelPermissionsByContactWebForm(SecurableItem $model, ContactWebForm $contactWebForm)
 {
     if ($model instanceof SecurableItem && count($model->permissions) === 0) {
         $defaultPermission = ContactWebFormAdapter::resolveAndGetDefaultPermissionSetting($contactWebForm);
         $nonEveryoneGroup = $contactWebForm->defaultPermissionGroupSetting;
         $type = DerivedExplicitReadWriteModelPermissionsElement::resolveUserPermissionConfigurationToPermissionType($defaultPermission);
         $postData = array('explicitReadWriteModelPermissions' => compact('type', 'nonEveryoneGroup'));
         $explicitReadWritePermissions = self::resolveAndMakeExplicitReadWriteModelPermissions($postData, $model);
         $updated = ExplicitReadWriteModelPermissionsUtil::resolveExplicitReadWriteModelPermissions($model, $explicitReadWritePermissions);
         if (!$updated) {
             throw new NotSupportedException();
         }
     }
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:14,代码来源:ContactWebFormsZurmoControllerUtil.php


示例6: makeAll

 /**
  * @param DemoDataHelper $demoDataHelper
  */
 public function makeAll(&$demoDataHelper)
 {
     assert('$demoDataHelper instanceof DemoDataHelper');
     assert('$demoDataHelper->isSetRange("User")');
     assert('$demoDataHelper->isSetRange("Account")');
     $conversations = array();
     foreach (self::getConversationData() as $randomConversationData) {
         $postData = array();
         $conversation = new Conversation();
         $conversation->setScenario('importModel');
         $conversation->owner = $demoDataHelper->getRandomByModelName('User');
         $conversation->createdByUser = $conversation->owner;
         $conversation->conversationItems->add($demoDataHelper->getRandomByModelName('Account'));
         $conversation->subject = $randomConversationData['subject'];
         $conversation->description = $randomConversationData['description'];
         //Add some comments
         foreach ($randomConversationData['comments'] as $commentDescription) {
             $comment = new Comment();
             $comment->setScenario('importModel');
             $comment->createdByUser = $demoDataHelper->getRandomByModelName('User');
             $comment->description = $commentDescription;
             $conversation->comments->add($comment);
             self::addItemIdToPostData($postData, $comment->createdByUser->getClassId('Item'));
         }
         //Add Super user
         $comment = new Comment();
         $comment->description = 'Great idea guys. Keep it coming.';
         $conversation->comments->add($comment);
         self::addItemIdToPostData($postData, Yii::app()->user->userModel->getClassId('Item'));
         $saved = $conversation->save();
         assert('$saved');
         //any user who has made a comment should be added as a participant and resolve permissions
         $explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem($conversation);
         ConversationParticipantsUtil::resolveConversationHasManyParticipantsFromPost($conversation, $postData, $explicitReadWriteModelPermissions);
         $saved = $conversation->save();
         assert('$saved');
         $success = ExplicitReadWriteModelPermissionsUtil::resolveExplicitReadWriteModelPermissions($conversation, $explicitReadWriteModelPermissions);
         $saved = $conversation->save();
         assert('$success');
         $conversations[] = $conversation->id;
     }
     $demoDataHelper->setRangeByModelName('Conversation', $conversations[0], $conversations[count($conversations) - 1]);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:46,代码来源:ConversationsDemoDataMaker.php


示例7: actionInlineEditValidate

 protected function actionInlineEditValidate($model)
 {
     $readyToUsePostData = ExplicitReadWriteModelPermissionsUtil::removeIfExistsFromPostData($_POST[get_class($model)]);
     $sanitizedPostData = PostUtil::sanitizePostByDesignerTypeForSavingModel($model, $readyToUsePostData);
     $sanitizedOwnerPostData = PostUtil::sanitizePostDataToJustHavingElementForSavingModel($sanitizedPostData, 'owner');
     $sanitizedPostDataWithoutOwner = PostUtil::removeElementFromPostDataForSavingModel($sanitizedPostData, 'owner');
     $model->setAttributes($sanitizedPostDataWithoutOwner);
     if ($model->validate()) {
         $modelToStringValue = strval($model);
         if ($sanitizedOwnerPostData != null) {
             $model->setAttributes($sanitizedOwnerPostData);
         }
         if ($model instanceof OwnedSecurableItem) {
             $model->validate(array('owner'));
         }
     }
     $errorData = ZurmoActiveForm::makeErrorsDataAndResolveForOwnedModelAttributes($model);
     echo CJSON::encode($errorData);
     Yii::app()->end(0, false);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:20,代码来源:DefaultController.php


示例8: makeReportBySavedReport

 /**
  * @param $savedReport
  * @return Report
  */
 public static function makeReportBySavedReport($savedReport)
 {
     $report = new Report();
     if ($savedReport->id > 0) {
         $report->setId((int) $savedReport->id);
     }
     $report->setDescription($savedReport->description);
     $report->setModuleClassName($savedReport->moduleClassName);
     $report->setName($savedReport->name);
     $report->setOwner($savedReport->owner);
     $report->setType($savedReport->type);
     $explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem($savedReport);
     $report->setExplicitReadWriteModelPermissions($explicitReadWriteModelPermissions);
     if ($savedReport->serializedData != null) {
         $unserializedData = unserialize($savedReport->serializedData);
         if (isset($unserializedData['filtersStructure'])) {
             $report->setFiltersStructure($unserializedData['filtersStructure']);
         }
         if (isset($unserializedData['currencyConversionType'])) {
             $report->setCurrencyConversionType((int) $unserializedData['currencyConversionType']);
         }
         if (isset($unserializedData['spotConversionCurrencyCode'])) {
             $report->setSpotConversionCurrencyCode($unserializedData['spotConversionCurrencyCode']);
         }
         self::makeComponentFormAndPopulateReportFromData($unserializedData[ComponentForReportForm::TYPE_FILTERS], $report, 'Filter');
         self::makeComponentFormAndPopulateReportFromData($unserializedData[ComponentForReportForm::TYPE_ORDER_BYS], $report, 'OrderBy');
         self::makeComponentFormAndPopulateReportFromData($unserializedData[ComponentForReportForm::TYPE_GROUP_BYS], $report, 'GroupBy');
         self::makeComponentFormAndPopulateReportFromData($unserializedData[ComponentForReportForm::TYPE_DISPLAY_ATTRIBUTES], $report, 'DisplayAttribute');
         self::makeComponentFormAndPopulateReportFromData($unserializedData[ComponentForReportForm::TYPE_DRILL_DOWN_DISPLAY_ATTRIBUTES], $report, 'DrillDownDisplayAttribute');
         if (isset($unserializedData['chart'])) {
             $moduleClassName = $report->getModuleClassName();
             $modelClassName = $moduleClassName::getPrimaryModelName();
             $adapter = ModelRelationsAndAttributesToSummationReportAdapter::make($moduleClassName, $modelClassName, $report->getType());
             $chart = new ChartForReportForm(ReportUtil::makeDataAndLabelsForSeriesOrRange($adapter->getAttributesForChartSeries($report->getGroupBys(), $report->getDisplayAttributes())), ReportUtil::makeDataAndLabelsForSeriesOrRange($adapter->getAttributesForChartRange($report->getDisplayAttributes())));
             $chart->setAttributes($unserializedData['chart']);
             $report->setChart($chart);
         }
     }
     return $report;
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:44,代码来源:SavedReportToReportAdapter.php


示例9: resolveAndMakeExplicitReadWriteModelPermissions

 protected static function resolveAndMakeExplicitReadWriteModelPermissions($sanitizedData, $model)
 {
     return ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem($model);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:4,代码来源:ConversationZurmoControllerUtil.php


示例10: resolveEmailMessage

 protected static function resolveEmailMessage(EmailTemplate $emailTemplate, Contact $contact = null, $htmlContent, $emailAddress = null)
 {
     // TODO: @Shoaibi: Critical: Refactor this and AutoresponderAndCampaignItemsUtil
     $emailMessage = new EmailMessage();
     $emailMessage->subject = $emailTemplate->subject;
     $emailContent = new EmailMessageContent();
     $emailContent->textContent = $emailTemplate->textContent;
     // we do not need to do : EmailTemplateSerializedDataToHtmlUtil::resolveHtmlByEmailTemplateModel($emailTemplate);
     // check __set of EmailTemplate.
     $emailContent->htmlContent = $htmlContent;
     $emailMessage->content = $emailContent;
     $emailMessage->sender = static::resolveSender();
     static::resolveRecipient($emailMessage, $contact, $emailAddress);
     $box = EmailBox::resolveAndGetByName(EmailBox::USER_DEFAULT_NAME);
     $emailMessage->folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_DRAFT);
     Yii::app()->emailHelper->sendImmediately($emailMessage);
     $emailMessage->owner = $emailTemplate->owner;
     $explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem($emailTemplate);
     ExplicitReadWriteModelPermissionsUtil::resolveExplicitReadWriteModelPermissions($emailMessage, $explicitReadWriteModelPermissions);
     if (!$emailMessage->save()) {
         throw new FailedToSaveModelException("Unable to save EmailMessage");
     }
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:23,代码来源:DefaultController.php


示例11: testRegularUserCreateAccountAndChangeExplicitPermissions

 /**
  * @depends testRegularUserEditExistingAccountAndChangeExplicitPermissions
  */
 public function testRegularUserCreateAccountAndChangeExplicitPermissions()
 {
     $nobody = $this->logoutCurrentUserLoginNewUserAndGetByUsername('nobody');
     $group1 = Group::getByName('Group1');
     $everyoneGroup = Group::getByName(Group::EVERYONE_GROUP_NAME);
     //Create an account for nobody with no explicit permissions.
     $this->resetGetArray();
     $postData = array('type' => null);
     $this->setPostArray(array('Account' => array('name' => 'myNewAccount', 'officePhone' => '456765421', 'explicitReadWriteModelPermissions' => $postData)));
     //Make sure the redirect is to the details view and not the list view.
     $this->runControllerWithRedirectExceptionAndGetContent('accounts/default/create');
     // Not Coding Standard
     //Confirm the permissions are set right based on how the account was saved.
     $accounts = Account::getByName('myNewAccount');
     $this->assertEquals(1, count($accounts));
     $accountId = $accounts[0]->id;
     $explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem(Account::getById($accountId));
     $readWritePermitables = $explicitReadWriteModelPermissions->getReadWritePermitables();
     $readOnlyPermitables = $explicitReadWriteModelPermissions->getReadOnlyPermitables();
     $this->assertEquals(0, count($readWritePermitables));
     $this->assertEquals(0, count($readOnlyPermitables));
     //Create an account for nobody and add explicit permissions for the everyone group.
     $this->resetGetArray();
     $postData = array('type' => ExplicitReadWriteModelPermissionsUtil::MIXED_TYPE_EVERYONE_GROUP);
     $this->setPostArray(array('Account' => array('name' => 'myNewAccount2', 'officePhone' => '456765421', 'explicitReadWriteModelPermissions' => $postData)));
     //Make sure the redirect is to the details view and not the list view.
     $this->runControllerWithRedirectExceptionAndGetContent('accounts/default/create');
     // Not Coding Standard
     //Confirm the permissions are set right based on how the account was saved.
     $accounts = Account::getByName('myNewAccount2');
     $this->assertEquals(1, count($accounts));
     $accountId = $accounts[0]->id;
     $explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem(Account::getById($accountId));
     $readWritePermitables = $explicitReadWriteModelPermissions->getReadWritePermitables();
     $readOnlyPermitables = $explicitReadWriteModelPermissions->getReadOnlyPermitables();
     $this->assertEquals(1, count($readWritePermitables));
     $this->assertEquals(0, count($readOnlyPermitables));
     $this->assertEquals($everyoneGroup, $readWritePermitables[$everyoneGroup->getClassId('Permitable')]);
     //Create an account for nobody and add explicit permissions for a non-everyone group.
     $this->resetGetArray();
     $postData = array('type' => ExplicitReadWriteModelPermissionsUtil::MIXED_TYPE_NONEVERYONE_GROUP, 'nonEveryoneGroup' => $group1->id);
     $this->setPostArray(array('Account' => array('name' => 'myNewAccount3', 'officePhone' => '456765421', 'explicitReadWriteModelPermissions' => $postData)));
     //Make sure the redirect is to the details view and not the list view.
     $this->runControllerWithRedirectExceptionAndGetContent('accounts/default/create');
     // Not Coding Standard
     //Confirm the permissions are set right based on how the account was saved.
     $accounts = Account::getByName('myNewAccount3');
     $this->assertEquals(1, count($accounts));
     $accountId = $accounts[0]->id;
     $explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem(Account::getById($accountId));
     $readWritePermitables = $explicitReadWriteModelPermissions->getReadWritePermitables();
     $readOnlyPermitables = $explicitReadWriteModelPermissions->getReadOnlyPermitables();
     $this->assertEquals(1, count($readWritePermitables));
     $this->assertEquals(0, count($readOnlyPermitables));
     $this->assertEquals($group1, $readWritePermitables[$group1->getClassId('Permitable')]);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:59,代码来源:AccountPermissionsRegularUserWalkthroughTest.php


示例12: testResolveByPostDataAndModelThenMake

 /**
  * @depends testResolveExplicitReadWriteModelPermissions
  */
 public function testResolveByPostDataAndModelThenMake()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $accounts = Account::getByName('aTestAccount');
     $this->assertEquals(1, count($accounts));
     $account = $accounts[0];
     $group3 = Group::getByName('Group3');
     //Remove group 2 and 4, and add group 3.
     $postData = array('explicitReadWriteModelPermissions' => array('type' => ExplicitReadWriteModelPermissionsUtil::MIXED_TYPE_NONEVERYONE_GROUP, 'nonEveryoneGroup' => $group3->id));
     $explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::resolveByPostDataAndModelThenMake($postData, $account);
     $readWritePermitables = $explicitReadWriteModelPermissions->getReadWritePermitables();
     $readOnlyPermitables = $explicitReadWriteModelPermissions->getReadOnlyPermitables();
     $this->assertEquals(1, count($readWritePermitables));
     $this->assertEquals(0, count($readOnlyPermitables));
     $this->assertEquals($group3, $readWritePermitables[$group3->id]);
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:19,代码来源:ExplicitReadWriteModelPermissionsUtilTest.php


示例13: testEditOfTheLeadUserForTheCustomFieldsPlacedForLeadsModule

 /**
  * @depends testEditOfTheLeadUserForTheTagCloudFieldAfterRemovingAllTagsPlacedForLeadsModule
  */
 public function testEditOfTheLeadUserForTheCustomFieldsPlacedForLeadsModule()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     //Retrieve the the super user id.
     $superUserId = $super->id;
     //Retrieve the lead id.
     $leadId = self::getModelIdByModelNameAndName('Contact', 'Sarah Williams Edit');
     //Set the date and datetime variable values here.
     $date = Yii::app()->dateFormatter->format(DateTimeUtil::getLocaleDateFormatForInput(), time());
     $dateAssert = date('Y-m-d');
     $datetime = Yii::app()->dateFormatter->format(DateTimeUtil::getLocaleDateTimeFormatForInput(), time());
     $datetimeAssert = date('Y-m-d H:i:') . "00";
     $baseCurrency = Currency::getByCode(Yii::app()->currencyHelper->getBaseCode());
     //Retrieve the Lead State (Status) Id based on the name.
     $leadState = ContactState::getByName('In Progress');
     $leadStateId = $leadState[0]->id;
     $explicitReadWriteModelPermission = ExplicitReadWriteModelPermissionsUtil::MIXED_TYPE_EVERYONE_GROUP;
     //Edit and save the lead.
     $this->setGetArray(array('id' => $leadId));
     $this->setPostArray(array('Contact' => array('title' => array('value' => 'Mrs.'), 'firstName' => 'Sarah', 'lastName' => 'Williams Edit', 'jobTitle' => 'Sales Director Edit', 'companyName' => 'ABC Telecom Edit', 'industry' => array('value' => 'Banking'), 'website' => 'http://www.companyedit.com', 'department' => 'Sales Edit', 'officePhone' => '739-742-3005', 'source' => array('value' => 'Inbound Call'), 'mobilePhone' => '285-300-8232', 'officeFax' => '255-454-1914', 'state' => array('id' => $leadStateId), 'owner' => array('id' => $superUserId), 'primaryEmail' => array('emailAddress' => '[email protected]', 'optOut' => '0', 'isInvalid' => '0'), 'secondaryEmail' => array('emailAddress' => '[email protected]', 'optOut' => '0', 'isInvalid' => '0'), 'primaryAddress' => array('street1' => '26378 South Arlington Ave', 'street2' => '', 'city' => 'San Jose', 'state' => 'CA', 'postalCode' => '95131', 'country' => 'USA'), 'secondaryAddress' => array('street1' => '1652 North Cedar Court', 'street2' => '', 'city' => 'Phoenix', 'state' => 'AZ', 'postalCode' => '85003', 'country' => 'USA'), 'explicitReadWriteModelPermissions' => array('type' => $explicitReadWriteModelPermission), 'description' => 'This is a Edit Description', 'checkboxCstm' => '0', 'currencyCstm' => array('value' => 40, 'currency' => array('id' => $baseCurrency->id)), 'dateCstm' => $date, 'datetimeCstm' => $datetime, 'decimalCstm' => '12', 'picklistCstm' => array('value' => 'b'), 'multiselectCstm' => array('values' => array('gg', 'hh')), 'tagcloudCstm' => array('values' => array('reading', 'surfing')), 'countrylistCstm' => array('value' => 'aaaa'), 'statelistCstm' => array('value' => 'aaa1'), 'citylistCstm' => array('value' => 'ab1'), 'integerCstm' => '11', 'phoneCstm' => '259-784-2069', 'radioCstm' => array('value' => 'e'), 'textCstm' => 'This is a test Edit Text', 'textareaCstm' => 'This is a test Edit TextArea', 'urlCstm' => 'http://wwww.abc-edit.com'), 'save' => 'Save'));
     $this->runControllerWithRedirectExceptionAndGetUrl('leads/default/edit');
     //Check the details if they are saved properly for the custom fields after the edit.
     $lead = Contact::getById($leadId);
     //Retrieve the permission of the lead.
     $explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem($lead);
     $readWritePermitables = $explicitReadWriteModelPermissions->getReadWritePermitables();
     $readOnlyPermitables = $explicitReadWriteModelPermissions->getReadOnlyPermitables();
     $this->assertEquals($lead->title->value, 'Mrs.');
     $this->assertEquals($lead->firstName, 'Sarah');
     $this->assertEquals($lead->lastName, 'Williams Edit');
     $this->assertEquals($lead->state->id, $leadStateId);
     $this->assertEquals($lead->jobTitle, 'Sales Director Edit');
     $this->assertEquals($lead->companyName, 'ABC Telecom Edit');
     $this->assertEquals($lead->industry->value, 'Banking');
     $this->assertEquals($lead->website, 'http://www.companyedit.com');
     $this->assertEquals($lead->department, 'Sales Edit');
     $this->assertEquals($lead->officePhone, '739-742-3005');
     $this->assertEquals($lead->source->value, 'Inbound Call');
     $this->assertEquals($lead->mobilePhone, '285-300-8232');
     $this->assertEquals($lead->officeFax, '255-454-1914');
     $this->assertEquals($lead->primaryEmail->emailAddress, '[email protected]');
     $this->assertEquals($lead->primaryEmail->optOut, '0');
     $this->assertEquals($lead->primaryEmail->isInvalid, '0');
     $this->assertEquals($lead->secondaryEmail->emailAddress, '[email protected]');
     $this->assertEquals($lead->secondaryEmail->optOut, '0');
     $this->assertEquals($lead->secondaryEmail->isInvalid, '0');
     $this->assertEquals($lead->primaryAddress->street1, '26378 South Arlington Ave');
     $this->assertEquals($lead->primaryAddress->street2, '');
     $this->assertEquals($lead->primaryAddress->city, 'San Jose');
     $this->assertEquals($lead->primaryAddress->state, 'CA');
     $this->assertEquals($lead->primaryAddress->postalCode, '95131');
     $this->assertEquals($lead->primaryAddress->country, 'USA');
     $this->assertEquals($lead->secondaryAddress->street1, '1652 North Cedar Court');
     $this->assertEquals($lead->secondaryAddress->street2, '');
     $this->assertEquals($lead->secondaryAddress->city, 'Phoenix');
     $this->assertEquals($lead->secondaryAddress->state, 'AZ');
     $this->assertEquals($lead->secondaryAddress->postalCode, '85003');
     $this->assertEquals($lead->secondaryAddress->country, 'USA');
     $this->assertEquals(1, count($readWritePermitables));
     $this->assertEquals(0, count($readOnlyPermitables));
     $this->assertEquals($lead->description, 'This is a Edit Description');
     $this->assertEquals($lead->checkboxCstm, '0');
     $this->assertEquals($lead->currencyCstm->value, 40);
     $this->assertEquals($lead->currencyCstm->currency->id, $baseCurrency->id);
     $this->assertEquals($lead->dateCstm, $dateAssert);
     $this->assertEquals($lead->datetimeCstm, $datetimeAssert);
     $this->assertEquals($lead->decimalCstm, '12');
     $this->assertEquals($lead->picklistCstm->value, 'b');
     $this->assertEquals($lead->integerCstm, 11);
     $this->assertEquals($lead->phoneCstm, '259-784-2069');
     $this->assertEquals($lead->radioCstm->value, 'e');
     $this->assertEquals($lead->textCstm, 'This is a test Edit Text');
     $this->assertEquals($lead->textareaCstm, 'This is a test Edit TextArea');
     $this->assertEquals($lead->urlCstm, 'http://wwww.abc-edit.com');
     $this->assertEquals($lead->countrylistCstm->value, 'aaaa');
     $this->assertEquals($lead->statelistCstm->value, 'aaa1');
     $this->assertEquals($lead->citylistCstm->value, 'ab1');
     $this->assertContains('gg', $lead->multiselectCstm->values);
     $this->assertContains('hh', $lead->multiselectCstm->values);
     $this->assertContains('reading', $lead->tagcloudCstm->values);
     $this->assertContains('surfing', $lead->tagcloudCstm->values);
     $metadata = CalculatedDerivedAttributeMetadata::getByNameAndModelClassName('calcnumber', 'Contact');
     $testCalculatedValue = CalculatedNumberUtil::calculateByFormulaAndModelAndResolveFormat($metadata->getFormula(), $lead);
     $this->assertEquals(23, $testCalculatedValue);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:88,代码来源:LeadsDesignerSuperUserWalkthroughTest.php


示例14: generateAndProcessCampaignItems


//.........这里部分代码省略.........
[[PRIMARY^EMAIL__EMAIL^ADDRESS]]
[[PRIMARY^EMAIL__EMAIL^ADDRESS]]
[[SECONDARY^ADDRESS__CITY]]
[[SECONDARY^ADDRESS__COUNTRY]]
[[SECONDARY^ADDRESS__INVALID]]
[[SECONDARY^ADDRESS__LATITUDE]]
[[SECONDARY^ADDRESS__LONGITUDE]]
[[SECONDARY^ADDRESS__POSTAL^CODE]]
[[SECONDARY^ADDRESS__STATE]]
[[SECONDARY^ADDRESS__STREET1]]
[[SECONDARY^ADDRESS__STREET2]]
[[OWNER__DEPARTMENT]]
[[OWNER__FIRST^NAME]]
[[OWNER__IS^ACTIVE]]
[[OWNER__MOBILE^PHONE]]
[[OWNER__LAST^LOGIN^DATE^TIME]]
[[OWNER__LAST^NAME]]
[[CREATED^BY^USER__FIRST^NAME]]
[[CREATED^BY^USER__LAST^NAME]]
[[CREATED^BY^USER__MOBILE^PHONE]]
[[CREATED^BY^USER__TITLE]]
[[CREATED^BY^USER__USERNAME]]
[[ACCOUNT__ANNUAL^REVENUE]]
[[ACCOUNT__INDUSTRY]]
[[ACCOUNT__NAME]]
[[ACCOUNT__WEBSITE]]
[[ACCOUNT__BILLING^ADDRESS__COUNTRY]]
[[ACCOUNT__BILLING^ADDRESS__CITY]]
[[ACCOUNT__OWNER__FIRST^NAME]]
 ' " ` " '
MTG;
        $marketingList = MarketingListTestHelper::createMarketingListByName('marketingList Test', 'description goes here', 'fromName', '[email protected]');
        $campaign = CampaignTestHelper::createCampaign('campaign Test', 'subject', $content, $content, null, null, null, Campaign::STATUS_PROCESSING, null, null, $marketingList, false);
        $fileNames = array('testImage.png', 'testZip.zip', 'testPDF.pdf');
        $files = array();
        foreach ($fileNames as $index => $fileName) {
            $file = ZurmoTestHelper::createFileModel($fileName);
            $files[$index]['name'] = $fileName;
            $files[$index]['type'] = $file->type;
            $files[$index]['size'] = $file->size;
            $files[$index]['contents'] = $file->fileContent->content;
            $campaign->files->add($file);
        }
        $this->assertTrue($campaign->save(false));
        $processed = 0;
        foreach ($contacts as $contact) {
            MarketingListMemberTestHelper::createMarketingListMember(0, $marketingList, $contact);
            CampaignItemTestHelper::createCampaignItem($processed, $campaign, $contact);
        }
        AutoresponderOrCampaignBatchSizeConfigUtil::setBatchSize($count);
        Yii::app()->jobQueue->deleteAll();
        ForgetAllCacheUtil::forgetAllCaches();
        $job = new CampaignQueueMessagesInOutboxJob();
        $this->assertCount(0, Yii::app()->jobQueue->getAll());
        $startedAt = microtime(true);
        $this->assertTrue($job->run());
        $timeTaken = microtime(true) - $startedAt;
        ForgetAllCacheUtil::forgetAllCaches();
        $campaignItemsCountExpected = $count;
        $campaignItemsCountAfter = CampaignItem::getCount();
        $this->assertEquals($campaignItemsCountExpected, $campaignItemsCountAfter);
        $campaignItemsProcessed = CampaignItem::getByProcessedAndCampaignId(1, $campaign->id);
        $this->assertCount($count, $campaignItemsProcessed);
        foreach ($campaignItemsProcessed as $i => $campaignItem) {
            $contact = $contacts[$i];
            $email = $emails[$i];
            $emailMessage = $campaignItem->emailMessage;
            $this->assertEquals($marketingList->owner->id, $emailMessage->owner->id);
            $marketingListPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem($marketingList);
            $emailMessagePermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem($emailMessage);
            $this->assertEquals($marketingListPermissions, $emailMessagePermissions);
            $this->assertEquals($campaign->subject, $emailMessage->subject);
            $this->assertNotEquals($campaign->textContent, $emailMessage->content->textContent);
            $this->assertNotEquals($campaign->htmlContent, $emailMessage->content->htmlContent);
            $this->assertEquals(2, substr_count($emailMessage->content->textContent, '/marketingLists/external/'));
            $this->assertContains('/marketingLists/external/', $emailMessage->content->htmlContent);
            $this->assertEquals(2, substr_count($emailMessage->content->htmlContent, '/marketingLists/external/'));
            $this->assertEquals('[email protected]', $emailMessage->sender->fromAddress);
            $this->assertEquals('Support Team', $emailMessage->sender->fromName);
            $this->assertEquals(1, $emailMessage->recipients->count());
            $recipients = $emailMessage->recipients;
            $this->assertEquals(strval($contact), $recipients[0]->toName);
            $this->assertEquals($email->emailAddress, $recipients[0]->toAddress);
            $this->assertEquals(EmailMessageRecipient::TYPE_TO, $recipients[0]->type);
            $this->assertNotEmpty($emailMessage->files);
            $this->assertCount(count($files), $emailMessage->files);
            foreach ($campaign->files as $index => $file) {
                $this->assertEquals($file->name, $emailMessage->files[$index]->name);
                $this->assertEquals($file->type, $emailMessage->files[$index]->type);
                $this->assertEquals($file->size, $emailMessage->files[$index]->size);
                //CampaingItem should share the Attachments content from Campaign
                $this->assertEquals($file->fileContent->content, $emailMessage->files[$index]->fileContent->content);
                $this->assertEquals($file->fileContent->id, $emailMessage->files[$index]->fileContent->id);
            }
            $headersArray = array('zurmoItemId' => $campaignItem->id, 'zurmoItemClass' => get_class($campaignItem), 'zurmoPersonId' => $contact->getClassId('Person'));
            $expectedHeaders = serialize($headersArray);
            $this->assertEquals($expectedHeaders, $emailMessage->headers);
        }
        return $timeTaken;
    }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:101,代码来源:CampaignQueueMessagesInOutboxJobBenchmarkTest.php


示例15: resolveValueAndSetToModel

 /**
  * Utilized to create or update model attribute values after a workflow's triggers are fired as true.
  * Currently only works with creating new and creating new related models. Not designed to support updating
  * existing models.
  * @param WorkflowActionProcessingModelAdapter $adapter
  * @param $attribute
  * @throws FailedToResolveExplicitReadWriteModelPermissionsException
  * @throws NotSupportedException
  */
 public function resolveValueAndSetToModel(WorkflowActionProcessingModelAdapter $adapter, $attribute)
 {
     assert('is_string($attribute)');
     if ($adapter->getModel()->id < 0) {
         throw new NotSupportedException();
     }
     if ($this->type == self::TYPE_DYNAMIC_SAME_AS_TRIGGERED_MODEL) {
         $triggeredModel = $adapter->getTriggeredModel();
         if (null == ($explicitReadWriteModelPermissions = $triggeredModel->getExplicitReadWriteModelPermissionsForWorkflow())) {
             $explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem($adapter->getTriggeredModel());
         }
     } elseif ($this->type == self::TYPE_DYNAMIC_OWNER) {
         //Do nothing, by default this will take.
         return;
     } elseif ($this->type == self::TYPE_DYNAMIC_EVERYONE_GROUP) {
         $explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem($adapter->getModel());
         $explicitReadWriteModelPermissions->addReadWritePermitable(Group::getByName(Group::EVERYONE_GROUP_NAME));
     } else {
         $explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem($adapter->getModel());
         try {
             $group = Group::getById((int) $this->type);
             $explicitReadWriteModelPermissions->addReadWritePermitable($group);
         } catch (NotFoundException $e) {
             //todo: handle exception better
             return;
         }
     }
     $success = ExplicitReadWriteModelPermissionsUtil::resolveExplicitReadWriteModelPermissions($adapter->getModel(), $explicitReadWriteModelPermissions);
     if (!$success) {
         throw new FailedToResolveExplicitReadWriteModelPermissionsException();
     }
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:41,代码来源:ExplicitReadWriteModelPermissionsWorkflowActionAttributeForm.php


示例16: testEditOfTheProductForTheCustomFieldsPlacedForProductsModule

 /**
  * @depends testEditOfTheProductForTheTagCloudFieldAfterRemovingAllTagsPlacedForProductsModule
  */
 public function testEditOfTheProductForTheCustomFieldsPlacedForProductsModule()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     //Set the date and datetime variable values here.
     $date = Yii::app()->dateFormatter->format(DateTimeUtil::getLocaleDateFormatForInput(), time());
     $dateAssert = date('Y-m-d');
     $datetime = Yii::app()->dateFormatter->format(DateTimeUtil::getLocaleDateTimeFormatForInput(), time());
     $datetimeAssert = date('Y-m-d H:i:') . "00";
     $baseCurrency = Currency::getByCode(Yii::app()->currencyHelper->getBaseCode());
     //Retrieve the account id, the super user id and product Id.
     $accountId = self::getModelIdByModelNameAndName('Account', 'superAccount');
     $superUserId = $super->id;
     $explicitReadWriteModelPermission = ExplicitReadWriteModelPermissionsUtil::MIXED_TYPE_EVERYONE_GROUP;
     $product = Product::getByName('myEditProduct');
     $productId = $product[0]->id;
     //Edit a new Product based on the custom fields.
     $this->setGetArray(array('id' => $productId));
     $this->setPostArray(array('Product' => array('name' => 'myEditProduct', 'owner' => array('id' => $superUserId), 'type' => 1, 'sellPrice' => array('currency' => array('id' => $baseCurrency->id), 'value' => 200), 'account' => array('id' => $accountId), 'quantity' => 10, 'priceFrequency' => 2, 'stage' => array('value' => 'Open'), 'explicitReadWriteModelPermissions' => array('type' => $explicitReadWriteModelPermission), 'checkboxCstm' => '0', 'currencyCstm' => array('value' => 40, 'currency' => array('id' => $baseCurrency->id)), 'decimalCstm' => '12', 'dateCstm' => $date, 'datetimeCstm' => $datetime, 'picklistCstm' => array('value' => 'b'), 'multiselectCstm' => array('values' => array('gg', 'hh')), 'tagcloudCstm' => array('values' => array('reading', 'surfing')), 'countrylistCstm' => array('value' => 'aaaa'), 'statelistCstm' => array('value' => 'aaa1'), 'citylistCstm' => array('value' => 'ab1'), 'integerCstm' => '11', 'phoneCstm' => '259-784-2069', 'radioCstm' => array('value' => 'e'), 'textCstm' => 'This is a test Edit Text', 'textareaCstm' => 'This is a test Edit TextArea', 'urlCstm' => 'http://wwww.abc-edit.com')));
     $this->runControllerWithRedirectExceptionAndGetUrl('products/default/edit');
     //Check the details if they are saved properly for the custom fields.
     $productId = self::getModelIdByModelNameAndName('Product', 'myEditProduct');
     $product = Product::getById($productId);
     //Retrieve the permission of the product.
     $explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem($product);
     $readWritePermitables = $explicitReadWriteModelPermissions->getReadWritePermitables();
     $readOnlyPermitables = $explicitReadWriteModelPermissions->getReadOnlyPermitables();
     $this->assertEquals($product->name, 'myEditProduct');
     $this->assertEquals($product->quantity, 10);
     $this->assertEquals($product->sellPrice->value, 200.0);
     $this->assertEquals($product->account->id, $accountId);
     $this->assertEquals($product->type, 1);
     $this->assertEquals($product->stage->value, 'Open');
     $this->assertEquals($product->owner->id, $superUserId);
     $this->assertEquals(1, count($readWritePermitables));
     $this->assertEquals(0, count($readOnlyPermitables));
     $this->assertEquals($product->checkboxCstm, '0');
     $this->assertEquals($product->currencyCstm->value, 40);
     $this->assertEquals($product->currencyCstm->currency->id, $baseCurrency->id);
     $this->assertEquals($product->dateCstm, $dateAssert);
     $this->assertEquals($product->datetimeCstm, $datetimeAssert);
     $this->assertEquals($product->decimalCstm, '12');
     $this->assertEquals($product->picklistCstm->value, 'b');
     $this->assertEquals($product->integerCstm, 11);
     $this->assertEquals($product->phoneCstm, '259-784-2069');
     $this->assertEquals($product->radioCstm->value, 'e');
     $this->assertEquals($product->textCstm, 'This is a test Edit Text');
     $this->assertEquals($product->textareaCstm, 'This is a test Edit TextArea');
     $this->assertEquals($product->urlCstm, 'http://wwww.abc-edit.com');
     $this->assertEquals($product->dateCstm, $dateAssert);
     $this->assertEquals($product->datetimeCstm, $datetimeAssert);
     $this->assertEquals($product->countrylistCstm->value, 'aaaa');
     $this->assertEquals($product->statelistCstm->value, 'aaa1');
     $this->assertEquals($product->citylistCstm->value, 'ab1');
     $this->assertContains('gg', $product->multiselectCstm->values);
     $this->assertContains('hh', $product->multiselectCstm->values);
     $this->assertContains('reading', $product->tagcloudCstm->values);
     $this->assertContains('surfing', $product->tagcloudCstm->values);
     $metadata = CalculatedDerivedAttributeMetadata::getByNameAndModelClassName('calcnumber', 'Product');
     $testCalculatedValue = CalculatedNumberUtil::calculateByFormulaAndModelAndResolveFormat($metadata->getFormula(), $product);
     $this->assertEquals(132, intval(str_replace(',', '', $testCalculatedValue)));
     // Not Coding Standard
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:65,代码来源:ProductsDesignerSuperUserWalkthroughTest.php


示例17: testProcessWithDefaultSender

 public function testProcessWithDefaultSender()
 {
     $message = new EmailMessageForWo 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Export类代码示例发布时间:2022-05-23
下一篇:
PHP Expectations类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap