Admin_ClassController::exportCustomLayoutDefinitionAction PHP Метод

exportCustomLayoutDefinitionAction() публичный Метод

    public function exportCustomLayoutDefinitionAction()
    {
        $this->removeViewRenderer();
        $id = intval($this->getParam("id"));
        if ($id) {
            $customLayout = Object\ClassDefinition\CustomLayout::getById($id);
            if ($customLayout) {
                $name = $customLayout->getName();
                unset($customLayout->id);
                unset($customLayout->classId);
                unset($customLayout->name);
                unset($customLayout->creationDate);
                unset($customLayout->modificationDate);
                unset($customLayout->userOwner);
                unset($customLayout->userModification);
                unset($customLayout->fieldDefinitions);
                header("Content-type: application/json");
                header("Content-Disposition: attachment; filename=\"custom_definition_" . $name . "_export.json\"");
                $json = json_encode($customLayout);
                $json = \Zend_Json::prettyPrint($json);
                echo $json;
                die;
            }
        }
        $errorMessage = ": Custom Layout with id [ " . $id . " not found. ]";
        Logger::error($errorMessage);
        echo $errorMessage;
    }