Copyright 2011-2016 Horde LLC (http://www.horde.org/) See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
Author: Gunnar Wrobel (wrobel@pardus.de)
Inheritance: implements Countable
示例#1
0
文件: Ledger.php 项目: horde/horde
 /**
  * Run the module.
  *
  * @param Horde_Cli $cli       The CLI handler.
  * @param mixed     $options   An array of options.
  * @param mixed     $arguments An array of arguments.
  * @param array     &$world    A list of initialized dependencies.
  *
  * @return NULL
  */
 public function run($cli, $options, $arguments, &$world)
 {
     if (!isset($arguments[1])) {
         $action = 'display';
     } else {
         $action = $arguments[1];
     }
     switch ($action) {
         case 'display':
             $folders = $world['storage']->getList()->getQuery()->listByType('h-ledger');
             foreach ($folders as $folder) {
                 $cli->writeln($folder);
             }
             break;
             break;
         case 'import':
             $ledger = new Horde_Kolab_Cli_Data_Ledger();
             $ledger->importFile($arguments[3]);
             $data = $world['storage']->getData($arguments[2], 'h-ledger');
             $object = array('type' => 'h-ledger');
             foreach ($ledger->asXml() as $entry) {
                 $object['xml'] = $entry;
                 $data->create($object);
             }
             break;
         default:
             $cli->message(sprintf(Horde_Kolab_Cli_Translation::t('Action %s not supported!'), $action), 'cli.error');
             break;
     }
 }
示例#2
0
 private function _import()
 {
     $ledger = new Horde_Kolab_Cli_Data_Ledger();
     $ledger->importFile(__DIR__ . '/../../../fixtures/ledger.xml');
     return $ledger;
 }