Exemplo n.º 1
0
 /**
  * Private function, only for notifications from AnwContentSettings.
  */
 public function ___notifyConfigurableContentChanged()
 {
     AnwUtils::checkFriendAccess("AnwContentSettings");
     $this->oContentSettings = null;
 }
Exemplo n.º 2
0
 /**
  * Returns array of settings values (override values when present, default ones when not overriden).
  */
 function toFusionedCfgArray()
 {
     AnwUtils::checkFriendAccess(array("AnwComponent", "AnwContentSettings"));
     $cfg = array();
     $aoConfigurableSettings = $this->getContentFieldsContainer()->getContentFields();
     foreach ($aoConfigurableSettings as $oSetting) {
         $sSettingName = $oSetting->getName();
         if ($oSetting instanceof AnwStructuredContentField_atomic) {
             $aoSettingValues = $this->getContentFieldValues($sSettingName);
             $cfg[$sSettingName] = array();
             foreach ($aoSettingValues as $oSettingValue) {
                 $cfg[$sSettingName][] = $oSetting->getArrayItemFromValue($oSettingValue);
             }
         } else {
             //recursive call
             $aoSubContents = $this->getSubContents($sSettingName);
             $cfg[$sSettingName] = array();
             foreach ($aoSubContents as $oSubContent) {
                 $amSubCfg = $oSubContent->toFusionedCfgArray();
                 //if ($amSubCfg!==null)
                 //{
                 $cfg[$sSettingName][] = $amSubCfg;
                 //}
             }
         }
         //atomic fields don't need to be in an array, as they have only 1 value
         if (!$oSetting->isMultiple() && isset($cfg[$sSettingName])) {
             $cfg[$sSettingName] = array_pop($cfg[$sSettingName]);
         }
     }
     return $cfg;
 }
Exemplo n.º 3
0
 function renderAdditionalEditInput($sSuffix, $oContentParent)
 {
     AnwUtils::checkFriendAccess("AnwStructuredContent");
     if (!$this->isMultiple()) {
         throw new AnwUnexpectedException("JS_AddMultipleContentField on non multiple field");
     }
     //temporary disable collapsing
     self::setDoCollapsing(false);
     $nNewSuffixNumber = AnwUtils::genUniqueIdNumeric();
     $sDefaultValue = null;
     if ($this instanceof AnwStructuredContentField_composed) {
         $sNewSuffix = $this->updateSuffix($sSuffix, $nNewSuffixNumber);
         $oSubContent = $oContentParent->newContent($this);
         $sSubRender = $oSubContent->renderEditHtmlForm(false, "", $sNewSuffix);
         $sDefaultValue = array(AnwStructuredContent::IDX_SUBCONTENT => $oSubContent, AnwStructuredContent::IDX_RENDERED => $sSubRender);
     } else {
         $aoValuesTmp = $this->getDefaultValues();
         // in two lines for avoiding php warning
         $sDefaultValue = array_pop($aoValuesTmp);
         //TODO ??
     }
     $sHtmlRender = $this->renderEditInputN($sSuffix, $sDefaultValue, $nNewSuffixNumber);
     //enable collapsing again
     self::setDoCollapsing(true);
     return $sHtmlRender;
 }
Exemplo n.º 4
0
 /**
  * Only for unittest usage.
  */
 static function ___unittest_getSettingsFromFile_doOverride($amDefaultSettings, $amOverrideSettings)
 {
     AnwUtils::checkFriendAccess("AnwSettingsTestCase");
     return self::getSettingsFromFile_doOverride($amDefaultSettings, $amOverrideSettings);
 }