summaryrefslogblamecommitdiffstats
path: root/application/modules/user/controllers/BootmenuController.php
blob: 3d6fbf108a7d9940e76d8065d680a60100f9d5d3 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
     









                                                                           
 
                                                            
 
 
                                  
                                       

                                    
                        
                        



                                                              



                                                                                  
 
                                                                                       
                                                                                                   

                                




                                                                                                           
                                
                                                                        


                                                                    

                                                                
 



                                                                 












                                                                                           

                                                            



                                                                                         

 
                                              







                                                                                             
                                           















                                                                                                                                                                           

                                                                                                                                                                                   


                                 
                                                  













                                                                                                                                                                           

                                                                                                                                                                                   




                                 

                                                              
                                                  
                                                
                                                 
                                  

                                                                         
                 
                                                                  



                                                   
                                                   
                                                                               
                                                                                                                                                   

                                                       
                                                                    
                                                                                

                                                      
                                                                  



                                       
                                                                                                        
         
 





                                                                                                                       
                        




























































                                                                                                                                                      
                                                   






























































                                                                                                                                              
                                                                                                                        







































                                                                                                                              

                                                                              







                                                                                                  
                                                                                                                                                       
                                                                                                                                                                                                     



                                 

                

















                                                                                                                               
                                           
                                                  


                                           
                                      
                                               









                                                                                  
                                                   
                                                      


                                                   
                                              
                                                       





























































                                                                                                                                           
                                                                                                                                                       

                                                                                                                                                                                                     


                                 












                                                                                                                                                           















                                                                      







                                                                                 
                                                   
                                                          

                                           
                                      
                                              
                                                 
                           
 






                                                                                        
                         


                                                                                 
                                                   
                                                          

                                           
                                      
                                              
                                                         












































































                                                                                                                                                  
 

 











 
<?php
/*
 * Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
 * This program is free software distributed under the GPL version 2.
 * See http://gpl.openslx.org/
 *
 * If you have any feedback please consult http://feedback.openslx.org/ and
 * send your suggestions, praise, or complaints to feedback@openslx.org
 *
 * General information about OpenSLX can be found at http://openslx.org/
 */

class user_BootmenuController extends Zend_Controller_Action
{

	protected $bootmenuMapper;
	protected $bootmenuentryMapper;
	protected $membershipMapper;
	protected $membership;
	protected $page;
	protected $type;

	public function init()
	{
		if (Zend_Auth::getInstance()->hasIdentity()) {
			$userIDsNamespace = Zend_Session::namespaceGet('userIDs');
			if($userIDsNamespace['membershipID'] ==''){
				$this->_redirect('/user/index');
			}

			$this->bootmenuMapper = new Application_Model_BootMenuMapper();
			$this->bootmenuentryMapper = new Application_Model_BootMenuEntriesMapper();
				
				
			$this->membershipMapper = new Application_Model_MembershipMapper();
			$this->membership = new Application_Model_Membership();
			$this->membershipMapper->find($userIDsNamespace['membershipID'],$this->membership);

			$this->db = Zend_Db_Table::getDefaultAdapter();
				
			$this->type = $this->_request->getParam('type');
		} else {
			$this->_helper->redirector('login', 'auth');
		}
		$this->page = $this->_request->getParam('page');
	}

	public function indexAction()
	{
		 
		$result = $this->_request->getParam('addresult');
		if($result != ""){
			$pbsNotifier = new Pbs_Notifier();
			$this->view->notification = $pbsNotifier->notify('create',$result);
		}
		$result = $this->_request->getParam('deleteresult');
		if($result != ""){
			$pbsNotifier = new Pbs_Notifier();
			$this->view->notification = $pbsNotifier->notify('delete',$result);
		}
		$result = $this->_request->getParam('modifyresult');
		if($result != ""){
			$pbsNotifier = new Pbs_Notifier();
			$this->view->notification = $pbsNotifier->notify('modify',$result);
		}
		$result = $this->_request->getParam('json');
		if($result != ""){
			$pbsNotifier = new Pbs_Notifier();
			$this->view->notification = $pbsNotifier->notify('json',$result);
		}


		//ACL Darf er Bootmenus sehen?
		if(!Pbs_Acl::checkRight('booai') && !Pbs_Acl::checkRight('booui'))
		$this->_redirect('/user/index');

		$this->bootMenumapper = new Application_Model_BootMenuMapper();
		$this->bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper();
		$bootosMapper = new Application_Model_BootOsMapper();
		$configMapper = new Application_Model_ConfigMapper();

		$bootmenuentries = array();
		if($this->type =='group' && Pbs_Acl::checkRight('booai')){
			$this->view->type = 'group';
			$bootmenu = $this->bootmenuMapper->findBy(array('groupID' => $this->membership->getGroupID()));
			foreach ($bootmenu as $bm){
				$bm->setCreated(date(Zend_Registry::get('dateformat'),$bm->getCreated()));
				$bootmenuID = $bm->getID();
				$bootmenuentries[$bootmenuID] = $this->bootmenuentriesMapper->findBy(array('bootmenuID' => $bootmenuID));
				foreach ($bootmenuentries[$bootmenuID] as $bootmenuentry){
					$kcl = $bootosMapper->find($bootmenuentry->getBootosID())->getDefaultkcl();
					if($bootmenuentry->getKcl() && $kcl != null)
					$bootmenuentry->setKcl($kcl);
					else
					$bootmenuentry->setKcl("deactivated (edit Bootmenuentry to activate)");
					if($bootmenuentry->getKclappend() == null)
					$bootmenuentry->setKclappend("none (edit Bootmenuentry to set KCL-Append)");
					$bootmenuentry->setBootosID("[".$bootmenuentry->getBootosID()."] ".$bootosMapper->find($bootmenuentry->getBootosID())->getTitle());
					if($bootmenuentry->getConfigID() != null)
						$bootmenuentry->setConfigID("[".$bootmenuentry->getConfigID()."] ".$configMapper->find($bootmenuentry->getConfigID())->getTitle());
				}
			}
		}else{
			$this->view->type = 'own';
			$bootmenu = $this->bootmenuMapper->findBy(array('membershipID' => $this->membership->getID()));
			if($bootmenu != null){
				$bootmenu[0]->setCreated(date(Zend_Registry::get('dateformat'),$bootmenu[0]->getCreated()));
				$bootmenuID = $bootmenu[0]->getID();
				$bootmenuentries[$bootmenuID] = $this->bootmenuentriesMapper->findBy(array('bootmenuID' => $bootmenuID));
				foreach ($bootmenuentries[$bootmenuID] as $bootmenuentry){
					$kcl = $bootosMapper->find($bootmenuentry->getBootosID())->getDefaultkcl();
					if($bootmenuentry->getKcl() && $kcl != null)
					$bootmenuentry->setKcl($kcl);
					else
					$bootmenuentry->setKcl("deactivated (edit Bootmenuentry to activate)");
					if($bootmenuentry->getKclappend() == null)
					$bootmenuentry->setKclappend("none");
					$bootmenuentry->setBootosID("[".$bootmenuentry->getBootosID()."] ".$bootosMapper->find($bootmenuentry->getBootosID())->getTitle());
					if($bootmenuentry->getConfigID() != null)
						$bootmenuentry->setConfigID("[".$bootmenuentry->getConfigID()."] ".$configMapper->find($bootmenuentry->getConfigID())->gettitle());
				}
			}
		}
	  
		// Search
		$search = $this->_request->getParam('search');
		$mySearch = new Pbs_Search();
		$mySearch->setSearchTerm($search);
		$mySearch->setType($this->type);
		$mySearch->setModule('bootmenu');
		if($search != ''){
			$this->view->search = $mySearch->getSearchTerm();
			$bootmenu = $mySearch->search($bootmenu);
		}
		$this->view->searchform = $mySearch->searchForm();
	  
		// Pagination
		$pagination = new Pbs_Pagination();
		$pagination->setPerPage(10);
		$pagination->setElement($bootmenu);
		$pagination->setRequestPage($this->_request->getParam('page'));
		$pagination->setPageUrl('/user/bootmenu/index/type/'.$this->type.((isset($this->view->search))?'/search/'.$this->view->search:''));
		$bootmenu = $pagination->getElements();

		$this->view->pagination = $pagination->pagination();
		$this->view->page 		= $pagination->getRequestPage();

		$this->view->bootmenulist = $bootmenu;
		$this->view->bootmenuentrylist = $bootmenuentries;

	}

	public function searchAction(){
		$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/search/'.($_GET['search']));
	}


	public function createbootmenuAction()
	{
		//ACL Darf er BootMenus erstellen?
		if(!Pbs_Acl::checkRight('booc'))
		$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/forbidden');
			
		if (!isset($_POST["createbootmenu"])){
			$bootmenuForm = new user_Form_Bootmenu(array('action' => 'createbootmenu','page' => $this->page, 'type'=>$this->type));
		} else {
			 
			$bootmenuForm = new user_Form_Bootmenu(array('action' => 'createbootmenu','page' => $this->page, 'type'=>$this->type),$_POST);

			if ($bootmenuForm->isValid($_POST)) {

				$bootmenu = new Application_Model_BootMenu($_POST);
				$bootmenu->setCreated(time());
				$bootmenu->setGroupID($this->membership->getGroupID());
				$bootmenu->setDefaultbootmenu('0');

				try{
					$this->bootmenuMapper->save($bootmenu);
				}catch(Zend_Exception $e){
					echo "Caught exception: " . get_class($e) . "<br/>";
					echo "Message: " . $e->getMessage() . "<br/>";
					$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/error');
				}
				$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/ok');
			}
		}

		$this->view->bootmenuForm = $bootmenuForm;
	}

	public function editbootmenuAction()
	{

		//ACL Is he allowed to edit BootMenus?
		if(!Pbs_Acl::checkRight('booe'))
		$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');

		$bootmenuID = $this->_request->getParam('bootmenuID');
		if (!is_numeric($bootmenuID))
		$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');

		$bootmenu = new Application_Model_BootMenu();
		$this->bootmenuMapper->find($bootmenuID, $bootmenu);

		if($this->membership->getGroupID() != $bootmenu->getGroupID())
		$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');

		if (!isset($_POST["editbootmenu"])){

			$bootmenuForm = new user_Form_Bootmenu(array('action' => 'editbootmenu','page' => $this->page, 'type'=>$this->type));
			$bootmenuForm->populate($bootmenu->toArray());

		}else{
			$bootmenuForm = new user_Form_Bootmenu(array('action' => 'editbootmenu','page' => $this->page, 'type'=>$this->type),$_POST);

			if ($bootmenuForm->isValid($_POST)) {

				$bootmenuold = $bootmenu;
				 
				$bootmenu = new Application_Model_BootMenu($_POST);
				$bootmenu->setGroupID($this->membership->getGroupID());
				$bootmenu->setCreated(time());
				$bootmenu->setID($bootmenuID);
				$bootmenu->setDefaultbootmenu($bootmenuold->getDefaultbootmenu());
				print_a($bootmenu);
				try {
					$this->bootmenuMapper->save($bootmenu);
				}catch(Zend_Exception $e)
				{
					echo "Caught exception: " . get_class($e) . "<br/>";
					echo "Message: " . $e->getMessage() . "<br/>";
					$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
				}

				$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/ok');
			}
			 
		}
		 
		$this->view->bootmenuForm = $bootmenuForm;
	}

	public function deletebootmenuAction()
	{

		//ACL Is he allowed to delete Bootmenu?
		if(!Pbs_Acl::checkRight('bood'))
		$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');

		try{
			$bootmenuID = $this->_request->getParam('bootmenuID');
			if (!is_numeric($bootmenuID))
			$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');
			 
			$bootmenu = new Application_Model_BootMenu();
			$this->bootmenuMapper->find($bootmenuID, $bootmenu);
			 
			if($this->membership->getGroupID() != $bootmenu->getGroupID())
			$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');

			$this->bootmenuMapper->delete($bootmenu);

		}catch(Zend_Exception $e){
			echo "Caught exception: " . get_class($e) . "<br/>";
			echo "Message: " . $e->getMessage() . "<br/>";
			$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/error');
		}
		$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/ok');
	}

	public function defaultbootmenuAction()
	{
		 
		//ACL Is he allowed to set Bootmenu as Default?
		if(!Pbs_Acl::checkRight('boodbm'))
		$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
	  
		try{
			$bootmenuID = $this->_request->getParam('bootmenuID');
			if (!is_numeric($bootmenuID))
			$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
		  
			$bootmenu = new Application_Model_BootMenu();

			$this->bootmenuMapper->find($bootmenuID, $bootmenu);
				
			if($bootmenu->getDefaultbootmenu() == false){
				 
				list($defaultbootmenu) = $this->bootmenuMapper->findBy(array('defaultbootmenu' => '1'));
				if($defaultbootmenu != null){
					$defaultbootmenu->setDefaultbootmenu(false);
					$this->bootmenuMapper->save($defaultbootmenu);
				}
				$bootmenu->setDefaultbootmenu(true);
				$this->bootmenuMapper->save($bootmenu);
			}
		}catch(Zend_Exception $e){
			echo "Caught exception: " . get_class($e) . "<br/>";
			echo "Message: " . $e->getMessage() . "<br/>";
			$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
		}
		$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/ok');
		 
	}

	public function addbootmenuentryAction()
	{
		 
		//ACL Darf er BootMenuEntries erstellen?
		if(!Pbs_Acl::checkRight('booae') && !Pbs_Acl::checkRight('booaeo'))
		$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/forbidden');

		$bootmenuID = $this->_request->getParam('bootmenuID');
		$maxorder = $this->_request->getParam('maxorder');
		 
		if (!is_numeric($bootmenuID) || !is_numeric($maxorder))
		$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');

		$bootosMapper = new Application_Model_BootOsMapper();
		$configMapper = new Application_Model_ConfigMapper();
		$groupMapper = new Application_Model_GroupMapper();
		 
		$groupID = $this->membership->getGroupID();
		$groupgroupsMapper = new Application_Model_GroupGroupsMapper();
		 
		$parents = array();
		$bootoslist = array();
		$parents = $groupgroupsMapper->getParentGroups($groupID);
		 
		$configlist = array('Preset' => array(), 'Custom' => Array());
		
		foreach($parents as $k => $parent){
			foreach($parent as  $p){
				$bootos = $bootosMapper->findBy(array("groupID" => $p));
				foreach ($bootos as $b)
				if($b->getPublic() - $k >= 0 ){
					$grouptitle = $groupMapper->find($p)->getTitle();
					$bootoslist[$b->getID()] = $b;
					$bootosanzeige[$grouptitle][$b->getID()] = $b->getTitle();
					$configlist['Preset'][$b->getID()] = $configMapper->findBy(array('bootosID' => $b->getID(), 'visible' => '1'));
					$configlist['Custom'][$b->getID()] = $configMapper->findBy(array('membershipID' => $this->membership->getID(), 'bootosID' => $b->getID(), 'visible' => '1'));
				}
			}
		}

		


		$bootmenu = new Application_Model_BootMenu();
		$this->bootmenuMapper->find($bootmenuID, $bootmenu);
		 
		if($bootmenu->getMembershipID() != null){
			if($this->membership->getID() != $bootmenu->getMembershipID() || !Pbs_Acl::checkRight('booaeo'))
			$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/forbidden');
		}else{
			if($this->membership->getGroupID() != $bootmenu->getGroupID() || !Pbs_Acl::checkRight('booae'))
			$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/forbidden');
		}

		if (!isset($_POST["addbootmenuentry"])){

			if(!isset($_POST['kcl']))
			$_POST['kcl'] = true;

			$bootmenuentryForm = new user_Form_BootmenuEntries(array(
    	    	'bootoslist'=> $bootoslist,
    	    	'bootosanzeige' => $bootosanzeige,
    	    	'maxorder'=> $maxorder, 
    	    	'configlist'=> $configlist,
    	    	'page' => $this->page,
    	    	'type' => $this->type,
    	    	'action' => 'addbootmenuentry',
			));
				
			$bootmenuentryForm->populate(array('order' => $maxorder));
			unset($_POST['defaultkcl']);
			unset($_POST['configID']);
			$bootmenuentryForm->populate($_POST);
				
		} else {
			 
			$bootmenuentryForm = new user_Form_BootmenuEntries(array(
    	        	'bootoslist'=>$bootoslist, 
    	            'bootosanzeige' => $bootosanzeige,
    	        	'maxorder'=> $maxorder, 
    	        	'configlist'=>$configlist, 
    	        	'page' => $this->page, 
    	       		'type' => $this->type,
    	        	'action' => 'addbootmenuentry',
			),$_POST);
			 
			if ($bootmenuentryForm->isValid($_POST)) {
					
				$bootmenuentry = new Application_Model_BootMenuEntries($_POST);
				$bootmenuentry->setBootmenuID($bootmenuID);

				try {
					if($bootmenuentry->getOrder() < $maxorder){
						$bootmenuentry->setOrder($bootmenuentry->getOrder());
						$this->bootmenuentryMapper->order($bootmenuentry);
					}

					//print_a($bootmenuentry);

					$this->bootmenuentryMapper->save($bootmenuentry);
				}catch(Zend_Exception $e)
				{
					echo "Caught exception: " . get_class($e) . "<br/>";
					echo "Message: " . $e->getMessage() . "<br/>";
					$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/error');
						
				}
				$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/ok');
			}
		}

		$this->view->bootmenuentryForm = $bootmenuentryForm;
		 
	}

	public function editbootmenuentryAction()
	{
		//ACL Is he allowed to edit BootMenus?
		if(!Pbs_Acl::checkRight('booee') && !Pbs_Acl::checkRight('booeem') && !Pbs_Acl::checkRight('booeeo'))
		$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');

		$bootmenuentryID = $this->_request->getParam('bootmenuentryID');
		$maxorder = $this->_request->getParam('maxorder');
		$oldorder = $this->_request->getParam('oldorder');
		if (!is_numeric($bootmenuentryID) || !is_numeric($maxorder) || !is_numeric($oldorder))
		$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');

		$bootosMapper = new Application_Model_BootOsMapper();
		$configMapper = new Application_Model_ConfigMapper();

		$groupID = $this->membership->getGroupID();
		$groupgroupsMapper = new Application_Model_GroupGroupsMapper();
		$groupMapper = new Application_Model_GroupMapper();
		 
		$parents = array();
		$bootoslist = array();
		$parents = $groupgroupsMapper->getParentGroups($groupID);
		 
		foreach($parents as $k => $parent){
			foreach($parent as  $p){
				$bootos = $bootosMapper->findBy(array("groupID" => $p));
				foreach ($bootos as $b)
				if($b->getPublic() - $k >= 0 ){
					$grouptitle = $groupMapper->find($p)->getTitle();
					$bootoslist[$b->getID()] = $b;
					$bootosanzeige[$grouptitle][$b->getID()] = $b->getTitle();
					$configlist['Preset'][$b->getID()] = $configMapper->findBy(array('bootosID' => $b->getID(), 'visible' => '1'));
					$configlist['Custom'][$b->getID()] = $configMapper->findBy(array('membershipID' => $this->membership->getID(), 'bootosID' => $b->getID(), 'visible' => '1'));
					
				}
			}
		}

		$bootmenuentry = new Application_Model_BootMenuEntries();
		$bootmenu = new Application_Model_BootMenu();
		$this->bootmenuentryMapper->find($bootmenuentryID, $bootmenuentry);
		$this->bootmenuMapper->find($bootmenuentry->getBootmenuID(), $bootmenu);
		 
		if($bootmenu->getMembershipID() != null){
			if($this->membership->getID() != $bootmenu->getMembershipID() || !Pbs_Acl::checkRight('booeeo'))
			$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
		}else{
			if($this->membership->getGroupID() != $bootmenu->getGroupID() || (!Pbs_Acl::checkRight('booee') && !Pbs_Acl::checkRight('booeem')))
			$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
		}
		
		$neworder = $this->_request->getParam('neworder');
		if($neworder != ''){
			if($neworder == 'undefined')
				$neworder = $maxorder-1;
					
			$_POST = array(
    			'title' => $bootmenuentry->getTitle(),
    			'bootosID' => $bootmenuentry->getBootosID(),
   				'kcl' => $bootmenuentry->getKcl(),
    			'kclappend' => $bootmenuentry->getKclappend(),
    			'configID' => $bootmenuentry->getConfigID(),
    			'order' => $neworder,
    			'editbootmenuentry' => 'Edit Bootmenuentry',
			);
		}
		 
		if (!isset($_POST["editbootmenuentry"])){
			if(!isset($_POST['bootosID']))
			$_POST['bootosID'] = $bootmenuentry->getBootosID();
			if(!isset($_POST['kcl']))
			$_POST['kcl'] = $bootmenuentry->getKcl();
			 
			$bootmenuentryForm = new user_Form_BootmenuEntries(array(
    			'bootoslist'=> $bootoslist,
    			'bootosanzeige' => $bootosanzeige,
    	    	'maxorder'=> $maxorder-1, 
    	    	'configlist'=> $configlist,
    	    	'page' => $this->page,
    			'type' => $this->type,
    	    	'action' => 'editbootmenuentry', 
			));

			if(!isset($_POST['configID'])){
				$bootmenuentryForm->populate($bootmenuentry->toArray());
			}
			else{
				unset($_POST['defaultkcl']);
				unset($_POST['configID']);
				$bootmenuentryForm->populate($_POST);
			}

		}else{
			$bootmenuentryForm = new user_Form_BootmenuEntries(array(
    			'bootoslist'=> $bootoslist,
    			'bootosanzeige' => $bootosanzeige,
    	    	'maxorder'=> $maxorder-1, 
    	    	'configlist'=> $configlist,
    	    	'page' => $this->page,
    			'type' => $this->type,
    	    	'action' => 'editbootmenuentry'),$_POST);

			if ($bootmenuentryForm->isValid($_POST)) {
				 
				$bootmenuentryold= $bootmenuentry;
				 
				$bootmenuentry = new Application_Model_BootMenuEntries($_POST);
				$bootmenuentry->setBootmenuID($bootmenu->getID());
				$bootmenuentry->setID($bootmenuentryID);
				 
				if(	$bootmenuentryold->getBootosID() != $bootmenuentry->getBootosID() ||
				$bootmenuentryold->getConfigID() != $bootmenuentry->getConfigID() ||
				$bootmenuentryold->getKcl() != $bootmenuentry->getKcl() ||
				$bootmenuentryold->getKclappend() != $bootmenuentry->getKclappend()){
					//ACL Is he allowed to edit this?
					if(!Pbs_Acl::checkRight('booee') && !Pbs_Acl::checkRight('booeeo'))
					$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
				}
				 
				try {
					if($bootmenuentry->getOrder() < $oldorder)
					$this->bootmenuentryMapper->orderbefore($bootmenuentry, $oldorder);
					else
					$this->bootmenuentryMapper->orderafter($bootmenuentry, $oldorder);

					$this->bootmenuentryMapper->save($bootmenuentry);

				}catch(Zend_Exception $e)
				{
					echo "Caught exception: " . get_class($e) . "<br/>";
					echo "Message: " . $e->getMessage() . "<br/>";
					$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');

				}

				$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/ok');
			}
			 
		}
		 
		$this->view->bootmenuentryForm = $bootmenuentryForm;
		 
	}

	public function removebootmenuentryAction()
	{
		//ACL Is he allowed to delete Bootos?
		if(!Pbs_Acl::checkRight('boode') && !Pbs_Acl::checkRight('boodeo'))
		$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');

		try{
			$bootmenuentryID = $this->_request->getParam('bootmenuentryID');
			if (!is_numeric($bootmenuentryID))
			$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');
			 
			$bootmenuentry = new Application_Model_BootMenuEntries();
			$bootmenu = new Application_Model_BootMenu();
			$this->bootmenuentryMapper->find($bootmenuentryID, $bootmenuentry);
			$this->bootmenuMapper->find($bootmenuentry->getBootmenuID(), $bootmenu);

			if($bootmenu->getMembershipID() != null){
				if($this->membership->getID() != $bootmenu->getMembershipID() || !Pbs_Acl::checkRight('boodeo'))
				$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');
			}else{
				if($this->membership->getGroupID() != $bootmenu->getGroupID() || !Pbs_Acl::checkRight('boode'))
				$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');
			}

			$this->bootmenuentryMapper->delete($bootmenuentry);
			$this->bootmenuentryMapper->orderremove($bootmenuentry);

		}catch(Zend_Exception $e){
			echo "Caught exception: " . get_class($e) . "<br/>";
			echo "Message: " . $e->getMessage() . "<br/>";
			$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/error');
		}
		$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/ok');
	}

}