parse() public method

Parse the form
public parse ( TwigTemplate $tpl )
$tpl TwigTemplate The template instance wherein the form will be parsed.
Example #1
0
 /**
  * Parse the data into the template
  */
 private function parse()
 {
     // have the settings been saved?
     if ($this->URL->getParameter('sent') == 'true') {
         // show success message
         $this->tpl->assign('updatePasswordSuccess', true);
     }
     // parse the form
     $this->frm->parse($this->tpl);
 }
Example #2
0
 /**
  * Parse
  */
 private function parse()
 {
     // parse the form or a status
     if (empty($this->status)) {
         $this->frm->parse($this->tpl);
     } else {
         $this->tpl->assign($this->status, true);
     }
     // parse an option so the stuff can be shown
     $this->tpl->assign('widgetFaqOwnQuestion', true);
 }
Example #3
0
 /**
  * Parse the data into the template.
  */
 private function parse()
 {
     // e-mail was sent?
     if ($this->URL->getParameter('sent') == 'true') {
         // show message
         $this->tpl->assign('registerIsSuccess', true);
         // hide form
         $this->tpl->assign('registerHideForm', true);
     } else {
         $this->frm->parse($this->tpl);
     }
 }
Example #4
0
 /**
  * Parse the data into the template
  */
 private function parse()
 {
     // form was sent?
     if ($this->URL->getParameter('sent') == 'true') {
         // show message
         $this->tpl->assign('subscribeIsSuccess', true);
         // hide form
         $this->tpl->assign('subscribeHideForm', true);
     }
     // parse the form
     $this->frm->parse($this->tpl);
 }
Example #5
0
 /**
  * Parse the data into the template.
  */
 private function parse()
 {
     // has the password been saved?
     if ($this->URL->getParameter('sent') == 'true') {
         // show message
         $this->tpl->assign('resetPasswordSuccess', true);
         // hide form
         $this->tpl->assign('resetPasswordHideForm', true);
     } else {
         $this->frm->parse($this->tpl);
     }
 }
Example #6
0
 /**
  * Parse the data into the template
  */
 private function parse()
 {
     // e-mail was sent?
     if ($this->URL->getParameter('sent') == 'true') {
         // show message
         $this->tpl->assign('forgotPasswordSuccess', true);
         // hide form
         $this->tpl->assign('forgotPasswordHideForm', true);
     }
     // parse the form
     $this->frm->parse($this->tpl);
 }
Example #7
0
 /**
  * Load the form
  */
 private function loadForm()
 {
     // don't show the form if someone is logged in
     if (FrontendProfilesAuthentication::isLoggedIn()) {
         return;
     }
     $this->frm = new FrontendForm('login', FrontendNavigation::getURLForBlock('Profiles', 'Login'));
     $this->frm->addText('email')->setAttributes(array('required' => null, 'type' => 'email'));
     $this->frm->addPassword('password')->setAttributes(array('required' => null));
     $this->frm->addCheckbox('remember', true);
     // parse the form
     $this->frm->parse($this->tpl);
 }
Example #8
0
 /**
  * Parse the data into the template
  */
 private function parse()
 {
     // form was sent?
     if ($this->URL->getParameter('sent') == 'true') {
         // show message
         $this->tpl->assign('unsubscribeIsSuccess', true);
         // hide form
         $this->tpl->assign('unsubscribeHideForm', true);
     }
     // unsubscribe was issued for a specific group/address
     if (\SpoonFilter::isEmail($this->email) && FrontendMailmotorModel::existsGroup($this->group)) {
         // unsubscribe the address from this group
         if (FrontendMailmotorModel::unsubscribe($this->email, $this->group)) {
             // hide form
             $this->tpl->assign('unsubscribeHideForm', true);
             // show message
             $this->tpl->assign('unsubscribeIsSuccess', true);
         } else {
             // unsubscribe failed, show an error
             $this->tpl->assign('unsubscribeHasError', true);
         }
     }
     // parse the form
     $this->frm->parse($this->tpl);
 }
Example #9
0
 /**
  * Parse the data into the template
  */
 private function parse()
 {
     // add to breadcrumb
     if ($this->settings['allow_multiple_categories']) {
         $this->breadcrumb->addElement($this->record['category_title'], $this->record['category_full_url']);
     }
     $this->breadcrumb->addElement($this->record['question']);
     // set meta
     if ($this->settings['allow_multiple_categories']) {
         $this->header->setPageTitle($this->record['category_title']);
     }
     $this->header->setPageTitle($this->record['question']);
     // assign article
     $this->tpl->assign('item', $this->record);
     // assign items in the same category and related items
     $this->tpl->assign('inSameCategory', FrontendFaqModel::getAllForCategory($this->record['category_id'], $this->settings['related_num_items'], $this->record['id']));
     $this->tpl->assign('related', FrontendFaqModel::getRelated($this->record['id'], $this->settings['related_num_items']));
     // assign settings
     $this->tpl->assign('settings', $this->settings);
     // parse the form
     if (empty($this->status)) {
         $this->frm->parse($this->tpl);
     }
     // parse the form status
     if (!empty($this->status)) {
         $this->tpl->assign($this->status, true);
     }
 }
Example #10
0
 /**
  * Parse the data into the template
  */
 private function parse()
 {
     $this->addJS('typeahead.bundle.min.js');
     $this->addCSS('Search.css');
     // parse the form
     $this->frm->parse($this->tpl);
     // no search term = no search
     if (!$this->term) {
         return;
     }
     // assign articles
     $this->tpl->assign('searchResults', $this->items);
     $this->tpl->assign('searchTerm', $this->term);
     // parse the pagination
     $this->parsePagination();
 }
Example #11
0
 /**
  * Parse.
  */
 private function parse()
 {
     // form name
     $formName = 'form' . $this->item['id'];
     $this->tpl->assign('formName', $formName);
     $this->tpl->assign('formAction', $this->createAction() . '#' . $formName);
     $this->tpl->assign('successMessage', false);
     // got fields
     if (!empty($this->fieldsHTML)) {
         // value of the submit button
         $submitValue = '';
         // loop html fields
         foreach ($this->fieldsHTML as &$field) {
             if ($field['type'] == 'heading' || $field['type'] == 'paragraph') {
                 $field['plaintext'] = true;
             } elseif ($field['type'] == 'checkbox' || $field['type'] == 'radiobutton') {
                 // name (prefixed by type)
                 $name = $field['type'] == 'checkbox' ? 'chk' . \SpoonFilter::toCamelCase($field['name']) : 'rbt' . \SpoonFilter::toCamelCase($field['name']);
                 // rebuild so the html is stored in a general name (and not rbtName)
                 foreach ($field['html'] as &$item) {
                     $item['field'] = $item[$name];
                 }
                 // multiple items
                 $field['multiple'] = true;
             } elseif ($field['type'] == 'submit') {
                 $submitValue = $field['html'];
             } else {
                 $field['simple'] = true;
             }
             // errors (only for form elements)
             if (isset($field['simple']) || isset($field['multiple'])) {
                 $field['error'] = $this->frm->getField($field['name'])->getErrors();
             }
         }
         // assign
         $this->tpl->assign('submitValue', $submitValue);
         $this->tpl->assign('fields', $this->fieldsHTML);
         // parse form
         $this->frm->parse($this->tpl);
         $this->tpl->assign('formToken', $this->frm->getToken());
         // assign form error
         $this->tpl->assign('error', $this->frm->getErrors() != '' ? $this->frm->getErrors() : false);
     }
 }
Example #12
0
 /**
  * Parse the data into the template
  */
 private function parse()
 {
     // have the settings been saved?
     if ($this->URL->getParameter('sent') == 'true') {
         // show success message
         $this->tpl->assign('updateSettingsSuccess', true);
     }
     // assign avatar
     $avatar = $this->profile->getSetting('avatar');
     if (empty($avatar)) {
         $avatar = '';
     }
     $this->tpl->assign('avatar', $avatar);
     // parse the form
     $this->frm->parse($this->tpl);
     // display name changes
     $this->tpl->assign('maxDisplayNameChanges', FrontendProfilesModel::MAX_DISPLAY_NAME_CHANGES);
     $this->tpl->assign('displayNameChangesLeft', FrontendProfilesModel::MAX_DISPLAY_NAME_CHANGES - $this->profile->getSetting('display_name_changes'));
 }
Example #13
0
 /**
  * Parse the data into the template
  */
 private function parse()
 {
     // get RSS-link
     $rssTitle = $this->get('fork.settings')->get('Blog', 'rss_title_' . FRONTEND_LANGUAGE);
     $rssLink = FrontendNavigation::getURLForBlock('Blog', 'Rss');
     // add RSS-feed
     $this->header->addRssLink($rssTitle, $rssLink);
     // get RSS-link for the comments
     $rssCommentTitle = vsprintf(FL::msg('CommentsOn'), array($this->record['title']));
     $rssCommentsLink = FrontendNavigation::getURLForBlock('Blog', 'ArticleCommentsRss') . '/' . $this->record['url'];
     // add RSS-feed into the metaCustom
     $this->header->addRssLink($rssCommentTitle, $rssCommentsLink);
     // add specified image
     if (isset($this->record['image']) && $this->record['image'] != '') {
         $this->header->addOpenGraphImage(FRONTEND_FILES_URL . '/blog/images/source/' . $this->record['image']);
     }
     // Open Graph-data: add images from content
     $this->header->extractOpenGraphImages($this->record['text']);
     // Open Graph-data: add additional OpenGraph data
     $this->header->addOpenGraphData('title', $this->record['title'], true);
     $this->header->addOpenGraphData('type', 'article', true);
     $this->header->addOpenGraphData('url', SITE_URL . $this->record['full_url'], true);
     $this->header->addOpenGraphData('site_name', $this->get('fork.settings')->get('Core', 'site_title_' . FRONTEND_LANGUAGE, SITE_DEFAULT_TITLE), true);
     $this->header->addOpenGraphData('description', $this->record['meta_description_overwrite'] == 'Y' ? $this->record['meta_description'] : $this->record['title'], true);
     // Twitter Card
     $imgURL = FRONTEND_FILES_URL . '/blog/images/source/' . $this->record['image'];
     $this->header->setTwitterCard($this->record['title'], $this->record['meta_description'], $imgURL);
     // when there are 2 or more categories with at least one item in it,
     // the category will be added in the breadcrumb
     if (count(FrontendBlogModel::getAllCategories()) > 1) {
         $this->breadcrumb->addElement($this->record['category_title'], FrontendNavigation::getURLForBlock('Blog', 'Category') . '/' . $this->record['category_url']);
     }
     // add into breadcrumb
     $this->breadcrumb->addElement($this->record['title']);
     // set meta
     $this->header->setPageTitle($this->record['meta_title'], $this->record['meta_title_overwrite'] == 'Y');
     $this->header->addMetaDescription($this->record['meta_description'], $this->record['meta_description_overwrite'] == 'Y');
     $this->header->addMetaKeywords($this->record['meta_keywords'], $this->record['meta_keywords_overwrite'] == 'Y');
     // advanced SEO-attributes
     if (isset($this->record['meta_data']['seo_index'])) {
         $this->header->addMetaData(array('name' => 'robots', 'content' => $this->record['meta_data']['seo_index']));
     }
     if (isset($this->record['meta_data']['seo_follow'])) {
         $this->header->addMetaData(array('name' => 'robots', 'content' => $this->record['meta_data']['seo_follow']));
     }
     $this->header->setCanonicalUrl($this->record['full_url']);
     // assign article
     $this->tpl->assign('item', $this->record);
     // count comments
     $commentCount = count($this->comments);
     // assign the comments
     $this->tpl->assign('commentsCount', $commentCount);
     $this->tpl->assign('comments', $this->comments);
     // options
     if ($commentCount > 1) {
         $this->tpl->assign('blogCommentsMultiple', true);
     }
     // parse the form
     $this->frm->parse($this->tpl);
     // some options
     if ($this->URL->getParameter('comment', 'string') == 'moderation') {
         $this->tpl->assign('commentIsInModeration', true);
     }
     if ($this->URL->getParameter('comment', 'string') == 'spam') {
         $this->tpl->assign('commentIsSpam', true);
     }
     if ($this->URL->getParameter('comment', 'string') == 'true') {
         $this->tpl->assign('commentIsAdded', true);
     }
     // assign settings
     $this->tpl->assign('settings', $this->settings);
     $navigation = FrontendBlogModel::getNavigation($this->record['id']);
     // set previous and next link for usage with Flip ahead
     if (!empty($navigation['previous'])) {
         $this->header->addLink(array('rel' => 'prev', 'href' => SITE_URL . $navigation['previous']['url']));
     }
     if (!empty($navigation['next'])) {
         $this->header->addLink(array('rel' => 'next', 'href' => SITE_URL . $navigation['next']['url']));
     }
     // assign navigation
     $this->tpl->assign('navigation', $navigation);
 }
Example #14
0
 /**
  * Parse the data into the template
  */
 private function parse()
 {
     $this->addJS('typeahead.bundle.min.js');
     $this->addCSS('Search.css');
     $this->frm->parse($this->tpl);
 }
Example #15
0
 /**
  * Parse the data into the template.
  */
 private function parse()
 {
     $this->frm->parse($this->tpl);
 }