Initialer Commit in GIT

This commit is contained in:
2014-10-01 07:19:14 +02:00
parent f3ccccc47e
commit dd1558b954
113 changed files with 14242 additions and 0 deletions

116
dca/tl_article.php Normal file
View File

@ -0,0 +1,116 @@
<?php
/**
* Contao Open Source CMS
* Copyright (C) 2005-2010 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright cgo IT, 2013
* @author Carsten Götzinger (info@cgo-it.de)
* @package rateit
* @license GNU/LGPL
* @filesource
*/
/**
* Extend tl_article
*/
$GLOBALS['TL_DCA']['tl_article']['config']['onsubmit_callback'][] = array('tl_article_rating','insert');
$GLOBALS['TL_DCA']['tl_article']['config']['ondelete_callback'][] = array('tl_article_rating','delete');
/**
* Palettes
*/
$GLOBALS['TL_DCA']['tl_article']['palettes']['__selector__'][] = 'addRating';
$GLOBALS['TL_DCA']['tl_article']['palettes']['default'] = $GLOBALS['TL_DCA']['tl_article']['palettes']['default'].';{rateit_legend:hide},addRating';
/**
* Add subpalettes to tl_article
*/
$GLOBALS['TL_DCA']['tl_article']['subpalettes']['addRating'] = 'rateit_position,rateit_template';
// Fields
$GLOBALS['TL_DCA']['tl_article']['fields']['addRating'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_article']['addRating'],
'exclude' => true,
'inputType' => 'checkbox',
'sql' => "char(1) NOT NULL default ''",
'eval' => array('tl_class'=>'w50 m12', 'submitOnChange'=>true)
);
$GLOBALS['TL_DCA']['tl_article']['fields']['rateit_position'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_article']['rateit_position'],
'default' => 'before',
'exclude' => true,
'inputType' => 'select',
'options' => array('after', 'before'),
'reference' => &$GLOBALS['TL_LANG']['tl_article'],
'sql' => "varchar(6) NOT NULL default ''",
'eval' => array('mandatory'=>true, 'tl_class'=>'w50')
);
$GLOBALS['TL_DCA']['tl_article']['fields']['rateit_template'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_article']['rateit_template'],
'default' => 'rateit_default',
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('tl_article_rating', 'getRateItArticleTemplates'),
'sql' => "varchar(255) NOT NULL default ''",
'eval' => array('mandatory'=>true, 'tl_class'=>'w50')
);
class tl_article_rating extends rateit\DcaHelper {
/**
* Constructor
*/
public function __construct() {
parent::__construct();
}
/**
* Return all navigation templates as array
* @param DataContainer
* @return array
*/
public function getRateItArticleTemplates(\DataContainer $dc) {
$intPid = $dc->activeRecord->pid;
if ($this->Input->get('act') == 'overrideAll')
{
$intPid = $this->Input->get('id');
}
return $this->getTemplateGroup('article_rateit_', $intPid);
}
public function insert(\DC_Table $dc) {
return $this->insertOrUpdateRatingKey($dc, 'article', $dc->activeRecord->title);
}
public function delete(\DC_Table $dc)
{
return $this->deleteRatingKey($dc, 'article');
}
}
?>

212
dca/tl_content.php Normal file
View File

@ -0,0 +1,212 @@
<?php
/**
* Contao Open Source CMS
* Copyright (C) 2005-2011 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright cgo IT, 2013
* @author Carsten Götzinger (info@cgo-it.de)
* @package rateit
* @license GNU/LGPL
* @filesource
*/
$GLOBALS['TL_DCA']['tl_content']['config']['onsubmit_callback'][] = array('tl_content_rateit','insert');
$GLOBALS['TL_DCA']['tl_content']['config']['ondelete_callback'][] = array('tl_content_rateit','delete');
/**
* palettes
*/
$GLOBALS['TL_DCA']['tl_content']['palettes']['rateit'] = '{type_legend},type,rateit_title;{rateit_legend},rateit_active;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space';
$GLOBALS['TL_DCA']['tl_content']['palettes']['gallery'] = $GLOBALS['TL_DCA']['tl_content']['palettes']['gallery'].';{rateit_legend},rateit_active';
/**
* fields
*/
$GLOBALS['TL_DCA']['tl_content']['fields']['rateit_title'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_content']['rateit_title'],
'default' => '',
'exclude' => true,
'inputType' => 'text',
'sql' => "varchar(255) NOT NULL default ''",
'eval' => array('mandatory'=>true, 'maxlength'=>255)
);
$GLOBALS['TL_DCA']['tl_content']['fields']['rateit_active'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_content']['rateit_active'],
'exclude' => true,
'inputType' => 'checkbox',
'sql' => "char(1) NOT NULL default ''",
'eval' => array('tl_class'=>'w50')
);
/**
* Class tl_content_rateit
*/
class tl_content_rateit extends rateit\DcaHelper {
/**
* Constructor
*/
public function __construct() {
parent::__construct();
}
public function insert(\DC_Table $dc) {
if ($dc->activeRecord->type == "gallery") {
$type = 'galpic';
if (version_compare(VERSION, '3.2', '>=')) {
$objFiles = \FilesModel::findMultipleByUuids(deserialize($dc->activeRecord->multiSRC));
} else {
$objFiles = \FilesModel::findMultipleByIds(deserialize($dc->activeRecord->multiSRC));
}
if ($objFiles !== null) {
// Get all images
while ($objFiles->next()) {
// Single files
if ($objFiles->type == 'file') {
$objFile = new \File($objFiles->path, true);
if (!$objFile->isGdImage) {
continue;
}
$this->insertOrUpdateRatingItemGallery($dc, $type, $objFile->name, $objFile->id, ($dc->activeRecord->rateit_active ? '1' : ''));
}
// Folders
else {
if (version_compare(VERSION, '3.2', '>=')) {
$objSubfiles = \FilesModel::findByPid($objFiles->uuid);
} else {
$objSubfiles = \FilesModel::findByPid($objFiles->id);
}
if ($objSubfiles === null) {
continue;
}
while ($objSubfiles->next()) {
// Skip subfolders
if ($objSubfiles->type == 'folder') {
continue;
}
$objFile = new \File($objSubfiles->path, true);
if (!$objFile->isGdImage) {
continue;
}
$this->insertOrUpdateRatingItemGallery($dc, $type, $objSubfiles->name, $objSubfiles->id, ($dc->activeRecord->rateit_active ? '1' : ''));
}
}
}
}
return true;
} else {
return $this->insertOrUpdateRatingKey($dc, 'ce', $dc->activeRecord->rateit_title);
}
}
public function delete(\DC_Table $dc) {
if ($dc->activeRecord->type == "gallery") {
$objFiles = \FilesModel::findMultipleByUuids(deserialize($dc->activeRecord->multiSRC));
// Get all images
while ($objFiles->next()) {
// Single files
if ($objFiles->type == 'file') {
$objFile = new \File($objFiles->path, true);
if (!$objFile->isGdImage) {
continue;
}
$rkey = $dc->activeRecord->id.'_'.$objFile->id;
$this->Database->prepare("DELETE FROM tl_rateit_items WHERE rkey=? and typ=?")
->execute($rkey, 'galpic');
}
// Folders
else {
$objSubfiles = \FilesModel::findByPid($objFiles->uuid);
if ($objSubfiles === null) {
continue;
}
while ($objSubfiles->next()) {
// Skip subfolders
if ($objSubfiles->type == 'folder') {
continue;
}
$objFile = new \File($objSubfiles->path, true);
if (!$objFile->isGdImage) {
continue;
}
$rkey = $dc->activeRecord->id.'_'.$objFile->id;
$this->Database->prepare("DELETE FROM tl_rateit_items WHERE rkey=? and typ=?")
->execute($rkey, 'galpic');
}
}
}
return true;
} else {
return $this->deleteRatingKey($dc, 'ce');
}
}
private function insertOrUpdateRatingItemGallery(\DC_Table &$dc, $type, $strName, $imgId, $active) {
$rkey = $dc->activeRecord->id.'|'.$imgId;
$headline = deserialize($dc->activeRecord->headline);
$title = $dc->activeRecord->id;
if (is_array($headline) && array_key_exists('value', $headline) && strlen($headline['value']) > 0) {
$title = $headline['value'];
}
$ratingTitle = $title.' - '.$strName;
$actRecord = $this->Database->prepare("SELECT * FROM tl_rateit_items WHERE rkey=? and typ=?")
->execute($rkey, $type)
->fetchAssoc();
if (!is_array($actRecord)) {
$arrSet = array('rkey' => $rkey,
'tstamp' => time(),
'typ' => $type,
'createdat' => time(),
'title'=> $ratingTitle,
'active' => $active
);
$insertRecord = $this->Database->prepare("INSERT INTO tl_rateit_items %s")
->set($arrSet)
->execute()
->insertId;
} else {
$this->Database->prepare("UPDATE tl_rateit_items SET active=?, title=? WHERE rkey=? and typ=?")
->execute($active, $ratingTitle, $rkey, $type)
->updatedId;
}
}
}
?>

89
dca/tl_faq.php Normal file
View File

@ -0,0 +1,89 @@
<?php
/**
* Contao Open Source CMS
* Copyright (C) 2005-2010 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright cgo IT, 2013
* @author Carsten Götzinger (info@cgo-it.de)
* @package rateit
* @license GNU/LGPL
* @filesource
*/
/**
* Extend tl_article
*/
$GLOBALS['TL_DCA']['tl_faq']['config']['onsubmit_callback'][] = array('tl_faq_rating','insert');
$GLOBALS['TL_DCA']['tl_faq']['config']['ondelete_callback'][] = array('tl_faq_rating','delete');
/**
* Palettes
*/
$GLOBALS['TL_DCA']['tl_faq']['palettes']['__selector__'][] = 'addRating';
$GLOBALS['TL_DCA']['tl_faq']['palettes']['default'] = $GLOBALS['TL_DCA']['tl_faq']['palettes']['default'].';{rating_legend:hide},addRating';
/**
* Add subpalettes to tl_article
*/
$GLOBALS['TL_DCA']['tl_faq']['subpalettes']['addRating'] = 'rateit_position';
// Fields
$GLOBALS['TL_DCA']['tl_faq']['fields']['addRating'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_faq']['addRating'],
'exclude' => true,
'inputType' => 'checkbox',
'sql' => "char(1) NOT NULL default ''",
'eval' => array('tl_class'=>'w50 m12', 'submitOnChange'=>true)
);
$GLOBALS['TL_DCA']['tl_faq']['fields']['rateit_position'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_faq']['rateit_position'],
'default' => 'before',
'exclude' => true,
'inputType' => 'select',
'options' => array('after', 'before'),
'reference' => &$GLOBALS['TL_LANG']['tl_faq'],
'sql' => "varchar(6) NOT NULL default ''",
'eval' => array('mandatory'=>true, 'tl_class'=>'w50')
);
class tl_faq_rating extends rateit\DcaHelper {
/**
* Constructor
*/
public function __construct() {
parent::__construct();
}
public function insert(\DC_Table $dc) {
return $this->insertOrUpdateRatingKey($dc, 'faq', $dc->activeRecord->question);
}
public function delete(\DC_Table $dc)
{
return $this->deleteRatingKey($dc, 'faq');
}
}
?>

140
dca/tl_module.php Normal file
View File

@ -0,0 +1,140 @@
<?php
/**
* Contao Open Source CMS
* Copyright (C) 2005-2011 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright cgo IT, 2013
* @author Carsten Götzinger (info@cgo-it.de)
* @package rateit
* @license GNU/LGPL
* @filesource
*/
$GLOBALS['TL_DCA']['tl_module']['config']['onsubmit_callback'][] = array('tl_module_rateit','insert');
$GLOBALS['TL_DCA']['tl_module']['config']['ondelete_callback'][] = array('tl_module_rateit','delete');
/**
* palettes
*/
$GLOBALS['TL_DCA']['tl_module']['palettes']['rateit'] = '{title_legend},name,rateit_title,type;{rateit_legend},rateit_active;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space';
$GLOBALS['TL_DCA']['tl_module']['palettes']['rateit_top_ratings'] = '{title_legend},name,headline,type;{rateit_legend},rateit_types,rateit_toptype,rateit_count,rateit_template;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space';
$GLOBALS['TL_DCA']['tl_module']['palettes']['articleList'] = $GLOBALS['TL_DCA']['tl_module']['palettes']['articleList'].';{rateit_legend},rateit_active';
/**
* fields
*/
$GLOBALS['TL_DCA']['tl_module']['fields']['rateit_title'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_module']['rateit_title'],
'default' => '',
'exclude' => true,
'inputType' => 'text',
'sql' => "varchar(255) NOT NULL default ''",
'eval' => array('mandatory'=>true, 'maxlength'=>255, 'tl_class'=>'w50')
);
$GLOBALS['TL_DCA']['tl_module']['fields']['rateit_active'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_module']['rateit_active'],
'exclude' => true,
'inputType' => 'checkbox',
'sql' => "char(1) NOT NULL default ''",
'eval' => array('tl_class'=>'w50 m12')
);
$GLOBALS['TL_DCA']['tl_module']['fields']['rateit_types'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_module']['rateit_types'],
'exclude' => true,
'inputType' => 'checkboxWizard',
'options' => array('page', 'article', 'ce', 'module', 'news', 'faq', 'galpic'),
'eval' => array('multiple'=>true, 'mandatory'=>true),
'reference' => &$GLOBALS['TL_LANG']['tl_module']['rateit_types'],
'sql' => "varchar(255) NOT NULL default ''"
);
$GLOBALS['TL_DCA']['tl_module']['fields']['rateit_toptype'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_module']['rateit_toptype'],
'exclude' => true,
'default' => 'best',
'inputType' => 'select',
'options' => array('best', 'most'),
'eval' => array('mandatory'=>true, 'tl_class'=>'w50'),
'reference' => &$GLOBALS['TL_LANG']['tl_module']['rateit_toptype'],
'sql' => "varchar(10) NOT NULL default ''"
);
$GLOBALS['TL_DCA']['tl_module']['fields']['rateit_count'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_module']['rateit_count'],
'default' => '10',
'exclude' => true,
'inputType' => 'text',
'eval' => array('mandatory'=>true, 'maxlength'=>3, 'rgxp'=>'digit', 'tl_class'=>'w50'),
'sql' => "varchar(3) NOT NULL default ''"
);
$GLOBALS['TL_DCA']['tl_module']['fields']['rateit_template'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_module']['rateit_template'],
'default' => 'mod_rateit_top_ratings',
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('tl_module_rateit', 'getRateItTopModuleTemplates'),
'eval' => array('mandatory'=>true, 'tl_class'=>'w50'),
'sql' => "varchar(255) NOT NULL default ''"
);
/**
* Class tl_module_rateit
*/
class tl_module_rateit extends rateit\DcaHelper {
/**
* Constructor
*/
public function __construct() {
parent::__construct();
}
public function insert(\DC_Table $dc) {
return $this->insertOrUpdateRatingKey($dc, 'module', $dc->activeRecord->rateit_title);
}
public function delete(\DC_Table $dc)
{
return $this->deleteRatingKey($dc, 'module');
}
public function getRateItTopModuleTemplates(\DataContainer $dc)
{
$intPid = $dc->activeRecord->pid;
if ($this->Input->get('act') == 'overrideAll')
{
$intPid = $this->Input->get('id');
}
return $this->getTemplateGroup('mod_rateit_top', $intPid);
}
}
?>

89
dca/tl_news.php Normal file
View File

@ -0,0 +1,89 @@
<?php
/**
* Contao Open Source CMS
* Copyright (C) 2005-2010 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright cgo IT, 2013
* @author Carsten Götzinger (info@cgo-it.de)
* @package rateit
* @license GNU/LGPL
* @filesource
*/
/**
* Extend tl_article
*/
$GLOBALS['TL_DCA']['tl_news']['config']['onsubmit_callback'][] = array('tl_news_rating','insert');
$GLOBALS['TL_DCA']['tl_news']['config']['ondelete_callback'][] = array('tl_news_rating','delete');
/**
* Palettes
*/
$GLOBALS['TL_DCA']['tl_news']['palettes']['__selector__'][] = 'addRating';
$GLOBALS['TL_DCA']['tl_news']['palettes']['default'] = $GLOBALS['TL_DCA']['tl_news']['palettes']['default'].';{rating_legend:hide},addRating';
/**
* Add subpalettes to tl_article
*/
$GLOBALS['TL_DCA']['tl_news']['subpalettes']['addRating'] = 'rateit_position';
// Fields
$GLOBALS['TL_DCA']['tl_news']['fields']['addRating'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_news']['addRating'],
'exclude' => true,
'inputType' => 'checkbox',
'sql' => "char(1) NOT NULL default ''",
'eval' => array('tl_class'=>'w50 m12', 'submitOnChange'=>true)
);
$GLOBALS['TL_DCA']['tl_news']['fields']['rateit_position'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_news']['rateit_position'],
'default' => 'before',
'exclude' => true,
'inputType' => 'select',
'options' => array('after', 'before'),
'reference' => &$GLOBALS['TL_LANG']['tl_news'],
'sql' => "varchar(6) NOT NULL default ''",
'eval' => array('mandatory'=>true, 'tl_class'=>'w50')
);
class tl_news_rating extends rateit\DcaHelper {
/**
* Constructor
*/
public function __construct() {
parent::__construct();
}
public function insert(\DC_Table $dc) {
return $this->insertOrUpdateRatingKey($dc, 'news', $dc->activeRecord->headline);
}
public function delete(\DC_Table $dc)
{
return $this->deleteRatingKey($dc, 'news');
}
}
?>

82
dca/tl_page.php Normal file
View File

@ -0,0 +1,82 @@
<?php
/**
* Contao Open Source CMS
* Copyright (C) 2005-2010 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright cgo IT, 2013
* @author Carsten Götzinger (info@cgo-it.de)
* @package rateit
* @license GNU/LGPL
* @filesource
*/
/**
* Extend tl_page
*/
$GLOBALS['TL_DCA']['tl_page']['config']['onsubmit_callback'][] = array('tl_page_rateit','insert');
$GLOBALS['TL_DCA']['tl_page']['config']['ondelete_callback'][] = array('tl_page_rateit','delete');
/**
* Palettes
*/
foreach ($GLOBALS['TL_DCA']['tl_page']['palettes'] as $keyPalette => $valuePalette)
{
// Skip if we have a array or the palettes for subselections
if (is_array($valuePalette) || $keyPalette == "__selector__" || $keyPalette == "root" || $keyPalette == "forward" || $keyPalette == "redirect")
{
continue;
}
$valuePalette .= ';{rateit_legend:hide},addRating';
// Write new entry back in the palette
$GLOBALS['TL_DCA']['tl_page']['palettes'][$keyPalette] = $valuePalette;
}
// Fields
$GLOBALS['TL_DCA']['tl_page']['fields']['addRating'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_page']['addRating'],
'exclude' => true,
'inputType' => 'checkbox',
'sql' => "char(1) NOT NULL default ''",
);
class tl_page_rateit extends rateit\DcaHelper {
/**
* Constructor
*/
public function __construct() {
parent::__construct();
}
public function insert(\DC_Table $dc) {
return $this->insertOrUpdateRatingKey($dc, 'page', $dc->activeRecord->title);
}
public function delete(\DC_Table $dc)
{
return $this->deleteRatingKey($dc, 'page');
}
}
?>

69
dca/tl_rateit_items.php Normal file
View File

@ -0,0 +1,69 @@
<?php
/**
* Contao Open Source CMS
* Copyright (C) 2005-2010 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright cgo IT, 2014
* @author Carsten Götzinger (info@cgo-it.de)
* @package rateit
* @license GNU/LGPL
* @filesource
*/
/**
* Table tl_rateit_items
*/
$GLOBALS['TL_DCA']['tl_rateit_items'] = array (
'config' => array (
'dataContainer' => 'Table',
'ctable' => array('tl_rateit_ratings'),
'switchToEdit' => false,
'sql' => array (
'keys' => array (
'id' => 'primary'
)
)
),
'fields' => array (
'id' => array (
'sql' => "int(10) unsigned NOT NULL auto_increment"
),
'tstamp' => array (
'sql' => "int(10) unsigned NOT NULL default '0'"
),
'title' => array (
'sql' => "varchar(513) NOT NULL default ''"
),
'rkey' => array (
'sql' => "varchar(32) NOT NULL default ''"
),
'typ' => array (
'sql' => "varchar(32) NOT NULL default ''"
),
'createdat' => array (
'sql' => "int(10) NOT NULL default '0'"
),
'active' => array (
'sql' => "char(1) NOT NULL default ''"
)
)
);

72
dca/tl_rateit_ratings.php Normal file
View File

@ -0,0 +1,72 @@
<?php
/**
* Contao Open Source CMS
* Copyright (C) 2005-2010 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright cgo IT, 2014
* @author Carsten Götzinger (info@cgo-it.de)
* @package rateit
* @license GNU/LGPL
* @filesource
*/
/**
* Table tl_rateit_items
*/
$GLOBALS['TL_DCA']['tl_rateit_ratings'] = array (
'config' => array (
'dataContainer' => 'Table',
'ptable' => 'tl_rateit_items',
'switchToEdit' => false,
'sql' => array (
'keys' => array (
'id' => 'primary',
'pid' => 'index',
)
)
),
'fields' => array (
'id' => array (
'sql' => "int(10) unsigned NOT NULL auto_increment"
),
'tstamp' => array (
'sql' => "int(10) unsigned NOT NULL default '0'"
),
'pid' => array (
'foreignKey' => 'tl_rateit_items.id',
'sql' => "int(10) unsigned NOT NULL default '0'",
'relation' => array('type'=>'belongsTo', 'load'=>'lazy')
),
'ip_address' => array (
'sql' => "varchar(50) NULL"
),
'memberid' => array (
'sql' => "int(10) unsigned NULL"
),
'rating' => array (
'sql' => "int(10) unsigned NOT NULL default '0'"
),
'createdat' => array (
'sql' => "int(10) NOT NULL default '0'"
)
)
);

133
dca/tl_settings.php Normal file
View File

@ -0,0 +1,133 @@
<?php
/**
* Contao Open Source CMS
* Copyright (C) 2005-2011 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright cgo IT, 2012-2013
* @author Carsten Götzinger (info@cgo-it.de)
* @package aeo
* @license GNU/LGPL
* @filesource
*/
/**
* palettes
*/
$GLOBALS['TL_DCA']['tl_settings']['palettes']['default'] .= ';{rateit_legend:hide},rating_type,rating_count,rating_textposition,rating_listsize,rating_allow_duplicate_ratings,rating_allow_duplicate_ratings_for_members,rating_template,rating_description';
/**
* fields
*/
$GLOBALS['TL_DCA']['tl_settings']['fields']['rating_type'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_settings']['rating_type'],
'default' => 'hearts',
'exclude' => true,
'inputType' => 'select',
'options' => array('hearts', 'stars'),
'reference' => &$GLOBALS['TL_LANG']['tl_settings'],
'eval' => array('mandatory'=>true, 'tl_class'=>'w50')
);
$GLOBALS['TL_DCA']['tl_settings']['fields']['rating_count'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_settings']['rating_count'],
'default' => '5',
'exclude' => true,
'inputType' => 'select',
'options' => array('1', '5', '10'),
'reference' => &$GLOBALS['TL_LANG']['tl_settings'],
'eval' => array('mandatory'=>true, 'tl_class'=>'w50')
);
$GLOBALS['TL_DCA']['tl_settings']['fields']['rating_textposition'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_settings']['rating_textposition'],
'default' => 'after',
'exclude' => true,
'inputType' => 'select',
'options' => array('after', 'before'),
'reference' => &$GLOBALS['TL_LANG']['tl_settings'],
'eval' => array('mandatory'=>true, 'tl_class'=>'w50')
);
$GLOBALS['TL_DCA']['tl_settings']['fields']['rating_listsize'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_settings']['rating_listsize'],
'exclude' => true,
'default' => 10,
'inputType' => 'text',
'eval' => array('mandatory'=>false, 'maxlength'=>4, 'tl_class'=>'w50')
);
$GLOBALS['TL_DCA']['tl_settings']['fields']['rating_allow_duplicate_ratings'] = array
(
'exclude' => true,
'label' => &$GLOBALS['TL_LANG']['tl_settings']['allow_duplicate_ratings'],
'inputType' => 'checkbox',
'eval' => array('tl_class'=>'w50 m12')
);
$GLOBALS['TL_DCA']['tl_settings']['fields']['rating_allow_duplicate_ratings_for_members'] = array
(
'exclude' => true,
'label' => &$GLOBALS['TL_LANG']['tl_settings']['allow_duplicate_ratings_for_members'],
'inputType' => 'checkbox',
'eval' => array('tl_class'=>'w50 m12')
);
$GLOBALS['TL_DCA']['tl_settings']['fields']['rating_template'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_settings']['rating_template'],
'default' => 'rateit_default',
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('tl_settings_rateit', 'getRateItTemplates'),
'eval' => array('mandatory'=>true, 'tl_class'=>'w50')
);
$GLOBALS['TL_DCA']['tl_settings']['fields']['rating_description'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_settings']['rating_description'],
'exclude' => true,
'default' => '%current%/%max% %type% (%count% [Stimme|Stimmen])',
'inputType' => 'text',
'eval' => array('mandatory'=>true, 'allowHtml'=>true, 'tl_class'=>'w50')
);
class tl_settings_rateit extends rateit\DcaHelper
{
public function getUserFullName() {
$this->import('jicw\\JICWHelper', 'JICWHelper');
return $this->JICWHelper->getUserFullName();
}
public function getUserEmail() {
$this->import('jicw\\JICWHelper', 'JICWHelper');
return $this->JICWHelper->getUserEmail();
}
public function getInstalledModules() {
$this->import('jicw\\JICWHelper', 'JICWHelper');
return $this->JICWHelper->getInstalledModules();
}
}
?>