本文整理匯總了PHP中Modules::getModulePath方法的典型用法代碼示例。如果您正苦於以下問題:PHP Modules::getModulePath方法的具體用法?PHP Modules::getModulePath怎麽用?PHP Modules::getModulePath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Modules
的用法示例。
在下文中一共展示了Modules::getModulePath方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: editModelAction
public function editModelAction($module, $modelName)
{
$path = Modules::getModulePath($module) . '/models/' . $modelName . '.php';
if (!file_exists($path)) {
Tools::redirect('/admin/modules/edit/' . $module, 'Модель ' . $modelName . ' не найдена', 'danger');
}
include_once Modules::getModulePath($module) . '/models/' . $modelName . '.php';
$modelFullName = $module . '\\' . $modelName;
$model = new $modelFullName();
if (filter_input(INPUT_POST, 'codeName') && filter_input(INPUT_POST, 'name')) {
$this->modules->generateModel($module, filter_input(INPUT_POST, 'name'), filter_input(INPUT_POST, 'codeName'), ['cols' => $_POST['cols']]);
Tools::redirect('/admin/modules/editor/' . $module, 'Модель ' . filter_input(INPUT_POST, 'codeName') . ' была сохранена');
}
$this->view->page(['content' => 'modelEditor', 'data' => compact('module', 'modelName', 'modelFullName', 'model')]);
}
示例2: addActionToController
public function addActionToController($module, $type, $controller, $url)
{
$modulePath = Module::getModulePath($module);
$path = Modules::getModulePath($module) . '/' . $type . '/' . $controller . '.php';
$class = CodeGenerator::parseClass($path);
$class->addMethod($url . 'Action');
$controllerCode = "<?php\n\n" . $class->generate();
Tools::createDir(pathinfo($path, PATHINFO_DIRNAME));
file_put_contents($path, $controllerCode);
$config = Config::custom($modulePath . '/generatorHash.php');
$config[$type . '/' . $module . 'Controller.php'] = md5($controllerCode);
Config::save($modulePath . '/generatorHash.php', $config);
}
示例3:
<?php
$table = new Ui\Table();
$table->name = 'Страницы';
$table->setCols(['Адрес', 'Операции']);
$table->addButton(['href' => "/admin/modules/createControllerMethod/{$module}/{$type}/{$controller}", 'text' => 'Создать']);
$class = CodeGenerator::parseClass(Modules::getModulePath($module) . '/' . $type . '/' . $controller . '.php');
foreach ($class->methods as $method) {
$name = str_replace('Action', '', $method->name);
$table->addRow([$name, ['class' => 'actionTd', 'html' => '<a class="btn btn-xs btn-success" href="/admin/modules/editControllerMethod/' . $module . '/' . $type . '/' . $controller . '/' . $name . '"><i class="glyphicon glyphicon-edit"></i></a>' . ' <a class="btn btn-xs btn-danger" href="/admin/modules/delControllerMethod/' . $module . '/' . $type . '/' . $controller . '/' . $name . '"><i class="glyphicon glyphicon-remove"></i></a>']]);
}
$table->draw();