namespace Org\Mxchange\CoreFramework\Command;
// Import framework stuff
-use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory;
+use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
use Org\Mxchange\CoreFramework\Request\Requestable;
-use Org\Mxchange\CoreFramework\Resolver\Resolver;
use Org\Mxchange\CoreFramework\Response\Responseable;
+use Org\Mxchange\CoreFramework\Traits\Resolver\ResolverTrait;
+use Org\Mxchange\CoreFramework\Traits\Template\CompileableTemplateTrait;
/**
* A general (base) command
*
* @author Roland Haeder <webmaster@shipsimu.org>
* @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2021 Core Developer Team
* @license GNU GPL 3.0 or any newer version
* @link http://www.shipsimu.org
*
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
abstract class BaseCommand extends BaseFrameworkSystem {
- /**
- * Resolver instance
- */
- private $resolverInstance = NULL;
+ // Load traits
+ use CompileableTemplateTrait;
+ use ResolverTrait;
/**
* Protected constructor
$this->setTemplateInstance($templateInstance);
}
- /**
- * Setter for resolver instance
- *
- * @param $resolverInstance Instance of a command resolver class
- * @return void
- */
- protected final function setResolverInstance (Resolver $resolverInstance) {
- $this->resolverInstance = $resolverInstance;
- }
-
- /**
- * Getter for resolver instance
- *
- * @return $resolverInstance Instance of a command resolver class
- */
- protected final function getResolverInstance () {
- return $this->resolverInstance;
- }
-
/**
* Sends a generic HTTP response with header, menu, content and footer
*
assert(!$requestInstance->isPostRequestMethod());
// Get the application instance
- $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
+ $applicationInstance = ApplicationHelper::getSelfInstance();
// Transfer application data
$this->getTemplateInstance()->assignApplicationData();
$this->getTemplateInstance()->loadCodeTemplate($masterTemplate);
// Set title
- $this->getTemplateInstance()->assignVariable('title', $this->getLanguageInstance()->getMessage('page_' . $applicationInstance->getAppShortName() . '_' . $this->getResolverInstance()->getCommandName() . '_title'));
+ $this->getTemplateInstance()->assignVariable('title', FrameworkBootstrap::getLanguageInstance()->getMessage('page_' . $applicationInstance->getAppShortName() . '_' . $this->getResolverInstance()->getCommandName() . '_title'));
// Construct the menu in every command. We could do this in BaseCommand class. But this means
// *every* command has a navigation system and that is want we don't want.
- $menuInstance = ObjectFactory::createObjectByConfiguredName($applicationInstance->getAppShortName() . '_' . $this->getResolverInstance()->getCommandName() . '_menu_class', array($applicationInstance));
+ $menuInstance = ObjectFactory::createObjectByConfiguredName($applicationInstance->getAppShortName() . '_' . $this->getResolverInstance()->getCommandName() . '_menu_class');
// Render the menu
$menuInstance->renderMenu();