/**
  * editAction
  * @author Cornelius Hansjakob <*****@*****.**>
  * @version 1.0
  */
 public function editAction()
 {
     $this->core->logger->debug('core->controllers->FolderController->editAction()');
     $this->getForm($this->core->sysConfig->generic->actions->edit);
     $this->addFolderSpecificFormElements();
     /**
      * get form title
      */
     $this->view->formtitle = $this->objForm->Setup()->getFormTitle();
     if ($this->objRequest->isPost() && $this->objRequest->isXmlHttpRequest()) {
         $arrFormData = $this->objRequest->getPost();
         $this->objForm->Setup()->setFieldValues($arrFormData);
         /**
          * prepare form (add fields and region to the Zend_Form)
          */
         $this->objForm->prepareForm();
         /**
          * set action
          */
         $this->objForm->setAction('/zoolu/core/folder/edit');
         if ($this->objForm->isValid($arrFormData)) {
             $this->objForm->saveFormData();
             /**
              * update the folder start element
              */
             $arrArgs = array('LanguageId' => $this->objRequest->getParam("languageId", $this->core->intZooluLanguageId), 'GenericSetup' => $this->objForm->Setup());
             $this->objCommandChain->runCommand('editFolderStartElement', $arrArgs);
             $this->view->assign('blnShowFormAlert', true);
         } else {
             $this->view->assign('blnShowFormAlert', false);
         }
     } else {
         /**
          * prepare form (add fields and region to the Zend_Form)
          */
         $this->objForm->prepareForm();
     }
     /**
      * output of metainformation to hidden div
      */
     $this->setViewMetaInfos();
     $this->view->form = $this->objForm;
     $this->renderScript('folder/form.phtml');
 }
Example #2
0
    }

}

class MailCommand implements ICommand {

    public function onCommand($name, $args) {
        if ($name != 'mail')
            return false;
        echo( "MailCommand handling 'mail'\n" );
        return true;
    }

}

$cc = new CommandChain();
$cc->addCommand(new UserCommand());
$cc->addCommand(new MailCommand());
$cc->runCommand('addUser', null);
$cc->runCommand('mail', null);
?>



<?php

/*
  « 5 - The strategy pattern »
  <<------------------------------------------------------------------------------
  resultado da execução:
  Array
class CustCommand implements Command
{
    public function onCommand($name, $args)
    {
        if ($name !== 'addCustomer') {
            return false;
        } else {
            echo 'This is Customer Command handling "addCustomer"' . PHP_EOL;
            echo 'The args:' . $args . PHP_EOL;
            return true;
        }
    }
}
class MailCommand implements Command
{
    public function onCommand($name, $args)
    {
        if ($name !== 'sendMail') {
            return false;
        } else {
            echo 'This is Mail Command handling "sendMail"' . PHP_EOL;
            echo 'The args:' . $args . PHP_EOL;
            return true;
        }
    }
}
$chain = new CommandChain();
$chain->addCommand(new CustCommand());
$chain->addCommand(new MailCommand());
$chain->runCommand('addCustomer', 'lcpeng');
$chain->runCommand('sendMail', '*****@*****.**');
Example #4
0
 /**
  * Get the command chain context
  * 
  * This functions sets the command subject as the mixer in the context
  *
  * @return  CommandContext
  */
 public function getCommandContext()
 {
     $context = $this->_command_chain->getContext();
     $context->setSubject($this->_mixer);
     return $context;
 }