/**
  * Outputs the view.
  *
  * @ $request->setView  ( '' ) -define the view name
  */
 function output()
 {
     global $application;
     if (!isset($this->HTML_TAGS_PREFIX_WITHOUT_MODULE_UID)) {
         $this->HTML_TAGS_PREFIX_WITHOUT_MODULE_UID = $this->HTML_TAGS_PREFIX;
     }
     //          -                             PersonInfoType,                   ,
     //                                    .
     $person_info_types = modApiFunc("Checkout", "getPersonInfoTypeList");
     foreach ($person_info_types as $id => $info) {
         if ($info['tag'] == $this->CHECKOUT_PREREQUISITE_NAME && $info['active'] == DB_FALSE) {
             return "";
         }
     }
     //Read the decrypted credit card data from the session
     $prerequisiteValidationResults = modApiFunc("Checkout", "getPrerequisiteValidationResults", $this->CHECKOUT_PREREQUISITE_NAME);
     if ($prerequisiteValidationResults["isMet"] == false) {
         return "";
     }
     // build direct tag list with values.
     // they are may be used in the container template.
     // Example: Local_Firstname();
     $this->direct_tags = modApiFunc("Checkout", "getPersonInfoTagList", $this->CHECKOUT_PREREQUISITE_NAME);
     /*        if ($this->NoView)
             {
                 $application->outputTagErrors(true, "CartContent", "Errors");
                 return "";
             }
             else
             {
                 $application->outputTagErrors(true, "CartContent", "Warnings");
             }*/
     $AttributesArray = array($this->HTML_TAGS_PREFIX . 'OutputAllAttributes' => "", $this->HTML_TAGS_PREFIX_WITHOUT_MODULE_UID . 'OutputAllAttributes' => "", $this->HTML_TAGS_PREFIX . 'OutputAllAttributesRows' => "", $this->HTML_TAGS_PREFIX_WITHOUT_MODULE_UID . 'OutputAllAttributesRows' => "");
     foreach ($prerequisiteValidationResults['validatedData'] as $data_id => $data) {
         if ($data['view_tag'] == "Statemenu") {
             $AttributesArray[$this->HTML_TAGS_PREFIX . "State"] = '';
         } else {
             if ($data['view_tag'] == "Statetext") {
             } else {
                 $AttributesArray[$this->HTML_TAGS_PREFIX . $data['view_tag']] = '';
             }
         }
     }
     $application->registerAttributes($AttributesArray);
     $application->registerAttributes($this->direct_tags);
     loadCoreFile('UUIDUtils.php');
     $this->templateFiller =& $application->getInstance('TemplateFiller');
     $this->template = $application->getBlockTemplate(UUIDUtils::cut_uuid_suffix($this->BLOCK_TAG_NAME, "js"));
     //__CLASS__ is lowercase class name, get_class() also returns class name in lowercase.
     $this->templateFiller->setTemplate($this->template);
     $retval = $this->templateFiller->fill("OutputContainer");
     return $retval;
 }
 function getPersonInfoVariantId($person_info_type_tag, $person_info_variant_tag)
 {
     global $application;
     loadCoreFile('UUIDUtils.php');
     $person_info_type_tag = UUIDUtils::cut_uuid_suffix($person_info_type_tag, "js");
     $params = array('person_info_variant_tag' => $person_info_variant_tag, 'person_info_type_tag' => $person_info_type_tag);
     $result = execQuery('SELECT_PERSON_INFO_VARIANT_ID', $params);
     if (sizeof($result) != 1) {
         //report error
         _fatal(__FILE__ . " : " . __LINE__ . '<br>sizeof($result) MUST BE equals to 1<br>$result = ' . print_r($result, true) . '<br>$person_info_type_tag = ' . $person_info_type_tag . '<br>$person_info_variant_tag = ' . $person_info_variant_tag . '<br>QUERY: SELECT_PERSON_INFO_VARIANT_ID');
     } else {
         return $result[0]['id'];
     }
 }
 /**
  * Outputs the view.
  *
  * @ $request->setView  ( '' ) -define the view name
  */
 function output()
 {
     global $application;
     if (!isset($this->HTML_TAGS_PREFIX_WITHOUT_MODULE_UID)) {
         $this->HTML_TAGS_PREFIX_WITHOUT_MODULE_UID = $this->HTML_TAGS_PREFIX;
     }
     //          -                             PersonInfoType,                   ,
     //                                    .
     $person_info_types = modApiFunc("Checkout", "getPersonInfoTypeList");
     foreach ($person_info_types as $id => $info) {
         if ($info['tag'] == $this->CHECKOUT_PREREQUISITE_NAME && $info['active'] == DB_FALSE) {
             return "";
         }
     }
     /*        if ($this->NoView)
             {
                 $application->outputTagErrors(true, "CartContent", "Errors");
                 return "";
             }
             else
             {
                 $application->outputTagErrors(true, "CartContent", "Warnings");
             }*/
     //block items
     $AttributesArray = array('CreditCardInfoJSAttrRules' => '', 'SubmitedCheckoutStoreBlocksListItemName' => "", $this->HTML_TAGS_PREFIX . 'InputFormFieldSize' => "", $this->HTML_TAGS_PREFIX . 'InputFormFieldMaxlength' => "", $this->HTML_TAGS_PREFIX . 'InputAllAttributesRows' => "", $this->HTML_TAGS_PREFIX_WITHOUT_MODULE_UID . 'InputAllAttributesRows' => "", $this->HTML_TAGS_PREFIX . 'JavascriptFunctions' => "", $this->HTML_TAGS_PREFIX_WITHOUT_MODULE_UID . 'JavascriptFunctions' => "");
     $prerequisiteValidationResults = modApiFunc("Checkout", "getPrerequisiteValidationResults", $this->CHECKOUT_PREREQUISITE_NAME);
     //Custom templates. As for now (2006 mar) they are not used.
     foreach ($prerequisiteValidationResults['validatedData'] as $data) {
         //            $AttributesArray[$this->HTML_TAGS_PREFIX . $data['view_tag']  . "LabelCssClass"] = '';
         $AttributesArray[$this->HTML_TAGS_PREFIX . $data['view_tag'] . "FieldLabel"] = '';
         $AttributesArray[$this->HTML_TAGS_PREFIX . $data['view_tag']] = '';
         //            $AttributesArray[$this->HTML_TAGS_PREFIX . $data['view_tag']  . "ErrorFlagClass"] = '';
         $AttributesArray[$this->HTML_TAGS_PREFIX . $data['view_tag'] . "InputFormFieldSize"] = '';
         $AttributesArray[$this->HTML_TAGS_PREFIX . $data['view_tag'] . "InputFormFieldMaxlength"] = '';
     }
     $application->registerAttributes($AttributesArray);
     $this->templateFiller =& $application->getInstance('TemplateFiller');
     loadCoreFile('UUIDUtils.php');
     $this->template = $application->getBlockTemplate(UUIDUtils::cut_uuid_suffix($this->BLOCK_TAG_NAME, "js"));
     //__CLASS__ is lowercase class name, get_class() also returns class name in lowercase.
     $this->templateFiller->setTemplate($this->template);
     //"Section" config.ini mechanism allowed to use two different templates with the same
     //  container name simultaneously. E.g. "Custom PersonInfo" and "Automatic AllAttributes
     //  PersonInfo" templates/views.
     //As for now (2006 mar) - there is no more even "Container" template : output is hardcoded
     //  to wrap and return single tag:
     ////        $retval = $this->templateFiller->fill("Container");
     /*        $ResultTableRows = $this->getTag($this->HTML_TAGS_PREFIX . 'InputAllAttributesRows');
             $ResultJavascriptFunctions = $this->getTag($this->HTML_TAGS_PREFIX . 'JavascriptFunctions');
             //The name of the outputted data block is passed as a hidden field,
             // to know what data should have come to Action, and how to check it.
             $HiddenField = "<input type=\"hidden\" name=\"". $this->getTag("SubmitedCheckoutStoreBlocksListItemName") . "\">";
     
     ///        $retval =
                   $ResultTableRows . "\n"
     //            .'</table>';
     //: can a javascript code be added the same way? For example, if templates
     // are table strings, the whole template is a few concatenated table strings,
     //  and appended to the end a javascript code, then wouldn't it result in
     // changing the table structure?
                 . $ResultJavascriptFunctions
                 . $HiddenField;
     */
     $retval = $this->templateFiller->fill("InputContainer");
     return $retval;
 }