/**
  * 设置所属模块
  * @param  string  $modName
  * @throws EGP_Exception
  */
 public function setModule($modName)
 {
     $module = new ModuleModel();
     if (!$module->exists($modName)) {
         throw new EGP_Exception("指定的模块名称 '{$modName}' 不存在");
     }
     $this->_modName = $modName;
     $this->_modDesc = $module->getDesc($this->_modName);
 }
Example #2
0
 /**
  * Initialize the object
  *
  * @param ContentModel|ModuleModel|FormModel $objElement
  * @param string                             $strColumn
  */
 public function __construct($objElement, $strColumn = 'main')
 {
     parent::__construct();
     // Store the parent element (see #4556)
     if ($objElement instanceof Model) {
         $this->objParent = $objElement;
     } elseif ($objElement instanceof Model\Collection) {
         $this->objParent = $objElement->current();
     }
     if ($this->strKey == '' || $this->strTable == '') {
         return;
     }
     /** @var Model $strModelClass */
     $strModelClass = \Model::getClassFromTable($this->strTable);
     // Load the model
     if (class_exists($strModelClass)) {
         $objHybrid = $strModelClass::findByPk($objElement->{$this->strKey});
         if ($objHybrid === null) {
             return;
         }
         $this->objModel = $objHybrid;
     } else {
         $objHybrid = $this->Database->prepare("SELECT * FROM " . $this->strTable . " WHERE id=?")->limit(1)->execute($objElement->{$this->strKey});
         if ($objHybrid->numRows < 1) {
             return;
         }
     }
     $cssID = array();
     $this->arrData = $objHybrid->row();
     // Get the CSS ID from the parent element (!)
     $this->cssID = deserialize($objElement->cssID, true);
     if (isset($objHybrid->attributes)) {
         $cssID = deserialize($objHybrid->attributes, true);
     }
     // Override the CSS ID (see #305)
     if (!empty($this->cssID[0])) {
         $cssID[0] = $this->cssID[0];
     }
     // Merge the CSS classes (see #6011)
     if (!empty($this->cssID[1])) {
         $cssID[1] = trim($cssID[1] . ' ' . $this->cssID[1]);
     }
     $this->cssID = $cssID;
     $this->typePrefix = $objElement->typePrefix;
     $arrHeadline = deserialize($objElement->headline);
     $this->headline = is_array($arrHeadline) ? $arrHeadline['value'] : $arrHeadline;
     $this->hl = is_array($arrHeadline) ? $arrHeadline['unit'] : 'h1';
     $this->strColumn = $strColumn;
 }
 /**
  * @brief Contructor
  **/
 function init()
 {
     // module_srl이 있으면 미리 체크하여 존재하는 모듈이면 module_info 세팅
     $module_srl = Context::get('module_srl');
     if (!$module_srl && $this->module_srl) {
         $module_srl = $this->module_srl;
         Context::set('module_srl', $module_srl);
     }
     $oModuleModel =& getModel('module');
     // module_srl이 넘어오면 해당 모듈의 정보를 미리 구해 놓음
     if ($module_srl) {
         $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
         if (!$module_info) {
             Context::set('module_srl', '');
             $this->act = 'list';
         } else {
             ModuleModel::syncModuleToSite($module_info);
             $this->module_info = $module_info;
             Context::set('module_info', $module_info);
         }
     }
     if ($module_info && !in_array($module_info->module, array('nmileage'))) {
         return $this->stop("msg_invalid_request");
     }
     // set template file
     $tpl_path = $this->module_path . 'tpl';
     $this->setTemplatePath($tpl_path);
     Context::set('tpl_path', $tpl_path);
 }
 /**
  * Das Modul generieren.
  *
  * Werte für das Template bereitstellen.
  *
  * @return void
  */
 protected function compile()
 {
     // Suche in Datenbank nach einem Modul des Typs 'nlsh_easy_Piwik_Module',
     $objPiwikModule = \ModuleModel::findOneBy('type', 'nlsh_easy_Piwik_Counter');
     // Wenn Modul vorhanden
     if ($objPiwikModule !== NULL) {
         // Impressumstext hinzufügen
         $arrEasyPiwikImpressum['impressumtext'] = $objPiwikModule->nlsh_piwik_impressum;
         // Abschalten einbinden, falls erwünscht und URL vorhanden
         if ($objPiwikModule->nlsh_piwik_noscan == TRUE && $objPiwikModule->nlsh_piwik_domain == TRUE) {
             // Pfad zur Website mit scheme "http://" vorbelegen,
             // falls scheme nicht vorhanden
             $parseUrl = parse_url($objPiwikModule->nlsh_piwik_domain);
             if (!$parseUrl['scheme']) {
                 $objPiwikModule->nlsh_piwik_domain = 'http://' . $objPiwikModule->nlsh_piwik_domain;
             }
             // Pfad zur CSS- Datei hinzufügen
             $urlCssOptOut = $this->Environment->url . $GLOBALS['TL_CONFIG']['websitePath'] . '/files/nlsh_piwik_counter_' . $objPiwikModule->id . '.css';
             // HTML- String für das iframe erzeugen und hinzufügen
             $arrEasyPiwikImpressum['piwiknoscan'] = sprintf("<iframe class =\"piwikiframe\" frameborder=\"0\" src=\"%s/index.php?module=CoreAdminHome&amp;action=optOut&amp;language=%s&amp;css=%s\"></iframe>", $objPiwikModule->nlsh_piwik_domain, $GLOBALS['TL_LANGUAGE'], $urlCssOptOut);
         }
     } else {
         // Fehlermeldung, wenn kein PIWIK- Modul vorhanden
         $arrEasyPiwikImpressum['nopiwikmodul'] = $GLOBALS['TL_LANG']['MSC']['nlsh_easy_Piwik_ContentImpressum']['nopiwikmodul'];
     }
     // und ab in das Template
     $this->Template->piwikimpressum = (object) $arrEasyPiwikImpressum;
 }
 /**
  * @brief 모듈 목록
  */
 function dispInipaystandardAdminModuleList()
 {
     $args = new stdClass();
     $args->sort_index = "module_srl";
     $args->page = Context::get('page');
     $args->list_count = 20;
     $args->page_count = 10;
     $args->s_module_category_srl = Context::get('module_category_srl');
     $search_target = Context::get('search_target');
     $search_keyword = Context::get('search_keyword');
     switch ($search_target) {
         case 'mid':
             $args->s_mid = $search_keyword;
             break;
         case 'browser_title':
             $args->s_browser_title = $search_keyword;
             break;
     }
     $output = executeQueryArray('inipaystandard.getModuleList', $args);
     ModuleModel::syncModuleToSite($output->data);
     Context::set('total_count', $output->total_count);
     Context::set('total_page', $output->total_page);
     Context::set('page', $output->page);
     Context::set('module_list', $output->data);
     Context::set('page_navigation', $output->page_navigation);
     $this->setTemplateFile('module_list');
 }
 /**
  * Modify the pallete and fields for this module
  */
 public function modifyPaletteAndFields($dc)
 {
     $objModule = \ModuleModel::findById($dc->id);
     if ($objModule != null && $objModule->type == 'hofff_subscribe-extended') {
         $GLOBALS['TL_DCA']['tl_module']['fields']['nl_template']['options_callback'] = array('tl_module_hofff_subscribe_extended', 'getNewsletterTemplates');
     }
 }
Example #7
0
 /**
  * Compile the current element
  */
 protected function compile()
 {
     $config = deserialize($this->bootstrap_navbarModules, true);
     $modules = array();
     $ids = array();
     // get ids
     foreach ($config as $index => $module) {
         $ids[$index] = intval($module['module']);
     }
     // prefetch modules, so only 1 query is required
     $ids = implode(',', $ids);
     $collection = \ModuleModel::findBy(array('tl_module.id IN(' . $ids . ')'), array());
     $models = array();
     if ($collection) {
         while ($collection->next()) {
             $model = $collection->current();
             $model->bootstrap_inNavbar = true;
             $models[$model->id] = $model;
         }
     }
     foreach ($config as $module) {
         $id = $module['module'];
         if ($id != '' && array_key_exists($id, $models)) {
             $modules[] = $this->generateModule($module, $models[$id]);
         }
     }
     if ($this->cssID[1] == '') {
         $cssID = $this->cssID;
         $cssID[1] = 'navbar-default';
         $this->cssID = $cssID;
     }
     $this->Template->modules = $modules;
 }
Example #8
0
 /**
  * Parse the template
  *
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'FE' && !BE_USER_LOGGED_IN && ($this->invisible || $this->start != '' && $this->start > time() || $this->stop != '' && $this->stop < time())) {
         return '';
     }
     $objModule = \ModuleModel::findByPk($this->module);
     if ($objModule === null) {
         return '';
     }
     $strClass = \Module::findClass($objModule->type);
     if (!class_exists($strClass)) {
         return '';
     }
     $objModule->typePrefix = 'ce_';
     /** @var Module $objModule */
     $objModule = new $strClass($objModule, $this->strColumn);
     $cssID = deserialize($objModule->cssID, true);
     // Override the CSS ID (see #305)
     if (!empty($this->cssID[0])) {
         $cssID[0] = $this->cssID[0];
     }
     // Merge the CSS classes (see #6011)
     if (!empty($this->cssID[1])) {
         $cssID[1] = trim($cssID[1] . ' ' . $this->cssID[1]);
     }
     $objModule->cssID = $cssID;
     return $objModule->generate();
 }
Example #9
0
 /**
  * load modal content
  */
 public function loadModalContent()
 {
     global $objPage;
     $id = \Input::get('modal');
     if ($id == '') {
         return;
     }
     $page = \Input::get('page');
     // load layout because we need to initiate bootstrap
     /** @var \PageModel $objPage */
     $objPage = \PageModel::findByPk($page);
     $objPage->loadDetails();
     if ($objPage === null) {
         $this->log(sprintf('Page ID %s not found', $page), 'Netzmacht\\Bootstrap\\Ajax::loadModalContent', TL_ERROR);
         exit;
     }
     $objLayout = $this->getPageLayout($objPage);
     // Set the layout template and template group
     $objPage->template = $objLayout->template ?: 'fe_page';
     $objPage->templateGroup = $objLayout->getRelated('pid')->templates;
     // trigger getPageLayout hook so
     if (isset($GLOBALS['TL_HOOKS']['getPageLayout']) && is_array($GLOBALS['TL_HOOKS']['getPageLayout'])) {
         foreach ($GLOBALS['TL_HOOKS']['getPageLayout'] as $hook) {
             $this->import($hook[0]);
             $this->{$hook[0]}->{$hook[1]}($objPage, $objLayout, $this);
         }
     }
     $model = \ModuleModel::findOneBy('type="bootstrap_modal" AND tl_module.id', $id);
     if ($model === null) {
         exit;
     }
     $model->isAjax = true;
     $this->output($this->getFrontendModule($model));
 }
 /**
  * Generate a front end module and return it as string
  *
  * @param mixed  $intId     A module ID or a Model object
  * @param string $strColumn The name of the column
  *
  * @return string The module HTML markup
  */
 protected static function getFrontendModuleAjax($intId, $strColumn = 'main')
 {
     if (!is_object($intId) && !strlen($intId)) {
         return '';
     }
     if (is_object($intId)) {
         $objRow = $intId;
     } else {
         $objRow = \ModuleModel::findByPk($intId);
         if ($objRow === null) {
             return '';
         }
     }
     // Check the visibility (see #6311)
     if (!\Controller::isVisibleElement($objRow)) {
         return '';
     }
     $strClass = \Module::findClass($objRow->type);
     // Return if the class does not exist
     if (!class_exists($strClass)) {
         \System::log('Module class "' . $strClass . '" (module "' . $objRow->type . '") does not exist', __METHOD__, TL_ERROR);
         return '';
     }
     $objRow->typePrefix = 'mod_';
     $objModule = new $strClass($objRow, $strColumn);
     $strBuffer = AjaxInput::get('g') == '1' ? $objModule->generate() : $objModule->generateAjax();
     // HOOK: add custom logic
     if (isset($GLOBALS['TL_HOOKS']['getFrontendModule']) && is_array($GLOBALS['TL_HOOKS']['getFrontendModule'])) {
         foreach ($GLOBALS['TL_HOOKS']['getFrontendModule'] as $callback) {
             $strBuffer = \System::importStatic($callback[0])->{$callback}[1]($objRow, $strBuffer, $objModule);
         }
     }
     return $strBuffer;
 }
 /**
  * Parse the template
  *
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'FE' && !BE_USER_LOGGED_IN && ($this->invisible || $this->start > 0 && $this->start > time() || $this->stop > 0 && $this->stop < time())) {
         return '';
     }
     $objModule = \ModuleModel::findByPk($this->news_module);
     if ($objModule === null) {
         return '';
     }
     $strClass = \Module::findClass($objModule->type);
     if (!class_exists($strClass)) {
         return '';
     }
     $objModule->typePrefix = 'ce_';
     $objModule = new $strClass($objModule, $this->strColumn);
     // Overwrite spacing and CSS ID
     $objModule->origSpace = $objModule->space;
     $objModule->space = $this->space;
     $objModule->origCssID = $objModule->cssID;
     $objModule->cssID = $this->cssID;
     // Override news filter settings
     $objModule->news_filterCategories = $this->news_filterCategories;
     $objModule->news_filterDefault = $this->news_filterDefault;
     $objModule->news_filterPreserve = $this->news_filterPreserve;
     return $objModule->generate();
 }
 protected function compile()
 {
     $objContentStart = \Database::getInstance()->prepare("SELECT * FROM tl_content WHERE pid=? AND type=? ORDER BY sorting")->limit(1)->execute($this->pid, 'formhybridStart');
     if ($objContentStart->numRows === 0) {
         return;
     }
     $objModule = \ModuleModel::findByPk($objContentStart->formhybridModule);
     if ($objModule === null) {
         return;
     }
     $objModule->refresh();
     $strClass = \Module::findClass($objModule->type);
     // Return if the class does not exist
     if (!class_exists($strClass)) {
         static::log('Module class "' . $strClass . '" (module "' . $objModule->type . '") does not exist', __METHOD__, TL_ERROR);
         return '';
     }
     $objArticle = \ArticleModel::findByPk($this->pid);
     if ($objArticle === null) {
         return;
     }
     global $objPage;
     $objModule = new $strClass($objModule, $objArticle->inColumn);
     $objModule->renderStop = true;
     $objModule->startModule = $_SESSION[FormSession::FORMHYBRID_FORMSESSION_START_KEY][$objPage->id . '_' . $objModule->formHybridDataContainer];
     $this->Template->content = $objModule->generate();
 }
 function init()
 {
     // module_srl이 있으면 미리 체크하여 존재하는 모듈이면 module_info 세팅
     $module_srl = Context::get('module_srl');
     if (!$module_srl && $this->module_srl) {
         $module_srl = $this->module_srl;
         Context::set('module_srl', $module_srl);
     }
     $oModuleModel =& getModel('module');
     // module_srl이 넘어오면 해당 모듈의 정보를 미리 구해 놓음
     if ($module_srl) {
         $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
         if (!$module_info) {
             Context::set('module_srl', '');
             $this->act = 'list';
         } else {
             ModuleModel::syncModuleToSite($module_info);
             $this->module_info = $module_info;
             Context::set('module_info', $module_info);
         }
     }
     if ($module_info && $module_info->module != 'purplebook') {
         return $this->stop("msg_invalid_request");
     }
     // 템플릿 설정
     $this->setTemplatePath($this->module_path . 'tpl');
 }
Example #14
0
 /**
  * @brief initialize
  **/
 function init($module = null)
 {
     if (Context::get('module') != 'admin') {
         parent::init();
     }
     // module_srl이 있으면 미리 체크하여 존재하는 모듈이면 module_info 세팅
     $module_srl = Context::get('module_srl');
     if (!$module_srl && $this->module_srl) {
         $module_srl = $this->module_srl;
         Context::set('module_srl', $module_srl);
     }
     $oModuleModel = getModel('module');
     // module_srl이 넘어오면 해당 모듈의 정보를 미리 구해 놓음
     if ($module_srl) {
         $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
         if (!$module_info) {
             Context::set('module_srl', '');
             $this->act = 'list';
         } else {
             ModuleModel::syncModuleToSite($module_info);
             $this->module_info = $module_info;
             Context::set('module_info', $module_info);
         }
     }
     if ($module_info && !in_array($module_info->module, array('cympusadmin'))) {
         return new Object(-1, 'msg_invalid_request');
     }
     // set template file
     $tpl_path = $this->module_path . 'tpl';
     $this->setTemplatePath($tpl_path);
 }
 /**
  * @brief initialize view class
  */
 function init()
 {
     $oModuleModel =& getModel('module');
     // use $this->module_srl if the module_srl is not passed
     $module_srl = Context::get('module_srl');
     if (!$module_srl && $this->module_srl) {
         $module_srl = $this->module_srl;
         Context::set('module_srl', $module_srl);
     }
     // prepare $module_info if the module_srl is passed.
     if ($module_srl) {
         $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
         if (!$module_info) {
             Context::set('module_srl', '');
             $this->act = 'list';
         } else {
             ModuleModel::syncModuleToSite($module_info);
             $this->module_info = $module_info;
             Context::set('module_info', $module_info);
         }
     }
     // set template path
     $tpl_path = $this->module_path . 'tpl';
     $this->setTemplatePath($tpl_path);
     Context::set('tpl_path', $tpl_path);
 }
 /**
  * Parse the template
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'FE' && !BE_USER_LOGGED_IN && ($this->invisible || $this->start > 0 && $this->start > time() || $this->stop > 0 && $this->stop < time())) {
         return '';
     }
     $objModule = \ModuleModel::findByPk($this->module);
     if ($objModule === null) {
         return '';
     }
     $strClass = \Module::findClass($objModule->type);
     if (!class_exists($strClass)) {
         return '';
     }
     $objModule->typePrefix = 'ce_';
     $objModule = new $strClass($objModule, $this->strColumn);
     // create new cssID array
     $cssID = array();
     // set the ID
     $cssID[0] = $this->cssID[0] ?: $objModule->cssID[0];
     // merge the classes
     $arrElementClasses = explode(' ', $this->cssID[1]);
     $arrModuleClasses = explode(' ', $objModule->cssID[1]);
     $cssID[1] = implode(' ', array_unique(array_merge($arrModuleClasses, $arrElementClasses)));
     // Overwrite spacing and CSS ID
     $objModule->space = $this->space;
     $objModule->cssID = $cssID;
     return $objModule->generate();
 }
 /**
  * @brief 초기화
  *
  * livexe 모듈은 일반 사용과 관리자용으로 나누어진다.\n
  **/
 function init()
 {
     // module_srl이 있으면 미리 체크하여 존재하는 모듈이면 module_info 세팅
     $module_srl = Context::get('module_srl');
     if (!$module_srl && $this->module_srl) {
         $module_srl = $this->module_srl;
         Context::set('module_srl', $module_srl);
     }
     // module model 객체 생성
     $oModuleModel =& getModel('module');
     // module_srl이 넘어오면 해당 모듈의 정보를 미리 구해 놓음
     if ($module_srl) {
         $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
         if (!$module_info) {
             Context::set('module_srl', '');
             $this->act = 'dispLivexeAdminIndex';
         } else {
             ModuleModel::syncModuleToSite($module_info);
             $this->module_info = $module_info;
             Context::set('module_info', $module_info);
         }
     }
     if ($module_info && $module_info->module != 'livexe') {
         return $this->stop("msg_invalid_request");
     }
     // 모듈 카테고리 목록을 구함
     $module_category = $oModuleModel->getModuleCategories();
     Context::set('module_category', $module_category);
     $template_path = sprintf("%stpl/", $this->module_path);
     $this->setTemplatePath($template_path);
 }
Example #18
0
 /**
  * @brief Initialization
  **/
 function init()
 {
     // Pre-check if module_srl exists. Set module_info if exists
     $module_srl = Context::get('module_srl');
     // Create module model object
     $oModuleModel =& getModel('module');
     // module_srl two come over to save the module, putting the information in advance
     if ($module_srl) {
         $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
         if (!$module_info) {
             Context::set('module_srl', '');
             $this->act = 'list';
         } else {
             ModuleModel::syncModuleToSite($module_info);
             $this->module_info = $module_info;
             Context::set('module_info', $module_info);
         }
     }
     // Get a list of module categories
     $module_category = $oModuleModel->getModuleCategories();
     Context::set('module_category', $module_category);
     //Security
     $security = new Security();
     $security->encodeHTML('module_category..title');
     // Get a template path (page in the administrative template tpl putting together)
     $this->setTemplatePath($this->module_path . 'tpl');
 }
 function init()
 {
     // module_srl이 있으면 미리 체크하여 존재하는 모듈이면 module_info 세팅
     $module_srl = Context::get('module_srl');
     if (!$module_srl && $this->module_srl) {
         $module_srl = $this->module_srl;
         Context::set('module_srl', $module_srl);
     }
     // module model 객체 생성
     $oModuleModel = getModel('module');
     // module_srl이 넘어오면 해당 모듈의 정보를 미리 구해 놓음
     if ($module_srl) {
         $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
         if (!$module_info) {
             Context::set('module_srl', '');
             $this->act = 'list';
         } else {
             ModuleModel::syncModuleToSite($module_info);
             $this->module_info = $module_info;
             Context::set('module_info', $module_info);
         }
     }
     if ($module_info && $module_info->module != 'attendance') {
         return $this->stop("msg_invalid_request");
     }
     // 모듈 카테고리 목록을 구함
     $module_category = $oModuleModel->getModuleCategories();
     Context::set('module_category', $module_category);
 }
Example #20
0
 function __construct($path = null)
 {
     parent::__construct('pathmap', array('path', 'modpage', 'controller', 'action', 'extra', 'wildcard'), 'paths');
     if ($path != null) {
         $this->get_by_path($path);
     }
 }
 function dispTranslationAdminContent()
 {
     $args->sort_index = "module_srl";
     $args->page = Context::get('page');
     $args->list_count = 20;
     $args->page_count = 10;
     $args->s_module_category_srl = Context::get('module_category_srl');
     $s_mid = Context::get('s_mid');
     if ($s_mid) {
         $args->s_mid = $s_mid;
     }
     $s_browser_title = Context::get('s_browser_title');
     if ($s_browser_title) {
         $args->s_browser_title = $s_browser_title;
     }
     $output = executeQueryArray('translation.getTranslationList', $args);
     ModuleModel::syncModuleToSite($output->data);
     // setup module variables, context::set
     Context::set('total_count', $output->total_count);
     Context::set('total_page', $output->total_page);
     Context::set('page', $output->page);
     Context::set('translation_list', $output->data);
     Context::set('page_navigation', $output->page_navigation);
     // set template file
     $this->setTemplateFile('index');
 }
 /**
  * 角色指派
  */
 public function roleAction()
 {
     $uid = (int) $this->_request->getParam('uid');
     if ($this->_request->isPost()) {
         $roles = $this->_request->getPost('roles');
         $this->db->delete('user_role', $this->db->quoteInto('uid=?', $uid));
         foreach ($roles as $module => $roleId) {
             $data = array('uid' => $uid, 'role_id' => $roleId, 'mod_name' => $module);
             $this->db->insert('user_role', $data);
         }
         $this->_redirect($this->view->url(array('action' => 'list')));
     }
     $module = new ModuleModel();
     $this->view->modules = $module->info();
     $this->view->rolesGroup = $this->user->getRolesGroup();
     $this->view->userRoles = $this->user->getUserRoles($uid);
 }
Example #23
0
 /**
  * Constructor.
  */
 public function __construct(&$request)
 {
     // Construct the parent class
     parent::__construct($request);
     // Set the Visualization database variable
     $this->vizDb = SqlServerDatabase::getInstance();
     // Connect to the Visualization database as a read-only user and as a write user
     $this->vizDb->connect(self::DB_CONNECTION_VIZ_READ, self::DB_CONNECTION_VIZ_HOST, self::DB_CONNECTION_VIZ_READ_USER, self::DB_CONNECTION_VIZ_READ_PASS, self::DB_CONNECTION_VIZ_DB);
     $this->vizDb->connect(self::DB_CONNECTION_VIZ_WRITE, self::DB_CONNECTION_VIZ_HOST, self::DB_CONNECTION_VIZ_WRITE_USER, self::DB_CONNECTION_VIZ_WRITE_PASS, self::DB_CONNECTION_VIZ_DB);
 }
 public static function addSubscriptions(Order $objOrder, $arrTokens)
 {
     $strEmail = $objOrder->getBillingAddress()->email;
     $objAddress = $objOrder->getShippingAddress() ?: $objOrder->getBillingAddress();
     $arrItems = $objOrder->getItems();
     $objSession = \Session::getInstance();
     if (!($intModule = $objSession->get('isotopeCheckoutModuleIdSubscriptions'))) {
         return true;
     }
     $objSession->remove('isotopeCheckoutModuleIdSubscriptions');
     $objModule = \ModuleModel::findByPk($intModule);
     foreach ($arrItems as $item) {
         switch ($objModule->iso_direct_checkout_product_mode) {
             case 'product_type':
                 $objFieldpalette = FieldPaletteModel::findBy('iso_direct_checkout_product_type', Standard::findAvailableByIdOrAlias($item->product_id)->type);
                 break;
             default:
                 $objFieldpalette = FieldPaletteModel::findBy('iso_direct_checkout_product', $item->product_id);
                 break;
         }
         if ($objFieldpalette !== null && $objFieldpalette->iso_addSubscription) {
             if ($objFieldpalette->iso_subscriptionArchive && (!$objFieldpalette->iso_addSubscriptionCheckbox || \Input::post('subscribeToProduct_' . $item->product_id))) {
                 $objSubscription = Subscription::findOneBy(array('email=?', 'pid=?', 'activation!=?', 'disable=?'), array($strEmail, $objFieldpalette->iso_subscriptionArchive, '', 1));
                 if (!$objSubscription) {
                     $objSubscription = new Subscription();
                 }
                 if ($objFieldpalette->iso_addActivation) {
                     $strToken = md5(uniqid(mt_rand(), true));
                     $objSubscription->disable = true;
                     $objSubscription->activation = $strToken;
                     if (($objNotification = Notification::findByPk($objFieldpalette->iso_activationNotification)) !== null) {
                         if ($objFieldpalette->iso_activationJumpTo && ($objPageRedirect = \PageModel::findByPk($objFieldpalette->iso_activationJumpTo)) !== null) {
                             $arrTokens['link'] = \Environment::get('url') . '/' . \Controller::generateFrontendUrl($objPageRedirect->row()) . '?token=' . $strToken;
                         }
                         $objNotification->send($arrTokens, $GLOBALS['TL_LANGUAGE']);
                     }
                 }
                 $arrAddressFields = \Config::get('iso_addressFields');
                 if ($arrAddressFields === null) {
                     $arrAddressFields = serialize(array_keys(static::getIsotopeAddressFields()));
                 }
                 foreach (deserialize($arrAddressFields, true) as $strName) {
                     $objSubscription->{$strName} = $objAddress->{$strName};
                 }
                 $objSubscription->email = $strEmail;
                 $objSubscription->pid = $objFieldpalette->iso_subscriptionArchive;
                 $objSubscription->tstamp = $objSubscription->dateAdded = time();
                 $objSubscription->quantity = \Input::post('quantity');
                 $objSubscription->order_id = $objOrder->id;
                 $objSubscription->save();
             }
         }
     }
     return true;
 }
Example #25
0
 function getModuleMidList($args)
 {
     $args->list_count = 20;
     $args->page_count = 10;
     $output = executeQueryArray('module.getModuleMidList', $args);
     if (!$output->toBool()) {
         return $output;
     }
     ModuleModel::syncModuleToSite($output->data);
     return $output;
 }
 /**
  * 获取所有模块
  * @return array
  */
 public function info()
 {
     if (null == self::$_modules) {
         $rows = $this->db->select()->from('acl_module');
         $rows = $this->db->fetchAll($rows);
         self::$_modules = array();
         foreach ($rows as $row) {
             self::$_modules[$row['mod_name']] = $row['mod_desc'];
         }
     }
     return self::$_modules;
 }
 /**
  * Display a wildcard in the back end
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['newslist_plus'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     // set news categories from filter
     if (\Input::get('newscategories')) {
         $this->news_archives = explode(',', \Input::get('newscategories'));
         $this->filterActive = true;
     }
     $this->news_archives = $this->sortOutProtected(deserialize($this->news_archives));
     // Return if there are no archives
     if (!is_array($this->news_archives) || empty($this->news_archives)) {
         return '';
     }
     $GLOBALS['NEWS_FILTER_CATEGORIES'] = $this->news_filterCategories ? true : false;
     $GLOBALS['NEWS_FILTER_DEFAULT'] = deserialize($this->news_filterDefault, true);
     $GLOBALS['NEWS_FILTER_PRESERVE'] = $this->news_filterPreserve;
     if ($this->news_filterModule) {
         $this->objFilter = \ModuleModel::findByPk($this->news_filterModule);
     }
     $this->news_categories = array();
     // set news categories from filter
     if (\Input::get('categories')) {
         $this->news_categories = explode(',', \Input::get('categories'));
         $this->filterActive = true;
     }
     // Show the event reader if an item has been selected
     if (!$this->news_showInModal && $this->news_readerModule > 0 && (isset($_GET['news']) || \Config::get('useAutoItem') && isset($_GET['auto_item']))) {
         return $this->getFrontendModule($this->news_readerModule, $this->strColumn);
     }
     // filter
     if (\Input::get('startDate')) {
         $this->startDate = strtotime(\Input::get('startDate') . ' 00:00:00');
         $this->filterActive = true;
     }
     if (\Input::get('endDate')) {
         $this->endDate = strtotime(\Input::get('endDate') . ' 23:59:59');
         $this->filterActive = true;
     }
     if (\Input::get('searchKeywords')) {
         $this->strKeywords = trim(\Input::get('searchKeywords'));
         $this->filterActive = true;
         $this->filterSearch = true;
     }
     return parent::generate();
 }
 protected function compile()
 {
     $arrContent = array();
     $objContent = $this->Database->prepare("SELECT * FROM tl_content WHERE tstamp > ? && outSide_log = ? && invisible = ? ORDER BY tstamp DESC")->execute($this->Member->lastLogin, '', '');
     while ($objContent->next()) {
         $arrItem = $objContent->row();
         if ($objContent->type == 'module') {
             $objModule = \ModuleModel::findById($objContent->module);
         }
         if ($objContent->type != 'module' or $objContent->type == 'module' && $objModule->type != 'content_log') {
             $arrItem['htmlElement'] = $this->getContentElement($objContent->id);
             foreach ($GLOBALS['TL_HOOKS']['contentLog'] as $callback) {
                 $this->import($callback[0]);
                 $arrItem = $this->{$callback}[0]->{$callback}[1]($objContent->ptable, $objContent->tstamp, $arrItem);
             }
             if ($mod++ % 2 == 0) {
                 $arrItem['css'] .= 'even';
             } else {
                 $arrItem['css'] .= 'odd';
             }
             $arrItem['headline'] = deserialize($arrItem['headline']);
             $arrItem['parseDate'] = '<time datetime="' . date('Y-m-d\\TH:i:sP', $arrItem['tstamp']) . '">' . \Date::parse($GLOBALS['objPage']->datimFormat, $arrItem['tstamp']) . '</time>';
             $arrContent[] = (object) $arrItem;
         }
     }
     $objFAQ = $this->Database->prepare("SELECT * FROM tl_faq WHERE tstamp > ? && published = ? ORDER BY tstamp DESC")->execute($this->Member->lastLogin, '1');
     while ($objFAQ->next()) {
         $arrItem = $objFAQ->row();
         foreach ($GLOBALS['TL_HOOKS']['contentLog'] as $callback) {
             $this->import($callback[0]);
             $arrItem = $this->{$callback}[0]->{$callback}[1]('tl_faq', $objFAQ->tstamp, $arrItem);
         }
         if ($mod++ % 2 == 0) {
             $arrItem['css'] .= 'even';
         } else {
             $arrItem['css'] .= 'odd';
         }
         $arrItem['parseDate'] = '<time datetime="' . date('Y-m-d\\TH:i:sP', $arrItem['tstamp']) . '">' . \Date::parse($GLOBALS['objPage']->datimFormat, $arrItem['tstamp']) . '</time>';
         $arrContent[] = (object) $arrItem;
     }
     $arrContent[0]->css .= ' first';
     $arrContent[count($arrContent) - 1]->css .= ' last';
     foreach ($arrContent as $v) {
         $objTemplate = new \FrontendTemplate($this->contentLogTpl);
         $objTemplate->setData((array) $v);
         $html .= $objTemplate->parse();
     }
     if ($this->contentLogTpl == 'cl_list') {
         $html = '<table>' . $html . '</table>';
     }
     $this->Template->html = $html;
 }
 /**
  * Change the map height unit from integer to serialized array for inputUnit widget
  *
  * @since 1.8.0
  */
 protected function changeMapHeight()
 {
     $objModules = \ModuleModel::findAll();
     if (!$objModules) {
         return;
     }
     while ($objModules->next()) {
         if (is_numeric($objModules->anystores_mapheight)) {
             $objModules->anystores_mapheight = serialize(array('unit' => 'px', 'value' => $objModules->anystores_mapheight));
             $objModules->save();
         }
     }
 }
 /**
  * Override for the destroy function
  */
 public function destroy($index = 0)
 {
     $this->children = null;
     $this->getChildren();
     for ($i = 0; $i < count($this->children); $i++) {
         $this->children[$i]->destroy();
     }
     $this->children = null;
     $this->getChildren();
     if (count($this->children) == 0) {
         parent::destroy();
     }
 }