Commit b49f2384 by netz.coop

GPL

0 parents
Showing with 2672 additions and 0 deletions
/**
* @category freeSN
* @mailto code [at] netz.coop
* @version 0.4.200901
* @link http://netz.coop
*
* @copyright Copyright by netz.coop e.G. 2015
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
\ No newline at end of file
ln -s /var/www/Magento/AncLib/app/design/adminhtml/layout/lib.xml /var/www/Magento/Magento19/app/design/adminhtml/default/default/layout/anc/
\ No newline at end of file
select "-- AncAlbum lösche Datenbank Tabellen";
select "-- lösche mag_core_resource / anc_album_setup";
DELETE FROM `mag_core_resource` WHERE `mag_core_resource`.`code` = 'anc_album_setup';
--select "-- lösche mag_anc_album";
DROP TABLE mag_anc_album;
-- DROP TABLE mag_anc_album_ncsite;
#!/bin/bash
APPBASE="Anc"
APPNAME="Album"
APPBASELC="anc"
APPNAMELC="album"
APPDIR="/var/www/$2/${APPBASE}${APPNAME}"
echo "############"
echo "###########"
echo "########## ${APPBASE}${APPNAME} SETUP SCRIPT"
####
#
#
##
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}"
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 -p "$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 -p "$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/${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 -p "$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/${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 "$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
<?php
/**
* @package anc_album
* @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_Album_Block_Adminhtml_Albums extends Mage_Adminhtml_Block_Widget_Grid_Container {
public function __construct() {
//where is the controller
$this->_controller = 'adminhtml_albums';
$this->_blockGroup = 'anc_album';
$this->_headerText = Mage::helper('anc_album/data')->__('Album');
// //value of the add button
$this->_addButtonLabel = Mage::helper('anc_album/data')->__('Admin Album erstellen');
$varurlimages = $this->getUrl('image/adminhtml_image/list', array(
'target' => '_blank',
// 'type'=> 'text',
)
);
// $this->getMainButtonsHtml();
// $this->addType('ancbutton','Anc_Album_Lib_Varien_Data_Form_Element_ExtendedLabel');
// $this->addField('myimage', 'ancbutton', array(
// 'label' => 'Bilder verwalten',
// 'name' => 'mycustom_element',
// 'required' => false,
// 'value' => $varurlimages,
// 'bold' => true,
// 'label_style' => 'font-weight: bold;color:red;',
// ));
parent::__construct();
}
public function getCreateUrl()
{
/**
* Wichtig für Add Button
*/
return $this->getUrl(
'album/adminhtml_album/edit'
);
}
}
<?php
/**
* @package anc_album
* @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_Album_Block_Adminhtml_Albums_Edit
extends Mage_Adminhtml_Block_Widget_Form_Container
{
public function __construct()
{
parent::__construct();
// parent::__construct();
// $this->_addButton('save_and_continue', array(
// 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
// 'onclick' => 'saveAndContinueEdit()',
// 'class' => 'save',
// ), -100);
$this->_addButton('saveandcontinue', array(
'label' => Mage::helper('adminhtml')->__('Speichern und Bearbeitung fortsetzen'),
'onclick' => 'saveAndContinueEdit()',
'class' => 'save',
), -100);
$this->_objectId = 'id';
$this->_controller = 'albums';
$this->_blockGroup = 'anc_album_adminhtml';
$this->_mode = 'edit';
// parent::__construct();
$this->_updateButton('save', 'label', $this->__('Speichern'));
$this->_updateButton('delete', 'label', $this->__('Delete'));
$this->_formScripts[] = "
function toggleEditor() {
if (tinyMCE.getInstanceById('form_content') == null) {
tinyMCE.execCommand('mceAddControl', false, 'edit_form');
} else {
tinyMCE.execCommand('mceRemoveControl', false, 'edit_form');
}
}
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_album
* @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_Album_Block_Adminhtml_Albums_Edit_Form extends Mage_Adminhtml_Block_Widget_Form {
// public function __construct() {
//// parent::__construct();
//// $this->_removeButton('back');
// }
protected function _prepareForm() {
if (Mage::registry('anc_album')) {
$data = Mage::registry('anc_album')->getData();
} else {
$data = array();
}
$form = new Varien_Data_Form(array(
'id' => 'edit_form',
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
'method' => 'post',
'enctype' => 'multipart/form-data'
)
);
$form->setUseContainer(true);
$this->setForm($form);
$form->setValues($data);
return parent::_prepareForm();
}
}
<?php
/**
* @package anc_album
* @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_Album_Block_Adminhtml_Albums_Edit_Tab_Content extends Mage_Adminhtml_Block_Widget_Form {
protected function _prepareForm() {
/**
* Zur Dropzone
*/
$varParam = $this->getRequest()->getParams();
if($varParam['id']){
$this->setTemplate('anc/album/admin_owngallery.phtml');
}else{
// Mage::getSingleton('adminhtml/session')
// ->addError(Mage::helper('anc_album/data')->__('Bitte Album speichern'));
// Mage::getSingleton('adminhtml/session')
// ->addSuccess(Mage::helper('anc_album/data')->__('Bitte Album speichern um Bilder hinzuzufügen'));
echo '<h1 style="color:orange;" >'.Mage::helper('anc_album/data')->__('Album speichern um Bilder hinzuzufügen').'</h1>';
}
return parent::_prepareForm();
}
}
<?php
/**
* @package anc_album
* @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_Album_Block_Adminhtml_Albums_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
protected function _prepareForm() {
if (Mage::registry('anc_album')) {
$data = Mage::registry('anc_album')->getData();
} else {
$data = array();
}
$varParam = $this->getRequest()->getParams();
$form = new Varien_Data_Form();
$this->setForm($form);
$fieldset = $form->addFieldset('anc_album', array('name' => 'name')); //Mage::helper('news')->__('news information')));
$fieldset->addField('name', 'text', array(
'label' => Mage::helper('anc_album/data')->__('Name'),
// 'class' => 'required-entry',
// 'required' => true,
'name' => 'name',
));
$fieldset->addField('comment', 'textarea', array(
'label' => Mage::helper('anc_album/data')->__('Comment'),
// 'class' => 'required-entry',
// 'required' => true,
'name' => 'comment',
));
$fieldset->addField('url_rewrite', 'text', array(
'label' => Mage::helper('anc_album/data')->__('url_rewrite'),
// 'class' => 'required-entry',
// 'required' => true,
'name' => 'url_rewrite',
));
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('isplaylist', 'radios', array(
'label' => Mage::helper('anc_album/data')->__('Playlist'),
'name' => 'isplaylist',
'onclick' => "",
'onchange' => "",
'value' => '1',
'values' => array(
array('value' => '1', 'label' => 'Ja'),
array('value' => '0', 'label' => 'Nein'),
),
'disabled' => false,
'readonly' => false,
'tabindex' => 1
));
$fieldset->addField('iscategory', 'radios', array(
'label' => Mage::helper('anc_album/data')->__('Kategorie'),
'name' => 'iscategory',
'onclick' => "",
'onchange' => "",
'value' => '1',
'values' => array(
array('value' => '1', 'label' => 'Ja'),
array('value' => '0', 'label' => 'Nein'),
),
'disabled' => false,
'readonly' => false,
'tabindex' => 1
));
$fieldset->addField('categoryshowinproductselection', 'radios', array(
'label' => Mage::helper('anc_album/data')->__('Zeige in Produktauswahl'),
'name' => 'categoryshowinproductselection',
'onclick' => "",
'onchange' => "",
'value' => '1',
'values' => array(
array('value' => '1', 'label' => 'Ja'),
array('value' => '0', 'label' => 'Nein'),
),
'disabled' => false,
'readonly' => false,
'tabindex' => 1
));
$arrayoptions = array('0' => 'Standard Album');
$arrayoptions['1'] = 'Gutscheinecken Album';
if (array_key_exists('isadvertising', $varParam)) {
$var_advertising = $varParam['isadvertising'];
}
$fieldset->addField('isadvertising', 'select', array(
'label' => Mage::helper('anc_album/data')->__('Typ'),
'class' => 'required-entry',
'required' => true,
'name' => 'isadvertising',
'onclick' => "",
'onchange' => "",
'value' => $var_advertising,
'values' => $arrayoptions,
'disabled' => false,
'readonly' => false,
));
$varurlimages = $this->getUrl('image/adminhtml_image/list', array(
'target' => '_blank',
'albumid' => $data['entity_id'],
// 'type'=> 'text',
)
);
$varurltexts = $this->getUrl('text/adminhtml_text/list', array(
'albumid' => $data['entity_id'],
// 'type'=> 'text',
));
$arrayurl=array('albumid'=>$data['entity_id']);
if($data['ncright_id']>0){
$arrayurl['id']=$data['ncright_id'];
}
$varurlrights = $this->getUrl('lib/adminhtml_ncrights/edit', $arrayurl
);
/**
* 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'));
}
$fieldset->addType('ancbutton','Anc_Album_Lib_Varien_Data_Form_Element_ExtendedLabel');
if($varParam['id']){
$fieldset->addField('myimage', 'ancbutton', array(
'label' => 'Bilder verwalten',
'name' => 'mycustom_element',
'required' => false,
'value' => $varurlimages,
'bold' => true,
'label_style' => 'font-weight: bold;color:red;',
));
$fieldset->addField('my_rights', 'ancbutton', array(
'label' => 'Rechte verwalten',
'name' => 'mycustom_element',
'required' => false,
'value' => $varurlrights,
'bold' => true,
'label_style' => 'font-weight: bold;color:red;',
));
$fieldset->addField('my_texts', 'ancbutton', array(
'label' => 'Texte verwalten',
'name' => 'mycustom_element',
'required' => false,
'value' => $varurltexts,
'bold' => true,
'label_style' => 'font-weight: bold;color:red;',
));
}
if (!empty($data)) {
$form->addValues($data);
}
return parent::_prepareForm();
}
}
<?php
/**
* @package anc_album
* @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_Album_Block_Adminhtml_Albums_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs {
public function __construct() {
parent::__construct();
// $this->_removeButton('back');
$this->setId('albums_tabs');
$this->setDestElementId('edit_form'); // this should be same as the form id define above
$this->setTitle('Albums');
}
protected function _beforeToHtml() {
$this->addTab(
'form_section', array(
'name'=>'tab1',
'label' => Mage::helper('anc_album/data')->__('Alben Metadaten'),//'Albums Info', // Mage::helper('news')->__('News Information'),
'title' => Mage::helper('anc_album/data')->__('Alben Metadaten'),//'Albums Info', //Mage::helper('news')->__('News Information'),
'content' => $this->getLayout()->createBlock('anc_album/adminhtml_albums_edit_tab_form')->toHtml(),
'active' => true,
)
);
$this->addTab('form_section1', array(
'name'=>'tab2',
'label' => Mage::helper('anc_album/data')->__('Alben Inhalt'),//'Albums Extras', //Mage::helper('news')->__('Content'),
'title' => Mage::helper('anc_album/data')->__('Alben Inhalt'),//'Albums Extras', //Mage::helper('news')->__('Content'),
'content' => $this->getLayout()->createBlock('anc_album/adminhtml_albums_edit_tab_content')->toHtml(),
));
return parent::_beforeToHtml();
}
}
<?php
/**
* @package anc_album
* @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_Album_Block_Adminhtml_Albums_Grid extends Mage_Adminhtml_Block_Widget_Grid
{
public function __construct()
{
parent::__construct();
// $this->_removeButton('back');
// $this->_removeButton('back');
$this->setId('anc_album_albums_grid');
$this->setDefaultSort('entity_id');
$this->setDefaultDir('DESC');
$this->setSaveParametersInSession(true);
}
protected function _getCollectionClass()
{
return 'anc_album/ncalbum';
}
protected function _prepareCollection()
{
//
$varParam = $this->getRequest()->getParams();
if(array_key_exists('kind', $varParam)&& $varParam['kind']=='users') {
echo "<h1>Alle Alben der Benutzer: </h1>";
echo '<a href="'.$this->getUrl('album/adminhtml_album/list', array('kind' => 'admin',)).'" >Alben Admin</a>';
$collection = Mage::getModel('anc_album/ncalbum')->getCollection()->addFieldToFilter('customer_id',array('gt'=>0));;
}else{
echo "<h1>Alle Alben der Administratoren: </h1>";
echo '<a href="'.$this->getUrl('album/adminhtml_album/list', array('kind' => 'users',)).'" >Alben der Benutzer</a>';
$collection = Mage::getModel('anc_album/ncalbum')->getCollection()->addFieldToFilter('admin_user_id',array('gt'=>0));;
}
// D::s($collection,'$collection',15,1,1);
$this->setCollection($collection);
// D::s($collection,'$collection',5,1,1);
return parent::_prepareCollection();
}
protected function _prepareColumns()
{
$this->addColumn('entity_id',
array(
'header' => Mage::helper('anc_album/data')->__('Id'),
'align' =>'right',
'width' => '50px',
'index' => 'entity_id',
));
$this->addColumn('name',
array(
'header' => Mage::helper('anc_album/data')->__('Name'),
'align' =>'left',
'index' => 'name',
));
$this->addColumn('comment', array(
'header' => Mage::helper('anc_album/data')->__('Comment'),
'align' =>'left',
'index' => 'comment',
));
$this->addColumn('url_rewrite', array(
'header' => Mage::helper('anc_album/data')->__('url_rewrite'),
'align' =>'left',
'index' => 'url_rewrite',
));
$this->addColumn('admin_user_id', array(
'header' => Mage::helper('anc_album/data')->__('Admin'),
'align' =>'left',
'index' => 'admin_user_id',
));
$this->addColumn('customer_id', array(
'header' => Mage::helper('anc_album/data')->__('Customer'),
'align' =>'left',
'index' => 'customer_id',
));
$this->addColumn('created_at', array(
'header' => Mage::helper('anc_album/data')->__('Created'),
'align' =>'left',
'index' => 'created_at',
));
$this->addColumn('updated_at', array(
'header' => Mage::helper('anc_album/data')->__('Updated'),
'align' =>'left',
'index' => 'updated_at',
));
$this->addColumn('isplaylist', array(
'header' => Mage::helper('anc_album/data')->__('Ist Playlist'),
'align' =>'left',
'index' => 'isplaylist',
));
$this->addColumn('iscategory', array(
'header' => Mage::helper('anc_album/data')->__('Ist Kategorie'),
'align' =>'left',
'index' => 'iscategory',
));
$this->addColumn('categoryshowinproductselection', array(
'header' => Mage::helper('anc_album/data')->__('Zeige in Produktauswahl'),
'align' =>'left',
'index' => 'categoryshowinproductselection',
));
//
$this->addColumn('isadvertising', array(
'header' => Mage::helper('anc_album/data')->__('Typ: Werbeecke'),
'align' =>'left',
'index' => 'isadvertising',
));
return parent::_prepareColumns();
}
public function getRowUrl($row)
{
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 Album erstellen'),
'onclick' => "setLocation('".$this->getUrl('*/*/new',array('kind'=>'users'))."')",
'class' => 'task'
))->toHtml();
return $addButton.$html;
}
}
\ No newline at end of file
<?php
/**
* @package anc_album
* @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_Album_Helper_Data extends Mage_Core_Helper_Abstract {
}
\ No newline at end of file
<?php
/**
* @package anc_album
* @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_Album_Helper_Nccategory extends Mage_Core_Helper_Abstract {
/**
* gibt den request_path zurück,
* falls $param_ncalbum übergeben und 'core/url_rewrite' noch nicht exisitert wird diese in getUrlRewrite angelegt
*
* @param Mage_Catalog_Model_Category $param_ncalbumjokercategory
* @param array $param_ncalbum
* @return string - request_path
*/
public function getCategoryUrl (Mage_Catalog_Model_Category $param_ncalbumjokercategory, $param_ncalbum) {
// D::compareFe($param_ncalbumjokercategory, $param_ncalbum, '$param_ncalbumjokercategory, $param_ncalbum');
if(is_object($param_ncalbumjokercategory)) {
if(array_key_exists('url_rewrite', $param_ncalbum) && $param_ncalbum['url_rewrite']) {
$basepath = dirname($param_ncalbumjokercategory->getRequestPath());
$new_request_path = $basepath.'/'.$param_ncalbum['url_rewrite'].'.html';
return $this->getUrlRewrite($new_request_path, $param_ncalbumjokercategory);
} else if($param_ncalbumjokercategory->getParentId()
&& $param_ncalbumjokercategory->getParentCategory()->getName()==='ncalbumjokercategory') {
// $parent_url_rewrite = basename(Mage::app()->getRequest()->getOriginalPathInfo(), ".html");
$SelectedCategoryNcAlbumModel = $this->getSelectedCategoryNcAlbumModel();
if(is_object($SelectedCategoryNcAlbumModel)) {
$parent_url_rewrite = $SelectedCategoryNcAlbumModel->getUrlRewrite();
$ncalbum = Mage::getModel('anc_album/ncalbum')->load($parent_url_rewrite, 'url_rewrite');
if($ncalbum->getUrlRewrite() === $parent_url_rewrite) {
$new_request_path = str_replace("ncalbumjokercategory", $parent_url_rewrite, $param_ncalbumjokercategory->getRequestPath());
return $this->getUrlRewrite($new_request_path, $param_ncalbumjokercategory);
}
}
} else {
return $param_ncalbumjokercategory->getRequestPath();
}
}
}
private $SelectedCategoryNcAlbumModel = null;
private $SelectedCategoryNcAlbumModelByUrl = null;
public function getSelectedCategoryNcAlbumModel() {
$SelectedCategoryNcAlbumModel = Mage::getSingleton('checkout/session')->getSelectedCategoryNcAlbumModel();
// D::fe($SelectedCategoryNcAlbumModel, 'getSelectedCategoryNcAlbumModel');
return $SelectedCategoryNcAlbumModel;
}
/**
* return Anc_Album_Model_Ncalbum
*/
public function getSelectedCategoryNcAlbumModelByUrl() {
// umständlicher Vergleich zwischen current_category und getRequest
if(is_null($this->SelectedCategoryNcAlbumModelByUrl)) {
$current_category = Mage::registry('current_category');
if(is_object($current_category)
&& strpos($current_category->getUrlPath(), 'ncalbumjokercategory') !==false
&& Mage::app()->getRequest()->getParam('id') === $current_category->getId()
) {
$OriginalPathInfo = explode('/', Mage::app()->getRequest()->getOriginalPathInfo());
if(!$OriginalPathInfo[0]) {
array_shift($OriginalPathInfo);
}
$UrlPath = explode('/', $current_category->getUrlPath());
if(!$UrlPath[0]) {
array_shift($UrlPath);
}
if(array_search('ncalbumjokercategory', $UrlPath) !== false) {
$SelectedNcAlbumCategory = $OriginalPathInfo[array_search('ncalbumjokercategory', $UrlPath)];
} else if(array_search('ncalbumjokercategory.html', $UrlPath) !== false) {
$SelectedNcAlbumCategory = $OriginalPathInfo[array_search('ncalbumjokercategory.html', $UrlPath)];
$SelectedNcAlbumCategory = basename($SelectedNcAlbumCategory, ".html");
} else {
D::compareFe($OriginalPathInfo, $UrlPath, '$OriginalPathInfo, $UrlPath');
}
if($SelectedNcAlbumCategory) {
$ncalbum = Mage::getModel('anc_album/ncalbum')->load($SelectedNcAlbumCategory, 'url_rewrite');
if(is_object($ncalbum) && $ncalbum->getId()) {
$this->SelectedCategoryNcAlbumModelByUrl = $ncalbum;
}
}
} else {
$current_product = Mage::registry('current_product');
// D::comparefe($current_product, 'no $current_category!!!!',1,1);
}
}
if(!$this->SelectedCategoryNcAlbumModelByUrl) {
// D::li('Achtung keine $this->SelectedCategoryNcAlbumModelByUrl = $ncalbum; !!! ',1,1);
}
return $this->SelectedCategoryNcAlbumModelByUrl;
}
/**
* schaut nach ob schon exisitert, falls nein wirds erstellt
* und gibt dann den richtigen (durch anc_album/ncalbum.url_rewrite ersetzten) request_path zurück
*
* @param string $new_request_path
* @param Mage_Catalog_Model_Category $param_ncalbumjokercategory
* @return string - request_path
*/
private function getUrlRewrite($new_request_path, Mage_Catalog_Model_Category $param_ncalbumjokercategory) {
$already_url_rewrite = Mage::getModel('core/url_rewrite')->load($new_request_path, 'request_path');
if($already_url_rewrite->getRequestPath() === $new_request_path) {
return $already_url_rewrite->getRequestPath();
} else {
$url_rewrite = Mage::getModel('core/url_rewrite')->load($param_ncalbumjokercategory->getRequestPath(), 'request_path');
$new_url_rewrite = Mage::getModel('core/url_rewrite');
$new_url_rewrite->setRequestPath($new_request_path);
$new_url_rewrite->setStoreId($url_rewrite->getStoreId());
$new_url_rewrite->setIdPath(str_replace('.html', '', $new_request_path));
$new_url_rewrite->setTargetPath($url_rewrite->getTargetPath());
$new_url_rewrite->setOptions($url_rewrite->getOptions());
$new_url_rewrite->setDescription($url_rewrite->getDescription());
$new_url_rewrite->setCategoryId($url_rewrite->getCategoryId());
$new_url_rewrite->setProductId($url_rewrite->getProductId());
$new_url_rewrite->save();
$new_url_rewrite = Mage::getModel('core/url_rewrite')->load($new_request_path, 'request_path');
return $new_url_rewrite->getRequestPath();
}
}
}
<?php
/**
* @package anc_album
* @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_Album_Helper_Ncmodel extends Mage_Core_Helper_Abstract {
/**
private $NcAlbums = array();
/**
*
* @param int $param_ncimage_id
* @return anc_image/ncimage
*/
public function getNcAlbum($param_ncalbum_id) {
if ($param_ncalbum_id) {
if (!array_key_exists($param_ncalbum_id, $this->NcAlbums)) {
// $ncimage = Mage::getModel('anc_image/ncimage')->load($param_ncimage_id);
$ncalbum = Mage::helper('anc_lib/ncrights')->loadNcModel('anc_album/ncalbum', $param_ncalbum_id);
$this->NcAlbums[$param_ncalbum_id] = $ncalbum;
}
return $this->NcAlbums[$param_ncalbum_id];
} else {
return false;
}
}
public function getNcAlbumsForCustomer() {
$customer = Mage::getSingleton('customer/session')->getCustomer();
// return Mage::getModel('anc_image/ncimage')->getCollection()->addFieldToFilter('customer_id', $customer->getId());
return Mage::helper('anc_lib/ncrights')->getNcModelsByOneFilter('anc_album/ncalbum', 'customer_id', $customer->getId());
}
public function createNcAlbumForCustomer() {
$customer = Mage::getSingleton('customer/session')->getCustomer();
$albumdata = array();
$albumdata['customer_id'] = $customer->getId();
$albumdata['admin_user_id'] = '0';
$albumdata['name'] = 'Benutzeralbum ' . $customer->getName() . ' ' . $customer->getId();
$albumdata['url_rewrite'] = 'kundenalbum' . $customer->getId();
$albumdata['isplaylist'] = 0;
$albumdata['iscategory'] = 0;
$model = Mage::getModel('anc_album/ncalbum');
$model->addData($albumdata);
try {
$model->save();
} catch (Exception $e) {
// D::show($e->getMessage());
}
return $model->getId();
}
public function saveNcImage(Anc_Image_Model_Ncimage $param_ncimage) {
if (is_object($param_ncimage)) {
$param_ncimage->save();
$this->NcImages[$param_ncimage->getId()] = $param_ncimage;
return $this->NcImages[$param_ncimage->getId()];
} else {
return false;
}
}
public function deleteNcImage(Anc_Image_Model_Ncimage $param_ncimage) {
if (is_object($param_ncimage)) {
$customer = Mage::getSingleton('customer/session')->getCustomer();
if ($customer->getId() && $customer->getId() === $param_ncimage->getCustomerId()) {
Mage::helper('anc_image/ncmodel')->deleteNcImageFiles($param_ncimage);
$param_ncimage->delete();
// D::s($param_ncimage, '$param_ncimage');
return true;
} else {
return false;
}
} else {
return false;
}
}
public function deleteNcImageFiles(Anc_Image_Model_Ncimage $param_ncimage) {
if (is_object($param_ncimage)) {
$customer = Mage::getSingleton('customer/session')->getCustomer();
if ($customer->getId() && $customer->getId() === $param_ncimage->getCustomerId()) {
// mcFile::deleteFile(Mage::getBaseDir().$param_ncimage->getPath());
mcFile::deleteFile(Mage::helper('anc_lib/ncfilepath')->getThisMagentoInstallationPath() . $param_ncimage->getPath());
return true;
} else {
return false;
}
} else {
return false;
}
}
public function getBlancoNcImageQuoteitemoption() {
return Mage::getModel('anc_image/ncimage_quoteitemoption');
}
/**
* gibt die NcAlben für Kunden zurück
* @todo ncrights
*
* @return type
*/
private function getForCustomer() {
$ItemInfos = Mage::helper('anc_lib/data')->getCheckoutCartItemInfos();
$current_product = $ItemInfos['item_product'];
$ParentItemInfos = Mage::helper('anc_lib/data')->getCheckoutCartParentItemInfos();
$bundle_product = $ParentItemInfos['parent_item_product'];
// Mage::app()->getRequest()->getParam('product_id', 44);
if (is_object($bundle_product) && is_object($current_product)) {
$bundle_product_array = $bundle_product->getData();
$current_product_array = $current_product->getData();
D::ulli('ANCOBJSPEC: ' . $current_product_array['ancobjspecial'], 1);
if ($bundle_product_array['ancobjectncalbumadvertisingid'] > 0 && $current_product_array['ancobjspecial'] === 'isadvertising') {
$album_id = $bundle_product_array['ancobjectncalbumadvertisingid'];
$show_single = $bundle_product_array['ancobjncalbumadvertsingle'];
Mage::app()->getRequest()->setParam('ncobject_album_id', $album_id);
Mage::app()->getRequest()->setParam('ncobjectsingle', $show_single);
} elseif ($bundle_product_array['ancobjectnctextadressid'] > 0 && $current_product_array['ancobjspecial'] === 'adresse') {
$album_id = $bundle_product_array['ancobjectnctextadressid'];
$show_single = $bundle_product_array['ancobjnctextadresssingle'];
Mage::app()->getRequest()->setParam('ncobject_album_id', $album_id);
Mage::app()->getRequest()->setParam('ncobjectsingle', $show_single);
} elseif ($current_product_array['ancobjspecial'] === 'personalisiert') {
$personalisiert = TRUE;
Mage::app()->getRequest()->setParam('ncpersonalisiert', $show_single);
}
}
/**
* Album Ids werden im Bündelprodukt angegeben
* show Single auch
*/
if ($album_id) {
if ($show_single) {
$param_arrayFields = array(
'entity_id',
);
$param_arrayContent = array(
array('eq' => $album_id),
);
} else {
$param_arrayFields = array(
'entity_id',
'iscategory'
);
$param_arrayContent = array(
array('eq' => $album_id),
array('eq' => '1')
);
}
} else {
/**
* Or Condition für Field to filter
*/
if ($personalisiert) {
$param_arrayFields = array(
'iscategory',
// 'ispersonalized'
);
$param_arrayContent = array(
array('eq' => '1'),
// array('eq' => '1')
);
} else {
$param_arrayFields = array(
'iscategory'
);
$param_arrayContent = array(
array('eq' => '1')
);
}
}
$customer = Mage::getSingleton('customer/session')->getCustomer();
$collection = Mage::getModel('anc_album/ncalbum')->getCollection()
->addFieldToFilter('ncright_id', 0)
// ->addFieldToFilter('iscategory', 1)
->addFieldToFilter($param_arrayFields, $param_arrayContent)
->addFieldToFilter('customer_id', 0);
return $collection->getData();
}
public function getAllCategoryNcAlbums() {
return $this->getForCustomer();
}
private function getForCustomerPlaylistNcAlbums() {
$collection = Mage::getModel('anc_album/ncalbum')->getCollection()
->addFieldToFilter('ncright_id', 0)
->addFieldToFilter('isplaylist', 1)
->addFieldToFilter('customer_id', 0);
return $collection->getData();
}
public function getAllPlaylistNcAlbums() {
return $this->getForCustomerPlaylistNcAlbums();
}
public function getFirstImageFromNcalbum($param_id) {
return Mage::helper('anc_lib/ncrights')->getNcModelBy('anc_image/ncimage', 'ncalbum_id', $param_id);
}
}
<?php
/**
* @package anc_album
* @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();
$var_getNctype = $this->getNctype();
// D::s($var_name,'$var_name',5,1,1);
if($var_getNctype=='button'){
$html = '<button title="'.$var_label.'" onclick="window.open(\''.$var_url . '\')"><span>'.$var_label.'</span></button>';
}else if($var_getNctype=='text'){
$html = ''.$var_label.'';
}else{
$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->getMylabel()
. ( $this->getRequired() ? ' <span class="required">*</span>' : '' ).'</label>'."\n";
}
else {
$html = '';
}
return $html;
}
}
\ No newline at end of file
<?php
/**
* @package anc_album
* @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_Album_Model_Ncalbum extends Mage_Core_Model_Abstract {
protected function _construct()
{
parent::_construct();
$this->_init('anc_album/ncalbum');
}
}
\ No newline at end of file
<?php
/**
* @package anc_album
* @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_Album_Model_Ncalbum_Collection extends Mage_Core_Model_Collection_Abstract{
public function _construct(){
$this->_init('anc_album/ncalbum');
parent::_construct();
}
}
\ No newline at end of file
<?php
/**
* @package anc_album
* @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_Album_Model_Observer {
public function checkncalbumjokercategory(Varien_Event_Observer $param_param) {
$SelectedCategoryNcAlbumModel = Mage::helper('anc_album/nccategory')->getSelectedCategoryNcAlbumModelByUrl();
if(is_object($SelectedCategoryNcAlbumModel)) {
Mage::getSingleton('checkout/session')->setSelectedCategoryNcAlbumModel($SelectedCategoryNcAlbumModel);
}
}
}
<?php
/**
* @package anc_album
* @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_Album_Model_Resource_Mysql4_Ncalbum extends Mage_Core_Model_Mysql4_Abstract {
protected function _construct() {
$this->_init('anc_album/ncalbum', 'entity_id');
}
protected function _beforeSave(Mage_Core_Model_Abstract $ncimage) {
if(!$ncimage->getId()) {
$ncimage->setCreatedAt(now());
}
$ncimage->setUpdatedAt(now());
return parent::_beforeSave($ncimage);
}
}
\ No newline at end of file
<?php
/**
* @package anc_album
* @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_Album_Model_Resource_Mysql4_Ncalbum_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract{
public function _construct(){
$this->_init('anc_album/ncalbum');
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_album
* @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_Album_Adminhtml_AdministratorController extends Mage_Adminhtml_Controller_Action {//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_image.xml als link aufrufbar,
* * durch selbige anc_image.xml bekommt die fnc das template @see app/design/frontend/template/ancimage/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 ncimage
*
* Block/Template Funktion
*
*/
// public function showncimageformAction() {
//
// if (Mage::getSingleton('customer/session')->isLoggedIn()) {
// $params=$this->getRequest()->getParams();
// if(is_array($params) && array_key_exists('id', $params)) {
//
// $ncimage = Mage::helper('anc_image/ncmodel')->getNcImage($params['id']);
//D::li($ncimage, '$ncimage'.$params['id']);
// if(is_object($ncimage)) {
//
// if(array_key_exists('name', $params)) {
// $ncimage->setName($params['name']);
// }
// if(array_key_exists('comment', $params)) {
// $ncimage->setComment($params['comment']);
// }
//
// $ncimage = Mage::helper('anc_image/ncmodel')->saveNcImage($ncimage);
// D::compareFe($ncimage,$params, '$ncimage, $this->getParams()');
//
// }
//
// }
//
// $this->loadLayout();
// $this->getLayout()->getBlock('root')->setTemplate('page/empty.phtml');
//// $this->getLayout()->getBlock('content')->append(
//// $this->getLayout()->createBlock('anc_image/owngallery')->setTemplate('anc/image/customer_showNcImageForm.phtml')
//// );
// $this->renderLayout();
// } else {
// echo('nicht eingeloggt');
// }
//
// }
public function simpleowngalleryAction() {
// D::li('simpleowngalleryAction');
$this->loadLayout();
$this->getLayout()->getBlock('root')->setTemplate('page/empty.phtml');
$this->renderLayout();
}
/**
* @param _POST[id] => $this->getRequest()->getParams()[id] -- anc_image/ncimage id
*
*/
// public function deleteNcImageAction() {
// $params=$this->getRequest()->getParams();
// $json_rueckgabe = array();
// if(array_key_exists('id', $params) && $params['id']) {
// $param_id = $params['id'];
//
// $ncimage = Mage::helper('anc_image/ncmodel')->getNcImage($param_id);
//
// if(Mage::helper('anc_image/ncmodel')->deleteNcImage($ncimage)) {
// $json_rueckgabe['status'] = 'OK';
// $json_rueckgabe['message'] = 'Das Bild ('.$ncimage->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);
// }
/**
* http://mag19.lc/index.php/printconfigproduct/adminhtml_tasks/nutzen/qid/1/oid/1/key/312677a8ed3fab83712794fd4cf5a157/
* @param optional _POST[id] => $this->getRequest()->getParams()[id] -- anc_image/ncimage 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 uploadImageAction() {
D::li('uploadImageAction');
$params=$this->getRequest()->getParams();
// D::s($params,'$params',5,1);
if(array_key_exists('id', $params)) {
$param_id = $params['id'];
} else {
$param_id = false;
}
$json_rueckgabe = array();
/* Get the customer data */
// $customer = Mage::getSingleton('customer/session')->getCustomer();
// $userArray = Mage::getSingleton('admin/session')->getData();
//// $admin_id = Mage::getSingleton('admin/session')->getUser()->getId();
// D::li('$admin_id: '.$admin_id);
Mage::getSingleton('core/session', array('name' => 'adminhtml'));
$user = Mage::getSingleton('admin/session');
// $userId = $user->getUser()->getUserId();
if(isset($_FILES['file']['name']) && $_FILES['file']['name'] != '') {
try
{
// $path = Mage::helper('anc_image/ncimage')->getPathForNewNcImage(true); Achtung true war glaube ich eh überflüssig .. fnc hat sich geändert
$path = Mage::helper('anc_image/ncimage')->getPathForNewNcImage('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) {
$ncimage = Mage::helper('anc_image/ncmodel')->getNcImage($param_id);
if(Mage::helper('anc_image/ncmodel')->deleteNcImageFiles($ncimage)) {
} else {
$json_rueckgabe['status'] = 'ERROR';
$json_rueckgabe['message'] = 'Sie habe nicht die Berechtigung!';
echo json_encode($json_rueckgabe);
return;
}
} else {
$ncimage = Mage::getModel('anc_image/ncimage');
}
$ncimage->setData('customer_id',$user->getUserId());
$ncimage->setData('file',$fname);
$ncimage->save();
$ncimage->setData('path', Mage::helper('anc_image/ncimage')->getNcImagePath($ncimage->getId(), 'relative', 'original'));
$ncimage->save();
if($ncimage->getId()) {
$json_rueckgabe['model'] = 'anc_image/ncimage';
$json_rueckgabe['file'] = $fname;
$json_rueckgabe['id'] = $ncimage->getId();
$json_rueckgabe['path'] = $ncimage->getPath();
$json_rueckgabe['status'] = 'OK';
$json_rueckgabe['message'] = 'upload erfolgreich !! ('.$ncimage->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'] = 'ubermittlungsprobleme: Datei konnte nicht gespeichert werden (vielleicht war die Datei groesser als '.@ini_get('post_max_size').' MB)';
}
echo json_encode($json_rueckgabe);
}
protected function _isAllowed() {
return Mage::getSingleton('admin/session')->isAllowed('administrator/*');
}
}
\ No newline at end of file
<?php
/**
* @package anc_album
* @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_Album_Adminhtml_AlbumController extends Mage_Adminhtml_Controller_Action {
// private static $customerid;
public function listAction() {
// D::ulli('list', 1);
$admin_id = Mage::getSingleton('admin/session')->getUser()->getId();
// D::li('$admin_id: '.$admin_id,1,1);
// Mage::helper('anc_image/ncimage')->printAdminId();
$albumBlock = $this->getLayout()->createBlock('anc_album/adminhtml_albums');
$this->loadLayout()
->_addContent($albumBlock)
->renderLayout();
}
protected function _initAction() {
$this->loadLayout()->_setActiveMenu('anc_album/ANC')
->_addBreadcrumb('test Manager', 'test Manager');
return $this;
}
public function indexAction() {
// D::ulli('index', 1);
$this->_initAction();
$this->renderLayout();
/**
* go to listAction
*/
$this->_redirect(
'*/*/list', array(
// 'id' => $oModel->getId(),
// 'store' => $sStoreId
)
);
}
public function editAction() {
// D::ulli('edit', 1);
$id = $this->getRequest()->getParam('id');
// if (!$id){
// $id=2;
// }
$model = Mage::getModel('anc_album/ncalbum')->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_album/adminhtml_albums_edit'))
->_addLeft($this->getLayout()
->createBlock('anc_album/adminhtml_albums_edit_tabs')
);
$this->renderLayout();
} else {
Mage::getSingleton('adminhtml/session')
->addError('Test does not exist');
$this->_redirect('*/*/');
}
}
public function newAction() {
D::ulli('new', 1);
$this->_forward('edit');
}
public function saveAction() {
// D::ulli('Save', 1);
if ($this->getRequest()->getPost()) {
try {
$postData = $this->getRequest()->getPost();
D::s($postData, '$postDataAlbum', 5, 1);
$testModel = Mage::getModel('anc_album/ncalbum');
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');
/**
* Für save and continue
*/
if ($this->getRequest()->getParam('back')) {
$this->_redirect(
'*/*/edit', array(
'id' => $testModel->getId(),
)
);
return;
}
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_album/ncalbum');
$testModel->setId($this->getRequest()
->getParam('id'))
->delete();
Mage::getSingleton('adminhtml/session')
->addSuccess('successfully deleted');
$this->_redirect('*/*/');
$this->_redirect('*/*/list');
} catch (Exception $e) {
Mage::getSingleton('adminhtml/session')
->addError($e->getMessage());
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
}
}
$this->_redirect('*/*/list');
// $this->_redirect('*/*/');
}
protected function _isAllowed() {
return Mage::getSingleton('admin/session')->isAllowed('album/form');
}
}
<!--
@notactive since 20141013 backend benutzer rechte beschneiden, wird derzeit nicht genutzt
-->
<?xml version="1.0"?>
<config>
<acl>
<resources>
<all>
<title>Allow Everything</title>
</all>
<admin>
<children>
<Anc_Anc module="anc_album">
<title>ANC</title>
<sort_order>71</sort_order>
<children>
<item2 module="anc_album">
<title>Album</title>
<sort_order>3</sort_order>
<action>album/adminhtml_album/list</action>
<children>
<item2a module="anc_album">
<title>Album</title>
<sort_order>2</sort_order>
<action>album/adminhtml_album/list</action>
</item2a>
<itemwebservice1 module="anc_album">
<title>WEBSERVICE</title>
<sort_order>3</sort_order>
<action>album/adminhtml_administrator/uploadImage</action>
</itemwebservice1>
</children>
</item2>
</children>
</Anc_Anc>
<Anc_Album module="anc_album">
<title>Import Play</title>
<sort_order>71</sort_order>
<children>
<items module="anc_album">
<title>Manage Items</title>
<sort_order>0</sort_order>
<action>album/adminhtml_calendar/uploaddate</action>
</items>
</children>
</Anc_Album>
<system>
<children>
<config>
<children>
<album translate="title">
<title>Album</title>
<sort_order>101</sort_order>
</album>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</acl>
</config>
\ No newline at end of file
<?xml version="1.0"?>
<config>
<modules>
<Anc_Album>
<version>0.1.1</version>
</Anc_Album>
</modules>
<frontend>
<!-- einbindung der layoutkonfiguration (s.u.) -->
<layout>
<updates>
<Anc_Album>
<file>anc_album.xml</file>
</Anc_Album>
</updates>
</layout>
<!-- damit die controller funktionen über eine url erreichbar sind (s.u.) -->
<routers>
<!--Umleitung bzw aktivierung der controllers-->
<anc_album>
<use>standard</use>
<args>
<!-- alle urls die mit "http://magento/ancimage" werden ins modul Anc_Image umgeleitet -->
<module>Anc_Album</module>
<frontName>album</frontName>
</args>
</anc_album>
</routers>
<events>
<catalog_category_collection_load_after>
<observers>
<anc_album_checkncalbumjokercategory>
<type>singleton</type>
<class>anc_album/observer</class>
<method>checkncalbumjokercategory</method>
</anc_album_checkncalbumjokercategory>
</observers>
</catalog_category_collection_load_after>
</events>
</frontend>
<global>
<helpers>
<anc_album>
<class>Anc_Album_Helper</class>
</anc_album>
<anc_lib>
<class>Anc_Lib_Helper</class>
</anc_lib>
<anc_image>
<class>Anc_Image_Helper</class>
</anc_image>
</helpers>
<libs>
<anc_lib>
<class>Anc_Lib_Lib</class>
</anc_lib>
</libs>
<blocks>
<anc_album>
<class>Anc_Album_Block</class>
</anc_album>
<anc_album_adminhtml>
<class>Anc_Album_Block_Adminhtml</class>
</anc_album_adminhtml>
<adminhtml>
</adminhtml>
</blocks>
<models>
<anc_album>
<class>Anc_Album_Model</class>
<!-- folgendes ist ein verweis auf den nachfolgenden tag <anc_album_resource> -->
<resourceModel>anc_album_resource</resourceModel>
</anc_album>
<anc_album_resource>
<class>Anc_Album_Model_Resource_Mysql4</class>
<!-- entitie's mit s hier können mehrere Tabellen(namen) untergebracht werden -->
<entities>
<ncalbum>
<table>anc_album_ncalbum</table>
</ncalbum>
<!-- <ncsite>
<table>anc_album_ncsite</table>
</ncsite>-->
</entities>
</anc_album_resource>
</models>
<resources>
<!-- hier verbirgt sich das installationsskript um die datenbanktabellen zu erstellen -->
<anc_album_setup>
<setup>
<module>Anc_Album</module>
<class>Mage_Sales_Model_Mysql4_Setup</class>
</setup>
<connection>
<use>core_setup</use>
</connection>
</anc_album_setup>
<!-- datenbank verbindungen -->
<anc_album_write>
<connection>
<use>core_write</use>
</connection>
</anc_album_write>
<anc_album_read>
<connection>
<use>core_read</use>
</connection>
</anc_album_read>
</resources>
</global>
<admin>
<routers>
<anc_album>
<use>admin</use>
<args>
<module>Anc_Album</module>
<frontName>album</frontName>
</args>
</anc_album>
</routers>
</admin>
<adminhtml>
<layout>
<updates>
<album>
<file>anc/album.xml</file>
</album>
</updates>
</layout>
<menu>
<Anc_Anc module="anc_album">
<title>ANC</title>
<sort_order>71</sort_order>
<children>
<item1album module="anc_album">
<title>Album</title>
<sort_order>1</sort_order>
<action>album/adminhtml_album/list</action>
</item1album>
<!-- <item1site module="anc_album">
<title>Playlist</title>
<sort_order>3</sort_order>
<action>album/adminhtml_site/list</action>
</item1site> -->
</children>
</Anc_Anc>
</menu>
</adminhtml>
</config>
\ No newline at end of file
<?php
/**
* @copyright (c) 2014, netz.coop eG
*/
/**
* @var Mage_Sales_Model_Mysql4_Setup $installer
*/
$installer = $this;
$installer->startSetup();
$tableName = $installer->getTable('anc_album/ncalbum');
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('name', Varien_Db_Ddl_Table::TYPE_VARCHAR, null, array(), 'Name')
->addColumn('comment', Varien_Db_Ddl_Table::TYPE_VARCHAR, null, array(), 'comment')
->addColumn('url_rewrite', Varien_Db_Ddl_Table::TYPE_VARCHAR, null, array(), 'url_rewrite')
->addColumn('admin_user_id',Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('unsigned' => true,'nullable' => false,'default' => '0',),'Who Created backend')
->addColumn('customer_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('unsigned' => true, 'nullable' => false, 'default' => '0',), 'Who Created frontend')
->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('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('isplaylist', Varien_Db_Ddl_Table::TYPE_BOOLEAN, null, array('default' => '1'), 'is a playlist checkbox')
->addColumn('iscategory', Varien_Db_Ddl_Table::TYPE_BOOLEAN, null, array('default' => '1'), 'is a category checkbox')
->addIndex($installer->getIdxName('anc_album/ncalbum', array('customer_id')),array('customer_id'))
->addIndex($installer->getIdxName('anc_album/ncalbum', array('admin_user_id')),array('admin_user_id'))
->addIndex($installer->getIdxName('anc_album/ncalbum', array('original_id')),array('original_id'))
// http://docs.magentocommerce.com/Varien/Varien_Db/Varien_Db_Ddl_Table.html#addForeignKey
// ->addForeignKey(
// $installer->getFkName( 'anc_album/ncalbum','customer_id','customer/entity','entity_id'), 'customer_id',
// $installer->getTable('customer/entity'), 'entity_id',
// Varien_Db_Ddl_Table::ACTION_NO_ACTION, Varien_Db_Ddl_Table::ACTION_NO_ACTION
// )
// ->addForeignKey(
// $installer->getFkName( 'anc_album/ncalbum','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_album/ncalbum','original_id','anc_album/ncalbum','entity_id'), 'original_id',
// $installer->getTable('anc_album/ncalbum'), 'entity_id',
// Varien_Db_Ddl_Table::ACTION_NO_ACTION, Varien_Db_Ddl_Table::ACTION_NO_ACTION
// )
;
$installer->getConnection()->createTable($table);
}
/**
* @deprecated !!! @since 20140812 ist jetzt in AncPlaylist ....
*/
//$tableName = $installer->getTable('anc_album/ncsite');
//if ($installer->getConnection()->isTableExists($tableName) != true ){
// $table = $installer->getConnection()->newTable($tableName)
// ->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER,null,array('identity' => true,'unsigned' => true,'nullable' => false,'primary' => true,),'Id')
// ->addColumn('customer_id', Varien_Db_Ddl_Table::TYPE_INTEGER,null,array('unsigned' => true,'nullable' => false,'default' => '0',),'Customer ID')
// ->addColumn('ncalbum_id', Varien_Db_Ddl_Table::TYPE_INTEGER,null,array('unsigned' => true,'nullable' => false,'default' => '0',),'ncalbum id')
// ->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER,null,array('unsigned' => true,'nullable' => false,'default' => '0',),'Order Id')
// ->addColumn('quote_item_id',Varien_Db_Ddl_Table::TYPE_INTEGER,null,array('unsigned' => true,'nullable' => false,'default' => '0',),'Quote Item Id')
//
// ->addColumn('ordertime', Varien_Db_Ddl_Table::TYPE_TIMESTAMP,null,array(),'Bestellzeitpunkt')
// ->addColumn('product_name', Varien_Db_Ddl_Table::TYPE_VARCHAR,null,array(),'Produktname')
// ->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP,null,array(),'When beginn')
// ->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP,null,array(),'When updated')
// ->addColumn('deleted_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP,null, array(), 'When deleted')
// ->addColumn('deleted', Varien_Db_Ddl_Table::TYPE_TINYINT,null,array('default' => '0'),'Deleted')
// ->addColumn('track_num', Varien_Db_Ddl_Table::TYPE_INTEGER,null,array('unsigned' => true,'nullable' => false,'default' => '0',),'Aufrufe')
//
// ;
// $installer->getConnection()->createTable($table);
//}
//
//$installer->endSetup();
?>
\ No newline at end of file
<?php
/**
* @copyright (c) 2014, netz.coop eG
*/
/*
* 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.
*/
$installer = $this;
$connection = $installer->getConnection();
$installer->startSetup();
/**
* Neue Spalte Zeige in der Produktauswahl (Wenn kategorie geewählt wurde)
*/
$installer->getConnection()
->addColumn($installer->getTable('anc_album/ncalbum'), 'categoryshowinproductselection',Varien_Db_Ddl_Table::TYPE_BOOLEAN, null, array('default' => '1'), 'Zeige in der Produktauswahl ');
$installer->endSetup();
/**
* Neue Spalte für die Werbeecke
*/
$installer->getConnection()
->addColumn($installer->getTable('anc_album/ncalbum'), 'isadvertising', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('unsigned' => true, 'nullable' => false, 'default' => '0',), 'Gutscheinecke');
$installer->endSetup();
?>
\ No newline at end of file
<?xml version="1.0"?>
<layout version="0.1.0">
<anc_album_adminhtml_album_edit>
<reference name="head">
<!--JQUERY MACHT KONFLIKTE-->
<!-- <action method="addItem">
<type>js</type>
<name>Anc/Lib/jquery-2.1.1.min.js</name>
</action>-->
<action method="addJs" >
<!-- <script>
Anc/Lib/jquery-1.11.1.min.js
</script>-->
<script>
Anc/Lib/jquery-2.1.1.min.js
</script>
<!--<script>jQuery.noConflict();</script>-->
</action>
<action method="addJs" >
<!-- <script>
Anc/Lib/jquery-1.11.1.min.js
</script>-->
<script>
Anc/Lib/noconflict.js
</script>
<!--<script>jQuery.noConflict();</script>-->
</action>
<!-- <action method="addItem" >
<script>
jQuery.noConflict();
</script>
</action>
<action method="addJs" >
<script>
jQuery.noConflict();
</script>
</action>-->
<action method="addJs"><script>Anc/Image/Typeadmin.js</script></action>
<action method="addCss"><stylesheet>css/anc/lib/ancextension_type.css</stylesheet></action>
<action method="addItem">
<type>js</type>
<name>Anc/Image/extlib/dropzone.js</name>
</action>
<action method="addItem">
<type>js</type>
<name>Anc/Image/extlib/jquery.prettyPhoto.js</name>
</action>
<action method="addItem">
<type>skin_css</type>
<name>css/anc/image/dropzone.css</name>
</action>
<action method="addItem">
<type>skin_css</type>
<name>css/anc/image/prettyPhoto.css</name>
</action>
<!--ich schätze mal das das hier nicht hin gehört, falls ja weiß ich nicht welches template hier gemeint ist ... falls das fürs frontend gemeint war heißt das jetzt anders und zwar customer_gallerysimple.phtml (typ muß wahrscheinlich dann auch geändert werden-->
<!--<block type="anc_image/owngallery" name="anc_image_simpleowngallery" template="anc/image/customer_simpleowngallery.phtml" />-->
</reference>
<!-- <reference name="content">
<block type="anc_image/adminhtml_admingallery" name="simpleadmingallery" template="anc/image/simpleadmingallery.phtml" />
</reference>-->
<reference name="content">
<block type="anc_image/adminhtml_admingallery" after="content" name="simpleadmingallery" template="anc/album/simpleadmingalleryimage.phtml" />
<!-- Zur anzeige der Album Texte im Album -->
<block type="anc_text/adminhtml_admingallery" after="content" name="simpleadmingallerytext" template="anc/album/simpleadmingallerytext.phtml" />
</reference>
</anc_album_adminhtml_album_edit>
<anc_image_administrator_simpleowngallery>
<reference name="content">
<block type="anc_image/adminhtml_admingallery" name="simpleadmingallery" template="anc/image/simpleadmingallery.phtml" />
</reference>
</anc_image_administrator_simpleowngallery>
</layout>
<div class="anc-image-owngallery">
<?php Mage::getSingleton('core/session', array('name'=>'adminhtml'));
if(Mage::getSingleton('admin/session')->isLoggedIn()): ?>
<div class="col2-set">
<div class="col-1">
<div class="anc-image-owngallery-main">neues Bild hochladen</div>
<div class="anc-image-owngallery-content">
<?php $dropzone_id = 'ancimage-dropzone-id'.$DropzoneIndex; ?>
<?php $ancnote_id = 'ancnote-id'; ?>
<div id="<?php echo $ancnote_id; ?>"></div>
<div id="<?php echo $dropzone_id; ?>" class="dropzone ancimage-dropzone" title="Bitte ziehen Sie aus Ihrer Galerie oder Ihrem Dateiexplorer einfach ein Bild in diesen Bereich!">
<div class="preview-database-image">
Lassen Sie hier Ihr Bild fallen!<br />
</div>
</div>
<?php
$params=$this->getRequest()->getParams();
// D::s($params,'$params',5,1,1);
$urlUploadImage= $this->getUrl('image/adminhtml_administrator/uploadImage', array('album_id'=>$params['id']));
$formkey= Mage::getSingleton('core/session')->getFormKey();
?>
<script type="text/javascript">
jQuery(document).ready(function($) {
Anc_Image_Typeadmin.droppableFile(
jQuery(" #<?php echo $dropzone_id; ?>"),
null,
"<?php echo $urlUploadImage; ?>",
jQuery(" #<?php echo $ancnote_id; ?>"),
"<?php echo $this->getUrl('image/adminhtml_administrator/simpleowngallery', array()) ?> ul.gallery",
"<?php echo $formkey?>"
);
});
</script>
</div>
<div class="anc-image-owngallery-main">Meine Bilder (alpha)</div>
<div class="anc-image-owngallery-content">
<div class="anc-image-owngallery-content-view">
<?php echo $this->getChildHtml('simpleadmingallery') ?>
</div>
</div>
</div>
<div class="col-2">
<div class="anc-image-owngallery-form">
<div class="anc-image-owngallery-main">Bilddaten</div>
<div class="anc-image-owngallery-content" id="anc-image-owngallery-form-content"></div>
</div>
</div>
</div>
<script type="text/javascript">
jQuery(document).ready(function($) {
// jQuery("a[rel^='prettyPhoto']").prettyPhoto({});
jQuery('a.ancimage-showNcImageForm').unbind("click").click(function(e){
e.preventDefault();
jQuery(".anc-image-owngallery * #anc-image-owngallery-form-content").load(jQuery(this).data('site'), function() {
jQuery('#ancimage-customer_showNcImageFormDelete').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('.anc-image-owngallery * #anc-image-owngallery-form-content').html(response); // update the DIV
}
});
return false; // cancel original event to prevent form submitting
});
jQuery('#ancimage-customer_showNcImageForm').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('.anc-image-owngallery * #anc-image-owngallery-form-content').html(response); // update the DIV
}
});
return false; // cancel original event to prevent form submitting
});
});
});
});
</script>
<?php else: ?>
<h1>Bitte loggen Sie sich ein!</h1>
<?php endif; ?>
</div>
<?php $NcImagesForCustomer = Mage::helper('anc_image/ncmodel')->getNcImagesForCustomer(); ?>
<ul class="gallery AncGalleryImages">
<?php foreach($NcImagesForCustomer as $ncimage ): ?>
<?php $NcImagePath = Mage::helper('anc_image/ncimage')->getNcImagePath($ncimage['entity_id'], 'relative', 'original'); ?>
<?php $ncimage_title = Mage::helper('anc_image/ncimage')->getNcImageMetaDataAsHtml($ncimage['entity_id']); ?>
<a data-site="<?php echo $this->getUrl('ancimage/customer/showNcImageForm', array('id'=>$ncimage['entity_id'])) ?>" class="ancimage-showNcImageForm" rel="prettyPhoto[pp_gal2]" href="<?php echo $NcImagePath ?>" title="<?php echo $ncimage_title; ?>">
<img height="50" src="<?php echo DS.$NcImagePath ?>" class="anc-image-draggable" id="<?php echo $ncimage['entity_id'] ?>" />
</a>
<?php endforeach; ?>
</ul>
\ No newline at end of file
<?php
/**
*
* @var $this anc_image/catalog_product_view_options_type_ancimage
*
* @package anc_image
* @anc_album_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 = 'ancimage-dropzone-id'.$DropzoneIndex; ?>
<?php $ancnote_id = 'ancnote-id'.$DropzoneIndex; ?>
<?php $_option = $this->getOption(); ?>
<?php $input_id = 'options_'.$_option->getId().'_text'; ?>
<div class="ancimage_type" id="<?php echo $_option->getSku(); ?>">
<dt class="<?php echo $_option->getSku(); ?>"><label<?php if ($_option->getIsRequire()) echo ' class="required"' ?>><?php if ($_option->getIsRequire()) echo '<em>*</em>' ?><?php echo $this->escapeHtml($_option->getTitle()) ?></label>
<?php echo $this->getFormatedPrice() ?></dt>
<dd class="<?php echo $_option->getSku(); ?><?php if ($_option->decoratedIsLast){?> last<?php }?>">
<div class="input-box">
<input type="hidden" onchange="opConfig.reloadPrice()" id="<?php echo $input_id ?>" class="input-text<?php echo $_option->getIsRequire() ? ' required-entry' : '' ?> <?php echo $_option->getMaxCharacters() ? ' validate-length maximum-length-'.$_option->getMaxCharacters() : '' ?> product-custom-option" name="options[<?php echo $_option->getId() ?>]" value="<?php echo $this->escapeHtml($this->getDefaultValue()) ?>" />
<?php if ($_option->getMaxCharacters()): ?>
<p class="note"><?php echo Mage::helper('catalog')->__('Maximum file size:')?> <strong><?php echo $_option->getMaxCharacters() ?> <?php echo Mage::helper('catalog')->__('mb.')?></strong></p>
<?php endif; ?>
<?php if ($_option->getFileExtension()): ?>
<p class="no-margin"><?php echo Mage::helper('catalog')->__('Allowed file extensions to upload')?>: <strong><?php echo $_option->getFileExtension() ?></strong></p>
<?php endif; ?>
<?php if ($_option->getImageSizeX() > 0): ?>
<p class="no-margin"><?php echo Mage::helper('catalog')->__('Maximum image width')?>: <strong><?php echo $_option->getImageSizeX() ?> <?php echo Mage::helper('catalog')->__('px.')?></strong></p>
<?php endif; ?>
<?php if ($_option->getImageSizeY() > 0): ?>
<p class="no-margin"><?php echo Mage::helper('catalog')->__('Maximum image height')?>: <strong><?php echo $_option->getImageSizeY() ?> <?php echo Mage::helper('catalog')->__('px.')?></strong></p>
<?php endif; ?>
</div>
</dd>
<div class="ancimage <?php echo $_option->getSku(); ?>" >
<div id="<?php echo $ancnote_id; ?>"></div>
<div id="<?php echo $dropzone_id; ?>" class="dropzone ancimage-dropzone" title="Bitte ziehen Sie aus Ihrer Galerie oder Ihrem Dateiexplorer einfach ein Bild in diesen Bereich!">
<div class="preview-database-image">
Lassen Sie hier Ihr Bild fallen!<br />
<?php $path = Mage::helper('anc_image/ncimage')->getNcImagePath($this->getDefaultValue(), 'relative', 'original'); ?>
<?php if($path):?>
<img src="<?php echo DS.$path; ?>" />
<?php endif; ?>
</div>
</div>
</div>
<script type="text/javascript">
jQuery(document).ready(function($) {
Anc_Image_Typeadmin.droppableFile(
jQuery(" #<?php echo $dropzone_id; ?>"),
jQuery(" #<?php echo $input_id; ?>"),
"<?php echo $this->getUrl('ancimage/customer/uploadImage', array()) ?>",
jQuery(" #<?php echo $ancnote_id; ?>"),
"<?php echo $this->getUrl('ancimage/customer/simpleowngallery', array()) ?> ul.gallery"
);
});
alert("ancalbum.phtml: <?php echo $this->getUrl('ancimage/customer/simpleowngallery', array()) ?>");
</script>
</div>
AncAlbum/app/design/adminhtml/template/album/edit/ancalbum.phtml ... hat diese datei eine relevants ? wenn ja wo wird sie aufgerufen .... Anc_Image_Typeadmin.droppableFile Aufruf letzter Parameter ancimage/customer/simpleowngallery ... falls frontend simpleowngallery gemeint war ... sie heißt jetzt customer_gallerysimple und hat sich geändert
\ No newline at end of file
<?php
$params=$this->getRequest()->getParams();
D::ulli('Test sg.phtml',1);
?>
<?php $NcImagesForCustomer = Mage::helper('anc_image/ncmodel')->getNcImagesForAlbum($params['id']); ?>
<ul class="gallery AncGalleryImages">
<?php if ($params['id']>0):?>
<?php foreach($NcImagesForCustomer as $ncimage ): ?>
<?php $NcImagePath = Mage::helper('anc_image/ncimage')->getNcImagePath($ncimage['entity_id'], 'relative', 'thumbnail');?>
<?php $url= Mage::helper("adminhtml")->getUrl("image/adminhtml_image/edit/",array('id'=>$ncimage['entity_id'])); ?>
<?php // $NcImagePath = Mage::helper('anc_image/ncimage')->getNcImagePath($ncimage['entity_id'], 'relative', 'original'); ?>
<?php $ncimage_title = Mage::helper('anc_image/ncimage')->getNcImageMetaDataAsHtml($ncimage['entity_id']); ?>
<a data-site="<?php echo $this->getUrl('ancimage/customer/showNcImageForm', array('id'=>$ncimage['entity_id'])) ?>" class="ancimage-showNcImageForm" rel="prettyPhoto[pp_gal2]" href="<?php echo $url ?>" title="<?php echo $ncimage_title; ?>">
<img height="50" src="<?php echo DS.$NcImagePath ?>" class="anc-image-draggabl" id="<?php echo $ncimage['entity_id'] ?>" />
</a>
<?php endforeach; ?>
<?php endif;?>
</ul>
\ No newline at end of file
<?php
$params = $this->getRequest()->getParams();
//D::ulli('Test sg.phtml',1);
?>
<?php $NcTextsForCustomer = Mage::helper('anc_text/ncmodel')->getNcTextsForAlbum($params['id']); ?>
<ul class="gallery AncGalleryTexts">
<?php if ($params['id'] > 0): ?>
<?php foreach ($NcTextsForCustomer as $nctext): ?>
<?php $url= Mage::helper("adminhtml")->getUrl("text/adminhtml_text/edit/",array('id'=>$nctext['entity_id'])); ?>
<?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 $url ?>" 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; ?>
<?php endif; ?>
</ul>
<?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.
-->
<root>
</root>
<?php $_helper = $this->helper('catalog/output'); ?>
<?php $_category = $this->getCurrentCategory(); ?>
<?php $ncalbum = $this->getNcalbumcategory(); ?>
<?php $ncimage = Mage::helper('anc_album/ncmodel')->getFirstImageFromNcalbum($ncalbum['entity_id']); ?>
<?php
if(is_object($ncimage)) {
$_imageUrl= Mage::helper('anc_image/ncimage')->getNcImagePath($ncimage->getId(), 'relative', 'thumbnail');
} else {
$_imageUrl= null;
}
?>
<?php $ChildCategorie = $this->getChildCategorie(); ?>
<div class="category">
<li class="category-name">
<a href="/<?php echo Mage::helper('anc_album/nccategory')->getCategoryUrl($ChildCategorie, $ncalbum)?>">
<?php if($ncalbum['name']): ?>
<?php echo $ncalbum['name']; ?>
<?php else: ?>
<?php echo $ChildCategorie->getName()?>
<?php endif; ?>
</a>
</li>
<div class="category-image">
<a href="/<?php echo Mage::helper('anc_album/nccategory')->getCategoryUrl($ChildCategorie, $ncalbum)?>">
<?php if($_imageUrl): $_imageUrl = '/'.$_imageUrl; ?>
<?php elseif($_imageUrl=$ncalbum['imageUrl']):?>
<?php elseif($_imageUrl=$ChildCategorie->getImageUrl()): ?>
<?php elseif($_imageUrl=$_category->getImageUrl()): ?>
<?php elseif($_imageUrl=$_category->getParentCategory()->getImageUrl()): ?>
<?php endif;?>
<img src="<?php echo $_imageUrl?>" height="188">
</a>
</div>
<?php if($ncalbum['coment']): ?>
<div class="category-description"><?php echo $ncalbum['coment'] ?></div>
<?php endif; ?>
</div>
\ No newline at end of file
<?xml version="1.0"?>
<config>
<modules>
<Anc_Album>
<active>true</active>
<codePool>local</codePool>
</Anc_Album>
</modules>
</config>
\ No newline at end of file
File mode changed
copy.src.files=false
copy.src.on.open=false
copy.src.target=
index.file=app/code/controllers/Adminhtml/AlbumController.php
run.as=LOCAL
url=http://localhost/AncAlbum/
include.path=${php.global.include.path}
php.version=PHP_54
source.encoding=UTF-8
src.dir=.
tags.asp=false
tags.short=false
web.root=.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.php.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/php-project/1">
<name>AncAlbum</name>
</data>
</configuration>
</project>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!