/**
  * childnavigationAction
  * @author Thomas Schedler <*****@*****.**>
  * @version 1.0
  */
 public function childnavigationAction()
 {
     $this->core->logger->debug('global->controllers->NavigationController->childnavigationAction()');
     if ($this->getRequest()->isPost() && $this->getRequest()->isXmlHttpRequest()) {
         $objRequest = $this->getRequest();
         $intCurrLevel = $objRequest->getParam("currLevel");
         $this->setFolderId($objRequest->getParam("folderId"));
         $this->setRootLevelId($objRequest->getParam("rootLevelId"));
         $intRootLevelGroupId = $objRequest->getParam('rootLevelGroupId');
         $strRootLevelGroupKey = $objRequest->getParam('rootLevelGroupKey', 'content');
         /**
          * get childnavigation
          */
         $this->getModelFolders();
         $objChildelements = $this->objModelFolders->loadGlobalChildNavigation($this->intFolderId, $intRootLevelGroupId);
         $this->view->assign('childelements', $objChildelements);
         $this->view->assign('currLevel', $intCurrLevel);
         $this->view->assign('rootLevelId', $this->intRootLevelId);
         $this->view->assign('rootLevelGroupId', $intRootLevelGroupId);
         $this->view->assign('rootLevelGroupKey', $strRootLevelGroupKey);
     }
 }
 */
define('APPLICATION_ENV', 'development');
/**
 * include general (autoloader, config)
 */
require_once dirname(__FILE__) . '/../sys_config/general.inc.php';
try {
    $objConsoleOpts = new Zend_Console_Getopt(array('folderId|f=i' => 'Folder Id', 'rootLevelId|r=i' => 'RootLevel Id', 'fromLanguageId|fl=i' => 'From Language Id', 'toLanguageId|tl=i' => 'To Language Id'));
    echo "build tree language variant\n---------------------------\n";
    if (isset($objConsoleOpts->fromLanguageId) && isset($objConsoleOpts->toLanguageId)) {
        echo "load fist level of the tree ...\n";
        require_once GLOBAL_ROOT_PATH . $core->sysConfig->path->zoolu_modules . 'core/models/Folders.php';
        $objModelFolders = new Model_Folders();
        $objModelFolders->setLanguageId($objConsoleOpts->fromLanguageId);
        if (isset($objConsoleOpts->folderId) && $objConsoleOpts->folderId > 0) {
            $objProducts = $objModelFolders->loadGlobalChildNavigation($objConsoleOpts->folderId, $core->sysConfig->root_level_groups->product);
        } else {
            if (isset($objConsoleOpts->rootLevelId) && $objConsoleOpts->rootLevelId > 0) {
                $objProducts = $objModelFolders->loadGlobalRootNavigation($objConsoleOpts->rootLevelId, $core->sysConfig->root_level_groups->product);
            }
        }
        // simulate user auth
        $obj = new stdClass();
        $obj->id = 3;
        //user id
        Zend_Auth::getInstance()->getStorage()->write($obj);
        if (isset($objProducts) && count($objProducts)) {
            buildTreeLanguageVariantNow($objProducts);
        }
    }
    echo "---------------------------\n";