public function index() { $tasks = $this->getTasks(); // Web mode if (!Director::is_cli()) { $renderer = new DebugView(); echo $renderer->renderHeader(); echo $renderer->renderInfo("SilverStripe Development Tools: Tasks", Director::absoluteBaseURL()); $base = Director::absoluteBaseURL(); echo "<div class=\"options\">"; echo "<ul>"; foreach ($tasks as $task) { echo "<li><p>"; echo "<a href=\"{$base}dev/tasks/" . $task['segment'] . "\">" . $task['title'] . "</a><br />"; echo "<span class=\"description\">" . $task['description'] . "</span>"; echo "</p></li>\n"; } echo "</ul></div>"; echo $renderer->renderFooter(); // CLI mode } else { echo "SILVERSTRIPE DEVELOPMENT TOOLS: Tasks\n--------------------------\n\n"; foreach ($tasks as $task) { echo " * {$task['title']}: sake dev/tasks/" . $task['segment'] . "\n"; } } }
public function build($request) { if (Director::is_cli()) { $da = DatabaseAdmin::create(); return $da->handleRequest($request, $this->model); } else { $renderer = DebugView::create(); echo $renderer->renderHeader(); echo $renderer->renderInfo("Environment Builder", Director::absoluteBaseURL()); echo "<div class=\"build\">"; $da = DatabaseAdmin::create(); $response = $da->handleRequest($request, $this->model); echo "</div>"; echo $renderer->renderFooter(); return $response; } }
/** * Build the default data, calling requireDefaultRecords on all * DataObject classes * Should match the $url_handlers rule: * 'build/defaults' => 'buildDefaults', */ public function buildDefaults() { $da = DatabaseAdmin::create(); $renderer = null; if (!Director::is_cli()) { $renderer = DebugView::create(); echo $renderer->renderHeader(); echo $renderer->renderInfo("Defaults Builder", Director::absoluteBaseURL()); echo "<div style=\"margin: 0 2em\">"; } $da->buildDefaults(); if (!Director::is_cli()) { echo "</div>"; echo $renderer->renderFooter(); } }