public function viewAction()
 {
     $typeName = $this->_getParam('typename');
     $typeId = $this->_getParam('typeid');
     $this->view->items = "";
     $proxy = new SxCms_Page_Proxy();
     $this->view->page = $proxy->getPageById('286', null, $this->_getParam('lng', 'nl'));
     $proxy = new SxModule_Sheets_Type_Proxy();
     $types = $proxy->getAllActive();
     $this->view->types = $types;
     $masterArray = array();
     $typesAr = array();
     $xi = 0;
     $subtypesArray = array();
     foreach ($types as $type) {
         if (count($type->getSubtypes()) != 0) {
             $proxy = new SxModule_Sheets_Proxy();
             $items = $proxy->getAllActiveByType($type->getId());
             $typesAr[$xi]['id'] = $type->getId();
             $typesAr[$xi]['name'] = $type->getName();
             $xi++;
             //geef items en subtitles door
             if ($type->getId() == $typeId) {
                 $this->view->items = $type->getSubtypes();
             }
         }
     }
     $this->view->typeid = $typeId;
     $this->view->types = $typesAr;
     $this->_helper->layout->setLayout('12col');
 }
 public function init()
 {
     $this->view->lng = $this->_getParam('lng', 'nl');
     $this->view->glob_tmx = new Zend_Translate('tmx', APPLICATION_ROOT . '/application/var/locale/global.tmx', $this->_getParam('lng', 'nl'));
     $pageProxy = new SxCms_Page_Proxy();
     $page = $pageProxy->getPageById(12);
     $this->view->page = $page;
     $this->_helper->layout->setLayout('full');
 }
 public function detailAction()
 {
     $newsProxy = new SxModule_News_Proxy();
     $news = $newsProxy->getById((int) $this->_getParam('id'), $this->_getParam('lng'));
     //$page = new SxCms_Page();
     $pageProxy = new SxCms_Page_Proxy();
     $page = $pageProxy->getPageById(242);
     $this->view->page = $page;
     $this->view->news = $news;
 }
 public function init()
 {
     $config = Zend_Registry::get('config');
     $_SESSION['System']['lng'] = $this->_getParam('lng', $config->system->defaults->language);
     $this->view->lng = $_SESSION['System']['lng'];
     $this->view->glob_tmx = new Zend_Translate('tmx', APPLICATION_ROOT . '/application/var/locale/global.tmx', $_SESSION['System']['lng']);
     $pageProxy = new SxCms_Page_Proxy();
     $page = $pageProxy->getPageById(6);
     $this->view->page = $page;
 }
 public function activateAction()
 {
     $pageProxy = new SxCms_Page_Proxy();
     $page = $pageProxy->getPageById(11);
     $this->view->page = $page;
     $currentSubscribeId = $this->_getParam('id', null);
     $subscribeProxy = new SxModule_Subscribe_Proxy();
     $subscribe = $subscribeProxy->getById($currentSubscribeId);
     $subscribe->activate();
     $this->_helper->layout->setLayout('full');
 }
 public function init()
 {
     $this->view->lng = $this->_getParam('lng', 'nl');
     $this->view->glob_tmx = new Zend_Translate('tmx', APPLICATION_ROOT . '/application/var/locale/global.tmx', $this->_getParam('lng', 'nl'));
     $proxy = new SxCms_Page_Proxy();
     $page = $proxy->getPageById('28', $this->_getParam('lng', 'nl'));
     $this->view->page = $page;
     if (!Zend_Auth::getInstance()->hasIdentity()) {
         $this->_helper->redirector->gotoSimple('login', 'member');
     }
 }
 public function errorAction()
 {
     /**
      * Check database connection
      */
     try {
         $db = Zend_Registry::get('db');
         $db->getConnection();
     } catch (Zend_Db_Adapter_Exception $e) {
         // perhaps a failed login credential, or perhaps the RDBMS is not running
         $this->databaseError($e);
     } catch (Zend_Exception $e) {
         // perhaps factory() failed to load the specified Adapter class
         $this->databaseError($e);
     }
     /**
      * Normal error page
      */
     $pageProxy = new SxCms_Page_Proxy();
     $page = $pageProxy->getPageById(36);
     $this->view->page = $page;
     $this->view->lng = isset($_SESSION['System']['lng']) ? $_SESSION['System']['lng'] : $this->_getParam('lng', 'nl');
     $this->_helper->layout->setLayout('full');
     $this->view->errorpage = true;
     $this->view->glob_tmx = new Zend_Translate('tmx', APPLICATION_ROOT . '/application/var/locale/global.tmx', $this->_getParam('lng', 'nl'));
     $errors = $this->_getParam('error_handler');
     switch ($errors->type) {
         case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
         case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
             // 404 error -- controller or action not found
             $this->getResponse()->setHttpResponseCode(404);
             $this->render('404');
             break;
         default:
             // application error
             $this->getResponse()->setHttpResponseCode(500);
             break;
     }
     // log exception to database
     $db = Zend_Registry::get('db');
     $columnMapping = array('priority' => 'priority', 'type' => 'type', 'message' => 'message', 'user' => 'user', 'ip' => 'ip', 'agent' => 'agent', 'url' => 'url');
     $user = Zend_Auth::getInstance()->hasIdentity() ? Zend_Auth::getInstance()->getIdentity()->getEmail() : 'anonymous';
     $writer = new Zend_Log_Writer_Db($db, 'Logs', $columnMapping);
     $logger = new Zend_Log($writer);
     $logger->setEventItem('user', $user);
     $logger->setEventItem('ip', $_SERVER['REMOTE_ADDR']);
     $logger->setEventItem('agent', $_SERVER['HTTP_USER_AGENT']);
     $logger->setEventItem('url', $this->view->url());
     $logger->setEventItem('type', $errors->type);
     $logger->err($errors->exception);
 }
 public function init()
 {
     $config = Zend_Registry::get('config');
     $_SESSION['System']['lng'] = $this->_getParam('lng', $config->system->defaults->language);
     $this->view->lng = $_SESSION['System']['lng'];
     $this->view->glob_tmx = new Zend_Translate('tmx', APPLICATION_ROOT . '/application/var/locale/global.tmx', $_SESSION['System']['lng']);
     /* CONTACTPAGINA TMX */
     $this->view->contact_tmx = new Zend_Translate('tmx', APPLICATION_ROOT . '/application/var/locale/contact.tmx', $_SESSION['System']['lng']);
     $pageProxy = new SxCms_Page_Proxy();
     /* CONTACTPAGINA ID */
     $this->view->page = $pageProxy->getPageById(9, $this->_getParam('lng', 'nl'));
     /* CONTACTPAGINA TEMPLATE */
     $this->_helper->layout->setLayout('full');
 }
 public function init()
 {
     if ($this->_getParam('reset')) {
         unset($_SESSION['Cms_PageWizard']);
         $this->_redirect('/admin/' . $this->getRequest()->getControllerName() . '/' . $this->getRequest()->getActionName());
     }
     if (!isset($_SESSION['Cms_PageWizard']['page'])) {
         $proxy = new SxCms_Page_Proxy();
         $page = $proxy->getPageById($this->_getParam('id'));
         $_SESSION['Cms_PageWizard']['page'] = $page;
     }
     $this->_page = $_SESSION['Cms_PageWizard']['page'];
     $this->view->page = $this->_page;
     $this->view->menu = array('template' => 'page/__menu.phtml', 'active' => 'menu-page', 'tab' => 'cms');
     $config = Zend_Registry::get('config');
     $lngs = $config->system->language;
     $this->view->lngs = $lngs;
 }
 public function init()
 {
     if ($this->_getParam('reset')) {
         unset($_SESSION['Cms_PageWizard']);
         $this->_redirect('/admin/' . $this->getRequest()->getControllerName() . '/' . $this->getRequest()->getActionName());
     }
     if (!isset($_SESSION['Cms_PageWizard']['page'])) {
         $proxy = new SxCms_Page_Proxy();
         $page = $proxy->getPageById($this->_getParam('id'));
         $_SESSION['Cms_PageWizard']['page'] = $page;
     }
     $this->_page = $_SESSION['Cms_PageWizard']['page'];
     $this->view->page = $this->_page;
     $this->view->menu = array('template' => 'page/__menu.phtml', 'active' => 'menu-page', 'tab' => 'cms');
     $config = Zend_Registry::get('config');
     $lngs = $config->system->language;
     $this->view->lngs = $lngs;
     # Admin taal
     $systemAdmin = new Zend_Session_Namespace('SystemAdmin');
     $this->view->admin_tmx = $this->admin_tmx = new Zend_Translate('tmx', APPLICATION_ROOT . '/application/var/locale/admin/page.tmx', $systemAdmin->lng);
     $this->view->admin_menu_tmx = $this->admin_menu_tmx = new Zend_Translate('tmx', APPLICATION_ROOT . '/application/var/locale/admin/menu.tmx', $systemAdmin->lng);
     $this->view->adminlngs = $adminlngs = $config->systemadmin->language;
 }
 public function profileAction()
 {
     $proxy = new SxCms_Page_Proxy();
     $this->view->page = $proxy->getPageById('29', null, $this->_getParam('lng', 'nl'));
     //enable groups if they can choose them
     /*
     $proxy = new SxModule_Securedocs_Group_Proxy();
     $groups = $proxy->getAll();
     $this->view->groups = $groups;
     */
     $identity = Zend_Auth::getInstance()->getIdentity();
     $proxy = new SxModule_Members_Proxy();
     $item = $proxy->getById($identity->getId());
     if ($this->getRequest()->isPost()) {
         $item->setActive($this->_getParam('active'));
         $item->setLng($_SESSION['System']['lng']);
         //$this->_getParam('language')
         $item->setSex($this->_getParam('sex'));
         $item->setName($this->_getParam('name'));
         $item->setFirstName($this->_getParam('firstname'));
         $item->setCompany($this->_getParam('company'));
         $item->setWebsite($this->_getParam('website'));
         $item->setEmail($this->_getParam('email'));
         $item->setPassword($this->_getParam('password'));
         $item->setPhone($this->_getParam('phone'));
         $item->setFax($this->_getParam('fax'));
         $item->setMobilePhone($this->_getParam('mobilephone'));
         $item->setStreet($this->_getParam('street'));
         $item->setNumber($this->_getParam('number'));
         $item->setPostalcode($this->_getParam('postalcode'));
         $item->setPlace($this->_getParam('place'));
         $item->setCountry($this->_getParam('country'));
         $item->setBoardMember($this->_getParam('boardmember'));
         $item->setGroups($this->_getParam('groups'));
         //groups = array;
         /* validate post */
         if ($item->isValid()) {
             $item->save();
             $item->sendToAdmin();
             $this->view->success = "Aanpassingen succesvol opgeslagen";
         }
     }
     $this->view->messages = Sanmax_MessageStack::getInstance('SxModule_Members');
     $this->view->item = $item;
 }
 public function overviewAction()
 {
     $proxy = new SxCms_Page_Proxy();
     $page_id = $this->_getParam('page_id');
     $page_has_form = $proxy->getPageById($page_id, $this->_getParam('lng', 'nl'));
     if ($page_has_form->getPageform()) {
         $this->view->captchaId = $this->generateCaptcha();
         $pageformproxy = new SxModule_Pageform_Proxy();
         $subscription = new SxModule_Pageform_Subscription();
         $pageform = $pageformproxy->getActiveById($page_has_form->getPageform(), $_SESSION['System']['lng']);
         $this->view->pageform = $pageform;
         if ($this->getRequest()->isPost() && $this->_getParam('form_' . $page_id)) {
             $data = $this->_getParam('pageform');
             $subscription->setPageformId($pageform->getId())->setPageformname($pageform->getName())->setIp($this->getRequest()->getServer('REMOTE_ADDR'))->setAgent($this->getRequest()->getServer('HTTP_USER_AGENT'))->setLng($this->_getParam('lng'))->setUrl('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
             foreach ($pageform->getField() as $field) {
                 if (isset($data[$field->getKey()])) {
                     # Tijd instellen
                     if ($field->getFieldType() == 'text' && $field->getValidation() == 'time' && is_array($data[$field->getKey()])) {
                         $data[$field->getKey()] = $data[$field->getKey()]['hh'] . ':' . $data[$field->getKey()]['mm'];
                     }
                     # Tijd & datum instellen
                     if ($field->getFieldType() == 'text' && $field->getValidation() == 'datetime' && is_array($data[$field->getKey()])) {
                         $data[$field->getKey()] = $data[$field->getKey()]['date'] . ' ' . $data[$field->getKey()]['hh'] . ':' . $data[$field->getKey()]['mm'];
                     }
                 }
                 $metaObject = new SxModule_Pageform_Subscription_Meta();
                 $metaObject->setFieldId($field->getId())->setLabel($field->getTsl()->getName())->setName($field->getKey())->setValue(isset($data[$field->getKey()]) ? $data[$field->getKey()] : null);
                 $subscription->addMeta($metaObject);
             }
             $fielderrors = APPLICATION_ROOT . '/application/var/locale/fielderrors.tmx';
             $validator = new SxModule_Pageform_Subscription_Validator();
             $validator->setTmx(new Zend_Translate('tmx', $fielderrors, $_SESSION['System']['lng']));
             //$validator->setTmx( new Zend_Translate('tmx', APPLICATION_ROOT . '/application/var/locale/pageform.tmx', $_SESSION['System']['lng']) );
             $captchaOk = true;
             if ($pageform->getCaptcha()) {
                 $captchaOk = false;
                 $captcha = $this->_getParam('captcha');
                 if ($this->validateCaptcha($captcha)) {
                     $captchaOk = true;
                 }
             }
             $valid = false;
             if ($validator->validate($subscription, $pageform)) {
                 if ($pageform->getCaptcha()) {
                     if ($captchaOk) {
                         $valid = true;
                     }
                 } else {
                     $valid = true;
                 }
             }
             if (!$captchaOk) {
                 $this->view->capt_err = "Neem de captcha code correct over";
             }
             if ($valid) {
                 $subscription->save();
                 $config = Zend_Registry::get('config');
                 if ($pageform->getMailoption() == 1) {
                     $mail = new Zend_Mail('utf-8');
                     $mail->setSubject('Formulier verzonden op website: ' . $pageform->getName())->setFrom(Zend_Registry::get('config')->company->email, "formulier: " . $pageform->getName());
                     $view = new Zend_View();
                     $view->assign('subscription', $subscription);
                     $view->assign('config', $config);
                     $view->addScriptPath(APPLICATION_PATH . '/modules/default/views/scripts');
                     $body = $view->render('/__mail/_mailMessage.phtml');
                     $mail->setBodyHtml($body);
                     //                        $body = '<h1>Message information</h1>';
                     //                        $body .= 'Datum : ' . date('Y-m-d H:i:s') . "<br>";
                     //                        foreach ($subscription->getMeta() as $meta) {
                     //                            $body .= " " . $meta->getLabel() . ": " . $meta->getValue() . "<br>";
                     //                        }
                     //$view = new Zend_View();
                     //$view->assign('domain', $config->system->web->url);
                     //$view->assign('message', $body);
                     //$view->addScriptPath(APPLICATION_PATH . '/modules/default/views/scripts/__mail/');
                     //$mail_content =  $view->render('template.phtml');
                     $mail->setBodyHtml($body);
                     $mail->addTo($pageform->getMailto());
                     $mail->send();
                 }
                 if ($pageform->getTsl()->getConfirm() == 1) {
                     foreach ($subscription->getMeta() as $meta) {
                         if ($meta->getLabel() == $pageform->getTsl()->getConfirmto()) {
                             $sendto = $meta->getValue();
                         }
                     }
                     //$view = new Zend_View();
                     //$view->assign('domain', $config->system->web->url);
                     //$view->assign('message', $pageform->getTsl()->getConfirmcontent());
                     //$view->addScriptPath(APPLICATION_PATH . '/modules/default/views/scripts/__mail/');
                     //$mail_content =  $view->render('template.phtml');
                     $mail = new Zend_Mail('utf-8');
                     $mail->setSubject($pageform->getTsl()->getConfirmsubject())->setFrom(Zend_Registry::get('config')->company->email, Zend_Registry::get('config')->company->name);
                     $mail->setBodyHtml($body);
                     $mail->addTo($sendto);
                     $mail->send();
                 }
                 $subscription = new SxModule_Pageform_Subscription();
                 $this->view->message = "Bedankt, we hebben je bericht goed ontvangen. We zullen je zo spoedig mogelijk contacteren.";
             }
         }
         $this->view->form_slug = $this->_getParam('form_' . $page_id);
         $this->view->subscription = $subscription;
         $this->view->page = $page_has_form;
         $this->view->form_class = $this->_getParam('form_class');
         $this->view->page_id = $page_id;
         $this->view->messages = Sanmax_MessageStack::getInstance('SxModule_Pageform_Subscription');
     }
 }
Exemple #13
0
 public function getById($page_id, $lng = 'nl')
 {
     $proxy = new SxCms_Page_Proxy();
     return $proxy->getPageById($page_id, $lng);
 }
 public function submenuAction()
 {
     if (false == ($page = $this->_getParam('page'))) {
         return;
     }
     if (!$page->getId()) {
         return;
     }
     $pageProxy = new SxCms_Page_Proxy();
     $cTree = array();
     $tree = $pageProxy->getPagesByParentId($page->getId());
     $breadcrumbs = $page->getBreadcrumbs($this->_getParam('lng', 'nl'), true, false);
     $active = array();
     $active[] = $page->getId();
     if (isset($breadcrumbs[1])) {
         $active[] = $breadcrumbs[1]['page_id'];
         $tree = $pageProxy->getPagesByParentId($breadcrumbs[1]['page_id'], null, $this->_getParam('lng', 'nl'), true, true);
         $cTree = array($breadcrumbs[1]['page_id'] => $tree);
     }
     if (isset($breadcrumbs[0])) {
         $active[] = $breadcrumbs[0]['page_id'];
         $tree = $pageProxy->getPagesByParentId($breadcrumbs[0]['page_id'], null, $this->_getParam('lng', 'nl'), true, true);
     }
     $section = $pageProxy->getPageById($breadcrumbs[0]['page_id'], $this->_getParam('lng', 'nl'));
     $submenus = array();
     foreach ($tree as $item) {
         $object = $item;
         if ($object->isInNavigation() === true && $object->getDatePublished() <= strftime('%Y-%m-%d %H:%M:%S') && ($object->getDateExpired() >= strftime('%Y-%m-%d %H:%M:%S') || is_null($object->getDateExpired()))) {
             $submenus[] = $item;
         }
     }
     $this->view->submenus = $submenus;
     $this->view->subsubmenus = $cTree;
     $this->view->active = $active;
     $this->view->section = $section;
 }