Esempio n. 1
0
 function &_AddDataContainerFromArray($name, &$ar)
 {
     $tr = null;
     if (empty($name)) {
         return $tr;
     }
     // return $tr=null because function returns reference
     // not that $ar can be null, meaning empty or virtual container
     if (strpos($name, 'FormInputs') !== false) {
         // special type of container
         $tr = new OEHTMLValsContainer($name);
         if (!empty($ar)) {
             $tr->SetFromAssociativeArray($ar);
         }
         $tr->ObtainPOSTValues();
     } else {
         if (strpos($name, 'ConstVals') !== false) {
             // special type of container
             $tr = new OEConstSrcContainer($name);
             $tr->SetFromAssociativeArray($ar);
             $tr->TranslateLocalizableValues($this->currLang);
         } else {
             if (strpos($name, 'FormattedItems') !== false) {
                 // special type of container
                 $tr = new OEFormattedItemsContainer($name, $this);
                 $tr->SetFromAssociativeArray($ar);
                 $tr->TranslateLocalizableValues($this->currLang);
             } else {
                 if (strpos($name, 'EventParams') !== false) {
                     // special type of container
                     $tr = new OEEventParamsContainer($name, $this);
                     // virtual container, contains no physical data, instead gets value of DBValue used by element's property
                 } else {
                     if (strpos($name, 'URLParams') !== false) {
                         // special type of container
                         $tr = new OEPageParamsContainer($name);
                         // session values container
                     } else {
                         if (strpos($name, 'Session') !== false) {
                             // special type of container
                             $tr = new OESessionContainer($name);
                             // session values container
                         } else {
                             if (strpos($name, 'Cookie') !== false) {
                                 // special type of container
                                 $tr = new OECookieContainer($name);
                                 // cookie values container
                             } else {
                                 if (strpos($name, 'AutoVals') !== false) {
                                     // special type of container
                                     $tr = new OEAutoContainer($name, $this);
                                     // special "auto" values container
                                     if (!empty($ar)) {
                                         $tr->SetFromAssociativeArray($ar);
                                     }
                                     $tr->InitValues($this);
                                 } else {
                                     if (empty($ar)) {
                                         return $tr;
                                     }
                                     // check
                                     $tr = new OEDataContainer($name);
                                     $tr->SetFromAssociativeArray($ar);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     $this->AddContainer($tr);
     return $tr;
 }