protected function _loadParams() { $this->_globalSettings = HCMS_Utils::loadThemeConfig('config.php', 'contact'); $fieldTypes = HCMS_Utils::loadThemeConfig('types.php', 'contact'); if (!isset($this->_globalSettings['forms'][$this->_formId])) { throw new Exception("Form not found"); } $this->_formParams = $this->_globalSettings['forms'][$this->_formId]; $this->_fields = Contact_Form_Generic::getFieldsArr($fieldTypes, $this->_formParams['fields']); }
protected function _loadParams() { $this->_globalSettings = HCMS_Utils::loadThemeConfig('config.php', 'contact'); $fieldTypes = HCMS_Utils::loadThemeConfig('types.php', 'contact'); if ($this->_request->getParam('form_id')) { $this->_formId = $this->_request->getParam('form_id'); } if (!isset($this->_globalSettings['forms'][$this->_formId])) { throw new Exception("Form not found"); } $this->_formParams = $this->_globalSettings['forms'][$this->_formId]; $this->_fields = Contact_Form_Generic::getFieldsArr($fieldTypes, $this->_formParams['fields']); $this->_entityClassName = $this->getEntityClassName(); $this->_mapperClassName = $this->getMapperClassName(); $this->_columns = $this->getColumns(); $this->view->columns = $this->_columns; $this->view->formId = $this->_formId; }
protected function _initApplication() { $bootstrap = $this->getInvokeArg('bootstrap'); $config = $bootstrap->getOptions(); if (isset($config['default']['applicationId'])) { $this->_applicationId = $config['default']['applicationId']; } else { $this->_applicationId = 1; } $this->_application = new Application_Model_Application(); if (!Application_Model_ApplicationMapper::getInstance()->find($this->_applicationId, $this->_application)) { throw new Zend_Exception("Application not found [{$this->_applicationId}]"); } $this->_publicDirectory = isset($config['default']['publicDirectory']) ? $config['default']['publicDirectory'] : APPLICATION_PATH . '/../public'; $fileConfig = HCMS_Utils::loadThemeConfig('application.php'); if ($fileConfig && isset($fileConfig['settings'])) { $this->_application->set_settings($fileConfig['settings']); } $this->view->application = $this->_application; $this->view->headTitle($this->_application->get_name())->setSeparator(' - '); if ($this->getRequest()->getModuleName() != '') { $this->_module = $this->getRequest()->getModuleName(); } $this->view->module = $this->_module; //fb og properies $this->view->doctype('XHTML1_RDFA'); $this->view->headMeta()->setProperty('og:type', 'website'); $this->view->headMeta()->setProperty('og:url', $this->view->fullUrl()); if ($this->_application->get_name() != '') { $this->view->headMeta()->setProperty('og:title', $this->_application->get_name()); } if ($this->_application->get_og_settings('image') != '') { $this->view->headMeta()->setProperty('og:image', $this->view->fullUrl('/content/1/' . $this->_application->get_og_settings('image'))); } if ($this->_application->get_og_settings('description') != '') { $this->view->headMeta()->setProperty('og:description', $this->_application->get_og_settings('description')); } }
/** * Render picture tag * * @param string $imageSlug image ID * @param string $directory directory path * @param string $altText alt text * @param string $fileExt file extension including dot * @param array $params extra params * @return string */ public function renderPicture($imageSlug, $directory, $altText = '', $fileExt = '.jpg', $params = array()) { if (!isset(self::$imagesConf)) { self::$imagesConf = HCMS_Utils::loadThemeConfig('picture.php'); } $section = isset($params['section']) ? $params['section'] : 'default'; $images = self::$imagesConf[$section]; if (isset($params['css_class'])) { $cssClass = ' class="' . $params['css_class'] . '"'; } else { $cssClass = ''; } $html = '<picture' . $cssClass . '><!--[if IE 9]><video style="display: none;"><![endif]-->'; foreach ($images as $query => $suffix) { $path = $directory . '/' . $imageSlug . '_' . $suffix . $fileExt; if (isset($params['version'])) { $path .= '?v=' . $params['version']; } $html .= '<source srcset="' . $path . ' " media="' . $query . '">'; } $html .= '<!--[if IE 9]></video><![endif]--><img srcset="' . $path . '" alt="' . $this->view->escape($altText) . '"></picture>'; return $html; }
protected function _initMenus() { $navigation = HCMS_Utils::loadThemeConfig('navigation.php', 'admin'); $this->view->navigation(new Zend_Navigation($navigation)); }
/** * Get image params * * @param array $dims * @param boolean $independent960 * @return array */ public function getImagesParams($dims, $section = 'default') { $imagesConf = HCMS_Utils::loadThemeConfig('picture.php'); $variations = $imagesConf[$section]; $result = array(); $i = 0; foreach ($variations as $query => $suffix) { $width = $dims[$i * 2]; $height = $dims[$i * 2 + 1]; $elements = explode('_', $suffix); $vp = $elements[0]; $density = count($elements) >= 2 ? $elements[1] : 1; $result['img_' . $suffix] = array("name" => "Image for viewport width {$vp} and density {$density}", "media_query" => $query, "options" => array("minwidth" => $width, "maxwidth" => $width, "minheight" => $height, "maxheight" => $height)); $i++; } return $result; }
public function editAction() { //load params $this->_globalSettings = HCMS_Utils::loadThemeConfig('config.php', 'contact'); $fieldTypes = HCMS_Utils::loadThemeConfig('types.php', 'contact'); if ($this->_request->getParam('form_id')) { $this->_formId = $this->_request->getParam('form_id'); } if (!isset($this->_globalSettings['forms'][$this->_formId])) { throw new Exception("Form not found"); } $this->_formParams = $this->_globalSettings['forms'][$this->_formId]; $this->_fields = Contact_Form_Generic::getFieldsArr($fieldTypes, $this->_formParams['fields']); $data = $this->getRequest()->getPost('data'); $id = $this->_getParam('id'); //check if cancel button is pressed if ($this->_formHelper->isCancel()) { //cancel form return $this->_formHelper->returnCancel($this->view->url(array('action' => 'index')), $this->translate('Action canceled')); } //create form object $form = new Contact_Form_AdminSubscribe($data); //postback - save? if ($this->_formHelper->isSave()) { //check if valid if ($form->isValid()) { $values = $form->getValues(); $subscription = new Contact_Model_Subscription($values); if (isset($data['id'])) { $oldSubscription = new Contact_Model_Subscription(); if (Contact_Model_SubscriptionMapper::getInstance()->find($data['id'], $oldSubscription) && $oldSubscription->get_status() != $subscription->get_status()) { $dt = date("Y-m-d H:i:s"); switch ($subscription->get_status()) { case 'subscribed': $subscription->set_subscribed_dt($dt); break; case 'unsubscribed': $subscription->set_unsubscribed_dt($dt); break; default: break; } } } Contact_Model_SubscriptionMapper::getInstance()->save($subscription); //sending done, return success return $this->_formHelper->returnSuccess($this->view->url(array('action' => 'index')), $this->translate('Saved')); } else { $this->_formHelper->returnError($form->getMessages()); } } elseif (!$this->_formHelper->getRequest()->isPost()) { //edit action if (isset($id) && $id > 0) { $subscription = new Contact_Model_Subscription(); if (!Contact_Model_SubscriptionMapper::getInstance()->find($id, $subscription)) { throw new Exception("Record not found"); } //fetch data $data = $subscription->toArray(); //populate form with data $form->setData($data); } } $this->view->data = $data; $this->view->fields = $this->_fields; $this->view->formParams = $this->_formParams; $this->view->formId = $this->_formId; }