/**
  * Generate the checkout step
  * @return  string
  */
 public function generate()
 {
     // Make sure field data is available
     \Controller::loadDataContainer('tl_iso_product_collection');
     \System::loadLanguageFile('tl_iso_product_collection');
     $objTemplate = new Template($this->strTemplate);
     $varValue = null;
     $objWidget = new FormTextArea(FormTextArea::getAttributesFromDca($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField], $this->strField, $varValue, $this->strField, $this->strTable, $this));
     $objWidget->storeValues = true;
     if (\Input::post('FORM_SUBMIT') == $this->strFormId) {
         $objWidget->validate();
         $varValue = $objWidget->value;
         // Do not submit the field if there are errors
         if ($objWidget->hasErrors()) {
             $doNotSubmit = true;
         } elseif ($objWidget->submitInput()) {
             $objOrder = Isotope::getCart()->getDraftOrder();
             // Store the form data
             $_SESSION['FORM_DATA'][$this->strField] = $varValue;
             // Set the correct empty value (see #6284, #6373)
             if ($varValue === '') {
                 $varValue = $objWidget->getEmptyValue();
             }
             // Set the new value
             if ($varValue !== $objOrder->{$this->strField}) {
                 $objOrder->{$this->strField};
             }
         }
     }
     $objTemplate->headline = $GLOBALS['TL_LANG'][$this->strTable][$this->strField][0];
     $objTemplate->customerNotes = $objWidget->parse();
     return $objTemplate->parse();
 }
 /**
  * Parse the template file and return it as string
  * @param array
  * @return string
  */
 public function parse($arrAttributes = null)
 {
     if ($this->formcontrol_template) {
         $this->strTemplate = $this->formcontrol_template;
         global $objPage;
         $arrStrip = array();
         // XHTML does not support maxlength
         if ($objPage->outputFormat == 'xhtml') {
             $arrStrip[] = 'maxlength';
         }
         $this->fieldValue = specialchars(str_replace('\\n', "\n", $this->varValue));
         $this->fieldAttributes = $this->getAttributes($arrStrip);
     }
     return parent::parse($arrAttributes);
 }
Esempio n. 3
0
 /**
  * List a single member
  * @param integer
  */
 protected function listSingleMember($id)
 {
     global $objPage;
     $time = time();
     $this->Template = new FrontendTemplate('mod_memberlist_detail');
     $this->Template->record = array();
     // Get member
     $objMember = $this->Database->prepare("SELECT * FROM tl_member WHERE id=? AND disable!=1 AND (start='' OR start<=?) AND (stop='' OR stop>=?)")->limit(1)->execute($id, $time, $time);
     // No member found or group not allowed
     if ($objMember->numRows < 1 || count(array_intersect(deserialize($objMember->groups, true), $this->arrMlGroups)) < 1) {
         $this->Template->invalid = $GLOBALS['TL_LANG']['MSC']['invalidUserId'];
         // Do not index the page
         $objPage->noSearch = 1;
         $objPage->cache = 0;
         // Send 404 header
         header('HTTP/1.0 404 Not Found');
         return;
     }
     // Default variables
     $this->Template->action = ampersand($this->Environment->request);
     $this->Template->referer = 'javascript:history.go(-1)';
     $this->Template->back = $GLOBALS['TL_LANG']['MSC']['goBack'];
     $this->Template->publicProfile = sprintf($GLOBALS['TL_LANG']['MSC']['publicProfile'], $objMember->username);
     $this->Template->noPublicInfo = $GLOBALS['TL_LANG']['MSC']['noPublicInfo'];
     $this->Template->sendEmail = $GLOBALS['TL_LANG']['MSC']['sendEmail'];
     $this->Template->submit = $GLOBALS['TL_LANG']['MSC']['sendMessage'];
     $this->Template->loginToSend = $GLOBALS['TL_LANG']['MSC']['loginToSend'];
     $this->Template->emailDisabled = $GLOBALS['TL_LANG']['MSC']['emailDisabled'];
     // Confirmation message
     if ($_SESSION['TL_EMAIL_SENT']) {
         $this->Template->confirm = $GLOBALS['TL_LANG']['MSC']['messageSent'];
         $_SESSION['TL_EMAIL_SENT'] = false;
     }
     // Check personal message settings
     switch ($objMember->allowEmail) {
         case 'email_all':
             $this->Template->allowEmail = 3;
             break;
         case 'email_member':
             $this->Template->allowEmail = FE_USER_LOGGED_IN ? 3 : 2;
             break;
         default:
             $this->Template->allowEmail = 1;
             break;
     }
     // No e-mail address given
     if (!strlen($objMember->email)) {
         $this->Template->allowEmail = 1;
     }
     // Handle personal messages
     if ($this->Template->allowEmail > 1) {
         $arrField = array('name' => 'message', 'label' => $GLOBALS['TL_LANG']['MSC']['message'], 'inputType' => 'textarea', 'eval' => array('mandatory' => true, 'required' => true, 'rows' => 4, 'cols' => 40, 'decodeEntities' => true));
         $arrWidget = $this->prepareForWidget($arrField, $arrField['name'], '');
         $objWidget = new FormTextArea($arrWidget);
         // Validate widget
         if ($this->Input->post('FORM_SUBMIT') == 'tl_send_email') {
             $objWidget->validate();
             if (!$objWidget->hasErrors()) {
                 $this->sendPersonalMessage($objMember, $objWidget);
             }
         }
         $this->Template->widget = $objWidget;
         $this->Template->submit = $GLOBALS['TL_LANG']['MSC']['sendMessage'];
     }
     $arrFields = deserialize($objMember->publicFields);
     // Add public fields
     if (is_array($arrFields) && count($arrFields)) {
         $count = -1;
         foreach ($arrFields as $k => $v) {
             $class = 'row_' . ++$count . ($count == 0 ? ' row_first' : '') . ($count >= count($arrFields) - 1 ? ' row_last' : '') . ($count % 2 == 0 ? ' even' : ' odd');
             $arrFields[$k] = array('raw' => $objMember->row(), 'content' => $this->formatValue($v, $objMember->{$v}, true), 'class' => $class, 'label' => strlen($label = $GLOBALS['TL_DCA']['tl_member']['fields'][$v]['label'][0]) ? $label : $v, 'field' => $v);
         }
         $this->Template->record = $arrFields;
     }
 }