Example #1
0
 /**
  * Parse
  */
 private function parse()
 {
     // get list of recent products
     $numItems = FrontendModel::getModuleSetting('Catalog', 'recent_products_full_num_items', 3);
     $recentProducts = FrontendCatalogModel::getAll($numItems);
     $this->tpl->assign('widgetCatalogRecentProducts', $recentProducts);
 }
Example #2
0
 /**
  * Load the data, don't forget to validate the incoming data
  */
 private function getData()
 {
     // requested page
     $requestedPage = $this->URL->getParameter('page', 'int', 1);
     // set URL and limit
     $this->pagination['url'] = FrontendNavigation::getURLForBlock('catalog');
     $this->pagination['limit'] = FrontendModel::getModuleSetting('catalog', 'overview_num_items', 10);
     // populate count fields in pagination
     $this->pagination['num_items'] = FrontendCatalogModel::getAllCount();
     $this->pagination['num_pages'] = (int) ceil($this->pagination['num_items'] / $this->pagination['limit']);
     // num pages is always equal to at least 1
     if ($this->pagination['num_pages'] == 0) {
         $this->pagination['num_pages'] = 1;
     }
     // redirect if the request page doesn't exist
     if ($requestedPage > $this->pagination['num_pages'] || $requestedPage < 1) {
         $this->redirect(FrontendNavigation::getURL(404));
     }
     // populate calculated fields in pagination
     $this->pagination['requested_page'] = $requestedPage;
     $this->pagination['offset'] = $this->pagination['requested_page'] * $this->pagination['limit'] - $this->pagination['limit'];
     // get all categories
     $this->categories = FrontendCatalogModel::getAllCategories();
     // get tree of all categories
     $this->categoriesTree = FrontendCatalogModel::getCategoriesTree();
     // get all products
     $this->products = FrontendCatalogModel::getAll($this->pagination['limit'], $this->pagination['offset']);
 }
 /**
  * Validate the form
  */
 protected function validateForm()
 {
     if ($this->frm->isSubmitted()) {
         $fields = $this->frm->getFields();
         if ($fields['email']->isEmail(FL::err('EmailIsInvalid'))) {
         }
         if (FrontendMailengineModel::isSubscribed($fields['email']->getValue())) {
             $fields['email']->addError(FL::err('AlreadySubscribed'));
         }
         if ($this->frm->isCorrect()) {
             //--Subscribe
             $id = FrontendMailengineModel::subscribe($fields['email']->getValue());
             //--Get the default group
             $defaultGroup = FrontendModel::getModuleSetting($this->module, 'default_group');
             if ($defaultGroup > 0) {
                 $data = array();
                 $data['user_id'] = $id;
                 $data['group_id'] = $defaultGroup;
                 //--Add user to group
                 FrontendMailengineModel::insertUserToGroup($data);
             }
             // redirect
             $this->redirect(FrontendNavigation::getURLForBlock('Mailengine', 'MailengineSubscribe') . '?sent=true#subscribe');
         }
     }
     $this->frm->parse($this->tpl);
 }
Example #4
0
 /**
  * Load the data, don't forget to validate the incoming data
  */
 private function getData()
 {
     $parameter_count = count($this->URL->getParameters(false));
     if ($parameter_count <= 0) {
         $this->redirect(FrontendNavigation::getURL(404));
     }
     // get category
     $this->category = FrontendAgendaModel::getCategory($this->URL->getParameter($parameter_count - 1));
     if (empty($this->category)) {
         $this->redirect(FrontendNavigation::getURL(404));
     }
     // requested page
     $requestedPage = $this->URL->getParameter('page', 'int', 1);
     // set URL and limit
     $this->pagination['url'] = FrontendNavigation::getURLForBlock('Agenda', 'Category') . '/' . $this->category['url'];
     $this->pagination['limit'] = FrontendModel::getModuleSetting('Agenda', 'overview_num_items', 10);
     // populate count fields in pagination
     $this->pagination['num_items'] = FrontendAgendaModel::getCategoryCount($this->category['id']);
     $this->pagination['num_pages'] = (int) ceil($this->pagination['num_items'] / $this->pagination['limit']);
     // num pages is always equal to at least 1
     if ($this->pagination['num_pages'] == 0) {
         $this->pagination['num_pages'] = 1;
     }
     // redirect if the request page doesn't exist
     if ($requestedPage > $this->pagination['num_pages'] || $requestedPage < 1) {
         $this->redirect(FrontendNavigation::getURL(404));
     }
     // populate calculated fields in pagination
     $this->pagination['requested_page'] = $requestedPage;
     $this->pagination['offset'] = $this->pagination['requested_page'] * $this->pagination['limit'] - $this->pagination['limit'];
     // timestamps
     // @todo SET CORRECT TIMES
     $startTimestamp = strtotime('last Monday 00:59', time());
     // first day of the week
     $endTimestamp = strtotime("next Monday 0:59", time());
     // last day of the week
     // get items
     $this->items = FrontendAgendaModel::getAllByCategory($this->category['id'], $this->pagination['limit'], $this->pagination['offset'], $startTimestamp, $endTimestamp);
     // sort dates
     usort($this->items, "self::cmpValues");
 }
 /**
  * Subscribes email adres to list.
  *
  * @return bool
  * @param  string           $email  email.
  * @param  string[optional] $listId list id.
  */
 public static function unsubscribe($email, $listId = null)
 {
     // get mailchimp reference
     $mc = self::getMC();
     // if list_id = null get the setting for it
     if (!$listId) {
         $listId = FrontendModel::getModuleSetting('MailMotor', 'list');
     }
     // return list unsubcribe
     return (bool) $mc->listUnsubscribe($listId, $email, FrontendModel::getModuleSetting('MailMotor', 'delete_member'), FrontendModel::getModuleSetting('MailMotor', 'send_goodbye_email'), FrontendModel::getModuleSetting('MailMotor', 'send_notify_email'));
 }
Example #6
0
 /**
  * Load the data, don't forget to validate the incoming data
  */
 private function getData()
 {
     $this->parameters = $this->URL->getParameters();
     $url = end($this->parameters);
     if ($url === null) {
         $this->redirect(FrontendNavigation::getURL(404));
     }
     // get by URL
     $this->record = FrontendCatalogModel::getBrandFromUrl($url);
     if (empty($this->record)) {
         $this->redirect(FrontendNavigation::getURL(404));
     }
     // get products
     $this->products = FrontendCatalogModel::getAllByBrand($this->record['id']);
     // requested page
     $requestedPage = $this->URL->getParameter('page', 'int', 1);
     // set URL and limit
     $this->pagination['url'] = FrontendNavigation::getURLForBlock('catalog', 'category') . '/' . $this->record['url'];
     $this->pagination['limit'] = FrontendModel::getModuleSetting('catalog', 'overview_num_items', 10);
     // populate count fields in pagination
     $this->pagination['num_items'] = FrontendCatalogModel::getCategoryCount($this->record['id']);
     $this->pagination['num_pages'] = (int) ceil($this->pagination['num_items'] / $this->pagination['limit']);
     // num pages is always equal to at least 1
     if ($this->pagination['num_pages'] == 0) {
         $this->pagination['num_pages'] = 1;
     }
     // redirect if the request page doesn't exist
     if ($requestedPage > $this->pagination['num_pages'] || $requestedPage < 1) {
         $this->redirect(FrontendNavigation::getURL(404));
     }
     // populate calculated fields in pagination
     $this->pagination['requested_page'] = $requestedPage;
     $this->pagination['offset'] = $this->pagination['requested_page'] * $this->pagination['limit'] - $this->pagination['limit'];
 }
Example #7
0
 /**
  * Parse the page
  */
 protected function parse()
 {
     // build Facebook  OpenGraph data
     $this->header->addOpenGraphData('title', $this->record['meta_title'], true);
     $this->header->addOpenGraphData('type', 'article', true);
     $this->header->addOpenGraphData('url', SITE_URL . FrontendNavigation::getURLForBlock('agenda', 'detail') . '/' . $this->record['url'], true);
     $this->header->addOpenGraphData('site_name', FrontendModel::getModuleSetting('core', 'site_title_' . FRONTEND_LANGUAGE, SITE_DEFAULT_TITLE), true);
     $this->header->addOpenGraphData('description', $this->record['meta_title'], true);
     // add into breadcrumb
     $this->breadcrumb->addElement($this->record['meta_title']);
     // hide action title
     $this->tpl->assign('hideContentTitle', true);
     // show title linked with the meta title
     $this->tpl->assign('title', $this->record['title']);
     // set meta
     $this->header->setPageTitle($this->record['meta_title'], $this->record['meta_description_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']));
     }
     // add css
     $this->header->addCSS('/src/Frontend/Modules/' . $this->getModule() . '/Layout/Css/agenda.css');
     $this->tpl->assign("dateFormat", "d M");
     // assign item
     $this->tpl->assign('item', $this->record);
     // dates
     $this->tpl->assign('beginDate', $this->record['begin_date']);
     //$this->beginDate);
     $this->tpl->assign('endDate', $this->record['end_date']);
     //$this->endDate);
     // media
     //        $this->tpl->assign('images', $this->images);
     //        $this->tpl->assign('files', $this->files);
     //        $this->tpl->assign('videos', $this->videos);
     $this->tpl->assign('images', $this->record['images']);
     // parse the form
     $this->frm->parse($this->tpl);
     // some options
     if ($this->URL->getParameter('subscription', 'string') == 'moderation') {
         $this->tpl->assign('subscriptionIsInModeration', true);
     }
     if ($this->URL->getParameter('subscription', 'string') == 'true') {
         $this->tpl->assign('subscriptionIsAdded', true);
     }
     // location
     $location = array();
     if (!empty($this->record['name'])) {
         $location['name'] = $this->record['name'];
     }
     if (!empty($this->record['street'])) {
         $location['street'] = $this->record['street'];
     }
     if (!empty($this->record['number'])) {
         $location['number'] = $this->record['number'];
     }
     if (!empty($this->record['zip'])) {
         $location['zip'] = $this->record['zip'];
     }
     if (!empty($this->record['city'])) {
         $location['city'] = $this->record['city'];
     }
     // show google maps
     if ($this->record['google_maps'] == 'Y') {
         $this->addJSData('settings_' . $this->record['id'], $this->settings);
         $this->addJSData('items_' . $this->record['id'], array($this->record));
         $this->tpl->assign('location', $this->record);
         if (!empty($this->record)) {
             $this->tpl->assign('locationSet', true);
         }
         $this->tpl->assign('googlemaps', $this->record['google_maps']);
         if (!empty($this->record)) {
             $this->tpl->assign('googlemapsSet', true);
         }
         $this->tpl->assign('locationSettings', $this->settings);
         if (!empty($this->record)) {
             $this->tpl->assign('locationSettingsSet', true);
         }
     } else {
         $this->tpl->assign('location', $location);
         if (!empty($location)) {
             $this->tpl->assign('locationSet', true);
         }
         $this->tpl->assign('locationSettings', $this->settings);
         $this->tpl->assign('googlemaps', $this->record['google_maps']);
     }
 }
Example #8
0
 /**
  * Load the data, don't forget to validate the incoming data
  */
 private function getData()
 {
     $this->parameters = $this->URL->getParameters();
     $url = end($this->parameters);
     if ($url === null) {
         $this->redirect(FrontendNavigation::getURL(404));
     }
     // get by URL
     $this->record = FrontendCatalogModel::getCategory($url);
     if (empty($this->record)) {
         $this->redirect(FrontendNavigation::getURL(404));
     }
     // get subcategories
     $this->subcategories = FrontendCatalogModel::getAllCategories($this->record['id'], $this->record['url']);
     // get subcategories tree of parent
     $this->subcategoriesTree = FrontendCatalogModel::getCategoriesTree($this->record['id']);
     //--Get all the categories
     $this->categoriesTree = FrontendCatalogModel::getCategoriesTree(0, $this->record['id']);
     // get products
     $this->products = FrontendCatalogModel::getAllByCategory($this->record['id']);
     foreach ($this->products as &$product) {
         $product['image'] = FrontendMediaHelper::getFromModule('Catalog', $product['id'], 0, 1, 'product');
     }
     // requested page
     $requestedPage = $this->URL->getParameter('page', 'int', 1);
     // set URL and limit
     $this->pagination['url'] = FrontendNavigation::getURLForBlock('catalog', 'category') . '/' . $this->record['url'];
     $this->pagination['limit'] = FrontendModel::getModuleSetting('catalog', 'overview_num_items', 10);
     // populate count fields in pagination
     $this->pagination['num_items'] = FrontendCatalogModel::getCategoryCount($this->record['id']);
     $this->pagination['num_pages'] = (int) ceil($this->pagination['num_items'] / $this->pagination['limit']);
     // num pages is always equal to at least 1
     if ($this->pagination['num_pages'] == 0) {
         $this->pagination['num_pages'] = 1;
     }
     // redirect if the request page doesn't exist
     if ($requestedPage > $this->pagination['num_pages'] || $requestedPage < 1) {
         $this->redirect(FrontendNavigation::getURL(404));
     }
     // populate calculated fields in pagination
     $this->pagination['requested_page'] = $requestedPage;
     $this->pagination['offset'] = $this->pagination['requested_page'] * $this->pagination['limit'] - $this->pagination['limit'];
 }
 /**
  * Gets the data
  */
 private function getData()
 {
     $this->email = \SpoonFilter::getPostValue('subscriber', null, '');
     $this->listID = (string) FrontendModel::getModuleSetting('Mailchimp', 'activeList');
 }