function _ProcessCodeContainingIterators($st)
 {
     // recursive
     /*	ex. $st="somehtmlcode<!--__OEITSTART-->iteratorcode<!--__OEITEND--><!--__OEITSTART-->iteratorcode<!--__OEITEND-->somehtmlcode"
     			where iteratorcode may = somehtmlcode<!--__OEITSTART-->subiteratorcode<!--__OEITEND-->somehtmlcode<!--__OEITSTART-->subiteratorcode<!--__OEITEND-->somehtmlcode
     			
     			apply values (HTML modifiers) in somehtmlcode (non-iterator parts) according to current values and row counters - _ApplyValuesInHTMLCode()
     			then process each top-level iterator block - _ProcessIterator(), who recursively calls _ProcessCodeContainingIterators(iterator's inner code) for each row
     			returns output html code string with all values and iterators applied
     			
     			See comments for _ProcessIterator()
     			
     		* * * */
     //echo "Entering _ProcessCodeContainingIterators()<br/>";
     if (!isset($st[0])) {
         return $st;
     }
     // fast check for non-empty string
     $r = "";
     $posLastIterEnd = 0;
     while (true) {
         $tm_start2 = microtime(true);
         $posIterator = strpos($st, $this->ITSTART, $posLastIterEnd);
         // find next <!--__OEITSTART
         // apply inline HTML modifiers to not-yet-processed html BEFORE iterator block, or remaining code till the end if no more iterators:
         $codeOutsideIterator = $posIterator !== false ? substr($st, $posLastIterEnd, $posIterator - $posLastIterEnd) : substr($st, $posLastIterEnd);
         if ($codeOutsideIterator) {
             //echo '$codeOutsideIterator:';var_dump($codeOutsideIterator);
             $tm_start = microtime(true);
             $r .= $this->_ApplyValuesInHTMLCode($codeOutsideIterator);
             // outside-iterator code
             //echo "====TIME USED _ApplyValuesInHTMLCode::".((microtime(true) - $tm_start)*1000)." <br/>";
             //echo "\$posIterator = $posIterator ";
         }
         if ($posIterator === false) {
             break;
         }
         // all processed
         // find substring corresponding to iterator (note that iterator may include subiterators):
         $tm_start = microtime(true);
         $posLastIterEnd = OEDynUtils::FindEndBlock($st, $posIterator + 1, $this->ITSTART, $this->ITEND);
         if ($posLastIterEnd < 0) {
             return $st;
         }
         // error, non-terminated block
         $posLastIterEnd += strlen($this->ITEND);
         // position just after the iterator
         //echo "\$posLastIterEnd = $posLastIterEnd ";
         // recursive-generate iterator code and apply it to output
         //echo '$codeIterator:';var_dump(substr($st, $posIterator, $posLastIterEnd-$posIterator));
         $tm_start = microtime(true);
         $xCurrentRow = OEDataContainer::$iCurrentRow;
         $r .= $this->_ProcessIterator(substr($st, $posIterator, $posLastIterEnd - $posIterator));
         // inside-iterator code
         OEDataContainer::$iCurrentRow = $xCurrentRow;
         // restore global row counter
         //echo "====TIME USED _ProcessIterator::".((microtime(true) - $tm_start)*1000)." <br/>";
         //echo "====TIME USED inside CI while::".((microtime(true) - $tm_start2)*1000)." <br/>";
     }
     //echo "_ProcessCodeContainingIterators:";var_dump($r);
     return $r;
 }
Beispiel #2
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;
 }
 function __construct($Name, $mainManager)
 {
     // constructor
     parent::__construct($Name);
     if (empty($mainManager)) {
         return;
     }
     $this->Manager = $mainManager;
 }