/** * Tries to load an element identified by the pageId, the name of the placeholder and the language. * If no matching element was found, null is returned. * * @param string $strPageId * @param string $strPlaceholder * @param string $strLanguage * @param bool $bitJustActive * * @return class_module_pages_pageelement[] */ public static function getElementsByPlaceholderAndPage($strPageId, $strPlaceholder, $strLanguage, $bitJustActive = true) { $strAnd = ""; $arrParams = array($strPageId, $strLanguage, $strPlaceholder); if ($bitJustActive) { $strAnd = "AND system_status = 1\n AND ( system_date_start IS null OR (system_date_start = 0 OR system_date_start <= ?))\n AND ( system_date_end IS null OR (system_date_end = 0 OR system_date_end >= ? )) "; $arrParams[] = time(); $arrParams[] = time(); } $objORM = new class_orm_objectlist(); $strQuery = "SELECT *\n FROM " . _dbprefix_ . "page_element,\n " . _dbprefix_ . "element,\n " . _dbprefix_ . "system_right,\n " . _dbprefix_ . "system\n LEFT JOIN " . _dbprefix_ . "system_date\n ON (system_id = system_date_id)\n WHERE system_prev_id= ?\n AND page_element_ph_element = element_name\n AND system_id = right_id\n AND system_id = page_element_id\n AND page_element_ph_language = ?\n AND page_element_ph_placeholder = ?\n " . $strAnd . "\n " . $objORM->getDeletedWhereRestriction() . "\n ORDER BY system_sort ASC"; $arrIds = class_carrier::getInstance()->getObjDB()->getPArray($strQuery, $arrParams); class_orm_rowcache::addArrayOfInitRows($arrIds); $arrReturn = array(); foreach ($arrIds as $arrOneRow) { $arrReturn[] = class_objectfactory::getInstance()->getObject($arrOneRow["system_id"]); } return $arrReturn; }
/** * Loads all news from the db assigned to the passed cat * * @param int $intMode 0 = regular, 1 = archive * @param int|string $strCat * @param int $intOrder 0 = descending, 1 = ascending * @param int $intStart * @param int $intEnd * * @return class_module_news_news[] * @static */ public static function loadListNewsPortal($intMode, $strCat = 0, $intOrder = 0, $intStart = null, $intEnd = null) { $arrParams = array(); $longNow = class_date::getCurrentTimestamp(); //Get Timeintervall if ($intMode == "0") { //Regular news $strTime = "AND (system_date_special IS NULL OR (system_date_special > ? OR system_date_special = 0))"; } elseif ($intMode == "1") { //Archivnews $strTime = "AND (system_date_special < ? AND system_date_special IS NOT NULL AND system_date_special != 0)"; } else { $strTime = ""; } $objOrm = new class_orm_objectlist(); $strWhere = $objOrm->getDeletedWhereRestriction(); //check if news should be ordered de- or ascending if ($intOrder == 0) { $strOrder = "DESC"; } else { $strOrder = "ASC"; } if ($strCat != "0") { $strQuery = "SELECT *\n FROM " . _dbprefix_ . "news,\n " . _dbprefix_ . "news_member,\n " . _dbprefix_ . "system_right,\n " . _dbprefix_ . "system\n LEFT JOIN " . _dbprefix_ . "system_date\n ON system_id = system_date_id\n WHERE system_id = news_id\n AND news_id = newsmem_news\n AND system_id = right_id\n AND newsmem_category = ?\n AND system_status = 1\n AND (system_date_start IS NULL or(system_date_start < ? OR system_date_start = 0))\n " . $strTime . $strWhere . "\n AND (system_date_end IS NULL or (system_date_end > ? OR system_date_end = 0))\n ORDER BY system_date_start " . $strOrder . ", system_create_date DESC"; $arrParams[] = $strCat; $arrParams[] = $longNow; if ($strTime != "") { $arrParams[] = $longNow; } $arrParams[] = $longNow; } else { $strQuery = "SELECT *\n FROM " . _dbprefix_ . "news,\n " . _dbprefix_ . "system_right,\n " . _dbprefix_ . "system\n LEFT JOIN " . _dbprefix_ . "system_date\n ON system_id = system_date_id\n WHERE system_id = news_id\n AND system_id = right_id\n AND system_status = 1\n AND (system_date_start IS NULL or(system_date_start < ? OR system_date_start = 0))\n " . $strTime . $strWhere . "\n AND (system_date_end IS NULL or (system_date_end > ? OR system_date_end = 0))\n ORDER BY system_date_start " . $strOrder . ", system_create_date DESC"; $arrParams[] = $longNow; if ($strTime != "") { $arrParams[] = $longNow; } $arrParams[] = $longNow; } $arrIds = class_carrier::getInstance()->getObjDB()->getPArray($strQuery, $arrParams, $intStart, $intEnd); class_orm_rowcache::addArrayOfInitRows($arrIds); $arrReturn = array(); foreach ($arrIds as $arrOneId) { $arrReturn[] = class_objectfactory::getInstance()->getObject($arrOneId["system_id"]); } return $arrReturn; }
/** * Loads all news from the database * if passed, the filter is used to load the news of the given category * * @param string $strFilter * @param int $intAmount * * @return mixed * @static */ public static function getNewsList($strFilter = "", $intAmount = 0) { $objORM = new class_orm_objectlist(); $intNow = class_date::getCurrentTimestamp(); $arrParams = array($intNow, $intNow, $intNow); if ($strFilter != "") { $strQuery = "SELECT *\n\t\t\t\t\t\t\tFROM " . _dbprefix_ . "news,\n\t\t\t\t\t\t\t " . _dbprefix_ . "news_member,\n\t\t\t\t\t\t\t " . _dbprefix_ . "system_right,\n\t\t\t\t\t\t\t " . _dbprefix_ . "system\n\t\t\t\t\t LEFT JOIN " . _dbprefix_ . "system_date\n\t\t\t\t\t ON system_id = system_date_id\n\t\t\t\t\t\t\tWHERE system_id = news_id\n\t\t\t\t\t\t\t AND news_id = newsmem_news\n\t\t\t\t\t\t\t AND system_id = right_id\n\t\t\t\t\t\t\t AND system_status = 1\n\t\t\t\t\t\t\t AND (system_date_special IS NULL OR (system_date_special > ? OR system_date_special = 0))\n\t\t\t\t\t\t\t AND (system_date_start IS NULL or(system_date_start < ? OR system_date_start = 0))\n\t\t\t\t\t\t\t AND (system_date_end IS NULL or (system_date_end > ? OR system_date_end = 0))\n\t\t\t\t\t\t\t AND newsmem_category = ?\n\t\t\t\t\t\t\t " . $objORM->getDeletedWhereRestriction() . "\n\t\t\t\t\t\t\tORDER BY system_date_start DESC"; $arrParams[] = $strFilter; } else { $strQuery = "SELECT *\n\t\t\t\t\t\t\tFROM " . _dbprefix_ . "news,\n\t\t\t\t\t\t\t " . _dbprefix_ . "system_right,\n\t\t\t\t\t\t\t " . _dbprefix_ . "system\n\t\t\t\t\t\tLEFT JOIN " . _dbprefix_ . "system_date\n\t\t\t\t\t ON system_id = system_date_id\n\t\t\t\t\t\t\tWHERE system_id = news_id\n\t\t\t\t\t\t\t AND system_status = 1\n\t\t\t\t\t\t\t AND system_id = right_id\n\t\t\t\t\t\t\t AND (system_date_special IS NULL OR (system_date_special > ? OR system_date_special = 0))\n\t\t\t\t\t\t\t AND (system_date_start IS NULL or(system_date_start < ? OR system_date_start = 0))\n\t\t\t\t\t\t\t AND (system_date_end IS NULL or (system_date_end > ? OR system_date_end = 0))\n\t\t\t\t\t\t\t " . $objORM->getDeletedWhereRestriction() . "\n\t\t\t\t\t\t\tORDER BY system_date_start DESC"; } $intStart = null; $intEnd = null; if ($intAmount > 0) { $intStart = 0; $intEnd = $intAmount - 1; } $arrIds = class_carrier::getInstance()->getObjDB()->getPArray($strQuery, $arrParams, $intStart, $intEnd); class_orm_rowcache::addArrayOfInitRows($arrIds); $arrReturn = array(); foreach ($arrIds as $arrOneId) { $arrReturn[] = class_objectfactory::getInstance()->getObject($arrOneId["system_id"]); } return $arrReturn; }
/** * Initialises the internal modules-cache. * Loads all module-data into a single array. * Avoids multiple queries against the module-table. * * @param bool $bitCache * * @return array * @static */ private static function loadModuleData($bitCache = true) { if ((count(self::$arrModuleData) == 0 || !$bitCache) && count(class_carrier::getInstance()->getObjDB()->getTables()) > 0) { $strQuery = "SELECT *\n FROM " . _dbprefix_ . "system_right,\n " . _dbprefix_ . "system_module,\n " . _dbprefix_ . "system\n LEFT JOIN " . _dbprefix_ . "system_date\n ON system_id = system_date_id\n WHERE system_id = right_id\n AND system_id = module_id\n ORDER BY system_sort ASC, system_comment ASC "; $arrRows = class_carrier::getInstance()->getObjDB()->getPArray($strQuery, array(), null, null, $bitCache); class_orm_rowcache::addArrayOfInitRows($arrRows); self::$arrModuleData = $arrRows; } return self::$arrModuleData; }