Commit bfe5e07b by netz.coop

GPL

0 parents
Showing with 3076 additions and 0 deletions
/**
* @category freeSN
* @mailto code [at] netz.coop
* @version 0.4.200901
* @link http://netz.coop
*
* @copyright Copyright by netz.coop e.G. 2015
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
\ No newline at end of file
ln -s /var/www/Magento/AncLib/app/design/adminhtml/layout/lib.xml /var/www/Magento/Magento19/app/design/adminhtml/default/default/layout/anc/
\ No newline at end of file
select "-- AncPlaylist lösche Datenbank Tabellen";
select "-- lösche mag_core_resource / anc_playlist_setup";
DELETE FROM `mag_core_resource` WHERE `mag_core_resource`.`code` = 'anc_playlist_setup';
--select "-- lösche mag_anc_album";
DROP TABLE mag_anc_playlist;
DROP TABLE mag_anc_playlist_ncplaylist;
\ No newline at end of file
#!/bin/bash
APPBASE="Anc"
APPNAME="Playlist"
APPBASELC="anc"
APPNAMELC="playlist"
APPDIR="/var/www/$2/${APPBASE}${APPNAME}"
echo "############"
echo "###########"
echo "########## Setup Script für ${APPBASE}${APPNAME} $1 $2"
####
#
#
##
if [ "$3" = "TRUE" ];then
echo '*** !!! ACHTUNG NEWINSTALL = TRUE Datenbanken und Verzeichnisse der ${APPBASE}${APPNAME} werden gelöscht'
# CODE
echo "Lösche: rm -R $1/app/code/local/${APPBASE}/${APPNAME}"
rm -R "$1/app/code/local/${APPBASE}/${APPNAME}"
#ETC
echo "Lösche: $1/app/etc/modules/${APPBASE}_${APPNAME}.xml"
rm -R "$1/app/etc/modules/${APPBASE}_${APPNAME}.xml"
#Design Adminhtml
echo "Lösche: $1/app/design/adminhtml/base/default/layout/${APPBASELC}/${APPNAMELC}.xml"
rm -R "$1/app/design/adminhtml/base/default/layout/${APPBASELC}/${APPNAMELC}.xml"
echo "Lösche: $1/app/design/adminhtml/base/default/template/${APPBASELC}/${APPNAMELC}"
rm -R "$1/app/design/adminhtml/base/default/template/${APPBASELC}/${APPNAMELC}"
#Design Frontend
echo "Lösche: $1/app/design/frontend/base/default/layout/${APPBASELC}/${APPNAMELC}.xml"
rm -R "$1/app/design/frontend/base/default/layout/${APPBASELC}_${APPNAMELC}.xml"
echo "Lösche: $1/app/design/frontend/base/default/template/${APPBASELC}/${APPNAMELC}"
rm -R "$1/app/design/frontend/base/default/template/${APPBASELC}/${APPNAMELC}"
#JS
echo "Lösche: $1/js/${APPBASE}/${APPNAME}"
rm -R "$1/js/${APPBASE}/${APPNAME}"
#SKIN
echo "Lösche: $1/skin/frontend/base/default/css/${APPBASELC}/${APPNAMELC}"
rm -R "$1/skin/frontend/base/default/css/${APPBASELC}/${APPNAMELC}"
rm "$1/skin/adminhtml/base/default/css/${APPBASELC}/${APPNAMELC}"
exit 0
fi
###
# Code Local
#
##
if [ ! -d "$1/app/code/local/${APPBASE}" ];then
echo "*** Erstelle das Verzeichniss: $1/app/code/local/${APPBASE}"
mkdir "$1/app/code/local/${APPBASE}"
fi
if [ ! -d "$1/app/code/local/${APPBASE}/${APPNAME}" ];then
echo "*** Verlinke Verzeichniss: $APPDIR/app/code/local/${APPBASE}/${APPNAME} $1/app/code/local/${APPBASE}/${APPNAME}"
ln -s $APPDIR/app/code $1/app/code/local/${APPBASE}/${APPNAME}
fi
###
# etc
#
##
if [ ! -f "$1/app/etc/modules/${APPBASE}_${APPNAME}.xml" ];then
echo "*** Verlinke Datei: $1/app/etc/modules/${APPBASE}_${APPNAME}.xml"
ln -s $APPDIR/app/etc/modules/${APPBASE}_${APPNAME}.xml $1/app/etc/modules/${APPBASE}_${APPNAME}.xml
fi
###
# Design Adminhtml
#
##
#if [ ! -d "$1/app/design/frontend/base/default/layout" ];then
# echo "*** Erstelle das Verzeichniss: $1/app/design/frontend/base/default/layout"
# mkdir "$1/app/design/frontend/base/default/layout"
#fi
#if [ ! -d "$1/app/design/adminhtml/base/default/layout/${APPBASELC}" ];then
# echo "*** Erstelle das Verzeichniss: $1/app/design/adminhtml/base/default/layout/${APPBASELC}"
# mkdir "$1/app/design/adminhtml/base/default/layout/${APPBASELC}"
#fi
#if [ ! -f "$1/app/design/adminhtml/base/default/layout/${APPBASELC}/${APPNAMELC}.xml" ];then
# echo "*** Verlinke Datei: $APPDIR/app/design/adminhtml/layout/${APPBASELC}/${APPNAMELC}.xml $1/app/design/adminhtml/base/default/layout/${APPBASELC}/${APPNAMELC}.xml"
# ln -s $APPDIR/app/design/adminhtml/layout/${APPBASELC}/${APPNAMELC}.xml $1/app/design/adminhtml/base/default/layout/${APPBASELC}/${APPNAMELC}.xml
#fi
if [ ! -d "$1/app/design/adminhtml/base/default/template/${APPBASELC}" ];then
echo "*** Erstelle das Verzeichniss: $1/app/design/adminhtml/base/default/template/${APPBASELC}"
mkdir "$1/app/design/adminhtml/base/default/template/${APPBASELC}"
fi
if [ ! -d "$1/app/design/adminhtml/base/default/template/${APPBASELC}/${APPNAMELC}" ];then
echo "***### Verlinke Datei: $APPDIR/app/design/adminhtml/template $1/app/design/adminhtml/base/default/template/${APPBASELC}/${APPNAMELC}"
ln -s $APPDIR/app/design/adminhtml/template $1/app/design/adminhtml/base/default/template/${APPBASELC}/${APPNAMELC}
fi
###
# Design Frontend
#
##
if [ ! -d "$1/app/design/frontend/base/default/layout" ];then
echo "*** Erstelle das Verzeichniss: $1/app/design/frontend/base/default/layout"
mkdir "$1/app/design/frontend/base/default/layout"
fi
if [ ! -d "$1/app/design/frontend/base/default/layout/${APPBASELC}" ];then
echo "*** Erstelle das Verzeichniss: $1/app/design/frontend/base/default/layout/${APPBASELC}"
mkdir "$1/app/design/frontend/base/default/layout/${APPBASELC}"
fi
if [ ! -f "$1/app/design/frontend/base/default/layout/${APPBASELC}/${APPNAMELC}.xml" ];then
echo "*** Verlinke Datei: $APPDIR/app/design/frontend/layout/${APPBASELC}/${APPNAMELC}.xml $1/app/design/frontend/base/default/layout/${APPBASELC}/${APPNAMELC}.xml"
# ln -s $APPDIR/app/design/frontend/layout/${APPBASELC}_${APPNAMELC}.xml $1/app/design/frontend/base/default/layout/${APPBASELC}_${APPNAMELC}.xml
ln -s $APPDIR/app/design/frontend/layout/${APPNAMELC}.xml $1/app/design/frontend/base/default/layout/${APPBASELC}/${APPNAMELC}.xml
fi
if [ ! -d "$1/app/design/frontend/base/default/template" ];then
echo "*** Erstelle das Verzeichniss: $1/app/design/frontend/base/default/template"
mkdir "$1/app/design/frontend/base/default/template"
fi
if [ ! -d "$1/app/design/frontend/base/default/template/${APPBASELC}" ];then
echo "*** Erstelle das Verzeichniss: $1/app/design/frontend/base/default/template/${APPBASELC}"
mkdir "$1/app/design/frontend/base/default/template/${APPBASELC}"
fi
if [ ! -d "$1/app/design/frontend/base/default/template/${APPBASELC}/${APPNAMELC}" ];then
echo "*** Verlinke Datei: $APPDIR/app/design/frontend/template/${APPBASELC}/${APPNAMELC} $1/app/design/frontend/base/default/template/${APPBASELC}/${APPNAMELC}"
ln -s $APPDIR/app/design/frontend/template $1/app/design/frontend/base/default/template/${APPBASELC}/${APPNAMELC}
fi
###
# js
#
##
if [ ! -d "$1/js/${APPBASE}" ];then
echo "*** Erstelle das Verzeichniss: $1/js/${APPBASE}"
mkdir "$1/js/${APPBASE}"
fi
if [ ! -d "$1/js/${APPBASE}/${APPNAME}" ];then
echo "*** Verlinke Verzeichniss: $APPDIR/js $1/js/${APPBASE}/${APPNAME}"
ln -s $APPDIR/js $1/js/${APPBASE}/${APPNAME}
fi
###
# skin
#
##
if [ ! -d "$1/skin/frontend/base/default/css/${APPBASELC}" ];then
echo "*** Erstelle das Verzeichniss: $1/skin/frontend/base/default/css/${APPBASELC}"
mkdir -p "$1/skin/frontend/base/default/css/${APPBASELC}"
fi
if [ ! -d "$1/skin/frontend/base/default/css/${APPBASELC}/${APPNAMELC}" ];then
echo "*** Verlinke Verzeichniss: $APPDIR/js $1/skin/frontend/base/default/css/${APPBASELC}/${APPNAMELC}"
ln -s $APPDIR/skin/frontend/css $1/skin/frontend/base/default/css/${APPBASELC}/${APPNAMELC}
fi
if [ ! -d "$1/skin/frontend/base/default/images/${APPBASELC}" ];then
echo "*** Erstelle das Verzeichniss: $1/skin/frontend/base/default/images/${APPBASELC}"
mkdir -p "$1/skin/frontend/base/default/images/${APPBASELC}"
fi
if [ ! -d "$1/skin/frontend/base/default/images/${APPBASELC}/${APPNAMELC}" ];then
echo "*** Verlinke Verzeichniss: $APPDIR/js $1/skin/frontend/base/default/images/${APPBASELC}/${APPNAMELC}"
ln -s $APPDIR/skin/frontend/images $1/skin/frontend/base/default/images/${APPBASELC}/${APPNAMELC}
fi
###
# skin Adminhtml
#
##
if [ ! -d "$1/skin/adminhtml/base/default/css/${APPBASELC}" ];then
echo "*** Erstelle das Verzeichniss: $1/skin/frontend/base/default/css/${APPBASELC}"
mkdir -p "$1/skin/adminhtml/base/default/css/${APPBASELC}"
fi
if [ ! -d "$1/skin/adminhtml/base/default/css/${APPBASELC}/${APPNAMELC}" ];then
echo "*** Verlinke Verzeichniss: $APPDIR/skin/adminhtml/css $1/skin/adminhtml/base/default/css/${APPBASELC}/${APPNAMELC}"
ln -s $APPDIR/skin/adminhtml/css $1/skin/adminhtml/base/default/css/${APPBASELC}/${APPNAMELC}
fi
<?php
/**
* @package anc_playlist
* @category magento
* @mailto code [at] netz.coop
* @author netz.coop eG*
* @copyright (c) 2014, netz.coop eG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
* @anc_playlist_eingabetyp - _Block_Adminhtml_ -
* @eingabetyp_Redundanz Achtung!!! weitere Extensions die davon betroffen sind und selben Inhalt benötigen!!!!: AncImage, AnsPlaylist, AncAddressimport
*/
class Anc_Playlist_Block_Adminhtml_Catalog_Product_Edit_Tab_Options_Option
extends Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Options_Option
{
/**
* Class constructor
*/
public function __construct()
{
parent::__construct();
$this->setTemplate('anc/playlist/catalog/product/edit/options/option.phtml');
}
/**
* Retrieve html templates for different types of product custom options
* @eingabetyp_Redundanz
* @return string
*/
public function getTemplatesHtml()
{
$canEditPrice = $this->getCanEditPrice();
$canReadPrice = $this->getCanReadPrice();
$this->getChild('ancplaylist_option_type')
->setCanReadPrice($canReadPrice)
->setCanEditPrice($canEditPrice);
$this->getChild('ancimage_option_type')
->setCanReadPrice($canReadPrice)
->setCanEditPrice($canEditPrice);
$this->getChild('anctext_option_type')
->setCanReadPrice($canReadPrice)
->setCanEditPrice($canEditPrice);
$this->getChild('ancaddressimport_option_type')
->setCanReadPrice($canReadPrice)
->setCanEditPrice($canEditPrice);
$templates = parent::getTemplatesHtml() . "\n" .
$this->getChildHtml('ancplaylist_option_type').
$this->getChildHtml('ancimage_option_type').
$this->getChildHtml('anctext_option_type').
$this->getChildHtml('ancaddressimport_option_type');
return $templates;
}
}
\ No newline at end of file
<?php
/**
* @package anc_playlist
* @category magento
* @mailto code [at] netz.coop
* @author netz.coop eG*
* @copyright (c) 2014, netz.coop eG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
* @anc_playlist_eingabetyp - _Block_Adminhtml_ Formular im Backend beim Produkt editieren
*/
class Anc_Playlist_Block_Adminhtml_Catalog_Product_Edit_Tab_Options_Type_Ancplaylist extends
Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Options_Type_Abstract {
public function __construct() {
parent::__construct();
$this->setTemplate('anc/playlist/catalog/product/edit/options/type/ancplaylist.phtml');
}
}
\ No newline at end of file
<?php
/**
* @package anc_playlist
* @category magento
* @mailto code [at] netz.coop
* @author netz.coop eG*
* @copyright (c) 2014, netz.coop eG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
class Anc_Playlist_Block_Adminhtml_Ncplaylist extends Mage_Adminhtml_Block_Widget_Grid_Container {
public function __construct() {
//where is the controller
$this->_controller = 'adminhtml_ncplaylist';
$this->_blockGroup = 'anc_playlist';
$this->_headerText = Mage::helper('anc_playlist/data')->__('Playlists');
// //value of the add button
$this->_addButtonLabel = Mage::helper('anc_playlist/data')->__('Paylist nachträglich hinzufügen');
parent::__construct();
}
public function getCreateUrl()
{
/**
* Wichtig für Add Button
*/
return $this->getUrl(
'playlist/adminhtml_ncplaylist/edit'
);
}
}
<?php
/**
* @package anc_playlist
* @category magento
* @mailto code [at] netz.coop
* @author netz.coop eG*
* @copyright (c) 2014, netz.coop eG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
class Anc_Playlist_Block_Adminhtml_Ncplaylist_Edit
extends Mage_Adminhtml_Block_Widget_Form_Container
{
public function __construct()
{
parent::__construct();
$this->_addButton('saveandcontinue', array(
'label' => Mage::helper('adminhtml')->__('Speichern und Bearbeitung fortsetzen'),
'onclick' => 'saveAndContinueEdit()',
'class' => 'save',
), -100);
$this->_controller = 'ncplaylist';
$this->_blockGroup = 'anc_playlist_adminhtml';
$this->_formScripts[] = "
function saveAndContinueEdit(){
editForm.submit($('edit_form').action+'back/edit/');
}
";
$this->_updateButton('save', 'label', $this->__('Sichern'));
$this->_updateButton('delete', 'label', $this->__('Delete'));
}
}
\ No newline at end of file
<?php
/**
* @package anc_playlist
* @category magento
* @mailto code [at] netz.coop
* @author netz.coop eG*
* @copyright (c) 2014, netz.coop eG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
class Anc_Playlist_Block_Adminhtml_Ncplaylist_Edit_Form extends Mage_Adminhtml_Block_Widget_Form {
protected function _prepareForm() {
if (Mage::registry('anc_playlist')) {
$data = Mage::registry('anc_playlist')->getData();
} else {
$data = array();
}
$form = new Varien_Data_Form(array(
'id' => 'edit_form',
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
'method' => 'post',
'enctype' => 'multipart/form-data'
)
);
$form->setUseContainer(true);
$this->setForm($form);
$form->setValues($data);
return parent::_prepareForm();
}
}
<?php
/**
* @package anc_playlist
* @category magento
* @mailto code [at] netz.coop
* @author netz.coop eG*
* @copyright (c) 2014, netz.coop eG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
class Anc_Playlist_Block_Adminhtml_Ncplaylist_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
protected function _prepareForm() {
if (Mage::registry('anc_playlist')) {
$data = Mage::registry('anc_playlist')->getData();
} else {
$data = array();
}
$form = new Varien_Data_Form();
$this->setForm($form);
$fieldset = $form->addFieldset('anc_playlist', array('name' => 'name')); //Mage::helper('news')->__('news information')));
$fieldset->addField('customer_id', 'text', array(
'label' => Mage::helper('anc_playlist/data')->__('Customer Id'),
'class' => 'required-entry',
'required' => true,
'name' => 'customer_id',
));
// greift auf anc_album zu
$array = Mage::helper('anc_lib/sql')->selectFetchAll(
'anc_album_ncalbum',array('isplaylist'=> 1));
$arrayoptions = array('-1' => 'Bitte wählen..');
foreach ($array as $key => $value) {
$arrayoptions[$value['entity_id']] = $value['name'];
}
$varParam = $this->getRequest()->getParams();
if (array_key_exists('ncalbum_id', $varParam)) {
$var_album_id= $varParam['ncalbum_id'];
}
$fieldset->addField('ncalbum_id', 'select', array(
'label' => Mage::helper('anc_playlist/data')->__('Album'),
'class' => 'required-entry',
'required' => true,
'name' => 'ncalbum_id',
'onclick' => "",
'onchange' => "",
'value'=> $var_album_id,
'values' => $arrayoptions,
'disabled' => false,
'readonly' => false,
));
$fieldset->addField('order_id', 'text', array(
'label' => Mage::helper('anc_playlist/data')->__('Order Id'),
'class' => 'required-entry',
'required' => true,
'name' => 'order_id',
));
$fieldset->addField('quote_item_id', 'text', array(
'label' => Mage::helper('anc_playlist/data')->__('Quote Id'),
'class' => 'required-entry',
'required' => true,
'name' => 'quote_item_id',
));
// $fieldset->addField('ordertime', 'date',array(
// 'name' => 'ordertime', /* should match with your table column name where the data should be inserted */
// 'time' => true,
// 'class' => 'required-entry',
// 'required' => false,
// 'format' => 'yyyy-MM-dd HH:mm:ss',
// 'label' => Mage::helper('anc_playlist/data')->__('Date:'),
// "input_format" => Varien_Date::DATE_INTERNAL_FORMAT,
// 'image' => $this->getSkinUrl('images/grid-cal.gif'),
// ));
$fieldset->addField('ordertime', 'date',array(
'name' => 'ordertime', /* should match with your table column name where the data should be inserted */
'time' => true,
'class' => 'required-entry',
'required' => false,
'format' => 'yyyy-MM-dd HH:mm:ss',
'label' => Mage::helper('anc_playlist/data')->__('Date:'),
// "input_format" => Varien_Date::DATE_INTERNAL_FORMAT,
'image' => $this->getSkinUrl('images/grid-cal.gif'),
'readonly' => true,
));
// redudant
$fieldset->addField('product_name', 'text', array(
'label' => Mage::helper('anc_playlist/data')->__('Product Name'),
'class' => 'required-entry',
'required' => false,
'name' => 'product_name',
'readonly' => true,
));
// redudant
$fieldset->addField('customer_name', 'text', array(
'label' => Mage::helper('anc_playlist/data')->__('Customer Name'),
'class' => 'required-entry',
'required' => false,
'name' => 'customer_name',
'readonly' => true,
'disabled' => true,
));
$form->addValues($data);
return parent::_prepareForm();
}
}
<?php
/**
* @package anc_playlist
* @category magento
* @mailto code [at] netz.coop
* @author netz.coop eG*
* @copyright (c) 2014, netz.coop eG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
class Anc_Playlist_Block_Adminhtml_Ncplaylist_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs {
public function __construct() {
parent::__construct();
$this->setId('ncplaylist_tabs');
$this->setDestElementId('edit_form'); // this should be same as the form id define above
$this->setTitle('Ncplaylist');
}
protected function _beforeToHtml() {
$this->addTab(
'form_section', array(
'label' => Mage::helper('anc_playlist/data')->__('Playlist'),
'title' => Mage::helper('anc_playlist/data')->__('Playlist'),
'content' => $this->getLayout()->createBlock('anc_playlist/adminhtml_ncplaylist_edit_tab_form')->toHtml(),
'active' => true,
)
);
return parent::_beforeToHtml();
}
}
<?php
/**
* @package anc_playlist
* @category magento
* @mailto code [at] netz.coop
* @author netz.coop eG*
* @copyright (c) 2014, netz.coop eG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
class Anc_Playlist_Block_Adminhtml_Ncplaylist_Grid extends Mage_Adminhtml_Block_Widget_Grid
{
public function __construct()
{
parent::__construct();
$this->setId('anc_playlist_ncplaylist_grid');
$this->setDefaultSort('entity_id');
$this->setDefaultDir('DESC');
$this->setSaveParametersInSession(true);
}
protected function _getCollectionClass()
{
return 'anc_playlist/ncplaylist';
}
protected function _prepareCollection()
{
$varParam = $this->getRequest()->getParams();
echo "<h1>Alle Playlists: </h1>";
$collection = Mage::getModel('anc_playlist/ncplaylist')->getCollection();//->addFieldToFilter('admin_user_id',array('gt'=>0));;
$this->setCollection($collection);
return parent::_prepareCollection();
}
protected function _prepareColumns()
{
$this->addColumn('entity_id',
array(
'header' => Mage::helper('anc_playlist/data')->__('Id'),
'align' =>'right',
'width' => '50px',
'index' => 'entity_id',
));
$this->addColumn('customer_id',
array(
'header' => Mage::helper('anc_playlist/data')->__('Customer Id'),
'align' =>'right',
'width' => '50px',
'index' => 'customer_id',
));
// redudant
$this->addColumn('product_name', array(
'header' => Mage::helper('anc_playlist/data')->__('Product Name'),
'align' =>'left',
'index' => 'product_name',
));
// redudant
$this->addColumn('customer_name', array(
'header' => Mage::helper('anc_playlist/data')->__('Customer Name'),
'align' =>'left',
'index' => 'customer_name',
));
$this->addColumn('ncalbum_id', array(
'header' => Mage::helper('anc_playlist/data')->__('Album id'),
'align' =>'left',
'index' => 'ncalbum_id',
));
$this->addColumn('order_id', array(
'header' => Mage::helper('anc_playlist/data')->__('Order id'),
'align' =>'left',
'index' => 'order_id',
));
$this->addColumn('quote_item_id', array(
'header' => Mage::helper('anc_playlist/data')->__('Quote id'),
'align' =>'left',
'index' => 'quote_item_id',
));
$this->addColumn('ordertime', array(
'header' => Mage::helper('anc_playlist/data')->__('Order Time'),
'align' =>'left',
'index' => 'ordertime',
));
$this->addColumn('created_at', array(
'header' => Mage::helper('anc_playlist/data')->__('Created'),
'align' =>'left',
'index' => 'created_at',
));
$this->addColumn('updated_at', array(
'header' => Mage::helper('anc_playlist/data')->__('Updated'),
'align' =>'left',
'index' => 'updated_at',
));
return parent::_prepareColumns();
}
public function getRowUrl($row)
{
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
}
}
\ No newline at end of file
<?php
/**
* @package anc_playlist
* @category magento
* @mailto code [at] netz.coop
* @author netz.coop eG*
* @copyright (c) 2014, netz.coop eG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
class Anc_Playlist_Block_Catalog_Product_View_Options_Type_Ancplaylist
extends Mage_Catalog_Block_Product_View_Options_Abstract
{
/**
* Returns default value to show in text input
*
* @return string
*/
public function getDefaultValue()
{
return $this->getProduct()->getPreconfiguredValues()->getData('options/' . $this->getOption()->getId());
}
}
\ No newline at end of file
<?php
/**
* @package anc_playlist
* @category magento
* @mailto code [at] netz.coop
* @author netz.coop eG*
* @copyright (c) 2014, netz.coop eG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
class Anc_Playlist_Block_Options_Type_Customview_Ancplaylist
extends Mage_Core_Block_Template
{
protected $_template = 'anc/playlist/options/customview/ancplaylist.phtml';
}
\ No newline at end of file
<?php
/**
* @package anc_playlist
* @category magento
* @mailto code [at] netz.coop
* @author netz.coop eG*
* @copyright (c) 2014, netz.coop eG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
class Anc_Playlist_Helper_Data extends Mage_Core_Helper_Abstract {
}
\ No newline at end of file
<?php
/**
* @package anc_playlist
* @category magento
* @mailto code [at] netz.coop
* @author netz.coop eG*
* @copyright (c) 2014, netz.coop eG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
class Anc_Playlist_Helper_Ncconstant extends Mage_Core_Helper_Abstract {
private $AncPlaylist = 'AncPlaylist_KEY';
private $AncPlaylistOptionSku = 'AncPlaylist_TYPE';
private $ancSPSite = 'ancSPSite_KEY';
public function __get($name) {
return $this->$name;
}
public function isProductAncPlaylist(Mage_Catalog_Model_Product $param_product) {
if(is_object($param_product)) {
if (strpos($param_product->getSku(), Mage::helper('anc_playlist/ncconstant')->AncPlaylist) !== false) {
return true;
} else if (strpos($param_product->getSku(), Mage::helper('anc_playlist/ncconstant')->ancSPSite) !== false) {
return true;
}
}
return false;
}
public function isSkuAncPlaylist($param_sku) {
if($param_sku) {
if (strpos($param_sku, Mage::helper('anc_playlist/ncconstant')->AncPlaylist) !== false) {
return true;
} else if (strpos($param_sku, Mage::helper('anc_playlist/ncconstant')->ancSPSite) !== false) {
return true;
}
}
return false;
}
}
<?php
/**
* @package anc_playlist
* @category magento
* @mailto code [at] netz.coop
* @author netz.coop eG*
* @copyright (c) 2014, netz.coop eG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
class Anc_Playlist_Helper_Ncmodel extends Mage_Core_Helper_Abstract {
/**
* cache für anc_image/ncimage models
* @var array
*/
private $NcPlaylists = array();
public function getNcAlbumByAlbumId($param_id) {
return Mage::helper('anc_lib/ncrights')->loadNcModel('anc_album/ncalbum', $param_id);
}
public function getNcAlbumByUrlauth($param_id) {
$ncplaylist = Mage::helper('anc_lib/ncrights')->getNcModelBy('anc_playlist/ncplaylist', 'urlauth', $param_id);
return Mage::helper('anc_lib/ncrights')->loadNcModel('anc_album/ncalbum', $ncplaylist->getNcalbumId());
}
public function getOneNcImageFromNcAlbum($param_ncalbum_id, $param_image_nr=false) {
if(!$param_image_nr) {
$param_image_nr = 0;
}
if($param_image_nr !== false) {
$ncimages_collection = Mage::helper('anc_lib/ncrights')->getNcModelsByOneFilter('anc_image/ncimage', 'ncalbum_id', $param_ncalbum_id) ;
$ncimages = $ncimages_collection->getData();
if($param_image_nr >= count($ncimages)) {
$param_image_nr = $param_image_nr % count($ncimages);
}
if($param_image_nr < 0) {
$howmuchplus = round($param_image_nr/count($ncimages))*-1;
$param_image_nr = ($param_image_nr+count($ncimages)) + ($howmuchplus*count($ncimages));
}
//D::show($ncimages, '$ncimages :'.$param_image_nr,1,1);
return $ncimages[$param_image_nr];
} else {
// $ncimage = Mage::getModel("anc_image/ncimage")->load($param_ncalbum_id, 'ncalbum_id');
$ncimage = Mage::helper('anc_lib/ncrights')->getNcModelBy('anc_image/ncimage', 'ncalbum_id', $param_ncalbum_id);
//D::show($ncimage->getData(), '$ncimage->getData()',1,1) ;
return $ncimage->getData();
}
}
public function getNcPlaylist($param_playlist_id) {
if($param_playlist_id) {
if(!array_key_exists($param_playlist_id, $this->NcPlaylists)) {
// $ncplaylist = Mage::getModel('anc_playlist/ncplaylist')->load($param_playlist_id);
$ncplaylist = Mage::helper('anc_lib/ncrights')->loadNcModel('anc_playlist/ncplaylist', $param_playlist_id);
$this->NcPlaylists[$param_playlist_id] = $ncplaylist;
}
return $this->NcPlaylists[$param_playlist_id];
} else {
return false;
}
}
public function getBlancoNcPlaylist() {
$ncplaylist = Mage::getModel('anc_playlist/ncplaylist');
if(is_object($ncplaylist)) {
return $ncplaylist;
} else {
D::show($ncplaylist,'getBlancoNcPlaylist leer',1,1);
}
}
public function saveNcPlaylist(Anc_Playlist_Model_Ncplaylist $param_ncplaylist) {
if(is_object($param_ncplaylist)) {
$param_ncplaylist->save();
$this->NcPlaylists[$param_ncplaylist->getId()] = $param_ncplaylist;
return $this->NcPlaylists[$param_ncplaylist->getId()];
} else {
return false;
}
}
public function setNewUrlauth(Anc_Playlist_Model_Ncplaylist $param_ncplaylist) {
$param_ncplaylist->setData('urlauth',uniqid('pl', true));
}
}
\ No newline at end of file
<?php
/**
* @package anc_playlist
* @category magento
* @mailto code [at] netz.coop
* @author netz.coop eG*
* @copyright (c) 2014, netz.coop eG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
class Anc_Playlist_Helper_Ncsvginterface extends Mage_Core_Helper_Abstract {
/**
* Bearbeiten eines BildElementes in einer SVG (erstellt mit Inkscape Erweiterung)
* @param type $domel
* @param type $p_parentitemId
* @param type $MagentoID - Produkt id
* @return type
*/
private function editSiteSVG(DOMNode $domel, $p_parentitemId, $MagentoID, $p_subroductarray, $p_siteID, $p_magentoSiteWidth, $p_is_preview) {
// D::li("editSiteSVG(DOMNode $domel, $p_parentitemId, $MagentoID, $p_subroductarray, $p_siteID, $p_magentoSiteWidth, $p_is_preview)",1,1);
if (true) {
$ChildrenItemIds = Mage::helper('anc_printconfigproduct/cart')->getChildrenItemIds($p_parentitemId, $MagentoID);
$ncplaylist_id = Mage::helper('anc_lib/quoteitem')->getItemProductOptionByOptionSku($ChildrenItemIds[0], Mage::helper('anc_playlist/ncconstant')->AncPlaylistOptionSku);
if($ncplaylist_id) {
$NcPlaylist = Mage::helper('anc_playlist/ncmodel')->getNcPlaylist($ncplaylist_id);
$QrText = Mage::getUrl('playlist/site/showplaylist',array('urlauth' => $NcPlaylist->getUrlauth()));
} else {
$QrText = 'Konfigurieren Sie bitte Ihre Playlist.';
}
/*
* wenn vorschau und es soll ne homepage sein, dann nehme die dump homepage
* @author n @since 20140428
*/
if ($p_is_preview) {
// $QrText = Mage::getUrl('playlist/site/showplaylist',array('ncalbum_id' => $ncplaylist_id));
$path = Mage::helper('anc_lib/ncfilepath')->getModuleCustomerFilepath('anc_playlist', true);
} else {
// $path = '/media/serviceplus/qrcodes/';
$path = Mage::helper('anc_lib/ncfilepath')->getModuleCustomerFilepath('anc_playlist', true);
}
// $filename = 'qrcode_'.$p_subroductarray['cal']['item_id'].'_'.$p_subroductarray['qr'][$MagentoID]['item_id'].'_'.Mage::helper('anc_printconfigproduct/xml')->get('calside') .'.png';
if(is_object($NcPlaylist) && $urlauth = $NcPlaylist->getUrlauth()) {
$urlauth = '_'.$urlauth;
}
$filename = 'qrcode_item'.$p_parentitemId.$urlauth.'.png';
$filepath =Mage::helper('anc_lib/ncfilepath')->getThisMagentoInstallationPath().$path.$filename;
// D::li('$QrText: '.$QrText,1,1);
$height=$domel->getAttribute('height');
$file = $this->createQR($QrText, $filepath, $height, 0);
$domel->setAttribute('xlink:href', 'file://' . $file);
$domel->setAttribute('qrfilepath', $filepath);
$domel->setAttribute('qrtext', $QrText);
$domel->setAttribute('parentitemid', $p_parentitemId);
} else {
$domel->removeAttribute('xlink:href');
}
return $domel;
}
/**
* Create QR
*/
private function createQR($p_qrtxt, $p_tmp_qrfilepath, $p_size = '100', $p_margin = 0) {
$qrcodequality = Mage::helper('anc_printconfigproduct/constant')->get('ancpcpqrcodequality'); //
$varsize = $p_size * $qrcodequality;
// D::ulli('$varsize'.$varsize.'$p_size: '.$p_size.' $qrcodequality '.$qrcodequality,5,1,1);
QRcode::png($p_qrtxt, $p_tmp_qrfilepath, $level = QR_ECLEVEL_L, $varsize, $p_margin, $saveandprint = false);
return $p_tmp_qrfilepath;
}
public function prepareEditSiteSVG($domel, $p_parentitemId, $MagentoID, $p_subproductarray) {
$siteID = $p_subproductarray['site'][$MagentoID]['item_id'];
$domel->setAttribute('itemId', $siteID);
$magentoSiteWidth = $domel->getAttribute('width');
$is_preview = true;
// $product = Mage::getModel('catalog/product')->load($siteID);
// $product= Mage::getModel('catalog/product')->load($siteID);
// $BundleSelectionProductIds = Mage::helper('anc_printconfigproduct/bundleindividual')->getBundleSelectionProductIds($product);
// D::s($BundleSelectionProductIds,'$BundleSelectionProductIds',5,1,1);
// $BundleSelectionProductIds = Mage::helper('anc_printconfigproduct/bundleindividual')->getBundleItemSelections($p_parentitemId);
// $product= Mage::getModel('catalog/product')->load($MagentoID);
// $_option = $product->getOptions();
////D::fe($_option, '$_option')
// D::s($_option,'$_option',5,1,1);
if ($siteID) {
$order_id = Mage::helper('anc_lib/sql')->selectFetchOne('order_id', 'sales/order_item', array('quote_item_id' => $siteID));
/*
* wenn nicht order id dann vorschau
*/
if (!$order_id) {
$is_preview = true;
} else {
$is_preview = false;
}
}
// $domel = Mage::helper('anc_printconfigproduct/xmlextensions')->editSiteSVG($domel, $p_parentitemId, $MagentoID, $p_subproductarray, $siteID, $magentoSiteWidth, $is_preview);
$domel = Mage::helper('anc_playlist/ncsvginterface')->editSiteSVG($domel, $p_parentitemId, $MagentoID, $p_subproductarray, $siteID, $magentoSiteWidth, $is_preview);
}
}
\ No newline at end of file
<?php
/**
* @package anc_playlist
* @category magento
* @mailto code [at] netz.coop
* @author netz.coop eG*
* @copyright (c) 2014, netz.coop eG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
* @anc_playlist_eingabetyp
* @eingabetyp_Redundanz Achtung!!! weitere Extensions die davon betroffen sind und selben Inhalt benötigen!!!!: AncImage, AnsPlaylist, AncAddressimport
*/
class Anc_Playlist_Model_Catalog_Product_Option extends Mage_Catalog_Model_Product_Option {
const OPTION_GROUP_ANCPLAYLIST = 'ancplaylist';
const OPTION_TYPE_ANCPLAYLIST_TYPE = 'ancplaylist_type';
const OPTION_GROUP_ANCIMAGE = 'ancimage';
const OPTION_TYPE_ANCIMAGE_TYPE = 'ancimage_type';
const OPTION_GROUP_ANCTEXT = 'anctext';
const OPTION_TYPE_ANCTEXT_TYPE = 'anctext_type';
const OPTION_GROUP_ANCADDRESSIMPORT = 'ancaddressimport';
const OPTION_TYPE_ANCADDRESSIMPORT_TYPE = 'ancaddressimport_type';
/**
* Get group name of option by given option type
*
* @param string $type
* @return string
*/
public function getGroupByType($type = null)
{
if (is_null($type)) {
$type = $this->getType();
}
$group = parent::getGroupByType($type);
if( $group === '' && $type === self::OPTION_TYPE_ANCPLAYLIST_TYPE ){
$group = self::OPTION_GROUP_ANCPLAYLIST;
} else if( $group === '' && $type === self::OPTION_TYPE_ANCIMAGE_TYPE ){
$group = self::OPTION_GROUP_ANCIMAGE;
} else if( $group === '' && $type === self::OPTION_TYPE_ANCTEXT_TYPE ){
$group = self::OPTION_GROUP_ANCTEXT;
} else if( $group === '' && $type === self::OPTION_TYPE_ANCADDRESSIMPORT_TYPE ){
$group = self::OPTION_GROUP_ANCADDRESSIMPORT;
}
return $group;
}
/**
* Group model factory
*
* @param string $type Option type
* @return Mage_Catalog_Model_Product_Option_Group_Abstract
*/
public function groupFactory($type)
{
if( $type === self::OPTION_TYPE_ANCPLAYLIST_TYPE ){
return Mage::getModel('anc_playlist/catalog_product_option_type_ancplaylisttype');
} else if( $type === self::OPTION_TYPE_ANCIMAGE_TYPE ){
return Mage::getModel('anc_image/catalog_product_option_type_ancimagetype');
} else if( $type === self::OPTION_TYPE_ANCTEXT_TYPE ){
return Mage::getModel('anc_text/catalog_product_option_type_anctexttype');
} else if( $type === self::OPTION_TYPE_ANCADDRESSIMPORT_TYPE ){
return Mage::getModel('anc_addressimport/catalog_product_option_type_ancaddressimporttype');
}
return parent::groupFactory($type);
}
}
\ No newline at end of file
<?php
/**
* @package anc_playlist
* @category magento
* @mailto code [at] netz.coop
* @author netz.coop eG*
* @copyright (c) 2014, netz.coop eG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
class Anc_Playlist_Model_Catalog_Product_Option_Type_Ancplaylisttype
extends Mage_Catalog_Model_Product_Option_Type_Default
{
public function isCustomizedView() {
return true;
}
public function getCustomizedView($optionInfo)
{
$customizeBlock = new Anc_Playlist_Block_Options_Type_Customview_Ancplaylist();
$customizeBlock->setInfo($optionInfo);
return $customizeBlock->toHtml();
}
public function validateUserValue($values)
{
parent::validateUserValue($values);
$option = $this->getOption();
$value = trim($this->getUserValue());
$this->setUserValue($value);
return $this;
}
}
\ No newline at end of file
<?php
/**
* @package anc_playlist
* @category magento
* @mailto code [at] netz.coop
* @author netz.coop eG*
* @copyright (c) 2014, netz.coop eG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
class Anc_Playlist_Model_Ncplaylist extends Mage_Core_Model_Abstract {
protected function _construct()
{
parent::_construct();
$this->_init('anc_playlist/ncplaylist');
}
}
\ No newline at end of file
<?php
/**
* @package anc_playlist
* @category magento
* @mailto code [at] netz.coop
* @author netz.coop eG*
* @copyright (c) 2014, netz.coop eG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
class Anc_Playlist_Model_Observer {
/**
*
* observer: anclib_quoteitem_cloneproductitem
*
* @param array $param_values
*/
public function makeNewNcplaylistItemAfterClone(array $param_values) {
$CloneItemData = $param_values->getCloneItemData();
if(Mage::helper('anc_playlist/ncconstant')->isSkuAncPlaylist($CloneItemData['sku'])) {
$ncplaylist_id = Mage::helper('anc_lib/quoteitem')->getItemProductOptionByOptionSku($CloneItemData['item_id'], Mage::helper('anc_playlist/ncconstant')->AncPlaylistOptionSku);
if($ncplaylist_id) {
$ncplaylist = Mage::helper('anc_playlist/ncmodel')->getNcPlaylist($ncplaylist_id);
if($ncplaylist->getQuoteItemId() !== $CloneItemData['item_id']) {
// D::compareFe($ncplaylist, $param_values,'makeNewNcplaylistItemAfterClone');
$ncplaylist->setQuoteItemId($CloneItemData['item_id']);
// $ncplaylist->setEntityId();
$ncplaylist->setId();
Mage::helper('anc_playlist/ncmodel')->setNewUrlauth($ncplaylist);
$ncplaylist_new = Mage::helper('anc_playlist/ncmodel')->saveNcPlaylist($ncplaylist);
// D::compareFe($ncplaylist, $ncplaylist_new,'$ncplaylist, $ncplaylist_new');
Mage::helper('anc_lib/quoteitem')->setItemProductOptionByOptionSku($CloneItemData['item_id'], Mage::helper('anc_playlist/ncconstant')->AncPlaylistOptionSku, $ncplaylist->getId());
$quoteitem = Mage::helper('anc_lib/quoteitem')->getItem($CloneItemData['item_id']);
// D::fe($quoteitem->getData(), '$quoteitem');
}
}
}
}
public function savePlaylistOrderLink(array $param_values) {
$order = $param_values->getOrder();
$ListQuoteItemsByQuoteId = Mage::helper('anc_lib/quoteitem')->getListQuoteItemsByQuoteId($order->getQuoteId());
foreach($ListQuoteItemsByQuoteId as $ListQuoteItem) {
if(Mage::helper('anc_playlist/ncconstant')->isSkuAncPlaylist($ListQuoteItem['sku']) && $ListQuoteItem['parent_item_id']) {
$ncplaylist_id = Mage::helper('anc_lib/quoteitem')->getItemProductOptionByOptionSku($ListQuoteItem['item_id'], Mage::helper('anc_playlist/ncconstant')->AncPlaylistOptionSku);
if($ncplaylist_id) {
$NcPlaylist = Mage::helper('anc_playlist/ncmodel')->getNcPlaylist($ncplaylist_id);
if(!$NcPlaylist->getOrderId()) {
$NcPlaylist->setQuoteItemId($ListQuoteItem['item_id']);
$NcPlaylist->setOrderId($order->getId());
$NcPlaylist->setOrdertime($order->getCreatedAt());
$customer = Mage::getSingleton('customer/session')->getCustomer();
if(is_object($customer) && $customer->getId()) {
$NcPlaylist->setData('customer_id',$customer->getId());
$NcPlaylist->setData('customer_name',$customer->getFirstname().' '.$customer->getLastname());
} else {
$NcPlaylist->setData('customer_id',$order->getCustomerId());
$NcPlaylist->setData('customer_name',$order->getCustomerName());
}
Mage::helper('anc_playlist/ncmodel')->saveNcPlaylist($NcPlaylist);
}
}
}
}
}
}
<?php
/**
* @package anc_playlist
* @category magento
* @mailto code [at] netz.coop
* @author netz.coop eG*
* @copyright (c) 2014, netz.coop eG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
class Anc_Playlist_Model_Resource_Mysql4_Ncplaylist extends Mage_Core_Model_Mysql4_Abstract {
protected function _construct() {
$this->_init('anc_playlist/ncplaylist', 'entity_id');
}
protected function _beforeSave(Mage_Core_Model_Abstract $ncplaylist) {
if(!$ncplaylist->getId()) {
$ncplaylist->setCreatedAt(now());
}
$ncplaylist->setUpdatedAt(now());
return parent::_beforeSave($ncplaylist);
}
}
\ No newline at end of file
<?php
/**
* @package anc_playlist
* @category magento
* @mailto code [at] netz.coop
* @author netz.coop eG*
* @copyright (c) 2014, netz.coop eG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
class Anc_Playlist_Model_Resource_Mysql4_Ncplaylist_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract{
public function _construct(){
$this->_init('anc_playlist/ncplaylist');
parent::_construct();
}
/**
* spezielle function um bei der anc_lib/ncrights überprüfung die collection zu korrigieren
* * muss in jede extension rein, die ncrights nutzt!!!!
* @since 20141014
*
* @param array $param_data
*/
public function setDataAnc($param_data) {
$this->_data = $param_data;
}
}
\ No newline at end of file
<?php
/**
* @package anc_playlist
* @category magento
* @mailto code [at] netz.coop
* @author netz.coop eG*
* @copyright (c) 2014, netz.coop eG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
class Anc_Playlist_Adminhtml_NcplaylistController extends Mage_Adminhtml_Controller_Action {
// private static $customerid;
public function listAction() {
$siteBlock = $this->getLayout()->createBlock('anc_playlist/adminhtml_ncplaylist');
$this->loadLayout()
->_addContent($siteBlock)
->renderLayout();
}
protected function _initAction() {
$this->loadLayout()->_setActiveMenu('anc_playlist/ANC')
->_addBreadcrumb('test Manager _addBreadcrumb', 'test Manager _addBreadcrumb');
return $this;
}
public function indexAction() {
$this->_initAction();
$this->renderLayout();
$this->_redirect(
'*/*/list',
array(
)
);
}
public function editAction() {
$id = $this->getRequest()->getParam('id');
$model = Mage::getModel('anc_playlist/ncplaylist')->load($id);
if ($model->getId() || $id == 0) {
Mage::register('anc_playlist', $model);
$this->loadLayout();
$this->_setActiveMenu('test/set_time');
$this->_addBreadcrumb('test Manager', 'test Manager');
$this->_addBreadcrumb('Test Description', 'Test Description');
$this->getLayout()->getBlock('head')
->setCanLoadExtJs(true);
$this->_addContent($this->getLayout()
->createBlock('anc_playlist/adminhtml_ncplaylist_edit'))
->_addLeft($this->getLayout()
->createBlock('anc_playlist/adminhtml_ncplaylist_edit_tabs')
);
$this->renderLayout();
} else {
Mage::getSingleton('adminhtml/session')
->addError('Test does not exist');
$this->_redirect('*/*/');
}
}
public function newAction() {
$this->_forward('edit');
}
public function saveAction() {
if ($this->getRequest()->getPost()) {
try {
$postData = $this->getRequest()->getPost();
$testModel = Mage::getModel('anc_playlist/ncplaylist');
if ($this->getRequest()->getParam('id') <= 0)
$testModel->setCreatedTime(
Mage::getSingleton('core/date')
->gmtDate()
);
$testModel
->addData($postData)
->setUpdateTime(
Mage::getSingleton('core/date')
->gmtDate())
->setId($this->getRequest()->getParam('id'))
->save();
Mage::getSingleton('adminhtml/session')
->addSuccess('successfully saved');
Mage::getSingleton('adminhtml/session')
->settestData(false);
if ($this->getRequest()->getParam('back')) {
$this->_redirect(
'*/*/edit', array(
'id' => $testModel->getId(),
)
);
return;
}
$this->_redirect('*/*/list');
return;
} catch (Exception $e) {
Mage::getSingleton('adminhtml/session')
->addError($e->getMessage());
Mage::getSingleton('adminhtml/session')
->settestData($this->getRequest()
->getPost()
);
$this->_redirect('*/*/edit', array('id' => $this->getRequest()
->getParam('id')));
return;
}
}
$this->_redirect('*/*/');
}
public function deleteAction() {
if ($this->getRequest()->getParam('id') > 0) {
try {
$testModel = Mage::getModel('anc_playlist/ncplaylist');
$testModel->setId($this->getRequest()
->getParam('id'))
->delete();
Mage::getSingleton('adminhtml/session')
->addSuccess('successfully deleted');
$this->_redirect('*/*/');
$this->_redirect('*/*/list');
} catch (Exception $e) {
Mage::getSingleton('adminhtml/session')
->addError($e->getMessage());
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
}
}
$this->_redirect('*/*/list');
// $this->_redirect('*/*/');
}
protected function _isAllowed() {
return Mage::getSingleton('admin/session')->isAllowed('playlist/form');
}
}
<?php
/**
* @package anc_playlist
* @category magento
* @mailto code [at] netz.coop
* @author netz.coop eG*
* @copyright (c) 2014, netz.coop eG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
class Anc_Playlist_SiteController extends Mage_Core_Controller_Front_Action {
protected function _initAction() {
$this->loadLayout();
return $this;
}
public function showplaylistAction() {
$this->loadLayout();
$this->getLayout()->getBlock('root')->setTemplate('page/empty.phtml');
$this->renderLayout();
}
public function editplaylistAction() {
$item_id = Mage::app()->getRequest()->getParam('item_id');
$ncalbum_id = Mage::app()->getRequest()->getParam('ncalbum_id');
$customer = Mage::getSingleton('customer/session')->getCustomer();
$json_rueckgabe = array();
if($item_id) {
$ncplaylist_id = Mage::helper('anc_lib/quoteitem')->getItemProductOptionByOptionSku($item_id, Mage::helper('anc_playlist/ncconstant')->AncPlaylistOptionSku);
if($ncplaylist_id) {
$ncplaylist = Mage::helper('anc_playlist/ncmodel')->getNcPlaylist($ncplaylist_id);
} else {
$ncplaylist = Mage::helper('anc_playlist/ncmodel')->getBlancoNcPlaylist();
$ncplaylist->setData('customer_id',$customer->getId());
$ncplaylist->setData('customer_name',$customer->getFirstname().' '.$customer->getLastname());
$item = Mage::helper('anc_lib/quoteitem')->getItem($item_id);
$parent_product = Mage::helper('anc_lib/quoteitem')->getItemProduct($item->getParentItemId());
$ncplaylist->setProductName($parent_product->getName());
// $ncplaylist->setData('urlauth',uniqid('pl', true));
Mage::helper('anc_playlist/ncmodel')->setNewUrlauth($ncplaylist);
}
if(is_object($ncplaylist)) {
$ncplaylist->setData('ncalbum_id', $ncalbum_id);
$ncplaylist->setData('quote_item_id',$item_id);
// $ncplaylist->save();
$ncplaylist = Mage::helper('anc_playlist/ncmodel')->saveNcPlaylist($ncplaylist);
//D::show($ncplaylist, '$ncplaylist',1,1);
if($ncplaylist->getId()) {
$json_rueckgabe['ncplaylist_id'] = $ncplaylist->getId();
$json_rueckgabe['status'] = 'OK';
} else {
$json_rueckgabe['status'] = 'ERROR';
$json_rueckgabe['message'] = 'Playlist konnte nicht in die Datenbank eingetragen werden 1';
}
} else {
$json_rueckgabe['status'] = 'ERROR';
$json_rueckgabe['message'] = 'Playlist konnte nicht in die Datenbank eingetragen werden 2';
}
} else {
$json_rueckgabe['status'] = 'ERROR';
$json_rueckgabe['message'] = 'keine item_id';
}
echo json_encode($json_rueckgabe);
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<config>
<!-- versionierung des moduls -
wichtig vor alle dem auch im Zusammenhang mit dem Datenbankinstallationsskript
-->
<modules>
<Anc_Playlist>
<version>0.0.1</version>
</Anc_Playlist>
</modules>
<!-- was im frontend passiert -->
<frontend>
<!-- einbindung der layoutkonfiguration (s.u.) -->
<layout>
<updates>
<Anc_Playlist>
<file>anc/playlist.xml</file>
</Anc_Playlist>
</updates>
</layout>
<!-- damit die controller funktionen über eine url erreichbar sind (s.u.) -->
<routers>
<!--Umleitung bzw aktivierung der controllers-->
<anc_playlist>
<use>standard</use>
<args>
<!-- alle urls die mit "http://magento/ancplaylist" werden ins modul Anc_Playlist umgeleitet -->
<module>Anc_Playlist</module>
<frontName>ancplaylist</frontName>
</args>
</anc_playlist>
</routers>
<events>
<anclib_quoteitem_cloneproductitem>
<observers>
<anc_playlist_makeNewNcplaylistItemAfterClone>
<type>singleton</type>
<class>anc_playlist/observer</class>
<method>makeNewNcplaylistItemAfterClone</method>
</anc_playlist_makeNewNcplaylistItemAfterClone>
</observers>
</anclib_quoteitem_cloneproductitem>
<sales_order_save_commit_after>
<observers>
<anc_playlist_save_playlist_order_link>
<type>singleton</type>
<class>anc_playlist/observer</class>
<method>savePlaylistOrderLink</method>
</anc_playlist_save_playlist_order_link>
</observers>
</sales_order_save_commit_after>
</events>
</frontend>
<global>
<helpers>
<anc_playlist>
<class>Anc_Playlist_Helper</class>
</anc_playlist>
</helpers>
<!-- dem system bekannt machen das block klassen existieren -->
<blocks>
<anc_playlist>
<class>Anc_Playlist_Block</class>
</anc_playlist>
<!-- Wichtig damit die Blocks zum editieren richtig geladen werden-->
<anc_playlist_adminhtml>
<class>Anc_Playlist_Block_Adminhtml</class>
</anc_playlist_adminhtml>
<adminhtml>
<!-- @anc_playlist_eingabetyp -->
<rewrite>
<catalog_product_edit_tab_options_option>Anc_Playlist_Block_Adminhtml_Catalog_Product_Edit_Tab_Options_Option</catalog_product_edit_tab_options_option>
</rewrite>
</adminhtml>
</blocks>
<catalog>
<product>
<options>
<custom>
<groups>
<!-- @anc_playlist_eingabetyp -->
<ancplaylist translate="label" module="anc_playlist">
<label>NcPlaylist</label>
<render>anc_playlist/adminhtml_catalog_product_edit_tab_options_type_ancplaylist</render>
<types>
<ancplaylist_type translate="label" module="anc_playlist">
<label>Playlist</label>
</ancplaylist_type>
</types>
</ancplaylist>
</groups>
</custom>
</options>
</product>
</catalog>
<!-- die konfiguration der datenbank schnittstelle -->
<models>
<anc_playlist>
<class>Anc_Playlist_Model</class>
<!-- folgendes ist ein verweis auf den nachfolgenden tag <anc_playlist_resource> -->
<resourceModel>anc_playlist_resource</resourceModel>
</anc_playlist>
<anc_playlist_resource>
<class>Anc_Playlist_Model_Resource_Mysql4</class>
<!-- entitie's mit s hier können mehrere Tabellen(namen) untergebracht werden -->
<entities>
<ncplaylist>
<table>anc_playlist_ncplaylist</table>
</ncplaylist>
</entities>
</anc_playlist_resource>
<catalog>
<!-- @anc_playlist_eingabetyp -->
<rewrite>
<product_option>Anc_Playlist_Model_Catalog_Product_Option</product_option>
</rewrite>
</catalog>
</models>
<resources>
<!-- hier verbirgt sich das installationsskript um die datenbanktabellen zu erstellen -->
<anc_playlist_setup>
<setup><module>Anc_Playlist</module><class>Mage_Sales_Model_Mysql4_Setup</class></setup>
<connection><use>core_setup</use></connection>
</anc_playlist_setup>
<!-- datenbank verbindungen -->
<anc_playlist_write><connection><use>core_write</use></connection></anc_playlist_write>
<anc_playlist_read><connection><use>core_read</use></connection></anc_playlist_read>
</resources>
</global>
<admin>
<routers>
<anc_playlist>
<use>admin</use>
<args>
<modules>
<certification_may before="Mage_Adminhtml">Anc_Playlist_Adminhtml</certification_may>
</modules>
<module>Anc_Playlist</module>
<frontName>playlist</frontName>
</args>
</anc_playlist>
</routers>
</admin>
<adminhtml>
<!-- <layout>
<updates>
<album>
<file>anc/album.xml</file>
</album>
</updates>
</layout> -->
<menu>
<Anc_Anc module="anc_playlist">
<title>ANC</title>
<sort_order>72</sort_order>
<children>
<item1site module="anc_playlist">
<title>Playlist</title>
<sort_order>3</sort_order>
<action>playlist/adminhtml_ncplaylist/list</action>
</item1site>
</children>
</Anc_Anc>
</menu>
</adminhtml>
</config>
\ No newline at end of file
<?php
/**
* @copyright (c) 2014, netz.coop eG
*/
/**
* @var Mage_Sales_Model_Mysql4_Setup $installer
*/
$installer = $this;
$installer->startSetup();
$tableName = $installer->getTable('anc_playlist/ncplaylist');
if ($installer->getConnection()->isTableExists($tableName) != true ){
$table = $installer->getConnection()->newTable($tableName)
->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER,null,array('identity' => true,'unsigned' => true,'nullable' => false,'primary' => true,),'Id')
->addColumn('customer_id', Varien_Db_Ddl_Table::TYPE_INTEGER,null,array('unsigned' => true,'nullable' => false,'default' => '0',),'Customer ID')
->addColumn('ncalbum_id', Varien_Db_Ddl_Table::TYPE_INTEGER,null,array('unsigned' => true,'nullable' => false,'default' => '0',),'ncalbum id')
->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER,null,array('unsigned' => true,'nullable' => false,'default' => '0',),'Order Id')
->addColumn('quote_item_id',Varien_Db_Ddl_Table::TYPE_INTEGER,null,array('unsigned' => true,'nullable' => false,'default' => '0',),'Quote Item Id')
->addColumn('urlauth', Varien_Db_Ddl_Table::TYPE_VARCHAR,null,array(),'spezial eindeutiger url teil')
->addColumn('ordertime', Varien_Db_Ddl_Table::TYPE_TIMESTAMP,null,array(),'Bestellzeitpunkt')
// redudant
->addColumn('product_name', Varien_Db_Ddl_Table::TYPE_VARCHAR,null,array(),'redudant: Produktname')
->addColumn('customer_name', Varien_Db_Ddl_Table::TYPE_VARCHAR,null,array(),'redudant: Kundenname')
->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP,null,array(),'When beginn')
->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP,null,array(),'When updated')
->addColumn('deleted_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP,null, array(), 'When deleted')
->addColumn('deleted', Varien_Db_Ddl_Table::TYPE_TINYINT,null,array('default' => '0'),'Deleted')
->addColumn('track_num', Varien_Db_Ddl_Table::TYPE_INTEGER,null,array('unsigned' => true,'nullable' => false,'default' => '0',),'Aufrufe')
;
$installer->getConnection()->createTable($table);
}
$installer->endSetup();
?>
\ No newline at end of file
<?php
/**
*
* @package anc_playlist
* @anc_playlist_eingabetyp
* @copy from Magento18/app/design/adminhtml/default/default/template/catalog/product/edit/options/option.phtml
* @eingabetyp_Redundanz Achtung!!! weitere Extensions die davon betroffen sind und selben Inhalt benötigen!!!!: AncImage, AnsPlaylist, AncAddressimport
* @since 201400812
* @author netz.coop eG*
* @copyright (c) netz.coop eG*
* @version Magento 1.8, 1.9
*/
?>
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magentocommerce.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category design
* @package default_default
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
?>
<?php echo $this->getTemplatesHtml() ?>
<script type="text/javascript">
//<![CDATA[
var firstStepTemplate = '<div class="option-box" id="option_{{id}}">'+
'<table id="<?php echo $this->getFieldId() ?>_{{id}}" class="option-header" cellpadding="0" cellspacing="0">'+
'<input type="hidden" id="<?php echo $this->getFieldId() ?>_{{id}}_is_delete" name="<?php echo $this->getFieldName() ?>[{{id}}][is_delete]" value="" />'+
'<input type="hidden" id="<?php echo $this->getFieldId() ?>_{{id}}_previous_type" name="<?php echo $this->getFieldName() ?>[{{id}}][previous_type]" value="{{type}}" />'+
'<input type="hidden" id="<?php echo $this->getFieldId() ?>_{{id}}_previous_group" name="<?php echo $this->getFieldName() ?>[{{id}}][previous_group]" value="" />'+
'<input type="hidden" id="<?php echo $this->getFieldId() ?>_{{id}}_id" name="<?php echo $this->getFieldName() ?>[{{id}}][id]" value="{{id}}" />'+
'<input type="hidden" id="<?php echo $this->getFieldId() ?>_{{id}}_option_id" name="<?php echo $this->getFieldName() ?>[{{id}}][option_id]" value="{{option_id}}" />'+
'<thead>'+
'<tr>'+
'<th class="opt-title"><?php echo Mage::helper('catalog')->__('Title') ?> <span class="required">*</span></th>'+
'<th class="opt-type"><?php echo Mage::helper('catalog')->__('Input Type') ?> <span class="required">*</span></th>'+
'<th class="opt-req"><?php echo $this->jsQuoteEscape(Mage::helper('catalog')->__('Is Required')) ?></th>'+
'<th class="opt-order"><?php echo Mage::helper('catalog')->__('Sort Order') ?></th>'+
'<th class="a-right"><?php echo $this->jsQuoteEscape($this->getDeleteButtonHtml()) ?></th>'+
'</tr>'+
'</thead>'+
'<tr>'+
'<td><input type="text" class="required-entry input-text" id="<?php echo $this->getFieldId() ?>_{{id}}_title" name="<?php echo $this->getFieldName() ?>[{{id}}][title]" value="{{title}}">{{checkboxScopeTitle}}</td>'+
'<td><?php echo $this->getTypeSelectHtml() ?></td>'+
'<td class="opt-req"><?php echo $this->getRequireSelectHtml() ?></td>'+
'<td><input type="text" class="validate-zero-or-greater input-text" name="<?php echo $this->getFieldName() ?>[{{id}}][sort_order]" value="{{sort_order}}"></td>'+
'<td>&nbsp;</td>'+
'</tr></table></div>';
var productOption = {
div : $('product_options_container_top'),
templateSyntax : /(^|.|\r|\n)({{(\w+)}})/,
templateText : firstStepTemplate,
itemCount : 1,
add : function(data) {
this.template = new Template(this.templateText, this.templateSyntax);
if(!data.id){
data = {};
data.id = this.itemCount;
data.type = '';
data.option_id = 0;
} else {
this.itemCount = data.item_count;
}
Element.insert(this.div, {'after':this.template.evaluate(data)});
//set selected type
if (data.type) {
$A($('<?php echo $this->getFieldId() ?>_'+data.id+'_type').options).each(function(option){
if (option.value==data.type) option.selected = true;
});
}
//set selected is_require
if (data.is_require) {
$A($('<?php echo $this->getFieldId() ?>_'+data.id+'_is_require').options).each(function(option){
if (option.value==data.is_require) option.selected = true;
});
}
if (data.checkboxScopeTitle) {
//set disabled
if ($('<?php echo $this->getFieldId() ?>_'+data.option_id+'_title') && data.scopeTitleDisabled) {
$('<?php echo $this->getFieldId() ?>_'+data.option_id+'_title').disable();
}
}
this.itemCount++;
this.bindRemoveButtons();
productOptionType.bindSelectInputType();
},
remove : function(event){
var element = $(Event.findElement(event, 'div'));
if(element){
$('product_'+element.readAttribute('id')+'_'+'is_delete').value = '1';
element.addClassName('no-display');
element.addClassName('ignore-validate');
element.hide();
}
},
bindRemoveButtons : function(){
var buttons = $$('div.product-custom-options .delete-product-option');
for(var i=0;i<buttons.length;i++){
if(!$(buttons[i]).binded){
$(buttons[i]).binded = true;
Event.observe(buttons[i], 'click', this.remove.bind(this));
}
}
var inputs = $$('div.product-custom-options button', 'div.product-custom-options input', 'div.product-custom-options select', 'div.product-custom-options textarea');
<?php if ($this->isReadonly()):?>
for (var i=0, l = inputs.length; i < l; i ++) {
inputs[i].disabled = true;
if (inputs[i].tagName.toLowerCase()=='button') {
inputs[i].addClassName('disabled');
}
}
<?php else: ?>
inputs.each(function(el) { Event.observe(el, 'change', el.setHasChanges.bind(el)); } )
<?php endif;?>
}
}
var productOptionType = {
templateSyntax : /(^|.|\r|\n)({{(\w+)}})/,
loadStepTwo : function(event){
var element = $(Event.findElement(event, 'select'));
var group = '';
var previousGroupElm = $(element.readAttribute('id').sub('_type', '_previous_group'));
switch(element.getValue()){
case 'field':
case 'area':
template = OptionTemplateText;
group = 'text';
break;
case 'file':
template = OptionTemplateFile;
group = 'file';
break;
case 'drop_down':
case 'radio':
case 'checkbox':
case 'multiple':
template = OptionTemplateSelect;
group = 'select';
break;
case 'date':
case 'date_time':
case 'time':
template = OptionTemplateDate;
group = 'date';
break;
// @eingabetyp_Redundanz
// * @package anc_image
// * @since 20140416 @author netz.coop eG
case 'ancimage_type':
template = OptionTemplateAncimage;
group = 'ancimage';
break;
case 'anctext_type':
template = OptionTemplateAnctext;
group = 'anctext';
break;
//
// * @package anc_addressimport
// * @since 20140717 @author netz.coop eG
case 'ancaddressimport_type':
template = OptionTemplateAncaddressimport;
group = 'ancaddressimport';
break;
case 'ancplaylist_type':
template = OptionTemplateAncplaylist;
group = 'ancplaylist';
break;
default:
template = '';
group = 'unknown';
break;
}
if (previousGroupElm.getValue() != group) {
if ($(element.readAttribute('id')+'_'+previousGroupElm.getValue())) {
formElm = $(element.readAttribute('id')+'_'+previousGroupElm.getValue()).descendants();
formElm.each(function(elm){
if (elm.tagName == 'input' || elm.tagName == 'select') {
elm.name = '__delete__'+elm.readAttribute('name');
}
});
$(element.readAttribute('id')+'_'+previousGroupElm.getValue()).addClassName('no-display');
$(element.readAttribute('id')+'_'+previousGroupElm.getValue()).addClassName('ignore-validate');
$(element.readAttribute('id')+'_'+previousGroupElm.getValue()).hide();
}
previousGroupElm.value = group;
if ($(element.readAttribute('id')+'_'+group)) {
formElm = $(element.readAttribute('id')+'_'+group).descendants();
formElm.each(function(elm){
if (elm.match('input') || elm.match('select')) {
elm.name = elm.readAttribute('name').sub('__delete__', '');
}
});
$(element.readAttribute('id')+'_'+group).removeClassName('no-display');
$(element.readAttribute('id')+'_'+group).removeClassName('ignore-validate');
$(element.readAttribute('id')+'_'+group).show();
} else {
template = '<div id="'+element.readAttribute('id')+'_'+group+'" class="grid tier form-list">'+template+'</div><div id="'+element.readAttribute('id')+'_'+group+'_advice"></div';
this.secondTemplate = new Template(template, this.templateSyntax);
data = {};
if (!data.option_id) {
data = {};
data.option_id = $(element.readAttribute('id').sub('_type', '_id')).getValue();
}
Element.insert(element.readAttribute('id').sub('_type', ''), {'after':this.secondTemplate.evaluate(data)});
switch(element.getValue()){
case 'drop_down':
case 'radio':
case 'checkbox':
case 'multiple':
selectOptionType.bindAddButton();
break;
}
}
}
},
addDataToValues : function(data){
switch(data.type){
case 'field':
case 'area':
template = OptionTemplateText;
group = 'text';
break;
case 'file':
template = OptionTemplateFile;
group = 'file';
break;
case 'drop_down':
case 'radio':
case 'checkbox':
case 'multiple':
template = OptionTemplateSelect;
group = 'select';
break;
case 'date':
case 'date_time':
case 'time':
template = OptionTemplateDate;
group = 'date';
break;
// @eingabetyp_Redundanz
// * @package anc_image
// * @since 20140416 @author netz.coop eG
case 'ancimage_type':
template = OptionTemplateAncimage;
group = 'ancimage';
break;
case 'anctext_type':
template = OptionTemplateAnctext;
group = 'anctext';
break;
// * @package anc_addressimport
// * @since 20140717 @author netz.coop eG
case 'ancaddressimport_type':
template = OptionTemplateAncaddressimport;
group = 'ancaddressimport';
break;
case 'ancplaylist_type':
template = OptionTemplateAncplaylist;
group = 'ancplaylist';
break;
}
$('<?php echo $this->getFieldId() ?>_'+data.id+'_previous_group').value = group;
template = '<div id="<?php echo $this->getFieldId() ?>_{{id}}_type_'+group+'" class="grid tier form-list">'+template+'</div><div id="<?php echo $this->getFieldId() ?>_{{id}}_type_'+group+'_advice"></div>';
this.secondTemplate = new Template(template, this.templateSyntax);
Element.insert($('<?php echo $this->getFieldId() ?>_'+data.option_id), {'after':this.secondTemplate.evaluate(data)});
if (data.checkboxScopePrice) {
//set disabled
if ($('<?php echo $this->getFieldId() ?>_'+data.option_id+'_price') && data.scopePriceDisabled) {
$('<?php echo $this->getFieldId() ?>_'+data.option_id+'_price').disable();
$('<?php echo $this->getFieldId() ?>_'+data.option_id+'_price_type').disable();
}
}
switch(data.type){
case 'drop_down':
case 'radio':
case 'checkbox':
case 'multiple':
data.optionValues.each(function(value) {
selectOptionType.add(value);
});
selectOptionType.bindAddButton();
break;
}
if (data.price_type) {
$A($('<?php echo $this->getFieldId() ?>_'+data.option_id+'_price_type').options).each(function(option){
if (option.value==data.price_type) option.selected = true;
});
}
},
bindSelectInputType : function(){
var types = $$('.select-product-option-type');
for(var i=0;i<types.length;i++){
if(!$(types[i]).binded){
$(types[i]).binded = true;
Event.observe(types[i], 'change', function(event){
productOptionType.loadStepTwo(event);
});
}
}
}
}
var productOptionScope = {
addScope : function(event){
var element = $(Event.element(event));
fieldToDisable = $(element.readAttribute('id').sub('_use_default', ''));
if (fieldToDisable.disabled) {
if (fieldToDisable.hasClassName('product-option-price')) {//need change to cheking value of element
$(fieldToDisable.readAttribute('id')+'_type').enable();
}
fieldToDisable.enable();
} else {
if (fieldToDisable.hasClassName('product-option-price')) {//need change to cheking value of element
$(fieldToDisable.readAttribute('id')+'_type').disable();
}
fieldToDisable.disable();
}
},
bindScopeCheckbox : function(){
var checkboxes = $$('.product-option-scope-checkbox');
for (var i=0;i<checkboxes.length;i++) {
if (!$(checkboxes[i]).binded) {
$(checkboxes[i]).binded = true;
Event.observe(checkboxes[i], 'click', this.addScope.bind(this));
}
}
}
}
if($('option_panel')){
$('option_panel').remove();
}
productOption.bindRemoveButtons();
if($('<?php echo $this->getAddButtonId() ?>')){
Event.observe('<?php echo $this->getAddButtonId() ?>', 'click', productOption.add.bind(productOption));
}
//validation for selected input type
Validation.addAllThese([
['required-option-select', <?php echo $this->helper('core')->jsonEncode(Mage::helper('catalog')->__('Select type of option')) ?>, function(v, elm) {
if (elm.getValue() == '') {
return false;
}
return true;
}]]);
//adding data to templates
<?php foreach ($this->getOptionValues() as $_value): ?>
productOption.add(<?php echo $_value->toJson() ?>);
productOptionType.addDataToValues(<?php echo $_value->toJson() ?>);
<?php endforeach; ?>
//bind scope checkboxes
productOptionScope.bindScopeCheckbox();
//]]>
</script>
<div><?php if (!$this->isReadonly()):?><input type="hidden" name="affect_product_custom_options" value="1" /><?php endif;?></div>
<?php
/**
* @package anc_playlist
* @anc_playlist_eingabetyp - Formular-template im Backend beim Produkt editieren
* @copy app/design/adminhtml/default/default/template/catalog/product/edit/options/type/text.phtml
* @since 201400812
* @author netz.coop eG*
* @version Magento 1.8, 1.9
*/
?>
<script type="text/javascript">
//<![CDATA[
OptionTemplateAncplaylist = '<table class="border" cellpadding="0" cellspacing="0">'+
'<tr class="headings">'+
<?php if ($this->getCanReadPrice() !== false) : ?>
'<th class="type-price"><?php echo Mage::helper('catalog')->__('Price') ?></th>' +
'<th class="type-type"><?php echo Mage::helper('catalog')->__('Price Type') ?></th>' +
<?php endif; ?>
'<th class="type-sku"><?php echo Mage::helper('catalog')->__('SKU') ?></th>'+
'<th class="type-last last"><?php echo Mage::helper('catalog')->__('Max Size in MB') ?> </th>'+
'<th class="last">' + <?php echo $this->helper('core')->jsonEncode(Mage::helper('catalog')->__('Maximum Image Size')); ?> + '</th>' +
'</tr>'+
'<tr>'+
<?php if ($this->getCanReadPrice() !== false) : ?>
'<td><input type="text" class="input-text validate-number product-option-price" id="product_option_{{option_id}}_price" name="product[options][{{option_id}}][price]" value="{{price}}"<?php if ($this->getCanEditPrice() === false) : ?> disabled="disabled"<?php endif; ?>></td>' +
'<td><?php echo $this->getPriceTypeSelectHtml() ?>{{checkboxScopePrice}}</td>' +
<?php else : ?>
'<input type="hidden" name="product[options][{{option_id}}][price]">' +
'<input type="hidden" name="product[options][{{option_id}}][price_type]" id="product_option_{{option_id}}_price_type">' +
<?php endif; ?>
'<td><input type="text" class="input-text" name="product[options][{{option_id}}][sku]" value="{{sku}}"></td>'+
'<td class="type-last last"><input type="text" class="input-text validate-zero-or-greater" name="product[options][{{option_id}}][max_characters]" value="{{max_characters}}"></td>'+
'<td class="type-last last" nowrap><input class="input-text" type="text" name="product[options][{{option_id}}][image_size_x]" value="{{image_size_x}}">' +
<?php echo $this->helper('core')->jsonEncode(Mage::helper('catalog')->__('x')) ?> +
'<input class="input-text" type="text" name="product[options][{{option_id}}][image_size_y]" value="{{image_size_y}}">' +
<?php echo $this->helper('core')->jsonEncode(Mage::helper('catalog')->__('px.')) ?> +
'</td>' +
'</tr>'+
'</table>';
if ($('option_panel_type_ancplaylist')) {
$('option_panel_type_ancplaylist').remove();
}
//]]>
</script>
\ No newline at end of file
<?xml version="1.0"?>
<layout version="0.1.0">
<!-- in "meinem Benutzerkonto" wird ein weiterer link angezeigt, der über den Controller die neue seite anzeigt -->
<catalog_product_view translate="label">
<reference name="product.info.options">
<!-- @anc_playlist_eingabetyp -->
<action method="addOptionRenderer">
<type>ancplaylist</type>
<block>anc_playlist/catalog_product_view_options_type_ancplaylist</block>
<template>anc/playlist/catalog/product/view/options/type/ancplaylist.phtml</template>
</action>
</reference>
</catalog_product_view>
<!-- for the @AncBundleproduct Extension and the sepcial catalog_product_subview @anc_playlist_eingabetyp -->
<catalog_product_subview translate="label">
<reference name="product.info.options">
<!-- @anc_playlist_eingabetyp -->
<action method="addOptionRenderer">
<type>ancplaylist</type>
<block>anc_playlist/catalog_product_view_options_type_ancplaylist</block>
<template>anc/playlist/catalog/product/view/options/type/ancplaylist.phtml</template>
</action>
</reference>
</catalog_product_subview>
<anc_playlist_site_showplaylist>
<reference name="head">
<action method="addCss"><stylesheet>css/anc/playlist/site_showplaylist.css</stylesheet></action>
<action method="removeItem"><type>skin_css</type><name>css/spv3_header.css</name></action>
<action method="removeItem"><type>skin_css</type><name>css/spv3_footer.css</name></action>
<action method="removeItem"><type>skin_css</type><name>css/spv3_home.css</name></action>
<action method="removeItem"><type>skin_css</type><name>css/spv3_category_product_list.css</name></action>
<action method="removeItem"><type>skin_css</type><name>css/styles.css</name></action>
<action method="removeItem"><type>skin_css</type><name>css/print.css</name></action>
<action method="removeItem"><type>js</type><name>varien/form.js</name></action>
<!--<action method="removeItem"><type>js</type><name>jquery/jquery-2.0.2.min.js</name></action>-->
<action method="removeItem"><type>js</type><name>jquery/jqueryui/jquery-ui.min.js</name></action>
<action method="removeItem"><type>js</type><name>varien/product.js</name></action>
<action method="removeItem"><type>js</type><name>varien/configurable.js</name></action>
<action method="removeItem"><type>js</type><name>lib/ccard.js</name></action>
<action method="removeItem"><type>js</type><name>mage/cookies.js</name></action>
<action method="removeItem"><type>js</type><name>prototype/prototype.js</name></action>
<action method="removeItem"><type>js</type><name>prototype/validation.js</name></action>
<action method="removeItem"><type>js</type><name>mage/translate.js</name></action>
<action method="removeItem"><type>js</type><name>varien/js.js</name></action>
<action method="removeItem"><type>js</type><name>scriptaculous/builder.js</name></action>
<action method="removeItem"><type>js</type><name>scriptaculous/effects.js</name></action>
<action method="removeItem"><type>js</type><name>scriptaculous/dragdrop.js</name></action>
<action method="removeItem"><type>js</type><name>scriptaculous/controls.js</name></action>
<action method="removeItem"><type>js</type><name>scriptaculous/slider.js</name></action>
<action method="removeItem"><type>js</type><name>varien/menu.js</name></action>
<action method="removeItem"><type>js</type><name>jqueryui/jquery-ui.min.js</name></action>
<action method="removeItem"><type>js</type><name>varien/weee.js</name></action>
</reference>
<reference name="content">
<block type="page/html" name="anc_playlist_showplaylist" template="anc/playlist/site_showplaylist.phtml" />
</reference>
</anc_playlist_site_showplaylist>
</layout>
\ No newline at end of file
<?php
/**
*
* @var $this anc_playlist/catalog_product_view_options_type_ancplaylist
*
* @package anc_playlist
* @anc_playlist_eingabetyp -- Formular bzw ansicht im Frontend im Warenkorb beim Produkt konfigurieren
* @copy Grundlage: Magento18/app/design/frontend/base/default/template/catalog/product/view/options/type/text.phtml
* @since 201400812
* @author netz.coop eG*
*/
?>
<?php $DropzoneIndex = Mage::helper('anc_lib/data')->getElementIndexForId(); ?>
<?php $dropzone_id = 'ancplaylist-dropzone-id'.$DropzoneIndex; ?>
<?php $ancnote_id = 'ancnote-id'; ?>
<?php $_option = $this->getOption(); ?>
<?php $input_id = 'options_'.$_option->getId().'_text'; ?>
<div class="ancplaylist-ancplaylist anc-productview">
<div class="ancplaylist_type anc-productview-type" id="<?php echo $_option->getSku(); ?>">
<div class="ancplaylist_type-fakewrapper anc-productview-type-fakewrapper">
<div id="<?php echo $ancnote_id; ?>"></div>
<input type="hidden" onchange="opConfig.reloadPrice()" id="<?php echo $input_id ?>" class="input-text<?php echo $_option->getIsRequire() ? ' required-entry' : '' ?> <?php echo $_option->getMaxCharacters() ? ' validate-length maximum-length-'.$_option->getMaxCharacters() : '' ?> product-custom-option" name="options[<?php echo $_option->getId() ?>]" value="<?php echo $this->escapeHtml($this->getDefaultValue()) ?>" />
<?php // $Currentpageinfos = Mage::helper('anc_lib/data')->getCurrentcheckoutcartinfos(); ?>
<?php $ParentItemInfos = Mage::helper('anc_lib/data')->getCheckoutCartParentItemInfos(); ?>
<?php echo $this->getLayout()
->getBlockSingleton('catalog/product_view')
->setTemplate('anc/printconfigproduct/printconfigproductpreview.phtml')
->setForceProduct($ParentItemInfos['parent_item_product'])
->setForceItemId($ParentItemInfos['parent_item_id'])
->setForceAncdesignconfig('image')
// ->setForcePageNr(5)
->setForcePageNr($ParentItemInfos['parent_item_product']->getAncprintDefaultPageQrcode() )
->setForceMaxPages(1)
->setOnlyPreview(true)
->toHtml(); ?>
</div>
</div>
<div class="ancplaylist_type-possibility anc-productview-possibility">
<?php echo $this->getLayout()
->getBlockSingleton('catalog/product_view')
->setTemplate('anc/playlist/ncplaylist.phtml')
->setAncPlaylistInputId($input_id)
->setNcPlaylistId($this->escapeHtml($this->getDefaultValue()))
->toHtml(); ?>
</div>
<script type="text/javascript">
jQuery(document).ready(function($) {
});
</script>
</div>
\ No newline at end of file
<!--/**
* wird geladen wenn der eingabetyp @see @anc_image_eingabetyp genutzt wird
* @package anc_playlist
* @since 20140812
* @author netz.coop eG*
*/
-->
<?php
/**
* @input
*/
$NcPlaylistId = $this->getNcPlaylistId() ;
/**
* @input
*/
$AncPlaylistInputId = $this->getAncPlaylistInputId();
$ItemInfos = Mage::helper('anc_lib/data')->getCheckoutCartItemInfos();
if($NcPlaylistId) {
$NcPlaylist = Mage::helper('anc_playlist/ncmodel')->getNcPlaylist($NcPlaylistId);
if(is_object($NcPlaylist)) {
$ChoosedNcAlbumId = $NcPlaylist->getNcalbumId();
}
}
?>
<div class="ancimage-customer_galleries anc-menu-box">
<div class="ancimage-customer_galleries-header anc-menu-box-header">QR Code</div>
<div id="accordion" class="anc-menu-box-content">
<h3 class="anc-menu-box-content-subheader">Playlist</h3>
<div class="anc-menu-box-content-subcontent">
<?php $ncplaylist_ncalbums = Mage::helper('anc_album/ncmodel')->getAllPlaylistNcAlbums(); ?>
<?php if(is_array($ncplaylist_ncalbums) && !empty($ncplaylist_ncalbums)): ?>
<div id="ncplaylist_ncalbums">
<li data-ncalbum_id=""
title="<?php echo $ncalbum['comment']; ?>"
<?php if($ChoosedNcAlbumId === $ncalbum['entity_id']):?>class="ui-selected"<?php endif; ?>
>
keine Playlist ausgewählt
</li>
<?php foreach ($ncplaylist_ncalbums as $ncalbum): ?>
<li data-ncalbum_id="<?php echo $ncalbum['entity_id'] ?>"
title="<?php echo $ncalbum['comment']; ?>"
<?php if($ChoosedNcAlbumId === $ncalbum['entity_id']):?>class="ui-selected"<?php endif; ?>
>
<?php echo $ncalbum['name'] ?>
</li>
<?php endforeach; ?>
</div>
<div id="ncplaylist_preview">
</div>
<?php endif; ?>
</div>
</div>
</div>
<script type="text/javascript">
/**
* initial Vorschau der playlist, falls schon eine playlist exisitert!
*/
jQuery(document).ready(function(jQuery) {
<?php if($ChoosedNcAlbumId): ?>
loadNcPlaylistPreview(<?php echo $ChoosedNcAlbumId; ?>);
<?php endif; ?>
});
/**
* wenn eine playlist (ncalbum) ausgewählt worden ist
*/
jQuery('#ncplaylist_ncalbums').selectable({
selected: function(typ, ui) {
loadNcPlaylistPreview(ui.selected.dataset['ncalbum_id']);
}
});
function ajax_editplaylist(ncalbum_id, ifredirectAfterSubmit, data, url, backurl) {
var ajax_editplaylist_data = {
url: '<?php echo Mage::getUrl('playlist/site/editplaylist',array('item_id' => $ItemInfos['item_id'])); ?>ncalbum_id/'+ncalbum_id+'/',
success : function(data, textStatus, jqXhr) {
var parseddata = jQuery.parseJSON( data );
jQuery("#<?php echo $AncPlaylistInputId; ?>").attr('value',parseddata.ncplaylist_id);
if(ifredirectAfterSubmit) {
redirectAfterSubmit(data, url, backurl);
}
}
};
jQuery.ajax(ajax_editplaylist_data);
}
/**
* wird beim speicher button, derzeit leider noch aus
* ancprintconfigproduct/default/template/catalog/product/view/options/wrapper/bottom.phtml
* aufgerufen
*
* @param {type} data
* @param {type} url
* @param {type} backurl
* @returns {undefined}
*/
function redirectAfterSubmitAfterSavePlaylist(data, url, backurl) {
var ncalbum_id = jQuery('#ncplaylist_ncalbums > .ui-selected').data('ncalbum_id');
var ncplaylist_id = jQuery("#<?php echo $AncPlaylistInputId; ?>").attr('value');
// wenn es noch keine playlist gibt, dann erstelle und speicher
if(!ncplaylist_id && ncalbum_id) {
ajax_editplaylist(ncalbum_id, true, data, url, backurl);
}
// wenn es eine gibt, aber diese nicht mehr gewollt ist, setze null und speicher
else if(ncplaylist_id && !ncalbum_id) {
jQuery("#<?php echo $AncPlaylistInputId; ?>").attr('value','');
redirectAfterSubmit(data, url, backurl);
}
// ansonsten update playlist und speicher
else {
ajax_editplaylist(ncalbum_id, true, data, url, backurl);
}
// redirectAfterSubmit(data, url, backurl);
}
function loadNcPlaylistPreview(param_ncalbum_id, param_loadparam) {
if(param_ncalbum_id) {
// zeige vorschau und ruf die rekursiv auf, damit in der playlist vorschau die buttons funktionieren
jQuery('#ncplaylist_preview').load(
'<?php echo Mage::getUrl('playlist/site/showplaylist',array()); ?>ncalbum_id/'+param_ncalbum_id+'/'+param_loadparam,
function() {
jQuery(document).ready(function($) {
jQuery('#ancplaylist_back').unbind("click").click(function(e){
e.preventDefault();
loadNcPlaylistPreview(param_ncalbum_id, '?show=back');
});
jQuery('#ancplaylist_next').unbind("click").click(function(e){
e.preventDefault();
loadNcPlaylistPreview(param_ncalbum_id, '?show=next');
});
});
}
);
// wenn schon eine playliste exisitert, dann aktualisiere sie auch
if(jQuery("#<?php echo $AncPlaylistInputId; ?>").attr('value')) {
jQuery('#ancnote-id').html('');
ajax_editplaylist(param_ncalbum_id, false);
}
// falls keine existiert, dann gib ne meldung das nach dem speichern eine existiert
else {
jQuery('#ancnote-id').html('<div class="anc-success">Sie können nach dem Übernehmen der Einstelungen mit Ihrem Smartphone den Qr-Code einscannen und sich Ihre mobile Internetseite ansehen.</div>');
}
} else {
jQuery('#ncplaylist_preview').html('');
}
}
</script>
<?php
/**
* @input Mage::app()->getRequest()->getParam('ncalbum_id') direkt dann muss eingeloggt
* oder
* @input Mage::app()->getRequest()->getParam('urlauth') dann holt er sich ncalbum_id über tabelle
*/
if($urlauth = Mage::app()->getRequest()->getParam('urlauth')) {
$ncplaylist_ncalbum = Mage::helper('anc_playlist/ncmodel')->getNcAlbumByUrlauth($urlauth);
$ncalbum_id = $ncplaylist_ncalbum->getId();
} else if($ncalbum_id = Mage::app()->getRequest()->getParam('ncalbum_id')) {
// $ncplaylist_ncalbum = Mage::getModel('anc_album/ncalbum')->load($ncalbum_id);
// $ncplaylist_ncalbum = Mage::helper('anc_lib/ncrights')->loadNcModel('anc_album/ncalbum', $ncalbum_id);
$ncplaylist_ncalbum = Mage::helper('anc_playlist/ncmodel')->getNcAlbumByAlbumId($ncalbum_id);
// D::show($ncimage, '$NcImageId: '.$NcImageId,1,1);
// D::compareFe($ncplaylist_ncalbum, $ncimage, '$ncplaylist_ncalbum, $ncimage',1,1);
} else {
exit;
}
//if(is_object($ncplaylist_ncalbum)) {
$NcImageId = Mage::getSingleton('checkout/session')->getNcImageId();
if($NcImageId >= 0) {
if(Mage::app()->getRequest()->getParam('show')=== 'next') {
$NcImageId++;
} else if(Mage::app()->getRequest()->getParam('show')=== 'back') {
$NcImageId--;
}
Mage::getSingleton('checkout/session')->setNcImageId($NcImageId);
$ncimage = Mage::helper('anc_playlist/ncmodel')->getOneNcImageFromNcAlbum($ncalbum_id, $NcImageId);
} else {
// $ncimage = Mage::helper('anc_playlist/ncmodel')->getOneNcImageFromNcAlbum($ncalbum_id);
$ncimage = Mage::helper('anc_playlist/ncmodel')->getOneNcImageFromNcAlbum($ncalbum_id, 0);
Mage::getSingleton('checkout/session')->setNcImageId(0);
}
//}
?>
<div class="ancplaylist-site_showplaylist">
<div class="ncheader">
<a href="<?php echo Mage::getUrl('',array()); ?>">
<img src="/skin/frontend/ancprintconfigproduct/default/images/logo.gif" />
</a>
</div>
<div class="nccontent">
<div class="ncimage">
<img src="<?php echo DS.Mage::helper('anc_image/ncimage')->getNcImagePath($ncimage['entity_id'], 'relative', 'original') ?>" />
</div>
</div>
<div class="ncmenu">
<a href="?show=back" id="ancplaylist_back">
<div class="ncleft">
<img src="/skin/frontend/ancprintconfigproduct/default/images/links_weiss_25x50.png" alt="weiter" />
</div>
</a>
<a href="?show=next">
<div class="ncright" id="ancplaylist_next">
<img src="/skin/frontend/ancprintconfigproduct/default/images/rechts_weiss_25x50.png" alt="zurück" />
</div>
</a>
</div>
</div>
<script type="text/javascript">
jQuery(document).ready(function($) {
var viewbox_height;
var viewbox_width;
if(jQuery('#ncplaylist_preview').length) {
viewbox_height = jQuery('#ncplaylist_preview').height();
viewbox_width = jQuery('#ncplaylist_preview').width();
} else {
viewbox_height = jQuery(window).height() ;
viewbox_width = jQuery(window).width();
}
jQuery('.ancplaylist-site_showplaylist').css({
'height': viewbox_height+'px',
'width' : viewbox_width+'px'
});
if(jQuery('.nccontent > .ncimage > img ').width() > jQuery('.nccontent > .ncimage > img ').height()) {
var img_css = {
'width': viewbox_width+'px'
}
} else {
var height = viewbox_height -jQuery('.ncheader').outerHeight() - jQuery('.ncmenu').outerHeight();
var height_klein = height - 30;
var img_css = {
'height': height_klein+'px'
}
}
console.log(img_css);
jQuery('.nccontent > .ncimage > img ').css(img_css);
console.log(jQuery('.nccontent > .ncimage > img '));
//
// var viewbox_height;
// if(jQuery('#ncplaylist_preview').length) {
// viewbox_height = jQuery('#ncplaylist_preview').height();
// } else {
// viewbox_height = jQuery(window).innerHeight() ;
// }
//// console.log('viewbox_height: '+viewbox_height);
//
//// var realarea = jQuery(window).innerHeight()
// var realarea = viewbox_height
// - jQuery('.ncheader').outerHeight()
// - jQuery('.ncmenu').outerHeight() ;
//// console.log(realarea+' <= '+jQuery('.nccontent ').outerHeight());
// if(realarea <= jQuery('.nccontent ').outerHeight()) {
// var factor = (realarea-12) / jQuery('.nccontent ').outerHeight();
// var new_width = Math.round(jQuery('.nccontent ').outerWidth() * factor);
//
// var img_css = {
// 'height': realarea+'px',
// 'width' : new_width+'px'
// }
//// console.log(img_css);
// jQuery('.nccontent > .ncimage > img ').css(img_css);
// }
//
// var area = realarea
// - jQuery('.nccontent ').outerHeight();
// var padding = Math.round(area/2)+'px';
//// console.log(area+' :: '+jQuery('.nccontent ').outerHeight());
// var css = {
// 'margin-top': padding,
// }
//// console.log(css);
// jQuery('.nccontent').css(css);
});
</script>
\ No newline at end of file
<?php
/**
* @input Mage::app()->getRequest()->getParam('ncalbum_id') direkt dann muss eingeloggt
* oder
* @input Mage::app()->getRequest()->getParam('urlauth') dann holt er sich ncalbum_id über tabelle
*/
if($urlauth = Mage::app()->getRequest()->getParam('urlauth')) {
$ncplaylist_ncalbum = Mage::helper('anc_playlist/ncmodel')->getNcAlbumByUrlauth($urlauth);
$ncalbum_id = $ncplaylist_ncalbum->getId();
} else if($ncalbum_id = Mage::app()->getRequest()->getParam('ncalbum_id')) {
// $ncplaylist_ncalbum = Mage::getModel('anc_album/ncalbum')->load($ncalbum_id);
// $ncplaylist_ncalbum = Mage::helper('anc_lib/ncrights')->loadNcModel('anc_album/ncalbum', $ncalbum_id);
$ncplaylist_ncalbum = Mage::helper('anc_playlist/ncmodel')->getNcAlbumByAlbumId($ncalbum_id);
// D::show($ncimage, '$NcImageId: '.$NcImageId,1,1);
// D::compareFe($ncplaylist_ncalbum, $ncimage, '$ncplaylist_ncalbum, $ncimage',1,1);
} else {
exit;
}
//if(is_object($ncplaylist_ncalbum)) {
$NcImageId = Mage::getSingleton('checkout/session')->getNcImageId();
if($NcImageId >= 0) {
if(Mage::app()->getRequest()->getParam('show')=== 'next') {
$NcImageId++;
} else if(Mage::app()->getRequest()->getParam('show')=== 'back') {
$NcImageId--;
}
Mage::getSingleton('checkout/session')->setNcImageId($NcImageId);
$ncimage = Mage::helper('anc_playlist/ncmodel')->getOneNcImageFromNcAlbum($ncalbum_id, $NcImageId);
} else {
// $ncimage = Mage::helper('anc_playlist/ncmodel')->getOneNcImageFromNcAlbum($ncalbum_id);
$ncimage = Mage::helper('anc_playlist/ncmodel')->getOneNcImageFromNcAlbum($ncalbum_id, 0);
Mage::getSingleton('checkout/session')->setNcImageId(0);
}
//}
?>
<div class="ancplaylist-site_showplaylist">
<div class="ncheader">
<a href="<?php echo Mage::getUrl('',array()); ?>">
<img src="/skin/frontend/ancprintconfigproduct/default/images/logo.gif" />
</a>
</div>
<div class="nccontent">
<div class="ncimage">
<img src="<?php echo DS.Mage::helper('anc_image/ncimage')->getNcImagePath($ncimage['entity_id'], 'relative', 'original') ?>" />
</div>
</div>
<div class="ncmenu">
<a href="?show=back" id="ancplaylist_back">
<div class="ncleft">
<img src="/skin/frontend/ancprintconfigproduct/default/images/links_weiss_25x50.png" alt="weiter" />
</div>
</a>
<a href="?show=next">
<div class="ncright" id="ancplaylist_next">
<img src="/skin/frontend/ancprintconfigproduct/default/images/rechts_weiss_25x50.png" alt="zurück" />
</div>
</a>
</div>
</div>
<script type="text/javascript">
jQuery(document).ready(function($) {
var viewbox_height;
if(jQuery('#ncplaylist_preview').length) {
viewbox_height = jQuery('#ncplaylist_preview').height();
} else {
viewbox_height = jQuery(window).innerHeight() ;
}
// console.log('viewbox_height: '+viewbox_height);
// var realarea = jQuery(window).innerHeight()
var realarea = viewbox_height
- jQuery('.ncheader').outerHeight()
- jQuery('.ncmenu').outerHeight() ;
// console.log(realarea+' <= '+jQuery('.nccontent ').outerHeight());
if(realarea <= jQuery('.nccontent ').outerHeight()) {
var factor = (realarea-12) / jQuery('.nccontent ').outerHeight();
var new_width = Math.round(jQuery('.nccontent ').outerWidth() * factor);
var img_css = {
'height': realarea+'px',
'width' : new_width+'px'
}
// console.log(img_css);
jQuery('.nccontent > .ncimage > img ').css(img_css);
}
var area = realarea
- jQuery('.nccontent ').outerHeight();
var padding = Math.round(area/2)+'px';
// console.log(area+' :: '+jQuery('.nccontent ').outerHeight());
var css = {
'margin-top': padding,
}
// console.log(css);
jQuery('.nccontent').css(css);
});
</script>
\ No newline at end of file
<?xml version="1.0"?>
<config>
<modules>
<Anc_Playlist>
<active>true</active>
<codePool>local</codePool>
</Anc_Playlist>
</modules>
</config>
\ No newline at end of file
/*
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
*/
/*
Created on : 14.08.2014, 12:04:36
Author : neumann
*/
body {
/* max-width: 720px;
max-height: 1280px;*/
height:100%;
width:100%;
/* min-width: 320px;
min-height: 480px;*/
min-width: 240px;
min-height: 320px;
margin: 0px;
padding: 0px;
}
.ancplaylist-site_showplaylist {
/*display: table;*/
}
.ancplaylist-site_showplaylist > div {
/*display: table-row;*/
width:100%;
}
.ancplaylist-site_showplaylist > .ncheader {
height:50px;
}
.ancplaylist-site_showplaylist > .ncheader > a > img {
width:30%;
/*height:40px;*/
float: right;
margin: 5px;
}
.ancplaylist-site_showplaylist > .nccontent {
margin:0;
padding:0;
}
.ancplaylist-site_showplaylist > .nccontent > .ncimage {
text-align: center;
margin:0;
padding:0;
}
.ancplaylist-site_showplaylist > .nccontent > .ncimage > img {
/*width:100%;*/
margin:0;
padding:0;
}
.ancplaylist-site_showplaylist > .ncmenu {
position:absolute;
bottom:0;
/* height:60px;*/
height:10%;
}
.ancplaylist-site_showplaylist > .ncmenu * div {
width:49%;
background-color: #5EBD00;
/*height:60px;*/
text-align: center;
height:100%;
}
.ancplaylist-site_showplaylist > .ncmenu * .ncleft {
float : left;
}
.ancplaylist-site_showplaylist > .ncmenu * .ncright {
float: right;
}
.ancplaylist-site_showplaylist > .ncmenu * div > img {
/* height: 40px;*/
padding-top: 5%;
padding-bottom: auto;
height:70%;
display:inline-block;
}
/*
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
*/
/*
Created on : 14.08.2014, 12:04:36
Author : neumann
*/
body {
/* max-width: 720px;
max-height: 1280px;*/
height:100%;
width:100%;
/* min-width: 320px;
min-height: 480px;*/
min-width: 240px;
min-height: 320px;
margin: 0px;
padding: 0px;
}
.ancplaylist-site_showplaylist {
/*display: table;*/
}
.ancplaylist-site_showplaylist > div {
/*display: table-row;*/
width:100%;
}
.ancplaylist-site_showplaylist > .ncheader {
height:50px;
}
.ancplaylist-site_showplaylist > .ncheader > a > img {
width:30%;
/*height:40px;*/
float: right;
margin: 5px;
}
.ancplaylist-site_showplaylist > .nccontent {
margin:0;
padding:0;
}
.ancplaylist-site_showplaylist > .nccontent > .ncimage {
text-align: center;
margin:0;
padding:0;
}
.ancplaylist-site_showplaylist > .nccontent > .ncimage > img {
width:100%;
margin:0;
padding:0;
}
.ancplaylist-site_showplaylist > .ncmenu {
position:absolute;
bottom:0;
/* height:60px;*/
height:10%;
}
.ancplaylist-site_showplaylist > .ncmenu * div {
width:49%;
background-color: #5EBD00;
/*height:60px;*/
text-align: center;
height:100%;
}
.ancplaylist-site_showplaylist > .ncmenu * .ncleft {
float : left;
}
.ancplaylist-site_showplaylist > .ncmenu * .ncright {
float: right;
}
.ancplaylist-site_showplaylist > .ncmenu * div > img {
/* height: 40px;*/
padding-top: 5%;
padding-bottom: auto;
height:70%;
display:inline-block;
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!