/**
  * @param RedBeanModel $model
  * @param array $explicitReadWriteModelPermissions
  */
 protected function afterSetAttributesDuringSave($model, $explicitReadWriteModelPermissions)
 {
     assert('$model instanceof SavedCalendar');
     $postData = PostUtil::getData();
     $wizardFormClassName = ReportToWizardFormAdapter::getFormClassNameByType(Report::TYPE_ROWS_AND_COLUMNS);
     if (isset($postData[$wizardFormClassName])) {
         CalendarUtil::populateFiltersDataInModel($model, $postData[$wizardFormClassName]);
     }
 }
Example #2
0
 /**
  * Populate saved calendar module.
  *
  * @param User $user
  * @param string $name
  * @param string $moduleClassName
  * @param string $startAttributeName
  * @param string $endAttributeName
  */
 public static function populateSavedCalendar(User $user, $name, $moduleClassName, $startAttributeName, $endAttributeName = '')
 {
     $savedCalendar = new SavedCalendar();
     $savedCalendar->name = $name;
     $savedCalendar->timeZone = $user->timeZone;
     $savedCalendar->location = 'Chicago';
     $savedCalendar->moduleClassName = $moduleClassName;
     $savedCalendar->startAttributeName = $startAttributeName;
     $savedCalendar->endAttributeName = $endAttributeName;
     assert($savedCalendar->save());
     // Not Coding Standard
     CalendarUtil::setMyCalendarColor($savedCalendar, $user);
     $filtersData = array('filtersStructure' => '1', 'Filters' => array(array('attributeIndexOrDerivedType' => 'owner__User', 'structurePosition' => '1', 'operator' => 'equals', 'value' => $user->id, 'stringifiedModelForValue' => strval($user), 'availableAtRunTime' => '0')));
     CalendarUtil::populateFiltersDataInModel($savedCalendar, $filtersData);
     assert($savedCalendar->save());
     // Not Coding Standard
     return $savedCalendar;
 }