Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

ezmultioption2.php
Go to the documentation of this file.
1 <?php
16 class eZMultiOption2
17 {
18 public $ID;
19 public $Rules;
23 public $MultiOptionCount;
33 public function __construct( $name, $id = 0, $multioptionIDCounter = 0, $optionCounter = 0, $groupID = 0 )
34 {
35 $this->Name = $name;
36 $this->ID = $id;
37 $this->GroupID = $groupID;
38 $this->Options = array();
39 $this->ChildGroupList = array();
40 $this->MultiOptionIDCounter = $multioptionIDCounter;
41 $this->OptionCounter = $optionCounter;
42 $this->GroupIDCounter = $groupID;
43 $this->Rules = array();
44 }
45
46 function setGroupIDCounter( $groupIDCounter )
47 {
48 $this->GroupIDCounter = $groupIDCounter;
49 }
50
51 function getGroupIDCounter()
52 {
53 return $this->GroupIDCounter;
54 }
55 function setMultiOptionIDCounter( $multioptionIDCounter )
56 {
57 $this->MultiOptionIDCounter = $multioptionIDCounter;
58 }
59
60 function getMultiOptionIDCounter()
61 {
62 return $this->MultiOptionIDCounter;
63 }
64 function setOptionCounter( $optionCounter )
65 {
66 $this->OptionCounter = $optionCounter;
67 }
68
69 function getOptionCounter()
70 {
71 return $this->OptionCounter;
72 }
73
74 function addChildGroup( $group, $multioptionID = false )
75 {
76 if ( $group->GroupID == 0 )
77 {
78 $this->GroupIDCounter++;
79 $group->GroupIDCounter = $this->GroupIDCounter;
80 $group->GroupID = $this->GroupIDCounter;
81 }
82 else
83 {
84 $this->initCounters( $group );
85 }
86 if ( $multioptionID === false )
87 {
88 $this->ChildGroupList[] = $group;
89 }
90 else
91 {
92 $this->Options[$multioptionID]['child_group'] = $group;
93 }
94 return count( $this->ChildGroupList );
95 }
96
104 function addMultiOption( $name, $multiOptionPriority, $defaultValue, $multiOptionID )
105 {
106 if ( strlen( $multiOptionID ) == 0 )
107 {
108 $this->MultiOptionIDCounter++;
109 $multiOptionID = $this->MultiOptionIDCounter;
110 }
111 else
112 {
113 if ( $this->MultiOptionIDCounter < $multiOptionID )
114 {
115 $this->MultiOptionIDCounter = $multiOptionID;
116 }
117 }
118
119 $this->Options[] = array( "id" => count( $this->Options ),
120 "multioption_id" => $multiOptionID,
121 "name" => $name,
122 'priority'=> $multiOptionPriority,
123 "default_option_id" => $defaultValue,
124 'imageoption' => false,
125 'optionlist' => array() );
126 return count( $this->Options ) - 1;
127 }
128
135 function addOption( $newID, $OptionID, $optionValue, $optionAdditionalPrice, $isSelectable = 1, $objectID = 0 )
136 {
137 $key = count( $this->Options[$newID]['optionlist'] ) + 1;
138 if ( strlen( $OptionID ) == 0 )
139 {
140 $this->OptionCounter += 1;
141 $OptionID = $this->OptionCounter;
142 }
143 else if ( $OptionID > $this->OptionCounter )
144 {
145 $this->OptionCounter = $OptionID;
146 }
147 $this->Options[$newID]['optionlist'][] = array( "id" => $key,
148 "option_id" => $OptionID,
149 "value" => $optionValue,
150 'additional_price' => $optionAdditionalPrice,
151 'is_selectable' => $isSelectable );
152 if ( $objectID )
153 {
154 $this->Options[$newID]['optionlist'][count( $this->Options[$newID]['optionlist'])-1]['object'] = $objectID;
155 $this->Options[$newID]['imageoption'] = 1;
156
157 }
158 return $OptionID;
159 }
160
161 function addOptionForMultioptionID( $multioptionID, $OptionID, $optionValue, $optionAdditionalPrice )
162 {
163 $searchResult = $this->findMultiOption( $multioptionID );
164 if ( !$searchResult )
165 return null;
166 $group = $searchResult['group'];
167 $this->initCounters( $group );
168 return $group->addOption( $searchResult['id'], $OptionID, $optionValue, $optionAdditionalPrice );
169 }
170
171 function setObjectForOption( $multioptionID, $optionID, $objectID )
172 {
173 $searchResult = $this->findMultiOption( $multioptionID );
174 if ( !$searchResult )
175 return null;
176 $group = $searchResult['group'];
177
178 if ( isset( $group->Options[$searchResult['id']]['optionlist'][$optionID] ) )
179 {
180 $group->Options[$searchResult['id']]['optionlist'][$optionID]['object'] = $objectID;
181 $group->Options[$searchResult['id']]['imageoption'] = 1;
182 }
183 }
184 function removeObjectFromOption( $multioptionID, $optionID )
185 {
186 $searchResult = $this->findMultiOption( $multioptionID );
187 if ( !$searchResult )
188 return null;
189 $group = $searchResult['group'];
190
191 if ( isset( $group->Options[$searchResult['id']]['optionlist'][$optionID]['object'] ) )
192 {
193 unset( $group->Options[$searchResult['id']]['optionlist'][$optionID]['object'] );
194 $imageoption = 0;
195 foreach ( $group->Options[$searchResult['id']]['optionlist'] as $option )
196 {
197 $imageoption = isset( $option['object'] ) ? 1 : 0;
198 }
199 $group->Options[$searchResult['id']]['imageoption'] = $imageoption;
200 }
201 }
202
203 function findGroup( $groupID, $depth = 0, $groupStack = array() )
204 {
205 $groupStack[] = array( $this->attribute( 'group_id' ), $depth );
206 if ( $depth > 15 )
207 {
208 var_dump( $groupStack );
209 die( "depth=$depth groupID=$groupID" );
210 }
211 foreach ( $this->Options as $key => $option )
212 {
213 if ( isset( $option['child_group'] ) )
214 {
215 if ( $option['child_group']->attribute( "group_id") == $groupID )
216 return $this->Options[$key]['child_group'];
217 else
218 {
219 if ( $group = $this->Options[$key]['child_group']->findGroup( $groupID, $depth + 1, $groupStack ) )
220 return $group;
221 }
222 }
223 }
224
225 foreach ( array_keys( $this->ChildGroupList ) as $key )
226 {
227 if ( $this->ChildGroupList[$key]->attribute( 'group_id' ) == $groupID )
228 {
229 return $this->ChildGroupList[$key];
230 }
231
232 if ( $group = $this->ChildGroupList[$key]->findGroup( $groupID, $depth + 1, $groupStack ) )
233 return $group;
234 }
235 $dummyGroup = null;
236 return $dummyGroup;
237 }
238
239 function findMultiOption( $multioptionID, $depth = 0 )
240 {
241 foreach ( $this->Options as $key => $optionList )
242 {
243 if ( $optionList['multioption_id'] == $multioptionID )
244 {
245 $option = $this->Options[$key];
246 return array( "group" => $this,
247 "id" => $option['id'] );
248 }
249 if ( isset( $optionList['child_group'] ) )
250 {
251 $group = $this->Options[$key]['child_group'];
252 $returnArray = $group->findMultiOption( $multioptionID,$depth+1 );
253 if ( $returnArray )
254 {
255 return $returnArray;
256 }
257 }
258 }
259
260 foreach ( array_keys( $this->ChildGroupList ) as $key )
261 {
262 $returnArray =$this->ChildGroupList[$key]->findMultiOption( $multioptionID,$depth+1 );
263 if ( $returnArray )
264 {
265 return $returnArray;
266 }
267 }
268 return null;
269 }
270
271 function findOption( $multioption, $optionID )
272 {
273 if ( $multioption )
274 {
275 $optionFound = false;
276 foreach( $multioption['optionlist'] as $option )
277 {
278 if ( $option['option_id'] == $optionID )
279 {
280 $option['multioption_name'] = $multioption['name'];
281 $optionFound = $option;
282 break;
283 }
284 }
285 return $optionFound;
286 }
287
288 foreach ( $this->Options as $key => $optionList )
289 {
290 if( $option = $this->findOption( $optionList, $optionID ) )
291 {
292 return $option;
293 }
294 else if ( array_key_exists( 'child_group', $optionList ) && $optionList['child_group'] )
295 {
296 if ( $option = $optionList['child_group']->findOption( false, $optionID ) )
297 return $option;
298 }
299 }
300
301 foreach ( array_keys( $this->ChildGroupList ) as $key )
302 {
303 if ( $option = $this->ChildGroupList[$key]->findOption( false, $optionID ) )
304 return $option;
305 }
306 return false;
307 }
308
309 function runFunctionForAllGroups( $func, $params )
310 {
311 foreach ( $this->Options as $key => $optionList )
312 {
313 if ( isset( $optionList['child_group'] ) )
314 {
315 $optionList['child_group']->runFunctionForAllGroups( $func, $params );
316 $optionList['child_group']->$func( $params );
317 }
318 }
319 foreach ( array_keys( $this->ChildGroupList ) as $key )
320 {
321 $this->ChildGroupList[$key]->runFunctionForAllGroups( $func, $params );
322 $this->ChildGroupList[$key]->$func( $params );
323 }
324 }
325
326
327 function resetCounters()
328 {
329 $this->resetOptionCounter();
330 }
331
335 function resetOptionCounter()
336 {
337 $maxValue = 0;
338 foreach ( $this->Options as $optionList )
339 {
340 foreach ( $optionList['optionlist'] as $option )
341 {
342 if ( $maxValue < $option['option_id'] )
343 {
344 $maxValue = $option['option_id'];
345 }
346 }
347 }
348 $this->OptionCounter = $maxValue;
349 }
350
354 function changeMultiOptionId()
355 {
356 $i = 0 ;
357 foreach ( $this->Options as $key => $opt )
358 {
359 $this->Options[$key]['id'] = $i++;
360 }
361 $this->MultiOptionCount = $i - 1;
362 }
363
364 function removeChildGroup( $groupID, $depth = 0 )
365 {
366 if ( $depth > 15 )
367 die( "depth=$depth" );
368 $removed = false;
369 foreach ( $this->Options as $key => $option )
370 {
371 if ( isset( $option['child_group'] ) )
372 {
373 if ( $option['child_group']->attribute( "group_id" ) == $groupID )
374 {
375 unset( $this->Options[$key]['child_group'] );
376 return true;
377 }
378 else
379 {
380 if ( $option['child_group']->removeChildGroup( $groupID, $depth + 1 ) )
381 return true;
382 }
383 }
384 }
385
386 foreach ( array_keys( $this->ChildGroupList ) as $key )
387 {
388 if ( $this->ChildGroupList[$key]->attribute( 'group_id' ) == $groupID )
389 {
390 unset( $this->ChildGroupList[$key] );
391 return true;
392 }
393 if ( $this->ChildGroupList[$key]->removeChildGroup( $groupID, $depth + 1 ) )
394 return true;
395 }
396 return false;
397 }
398
406 function removeMultiOptions( $array_remove )
407 {
408 foreach ( $array_remove as $id )
409 {
410 unset( $this->Options[ $id ] );
411 }
412 $this->Options = array_values( $this->Options );
413 $this->changeMultiOptionId();
414 }
415
416
424 function removeOptions( $arrayRemove, $optionId )
425 {
426 foreach ( $arrayRemove as $id )
427 {
428 unset( $this->Options[$optionId]['optionlist'][$id - 1] );
429 }
430 $this->Options = array_values( $this->Options );
431 $i = 1;
432 foreach ( $this->Options[$optionId]['optionlist'] as $key => $opt )
433 {
434 $this->Options[$optionId]['optionlist'][$key]['id'] = $i;
435 $i++;
436 }
437 }
438
439 function getIDsFromMultioptions( $params)
440 {
441 if ( $params['group'] )
442 {
443 foreach ( $this->Options as $multioption )
444 {
445 $params['group']->MultioptionIDList[] = $multioption['multioption_id'];
446 foreach ( $multioption['optionlist'] as $option )
447 {
448 $params['group']->OptionIDList[] = $option['option_id'];
449 }
450 }
451 }
452 }
453
454 function cleanupRules( )
455 {
456 $this->runFunctionForAllGroups( 'getIDsFromMultioptions', array( 'group' => $this ) );
457 foreach( $this->Rules as $key => $ruleForOption )
458 {
459 if ( ! in_array( $key, $this->OptionIDList ) )
460 {
461 unset( $this->Rules[$key] );
462 continue;
463 }
464
465 foreach ( $ruleForOption as $moption => $rule )
466 {
467 if ( !in_array( $moption, $this->MultioptionIDList ) )
468 {
469 unset( $this->Rules[$key][$moption] );
470 if ( count( $this->Rules[$key] ) == 0 )
471 {
472 unset( $this->Rules[$key] );
473 break;
474 }
475 continue;
476 }
477 foreach( $rule as $index =>$optionID )
478 {
479 if ( !in_array( $optionID, $this->OptionIDList ) )
480 {
481 unset( $this->Rules[$key][$moption][$index] );
482 if( count( $rule ) == 0 )
483 {
484 unset( $this->Rules[$key][$moption] );
485 break;
486 }
487 continue;
488 }
489
490 }
491 if( count( $this->Rules[$key] ) == 0 )
492 {
493 unset( $this->Rules[$key] );
494 break;
495 }
496 }
497 }
498 }
499
500 function addOptionToRules( $multioptionID, $optionID )
501 {
502 $rules = $this->Rules;
503 foreach( $this->Rules as $key => $ruleForOption )
504 {
505 foreach ( $ruleForOption as $moption => $rule )
506 {
507 if ( $multioptionID == $moption )
508 {
509 $this->Rules[$key][$moption][] = $optionID;
510 }
511 }
512 }
513 }
514
518 function attributes()
519 {
520 return array( 'name',
521 'id',
522 'group_id',
523 'rules',
524 'multioption_list',
525 'optiongroup_list' );
526 }
527
533 function hasAttribute( $name )
534 {
535 return in_array( $name, $this->attributes() );
536 }
537
543 function attribute( $name )
544 {
545 switch ( $name )
546 {
547 case "name" :
548 {
549 return $this->Name;
550 } break;
551 case "id" :
552 {
553 return $this->ID;
554 } break;
555 case "group_id":
556 {
557 return $this->GroupID;
558 } break;
559 case "rules":
560 {
561 return $this->Rules;
562 } break;
563 case "multioption_list" :
564 {
565 return $this->Options;
566 } break;
567 case "optiongroup_list":
568 {
569 return $this->ChildGroupList;
570 } break;
571 default:
572 {
573 eZDebug::writeError( "Attribute '$name' does not exist", __METHOD__ );
574 $retValue = null;
575 return $retValue;
576 }break;
577 }
578 }
579
580 function initCountersRecursive()
581 {
582 $this->runFunctionForAllGroups( 'initCounters', $this );
583 }
584
585 function initCounters( $group )
586 {
587 if ( $this->GroupIDCounter < $this->attribute( 'group_id' ) )
588 $this->GroupIDCounter = $this->attribute( 'group_id' );
589
590 if ( $this->GroupIDCounter < $group->getGroupIDCounter() )
591 $this->GroupIDCounter = $group->getGroupIDCounter();
592
593 if ( $this->OptionCounter < $group->getOptionCounter() )
594 $this->OptionCounter = $group->getOptionCounter();
595
596 if ( $this->getMultiOptionIDCounter() < $group->getMultiOptionIDCounter() )
597 $this->setMultiOptionIDCounter( $group->getMultiOptionIDCounter() );
598 }
599
607 function decodeXML( $xmlString )
608 {
609 $this->OptionCounter = 0;
610 $this->Options = array();
611 if ( $xmlString != "" )
612 {
613 $dom = new DOMDocument( '1.0', 'utf-8' );
614 $success = $dom->loadXML( $xmlString );
615
616 $root = $dom->documentElement;
617
618 if ( $root->localName == 'ezmultioption' )
619 {
620 $this->initFromXMLCompat( $root );
621 return;
622 }
623
624 $this->initGroupFromDom( $root );
625
626 $rulesNode = $root->getElementsByTagName( "rules" )->item( 0 );
627 if ( !$rulesNode )
628 return;
629 $ruleList = $rulesNode->getElementsByTagName( "rule" );
630 //Loop for rules
631 $rules = array();
632 foreach ( $ruleList as $ruleNode )
633 {
634 $optionID = $ruleNode->getAttribute( "option_id" );
635 $ruleDataNodeList = $ruleNode->getElementsByTagName( 'rule_data' );
636 $ruleForOption = array();
637 foreach ( $ruleDataNodeList as $ruleDataNode )
638 {
639 $multioptionID = $ruleDataNode->getAttribute( "multioption_id" );
640 $includeOptionNodeList = $ruleDataNode->getElementsByTagName( 'option_id' );
641 $includeOptions = array();
642 foreach ( $includeOptionNodeList as $includeOptionNode )
643 {
644 $includeOptions[] = $includeOptionNode->textContent;
645 }
646 $ruleForOption[$multioptionID] = $includeOptions;
647 }
648 $rules[$optionID] = $ruleForOption;
649 }
650 $this->Rules = $rules;
651 }
652 else
653 {
654 //The control come here while creaging new object for MultiOption
655 $group = new eZMultiOption2( '' );
656 $this->addChildGroup( $group );
657 $nodeID = $group->addMultiOption( "", 0, false , '' );
658 $group->addOption( $nodeID, "", "", "" );
659 $this->initCounters( $group );
660 unset( $group);
661 }
662 }
663
664 function initFromXMLCompat( $root, $new = false )
665 {
666 if ( $root && $root->getAttribute( 'option_counter' ) > 0 )
667 {
668 $this->Name = '';
669 $this->OptionCounter = 0;
670 $this->MultiOptionIDCounter = 0;
671 $this->GroupIDCounter = 1;
672 $this->GroupID = 0;
673 $this->ID = 0;
674
675 $multiOptionGroup = new eZMultiOption2( '', 0, 0, 0, 1 );
676 $multiOptionGroup->initCounters( $this );
677 $multiOptionGroup->initGroupFromDom( $root );
678 $this->initCounters( $multiOptionGroup );
679 $this->ChildGroupList[] = $multiOptionGroup;
680
681 }
682 }
683
684 function initGroupFromDom( $root, $new = false )
685 {
686 $xpath = new DOMXPath( $root->ownerDocument );
687
688 if ( $root && $root->getAttribute("option_counter") > 0 )
689 {
690 // set the name of the node
691 $this->Name = $xpath->query( 'name', $root )->item( 0 )->textContent;
692 $this->OptionCounter = $root->getAttribute("option_counter");
693 $this->MultiOptionIDCounter = $root->getAttribute("multioption_counter")
694 ? $root->getAttribute("multioption_counter")
695 : $this->MultiOptionIDCounter;
696
697 $this->GroupIDCounter = $root->getAttribute( 'group_counter ') ? $root->getAttribute( 'group_counter ') : $this->GroupIDCounter;
698 $this->GroupID = $root->getAttribute( 'group_id' ) ? $root->getAttribute( 'group_id' ) : $this->GroupID ;
699 $this->ID = $root->getAttribute( 'id' ) ? $root->getAttribute( 'id' ) : $this->ID;
700
701 $multioptionsList = $xpath->query( "multioptions/multioption", $root );
702 //Loop for MultiOptions
703 foreach ( $multioptionsList as $multioption )
704 {
705 $newID = $this->addMultiOption( $multioption->getAttribute( "name" ),
706 $multioption->getAttribute( "priority" ),
707 $multioption->getAttribute( "default_option_id" ),
708 $multioption->getAttribute( "multioption_id" ) );
709
710 $optionNode = $xpath->query( "option", $multioption );
711 foreach ( $optionNode as $option )
712 {
713 $isSelectable = $option->getAttribute( "is_selectable" ) === false ? 1 : $option->getAttribute( "is_selectable" );
714 $this->addOption( $newID,
715 $option->getAttribute( "option_id" ),
716 $option->getAttribute( "value" ),
717 $option->getAttribute( "additional_price" ),
718 $isSelectable,
719 $option->getAttribute( "object" ) );
720 }
721 $groupNode = $xpath->query( "optiongroup", $multioption )->item( 0 );
722 if( $groupNode )
723 {
724 $multiOptionGroup = new eZMultiOption2( '' );
725 $multiOptionGroup->initCounters( $this );
726 $multiOptionGroup->initGroupFromDom( $groupNode );
727 $this->initCounters( $multiOptionGroup );
728 $this->Options[$newID]['child_group'] = $multiOptionGroup;
729 }
730
731 }
732 $this->changeMultiOptionId();
733
734 $groupList = $xpath->query( "groups/optiongroup", $root );
735 foreach ( $groupList as $group )
736 {
737 $multiOptionGroup = new eZMultiOption2( '' );
738 $multiOptionGroup->initCounters( $this );
739 $multiOptionGroup->initGroupFromDom( $group );
740 $this->initCounters( $multiOptionGroup );
741 $this->ChildGroupList[] = $multiOptionGroup;
742 }
743
744 }
745 else
746 {
747 //The control come here while creating new object for MultiOption
748 if ( $new )
749 {
750 $nodeID = $this->addMultiOption( "", 0, false, '' );
751 $this->addOption( $nodeID, "", "", "" );
752 }
753 }
754
755 }
756
761 function xmlString()
762 {
763 $doc = new DOMDocument( '1.0', 'utf-8' );
764 $root = $doc->createElement( "ezmultioption2" );
765 $doc->appendChild( $root );
766
767
768 $this->createDomElementForGroup( $doc, $root );
769
770 $rulesNode = $doc->createElement( "rules" );
771
772 foreach ( $this->Rules as $ruleFor => $rule )
773 {
774 unset( $ruleNode );
775 $ruleNode = $doc->createElement( "rule" );
776 $ruleNode->setAttribute( "option_id", $ruleFor );
777 foreach ( $rule as $multioptionID => $ruleData )
778 {
779 unset( $ruleDataNode );
780 $ruleDataNode = $doc->createElement( "rule_data" );
781 $ruleDataNode->setAttribute( "multioption_id", $multioptionID );
782 foreach ( $ruleData as $optionID )
783 {
784 unset( $includeNode );
785 $includeNode = $doc->createElement( "option_id", $optionID );
786 $ruleDataNode->appendChild( $includeNode );
787 }
788 $ruleNode->appendChild( $ruleDataNode );
789 }
790 $rulesNode->appendChild( $ruleNode );
791 }
792 $root->appendChild( $rulesNode );
793
794 $xml = $doc->saveXML();
795 return $xml;
796 }
797
798 function createDomElementForGroup( $doc, $groupNode, $depth = 0 )
799 {
800 $root = $groupNode;
801 $root->setAttribute( 'option_counter', $this->OptionCounter );
802 $root->setAttribute( 'multioption_counter', $this->MultiOptionIDCounter );
803 $root->setAttribute( 'group_counter', $this->GroupIDCounter );
804
805 $root->setAttribute( 'group_id', $this->GroupID );
806 $root->setAttribute( 'id', $this->ID );
807
808 $name = $doc->createElement( "name", $this->Name );
809 $root->appendChild( $name );
810
811 $multioptions = $doc->createElement( "multioptions" );
812 $root->appendChild( $multioptions );
813
814 foreach ( $this->Options as $multioption )
815 {
816 unset( $multioptionNode );
817 $multioptionNode = $doc->createElement( "multioption" );
818 $multioptionNode->setAttribute( "id", $multioption['id'] );
819 $multioptionNode->setAttribute( "name", $multioption['name'] );
820 $multioptionNode->setAttribute( "multioption_id", $multioption['multioption_id'] );
821 $multioptionNode->setAttribute( "priority", $multioption['priority'] );
822 $multioptionNode->setAttribute( 'default_option_id', $multioption['default_option_id'] );
823
824 if ( isset( $multioption['imageoption'] ) && $multioption['imageoption'] )
825 $multioptionNode->setAttribute( "imageoption", $multioption['imageoption'] );
826
827 foreach ( $multioption['optionlist'] as $option )
828 {
829 unset( $optionNode );
830 $optionNode = $doc->createElement( "option" );
831 $optionNode->setAttribute( "id", $option['id'] );
832 $optionNode->setAttribute( "option_id", $option['option_id'] );
833 $optionNode->setAttribute( "value", $option['value'] );
834
835 if ( isset( $option['object'] ) && $option['object'] )
836 {
837 $optionNode->setAttribute( "object", $option['object'] );
838 }
839 $optionNode->setAttribute( 'additional_price', $option['additional_price'] );
840 $optionNode->setAttribute( 'is_selectable', $option['is_selectable'] );
841 $multioptionNode->appendChild( $optionNode );
842 }
843 if ( array_key_exists( 'child_group', $multioption ) && $multioption['child_group'] )
844 {
845 $childGroup = $multioption['child_group'];
846 unset( $childGroupNode );
847 $childGroupNode = $doc->createElement( "optiongroup" );
848 $childGroupNode->setAttribute( "id", $childGroup->ID );
849 $childGroup->createDomElementForGroup( $doc, $childGroupNode, $depth + 1 );
850 $multioptionNode->appendChild( $childGroupNode );
851 }
852 $multioptions->appendChild( $multioptionNode );
853 }
854
855 $groups = $doc->createElement( "groups" );
856
857 foreach ( $this->ChildGroupList as $childGroup )
858 {
859 unset( $childGroupNode );
860 $childGroupNode = $doc->createElement( "optiongroup" );
861 $childGroupNode->setAttribute( "id", $childGroup->ID );
862 $childGroup->createDomElementForGroup( $doc, $childGroupNode, $depth + 1 );
863 $groups->appendChild( $childGroupNode );
864 }
865 $root->appendChild( $groups );
866 return $root;
867
868 }
871 public $Name;
872 public $GroupID;
874 public $Options;
876 public $MultiOptionIDCounter;
877 public $GroupIDCounter;
879 public $OptionCounter;
880 public $ChildGroupList;
881 public $MultioptionIDList = array();
882 public $OptionIDList = array();
883 }
884 ?>
eZDebug\writeError
static writeError( $string, $label="", $backgroundClass="")
Definition: ezdebug.php:545
eZMultiOption2
Encapsulates multiple options in one datatype.
Definition: ezmultioption2.php:17
eZMultiOption2\addMultiOption
addMultiOption( $name, $multiOptionPriority, $defaultValue, $multiOptionID)
Definition: ezmultioption2.php:104
eZMultiOption2\removeOptions
removeOptions( $arrayRemove, $optionId)
Definition: ezmultioption2.php:424
eZMultiOption2\initCountersRecursive
initCountersRecursive()
Definition: ezmultioption2.php:580
eZMultiOption2\findGroup
findGroup( $groupID, $depth=0, $groupStack=array())
Definition: ezmultioption2.php:203
eZMultiOption2\initGroupFromDom
initGroupFromDom( $root, $new=false)
Definition: ezmultioption2.php:684
eZMultiOption2\attributes
attributes()
Definition: ezmultioption2.php:518
eZMultiOption2\setGroupIDCounter
setGroupIDCounter( $groupIDCounter)
Definition: ezmultioption2.php:46
eZMultiOption2\findOption
findOption( $multioption, $optionID)
Definition: ezmultioption2.php:271
eZMultiOption2\initFromXMLCompat
initFromXMLCompat( $root, $new=false)
Definition: ezmultioption2.php:664
eZMultiOption2\removeChildGroup
removeChildGroup( $groupID, $depth=0)
Definition: ezmultioption2.php:364
eZMultiOption2\runFunctionForAllGroups
runFunctionForAllGroups( $func, $params)
Definition: ezmultioption2.php:309
eZMultiOption2\$Options
$Options
Contains the Options.
Definition: ezmultioption2.php:874
eZMultiOption2\hasAttribute
hasAttribute( $name)
Definition: ezmultioption2.php:533
eZMultiOption2\resetCounters
resetCounters()
Definition: ezmultioption2.php:327
eZMultiOption2\$GroupIDCounter
$GroupIDCounter
Definition: ezmultioption2.php:877
eZMultiOption2\__construct
__construct( $name, $id=0, $multioptionIDCounter=0, $optionCounter=0, $groupID=0)
Definition: ezmultioption2.php:33
eZMultiOption2\attribute
attribute( $name)
Definition: ezmultioption2.php:543
eZMultiOption2\$MultiOptionCount
$MultiOptionCount
Definition: ezmultioption2.php:23
eZMultiOption2\findMultiOption
findMultiOption( $multioptionID, $depth=0)
Definition: ezmultioption2.php:239
eZMultiOption2\getGroupIDCounter
getGroupIDCounter()
Definition: ezmultioption2.php:51
eZMultiOption2\resetOptionCounter
resetOptionCounter()
Definition: ezmultioption2.php:335
eZMultiOption2\initCounters
initCounters( $group)
Definition: ezmultioption2.php:585
eZMultiOption2\setOptionCounter
setOptionCounter( $optionCounter)
Definition: ezmultioption2.php:64
eZMultiOption2\removeMultiOptions
removeMultiOptions( $array_remove)
Definition: ezmultioption2.php:406
eZMultiOption2\$MultiOptionIDCounter
$MultiOptionIDCounter
Contains the multioption counter value.
Definition: ezmultioption2.php:876
eZMultiOption2\$OptionIDList
$OptionIDList
Definition: ezmultioption2.php:882
eZMultiOption2\getOptionCounter
getOptionCounter()
Definition: ezmultioption2.php:69
eZMultiOption2\xmlString
xmlString()
Definition: ezmultioption2.php:761
eZMultiOption2\addOptionToRules
addOptionToRules( $multioptionID, $optionID)
Definition: ezmultioption2.php:500
eZMultiOption2\cleanupRules
cleanupRules()
Definition: ezmultioption2.php:454
eZMultiOption2\$Rules
$Rules
Definition: ezmultioption2.php:19
eZMultiOption2\addOption
addOption( $newID, $OptionID, $optionValue, $optionAdditionalPrice, $isSelectable=1, $objectID=0)
Definition: ezmultioption2.php:135
eZMultiOption2\setObjectForOption
setObjectForOption( $multioptionID, $optionID, $objectID)
Definition: ezmultioption2.php:171
eZMultiOption2\createDomElementForGroup
createDomElementForGroup( $doc, $groupNode, $depth=0)
Definition: ezmultioption2.php:798
eZMultiOption2\$MultioptionIDList
$MultioptionIDList
Definition: ezmultioption2.php:881
eZMultiOption2\addChildGroup
addChildGroup( $group, $multioptionID=false)
Definition: ezmultioption2.php:74
eZMultiOption2\removeObjectFromOption
removeObjectFromOption( $multioptionID, $optionID)
Definition: ezmultioption2.php:184
eZMultiOption2\$OptionCounter
$OptionCounter
Contains the option counter value.
Definition: ezmultioption2.php:879
eZMultiOption2\$GroupID
$GroupID
Definition: ezmultioption2.php:872
eZMultiOption2\addOptionForMultioptionID
addOptionForMultioptionID( $multioptionID, $OptionID, $optionValue, $optionAdditionalPrice)
Definition: ezmultioption2.php:161
eZMultiOption2\changeMultiOptionId
changeMultiOptionId()
Definition: ezmultioption2.php:354
eZMultiOption2\decodeXML
decodeXML( $xmlString)
Definition: ezmultioption2.php:607
eZMultiOption2\$Name
$Name
Definition: ezmultioption2.php:871
eZMultiOption2\getMultiOptionIDCounter
getMultiOptionIDCounter()
Definition: ezmultioption2.php:60
eZMultiOption2\$ChildGroupList
$ChildGroupList
Definition: ezmultioption2.php:880
eZMultiOption2\getIDsFromMultioptions
getIDsFromMultioptions( $params)
Definition: ezmultioption2.php:439
eZMultiOption2\$ID
$ID
Definition: ezmultioption2.php:18
eZMultiOption2\setMultiOptionIDCounter
setMultiOptionIDCounter( $multioptionIDCounter)
Definition: ezmultioption2.php:55
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.