Commit bcea48eb by netz.coop

AncText GPL initial

0 parents
Showing with 4848 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
Magento Extension ist abhängig von weiteren Extensions!
select "-- AncText lösche Datenbank Tabellen";
select "-- lösche mag_core_resource / anc_text_setup";
DELETE FROM `mag_core_resource` WHERE `mag_core_resource`.`code` = 'anc_text_setup';
select "-- lösche mag_anc_text_album";
DROP TABLE mag_anc_text_album;
select "-- lösche mag_anc_text_album_list";
DROP TABLE mag_anc_text_album_list;
select "-- lösche mag_anc_text_nctext";
DROP TABLE mag_anc_text_nctext;
select "-- lösche mag_anc_text_nctext_quoteitemoption";
DROP TABLE mag_anc_text_nctext_quoteitemoption;
\ No newline at end of file
#!/bin/bash
APPBASE="Anc"
APPNAME="Text"
APPBASELC="anc"
APPNAMELC="text"
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/texts/${APPBASELC}" ];then
echo "*** Erstelle das Verzeichniss: $1/skin/frontend/base/default/texts/${APPBASELC}"
mkdir -p "$1/skin/frontend/base/default/texts/${APPBASELC}"
fi
if [ ! -d "$1/skin/frontend/base/default/texts/${APPBASELC}/${APPNAMELC}" ];then
echo "*** Verlinke Verzeichniss: $APPDIR/js $1/skin/frontend/base/default/texts/${APPBASELC}/${APPNAMELC}"
ln -s $APPDIR/skin/frontend/texts $1/skin/frontend/base/default/texts/${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_text
* @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_Text_Block_Adminhtml_Admingallery extends Mage_Core_Block_Template{
// public function __construct() {
// echo 'halloo';
// }
/**
* gibt eingeloggten Benutzer zurück
*
* @return type
*/
public function getCustomer() {
return Mage::getSingleton('customer/session')->getCustomer();
}
/**
*
* @return Collection
*/
public function getNcTexts() {
$params=$this->getRequest()->getParams();
return Mage::helper('anc_text/ncmodel')->getNcTextsForAlbum($params['id']);
// return Mage::helper('anc_text/ncmodel')->getNcTextsForCustomer();
}
/**
*
*/
public function getCallNcText() {
$params=$this->getRequest()->getParams();
$nctext = Mage::helper('anc_text/ncmodel')->getNcText($params['id']);
return $nctext;
}
public function getNcTextMetaData($param_nctext_id) {
return Mage::helper('anc_text/ncmodel')->getNcTextMetaData($param_nctext_id);
}
protected function getNcTextPath($param_nctext_id) {
return Mage::helper('anc_text/nctext')->getNcTextPath($param_nctext_id, 'relative', 'original');
}
// existiert _toHtml() wird das template gar nicht erst mehr aufgerufen
// protected function _toHtml()
// {
// return 'Hallo Welt!';
// }
}
<?php
/**
* @package anc_text
* @category magento
* @mailto code [at] netz.coop
* @since 20140416
* @author netz.coop eG*
* @copyright (c) 2014, netz.coop eG
*
* @anc_text_eingabetyp - _Block_Adminhtml_ -
* @eingabetyp_Redundanz Achtung!!! weitere Extensions die davon betroffen sind und selben Inhalt benötigen!!!!: AncImage, AncPlaylist, AncAddressimport
*
* 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_Text_Block_Adminhtml_Catalog_Product_Edit_Tab_Options_Option
extends Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Options_Option
{
/**
* Class constructor
*/
public function __construct()
{
// D::li('Anc_Text_Block_Adminhtml_Catalog_Product_Edit_Tab_Options_Option');
parent::__construct();
$this->setTemplate('anc/text/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_text
* @category magento
* @mailto code [at] netz.coop
* @since 20140416
* @author netz.coop eG*
* @copyright (c) 2014, netz.coop eG
*
*
* @anc_text_eingabetyp - _Block_Adminhtml_ Formular im Backend beim Produkt editieren
*
*
* 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_Text_Block_Adminhtml_Catalog_Product_Edit_Tab_Options_Type_Anctext extends
Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Options_Type_Abstract
{
public function __construct()
{
parent::__construct();
// D::li('Anc_Text_Block_Adminhtml_Catalog_Product_Edit_Tab_Options_Type_Anctext',1,1);
$this->setTemplate('anc/text/catalog/product/edit/options/type/anctext.phtml');
}
}
\ No newline at end of file
<?php
/**
* @package anc_text
* @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_Text_Block_Adminhtml_Texts extends Mage_Adminhtml_Block_Widget_Grid_Container {
public function __construct() {
//where is the controller
$this->_controller = 'adminhtml_texts';
$this->_blockGroup = 'anc_text';
$this->_headerText = Mage::helper('anc_text/data')->__('Texte');
// //value of the add button
$this->_addButtonLabel = Mage::helper('anc_text/data')->__('Texte erstellen');
parent::__construct();
}
public function getCreateUrl()
{
$varParam = $this->getRequest()->getParams();
if (array_key_exists('albumid', $varParam)) {
$var_album= '/albumid/'.$varParam['albumid'];
}
/**
* Wichtig für Add Button
*/
return $this->getUrl(
'text/adminhtml_text/edit'.$var_album
);
}
}
<?php
/**
* @package anc_text
* @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_Text_Block_Adminhtml_Texts_Edit
extends Mage_Adminhtml_Block_Widget_Form_Container
{
public function __construct()
{
parent::__construct();
$this->_controller = 'texts';
$this->_blockGroup = 'anc_text_adminhtml';
$this->_addButton('saveandcontinue', array(
'label' => Mage::helper('adminhtml')->__('Speichern und Bearbeitung fortsetzen'),
'onclick' => 'saveAndContinueEdit()',
'class' => 'save',
), -100);
$this->_updateButton('save', 'label', $this->__('Save'));
$varparams = $this->getRequest()->getParams();
$this->_updateButton('delete', 'label', $this->__('Delete'));
if($varparams['albumid']){
$data = array(
'label' => 'Zurück zum Album',
'onclick' => 'setLocation(\'' . $this->getUrl('*/*/list',array('albumid'=>$varparams['albumid'])) . '\')',
'class' => 'back'
);
}else{
$data = array(
'label' => 'Zurück',
'onclick' => 'setLocation(\'' . $this->getUrl('*/*/list') . '\')',
'class' => 'back'
);
}
$this->addButton ('my_back', $data, 0, 100, 'header');
$this->_removeButton('back');
$this->_formScripts[] = "
function saveAndContinueEdit(){
editForm.submit($('edit_form').action+'back/edit/');
}
";
}
public function getHeaderText()
{
return Mage::helper('anc_album/data')->__('Album Container');
}
}
\ No newline at end of file
<?php
/**
* @package anc_text
* @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_Text_Block_Adminhtml_Texts_Edit_Form extends Mage_Adminhtml_Block_Widget_Form {
protected function _prepareForm() {
//echo 'test3';
if (Mage::registry('anc_text')) {
$data = Mage::registry('anc_text')->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();
}
}
\ No newline at end of file
<?php
/**
* @package anc_text
* @category magento
* @mailto code [at] netz.coop
* @since 20140416
* @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_Text_Block_Adminhtml_Texts_Edit_Tab_Content extends Mage_Adminhtml_Block_Widget_Form {
protected function _prepareForm() {
if (Mage::registry('anc_text')) {
$data = Mage::registry('anc_album')->getData();
} else {
$data = array();
}
$form = new Varien_Data_Form();
$this->setForm($form);
$fieldset = $form->addFieldset('anc_album', array('name' => 'Info'));//Mage::helper('news')->__('news information')));
$form->setValues($data);
return parent::_prepareForm();
}
}
<?php
/**
* @package anc_text
* @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_Text_Block_Adminhtml_Texts_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
protected function _prepareForm() {
$admin_id = Mage::getSingleton('admin/session')->getUser()->getId();
if (Mage::registry('anc_text')) {
$data = Mage::registry('anc_text')->getData();
} else {
$data = array();
}
if (strpos($data['path'], "/media/") === 0) {
$data['path'] = substr($data['path'], 7);
$data['path'] = dirname($data['path']) . '/';
}
$varParam = $this->getRequest()->getParams();
// D::s($data,'data',5,1,1);
$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'
));
$this->setForm($form);
$fieldset = $form->addFieldset('anc_text', array('name' => 'name')); //Mage::helper('news')->__('news information')));
// D::s($data,'$data',5,1,1);
if ($data['path'] && $data['file']) {
// echo '<img src="' . $data['path'] . $data['file'] . '" alt = "' . $data['file'] . '" />';
}
$fieldset->addField('name', 'text', array(
'label' => Mage::helper('anc_text/data')->__('Name'),
// 'class' => 'required-entry',
'required' => false,
'name' => 'name',
));
$fieldset->addField('comment', 'textarea', array(
'label' => Mage::helper('anc_text/data')->__('Comment'),
// 'class' => 'required-entry',
'required' => false,
'name' => 'comment',
));
$fieldset->addField('content', 'textarea', array(
'label' => Mage::helper('anc_text/data')->__('Text'),
// 'class' => 'required-entry',
'required' => false,
'name' => 'content',
));
if ($varParam['kind'] === 'users' || $data['customer_id'] > 0) {
$fieldset->addField('customer_id', 'text', array(
'label' => Mage::helper('anc_album/data')->__('Customer Id'),
'class' => 'required-entry',
'required' => true,
'name' => 'customer_id',
));
}
// $fieldset->addField('path', 'text', array(
// 'label' => Mage::helper('anc_text/data')->__('Pfad'),
// 'value' => 'anc/text/admin/' . $admin_id . '/original/',
// 'class' => 'required-entry',
// 'required' => true,
// 'name' => 'path',
// ));
// $fieldset->addField('file', 'text', array(
// 'label' => Mage::helper('anc_text/data')->__('Datei'),
// 'class' => 'required-entry',
// 'required' => true,
// 'name' => 'file',
// ));
$array = Mage::helper('anc_lib/sql')->selectFetchAll(
'anc_album_ncalbum');
// D::s($array,'$array',5,1,1);
$arrayoptions = array('-1' => 'Bitte wählen..');
foreach ($array as $key => $value) {
$arrayoptions[$value['entity_id']] = $value['name'];
}
// $testarray=array('-1'=>'Please Select..','1' => 'Option1','2' => 'Option2', '3' => 'Option3');
// D::s($arrayoptions,'$array',5,1,1);
// D::s($testarray,'$testarray',5,1,1);
// $varParam = $this->getRequest()->getParams();
if (array_key_exists('albumid', $varParam)) {
$var_album_id = $varParam['albumid'];
}
$fieldset->addField('ncalbum_id', 'select', array(
'label' => Mage::helper('anc_album/data')->__('Album'),
'class' => 'required-entry',
'required' => true,
'name' => 'ncalbum_id',
'onclick' => "",
'onchange' => "",
'value' => $var_album_id,
'values' => $arrayoptions,
'disabled' => false,
'readonly' => false,
));
// $arrayoptionsViG=array(
// 0 => 'Nein',
// 1=>'Ja'
// );
//
// $fieldset->addField('visibleingallery', 'select', array(
// 'label' => Mage::helper('anc_album/data')->__('Sichtbar in Galerie'),
// 'class' => 'required-entry',
// 'required' => true,
// 'name' => 'visibleingallery',
// 'onclick' => "",
// 'onchange' => "",
// 'value' => 1,
// 'values' => $arrayoptionsViG,
// 'disabled' => false,
// 'readonly' => false,
// ));
$fieldset->addField('ispersonalized', 'radios', array(
'label' => Mage::helper('anc_album/data')->__('Personalisiert'),
'name' => 'ispersonalized',
'onclick' => "",
'onchange' => "",
'value' => '1',
'values' => array(
array('value' => '1', 'label' => 'Ja'),
array('value' => '0', 'label' => 'Nein'),
),
'disabled' => false,
'readonly' => false,
'tabindex' => 1
));
// $varurlplaylists = $this->getUrl('site/adminhtml_playlist/list', array('id' => $data['entity_id'],));
$arrayurl = array('textid' => $data['entity_id']);
if ($data['ncright_id'] > 0) {
$arrayurl['id'] = $data['ncright_id'];
}
$varurlrights = $this->getUrl('lib/adminhtml_ncrights/edit', $arrayurl
);
$fieldset->addType('ancbutton', 'Anc_Album_Lib_Varien_Data_Form_Element_ExtendedLabel');
if($varParam['id']){
$fieldset->addField('myrights', 'ancbutton', array(
'label' => 'Rechte verwalten',
'name' => 'myrights',
'required' => false,
'value' => $varurlrights,
'bold' => true,
'label_style' => '',
));
}
// $fieldset->addField('mysaveandcontinue', 'ancbutton', array(
// 'label' => 'Speichern und weiter bearbeiten',
// 'name' => 'mysaveandcontinue',
// 'required' => false,
// 'value' => $this->getUrl('*/*/save', array( '_current' => true, 'back' => 'edit',)),
// 'bold' => true,
// 'label_style' => '',
// ));
// $fieldset->addField('linkrights', 'link', array(
// 'label' => "zu:",
// 'style' => "test",
// 'href' => $this->getUrl('site/adminhtml_playlist/list', array('id' => $data['entity_id'],)),
// 'value' => 'Rechte verwalten',
// 'name' => 'linkrights',
// 'after_element_html' => ''
// ));
/**
* Setzen der Hidden Id für Admin muss über den $data array erfolgen da sonst Magento für neue Elemente 0 setzt
*/
if ($varParam['kind'] === 'users' || $data['customer_id'] > 0) {
} else {
$data['admin_user_id'] = $admin = Mage::getSingleton('admin/session')->getUser()->getId();
$fieldset->addField('admin_user_id', 'hidden', array('name' => 'admin_user_id'));
}
if ($varParam['albumid'] === 'users' || $data['customer_id'] > 0) {
} else {
$data['albumid'] = $varParam['albumid'];
$fieldset->addField('albumid', 'hidden', array('name' => 'albumid'));
}
// D::s($data,'$data',5,1,1);
// $data['path']= 'media/serviceplus/image/';
// $fieldset->addField('file', 'text', array(
// 'label' => Mage::helper('anc_album/data')->__('Upload'),
// 'required' => false,
//// 'value' => 'media/serviceplus/image/'.$data['file'],
// 'name' => 'file',
//// 'path'=> 'media/serviceplus/text/',
//// 'disabled' => false,
//// 'readonly' => true,
// 'after_element_html' => $data['file'],
//// 'tabindex' => 1
// ));
if (!empty($data)) {
$form->addValues($data);
}
/*
* Damit das Bild als preview angezeigt wird
*/
// $p = $form->getElement('file')->getValue();
// $form->getElement('file')->setValue($data['path'] . $p);
return parent::_prepareForm();
}
}
<?php
/**
* @package anc_text
* @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_Text_Block_Adminhtml_Texts_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs {
public function __construct() {
parent::__construct();
$this->setId('texts_edit_tabs');
$this->setDestElementId('edit_form'); // this should be same as the form id define above
$this->setTitle('Texts');
// echo 'a';
}
protected function _beforeToHtml() {
$this->addTab(
'form_section', array(
'label' => Mage::helper('anc_text/data')->__('Texts Info'),//'Texts Info', // Mage::helper('news')->__('News Information'),
'title' => Mage::helper('anc_text/data')->__('Texts Info'),//'Texts Info', //Mage::helper('news')->__('News Information'),
'content' => $this->getLayout()->createBlock('anc_text/adminhtml_texts_edit_tab_form')->toHtml(),
'active' => true,
)
);
// $this->addTab('form_section1', array(
// 'label' => Mage::helper('anc_text/data')->__('Texts Extras'),//'Texts Extras', //Mage::helper('news')->__('Content'),
// 'title' => Mage::helper('anc_text/data')->__('Texts Extras'),//'Texts Extras', //Mage::helper('news')->__('Content'),
//// 'content' => $this->getLayout()->createBlock('anc_text/adminhtml_images_edit_tab_content')->toHtml(),
// ));
return parent::_beforeToHtml();
}
}
<?php
/**
* @package anc_text
* @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_Text_Block_Adminhtml_Texts_Grid extends Mage_Adminhtml_Block_Widget_Grid {
public function __construct() {
parent::__construct();
$this->setId('anc_text_texts_grid');
$this->setDefaultSort('entity_id');
$this->setDefaultDir('DESC');
$this->setSaveParametersInSession(true);
}
protected function _getCollectionClass() {
return 'anc_text/nctext';
}
protected function _prepareCollection() {
$varParam = $this->getRequest()->getParams();
if (array_key_exists('albumid', $varParam)) {
$array = Mage::helper('anc_lib/sql')->selectFetchAll(
'anc_album_ncalbum', array('entity_id' => $varParam['albumid'])
);
echo "<h1>Texte des Albums: " . $array[0]['name'] . " </h1>";
$collection = Mage::getModel('anc_text/nctext')->getCollection()->addFieldToFilter('ncalbum_id', array('eq' => $varParam['albumid']));
;
} else if(array_key_exists('kind', $varParam)&& $varParam['kind']=='users') {
echo "<h1>Alle Texte der Benutzer: </h1>";
echo '<a href="'.$this->getUrl('text/adminhtml_text/list', array('kind' => 'admin',)).'" >Texte Admin</a>';
$collection = Mage::getModel('anc_text/nctext')->getCollection()->addFieldToFilter('customer_id', array('gt' => 0))->addFieldToFilter('ordered', array('null' => true));
;
} else {
echo "<h1>Alle Texte der Administratoren: </h1>";
echo '<a href="'.$this->getUrl('text/adminhtml_text/list', array('kind' => 'users',)).'" >Texte der Benutzer</a>';
$collection = Mage::getModel('anc_text/nctext')->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_text/data')->__('Id'),
'align' => 'right',
'width' => '50px',
'index' => 'entity_id',
));
$this->addColumn('name', array(
'header' => Mage::helper('anc_text/data')->__('Name'),
'align' => 'left',
'index' => 'name',
));
$this->addColumn('comment', array(
'header' => Mage::helper('anc_text/data')->__('Comment'),
'align' => 'left',
'index' => 'comment',
));
$this->addColumn('content', array(
'header' => Mage::helper('anc_text/data')->__('Text'),
'align' => 'left',
'index' => 'content',
));
$this->addColumn('admin_user_id', array(
'header' => Mage::helper('anc_text/data')->__('Admin'),
'align' => 'left',
'index' => 'admin_user_id',
));
$this->addColumn('customer_id', array(
'header' => Mage::helper('anc_text/data')->__('Customer'),
'align' => 'left',
'index' => 'customer_id',
));
// $this->addColumn('path', array(
// 'header' => Mage::helper('anc_text/data')->__('Pfad'),
// 'align' => 'left',
// 'index' => 'path',
// ));
// $this->addColumn('file', array(
// 'header' => Mage::helper('anc_text/data')->__('Datei'),
// 'align' => 'left',
// 'index' => 'file',
// ));
$this->addColumn('ncalbum_id', array(
'header' => Mage::helper('anc_text/data')->__('Album Id'),
'align' => 'left',
'index' => 'ncalbum_id',
));
$this->addColumn('ncright_id', array(
'header' => Mage::helper('anc_text/data')->__('Rechte Id'),
'align' => 'left',
'index' => 'ncright_id',
));
$this->addColumn('original_id', array(
'header' => Mage::helper('anc_text/data')->__('Eltern Id'),
'align' => 'left',
'index' => 'original_id',
));
$this->addColumn('visibleingallery', array(
'header' => Mage::helper('anc_text/data')->__('Sichtbar'),
'align' => 'left',
'index' => 'visibleingallery',
));
$this->addColumn('used_byitem_id', array(
'header' => Mage::helper('anc_text/data')->__('Produkt ID'),
'align' => 'left',
'index' => 'used_byitem_id',
));
$this->addColumn('ispersonalized', array(
'header' => Mage::helper('anc_text/data')->__('Personalisiert'),
'align' => 'left',
'index' => 'ispersonalized',
));
$this->addColumn('created_at', array(
'header' => Mage::helper('anc_text/data')->__('Created'),
'align' => 'left',
'index' => 'created_at',
));
$this->addColumn('updated_at', array(
'header' => Mage::helper('anc_text/data')->__('Updated'),
'align' => 'left',
'index' => 'updated_at',
));
return parent::_prepareColumns();
}
public function getRowUrl($row) {
$varParam = $this->getRequest()->getParams();
if (array_key_exists('albumid', $varParam)) {
// $var_album= '/albumid/'.$varParam['albumid'];
return $this->getUrl('*/*/edit', array('id' => $row->getId(),'albumid'=>$varParam['albumid']));
}else{
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
}
}
public function getMainButtonsHtml()
{
$html = parent::getMainButtonsHtml();//get the parent class buttons
$addButton = $this->getLayout()->createBlock('adminhtml/widget_button') //create the add button
->setData(array(
'label' => Mage::helper('adminhtml')->__('Kunden Text erstellen'),
'onclick' => "setLocation('".$this->getUrl('*/*/new',array('kind'=>'users'))."')",
'class' => 'task'
))->toHtml();
return $addButton.$html;
}
}
<?php
/**
* @package anc_text
* @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_Text_Block_Catalog_Product_View_Options_Type_Anctext
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_text
* @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_Text_Block_Galleriesmanager extends Mage_Core_Block_Template{
/**
* gibt eingeloggten Benutzer zurück
*
* @return type
*/
public function getCustomer() {
return Mage::getSingleton('customer/session')->getCustomer();
}
/**
*
* @return Collection
*/
public function getNcTexts() {
return Mage::helper('anc_text/ncmodel')->getNcTextsForCustomer();
}
public function getCallNcText() {
$params=$this->getRequest()->getParams();
$nctext = Mage::helper('anc_text/ncmodel')->getNcText($params['id']);
return $nctext;
}
public function getNcTextMetaData($param_nctext_id) {
return Mage::helper('anc_text/ncmodel')->getNcTextMetaData($param_nctext_id);
}
protected function getNcTextPath($param_nctext_id) {
return Mage::helper('anc_text/nctext')->getNcTextPath($param_nctext_id, 'relative', 'original');
}
}
<?php
/**
* @package anc_text
* @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_Text_Block_Options_Type_Customview_Anctext
extends Mage_Core_Block_Template
{
protected $_template = 'anc/text/options/customview/anctext.phtml';
}
\ No newline at end of file
<?php
/**
* @package anc_text
* @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_Text_Helper_Data extends Mage_Core_Helper_Abstract {
}
\ No newline at end of file
<?php
/**
* @package anc_text
* @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_Text_Helper_Ncconstant extends Mage_Core_Helper_Abstract {
/**
*
* @const SVGModul Bild - Individuelle Option NcText > Bild
*/
private $ancSPText = 'ancSPText_KEY';
private $AncSPTextOptionSku = 'ancSPText_KEY_ownText';
private $ancSPAncText_Size = 10;
/**
* @const SVGModul Bild
*/
private $ancSPImage = 'ancSPImage_KEY';
private $ancSPImage_KEY_cropH = 'ancSPImage_KEY_cropH';
private $ancSPImage_KEY_cropW = 'ancSPImage_KEY_cropW';
private $ancSPImage_KEY_imgH = 'ancSPImage_KEY_imgH';
private $ancSPImage_KEY_imgW = 'ancSPImage_KEY_imgW';
private $ancSPImage_KEY_imgInitH = 'ancSPImage_KEY_imgInitH';
private $ancSPImage_KEY_imgInitW = 'ancSPImage_KEY_imgInitW';
private $ancSPImage_KEY_imgX1 = 'ancSPImage_KEY_imgX1';
private $ancSPImage_KEY_imgY1 = 'ancSPImage_KEY_imgY1';
private $ancSPImage_KEY_cropfile = 'ancSPImage_KEY_cropfile';
// D::ulli('<br> #SKU: '.$param_product->getSku().' Text: '.Mage::helper('anc_text/ncconstant')->ancSPText,1,1);
/**
*
* @const SVGModul Bild - Individuelle Option NcImage > Bild
*/
private $ancSPAncImage = 'ancSPImage_KEY_ancimage';
private $ancSPAncImage_Size = 10;
public function __get($name) {
return $this->$name;
}
public function isProductAncText(Mage_Catalog_Model_Product $param_product) {
if(is_object($param_product)) {
if (strpos($param_product->getSku(), Mage::helper('anc_text/ncconstant')->ancSPText) !== false) {
return true;
}
}
return false;
}
}
<?php
/**
* @package anc_text
* @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_Text_Helper_Ncmodel extends Mage_Core_Helper_Abstract {
/**
* cache für anc_text/nctext models
* @var array
*/
private $NcTexts = array();
/**
* gibt zurück wie oft das bild schon für den kauf verwendet wurde
*
* @param int $param_nctext_id
* @return Anc_Text_Model_Resource_Mysql4_Nctext_Quoteitemoption_Collection
*/
public function getNcTextMetaData($param_nctext_id) {
$collection = Mage::getModel('anc_text/nctext_quoteitemoption')->getCollection();
$Quoteitemoption_Collection = $collection->addFieldToFilter('nctext_id', $param_nctext_id);
return $Quoteitemoption_Collection;
}
/**
*
* @param int $param_nctext_id
* @return anc_text/nctext
*/
public function getNcText($param_nctext_id) {
if ($param_nctext_id) {
if (!array_key_exists($param_nctext_id, $this->NcTexts)) {
$nctext = Mage::helper('anc_lib/ncrights')->loadNcModel('anc_text/nctext', $param_nctext_id);
$this->NcTexts[$param_nctext_id] = $nctext;
}
return $this->NcTexts[$param_nctext_id];
} else {
return false;
}
}
public function createNCNew() {
$customer = Mage::getSingleton('customer/session')->getCustomer()->getId();
$textdata= array();
$textdata['customer_id'] = $customer;
$var_albums = Mage::helper('anc_album/ncmodel')->getNcAlbumsForCustomer()->getData();
if (!$var_albums[0]) {
$albumid = Mage::helper('anc_album/ncmodel')->createNcAlbumForCustomer();
$var_albums = Mage::helper('anc_album/ncmodel')->getNcAlbumsForCustomer()->getData();
} else {
$albumid = $var_albums[0]['entity_id'];
}
$textdata['ncalbum_id'] = $albumid;
$textdata['name']='Neuer Text';
$textdata['content']=' ';
try {
$model = Mage::getModel('anc_text/nctext');
$model->setData($textdata);
$model->save();
} catch (Exception $e) {
// D::show($e->getMessage());
}
return $model->getId();
}
public function prepareSaveNcText(array $param_save, array $original_item = null) {
$params = Mage::app()->getRequest()->getParams();
$var_controller= Mage::app()->getRequest()->getControllerName();
$var_action =Mage::app()->getRequest()->getActionName();
$var_getRequest =Mage::app()->getRequest();
/**
*
*
* HIER GET PARAMS
*
*/
$new = false;
$customer = Mage::getSingleton('customer/session')->getCustomer();
$textdata = array();
if ($param_save['ncinput_id'] > 0) {
$textdata['entity_id'] = $param_save['ncinput_id'];
} else {
$new = true;
}
if ($param_save['special'] === 'custemerbe') {
} else {
if ($param_save['option_id'] != $param_save['used_byitem_id']) {
$new = true;
unset($textdata['entity_id']);
}
if ($param_save['option_id']) {
$textdata['used_byitem_id'] = $param_save['option_id'];
}
}
$textdata['customer_id'] = $customer->getId();
$textdata['admin_user_id'] = 0;
D::s($params,'$params',5,1);
D::s($param_save,'$param_save',5,1);
D::s($var_getRequest,'$var_getRequest',5,1);
if ($param_save['varcontent'] && $param_save['varcontent'] != $original_item['varcontent']) {
/**
* Speichere veränderten neu ab mit neuer idtext ab
*/
$textdata['content'] = $param_save['varcontent'];
if($param_save['ordered']== 1 || key_exists('option_id', $param_save) && $param_save['option_id'] > 0){
$new = true;
unset($textdata['entity_id']);
unset($textdata['ordered']);
}
} else {
// return $textdata['ncinput_id'];
}
if ($param_save['admin_user_id'] > 0) {
$textdata['original_id'] = $param_save['original_id'];
$new = true;
unset($textdata['entity_id']);
}
if ($param_save['album_id']) {
$textdata['ncalbum_id'] = $param_save['album_id'];
} else {
// return;
}
$textdata['visibleingallery'] = 0;
$textdata['admin_user_id'] = '0';
if ($param_save['name']) {
$textdata['name'] = $param_save['name'];
} else {
$textdata['name'] = 'Text ' . $customer->getName() . ' ID ' . $customer->getId();
}
if ($param_save['comment']) {
$textdata['comment'] = $param_save['comment'];
}
$textdata['url_rewrite'] = 'kundenalbum' . $customer->getId();
$textdata['isplaylist'] = 0;
$textdata['iscategory'] = 0;
$model = Mage::getModel('anc_text/nctext');
if ($new) {
try {
$model->setData($textdata);
$model->save();
} catch (Exception $e) {
// D::show($e->getMessage());
}
} else {
$model->load($textdata['entity_id'])->addData($textdata);
try {
$model->setId($textdata['entity_id'])->save();
} catch (Exception $e) {
// D::show($e->getMessage());
}
}
return $model->getId();
}
public function getNcTextsForCustomer() {
$customer = Mage::getSingleton('customer/session')->getCustomer();
$param_arrayFields = array(
'customer_id',
'ordered'
);
$param_arrayContent = array(
array('eq' => $customer->getId()),
array('null' => true)
);
return Mage::helper('anc_lib/ncrights')->getNcModelsByOneFilter('anc_text/nctext', $param_arrayFields, $param_arrayContent);
}
public function getNcTextsForAlbum($param_album_id, array $param_filter=null,array $param_content=null) {
if($param_filter&&$param_content){
return Mage::helper('anc_lib/ncrights')->getNcModelsByOneFilter('anc_text/nctext', $param_filter, $param_content);
}else{
return Mage::helper('anc_lib/ncrights')->getNcModelsByOneFilter('anc_text/nctext', 'ncalbum_id', $param_album_id);
}
}
public function saveNcText(Anc_Text_Model_Nctext $param_nctext) {
if (is_object($param_nctext)) {
$param_nctext->save();
$this->NcTexts[$param_nctext->getId()] = $param_nctext;
return $this->NcTexts[$param_nctext->getId()];
} else {
return false;
}
}
public function deleteNcText(Anc_Text_Model_Nctext $param_nctext) {
if (is_object($param_nctext)) {
$customer = Mage::getSingleton('customer/session')->getCustomer();
if ($customer->getId() && $customer->getId() === $param_nctext->getCustomerId()) {
Mage::helper('anc_text/ncmodel')->deleteNcTextFiles($param_nctext);
$param_nctext->delete();
return true;
} else {
return false;
}
} else {
return false;
}
}
public function deleteNcTextFiles(Anc_Text_Model_Nctext $param_nctext) {
if (is_object($param_nctext)) {
$customer = Mage::getSingleton('customer/session')->getCustomer();
if ($customer->getId() && $customer->getId() === $param_nctext->getCustomerId()) {
mcFile::deleteFile(Mage::helper('anc_lib/ncfilepath')->getThisMagentoInstallationPath() . $param_nctext->getPath());
return true;
} else {
return false;
}
} else {
return false;
}
}
public function getBlancoNcTextQuoteitemoption() {
return Mage::getModel('anc_text/nctext_quoteitemoption');
}
}
<?php
/**
* @package anc_text
* @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_Text_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
* @return type
*/
private $editTextNoodeParentId='';
public function editTextSVG(DOMNode $domel, $p_parentitemId, $MagentoID) {
/**
* anc_text ....
*/
if (true) {
$ChildrenItemIds = Mage::helper('anc_printconfigproduct/cart')->getChildrenItemIds($p_parentitemId, $MagentoID);
$nctext_id = Mage::helper('anc_lib/quoteitem')->getItemProductOptionByOptionSku($ChildrenItemIds[0], Mage::helper('anc_text/ncconstant')->AncSPTextOptionSku);
$nctext = Mage::helper('anc_text/ncmodel')->getNcText($nctext_id);
$domtags = $domel->getElementsByTagName(Mage::helper('anc_printconfigproduct/constant')->get('ancpcpSVGEditTagText'));
foreach ($domtags as $domtag) {
if ($nctext['content']) {
$p_where = array("option_id" => $nctext_id);
$varoptionser = Mage::helper('anc_lib/sql')->selectFetchOne("type", "catalog_product_option", $p_where);
if ($domtag->nodeName == Mage::helper('anc_printconfigproduct/constant')->get('ancpcpSVGEditTagText')&& $domtag->parentNode->getAttribute('MagentoID')==$MagentoID) {
$value_tmp = Mage::helper('anc_printconfigproduct/xml')->replaceinCalnamedates($nctext['content']);
$value_tmp = Mage::helper('anc_printconfigproduct/xmlfrontend')->replaceHtmlforInkscape($value_tmp);
$value= Mage::helper('anc_printconfigproduct/placeholder')->replaceStringWithArrayValues($value_tmp);
$domtag->nodeValue = '';
$parentNode= $domtag->parentNode;
$parentId=$parentNode->getAttribute('id');;
$parentName=$parentNode->nodeName;
if($parentId === $this->editTextNoodeParentId){
}else{
Mage::helper('anc_printconfigproduct/xmlfrontend')->appendHTML($domtag, $value);
}
$this->editTextNoodeParentId=$parentId;
}
}
}
}
/**
* version wenns eine magento datei ist und nicht das neue anc_text gennutzt wird
*/ else {
// $ary_backdata = Mage::helper('anc_printconfigproduct/cart')->doGetChildItemOptionInfoBuyRequest($p_parentitemId, $MagentoID);
//
// $file = $this->getTextfromOptions($ary_backdata[0]['options']);
// if ($file) {
// $domel->setAttribute('xlink:href', 'file://' . $file);
// }
}
return $domel;
}
public function editTextSVG2(DOMNode $domel, $p_parentitemId, $MagentoID) {
$ary_backdata = Mage::helper('anc_printconfigproduct/cart')->doGetChildItemOptionInfoBuyRequest($p_parentitemId, $MagentoID);
$domtags = $domel->getElementsByTagName(Mage::helper('anc_printconfigproduct/constant')->get('ancpcpSVGEditTagText'));
foreach ($domtags as $domtag) {
if (is_array($ary_backdata[0])) {
foreach ($ary_backdata[0]['options'] as $key => $value) {
$p_where = array("option_id" => $key);
$varoptionser = Mage::helper('anc_lib/sql')->selectFetchOne("type", "catalog_product_option", $p_where);
if ($varoptionser == 'area') {
if ($domtag->nodeName == Mage::helper('anc_printconfigproduct/constant')->get('ancpcpSVGEditTagText')&& $domtag->parentNode->getAttribute('MagentoID')==$MagentoID) {
$num_br = count($positions_html_array[0]);
$value = Mage::helper('anc_printconfigproduct/xml')->replaceinCalnamedates($value);
$value = Mage::helper('anc_printconfigproduct/xmlfrontend')->replaceHtmlforInkscape($value);
$domtag->nodeValue = '';
Mage::helper('anc_printconfigproduct/xmlfrontend')->appendHTML($domtag, $value);
}
}
}
}
}
return $domel;
}
/**
* Gibt ein Bildpfad aus dem Optionen Array der Media Gallery zurück
* bei mehr Bildern eine Ausgabe in der mc_log
* @param array $p_options
* @param type $parmam_what
* @return array
*/
private function getTextfromOptions(array $p_options, $parmam_what = "fullpath") {
$filename = null;
foreach ($p_options as $key => $valarray) {
if (!$filename) {
$filename = $p_options[$key]['fullpath'];
} else {
$filename2 = $p_options[$key]['fullpath'];
}
}
return $filename;
}
}
\ No newline at end of file
<?php
/**
* @package anc_text
* @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/>.
*
*/
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* Diese Klasse Existiert in Mehreren Extensions von uns und Muss im Zweifel leider in allen geändert werden!
*
* Dies geschah aus Faulheit und unwissenheit wie auf die Lib eioner anderen Extension zugegriffen werden kann!
*
* !!!!
*/
class Anc_Album_Lib_Varien_Data_Form_Element_ExtendedLabel extends Varien_Data_Form_Element_Abstract
{
public function __construct($attributes=array())
{
parent::__construct($attributes);
$this->setType('label');
}
public function getElementHtml()
{
//'<button type="button" value="Open Window" onclick="window.open(\'' . $varurlimages . '\')">Bilder des Albums verwalten</button>';
//
$var_url= $this->getEscapedValue();
$var_label= $this->getLabel();
// D::s($var_name,'$var_name',5,1,1);
$html = '<button title="'.$var_label.'" onclick="window.open(\''.$var_url . '\')"><span>'.$var_label.'</span></button>';
$html.= $this->getAfterElementHtml();
return $html;
}
public function getLabelHtml($idSuffix = ''){
if (!is_null($this->getLabel())) {
$html = '<label for="'.$this->getHtmlId() . $idSuffix . '" style="'.$this->getLabelStyle().'">'.''//$this->getLabel()
. ( $this->getRequired() ? ' <span class="required">*</span>' : '' ).'</label>'."\n";
}
else {
$html = '';
}
return $html;
}
}
\ No newline at end of file
<?php
/**
* @package anc_text
* @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/>.
*
* @eingabetyp_Redundanz Achtung!!! weitere Extensions die davon betroffen sind und selben Inhalt benötigen!!!!: AncImage, AncPlaylist, AncAddressimport,AncText
*/
class Anc_Text_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_text
* @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_Text_Model_Catalog_Product_Option_Type_Anctexttype
extends Mage_Catalog_Model_Product_Option_Type_Default
{
public function isCustomizedView() {
return true;
}
public function getCustomizedView($optionInfo)
{
$customizeBlock = new Anc_Text_Block_Options_Type_Customview_Anctext();
$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_text
* @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_Text_Model_Nctext extends Mage_Core_Model_Abstract {
protected function _construct()
{
parent::_construct();
$this->_init('anc_text/nctext');
}
}
\ No newline at end of file
<?php
/**
* @package anc_text
* @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_Text_Model_Nctext_Quoteitemoption extends Mage_Core_Model_Abstract {
protected function _construct()
{
parent::_construct();
$this->_init('anc_text/nctext_quoteitemoption');
}
}
\ No newline at end of file
<?php
/**
* @package anc_text
* @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_Text_Model_Observer {
private $itemarray = array();
public function saveTextOrderLink(array $param_values) {
// D::s('saveTextOrderLink',5,1);
$order = $param_values->getOrder();
$customerId = Mage::getSingleton('customer/session')->getCustomer()->getId();
$ListQuoteItemsByQuoteId = Mage::helper('anc_lib/quoteitem')->getListQuoteItemsByQuoteId($order->getQuoteId());
foreach ($ListQuoteItemsByQuoteId as $ListQuoteItem) {
// D::ulli('foreach',5,1);
$ItemProductOptions = Mage::helper('anc_lib/quoteitem')->getItemProductOptionByOptionType($ListQuoteItem['item_id'], 'anctext_type');
if (is_array($ItemProductOptions) && !empty($ItemProductOptions)) {
// D::ulli('if',5,1);
foreach ($ItemProductOptions as $option_id => $nctext_id) {
// D::ulli('if foreach'. $nctext_id,5,1);
/**
* Kopiere das Text- Item damit Der Benutzer es bearbeiten kann und das Oreginalitem nicht mehr verändert wird
*/
if (!array_search($nctext_id, $this->itemarray)) {
try {
D::s($this->itemarray,'$this->itemarray',5,1);
$this->itemarray[] = $nctext_id;
$model = Mage::getModel('anc_text/nctext');
$textitem = $model->load($nctext_id)->getData();
unset($textitem['entity_id']);
unset($textitem['ordered']);
unset($textitem['admin_user_id']);
$textitem['customer_id']= $customerId;
// $textitem['comment'] = $textitem['comment'] . ' Kopie von ' . $textitem['entity_id'] . ' ItemId: ' . $textitem['used_byitem_id'];
$model->setData($textitem);
$model->save();
} catch (Exception $e) {
// D::show($e->getMessage());
}
}
Mage::helper('anc_lib/sql')->updateOneCell(
'anc_text/nctext', 'ordered', '1', array(
'entity_id' => $nctext_id,
)
);
$nctext_quoteitemoption_id = (int) Mage::helper('anc_lib/sql')->selectFetchOne(
'entity_id', 'anc_text/nctext_quoteitemoption', array(
'customer_id' => $order->getCustomerId(),
'nctext_id' => $nctext_id,
'order_id' => $order->getId(),
'quote_item_id' => $ListQuoteItem['item_id'],
'ordertime' => $order->getCreatedAt()
)
);
if (!$nctext_quoteitemoption_id) {
// $nctext_quoteitemoption = Mage::getModel('anc_text/nctext_quoteitemoption');
$nctext_quoteitemoption = Mage::helper('anc_text/ncmodel')->getBlancoNcTextQuoteitemoption();
$nctext_quoteitemoption->setCustomerId($order->getCustomerId());
$nctext_quoteitemoption->setNctextId($nctext_id);
$nctext_quoteitemoption->setOrderId($order->getId());
$nctext_quoteitemoption->setQuoteItemId($ListQuoteItem['item_id']);
$nctext_quoteitemoption->setOrdertime($order->getCreatedAt());
$nctext_quoteitemoption->save();
}
}
}
}
}
}
<?php
/**
* @package anc_text
* @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_Text_Model_Resource_Mysql4_Nctext extends Mage_Core_Model_Mysql4_Abstract {
protected function _construct() {
$this->_init('anc_text/nctext', 'entity_id');
}
protected function _beforeSave(Mage_Core_Model_Abstract $nctext) {
if(!$nctext->getId()) {
$nctext->setCreatedAt(now());
}
$nctext->setUpdatedAt(now());
return parent::_beforeSave($nctext);
}
}
\ No newline at end of file
<?php
/**
* @package anc_text
* @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_Text_Model_Resource_Mysql4_Nctext_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract{
public function _construct(){
$this->_init('anc_text/nctext');
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_text
* @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_Text_Model_Resource_Mysql4_Nctext_Quoteitemoption extends Mage_Core_Model_Mysql4_Abstract {
protected function _construct() {
$this->_init('anc_text/nctext_quoteitemoption', 'entity_id');
}
}
\ No newline at end of file
<?php
/**
* @package anc_text
* @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_Text_Model_Resource_Mysql4_Nctext_Quoteitemoption_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract{
public function _construct(){
$this->_init('anc_text/nctext_quoteitemoption');
parent::_construct();
}
}
\ No newline at end of file
<?php
/**
* @package anc_text
* @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_Text_Adminhtml_AdministratorController extends Mage_Adminhtml_Controller_Action {
protected function _initAction() {
$this->loadLayout();
return $this;
}
/**
* Block/Template Funktion
*
* fnc ist in "mein Benutzerkonto" laut @see app/design/frontend/layout/anc_text.xml als link aufrufbar,
* * durch selbige anc_text.xml bekommt die fnc das template @see app/design/frontend/template/anctext/customer_owngallery.phtml beigesteuert
*/
public function owngalleryAction() {
$this->loadLayout();
$this->getLayout()->getBlock('root')->setTemplate('page/1column.phtml');
$this->renderLayout();
}
/**
* param - $this->getRequest()->getParams()['id'] -- id des zu bearbeiteten nctext
*
* Block/Template Funktion
*
*/
public function shownctextformAction() {
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
$params=$this->getRequest()->getParams();
if(is_array($params) && array_key_exists('id', $params)) {
$nctext = Mage::helper('anc_text/ncmodel')->getNcText($params['id']);
//D::li($nctext, '$nctext'.$params['id']);
if(is_object($nctext)) {
if(array_key_exists('name', $params)) {
$nctext->setName($params['name']);
}
if(array_key_exists('comment', $params)) {
$nctext->setComment($params['comment']);
}
$nctext = Mage::helper('anc_text/ncmodel')->saveNcText($nctext);
// D::compareFe($nctext,$params, '$nctext, $this->getParams()');
}
}
$this->loadLayout();
$this->getLayout()->getBlock('root')->setTemplate('page/empty.phtml');
// $this->getLayout()->getBlock('content')->append(
// $this->getLayout()->createBlock('anc_text/owngallery')->setTemplate('anc/image/customer_showNcTextForm.phtml')
// );
$this->renderLayout();
} else {
echo('nicht eingeloggt');
}
}
public function simpleowngalleryAction() {
// D::li('testme',1);
$this->loadLayout();
$this->getLayout()->getBlock('root')->setTemplate('page/empty.phtml');
$this->renderLayout();
}
/**
* @param _POST[id] => $this->getRequest()->getParams()[id] -- anc_text/nctext id
*
*/
public function deleteNcTextAction() {
$params=$this->getRequest()->getParams();
$json_rueckgabe = array();
if(array_key_exists('id', $params) && $params['id']) {
$param_id = $params['id'];
$nctext = Mage::helper('anc_text/ncmodel')->getNcText($param_id);
if(Mage::helper('anc_text/ncmodel')->deleteNcText($nctext)) {
$json_rueckgabe['status'] = 'OK';
$json_rueckgabe['message'] = 'Der Text ('.$nctext->getId().' wurde gelöscht)!';
} else {
$json_rueckgabe['status'] = 'ERROR';
$json_rueckgabe['message'] = 'Es ist beim Löschen ein Fehler aufgetreten!';
}
} else {
$json_rueckgabe['status'] = 'ERROR';
$json_rueckgabe['message'] = 'Keine ID angegeben!';
}
echo json_encode($json_rueckgabe);
}
/**
* @param optional _POST[id] => $this->getRequest()->getParams()[id] -- anc_text/nctext id
*
* fnc wird übers formular von owngalleryAction() bzw customer_owngallery.phtml
* bei einem datei upload aufgerufen und verarbeitet die post werte
* * kopiert datei in entsprechendes kunden verzeichniss
* * speichert dateiname im model / in tabelle
*/
public function uploadTextAction() {
$params=$this->getRequest()->getParams();
if(array_key_exists('id', $params)) {
$param_id = $params['id'];
} else {
$param_id = false;
}
if(array_key_exists('album_id', $params)) {
$param_album_id = $params['album_id'];
} else {
$param_album_id = false;
}
$user = Mage::getSingleton('admin/session');
$userId = $user->getUser()->getUserId();
// D::ulli('Albumid: '.$param_album_id.' / Userid: '.$userId,1);
$json_rueckgabe = array();
/* Get the customer data */
$customer = Mage::getSingleton('customer/session')->getCustomer();
if(isset($_FILES['file']['name']) && $_FILES['file']['name'] != '') {
try
{
$path = Mage::helper('anc_text/nctext')->getPathForNewNcText('original');
$fname = $_FILES['file']['name']; //file name
$uploader = new Varien_File_Uploader('file'); //load class
$uploader->setAllowedExtensions(array('jpg','jpeg','gif','png')); //Allowed extension for file
$uploader->setAllowCreateFolders(true); //for creating the directory if not exists
$uploader->setAllowRenameFiles(true); //if true, uploaded file's name will be changed, if file with the same name already exists directory.
$uploader->setFilesDispersion(false);
$uploader->save($path,$fname); //save the file on the specified path
// den modifizierten namen, falls datei schon existierte
$fname = $uploader->getUploadedFileName();
if(is_file($path.DS.$fname)) {
/**
* datei wird ersetzt
*/
if($param_id) {
$nctext = Mage::helper('anc_text/ncmodel')->getNcText($param_id);
if(Mage::helper('anc_text/ncmodel')->deleteNcTextFiles($nctext)) {
} else {
$json_rueckgabe['status'] = 'ERROR';
$json_rueckgabe['message'] = 'Sie habe nicht die Berechtigung!';
echo json_encode($json_rueckgabe);
return;
}
} else {
$nctext = Mage::getModel('anc_text/nctext');
}
// $nctext->setData('customer_id',$customer->getId());
$nctext->setData('admin_user_id',$userId);
$nctext->setData('file',$fname);
if($param_album_id){//ncalbum_id
$nctext->setData('ncalbum_id',$param_album_id);
}
$nctext->save();
$nctext->setData('path', Mage::helper('anc_text/nctext')->getNcTextPath($nctext->getId(), 'relative', 'original'));
$nctext->save();
if($nctext->getId()) {
$json_rueckgabe['model'] = 'anc_text/nctext';
$json_rueckgabe['file'] = $fname;
$json_rueckgabe['id'] = $nctext->getId();
$json_rueckgabe['path'] = $nctext->getPath();
$json_rueckgabe['status'] = 'OK';
$json_rueckgabe['message'] = 'upload erfolgreich !! ('.$nctext->getId().'/'.$uploader->getUploadedFileName().')';
} else {
$json_rueckgabe['status'] = 'ERROR';
$json_rueckgabe['message'] = 'Datei konnte nicht in die Datenbank eingetragen werden';
}
} else {
$json_rueckgabe['status'] = 'ERROR';
$json_rueckgabe['message'] = 'Datei konnte nicht auf dem Server gespeichert werden';
}
} catch (Exception $e) {
$json_rueckgabe['status'] = 'ERROR';
$json_rueckgabe['message'] = $e->getMessage();
}
} else {
$json_rueckgabe['status'] = 'ERROR';
$json_rueckgabe['message'] = 'Übermittlungsprobleme: Datei konnte nicht gespeichert werden (vielleicht war die Datei größer als '.@ini_get('post_max_size').' MB)';
}
echo json_encode($json_rueckgabe);
}
}
\ No newline at end of file
<?php
/**
* @package anc_text
* @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_Text_Adminhtml_AlbumController extends Mage_Adminhtml_Controller_Action {
public function listAction() {
$albumBlock = $this->getLayout()->createBlock('anc_text/adminhtml_albums');
$this->loadLayout()
->_addContent($albumBlock)
->renderLayout();
}
protected function _initAction() {
$this->loadLayout()->_setActiveMenu('anc_text/ANC')
->_addBreadcrumb('test Manager', 'test Manager');
return $this;
}
public function indexAction() {
$this->_initAction();
$this->renderLayout();
}
public function editAction() {
$id = $this->getRequest()->getParam('id');
$model = Mage::getModel('anc_text/album')->load($id);
if ($model->getId() || $id == 0) {
Mage::register('anc_album', $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_text/adminhtml_albums_edit'))
->_addLeft($this->getLayout()
->createBlock('anc_text/adminhtml_albums_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_text/album');
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);
$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_text/album');
$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');
}
protected function _isAllowed() {
return Mage::getSingleton('admin/session')->isAllowed('text/form');
}
}
<?php
/**
* @package anc_text
* @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_Text_Adminhtml_TextController extends Mage_Adminhtml_Controller_Action {
public function listAction() {
$albumBlock = $this->getLayout()->createBlock('anc_text/adminhtml_texts');
$this->loadLayout()
->_addContent($albumBlock)
->renderLayout();
}
protected function _initAction() {
$this->loadLayout()->_setActiveMenu('anc_text/ANC')
->_addBreadcrumb('test Manager', 'test Manager');
return $this;
}
public function indexAction() {
$this->_initAction();
$this->renderLayout();
/**
* go to listAction
*/
$varparams = $this->getRequest()->getParams();
if ($varparams['albumid']) {
$this->_redirect('*/*/list', array(
'albumid' => $varparams['albumid'],
));
} else {
$this->_redirect(
'*/*/list', array(
)
);
}
}
public function editAction() {
$id = $this->getRequest()->getParam('id');
$model = Mage::getModel('anc_text/nctext')->load($id);
if ($model->getId() || $id == 0) {
Mage::register('anc_text', $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_text/adminhtml_texts_edit'))
->_addLeft($this->getLayout()
->createBlock('anc_text/adminhtml_texts_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();
$varparams = $this->getRequest()->getParams();
$testModel = Mage::getModel('anc_text/nctext');
if ($this->getRequest()->getParam('id') <= 0)
$testModel->setCreatedTime(
Mage::getSingleton('core/date')
->gmtDate()
);
$path = "";
if (isset($_FILES['file']['name']) && $_FILES['file']['name'] != '') {
try {
if (!(strpos($varparams['path'], "/media/") === 0)) {
$varparams['path'] = 'media/' . $varparams['path'];
}
$filename = $_FILES['file']['name'];
$path = $varparams['path'];
// D::ulli('Pfad: ' . $path, 1);
$fname = $_FILES['file']['name']; //file name
$uploader = new Varien_File_Uploader('file'); //load class
$uploader->setAllowedExtensions(array('png', 'jpg', 'gif')); //Allowed extension for file
$uploader->setAllowCreateFolders(true); //for creating the directory if not exists
$uploader->setAllowRenameFiles(false); //if true, uploaded file's name will be changed, if file with the same name already exists directory.
$uploader->setFilesDispersion(false);
$uploader->save($path, $fname); //save the file on the specified path
$postData['file'] = $_FILES['file']['name'];
// D::ulli('$path:'.$path.' / $fname:'.$fname);
$var_upload = true;
} catch (Exception $e) {
$var_upload = false;
echo 'Error Message: ' . $e->getMessage();
}
} else {
$var_upload = false;
}
if (is_array($varparams['file'])) {
// unset($postData['file']);
}
if (!(strpos($postData['path'], "/media/") === 0)) {
$postData['path'] = '/media/' . $postData['path'] . $filename;
$postData['file'] = $filename;
}
/**
* Falls Keine Datei gespeichert wurde
*/
if ($var_upload === false) {
unset($postData['file']);
unset($postData['path']);
}
$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);
/**
* Für save and continue
*/
if ($this->getRequest()->getParam('back')) {
if ($varparams['albumid']) {
$this->_redirect(
'*/*/edit', array(
'id' => $testModel->getId(),
'albumid' => $varparams['albumid'],
)
);
} else {
$this->_redirect(
'*/*/edit', array(
'id' => $testModel->getId(),
)
);
}
return;
}
if ($varparams['albumid']) {
$this->_redirect('*/*/list', array(
'albumid' => $varparams['albumid'],
));
} else {
$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_text/nctext');
$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');
}
protected function _isAllowed() {
return Mage::getSingleton('admin/session')->isAllowed('text/form');
}
}
<?php
/**
* @package anc_text
* @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_Text_CustomerController extends Mage_Core_Controller_Front_Action {
protected function _initAction() {
$this->loadLayout();
return $this;
}
/**
* Block/Template Funktion
*
* fnc ist in "mein Benutzerkonto" laut @see app/design/frontend/layout/anc_text.xml als link aufrufbar,
* * durch selbige anc_text.xml bekommt die fnc das template @see app/design/frontend/template/anctext/customer_galleriesmanager.phtml beigesteuert
*/
public function galleriesmanagerAction() {
$this->loadLayout();
$this->getLayout()->getBlock('root')->setTemplate('page/2columns-right.phtml');
$this->renderLayout();
}
/**
* param - $this->getRequest()->getParams()['id'] -- id des zu bearbeiteten nctext
*
* Block/Template Funktion
*
*/
public function shownctextformAction() {
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
$params = $this->getRequest()->getParams();
if (is_array($params) && array_key_exists('id', $params)) {
if($params['id']==0){
/**
* Wenn ein neuer Text erstellt wird
*/
$params['id'] = Mage::helper('anc_text/ncmodel')->createNCNew();
$this->getRequest()->setParams('id',$params['id']);
Mage::app()->getRequest()->setParam('id',$params['id']);
}
$nctext = Mage::helper('anc_text/ncmodel')->getNcText($params['id']);
if (is_object($nctext)) {
if (array_key_exists('name', $params)) {
$nctext->setName($params['name']);
}
if (array_key_exists('comment', $params)) {
$nctext->setComment($params['comment']);
}
$nctext = Mage::helper('anc_text/ncmodel')->saveNcText($nctext);
}
}
$this->loadLayout();
$this->getLayout()->getBlock('root')->setTemplate('page/empty.phtml');
$this->getLayout()->getBlock('content')->append(
$this->getLayout()->createBlock('anc_text/galleriesmanager')->setTemplate('anc/image/customer_showNcTextForm.phtml')
);
$this->renderLayout();
} else {
echo('nicht eingeloggt');
}
}
public function gallerysimpleAction() {
$this->loadLayout();
$this->getLayout()->getBlock('root')->setTemplate('page/empty.phtml');
$this->renderLayout();
}
/**
* @param _POST[id] => $this->getRequest()->getParams()[id] -- anc_text/nctext id
*
*/
public function deleteNcTextAction() {
$params = $this->getRequest()->getParams();
$json_rueckgabe = array();
if (array_key_exists('id', $params) && $params['id']) {
$param_id = $params['id'];
$nctext = Mage::helper('anc_text/ncmodel')->getNcText($param_id);
if (Mage::helper('anc_text/ncmodel')->deleteNcText($nctext)) {
$json_rueckgabe['status'] = 'OK';
$json_rueckgabe['message'] = 'Der Text(' . $nctext->getId() . ' wurde gelöscht)!';
} else {
$json_rueckgabe['status'] = 'ERROR';
$json_rueckgabe['message'] = 'Es ist beim Löschen ein Fehler aufgetreten!';
}
} else {
$json_rueckgabe['status'] = 'ERROR';
$json_rueckgabe['message'] = 'Keine ID angegeben!';
}
echo json_encode($json_rueckgabe);
}
/**
* @param optional _POST[id] => $this->getRequest()->getParams()[id] -- anc_text/nctext id
*
* fnc wird übers formular von galleriesmanagerAction() bzw customer_galleriesmanager.phtml
* bei einem datei upload aufgerufen und verarbeitet die post werte
* * kopiert datei in entsprechendes kunden verzeichniss
* * speichert dateiname im model / in tabelle
*/
public function savecustomertextAction() {
//ncinput_id: ncinput_id, option_id: option_id,ncalbum_id: ncalbum_id,nccustomerid:nccustomerid,ncadmin_id:ncadmin_id,used_byitem_id:used_byitem_id,ordered:ordered,varcontent:varcontent
$params = $this->getRequest()->getParams();
if (array_key_exists('id', $params)) {
$param_id = $params['id'];
} else {
$param_id = false;
}
if (array_key_exists('ncalbum_id', $params)) {
$param_ncalbum_id = $params['ncalbum_id'];
} else {
$param_ncalbum_id = false;
}
$json_rueckgabe = array();
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
$customerData = Mage::getSingleton('customer/session')->getCustomer();
// echo $customerData->getId();
} else {
// $this->_getSession()->addError('Bitte melden sie sich an um Ihr Produkt zu Personalisieren');
}
$texts = Mage::helper('anc_text/ncmodel')->getNcTextsForCustomer();
$var_albums = Mage::helper('anc_album/ncmodel')->getNcAlbumsForCustomer()->getData();
if (!$var_albums[0]) {
$albumid = Mage::helper('anc_album/ncmodel')->createNcAlbumForCustomer();
$var_albums = Mage::helper('anc_album/ncmodel')->getNcAlbumsForCustomer()->getData();
} else {
$albumid = $var_albums[0]['entity_id'];
}
$params['album_id'] = $albumid;
$textid = Mage::helper('anc_text/ncmodel')->prepareSaveNcText($params);
if ($textid) {
$json_rueckgabe['model'] = 'anc_text/nctext';
$json_rueckgabe['id'] = $textid; //$nctext->getId();
$json_rueckgabe['status'] = 'OK';
$json_rueckgabe['message'] = 'upload erfolgreich !! (' . $textid . ')';
} else {
$json_rueckgabe['status'] = 'ERROR';
$json_rueckgabe['message'] = 'Text1 konnte nicht auf dem Server gespeichert werden';
}
echo json_encode($json_rueckgabe);
}
public function getcustomertextdataAction() {
$params = $this->getRequest()->getParams();
if ($params['entity_id']) {
$texts = Mage::helper('anc_text/ncmodel')->getNcText($params['entity_id']);
$json_rueckgabe = array();
$json_rueckgabe['model'] = 'anc_text/nctext';
$json_rueckgabe['entity_id'] = $texts['entity_id'];
$json_rueckgabe['customer_id'] = $texts['customer_id'];
$json_rueckgabe['admin_user_id'] = $texts['admin_user_id'];
$json_rueckgabe['name'] = $texts['name'];
$json_rueckgabe['name'] = $texts['name'];
$json_rueckgabe['content'] = $texts['content'];
$json_rueckgabe['ncalbum_id'] = $texts['ncalbum_id'];
$json_rueckgabe['original_id'] = $texts['original_id'];
$json_rueckgabe['ncright_id'] = $texts['ncright_id'];
$json_rueckgabe['ordered'] = $texts['ordered'];
$json_rueckgabe['used_byitem_id'] = $texts['used_byitem_id'];
$json_rueckgabe['visibleingallery'] = $texts['visibleingallery'];
$json_rueckgabe['status'] = 'OK';
$json_rueckgabe['message'] = 'erfolgreich !! (' . $texts['entity_id'] . ')';
} else {
$json_rueckgabe['status'] = 'ERROR';
$json_rueckgabe['message'] = 'Text2 konnte nicht auf dem Server gespeichert werden';
}
echo json_encode($json_rueckgabe);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<config>
<acl>
<resources>
<all>
<title>Allow Everything</title>
</all>
<admin>
<children>
<Anc_Anc module="anc_text">
<title>ANC</title>
<sort_order>71</sort_order>
<children>
<!-- <ncalbum module="anc_text">
<title>Album</title>
<sort_order>1</sort_order>
<action>image/adminhtml_album/list</action>
</ncalbum>-->
<!-- @backend_grid-->
<!-- <nctext module="anc_text">
<title>Image</title>
<sort_order>2</sort_order>
<action>image/adminhtml_album/list</action>
</nctext>-->
</children>
</Anc_Anc>
<system>
<children>
<config>
<children>
<site translate="title">
<title>Lib</title>
<sort_order>101</sort_order>
</site>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</acl>
</config>
\ 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_Text>
<version>0.0.2</version>
</Anc_Text>
</modules>
<!-- was im frontend passiert -->
<frontend>
<!-- einbindung der layoutkonfiguration (s.u.) -->
<layout>
<updates>
<Anc_Text>
<file>anc/text.xml</file>
</Anc_Text>
</updates>
</layout>
<!-- damit die controller funktionen über eine url erreichbar sind (s.u.) -->
<routers>
<!--Umleitung bzw aktivierung der controllers-->
<anc_text>
<use>standard</use>
<args>
<!-- alle urls die mit "http://magento/anctext" werden ins modul Anc_Text umgeleitet -->
<module>Anc_Text</module>
<frontName>anctext</frontName>
</args>
</anc_text>
</routers>
<events>
<sales_order_save_commit_after>
<observers>
<!-- <anc_printconfigproduct_attribute_set_load_before>
<type>singleton</type>
<class>anc_printconfigproduct/observer</class>
<method>copyAttributeset</method>
</anc_printconfigproduct_attribute_set_load_before> -->
<anc_text_save_text_order_link>
<type>singleton</type>
<class>anc_text/observer</class>
<method>saveTextOrderLink</method>
</anc_text_save_text_order_link>
</observers>
</sales_order_save_commit_after>
</events>
</frontend>
<global>
<helpers>
<anc_text>
<class>Anc_Text_Helper</class>
</anc_text>
</helpers>
<!-- dem system bekannt machen das block klassen existieren -->
<blocks>
<anc_text>
<class>Anc_Text_Block</class>
</anc_text>
<!-- Wichtig damit die Blocks zum editieren richtig geladen werden-->
<anc_text_adminhtml>
<class>Anc_Text_Block_Adminhtml</class>
</anc_text_adminhtml>
<adminhtml>
<!-- @anc_text_eingabetyp -->
<rewrite>
<catalog_product_edit_tab_options_option>Anc_Text_Block_Adminhtml_Catalog_Product_Edit_Tab_Options_Option</catalog_product_edit_tab_options_option>
</rewrite>
</adminhtml>
</blocks>
<catalog>
<product>
<options>
<custom>
<groups>
<!-- @anc_text_eingabetyp -->
<anctext translate="label" module="anc_text">
<label>NcText</label>
<render>anc_text/adminhtml_catalog_product_edit_tab_options_type_anctext</render>
<types>
<anctext_type translate="label" module="anc_text">
<label>Text</label>
</anctext_type>
</types>
</anctext>
</groups>
</custom>
</options>
</product>
</catalog>
<!-- die konfiguration der datenbank schnittstelle -->
<models>
<anc_text>
<class>Anc_Text_Model</class>
<!-- folgendes ist ein verweis auf den nachfolgenden tag <anc_text_resource> -->
<resourceModel>anc_text_resource</resourceModel>
</anc_text>
<anc_text_resource>
<class>Anc_Text_Model_Resource_Mysql4</class>
<!-- entitie's mit s hier können mehrere Tabellen(namen) untergebracht werden -->
<entities>
<nctext>
<table>anc_text_nctext</table>
</nctext>
<nctext_quoteitemoption>
<table>anc_text_nctext_quoteitemoption</table>
</nctext_quoteitemoption>
<!-- <image>
<table>anc_text_album</table>
</album>-->
<!-- <album_list>
<table>anc_text_album_list</table>
</album_list> -->
</entities>
</anc_text_resource>
<catalog>
<!-- @anc_text_eingabetyp -->
<rewrite>
<product_option>Anc_Text_Model_Catalog_Product_Option</product_option>
</rewrite>
</catalog>
</models>
<resources>
<!-- hier verbirgt sich das installationsskript um die datenbanktabellen zu erstellen -->
<anc_text_setup>
<setup>
<module>Anc_Text</module>
<class>Mage_Sales_Model_Mysql4_Setup</class>
</setup>
<connection>
<use>core_setup</use>
</connection>
</anc_text_setup>
<!-- datenbank verbindungen -->
<anc_text_write>
<connection>
<use>core_write</use>
</connection>
</anc_text_write>
<anc_text_read>
<connection>
<use>core_read</use>
</connection>
</anc_text_read>
</resources>
</global>
<admin>
<routers>
<anc_text>
<use>admin</use>
<args>
<modules>
<certification_may before="Mage_Adminhtml">Anc_Text_Adminhtml</certification_may>
</modules>
<module>Anc_Text</module>
<frontName>text</frontName>
</args>
</anc_text>
</routers>
</admin>
<adminhtml>
<menu>
<Anc_Anc module="anc_text">
<title>ANC</title>
<sort_order>71</sort_order>
<children>
<ncalbumtext module="anc_text">
<title>Text</title>
<sort_order>6</sort_order>
<action>text/adminhtml_text/list</action>
</ncalbumtext>
<!-- @backend_grid-->
<!-- <nctext module="anc_text">
<title>Image</title>
<sort_order>2</sort_order>
<action>image/adminhtml_album/list</action>
</nctext> -->
</children>
</Anc_Anc>
</menu>
</adminhtml>
</config>
\ No newline at end of file
<?php
/**
* @package anc_text
* @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/>.
*
*/
/**
* @var Mage_Sales_Model_Mysql4_Setup $installer
*/
$installer = $this;
$installer->startSetup();
// Erstellen der anc_pricespercustomer Tabelle
$tableName = $installer->getTable('anc_text/nctext');
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',),'Who Created frontend')
->addColumn('admin_user_id',Varien_Db_Ddl_Table::TYPE_INTEGER,null,array('unsigned' => true,'nullable' => false,'default' => '0',),'Who Created backend')
->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('path', Varien_Db_Ddl_Table::TYPE_VARCHAR,null,array(),'file path')
// ->addColumn('file', Varien_Db_Ddl_Table::TYPE_VARCHAR,null,array(),'file')
->addColumn('name', Varien_Db_Ddl_Table::TYPE_VARCHAR,null,array(),'Name')
->addColumn('comment', Varien_Db_Ddl_Table::TYPE_VARCHAR,null,array(),'comment')
->addColumn('content', Varien_Db_Ddl_Table::TYPE_VARCHAR,null,array(),'content text')
->addColumn('ncalbum_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('unsigned' => true,'nullable' => false,'default' => '0',),'gehört zum album')
->addColumn('original_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('unsigned' => true,'nullable' => false,'default' => '0',),'wenn album dupliziert wird, würde hier die original album id angezeigt werden')
->addColumn('ncright_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('unsigned' => true,'nullable' => false,'default' => '0',),'Who Created frontend')
->addColumn('ordered',Varien_Db_Ddl_Table::TYPE_BOOLEAN,null,array(),'standard')
->addColumn('visibleingallery',Varien_Db_Ddl_Table::TYPE_BOOLEAN,null,array(),'Sichtbar in Gallerie')
->addColumn('used_byitem_id',Varien_Db_Ddl_Table::TYPE_INTEGER,null,array('unsigned' => true,'nullable' => false,'default' => '0',),'Welches Produkt')
->addIndex($installer->getIdxName('anc_text/nctext', array('customer_id')), array('customer_id'))
->addIndex($installer->getIdxName('anc_text/nctext', array('admin_user_id')), array('admin_user_id'))
->addIndex($installer->getIdxName('anc_text/nctext', array('original_id')), array('original_id'))
->addIndex($installer->getIdxName('anc_text/nctext', array('ncalbum_id')), array('ncalbum_id'))
// http://docs.magentocommerce.com/Varien/Varien_Db/Varien_Db_Ddl_Table.html#addForeignKey
// ->addForeignKey(
// $installer->getFkName( 'anc_text/nctext','customer_id','customer/entity','entity_id'), 'customer_id',
// $installer->getTable('customer/entity'), 'entity_id',
// Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
// )
// ->addForeignKey(
// $installer->getFkName( 'anc_text/nctext','admin_user_id','admin/user','user_id'), 'admin_user_id',
// $installer->getTable('admin/user'), 'user_id',
// Varien_Db_Ddl_Table::ACTION_NO_ACTION, Varien_Db_Ddl_Table::ACTION_NO_ACTION
// )
// ->addForeignKey(
// $installer->getFkName( 'anc_text/nctext','original_id','anc_text/nctext','entity_id'), 'original_id',
// $installer->getTable('anc_text/nctext'), 'entity_id',
// Varien_Db_Ddl_Table::ACTION_NO_ACTION, Varien_Db_Ddl_Table::ACTION_NO_ACTION
// )
// ->addForeignKey(
// $installer->getFkName( 'anc_text/nctext','ncalbum_id','anc_album/ncalbum','entity_id'), 'ncalbum_id',
// $installer->getTable('anc_album/ncalbum'), 'entity_id',
// Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
// )
;
$installer->getConnection()->createTable($table);
}
/**
* für die anzeige ob kunde schon mal bild benutzt hat, und wenn ja wan
* redudant weil info ansich vorhanden, aber zu performant um ran zukommen
*/
$tableName = $installer->getTable('anc_text/nctext_quoteitemoption');
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',),'Who Created frontend')
->addColumn('nctext_id', Varien_Db_Ddl_Table::TYPE_INTEGER,null,array('unsigned' => true,'nullable' => false,'default' => '0',),'Who Created backend')
->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER,null,array('unsigned' => true,'nullable' => false,'default' => '0',),'Who Created backend')
->addColumn('quote_item_id',Varien_Db_Ddl_Table::TYPE_INTEGER,null,array('unsigned' => true,'nullable' => false,'default' => '0',),'Who Created backend')
->addColumn('ordertime', Varien_Db_Ddl_Table::TYPE_TIMESTAMP,null,array(),'Bestellzeitpunkt')
->addColumn('product_name', Varien_Db_Ddl_Table::TYPE_VARCHAR,null,array(),'Produktname')
->addIndex($installer->getIdxName('anc_text/nctext_quoteitemoption', array('customer_id')),array('customer_id'))
->addIndex($installer->getIdxName('anc_text/nctext_quoteitemoption', array('nctext_id')),array('nctext_id'))
->addIndex($installer->getIdxName('anc_text/nctext_quoteitemoption', array('order_id')),array('order_id'))
->addIndex($installer->getIdxName('anc_text/nctext_quoteitemoption', array('quote_item_id')),array('quote_item_id'))
// ->addForeignKey(
// $installer->getFkName( 'anc_text/nctext_quoteitemoption','customer_id','customer/entity','entity_id'), 'customer_id',
// $installer->getTable('customer/entity'), 'entity_id',
// Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
// )
// ->addForeignKey(
// $installer->getFkName( 'anc_text/nctext_quoteitemoption','nctext_id','anc_text/nctext','entity_id'), 'nctext_id',
// $installer->getTable('anc_text/nctext'), 'entity_id',
// Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
// )
// ->addForeignKey(
// $installer->getFkName( 'anc_text/nctext_quoteitemoption','order_id','sales/order','entity_id'), 'order_id',
// $installer->getTable('sales/order'), 'entity_id',
// Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
// )
// ->addForeignKey(
// $installer->getFkName( 'anc_text/nctext_quoteitemoption','quote_item_id','sales/quote_item','item_id'), 'quote_item_id',
// $installer->getTable('sales/quote_item'), 'item_id',
// Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
// )
;
$installer->getConnection()->createTable($table);
}
$installer->endSetup();
?>
\ No newline at end of file
<?php
/**
* @package anc_text
* @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/>.
*
*/
/*
* 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.
*/
$model = 'anc_text/nctext';
$installer = $this;
$connection = $installer->getConnection();
$installer->startSetup();
/**
* Neue Spalte für die Unterschrift als font wenn gesetzt muss der Buchstabe für das einbetten angegeben werden
*/
$installer->getConnection()
->addColumn($installer->getTable('anc_text/nctext'), 'ispersonalized',Varien_Db_Ddl_Table::TYPE_BOOLEAN, null, array('default' => '1'), 'Ist Personalisiert ');
$installer->endSetup();
?>
\ No newline at end of file
<?xml version="1.0"?>
<layout version="0.1.0">
<anc_text_administrator_simpleowngallery>
<reference name="content">
<block type="anc_text/adminhtml_admingallery" name="simpleadmingallerytext" template="anc/text/simpleadmingallery.phtml" />
</reference>
</anc_text_administrator_simpleowngallery>
</layout>
<?php
/**
* @package anc_text
* @anc_text_eingabetyp - Formular-template im Backend beim Produkt editieren
* @copy app/design/adminhtml/default/default/template/catalog/product/edit/options/type/text.phtml
* @since 20140416
* @author netz.coop eG*
* @version Magento 1.8, 1.9
*/
//D::li('Anc_Text_Block_Adminhtml_Catalog_Product_Edit_Tab_Options_Type_Anctext => app/design/adminhtml/template/catalog/product/edit/options/type/anctext.phtml');
?>
<script type="text/javascript">
//<![CDATA[
OptionTemplateAnctext = '<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 Text 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}}][text_size_x]" value="{{text_size_x}}">' +
<?php echo $this->helper('core')->jsonEncode(Mage::helper('catalog')->__('x')) ?> +
'<input class="input-text" type="text" name="product[options][{{option_id}}][text_size_y]" value="{{text_size_y}}">' +
<?php echo $this->helper('core')->jsonEncode(Mage::helper('catalog')->__('px.')) ?> +
'</td>' +
'</tr>'+
'</table>';
if ($('option_panel_type_anctext')) {
$('option_panel_type_anctext').remove();
}
//]]>
</script>
\ No newline at end of file
<?php
$params=$this->getRequest()->getParams();
D::ulli('Test sg.phtml',1,1);
?>
<?php $NcTextsForCustomer = Mage::helper('anc_text/ncmodel')->getNcTextsForAlbum($params['id']); ?>
<ul class="gallery AncGalleryTexts">
<?php foreach($NcTextsForCustomer as $nctext ): ?>
<?php $NcTextPath = Mage::helper('anc_text/nctext')->getNcTextPath($nctext['entity_id'], 'relative', 'original'); ?>
<?php $nctext_title = Mage::helper('anc_text/nctext')->getNcTextMetaDataAsHtml($nctext['entity_id']); ?>
<a data-site="<?php echo $this->getUrl('anctext/customer/showNcTextForm', array('id'=>$nctext['entity_id'])) ?>" class="anctext-showNcTextForm" rel="prettyPhoto[pp_gal2]" href="<?php echo DS.$NcTextPath ?>" title="<?php echo $nctext_title; ?>">
<!--<img height="50" src="<?php // echo DS.$NcTextPath ?>" class="anc-text-draggable" id="<?php // echo $nctext['entity_id'] ?>" />-->
<!--<div title="<?php // echo $nctext_title;?>"><?php // echo $nctext['name'].' ';?></div>-->
<span title="<?php echo $nctext_title;?>"><?php echo $nctext['name'].' ';?> </span>
</a>
<span> &nbsp;</span>
<?php endforeach; ?>
</ul>
<?xml version="1.0"?>
<layout version="0.1.0">
<!-- for the @AncBundleproduct Extension and the sepcial catalog_product_subview @anc_text_eingabetyp -->
<catalog_product_subview translate="label">
<reference name="head">
<action method="addCss"><stylesheet>css/anc/lib/ancextension_type.css</stylesheet></action>
<!--<action method="addCss"><stylesheet>css/anc/image/dropzone.css</stylesheet></action>-->
<!--<action method="addCss"><stylesheet>css/anc/image/prettyPhoto.css</stylesheet></action>-->
<action method="addJs"><script>Anc/Text/Type.js</script></action>
<!-- <action method="addJs"><script>Anc/Image/extlib/dropzone.js</script></action>
<action method="addJs"><script>Anc/Image/extlib/jquery.prettyPhoto.js</script></action>
<action method="addJs"><script>Anc/Lib/croppic/croppic.min.js</script></action>
<action method="addJs"><script>Anc/Lib/Croppic.js</script></action> -->
</reference>
<reference name="content">
<block type="core/template" name="product.subview.text" template="anc/text/manipulate_catalog_product_subview.phtml"/>
</reference>
<reference name="product.info">
</reference>
<reference name="product.info.options">
<!-- @anc_text_eingabetyp -->
<action method="addOptionRenderer">
<type>anctext</type>
<block>anc_text/catalog_product_view_options_type_anctext</block>
<template>anc/text/catalog/product/view/options/type/anctext.phtml</template>
</action>
<action method="addOptionRenderer">
<type>ancimage</type>
<block>anc_image/catalog_product_view_options_type_ancimage</block>
<template>anc/image/catalog/product/view/options/type/ancimage.phtml</template>
</action>
<!-- <action method="addOptionRenderer">
<type>ancaddressimport</type>
<block>anc_addressimport/catalog_product_view_options_type_ancaddressimport</block>
<template>anc/addressimport/catalog/product/view/options/type/ancaddressimport.phtml</template>
</action>
<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>
<customer_account>
<reference name="customer_account_navigation">
<!--<action method="addLink"><name>galleriesmanager</name><path>ancimage/customer/galleriesmanager</path><label>Verwalten Sie Ihre Bilder</label><urlParams /></action>-->
<action method="addLink"><name>galleriestextmanager</name><path>anctext/customer/galleriesmanager</path><label>Verwalten Sie Ihre Texte</label><urlParams /></action>
</reference>
<reference name="head">
<!-- <action method="addJs"><script>Anc/Text/extlib/dropzone.js</script></action>
<action method="addCss"><stylesheet>css/anc/text/dropzone.css</stylesheet></action>
<action method="addJs"><script>Anc/Text/extlib/jquery.prettyPhoto.js</script></action>
<action method="addCss"><stylesheet>css/anc/text/prettyPhoto.css</stylesheet></action> -->
</reference>
<reference name="right"></reference>
</customer_account>
<catalog_product_view translate="label">
<reference name="head">
<action method="addCss"><stylesheet>css/anc/text/dropzone.css</stylesheet></action>
<action method="addCss"><stylesheet>css/anc/lib/ancextension_type.css</stylesheet></action>
<action method="addCss"><stylesheet>css/anc/text/customer_galleriesmanager.css</stylesheet></action>
<!--<action method="addCss"><stylesheet>css/anc/text/prettyPhoto.css</stylesheet></action>-->
<action method="addJs"><script>Anc/Text/Type.js</script></action>
<!--<action method="addJs"><script>Anc/Text/extlib/dropzone.js</script></action>-->
<!--<action method="addJs"><script>Anc/Text/extlib/jquery.prettyPhoto.js</script></action>-->
<!--<action method="addJs"><script>Anc/Lib/croppic/croppic.min.js</script></action>-->
<!--<action method="addJs"><script>Anc/Lib/Croppic.js</script></action>-->
<!--<action method="addCss"><stylesheet>css/anc/lib/croppic/croppic.css</stylesheet></action>-->
<action method="addJs"><script>Anc/Text/tinymce/js/tinymce/tinymce.min.js</script></action>
</reference>
<reference name="product.info">
</reference>
<reference name="product.info.options">
<!-- @anc_text_eingabetyp -->
<action method="addOptionRenderer">
<type>anctext</type>
<block>anc_text/catalog_product_view_options_type_anctext</block>
<template>anc/text/catalog/product/view/options/type/anctext.phtml</template>
</action>
</reference>
</catalog_product_view>
<anc_text_customer_gallerysimple>
<reference name="head">
<action method="addJs"><script>Anc/Text/extlib/jquery.prettyPhoto.js</script></action>
</reference>
<reference name="content">
<block type="anc_text/galleriesmanager" name="anc_text_gallerysimple" template="anc/text/customer_gallerysimple.phtml" />
</reference>
</anc_text_customer_gallerysimple>
<anc_text_customer_shownctextform>
<reference name="head">
<action method="addCss"><stylesheet>css/anc/lib/ancextension_type.css</stylesheet></action>
<!--<action method="addJs"><script>Anc/Text/Form.js</script></action>-->
<action method="addCss"><stylesheet>css/anc/text/dropzone.css</stylesheet></action>
<action method="addCss"><stylesheet>css/anc/text/prettyPhoto.css</stylesheet></action>
<action method="addJs"><script>Anc/Text/extlib/dropzone.js</script></action>
<!--<action method="addJs"><script>Anc/Text/Form.js</script></action>-->
<action method="addJs"><script>Anc/Text/extlib/jquery.prettyPhoto.js</script></action>
<action method="addJs"><script>Anc/Text/tinymce/js/tinymce/tinymce.min.js</script></action>
<!--notwendig für einzelansicht nicht aber wenn ajaxmaessig geladen wird-->
<!--<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>Anc/Printconfigproduct/tinymce/js/tinymce/tinymce.min.js</name></action>-->
</reference>
<reference name="content">
<block type="anc_text/galleriesmanager" name="anc_text_shownctextform" template="anc/text/customer_shownctextform.phtml" />
</reference>
</anc_text_customer_shownctextform>
<!-- Kürzel_extensionname_contraller_funcion bzw module_controller_action
die controller funktion muss kleingeschrieben sein, nur das A von Action muss groß
Ansicht wird konfiguriert -->
<anc_text_customer_galleriesmanager>
<!-- einbindung von javascript und css -->
<reference name="head">
<action method="addCss"><stylesheet>css/anc/text/customer_galleriesmanager.css</stylesheet></action>
<action method="addCss"><stylesheet>css/anc/lib/ancextension_type.css</stylesheet></action>
<action method="addCss"><stylesheet>css/anc/text/dropzone.css</stylesheet></action>
<action method="addCss"><stylesheet>css/anc/text/prettyPhoto.css</stylesheet></action>
<action method="addJs"><script>Anc/Text/extlib/dropzone.js</script></action>
<action method="addJs"><script>Anc/Text/Type.js</script></action>
<action method="addJs"><script>Anc/Text/extlib/jquery.prettyPhoto.js</script></action>
<action method="addJs"><script>Anc/Text/tinymce/js/tinymce/tinymce.min.js</script></action>
<!--<action method="addJs"><script>Anc/Text/extlib/dropzone.js</script></action>-->
<!--<action method="addCss"><stylesheet>css/anc/text/dropzone.css</stylesheet></action>-->
</reference>
<!-- einbindung des templates -->
<reference name="content">
<!--
type: module/block klasse
name: derzeit egal, so lange (wie gerade der fall) nicht zB mit getChildHtml aufgerufen wird
template: /var/www/Magento/Magento18/app/design/frontend/base/default/template/anc/text/customer_galleriesmanager.phtml liegen
-->
<block type="anc_text/galleriesmanager" name="anc_text_galleriesmanager" template="anc/text/customer_galleriesmanager.phtml" />
</reference>
<reference name="right">
<!--<action method="insert"><name>customer_account_navigation</name></action>-->
<block type="customer/account_navigation" name="customer_account_navigation" before="-" template="customer/account/navigation.phtml">
<action method="addLink" translate="label" module="customer"><name>account</name><path>customer/account/</path><label>Account Dashboard</label></action>
<action method="addLink" translate="label" module="customer"><name>account_edit</name><path>customer/account/edit/</path><label>Account Information</label></action>
<action method="addLink" translate="label" module="customer"><name>address_book</name><path>customer/address/</path><label>Address Book</label></action>
<action method="addLink" translate="label" module="sales"><name>orders</name><path>sales/order/history/</path><label>My Orders</label></action>
<!-- <action method="addLink"><name>galleriesmanager</name><path>ancimage/customer/galleriesmanager</path><label>Verwalten Sie Ihre Bilder</label><urlParams /></action>-->
<action method="addLink"><name>galleriestextmanager</name><path>anctext/customer/galleriesmanager</path><label>Verwalten Sie Ihre Texte</label><urlParams /></action>
</block>
<action method="unsetChild"><name>cart_sidebar</name></action>
<action method="unsetChild"><name>right.reports.product.viewed</name></action>
<remove name="right.poll" />
<remove name="sale.reorder.sidebar" />
<remove name="wishlist_sidebar" />
<action method="unsetChild"><name>right.reports.product.compared</name></action>
<action method="unsetChild"><name>right.permanent.callout</name></action>
</reference>
</anc_text_customer_galleriesmanager>
</layout>
\ 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 -->
<customer_account>
<reference name="customer_account_navigation">
<!--<action method="addLink"><name>galleriesmanager</name><path>ancimage/customer/galleriesmanager</path><label>Verwalten Sie Ihre Bilder</label><urlParams /></action>-->
<action method="addLink"><name>galleriestextmanager</name><path>anctext/customer/galleriesmanager</path><label>Verwalten Sie Ihre Texte</label><urlParams /></action>
</reference>
<reference name="head">
<!-- <action method="addJs"><script>Anc/Text/extlib/dropzone.js</script></action>
<action method="addCss"><stylesheet>css/anc/text/dropzone.css</stylesheet></action>
<action method="addJs"><script>Anc/Text/extlib/jquery.prettyPhoto.js</script></action>
<action method="addCss"><stylesheet>css/anc/text/prettyPhoto.css</stylesheet></action> -->
</reference>
<reference name="right"></reference>
</customer_account>
<catalog_product_view translate="label">
<reference name="head">
<action method="addCss"><stylesheet>css/anc/text/dropzone.css</stylesheet></action>
<action method="addCss"><stylesheet>css/anc/lib/ancextension_type.css</stylesheet></action>
<action method="addCss"><stylesheet>css/anc/text/customer_galleriesmanager.css</stylesheet></action>
<!--<action method="addCss"><stylesheet>css/anc/text/prettyPhoto.css</stylesheet></action>-->
<action method="addJs"><script>Anc/Text/Type.js</script></action>
<!--<action method="addJs"><script>Anc/Text/extlib/dropzone.js</script></action>-->
<!--<action method="addJs"><script>Anc/Text/extlib/jquery.prettyPhoto.js</script></action>-->
<!--<action method="addJs"><script>Anc/Lib/croppic/croppic.min.js</script></action>-->
<!--<action method="addJs"><script>Anc/Lib/Croppic.js</script></action>-->
<!--<action method="addCss"><stylesheet>css/anc/lib/croppic/croppic.css</stylesheet></action>-->
</reference>
<reference name="product.info">
</reference>
<reference name="product.info.options">
<!-- @anc_text_eingabetyp -->
<action method="addOptionRenderer">
<type>anctext</type>
<block>anc_text/catalog_product_view_options_type_anctext</block>
<template>anc/text/catalog/product/view/options/type/anctext.phtml</template>
</action>
<!-- <action method="addOptionRenderer">
<type>ancimage</type>
<block>anc_text/catalog_product_view_options_type_ancimage</block>
<template>anc/image/catalog/product/view/options/type/ancimage.phtml</template>
</action>-->
</reference>
</catalog_product_view>
<!-- for the @AncBundleproduct Extension and the sepcial catalog_product_subview @anc_text_eingabetyp -->
<catalog_product_subview translate="label">
<reference name="head">
<action method="addCss"><stylesheet>css/anc/lib/ancextension_type.css</stylesheet></action>
<!--<action method="addCss"><stylesheet>css/anc/text/dropzone.css</stylesheet></action>-->
<!--<action method="addCss"><stylesheet>css/anc/text/prettyPhoto.css</stylesheet></action>-->
<!--<action method="addJs"><script>Anc/Text/Type.js</script></action>-->
<!-- <action method="addJs"><script>Anc/Text/extlib/dropzone.js</script></action>
<action method="addJs"><script>Anc/Text/extlib/jquery.prettyPhoto.js</script></action>
<action method="addJs"><script>Anc/Lib/croppic/croppic.min.js</script></action>
<action method="addJs"><script>Anc/Lib/Croppic.js</script></action> -->
</reference>
<reference name="content">
<block type="core/template" name="product.subview.text" template="anc/text/manipulate_catalog_product_subview.phtml"/>
</reference>
<reference name="product.info">
</reference>
<reference name="product.info.options">
<!-- @anc_text_eingabetyp -->
<action method="addOptionRenderer">
<type>anctext</type>
<block>anc_text/catalog_product_view_options_type_anctext</block>
<template>anc/text/catalog/product/view/options/type/anctext.phtml</template>
</action>
<action method="addOptionRenderer">
<type>ancaddressimport</type>
<block>anc_addressimport/catalog_product_view_options_type_ancaddressimport</block>
<template>anc/addressimport/catalog/product/view/options/type/ancaddressimport.phtml</template>
</action>
</reference>
</catalog_product_subview>
<anc_text_customer_gallerysimple>
<reference name="head">
<action method="addJs"><script>Anc/Text/extlib/jquery.prettyPhoto.js</script></action>
</reference>
<reference name="content">
<block type="anc_text/galleriesmanager" name="anc_text_gallerysimple" template="anc/text/customer_gallerysimple.phtml" />
</reference>
</anc_text_customer_gallerysimple>
<anc_text_customer_shownctextform>
<reference name="head">
<action method="addCss"><stylesheet>css/anc/lib/ancextension_type.css</stylesheet></action>
<action method="addJs"><script>Anc/Text/Form.js</script></action>
<action method="addCss"><stylesheet>css/anc/text/dropzone.css</stylesheet></action>
<action method="addCss"><stylesheet>css/anc/text/prettyPhoto.css</stylesheet></action>
<action method="addJs"><script>Anc/Text/extlib/dropzone.js</script></action>
<!--<action method="addJs"><script>Anc/Text/Form.js</script></action>-->
<action method="addJs"><script>Anc/Text/extlib/jquery.prettyPhoto.js</script></action>
<!--notwendig für einzelansicht nicht aber wenn ajaxmaessig geladen wird-->
<!--<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>Anc/Printconfigproduct/tinymce/js/tinymce/tinymce.min.js</name></action>
</reference>
<reference name="content">
<block type="anc_text/galleriesmanager" name="anc_text_shownctextform" template="anc/text/customer_shownctextform.phtml" />
</reference>
</anc_text_customer_shownctextform>
<!-- Kürzel_extensionname_contraller_funcion bzw module_controller_action
die controller funktion muss kleingeschrieben sein, nur das A von Action muss groß
Ansicht wird konfiguriert -->
<anc_text_customer_galleriesmanager>
<!-- einbindung von javascript und css -->
<reference name="head">
<action method="addCss"><stylesheet>css/anc/text/customer_galleriesmanager.css</stylesheet></action>
<action method="addCss"><stylesheet>css/anc/lib/ancextension_type.css</stylesheet></action>
<action method="addCss"><stylesheet>css/anc/text/dropzone.css</stylesheet></action>
<action method="addCss"><stylesheet>css/anc/text/prettyPhoto.css</stylesheet></action>
<action method="addJs"><script>Anc/Text/extlib/dropzone.js</script></action>
<action method="addJs"><script>Anc/Text/Type.js</script></action>
<action method="addJs"><script>Anc/Text/extlib/jquery.prettyPhoto.js</script></action>
<!--<action method="addJs"><script>Anc/Text/extlib/dropzone.js</script></action>-->
<!--<action method="addCss"><stylesheet>css/anc/text/dropzone.css</stylesheet></action>-->
</reference>
<!-- einbindung des templates -->
<reference name="content">
<!--
type: module/block klasse
name: derzeit egal, so lange (wie gerade der fall) nicht zB mit getChildHtml aufgerufen wird
template: /var/www/Magento/Magento18/app/design/frontend/base/default/template/anc/text/customer_galleriesmanager.phtml liegen
-->
<block type="anc_text/galleriesmanager" name="anc_text_galleriesmanager" template="anc/text/customer_galleriesmanager.phtml" />
</reference>
<reference name="right">
<!--<action method="insert"><name>customer_account_navigation</name></action>-->
<block type="customer/account_navigation" name="customer_account_navigation" before="-" template="customer/account/navigation.phtml">
<action method="addLink" translate="label" module="customer"><name>account</name><path>customer/account/</path><label>Account Dashboard</label></action>
<action method="addLink" translate="label" module="customer"><name>account_edit</name><path>customer/account/edit/</path><label>Account Information</label></action>
<action method="addLink" translate="label" module="customer"><name>address_book</name><path>customer/address/</path><label>Address Book</label></action>
<action method="addLink" translate="label" module="sales"><name>orders</name><path>sales/order/history/</path><label>My Orders</label></action>
<!-- <action method="addLink"><name>galleriesmanager</name><path>ancimage/customer/galleriesmanager</path><label>Verwalten Sie Ihre Bilder</label><urlParams /></action>-->
<action method="addLink"><name>galleriestextmanager</name><path>anctext/customer/galleriesmanager</path><label>Verwalten Sie Ihre Texte</label><urlParams /></action>
</block>
<action method="unsetChild"><name>cart_sidebar</name></action>
<action method="unsetChild"><name>right.reports.product.viewed</name></action>
<remove name="right.poll" />
<remove name="sale.reorder.sidebar" />
<remove name="wishlist_sidebar" />
<action method="unsetChild"><name>right.reports.product.compared</name></action>
<action method="unsetChild"><name>right.permanent.callout</name></action>
</reference>
</anc_text_customer_galleriesmanager>
</layout>
\ No newline at end of file
<?php
/**
*
* @var $this anc_text/catalog_product_view_options_type_anctext
*
* @package anc_text
* @anc_text_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 20140416
* @author netz.coop eG*
*/
?>
<?php $DropzoneIndex = Mage::helper('anc_lib/data')->getElementIndexForId(); ?>
<?php $dropzone_id = 'anctext-dropzone-id'.$DropzoneIndex; ?>
<?php $ancnote_id = 'ancnote-id'; ?>
<?php $_option = $this->getOption(); ?>
<?php $input_id = 'options_'.$_option->getId().'_text'; ?>
<div class="anctext-anctext anc-productview">
<script type="text/javascript">
function loadNcTextIntoProductGalleryThumbnailButton() {
jQuery('.anc_text_choose').unbind("click").click(function(e){
e.preventDefault();
Anc_Text_Type.loadTextInto(
jQuery(this).data('anc_text_id'),
jQuery('#<?php echo $input_id; ?>'),
jQuery(this).data('anc_text_url'),
jQuery('#<?php echo $dropzone_id; ?>')
);
});
}
</script>
<div class="anctext_type anc-productview-type" id="<?php echo $_option->getSku(); ?>">
<div class="anctext_type-fakewrapper anc-productview-type-fakewrapper">
<div id="<?php echo $ancnote_id; ?>"></div>
<input type="text" 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()) ?>" />
<div class="anctext-info">
<div class="editor"></div>
<div class="text"></div>
</div>
<div class="<?php echo $_option->getSku(); ?>" id="anctext-texteditorarea-id">
<div id="<?php echo $dropzone_id; ?>"
class="dropzone anctext-dropzone"
title=""
data-pxwidth="<?php echo $_option->getTextSizeX() ?>"
data-pxheight="<?php echo $_option->getTextSizeY() ?>"
data-maxfilesizemb="<?php echo $_option->getMaxCharacters() ?>"
>
<?php // $path = Mage::helper('anc_text/nctext')->getNcTextPath($this->getDefaultValue(), 'relative', 'original'); ?>
<?php // $Currentpageinfos = Mage::helper('anc_lib/data')->getCurrentcheckoutcartinfos(); ?>
<?php $ItemInfos= Mage::helper('anc_lib/data')->getCheckoutCartItemInfos(); ?>
<?php // $Cropdata = Mage::helper('anc_text/nctext')->getCropdata($ItemInfos['item_id']); ?>
<div class="preview-database-text"
data-textsrc="<?php echo DS.$path; ?>"
<?php if(is_array($Cropdata)): ?>
data-cropH="<?php echo $Cropdata['cropH']; ?>"
data-cropW="<?php echo $Cropdata['cropW']; ?>"
data-imgH="<?php echo $Cropdata['imgH']; ?>"
data-imgW="<?php echo $Cropdata['imgW']; ?>"
data-imgInitH="<?php echo $Cropdata['imgInitH']; ?>"
data-imgInitW="<?php echo $Cropdata['imgInitW']; ?>"
data-imgX1="<?php echo $Cropdata['imgX1']; ?>"
data-imgY1="<?php echo $Cropdata['imgY1']; ?>"
<?php endif; ?>
>
<?php // if($path):?>
<!--<img src="<?php // echo $path; ?>" />-->
<?php // endif; ?>
</div>
</div>
</div>
</div>
</div>
<!-- Gallerien zum auswählen -->
<?php $gallerie_dropzone_id = 'anctext-dropzone-id'.Mage::helper('anc_lib/data')->getElementIndexForId(); ?>
<div class="anctext_type-possibility anc-productview-possibility">
<?php echo $this->getLayout()
->getBlockSingleton('anc_text/galleriesmanager')
->setTemplate('anc/text/customer_galleries.phtml')
->setIfGalleryCategory(true)
->setSelectorIdDropzoneOwn($gallerie_dropzone_id)
->toHtml(); ?>
<script type="text/javascript">
jQuery(document).ready(function($) {
// damit initialen laden der Gallerie auch die Thumbnail-Bilder-Button funktionieren
loadNcTextIntoProductGalleryThumbnailButton();
});
</script>
</div>
<script type="text/javascript">
jQuery(document).ready(function($) {
var dropzone_params = {
url: "<?php echo $this->getUrl('anctext/customer/uploadText', array()) ?>",
dictDefaultMessage: 'Bild hochladen',
success: function() { this.removeAllFiles(); }
}
var gallery_ajaxData = {
url: "<?php echo $this->getUrl('anctext/customer/gallerysimple', array()) ?> ul.gallery",
context: jQuery(".anctext-customer_galleriesown > .anctext-gallerie-content > .anctext-gallerie-content-view"),
success: function(reponse) {
// damit das hochgeladene Bild auch in der dropbopx angezeigt wird
Anc_Text_Type.loadTextInto(
reponse.id,
// jQuery('#<?php // echo $_option->getSku(); ?> > dd > .input-box > input'),
jQuery('#<?php echo $input_id; ?>'),
'<?php echo DS; ?>'+reponse.path,
jQuery('#<?php echo $dropzone_id; ?>')
);
// damit nach hochladen eines bildes und darauf folgende reloaden der gallerie,
// die (anderen) galleriebilder wieder in die dropbox geladen werden können
loadNcTextIntoProductGalleryThumbnailButton();
},
};
Anc_Text_Type.droppableFile(
jQuery(" #<?php echo $gallerie_dropzone_id; ?>"),
dropzone_params,
jQuery(" #<?php echo $input_id; ?>"),
jQuery(" #<?php echo $ancnote_id; ?>"),
gallery_ajaxData,
false
);
});
</script>
</div>
\ No newline at end of file
<?php
/**
* @input $this->getIfGalleryCategory()
* @input $this->getSelectorIdDropzoneOwn()
*/
?>
<div class="anctext-customer_galleries anc-menu-box">
<div class="anctext-customer_galleries-header anc-menu-box-header">Texte</div>
<div id="accordion" class="anc-menu-box-content">
<?php if($this->getIfGalleryCategory()): ?>
<h3 class="anctext-gallerie-header anc-menu-box-content-subheader">Vorlagen</h3>
<div class="anc-menu-box-content-subcontent">
<?php echo $this->getLayout()
->getBlockSingleton('anc_text/galleriesmanager')
->setTemplate('anc/text/customer_galleriescategory.phtml')
->setSelectorIdDropzoneCategory()
->toHtml(); ?>
</div>
<?php endif; ?>
<h3 class="anctext-gallerie-header anc-menu-box-content-subheader">Eigene Texte</h3>
<div class="anc-menu-box-content-subcontent">
<?php echo $this->getLayout()
->getBlockSingleton('anc_text/galleriesmanager')
->setTemplate('anc/text/customer_galleriesown.phtml')
->setSelectorIdDropzoneOwn($this->getSelectorIdDropzoneOwn())
->toHtml(); ?>
</div>
</div>
<script type="text/javascript">
jQuery(document).ready(function($) {
Anc_Text_Type.customerGallerysimplePrettyPhoto();
});
jQuery(function() {
jQuery( "#accordion" ).accordion();
});
</script>
</div>
\ No newline at end of file
<!--/**
* wird geladen wenn der eingabetyp @see @anc_text_eingabetyp genutzt wird
* @package anc_text
* @since 20140425
* @author netz.coop eG*
*/
-->
<?php
$SelectedCategoryNcAlbumModel = Mage::helper('anc_album/nccategory')->getSelectedCategoryNcAlbumModel();
// $SelectedCategoryNcAlbumModel = Mage::helper('anc_album/ncmodel')->getAllCategoryNcAlbums();;
if(is_object($SelectedCategoryNcAlbumModel) && $SelectedCategoryNcAlbumModel->getId()) {
$SelectedCategoryNcAlbumModel_id = $SelectedCategoryNcAlbumModel->getId();
} else {
$SelectedCategoryNcAlbumModel_id = false;
}
?>
<div class="anctext-customer_galleriescategory">
<div class="anctext-gallerie-subheader">
<?php if($this->getSelectorIdDropzone()): ?>
<div id="<?php echo $this->getSelectorIdDropzone(); ?>" class="dropzone anctext-dropzone" title="Bitte ziehen Sie aus Ihrem Dateiexplorer einfach ein Bild in diesen Bereich!"></div>
<?php else: ?>
<div>&nbsp;</div>
<?php endif; ?>
<?php $categories_ncalbums = Mage::helper('anc_album/ncmodel')->getAllCategoryNcAlbums(); ?>
<?php // $categories_ncalbums = Mage::getModel('anc_album/ncmodel')->getAllCategoryNcAlbums(); ?>
<?php // D::s($categories_ncalbums,'$categories_ncalbum',5,1,1);?>
<?php if(is_array($categories_ncalbums) && !empty($categories_ncalbums)): ?>
<div id="anctext-gallerie-subheader-category">
<ul id="menu">
<li>Rubrik <img src="/skin/frontend/base/default/texts/anc/text/unten_25x50.png" />
<ul id="categories_ncalbums">
<?php foreach ($categories_ncalbums as $ncalbum): ?>
<?php $ncalbum_id = $ncalbum['entity_id']; ?>
<li data-ncalbum_id="<?php echo $ncalbum['entity_id'] ?>"
class="<?php if($ncalbum_id===$SelectedCategoryNcAlbumModel_id) { echo 'ui-selected'; } ?>"
>
<?php echo $ncalbum['name'] ?>
</li>
<?php endforeach; ?>
</ul>
</li>
</ul>
</div>
<script type="text/javascript">
var selectOpt = {
selected: function(typ, ui) {
var url = "<?php echo $this->getUrl('anctext/customer/gallerysimple', array()) ?>ncalbum_id/"+ui.selected.dataset['ncalbum_id']+"/ ul.gallery";
var gallerie_csspath = '.anctext-customer_galleriescategory > .anctext-gallerie-content > .anctext-gallerie-content-view';
jQuery(gallerie_csspath).load(url, function() {
Anc_Text_Type.customerGallerysimplePrettyPhoto();
loadNcTextIntoProductGalleryThumbnailButton();
});
jQuery('#menu > li > ul').css('display','none');
}
}
jQuery('#categories_ncalbums').selectable(selectOpt);
jQuery("#menu").menu({
position: {
my:'left top',
at:'left bottom'
}
});
</script>
<?php endif; ?>
</div>
<?php if($SelectedCategoryNcAlbumModel_id === false) { $SelectedCategoryNcAlbumModel_id = $ncalbum_id; } ?>
<div class="anctext-gallerie-content">
<div class="anctext-gallerie-content-view">
<?php echo $this->setTemplate('anc/text/customer_gallerysimple.phtml')->setNcalbumId($SelectedCategoryNcAlbumModel_id)->toHtml(); ?>
</div>
</div>
</div>
\ No newline at end of file
<script type="text/javascript">
function loadNcTextIntoFormThumbnailButton() {
console.log('loadNcTextIntoFormThumbnailButton');
jQuery('.anc_text_choose').unbind("click").click(function(e) {
e.preventDefault();
loadNcTextIntoForm(jQuery(this).data('site'), jQuery(this).data('anc_text_id'));
});
}
function loadNcTextIntoForm(param_url, param_id) {
console.log(param_url);
console.log(param_id);
console.log('loadNcTextIntoForm');
// ajax_gettextinfo(param_id);
jQuery(".anctext-customer_galleriesmanager * #anctext-customer_galleriesmanager-form-content").load(param_url, function() {
jQuery('#anctext-customer_showNcTextFormDelete').submit(function() { // catch the form's submit event
jQuery.ajax({ // create an AJAX call...
data: jQuery(this).serialize(), // get the form data
type: jQuery(this).attr('method'), // GET or POST
url: jQuery(this).attr('action'), // the file to call
success: function(response) { // on success..
jQuery('.anctext-customer_galleriesmanager * #anctext-customer_galleriesmanager-form-content').html(response); // update the DIV
}
});
return false; // cancel original event to prevent form submitting
});
jQuery('#anctext-customer_showNcTextForm').submit(function() { // catch the form's submit event
jQuery.ajax({// create an AJAX call...
data: jQuery(this).serialize(), // get the form data
type: jQuery(this).attr('method'), // GET or POST
url: jQuery(this).attr('action'), // the file to call
success: function(response) { // on success..
jQuery('.anctext-customer_galleriesmanager * #anctext-customer_galleriesmanager-form-content').html(response); // update the DIV
}
});
return false; // cancel original event to prevent form submitting
});
});
}
</script>
<div class="anctext-customer_galleriesmanager">
<?php if (Mage::getSingleton('customer/session')->isLoggedIn()): ?>
<div class="col2-set">
<div class="col-1">
<div class="anctext-customer_galleriesmanager-form">
<div class="anctext-customer_galleriesmanager-main"><h1>Ihre Texte</h1></div>
<div class="anctext-customer_galleriesmanager-content" id="anctext-customer_galleriesmanager-form-content">
<input type="hidden" onchange="opConfig.reloadPrice()" id="anc_text_id" data-info="toll" class="data-anc_text_id" name="data-anc_text_id_options" value="<?php echo ''; ?>" />
<input type="hidden" onchange="opConfig.reloadPrice()" id="anc_customer_id" class="data-anc_customer_id" name="data-anc_customer_id_options" value="<?php echo ''; ?>" />
<input type="hidden" onchange="opConfig.reloadPrice()" id="anc_admin_id" class="data-anc_admin_id" name="data-anc_admin_id_options" value="<?php echo ''; ?>" />
<input type="hidden" onchange="opConfig.reloadPrice()" id="ncalbum_id" class="data-ncalbum_id" name="data-anc_admin_id_options" value="<?php echo ''; ?>" />
<input type="hidden" onchange="opConfig.reloadPrice()" id="used_byitem_id" class="data-used_byitem_id" name="data-used_byitem_id_options" value="<?php echo ''; ?>" />
<input type="hidden" onchange="opConfig.reloadPrice()" id="ordered" class="data-ordered" name="data-ordered_options" value="<?php echo ''; ?>" />
</div>
</div>
</div>
<div class="col-2">
<?php // $dropzone_id = 'anctext-dropzone-id' . Mage::helper('anc_lib/data')->getElementIndexForId(); ?>
<?php $ancnote_id = 'ancnote-id'; ?>
<?php
echo $this->getLayout()
->getBlockSingleton('anc_text/galleriesmanager')
->setTemplate('anc/text/customer_galleries.phtml')
->setSelectorIdDropzoneOwn($dropzone_id)
->toHtml();
?>
<script type="text/javascript">
jQuery(document).ready(function($) {
var dropzone_params = {
url: "<?php echo $this->getUrl('anctext/customer/createText', array()) ?>",
dictDefaultMessage: 'Text erstellen',
success: function() {
this.removeAllFiles();
}
}
var gallery_ajaxData = {
url: "<?php echo $this->getUrl('anctext/customer/gallerysimple', array()) ?> ul.gallery",
context: jQuery(".anctext-customer_galleriesown > .anctext-gallerie-content > .anctext-gallerie-content-view"),
success: function(reponse) {
// damit die gallerie auch klickbar ist
loadNcTextIntoFormThumbnailButton();
// damit hochgeladenes Bild auch im Formular gleich angezeigt wird
loadNcTextIntoForm('<?php echo $this->getUrl('anctext/customer/showNcTextForm', array()) ?>id/'+reponse.id+'/');
},
};
jQuery('div.wrapper div.page div.main-container.col2-right-layout div.main div.col-main div.anctext-customer_galleriesmanager div.col2-set div.col-2 div.anctext-customer_galleries.anc-menu-box div#accordion.anc-menu-box-content.ui-accordion.ui-widget.ui-helper-reset div#ui-id-2.anc-menu-box-content-subcontent.ui-accordion-content.ui-helper-reset.ui-widget-content.ui-corner-bottom.ui-accordion-content-active div.anctext-customer_galleriesown div.anctext-gallerie-subheader div.anctext-gallerie-subheader-category').append('<div id="createtext" ><a class="anc_text_choose" href="#" data-site="<?php echo Mage::getBaseUrl ();?>anctext/customer/showNcTextForm/id/0/">Text erstellen</a></div>');
// Anc_Text_Type.droppableFile(
// jQuery(" #<?php // echo $dropzone_id; ?>"),
// dropzone_params,
// null,
// jQuery(" #<?php // echo $ancnote_id; ?>"),
// gallery_ajaxData,
// false
// );
});
</script>
</div>
</div>
<script type="text/javascript">
jQuery(document).ready(function($) {
loadNcTextIntoFormThumbnailButton();
});
</script>
<?php else: ?>
<h1>Bitte loggen Sie sich ein!</h1>
<?php endif; ?>
</div>
<script type="text/javascript">
function loadNcTextIntoFormThumbnailButton() {
jQuery('.anc_text_choose').unbind("click").click(function(e){
e.preventDefault();
loadNcTextIntoForm(jQuery(this).data('site'));
});
}
function loadNcTextIntoForm(param_url) {
jQuery(".anctext-customer_galleriesmanager * #anctext-customer_galleriesmanager-form-content").load(param_url, function() {
jQuery('#anctext-customer_showNcTextFormDelete').submit(function() { // catch the form's submit event
jQuery.ajax({ // create an AJAX call...
data: jQuery(this).serialize(), // get the form data
type: jQuery(this).attr('method'), // GET or POST
url: jQuery(this).attr('action'), // the file to call
success: function(response) { // on success..
jQuery('.anctext-customer_galleriesmanager * #anctext-customer_galleriesmanager-form-content').html(response); // update the DIV
}
});
return false; // cancel original event to prevent form submitting
});
jQuery('#anctext-customer_showNcTextForm').submit(function() { // catch the form's submit event
jQuery.ajax({ // create an AJAX call...
data: jQuery(this).serialize(), // get the form data
type: jQuery(this).attr('method'), // GET or POST
url: jQuery(this).attr('action'), // the file to call
success: function(response) { // on success..
jQuery('.anctext-customer_galleriesmanager * #anctext-customer_galleriesmanager-form-content').html(response); // update the DIV
}
});
return false; // cancel original event to prevent form submitting
});
});
}
</script>
<div class="anctext-customer_galleriesmanager">
<?php if(Mage::getSingleton('customer/session')->isLoggedIn()): ?>
<div class="col2-set">
<div class="col-1">
<div class="anctext-customer_galleriesmanager-form">
<div class="anctext-customer_galleriesmanager-main"><h1>Ihre Motive</h1></div>
<div class="anctext-customer_galleriesmanager-content" id="anctext-customer_galleriesmanager-form-content"></div>
</div>
</div>
<div class="col-2">
<?php $dropzone_id = 'anctext-dropzone-id'.Mage::helper('anc_lib/data')->getElementIndexForId(); ?>
<?php $ancnote_id = 'ancnote-id'; ?>
<?php echo $this->getLayout()
->getBlockSingleton('anc_text/galleriesmanager')
->setTemplate('anc/text/customer_galleries.phtml')
->setSelectorIdDropzoneOwn($dropzone_id)
->toHtml(); ?>
<script type="text/javascript">
jQuery(document).ready(function($) {
var dropzone_params = {
url: "<?php echo $this->getUrl('anctext/customer/uploadText', array()) ?>",
dictDefaultMessage: 'Text hochladen',
success: function() { this.removeAllFiles(); }
}
var gallery_ajaxData = {
url: "<?php echo $this->getUrl('anctext/customer/gallerysimple', array()) ?> ul.gallery",
context: jQuery(".anctext-customer_galleriesown > .anctext-gallerie-content > .anctext-gallerie-content-view"),
success: function(reponse) {
// damit die gallerie auch klickbar ist
loadNcTextIntoFormThumbnailButton();
// damit hochgeladenes Bild auch im Formular gleich angezeigt wird
loadNcTextIntoForm('<?php echo $this->getUrl('anctext/customer/showNcTextForm', array())?>id/'+reponse.id+'/');
},
};
Anc_Text_Type.droppableFile(
jQuery(" #<?php echo $dropzone_id; ?>"),
dropzone_params,
null,
jQuery(" #<?php echo $ancnote_id; ?>"),
gallery_ajaxData,
false
);
});
</script>
</div>
</div>
<script type="text/javascript">
jQuery(document).ready(function($) {
loadNcTextIntoFormThumbnailButton();
});
</script>
<?php else: ?>
<h1>Bitte loggen Sie sich ein!</h1>
<?php endif; ?>
</div>
<!--/**
* wird geladen wenn der eingabetyp @see @anc_text_eingabetyp genutzt wird
* @package anc_text
* @since 20140425
* @author netz.coop eG*
*/ /html/body/div/div/div[2]/div/div[1]/div/div/div[2]/div/div[2]/div/div/div[1]/div[2]/div
html body.anc-text-customer-galleriesmanager div.wrapper div.page div.main-container.col2-right-layout div.main div.col-main div.anctext-customer_galleriesmanager div.col2-set div.col-2 div.anctext-customer_galleries.anc-menu-box div#accordion.anc-menu-box-content.ui-accordion.ui-widget.ui-helper-reset div#ui-id-2.anc-menu-box-content-subcontent.ui-accordion-content.ui-helper-reset.ui-widget-content.ui-corner-bottom.ui-accordion-content-active div.anctext-customer_galleriesown div.anctext-gallerie-subheader div div#createtext
html body.anc-text-customer-galleriesmanager div.wrapper div.page div.main-container.col2-right-layout div.main div.col-main div.anctext-customer_galleriesmanager div.col2-set div.col-2 div.anctext-customer_galleries.anc-menu-box div#accordion.anc-menu-box-content.ui-accordion.ui-widget.ui-helper-reset div#ui-id-2.anc-menu-box-content-subcontent.ui-accordion-content.ui-helper-reset.ui-widget-content.ui-corner-bottom.ui-accordion-content-active div#createtext
html body.anc-text-customer-galleriesmanager div.wrapper div.page div.main-container.col2-right-layout div.main div.col-main div.anctext-customer_galleriesmanager div.col2-set div.col-2 div.anctext-customer_galleries.anc-menu-box div#accordion.anc-menu-box-content.ui-accordion.ui-widget.ui-helper-reset div#ui-id-2.anc-menu-box-content-subcontent.ui-accordion-content.ui-helper-reset.ui-widget-content.ui-corner-bottom.ui-accordion-content-active div.anctext-customer_galleriesown div.anctext-gallerie-subheader.createtext
-->
<script type="text/javascript">
function ajax_createtexts(ncinput_id) {
var ajax_edittext_data = {
url: "<?php echo Mage::getUrl('anctext/customer/savecustomertext'); ?>",
method: 'Post',
// dataType:"json",
data: {ncinput_id: 0,new:'new'},
success: function(data, textStatus, jqXhr) {
console.log(data);
var parseddata = jQuery.parseJSON(data);
console.log(parseddata);
jQuery("#<?php echo $input_id; ?>").attr('value', parseddata.id);
// if (ifredirectAfterSubmit) {
// ajax_gettextinfo(parseddata.id)
//
//// redirectAfterSubmit(data, url, backurl);
// }
}
};
jQuery.ajax(ajax_edittext_data);
}
var gallery_ajaxData = {
url: "<?php echo $this->getUrl('anctext/customer/gallerysimple', array()) ?> ul.gallery",
context: jQuery(".anctext-customer_galleriesown > .anctext-gallerie-content > .anctext-gallerie-content-view"),
success: function(reponse) {
// damit die gallerie auch klickbar ist
loadNcTextIntoFormThumbnailButton();
// damit hochgeladenes Bild auch im Formular gleich angezeigt wird
loadNcTextIntoForm('<?php echo $this->getUrl('anctext/customer/showNcTextForm', array()) ?>id/'+reponse.id+'/');
},
};
</script>
<!--<div id="createtext" onclick="ajax_createtexts(0)">><span>Text erstellen</span></div>-->
<!--jQuery('.anctext-gallerie-subheader').append('<div id="createtext" ><span>Text erstellen</span></div>');-->
<div class="anctext-customer_galleriesown">
<div class="anctext-gallerie-subheader">
<?php if($this->getSelectorIdDropzoneOwn()): ?>
<div id="<?php echo $this->getSelectorIdDropzoneOwn(); ?>" class="dropzone anctext-dropzone" title="Bitte ziehen Sie aus Ihrer Galerie oder Ihrem Dateiexplorer einfach ein Bild in diesen Bereich!"></div>
<?php else: ?>
<div>&nbsp;</div>
<?php endif; ?>
<div class="anctext-gallerie-subheader-category"></div>
</div>
<div class="anctext-gallerie-content">
<?php if(Mage::getSingleton('customer/session')->isLoggedIn()): ?>
<!-- Anzeige der Daten -->
<div class="anctext-gallerie-content-view">
<?php $customer = Mage::getSingleton('customer/session')->getCustomer(); ?>
<?php $ncalbum_id = Mage::getModel('anc_album/ncalbum')->load($customer->getId(), 'customer_id')->getId(); ?>
<?php echo $this->setTemplate('anc/text/customer_gallerysimple.phtml')->setNcalbumId($ncalbum_id)->toHtml(); ?>
</div>
<?php else: ?>
<div id="ancnote" class="anc-error">Sie sind nicht angemeldet!<br/>Nutzen Sie die Vorzüge eines eigenen Textmoduls in der Sie Ihre Texte verwalten können!</div>
<?php endif; ?>
</div>
</div>
<?php // $NcTexts = Mage::helper('anc_text/ncmodel')->getNcTextsForCustomer(); ?>
<?php
if(!$ncalbum_id = $this->getNcalbumId()) {
$ncalbum_id = Mage::app()->getRequest()->getParam('ncalbum_id');
}
if(!$ncalbum_id) {
$customer = Mage::getSingleton('customer/session')->getCustomer();
$ncalbum_id = Mage::getModel('anc_album/ncalbum')->load($customer->getId(), 'customer_id')->getId();
}
if($ncalbum_id) {
$NcTexts = Mage::helper('anc_text/ncmodel')->getNcTextsForAlbum($ncalbum_id);
} else {
// D::li('getNcTextsForCustomer() - nix mit album aber anscheinend wohl trotzdem keine texte in der gallerie');
$NcTexts = Mage::helper('anc_text/ncmodel')->getNcTextsForCustomer();
}
?>
<ul class="gallery AncGalleryTexts">
<?php $var_count=0?>
<?php foreach($NcTexts as $nctext ): ?>
<?php if($var_count%2 ==0){
$var_cssanctextwrapper='anc_text_wrapper_bg_white';
}else{
$var_cssanctextwrapper='anc_text_wrapper';
}
?>
<?php $NcTextPath = Mage::helper('anc_text/nctext')->getNcTextPath($nctext['entity_id'], 'relative', 'thumbnail'); ?>
<?php $NcTextPath_original = Mage::helper('anc_text/nctext')->getNcTextPath($nctext['entity_id'], 'relative', 'original'); ?>
<?php $nctext_title = Mage::helper('anc_text/nctext')->getNcTextMetaDataAsHtml($nctext['entity_id']); ?>
<a data-site="<?php echo $this->getUrl('anctext/customer/showNcTextForm', array('id'=>$nctext['entity_id'])) ?>"
class="anctext-showNcTextForm"
rel="prettyPhoto[pp_gal2]"
href="<?php echo DS.$NcTextPath_original ?>"
>
<!--<div class="anc_text_wrapper">-->
<div class="<?php echo $var_cssanctextwrapper?>">
<a class="anc_text_choose"
href="#"
data-anc_text_id="<?php echo $nctext['entity_id'] ?>"
data-anc_text_url="<?php echo DS.$NcTextPath_original ?>"
data-site="<?php echo $this->getUrl('anctext/customer/showNcTextForm', array('id'=>$nctext['entity_id'])) ?>"
title='<?php if($nctext['name']):?><span class="header"><?php echo $nctext['name']; ?></span><?php endif; ?><span class="content"><?php if($nctext['comment']): echo $nctext['comment'].'<br/><br/>'; endif; ?><?php echo $nctext_title; ?></span>'
>
<!--<img src="<?php // echo DS.$NcTextPath ?>" class="anc-text-draggable" id="<?php // echo $nctext['entity_id'] ?>" />-->
<div class='anctext-gallerie-subheader anctexthead' title="<?php echo $nctext_title;?>" id="<?php echo $nctext['entity_id']?>"><?php echo $nctext['name'].' '; ?> ?> </div><br>
<div class='anctextcontentpreview' title="<?php echo $nctext_title;?>" id="<?php echo $nctext['entity_id']?>"><?php echo Mage::helper('anc_printconfigproduct/placeholder')->replaceStringWithArrayValues($nctext['content']).' '; ?> ?> </div><br>
</a>
</div>
</a>
<?php $var_count++;
// D::s($nctext,'nctext',5,1,1);?>
<?php endforeach; ?>
</ul>
<?php // $NcTexts = Mage::helper('anc_text/ncmodel')->getNcTextsForCustomer(); ?>
<?php
$params=Mage::app()->getRequest()->getParams();
// D::s($params,'Mage::app()->getRequest()->getParam',5,1,1);
if(!$ncalbum_id = $this->getNcalbumId()) {
// D::ulli('1',1,1);
$ncalbum_id = Mage::app()->getRequest()->getParam('ncalbum_id');
}
if(!$ncalbum_id) {
// D::ulli('2',1,1);
$customer = Mage::getSingleton('customer/session')->getCustomer();
$ncalbum_id = Mage::getModel('anc_album/ncalbum')->load($customer->getId(), 'customer_id')->getId();
}
if($ncalbum_id) {
if($params['ncobject_album_id'] && $params['ncobjectsingle']){
D::ulli('1',1,1);
$NcTexts = Mage::helper('anc_text/ncmodel')->getNcTextsForAlbum($params['ncobject_album_id']);
}else{
if($params['ncpersonalisiert']===1){
// D::ulli('2',1,1);
$param_arrayFields = array(
'ncalbum_id',
// 'ispersonalized',
'ordered'
);
$param_arrayContent = array(
array('eq' => $ncalbum_id,'eq' => '0'),
// array('eq' => '1'),
array('null' => true),
);
$NcTexts = Mage::helper('anc_text/ncmodel')->getNcTextsForAlbum($ncalbum_id,$param_arrayFields,$param_arrayContent);
}else{
// D::ulli('3',1,1);
$param_arrayFields = array(
'ncalbum_id',
'ispersonalized',
'ordered'
);
$param_arrayContent = array(
// array('eq' => $ncalbum_id,'neq' => '1','eq'=>null),
// array('eq' => '0'),
// array('eq' => '5')
array('eq' => $ncalbum_id),
array('null' => true),
array('null' => true),
// array('eq' => '0'),
// array('eq'=> 'Du nicht'),
);
$NcTexts = Mage::helper('anc_text/ncmodel')->getNcTextsForAlbum($ncalbum_id,$param_arrayFields,$param_arrayContent);
}
}
//ncobjectsingle
} else {
// D::ulli('4',1,1);
// if(Mage::app()->getRequest()->getParam('ncobject_album_id')){
// $NcTexts = Mage::helper('anc_text/ncmodel')->getNcTextsForAlbum($ncalbum_id);
// }else{
$NcTexts = Mage::helper('anc_text/ncmodel')->getNcTextsForCustomer();
// }
// D::li('getNcTextsForCustomer() - nix mit album aber anscheinend wohl trotzdem keine texte in der gallerie');
}
?>
<ul class="gallery AncGalleryTexts">
<?php $var_count=0?>
<?php foreach($NcTexts as $nctext ): ?>
<?php if($var_count%2 ==0){
$var_cssanctextwrapper='anc_text_wrapper_bg_white';
}else{
$var_cssanctextwrapper='anc_text_wrapper';
}
// D::s($nctext,'$nctext',5,1,1)
?>
<?php $NcTextPath = Mage::helper('anc_text/nctext')->getNcTextPath($nctext['entity_id'], 'relative', 'thumbnail'); ?>
<?php $NcTextPath_original = Mage::helper('anc_text/nctext')->getNcTextPath($nctext['entity_id'], 'relative', 'original'); ?>
<?php $nctext_title = Mage::helper('anc_text/nctext')->getNcTextMetaDataAsHtml($nctext['entity_id']); ?>
<a data-site="<?php echo $this->getUrl('anctext/customer/showNcTextForm', array('id'=>$nctext['entity_id'])) ?>"
class="anctext-showNcTextForm"
rel="prettyPhoto[pp_gal2]"
href="<?php echo DS.$NcTextPath_original ?>"
>
<!--<div class="anc_text_wrapper">-->
<div class="<?php echo $var_cssanctextwrapper?>">
<a class="anc_text_choose"
href="#"
data-anc_text_id="<?php echo $nctext['entity_id'] ?>"
data-anc_admin_id="<?php echo $nctext['admin_user_id'];?>"
data-anc_text_url="<?php echo DS.$NcTextPath_original ?>"
data-site="<?php echo $this->getUrl('anctext/customer/showNcTextForm', array('id'=>$nctext['entity_id'])) ?>"
title='<?php if($nctext['name']):?><span class="header"><?php echo $nctext['name']; ?></span><?php endif; ?><span class="content"><?php if($nctext['comment']): echo $nctext['comment'].'<br/><br/>'; endif; ?><?php echo $nctext_title; ?></span>'
>
<div class='anctext-gallerie-subheader anctexthead' title="<?php echo $nctext_title;?>" id="<?php echo $nctext['entity_id']?>"><?php echo $nctext['name'].' '; ?> </div><br>
<div class='anctextcontentpreview' title="<?php echo $nctext_title;?>" id="<?php echo $nctext['entity_id']?>"><?php echo Mage::helper('anc_printconfigproduct/placeholder')->replaceStringWithArrayValues($nctext['content']).' '; ?> ?> </div><br>
</a>
</div>
</a>
<?php $var_count++; ?>
<?php endforeach; ?>
</ul>
<script type="text/javascript">
jQuery(document).ready(function($) {
jQuery('#anc-product-config-area * .anc-productview-type').prepend(jQuery('#anc-product-config-area * .col-main > .ncbreadcrumbs'));
});
</script>
<!--/**
* wird geladen wenn der eingabetyp @see @anc_image_eingabetyp genutzt wird
* @package anc_text
* @since 20140812
* @author netz.coop eG*
*/
-->
<?php
/**
* @input
*/
$NcTextId = $this->getNcTextId() ;
/**
* @input
*/
$AncTextInputId = $this->getAncTextInputId();
$ItemInfos = Mage::helper('anc_lib/data')->getCheckoutCartItemInfos();
if($NcTextId) {
$NcText = Mage::helper('anc_text/ncmodel')->getNcText($NcTextId);
if(is_object($NcText)) {
$ChoosedNcAlbumId = $NcText->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">Text</h3>
<div class="anc-menu-box-content-subcontent">
<?php $nctext_ncalbums = Mage::getModel('anc_album/ncalbum')->getAllTextNcAlbums(); ?>
<?php if(is_array($nctext_ncalbums) && !empty($nctext_ncalbums)): ?>
<div id="nctext_ncalbums">
<li data-ncalbum_id=""
title="<?php echo $ncalbum['comment']; ?>"
<?php if($ChoosedNcAlbumId === $ncalbum['entity_id']):?>class="ui-selected"<?php endif; ?>
>
keine Text ausgewählt
</li>
<?php foreach ($nctext_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="nctext_preview">
</div>
<?php endif; ?>
</div>
</div>
</div>
<script type="text/javascript">
/**
* initial Vorschau der text, falls schon eine text exisitert!
*/
jQuery(document).ready(function(jQuery) {
<?php if($ChoosedNcAlbumId): ?>
loadNcTextPreview(<?php echo $ChoosedNcAlbumId; ?>);
<?php endif; ?>
});
/**
* wenn eine text (ncalbum) ausgewählt worden ist
*/
jQuery('#nctext_ncalbums').selectable({
selected: function(typ, ui) {
loadNcTextPreview(ui.selected.dataset['ncalbum_id']);
}
});
function ajax_edittext(ncalbum_id, ifredirectAfterSubmit, data, url, backurl) {
var ajax_edittext_data = {
url: '<?php echo Mage::getUrl('text/site/edittext',array('item_id' => $ItemInfos['item_id'])); ?>ncalbum_id/'+ncalbum_id+'/',
success : function(data, textStatus, jqXhr) {
var parseddata = jQuery.parseJSON( data );
jQuery("#<?php echo $AncTextInputId; ?>").attr('value',parseddata.nctext_id);
if(ifredirectAfterSubmit) {
redirectAfterSubmit(data, url, backurl);
}
}
};
jQuery.ajax(ajax_edittext_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 redirectAfterSubmitAfterSaveText(data, url, backurl) {
var ncalbum_id = jQuery('#nctext_ncalbums > .ui-selected').data('ncalbum_id');
var nctext_id = jQuery("#<?php echo $AncTextInputId; ?>").attr('value');
// wenn es noch keine text gibt, dann erstelle und speicher
if(!nctext_id && ncalbum_id) {
ajax_edittext(ncalbum_id, true, data, url, backurl);
}
// wenn es eine gibt, aber diese nicht mehr gewollt ist, setze null und speicher
else if(nctext_id && !ncalbum_id) {
jQuery("#<?php echo $AncTextInputId; ?>").attr('value','');
redirectAfterSubmit(data, url, backurl);
}
// ansonsten update text und speicher
else {
ajax_edittext(ncalbum_id, true, data, url, backurl);
}
// redirectAfterSubmit(data, url, backurl);
}
function loadNcTextPreview(param_ncalbum_id, param_loadparam) {
if(param_ncalbum_id) {
// zeige vorschau und ruf die rekursiv auf, damit in der text vorschau die buttons funktionieren
jQuery('#nctext_preview').load(
'<?php echo Mage::getUrl('text/site/showtext',array()); ?>ncalbum_id/'+param_ncalbum_id+'/'+param_loadparam,
function() {
jQuery(document).ready(function($) {
jQuery('#anctext_back').unbind("click").click(function(e){
e.preventDefault();
loadNcTextPreview(param_ncalbum_id, '?show=back');
});
jQuery('#anctext_next').unbind("click").click(function(e){
e.preventDefault();
loadNcTextPreview(param_ncalbum_id, '?show=next');
});
});
}
);
// wenn schon eine texte exisitert, dann aktualisiere sie auch
if(jQuery("#<?php echo $AncTextInputId; ?>").attr('value')) {
jQuery('#ancnote-id').html('');
ajax_edittext(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 speichern mit Ihrem Smartphone den Qr-Code einscannen und sich Ihre mobile Internetseite ansehen.</div>');
}
} else {
jQuery('#nctext_preview').html('');
}
}
</script>
<?php
/**
* @var $this Anc_Text_Block_Options_Type_Customview_Anctext
* @package anc_text
* @anc_text_eingabetyp
* @since 20140416
* @author netz.coop eG*
*/
// D::li('Anc_Text_Block_Options_Type_Customview_Anctext-> temmlate anctext.phtml ???????');
?>
<?php $data = $this->getInfo(); ?>
<h1>anctext.phtml: <?php echo $data['value'] ; ?> wird aufgerufen um informationen zB Warenkorb anzugeben</h1>
\ No newline at end of file
<?xml version="1.0"?>
<config>
<modules>
<Anc_Text>
<active>true</active>
<codePool>local</codePool>
</Anc_Text>
</modules>
</config>
\ No newline at end of file
This diff is collapsed. Click to expand it.
/**
* @package anc_text
* @since 20140416
* @copyright (c) netz.coop eG
* @author netz.coop eG
*/
//$.noConflict();
var Anc_Text_Typeadmin = {
"pastDraggable" : "",
/**
*
* @param element param_dropzone_element - welches die dropzone darstellen soll
* @param element param_input_element - optional - set input.value - bekommt die rückgabe id vom hochgeladenen bild
* @param string param_url_upload - url die das bild entgegen nimmt
* @param element param_note_element - rückgabe notiz (fehler, erfolgreich)
* @returns {undefined}
*/
"droppableFile" : function(param_dropzone_element, param_input_element, param_url_upload, param_note_element, param_url_simpleowngallery,param_secure) {
/**
* fnc teil der die dateien aus dem dateiexplorer entgegen nimmt
*/
param_dropzone_element.dropzone({
url: param_url_upload,
paramName: "file", // The name that will be used to transfer the file
maxFilesize: 50, // MB
maxFiles: 10,
params: { form_key : param_secure },
// maxfilesexceeded: function(file) { },
processing: function(file) {
jQuery(" button.button ").attr("disabled", "disabled");
param_note_element.append('<div>Bild wird hochgeladen. Bitte warten!</div>');
jQuery(" > .preview-database-text ", param_dropzone_element).remove();
jQuery(" > img ", param_dropzone_element).remove();
this.removeAllFiles();
},
init: function() {
this.on("complete", function (file) {
if (this.getUploadingFiles().length === 0 && this.getQueuedFiles().length === 0) {
// alert('file.width: '+file.width+' file.height: '+file.height);
}
});
this.on("success", function(file,rep) {
var reponse = jQuery.parseJSON( rep );
if(param_input_element) {
param_input_element.attr('value', reponse.id);
}
if(reponse.status === 'OK') {
var noteclass = 'anc-success';
jQuery(".anc-text-owngallery-content .anc-text-owngallery-content-view").load(param_url_simpleowngallery, function() {});
} else {
var noteclass = 'anc-error';
}
jQuery(" button.button ").attr("disabled", false);
jQuery(" div ", param_note_element).remove();
param_note_element.append('<div class="'+noteclass+'">'+reponse.message+'</div>');
});
}
});
var droppable_opt = {
accept:".anc-text-draggable",
tolerance: 'touch',
drop: function(typ, ui) {
var currentDraggable = jQuery(ui.draggable).attr('id');
jQuery(this).append(jQuery(ui.draggable).clone());
if(param_input_element) {
param_input_element.attr('value', ui.draggable.attr('id'));
}
jQuery(" > div ", param_dropzone_element).remove();
//If there is an object prior to the current one
if (this.pastDraggable != "") {
jQuery("#" + this.pastDraggable).remove(); //Place past object into its original coordinate
}
this.pastDraggable = currentDraggable;
},
activate: function(typ, ui) {},
deactivate: function(typ, ui) {},
over: function(typ, ui) {},
out: function(typ, ui) {
jQuery(ui.draggable).remove(); // jQuery(this).droppable('option', 'accept', '.anc-text-draggable');
},
}
param_dropzone_element.droppable(droppable_opt);
},
"draggableFile" : function() {
var draggable_opt = {
revert: "invalid", // im zweifel gehts wieder zurück zum ursprung
cursor: "move", // mauszeiger ....
containment: "#ancsubbundleproduct", // element darf nur innerhalb von containment bewegt werden
opacity: .5,
snap:true, // einrasten
snapMode:"inner",
grid: [10,10],
stack: '.anc-text-draggable', // letzter drop liegt vorne
helper: 'clone', // nicht moven sondern kopieren
// snapTolerance:50,
}
jQuery(' .anc-text-draggable').draggable(draggable_opt);
}
}
\ No newline at end of file
This diff could not be displayed because it is too large.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!