protected function saveModalConfigPerUserAndRelationModelId($modalConfigMetadata)
 {
     $user = Yii::app()->user->userModel;
     $metadata = MetadataUtil::getMetadata('CampaignOverallMetricsView', $user);
     $metadata['perUser'][intval($_GET['portletParams']['relationModelId'])] = $modalConfigMetadata;
     MetadataUtil::setMetadata('CampaignOverallMetricsView', $metadata, $user);
 }
 /**
  * @return array
  */
 public static function getMetadata()
 {
     $className = get_called_class();
     try {
         return GeneralCache::getEntry($className . 'Metadata');
     } catch (NotFoundException $e) {
     }
     $metadata = MetadataUtil::getMetadata($className);
     if (YII_DEBUG) {
         $className::assertMetadataIsValid($metadata);
     }
     GeneralCache::cacheEntry($className . 'Metadata', $metadata);
     return $metadata;
 }
 /**
  * @return array
  */
 public static function getMetadata()
 {
     $className = get_called_class();
     try {
         // not using default value to save cpu cycles on requests that follow the first exception.
         return GeneralCache::getEntry($className . 'Metadata');
     } catch (NotFoundException $e) {
     }
     $metadata = MetadataUtil::getMetadata($className);
     if (YII_DEBUG) {
         $className::assertMetadataIsValid($metadata);
     }
     GeneralCache::cacheEntry($className . 'Metadata', $metadata);
     return $metadata;
 }
 /**
  * Returns metadata for use in automatically generating the view.  Will attempt to retrieve from cache if
  * available, otherwill retrieve from database and cache.
  * @see getDefaultMetadata()
  * @param $user The current user.
  * @returns An array of metadata.
  */
 public static function getMetadata(User $user = null)
 {
     $className = static::resolveMetadataClassNameToUse();
     if ($user == null) {
         try {
             return GeneralCache::getEntry($className . 'Metadata');
         } catch (NotFoundException $e) {
         }
     }
     $metadata = MetadataUtil::getMetadata($className, $user);
     if (YII_DEBUG) {
         $className::assertMetadataIsValid($metadata);
     }
     if ($user == null) {
         GeneralCache::cacheEntry($className . 'Metadata', $metadata);
     }
     return $metadata;
 }
 /**
  * Returns metadata for use in automatically generating the view.  Will attempt to retrieve from cache if
  * available, otherwill retrieve from database and cache.
  * @see getDefaultMetadata()
  * @param $user The current user.
  * @returns An array of metadata.
  */
 public static function getMetadata(User $user = null)
 {
     $className = static::resolveMetadataClassNameToUse();
     if ($user == null) {
         try {
             // not using default value to save cpu cycles on requests that follow the first exception.
             return GeneralCache::getEntry($className . 'Metadata');
         } catch (NotFoundException $e) {
         }
     }
     $metadata = MetadataUtil::getMetadata($className, $user);
     if (YII_DEBUG) {
         $className::assertMetadataIsValid($metadata);
     }
     if ($user == null) {
         GeneralCache::cacheEntry($className . 'Metadata', $metadata);
     }
     return $metadata;
 }
 /**
  * @return CFormModel
  * @throws NotSupportedException
  */
 protected function resolveForm()
 {
     if ($this->formModel !== null) {
         return $this->formModel;
     }
     if ($this->formModelClassName == null) {
         throw new NotSupportedException();
     } else {
         $formModelClassName = $this->formModelClassName;
     }
     $formModel = new $formModelClassName();
     $user = Yii::app()->user->userModel;
     $metadata = MetadataUtil::getMetadata('CampaignOverallMetricsView', $user);
     $campaignId = 0;
     if (isset($this->params['relationModel'])) {
         $campaignId = $this->params['relationModel']->id;
     } elseif (isset($this->params['relationModelId'])) {
         $campaignId = $this->params['relationModelId'];
     }
     if (isset($metadata['perUser'][$campaignId])) {
         $formModel->beginDate = $metadata['perUser'][$campaignId]['beginDate'];
         $formModel->endDate = $metadata['perUser'][$campaignId]['endDate'];
         $formModel->groupBy = $metadata['perUser'][$campaignId]['groupBy'];
     } else {
         $metadata = self::getMetadata();
         $perUserMetadata = $metadata['perUser'];
         $this->resolveEvaluateSubString($perUserMetadata, null);
         $formModel->setAttributes($perUserMetadata);
     }
     $this->formModel = $formModel;
     return $formModel;
 }