Revision 2014
Added by darkviper almost 11 years ago
WbLinkAbstract.php | ||
---|---|---|
45 | 45 |
} |
46 | 46 |
|
47 | 47 |
abstract public function makeLinkFromTag(array $aReplacement); |
48 |
// abstract public function generateLinkList(Template $oTpl);
|
|
48 |
abstract public function &generateOptionsList();
|
|
49 | 49 |
|
50 |
/** |
|
51 |
* |
|
52 |
* @param string $sAddonName |
|
53 |
* @param string $sAddonTableName |
|
54 |
* @param string $sPageIdName |
|
55 |
* @param string $sSectionIdName |
|
56 |
* @param string $sItemIdName |
|
57 |
* @param string $sDateTimeName |
|
58 |
* @param string $sTitleName |
|
59 |
* @param string $sActivatedName |
|
60 |
* @return array by reference |
|
61 |
*/ |
|
62 |
final protected function &_executeListGeneration( |
|
63 |
$sAddonName = 'news', |
|
64 |
$sAddonTableName = 'mod_news_posts', |
|
65 |
$sPageIdName = 'page_id', |
|
66 |
$sSectionIdName = 'section_id', |
|
67 |
$sItemIdName = 'post_id', |
|
68 |
$sDateTimeName = 'created_when', |
|
69 |
$sTitleName = 'title', |
|
70 |
$sActivatedName = 'active' |
|
71 |
) |
|
72 |
{ |
|
73 |
$aAddonItems = array(); |
|
74 |
//generate news lists |
|
75 |
$sql = 'SELECT `p`.`'.$sItemIdName.'` `ItemId`, `p`.`'.$sPageIdName.'` `PageId`, ' |
|
76 |
. '`s`.`section_id` `SectionId`, `p`.`'.$sTitleName.'` `Title` ' |
|
77 |
. 'FROM `'.$this->oDb->TablePrefix.'sections` `s` ' |
|
78 |
. 'LEFT JOIN `'.$this->oDb->TablePrefix.$sAddonTableName.'` `p` ON `s`.`section_id`= `p`.`'.$sSectionIdName.'` ' |
|
79 |
. 'WHERE `p`.`'.$sActivatedName.'`>0 AND `s`.`module`=\''.$sAddonName.'\' ' |
|
80 |
. 'ORDER BY `s`.`page_id`, `s`.`section_id`, `p`.`'.$sDateTimeName.'` DESC'; |
|
81 |
if (( $oRes = $this->oDb->doQuery($sql))) { |
|
82 |
$iCurrentPage = 0; |
|
83 |
$iCurrentSection = 0; |
|
84 |
$iSectionCounter = 0; |
|
85 |
while ($aItem = $oRes->fetchRow(MYSQL_ASSOC)) { |
|
86 |
if ($iCurrentPage != $aItem['PageId']) { |
|
87 |
$iCurrentPage = $aItem['PageId']; |
|
88 |
$aAddonItems[$iCurrentPage.'P'] = array(); |
|
89 |
} |
|
90 |
if ($iCurrentSection != $aItem['SectionId']) { |
|
91 |
$iCurrentSection = $aItem['SectionId']; |
|
92 |
$aAddonItems[$iCurrentPage.'P'][] = array(); |
|
93 |
$iSectionCounter = sizeof($aAddonItems[$iCurrentPage.'P'])-1; |
|
94 |
} |
|
95 |
$aAddonItems[$iCurrentPage.'P'][$iSectionCounter][] = array( |
|
96 |
'wblink' => '[wblink'.$aItem['PageId'].'?addon='.$sAddonName.'&item='.$aItem['ItemId'].']', |
|
97 |
'title' => preg_replace("/\r?\n/", "\\n", $this->oDb->escapeString($aItem['Title'])) |
|
98 |
); |
|
99 |
} |
|
100 |
} |
|
101 |
return $aAddonItems; |
|
102 |
} |
|
50 | 103 |
|
104 |
|
|
51 | 105 |
} // end of class WbLinkAbstract |
Also available in: Unified diff
+ added new Interface usable to connect from WYSIWYG-Editor to all Modules with subitems like news or topics