Skip to content

Commit

Permalink
minor bugfixes
Browse files Browse the repository at this point in the history
minor bugfixes
  • Loading branch information
BigAndini committed Mar 4, 2015
1 parent 0f6a2a7 commit 1510bf0
Show file tree
Hide file tree
Showing 18 changed files with 140 additions and 178 deletions.
2 changes: 1 addition & 1 deletion module/Admin/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function getServiceConfig() {
$options[$role->getId()] = $role->getRoleId();
}

$form->get('parent_id')->setValueOptions($options);
$form->get('Parent_id')->setValueOptions($options);

return $form;
},
Expand Down
7 changes: 1 addition & 6 deletions module/Admin/config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,6 @@
),
),
'top_nav' => array(
'order' => array(
'label' => 'My Shopping Cart',
'route' => 'order',
'resource' => 'controller/Admin\Controller\Order:index',
),
'login' => array(
'label' => 'Login',
'route' => 'zfcuser/login',
Expand All @@ -134,7 +129,7 @@
#'action' => 'logout',
'resource' => 'controller/zfcuser:logout',
),
'order' => array(
'admin' => array(
'label' => 'AdminPanel',
'route' => 'admin',
'resource' => 'controller/Admin\Controller\Admin',
Expand Down
4 changes: 2 additions & 2 deletions module/Admin/src/Admin/Controller/RoleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ public function editAction()
$form->bind($role);
$form->get('submit')->setAttribute('value', 'Edit');

$options = $form->get('parent_id')->getValueOptions();
$options = $form->get('Parent_id')->getValueOptions();
unset($options[$role->getId()]);
$form->get('parent_id')->setValueOptions($options);
$form->get('Parent_id')->setValueOptions($options);

$request = $this->getRequest();
if ($request->isPost()) {
Expand Down
2 changes: 1 addition & 1 deletion module/Admin/src/Admin/Form/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct($name = null)

$this->add(array(
'type' => 'Zend\Form\Element\Select',
'name' => 'parent_id',
'name' => 'Parent_id',
'attributes' => array(
'class' => 'form-control form-element',
),
Expand Down
2 changes: 1 addition & 1 deletion module/Admin/view/admin/role/add.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ $form->prepare();
echo $this->form()->openTag($form);
echo $this->formHidden($form->get('id'));
echo $this->formRow($form->get('roleId'));
echo $this->formRow($form->get('parent_id'));
echo $this->formRow($form->get('Parent_id'));
echo $this->formHidden($form->get('csrf'));
echo $this->formSubmit($form->get('submit'));
?>
Expand Down
2 changes: 1 addition & 1 deletion module/Admin/view/admin/role/edit.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ $form->prepare();
echo $this->form()->openTag($form);
echo $this->formHidden($form->get('id'));
echo $this->formRow($form->get('roleId'));
echo $this->formRow($form->get('parent_id'));
echo $this->formRow($form->get('Parent_id'));
echo $this->formHidden($form->get('csrf'));
echo $this->formSubmit($form->get('submit'));
?>
Expand Down
8 changes: 6 additions & 2 deletions module/PreReg/src/PreReg/Controller/CartController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Zend\View\Model\ViewModel;
use Zend\Session\Container;
use ersEntity\Entity;
use PreReg\Service;

class CartController extends AbstractActionController {
/*
Expand Down Expand Up @@ -96,8 +97,11 @@ public function addAction() {
$session_cart->chooser = true;
}

$forrest = new Container('forrest');
$breadcrumb = $forrest->trace->cart;
$forrest = new Service\BreadcrumbFactory();
$breadcrumb = $forrest->get('cart');

#$forrest = new Container('forrest');
#$breadcrumb = $forrest->trace->cart;

return $this->redirect()->toRoute(
$breadcrumb->route,
Expand Down
69 changes: 15 additions & 54 deletions module/PreReg/src/PreReg/Controller/OrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,11 @@ class OrderController extends AbstractActionController {
* overview of this order
*/
public function indexAction() {
$clearance = new Container('forrest');
$clearance->getManager()->getStorage()->clear('forrest');
$forrest = new Container('forrest');
$forrest->trace = new \ArrayObject();

$breadcrumb = new \ArrayObject();
$breadcrumb->route = 'order';
$breadcrumb->params = array();
$breadcrumb->options = array();

$forrest->trace->product = $breadcrumb;
$forrest->trace->participant = $breadcrumb;
$forrest->trace->cart = $breadcrumb;
$forrest = new Service\BreadcrumbFactory();
$forrest->reset();
$forrest->set('product', 'order');
$forrest->set('participant', 'order');
$forrest->set('cart', 'order');

$session_cart = new Container('cart');

Expand Down Expand Up @@ -106,14 +98,17 @@ public function registerAction() {
}
}

$forrest = new Container('forrest');
$forrest = new Service\BreadcrumbFactory();
$forrest->set('participant', 'order', array('action' => 'register'));

/*$forrest = new Container('forrest');
$breadcrumb = new \ArrayObject();
$breadcrumb->route = 'order';
$breadcrumb->params = array(
'action' => 'register'
);
$breadcrumb->options = array();
$forrest->trace->participant = $breadcrumb;
$forrest->trace->participant = $breadcrumb;*/

$participants = $session_cart->order->getParticipants();

Expand All @@ -128,14 +123,17 @@ public function registerAction() {
* collect payment data and complete purchase
*/
public function paymentAction() {
$forrest = new Container('forrest');
$forrest = new Service\BreadcrumbFactory();
$forrest->set('paymenttype', 'order', array('action' => 'payment'));

/*$forrest = new Container('forrest');
$breadcrumb = new \ArrayObject();
$breadcrumb->route = 'order';
$breadcrumb->params = array(
'action' => 'payment'
);
$breadcrumb->options = array();
$forrest->trace->paymenttype = $breadcrumb;
$forrest->trace->paymenttype = $breadcrumb;*/

$form = new Form\PaymentType();

Expand Down Expand Up @@ -354,43 +352,6 @@ private function sendBankTransferEmail() {
$emailService->send();

return true;

$content = new Mime\Message();

$textContent = 'This is the text of the email.';
$textPart = new Mime\Part($textContent);
$textPart->type = 'text/plain';

$htmlMarkup = '<html><body><h1>This is the text of the email.</h1></body></html>';
$htmlPart = new Mime\Part($htmlMarkup);
$htmlPart->type = 'text/html';

$content->setParts(array($textPart, $htmlPart));

$contentPart = new Mime\Part($content->generateMessage());
$contentPart->type = 'multipart/alternative;' . PHP_EOL . ' boundary="' . $content->getMime()->boundary() . '"';

$pathToImage = getcwd() . '/public/img/logo.jpg';
$attachment = new Mime\Part(fopen($pathToImage, 'r'));
#$attachment->type = 'application/pdf';
$attachment->type = 'image/jpeg';
$attachment->filename = 'logo.jpg';
$attachment->encoding = Mime\Mime::ENCODING_BASE64;
$attachment->disposition = Mime\Mime::DISPOSITION_ATTACHMENT;

$body = new Mime\Message();
$body->setParts(array($contentPart, $attachment));
#$body->setParts(array($contentPart));

$message = new Message();
$message->setEncoding('utf-8');
$message->addTo($purchaser->getEmail());
$message->addFrom('[email protected]');
$message->setSubject('Testmail');
$message->setBody($body);

$transport = new Transport\Sendmail();
$transport->send($message);
}

/*
Expand Down
76 changes: 18 additions & 58 deletions module/PreReg/src/PreReg/Controller/ParticipantController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Zend\Session\Container;
use PreReg\Form;
use ersEntity\Entity;
use PreReg\Service;

class ParticipantController extends AbstractActionController {
/*
Expand All @@ -22,17 +23,9 @@ class ParticipantController extends AbstractActionController {
*/
public function indexAction()
{
$clearance = new Container('forrest');
$clearance->getManager()->getStorage()->clear('forrest');

$forrest = new Container('forrest');
$forrest->trace = new \ArrayObject();

$breadcrumb = new \ArrayObject();
$breadcrumb->route = 'participant';
$breadcrumb->params = array();
$breadcrumb->options = array();
$forrest->trace->participant = $breadcrumb;
$forrest = new Service\BreadcrumbFactory();
$forrest->reset();
$forrest->set('participant', 'participant');

$session_cart = new Container('cart');
$participants = $session_cart->order->getParticipants();
Expand All @@ -50,6 +43,7 @@ public function addAction() {
$form = new Form\Participant();
$request = $this->getRequest();

$forrest = new Service\BreadcrumbFactory();
if($request->isPost())
{
$user = new Entity\User();
Expand All @@ -64,8 +58,7 @@ public function addAction() {
$session_cart = new Container('cart');
$session_cart->order->addParticipant($user);

$forrest = new Container('forrest');
$breadcrumb = $forrest->trace->participant;
$breadcrumb = $forrest->get('participant');
if($breadcrumb->route == 'product' && ($breadcrumb->params['action'] == 'add' || $breadcrumb->params['action'] == 'edit')) {
$breadcrumb->params['participant_id'] = $user->getSessionId();
}
Expand All @@ -76,18 +69,10 @@ public function addAction() {
}
}

$forrest = new Container('forrest');
if(isset($forrest->trace) && isset($forrest->trace->participant)) {
$breadcrumb = $forrest->trace->participant;
} else {
$breadcrumb = new \ArrayObject();
$breadcrumb->route = 'participant';
$breadcrumb->params = array();
$breadcrumb->options = array();
if(isset($forrest->trace)) {
$forrest->trace->participant = $breadcrumb;
}
if(!$forrest->exists('participant')) {
$forrest->set('participant', 'participant');
}
$breadcrumb = $forrest->get('participant');

return [
'form' => $form,
Expand All @@ -114,6 +99,7 @@ public function editAction()

$form = new Form\Participant();
$request = $this->getRequest();
$forrest = new Service\BreadcrumbFactory();

$form->bind($participant);

Expand All @@ -128,26 +114,17 @@ public function editAction()
$session_cart = new Container('cart');
$session_cart->order->setParticipantBySessionId($participant, $id);

$forrest = new Container('forrest');
$breadcrumb = $forrest->trace->participant;
$breadcrumb = $forrest->get('participant');
return $this->redirect()->toRoute($breadcrumb->route, $breadcrumb->params, $breadcrumb->options);
} else {
error_log(var_export($form->getMessages(), true));
}
}

$forrest = new Container('forrest');
if(isset($forrest->trace) && isset($forrest->trace->participant)) {
$breadcrumb = $forrest->trace->participant;
} else {
$breadcrumb = new \ArrayObject();
$breadcrumb->route = 'participant';
$breadcrumb->params = array();
$breadcrumb->options = array();
if(isset($forrest->trace)) {
$forrest->trace->participant = $breadcrumb;
}
if(!$forrest->exists('participant')) {
$forrest->set('participant', 'participant');
}
$breadcrumb = $forrest->get('participant');
return [
'id' => $id,
'form' => $form,
Expand All @@ -164,27 +141,12 @@ public function deleteAction() {
return $this->redirect()->toRoute('participant');
}

$forrest = new Container('forrest');
if(isset($forrest->trace) && isset($forrest->trace->participant)) {
$breadcrumb = $forrest->trace->participant;
} else {
$breadcrumb = new \ArrayObject();
$breadcrumb->route = 'participant';
$breadcrumb->params = array();
$breadcrumb->options = array();
if(isset($forrest->trace)) {
$forrest->trace->participant = $breadcrumb;
}
$forrest = new Service\BreadcrumbFactory();
if(!$forrest->exists('participant')) {
$forrest->set('participant', 'participant');
}

/*$forrest = new Container('forrest');
if(!isset($forrest->trace->participant)) {
$breadcrumb = new \ArrayObject();
$breadcrumb->route = 'participant';
$breadcrumb->params = array();
$breadcrumb->options = array();
$forrest->trace->participant = $breadcrumb;
}*/
$breadcrumb = $forrest->get('participant');

$session_cart = new Container('cart');
$participant = $session_cart->order->getParticipantBySessionId($id);
Expand All @@ -199,8 +161,6 @@ public function deleteAction() {
$session_cart->order->removeParticipantBySessionId($id);
}

$forrest = new Container('forrest');
$breadcrumb = $forrest->trace->participant;
return $this->redirect()->toRoute(
$breadcrumb->route,
$breadcrumb->params,
Expand Down
6 changes: 4 additions & 2 deletions module/PreReg/src/PreReg/Controller/PaymentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
use Zend\Session\Container;
use PreReg\Service;

use PreReg\Form;

Expand All @@ -30,11 +31,12 @@ public function infoAction() {
->getServiceLocator()
->get('Doctrine\ORM\EntityManager');

$forrest = new Container('forrest');
$forrest = new Service\BreadcrumbFactory();
$breadcrumb = $forrest->get('paymenttype');

return new ViewModel(array(
'paymenttype' => $em->getRepository("ersEntity\Entity\PaymentType")->findOneBy(array('id' => $id)),
'forrest' => $forrest,
'breadcrumb' => $breadcrumb,
));
}

Expand Down
Loading

0 comments on commit 1510bf0

Please sign in to comment.