本文整理汇总了PHP中Meeting::getByName方法的典型用法代码示例。如果您正苦于以下问题:PHP Meeting::getByName方法的具体用法?PHP Meeting::getByName怎么用?PHP Meeting::getByName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Meeting
的用法示例。
在下文中一共展示了Meeting::getByName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSimpleUserImportWhereAllRowsSucceed
public function testSimpleUserImportWhereAllRowsSucceed()
{
Yii::app()->user->userModel = User::getByUsername('super');
$meetings = Meeting::getAll();
$this->assertEquals(0, count($meetings));
$import = new Import();
$serializedData['importRulesType'] = 'Meetings';
$serializedData['firstRowIsHeaderRow'] = true;
$import->serializedData = serialize($serializedData);
$this->assertTrue($import->save());
ImportTestHelper::createTempTableByFileNameAndTableName('importAnalyzerTest.csv', $import->getTempTableName(), true, Yii::getPathOfAlias('application.modules.meetings.tests.unit.files'));
$this->assertEquals(4, ImportDatabaseUtil::getCount($import->getTempTableName()));
// includes header rows.
$mappingData = array('column_0' => ImportMappingUtil::makeStringColumnMappingData('name'), 'column_1' => ImportMappingUtil::makeStringColumnMappingData('location'), 'column_2' => ImportMappingUtil::makeDateTimeColumnMappingData('startDateTime'), 'column_3' => ImportMappingUtil::makeDateTimeColumnMappingData('endDateTime'), 'column_4' => ImportMappingUtil::makeDropDownColumnMappingData('category'), 'column_5' => ImportMappingUtil::makeModelDerivedColumnMappingData('AccountDerived'), 'column_6' => ImportMappingUtil::makeModelDerivedColumnMappingData('ContactDerived'), 'column_7' => ImportMappingUtil::makeModelDerivedColumnMappingData('OpportunityDerived'), 'column_8' => ImportMappingUtil::makeTextAreaColumnMappingData('description'));
$importRules = ImportRulesUtil::makeImportRulesByType('Meetings');
$page = 0;
$config = array('pagination' => array('pageSize' => 50));
//This way all rows are processed.
$dataProvider = new ImportDataProvider($import->getTempTableName(), true, $config);
$dataProvider->getPagination()->setCurrentPage($page);
$importResultsUtil = new ImportResultsUtil($import);
$messageLogger = new ImportMessageLogger();
ImportUtil::importByDataProvider($dataProvider, $importRules, $mappingData, $importResultsUtil, new ExplicitReadWriteModelPermissions(), $messageLogger);
$importResultsUtil->processStatusAndMessagesForEachRow();
//Confirm that 3 models where created.
$meetings = Meeting::getAll();
$this->assertEquals(3, count($meetings));
$meetings = Meeting::getByName('meeting1');
$this->assertEquals(1, count($meetings[0]));
$this->assertEquals(1, count($meetings[0]->activityItems));
$this->assertEquals('testAccount', $meetings[0]->activityItems[0]->name);
$this->assertEquals('Account', get_class($meetings[0]->activityItems[0]));
$this->assertEquals('2011-12-22 05:03', substr($meetings[0]->latestDateTime, 0, -3));
$meetings = Meeting::getByName('meeting2');
$this->assertEquals(1, count($meetings[0]));
$this->assertEquals(1, count($meetings[0]->activityItems));
$this->assertEquals('testContact', $meetings[0]->activityItems[0]->firstName);
$this->assertEquals('Contact', get_class($meetings[0]->activityItems[0]));
$this->assertEquals('2011-12-22 05:03', substr($meetings[0]->latestDateTime, 0, -3));
$meetings = Meeting::getByName('meeting3');
$this->assertEquals(1, count($meetings[0]));
$this->assertEquals(1, count($meetings[0]->activityItems));
$this->assertEquals('testOpportunity', $meetings[0]->activityItems[0]->name);
$this->assertEquals('Opportunity', get_class($meetings[0]->activityItems[0]));
$this->assertEquals('2011-12-22 06:03', substr($meetings[0]->latestDateTime, 0, -3));
//Confirm 10 rows were processed as 'created'.
$this->assertEquals(3, ImportDatabaseUtil::getCount($import->getTempTableName(), "status = " . ImportRowDataResultsUtil::CREATED));
//Confirm that 0 rows were processed as 'updated'.
$this->assertEquals(0, ImportDatabaseUtil::getCount($import->getTempTableName(), "status = " . ImportRowDataResultsUtil::UPDATED));
//Confirm 2 rows were processed as 'errors'.
$this->assertEquals(0, ImportDatabaseUtil::getCount($import->getTempTableName(), "status = " . ImportRowDataResultsUtil::ERROR));
$beansWithErrors = ImportDatabaseUtil::getSubset($import->getTempTableName(), "status = " . ImportRowDataResultsUtil::ERROR);
$this->assertEquals(0, count($beansWithErrors));
}
示例2: testMeetingsThanSpanForMoreThanOneMonth
public function testMeetingsThanSpanForMoreThanOneMonth()
{
$savedCalendars = SavedCalendar::getByName('aSavedCalendar');
$savedCalendar = $savedCalendars[0];
$meetings = Meeting::getByName('aMeeting');
$meeting = $meetings[0];
$meeting->startDateTime = '2014-04-29 01:00:00';
$meeting->endDateTime = '2014-05-09 01:00:00';
$this->assertTrue($meeting->save());
$savedCalendarSubscriptions = SavedCalendarSubscriptions::makeByUser($this->super, (string) $savedCalendar->id);
$dataProvider = new CalendarItemsDataProvider($savedCalendarSubscriptions, array('startDate' => '2014-05-01 01:00:00', 'endDate' => '2014-05-31 01:00:00', 'dateRangeType' => SavedCalendar::DATERANGE_TYPE_MONTH));
$data = $dataProvider->getData();
$this->assertCount(1, $data);
$this->assertEquals('aMeeting', $data[0]->getTitle());
$meeting->startDateTime = '2014-04-29 01:00:00';
$meeting->endDateTime = '2014-06-09 01:00:00';
$this->assertTrue($meeting->save());
$savedCalendarSubscriptions = SavedCalendarSubscriptions::makeByUser($this->super, (string) $savedCalendar->id);
$dataProvider = new CalendarItemsDataProvider($savedCalendarSubscriptions, array('startDate' => '2014-05-01 01:00:00', 'endDate' => '2014-05-31 01:00:00', 'dateRangeType' => SavedCalendar::DATERANGE_TYPE_MONTH));
$data = $dataProvider->getData();
$this->assertCount(1, $data);
$this->assertEquals('aMeeting', $data[0]->getTitle());
$meeting->startDateTime = '2014-05-29 01:00:00';
$meeting->endDateTime = '2014-06-09 01:00:00';
$this->assertTrue($meeting->save());
$savedCalendarSubscriptions = SavedCalendarSubscriptions::makeByUser($this->super, (string) $savedCalendar->id);
$dataProvider = new CalendarItemsDataProvider($savedCalendarSubscriptions, array('startDate' => '2014-05-01 01:00:00', 'endDate' => '2014-05-31 01:00:00', 'dateRangeType' => SavedCalendar::DATERANGE_TYPE_MONTH));
$data = $dataProvider->getData();
$this->assertCount(1, $data);
$this->assertEquals('aMeeting', $data[0]->getTitle());
//Meeting start and ends before calendar start/end dates
$savedCalendarSubscriptions = SavedCalendarSubscriptions::makeByUser($this->super, (string) $savedCalendar->id);
$dataProvider = new CalendarItemsDataProvider($savedCalendarSubscriptions, array('startDate' => '2014-07-01 01:00:00', 'endDate' => '2014-08-31 01:00:00', 'dateRangeType' => SavedCalendar::DATERANGE_TYPE_MONTH));
$data = $dataProvider->getData();
$this->assertCount(0, $data);
//Meeting start and ends after calendar start/end dates
$savedCalendarSubscriptions = SavedCalendarSubscriptions::makeByUser($this->super, (string) $savedCalendar->id);
$dataProvider = new CalendarItemsDataProvider($savedCalendarSubscriptions, array('startDate' => '2014-01-01 01:00:00', 'endDate' => '2014-03-31 01:00:00', 'dateRangeType' => SavedCalendar::DATERANGE_TYPE_MONTH));
$data = $dataProvider->getData();
$this->assertCount(0, $data);
}
示例3: testUnprivilegedUserViewUpdateDeleteMeetings
/**
* @depends testListMeetings
*/
public function testUnprivilegedUserViewUpdateDeleteMeetings()
{
Yii::app()->user->userModel = User::getByUsername('super');
$notAllowedUser = UserTestHelper::createBasicUser('Steven');
$notAllowedUser->setRight('UsersModule', UsersModule::RIGHT_LOGIN_VIA_WEB_API);
$saved = $notAllowedUser->save();
$authenticationData = $this->login('steven', 'steven');
$headers = array('Accept: application/json', 'ZURMO_SESSION_ID: ' . $authenticationData['sessionId'], 'ZURMO_TOKEN: ' . $authenticationData['token'], 'ZURMO_API_REQUEST_TYPE: REST');
$everyoneGroup = Group::getByName(Group::EVERYONE_GROUP_NAME);
$this->assertTrue($everyoneGroup->save());
$meetings = Meeting::getByName('Michael Meeting');
$this->assertEquals(1, count($meetings));
$data['description'] = "Some new description 2";
// Test with unprivileged user to view, edit and delete account.
$authenticationData = $this->login('steven', 'steven');
$headers = array('Accept: application/json', 'ZURMO_SESSION_ID: ' . $authenticationData['sessionId'], 'ZURMO_TOKEN: ' . $authenticationData['token'], 'ZURMO_API_REQUEST_TYPE: REST');
$response = ApiRestTestHelper::createApiCall($this->serverUrl . '/test.php/meetings/meeting/api/read/' . $meetings[0]->id, 'GET', $headers);
$response = json_decode($response, true);
$this->assertEquals(ApiResponse::STATUS_FAILURE, $response['status']);
$this->assertEquals('You do not have rights to perform this action.', $response['message']);
$response = ApiRestTestHelper::createApiCall($this->serverUrl . '/test.php/meetings/meeting/api/update/' . $meetings[0]->id, 'PUT', $headers, array('data' => $data));
$response = json_decode($response, true);
$this->assertEquals(ApiResponse::STATUS_FAILURE, $response['status']);
$this->assertEquals('You do not have rights to perform this action.', $response['message']);
$response = ApiRestTestHelper::createApiCall($this->serverUrl . '/test.php/meetings/meeting/api/delete/' . $meetings[0]->id, 'DELETE', $headers);
$response = json_decode($response, true);
$this->assertEquals(ApiResponse::STATUS_FAILURE, $response['status']);
$this->assertEquals('You do not have rights to perform this action.', $response['message']);
//now check if user have rights, but no permissions.
$notAllowedUser->setRight('MeetingsModule', MeetingsModule::getAccessRight());
$notAllowedUser->setRight('MeetingsModule', MeetingsModule::getCreateRight());
$notAllowedUser->setRight('MeetingsModule', MeetingsModule::getDeleteRight());
$saved = $notAllowedUser->save();
$this->assertTrue($saved);
$response = ApiRestTestHelper::createApiCall($this->serverUrl . '/test.php/meetings/meeting/api/read/' . $meetings[0]->id, 'GET', $headers);
$response = json_decode($response, true);
$this->assertEquals(ApiResponse::STATUS_FAILURE, $response['status']);
$this->assertEquals('You do not have permissions for this action.', $response['message']);
$response = ApiRestTestHelper::createApiCall($this->serverUrl . '/test.php/meetings/meeting/api/update/' . $meetings[0]->id, 'PUT', $headers, array('data' => $data));
$response = json_decode($response, true);
$this->assertEquals(ApiResponse::STATUS_FAILURE, $response['status']);
$this->assertEquals('You do not have permissions for this action.', $response['message']);
$response = ApiRestTestHelper::createApiCall($this->serverUrl . '/test.php/meetings/meeting/api/delete/' . $meetings[0]->id, 'DELETE', $headers);
$response = json_decode($response, true);
$this->assertEquals(ApiResponse::STATUS_FAILURE, $response['status']);
$this->assertEquals('You do not have permissions for this action.', $response['message']);
// Allow everyone group to read/write meeting
$authenticationData = $this->login();
$headers = array('Accept: application/json', 'ZURMO_SESSION_ID: ' . $authenticationData['sessionId'], 'ZURMO_TOKEN: ' . $authenticationData['token'], 'ZURMO_API_REQUEST_TYPE: REST');
unset($data);
$data['explicitReadWriteModelPermissions'] = array('type' => ExplicitReadWriteModelPermissionsUtil::MIXED_TYPE_EVERYONE_GROUP);
$response = ApiRestTestHelper::createApiCall($this->serverUrl . '/test.php/meetings/meeting/api/update/' . $meetings[0]->id, 'PUT', $headers, array('data' => $data));
$response = json_decode($response, true);
$this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
$authenticationData = $this->login('steven', 'steven');
$headers = array('Accept: application/json', 'ZURMO_SESSION_ID: ' . $authenticationData['sessionId'], 'ZURMO_TOKEN: ' . $authenticationData['token'], 'ZURMO_API_REQUEST_TYPE: REST');
$response = ApiRestTestHelper::createApiCall($this->serverUrl . '/test.php/meetings/meeting/api/read/' . $meetings[0]->id, 'GET', $headers);
$response = json_decode($response, true);
$this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
unset($data);
$data['description'] = "Some new description 3";
$response = ApiRestTestHelper::createApiCall($this->serverUrl . '/test.php/meetings/meeting/api/update/' . $meetings[0]->id, 'PUT', $headers, array('data' => $data));
$response = json_decode($response, true);
$this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
$this->assertEquals("Some new description 3", $response['data']['description']);
$response = ApiRestTestHelper::createApiCall($this->serverUrl . '/test.php/meetings/meeting/api/delete/' . $meetings[0]->id, 'DELETE', $headers);
$response = json_decode($response, true);
$this->assertEquals(ApiResponse::STATUS_FAILURE, $response['status']);
$this->assertEquals('You do not have permissions for this action.', $response['message']);
// Test with privileged user
$authenticationData = $this->login();
$headers = array('Accept: application/json', 'ZURMO_SESSION_ID: ' . $authenticationData['sessionId'], 'ZURMO_TOKEN: ' . $authenticationData['token'], 'ZURMO_API_REQUEST_TYPE: REST');
//Test Delete
$response = ApiRestTestHelper::createApiCall($this->serverUrl . '/test.php/meetings/meeting/api/delete/' . $meetings[0]->id, 'DELETE', $headers);
$response = json_decode($response, true);
$this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
$response = ApiRestTestHelper::createApiCall($this->serverUrl . '/test.php/meetings/meeting/api/read/' . $meetings[0]->id, 'GET', $headers);
$response = json_decode($response, true);
$this->assertEquals(ApiResponse::STATUS_FAILURE, $response['status']);
}
示例4: testDeleteOfTheMeetingForTheCustomFieldsPlacedForMeetingsModule
/**
* @depends testEditOfTheMeetingForTheCustomFieldsPlacedForMeetingsModule
*/
public function testDeleteOfTheMeetingForTheCustomFieldsPlacedForMeetingsModule()
{
$super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
//Retrieve the meeting Id.
$meeting = Meeting::getByName('myEditMeeting');
//Set the meeting id so as to delete the meeting.
$this->setGetArray(array('id' => $meeting[0]->id));
$this->runControllerWithRedirectExceptionAndGetUrl('meetings/default/delete');
//Check to confirm that the meeting is deleted.
$meeting = Meeting::getByName('myEditMeeting');
$this->assertEquals(0, count($meeting));
}
示例5: testUpdateMeetingFromForm
/**
* @depends testCreateAndGetMeetingById
*/
public function testUpdateMeetingFromForm()
{
Yii::app()->user->userModel = User::getByUsername('super');
$user = User::getByUsername('billy');
$meetings = Meeting::getByName('MyMeeting');
$meeting = $meetings[0];
$this->assertEquals($meeting->name, 'MyMeeting');
$timeStamp = time();
$newStamp = DateTimeUtil::convertTimestampToDbFormatDateTime($timeStamp);
$postData = array('owner' => array('id' => $user->id), 'name' => 'New Name', 'startDateTime' => DateTimeUtil::convertTimestampToDisplayFormat($timeStamp, DateTimeUtil::DATETIME_FORMAT_DATE_WIDTH, DateTimeUtil::DATETIME_FORMAT_TIME_WIDTH, true));
$sanitizedPostData = PostUtil::sanitizePostByDesignerTypeForSavingModel($meeting, $postData);
$meeting->setAttributes($sanitizedPostData);
$saved = $meeting->save();
$this->assertTrue($saved);
$id = $meeting->id;
unset($meeting);
$meeting = Meeting::getById($id);
$this->assertEquals('New Name', $meeting->name);
$this->assertEquals($sanitizedPostData['startDateTime'], $meeting->startDateTime);
//create new meeting from scratch where the startDateTime and endDateTime attributes are not populated.
//It should let you save.
$meeting = new Meeting();
$postData = array('owner' => array('id' => $user->id), 'name' => 'Lamazing', 'startDateTime' => DateTimeUtil::convertTimestampToDisplayFormat($timeStamp, DateTimeUtil::DATETIME_FORMAT_DATE_WIDTH, DateTimeUtil::DATETIME_FORMAT_TIME_WIDTH, true));
$sanitizedPostData = PostUtil::sanitizePostByDesignerTypeForSavingModel($meeting, $postData);
$meeting->setAttributes($sanitizedPostData);
$saved = $meeting->save();
$this->assertTrue($saved);
$id = $meeting->id;
unset($meeting);
$meeting = Meeting::getById($id);
$this->assertEquals('Lamazing', $meeting->name);
$this->assertEquals($sanitizedPostData['startDateTime'], $meeting->startDateTime);
$this->assertEquals(null, $meeting->endDateTime);
}