/**
  * For each dupeModel add total ammount of Notes, Tasks, Emails and Meetings
  * @param $chart
  */
 protected function resolveDataForChart(&$chart)
 {
     $notes = array('category' => NotesModule::getModuleLabelByTypeAndLanguage('Plural'));
     $tasks = array('category' => TasksModule::getModuleLabelByTypeAndLanguage('Plural'));
     $emails = array('category' => EmailMessagesModule::getModuleLabelByTypeAndLanguage('Plural'));
     $meetings = array('category' => MeetingsModule::getModuleLabelByTypeAndLanguage('Plural'));
     foreach ($this->dupeModels as $dupeModel) {
         $itemId = $dupeModel->getClassId('Item');
         $notes['model-' . $dupeModel->id] = LatestActivitiesUtil::getCountByModelClassName('Note', array($itemId), LatestActivitiesConfigurationForm::OWNED_BY_FILTER_ALL);
         $tasks['model-' . $dupeModel->id] = LatestActivitiesUtil::getCountByModelClassName('Task', array($itemId), LatestActivitiesConfigurationForm::OWNED_BY_FILTER_ALL);
         $emails['model-' . $dupeModel->id] = LatestActivitiesUtil::getCountByModelClassName('EmailMessage', array($itemId), LatestActivitiesConfigurationForm::OWNED_BY_FILTER_ALL);
         $meetings['model-' . $dupeModel->id] = LatestActivitiesUtil::getCountByModelClassName('Meeting', array($itemId), LatestActivitiesConfigurationForm::OWNED_BY_FILTER_ALL);
     }
     $chart->data = array($notes, $tasks, $emails, $meetings);
 }
 public function testSuperUserMeetingDefaultControllerActions()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     //Load AttributesList for Meeting module.
     $this->setGetArray(array('moduleClassName' => 'MeetingsModule'));
     $this->runControllerWithNoExceptionsAndGetContent('designer/default/attributesList');
     //Load ModuleLayoutsList for Meeting module.
     $this->setGetArray(array('moduleClassName' => 'MeetingsModule'));
     $this->runControllerWithNoExceptionsAndGetContent('designer/default/moduleLayoutsList');
     //Load ModuleEdit view for each applicable module.
     $this->setGetArray(array('moduleClassName' => 'MeetingsModule'));
     $this->runControllerWithNoExceptionsAndGetContent('designer/default/moduleEdit');
     //Now validate save with failed validation.
     $this->setGetArray(array('moduleClassName' => 'MeetingsModule'));
     $this->setPostArray(array('ajax' => 'edit-form', 'MeetingsModuleForm' => $this->createModuleEditBadValidationPostData()));
     $content = $this->runControllerWithExitExceptionAndGetContent('designer/default/moduleEdit');
     $this->assertTrue(strlen($content) > 50);
     //approximate, but should definetely be larger than 50.
     //Now validate save with successful validation.
     $this->setGetArray(array('moduleClassName' => 'MeetingsModule'));
     $this->setPostArray(array('ajax' => 'edit-form', 'MeetingsModuleForm' => $this->createModuleEditGoodValidationPostData('meeting new name')));
     $content = $this->runControllerWithExitExceptionAndGetContent('designer/default/moduleEdit');
     $this->assertEquals('[]', $content);
     //Now save successfully.
     $this->setGetArray(array('moduleClassName' => 'MeetingsModule'));
     $this->setPostArray(array('save' => 'Save', 'MeetingsModuleForm' => $this->createModuleEditGoodValidationPostData('meeting new name')));
     $this->runControllerWithRedirectExceptionAndGetContent('designer/default/moduleEdit');
     //Now confirm everything did in fact save correctly.
     $this->assertEquals('Meeting New Name', MeetingsModule::getModuleLabelByTypeAndLanguage('Singular'));
     $this->assertEquals('Meeting New Names', MeetingsModule::getModuleLabelByTypeAndLanguage('Plural'));
     $this->assertEquals('meeting new name', MeetingsModule::getModuleLabelByTypeAndLanguage('SingularLowerCase'));
     $this->assertEquals('meeting new names', MeetingsModule::getModuleLabelByTypeAndLanguage('PluralLowerCase'));
     //Load LayoutEdit for each applicable module and applicable layout.
     $this->resetPostArray();
     $this->setGetArray(array('moduleClassName' => 'MeetingsModule', 'viewClassName' => 'MeetingEditAndDetailsView'));
     $this->runControllerWithNoExceptionsAndGetContent('designer/default/LayoutEdit');
 }
 protected function resolveConfirmAlertInHtmlOptions($htmlOptions)
 {
     $htmlOptions['confirm'] = Zurmo::t('Core', 'Are you sure you want to delete this {modelLabel}?', array('{modelLabel}' => MeetingsModule::getModuleLabelByTypeAndLanguage('SingularLowerCase')));
     return $htmlOptions;
 }