本文整理汇总了PHP中ModuleModel类的典型用法代码示例。如果您正苦于以下问题:PHP ModuleModel类的具体用法?PHP ModuleModel怎么用?PHP ModuleModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ModuleModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setModule
/**
* 设置所属模块
* @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);
}
示例2: __construct
/**
* 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;
}
示例3: init
/**
* @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);
}
示例4: compile
/**
* 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&action=optOut&language=%s&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;
}
示例5: dispInipaystandardAdminModuleList
/**
* @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');
}
示例6: modifyPaletteAndFields
/**
* 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');
}
}
示例7: compile
/**
* 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;
}
示例8: generate
/**
* 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();
}
示例9: loadModalContent
/**
* 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));
}
示例10: getFrontendModuleAjax
/**
* 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;
}
示例11: generate
/**
* 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();
}
示例12: compile
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();
}
示例13: init
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');
}
示例14: init
/**
* @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);
}
示例15: init
/**
* @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);
}