function getLatestPlacholder() { $this->strPlaceholder = null; $intLimitEnd = intval($this->arrSettings['settingsLatestNumOverview']); $objEntries = new MediaDirectoryEntry($this->moduleName); $objEntries->getEntries(null, null, null, null, true, null, 1, null, $intLimitEnd); foreach ($objEntries->arrEntries as $intEntryId => $arrEntry) { if ($objEntries->checkPageCmd('detail' . intval($arrEntry['entryFormId']))) { $strDetailCmd = 'detail' . intval($arrEntry['entryFormId']); } else { $strDetailCmd = 'detail'; } $strDetailUrl = 'index.php?section=' . $this->moduleName . '&cmd=' . $strDetailCmd . '&eid=' . $arrEntry['entryId']; $this->strPlaceholder .= '<li><a href="' . $strDetailUrl . '">' . $arrEntry['entryFields'][0] . '</a></li>'; } return '<ul id="' . $this->moduleNameLC . 'LatestPlacholder">' . $this->strPlaceholder . '</ul>'; }
function getHeadlines($arrExistingBlocks) { global $_ARRAYLANG, $_CORELANG, $objTemplate; $objEntry = new MediaDirectoryEntry($this->moduleName); $objEntry->getEntries(null, null, null, null, null, null, true, null, $this->arrSettings['settingsLatestNumHeadlines']); $i = 0; $r = 0; $numBlocks = count($arrExistingBlocks); if (!empty($objEntry->arrEntries)) { foreach ($objEntry->arrEntries as $key => $arrEntry) { if ($objEntry->checkPageCmd('detail' . intval($arrEntry['entryFormId']))) { $strDetailCmd = 'detail' . intval($arrEntry['entryFormId']); } else { $strDetailCmd = 'detail'; } $objTemplate->setVariable(array($this->moduleLangVar . '_LATEST_ROW_CLASS' => $r % 2 == 0 ? 'row1' : 'row2', $this->moduleLangVar . '_LATEST_ENTRY_ID' => $arrEntry['entryId'], $this->moduleLangVar . '_LATEST_ENTRY_VALIDATE_DATE' => date("H:i:s - d.m.Y", $arrEntry['entryValdateDate']), $this->moduleLangVar . '_LATEST_ENTRY_CREATE_DATE' => date("H:i:s - d.m.Y", $arrEntry['entryCreateDate']), $this->moduleLangVar . '_LATEST_ENTRY_HITS' => $arrEntry['entryHits'], $this->moduleLangVar . '_ENTRY_DETAIL_URL' => 'index.php?section=' . $this->moduleName . '&cmd=' . $strDetailCmd . '&eid=' . $arrEntry['entryId'], 'TXT_' . $this->moduleLangVar . '_ENTRY_DETAIL' => $_CORELANG['TXT_MEDIADIR_DETAIL'])); foreach ($arrEntry['entryFields'] as $key => $strFieldValue) { $intPos = $key + 1; $objTemplate->setVariable(array($this->moduleLangVar . '_LATEST_ENTRY_FIELD_' . $intPos . '_POS' => $strFieldValue)); } $blockId = $arrExistingBlocks[$i]; $objTemplate->parse($this->moduleNameLC . 'Latest_row_' . $blockId); if ($i < $numBlocks - 1) { ++$i; } else { $i = 0; } } } }
function parsePlaceholders() { global $objDatabase, $_LANGID, $_CONFIG; if ($this->objUser != false) { $strUserNick = $this->objUser->getUsername(); $strUserFirstname = $this->objUser->getProfileAttribute('firstname'); $strUserLastname = $this->objUser->getProfileAttribute('lastname'); } $objRSEntryFormId = $objDatabase->Execute("SELECT form_id FROM\n " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_entries\n WHERE\n id='" . $this->intEntryId . "'\n LIMIT 1"); if ($objRSEntryFormId !== false) { $intEntryFormId = intval($objRSEntryFormId->fields['form_id']); } $strRelQuery = "SELECT inputfield.`id` AS `id` FROM " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_inputfields AS inputfield WHERE (inputfield.`type` != 16 AND inputfield.`type` != 17) AND (inputfield.`form` = " . $intEntryFormId . ") ORDER BY inputfield.`order` ASC LIMIT 1"; $objRSEntryTitle = $objDatabase->Execute("SELECT\n rel_inputfield.`value` AS `value`\n FROM\n " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_entries AS entry,\n " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_rel_entry_inputfields AS rel_inputfield\n WHERE (rel_inputfield.`entry_id`='" . $this->intEntryId . "')\n AND (rel_inputfield.`field_id` = (" . $strRelQuery . ")) \n AND (rel_inputfield.`lang_id` = '" . $_LANGID . "')\n AND (rel_inputfield.`value` != '')\n GROUP BY value\n "); if ($objRSEntryTitle !== false) { $strEntryTitle = $objRSEntryTitle->fields['value']; } $objEntry = new MediaDirectoryEntry($this->moduleName); if ($objEntry->checkPageCmd('detail' . intval($intEntryFormId))) { $strDetailCmd = 'detail' . intval($intEntryFormId); } else { $strDetailCmd = 'detail'; } $strProtocol = ASCMS_PROTOCOL; $strDomain = $_CONFIG['domainUrl'] . \Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteOffsetPath(); $strDate = date(ASCMS_DATE_FORMAT); $strEntryLink = urldecode($strProtocol . "://" . $strDomain . '/index.php?section=' . $this->moduleName . '&cmd=' . $strDetailCmd . '&eid=' . $this->intEntryId); $arrPlaceholder = array('[[USERNAME]]', '[[FIRSTNAME]]', '[[LASTNAME]]', '[[TITLE]]', '[[LINK]]', '[[URL]]', '[[DATE]]'); $arrReplaceContent = array($strUserNick, $strUserFirstname, $strUserLastname, $strEntryTitle, $strEntryLink, $strDomain, $strDate); for ($x = 0; $x < 7; $x++) { $this->strTitle = str_replace($arrPlaceholder[$x], $arrReplaceContent[$x], $this->strTitle); } for ($x = 0; $x < 7; $x++) { $this->strTemplate = str_replace($arrPlaceholder[$x], $arrReplaceContent[$x], $this->strTemplate); } }