public function testSuperUserTaskDefaultControllerActions() { $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super'); //Load AttributesList for Task module. $this->setGetArray(array('moduleClassName' => 'TasksModule')); $this->runControllerWithNoExceptionsAndGetContent('designer/default/attributesList'); //Load ModuleLayoutsList for Task module. $this->setGetArray(array('moduleClassName' => 'TasksModule')); $this->runControllerWithNoExceptionsAndGetContent('designer/default/moduleLayoutsList'); //Load ModuleEdit view for each applicable module. $this->setGetArray(array('moduleClassName' => 'TasksModule')); $this->runControllerWithNoExceptionsAndGetContent('designer/default/moduleEdit'); //Now validate save with failed validation. $this->setGetArray(array('moduleClassName' => 'TasksModule')); $this->setPostArray(array('ajax' => 'edit-form', 'TasksModuleForm' => $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' => 'TasksModule')); $this->setPostArray(array('ajax' => 'edit-form', 'TasksModuleForm' => $this->createModuleEditGoodValidationPostData('task new name'))); $content = $this->runControllerWithExitExceptionAndGetContent('designer/default/moduleEdit'); $this->assertEquals('[]', $content); //Now save successfully. $this->setGetArray(array('moduleClassName' => 'TasksModule')); $this->setPostArray(array('save' => 'Save', 'TasksModuleForm' => $this->createModuleEditGoodValidationPostData('task new name'))); $this->runControllerWithRedirectExceptionAndGetContent('designer/default/moduleEdit'); //Now confirm everything did in fact save correctly. $this->assertEquals('Task New Name', TasksModule::getModuleLabelByTypeAndLanguage('Singular')); $this->assertEquals('Task New Names', TasksModule::getModuleLabelByTypeAndLanguage('Plural')); $this->assertEquals('task new name', TasksModule::getModuleLabelByTypeAndLanguage('SingularLowerCase')); $this->assertEquals('task new names', TasksModule::getModuleLabelByTypeAndLanguage('PluralLowerCase')); //Load LayoutEdit for each applicable module and applicable layout $this->resetPostArray(); $this->setGetArray(array('moduleClassName' => 'TasksModule', 'viewClassName' => 'OpenTasksForAccountRelatedListView')); $this->runControllerWithNoExceptionsAndGetContent('designer/default/LayoutEdit'); $this->setGetArray(array('moduleClassName' => 'TasksModule', 'viewClassName' => 'OpenTasksForContactRelatedListView')); $this->runControllerWithNoExceptionsAndGetContent('designer/default/LayoutEdit'); $this->setGetArray(array('moduleClassName' => 'TasksModule', 'viewClassName' => 'OpenTasksForOpportunityRelatedListView')); $this->runControllerWithNoExceptionsAndGetContent('designer/default/LayoutEdit'); $this->setGetArray(array('moduleClassName' => 'TasksModule', 'viewClassName' => 'TaskEditAndDetailsView')); $this->runControllerWithNoExceptionsAndGetContent('designer/default/LayoutEdit'); }
/** * 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); }
protected function resolveConfirmAlertInHtmlOptions($htmlOptions) { $htmlOptions['confirm'] = Zurmo::t('TasksModule', 'Are you sure you want to delete this {modelLabel}?', array('{modelLabel}' => TasksModule::getModuleLabelByTypeAndLanguage('SingularLowerCase'))); return $htmlOptions; }
/** * Action called in the event that the mass delete quantity is larger than the pageSize. * This action is called after the pageSize quantity has been delted and continues to be * called until the mass delete action is complete. For example, if there are 20 records to delete * and the pageSize is 5, then this action will be called 3 times. The first 5 are updated when * the actionMassDelete is called upon the initial form submission. */ public function actionMassDeleteProgress() { $pageSize = Yii::app()->pagination->resolveActiveForCurrentUserByType('massDeleteProgressPageSize'); $task = new Task(false); $dataProvider = $this->getDataProviderByResolvingSelectAllFromGet(new TasksSearchForm($task), $pageSize, Yii::app()->user->userModel->id, null, 'TasksSearchView'); $this->processMassDeleteProgress('Task', $pageSize, TasksModule::getModuleLabelByTypeAndLanguage('Plural'), $dataProvider); }