public function build($request) { if (Director::is_cli()) { $da = DatabaseAdmin::create(); return $da->handleRequest($request, $this->model); } else { $renderer = DebugView::create(); $renderer->writeHeader(); $renderer->writeInfo("Environment Builder", Director::absoluteBaseURL()); echo "<div class=\"build\">"; $da = DatabaseAdmin::create(); return $da->handleRequest($request, $this->model); echo "</div>"; $renderer->writeFooter(); } }
public function index() { $renderer = DebugView::create(); $renderer->writeHeader(); $renderer->writeInfo("Installed Omnipay Payment Gateways", Director::absoluteBaseURL()); $types = $this->PaymentTypes(); echo "<table style=\"font-size:12px;\" border=1 cellspacing=0>\n\t\t\t\t<thead>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Short Name</td>\n\t\t\t\t\t\t<td>Full name</td>\n\t\t\t\t\t\t<td>Purchase</td>\n\t\t\t\t\t\t<td>Authorize</td>\n\t\t\t\t\t\t<td>CompleteAuthorize</td>\n\t\t\t\t\t\t<td>Capture</td>\n\t\t\t\t\t\t<td>Complete Purchase</td>\n\t\t\t\t\t\t<td>Refund</td>\n\t\t\t\t\t\t<td>Void</td>\n\t\t\t\t\t\t<td>Create Card</td>\n\t\t\t\t\t\t<td>Delete Card</td>\n\t\t\t\t\t\t<td>Update Card</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</thead>\n\t\t\t<tbody>"; foreach ($types as $gateway) { echo "<tr>" . "<td>" . $gateway->getShortName() . "</td>" . "<td>" . $gateway->getName() . "</td>" . "<td>yes</td>" . "<td>" . ($gateway->supportsAuthorize() ? "yes" : "") . "</td>" . "<td>" . ($gateway->supportsCompleteAuthorize() ? "yes" : "") . "</td>" . "<td>" . ($gateway->supportsCapture() ? "yes" : "") . "</td>" . "<td>" . ($gateway->supportsCompletePurchase() ? "yes" : "") . "</td>" . "<td>" . ($gateway->supportsRefund() ? "yes" : "") . "</td>" . "<td>" . ($gateway->supportsVoid() ? "yes" : "") . "</td>" . "<td>" . ($gateway->supportsCreateCard() ? "yes" : "") . "</td>" . "<td>" . ($gateway->supportsDeleteCard() ? "yes" : "") . "</td>" . "<td>" . ($gateway->supportsUpdateCard() ? "yes" : "") . "</td>" . "</tr>"; if ($this->request->getVar('defaults')) { echo "<tr><td colspan=\"11\">"; var_dump($gateway->getDefaultParameters()); echo "</td></tr>"; } } echo "</tbody></table>"; $renderer->writeFooter(); }
/** * Build the default data, calling requireDefaultRecords on all * DataObject classes * Should match the $url_handlers rule: * 'build/defaults' => 'buildDefaults', */ function buildDefaults() { $da = DatabaseAdmin::create(); if (!Director::is_cli()) { $renderer = DebugView::create(); $renderer->writeHeader(); $renderer->writeInfo("Defaults Builder", Director::absoluteBaseURL()); echo "<div style=\"margin: 0 2em\">"; } $da->buildDefaults(); if (!Director::is_cli()) { echo "</div>"; $renderer->writeFooter(); } }
public function ActionDeleteCruft($data, $form) { if (!Director::is_cli()) { $renderer = DebugView::create(); $renderer->writeHeader(); $renderer->writeInfo("Environment Builder", Director::absoluteBaseURL()); echo "<div class=\"scrub\">"; } if (!empty($data["DeleteSpec"])) { foreach ($data["DeleteSpec"] as $table => $spec) { if (!empty($spec["WholeTable"]) && $spec["WholeTable"] === "1") { $this->deleteTable($table); continue; } if (!empty($spec["Fields"])) { foreach ($spec["Fields"] as $fieldName => $delete) { if ($delete !== "1") { continue; } $this->deleteField($table, $fieldName); } } if (!empty($spec["Indexes"])) { foreach ($spec["Indexes"] as $indexName => $delete) { if ($delete !== "1") { continue; } $this->deleteIndex($table, $indexName); } } if (!empty($spec["ManyMany"])) { foreach ($spec["ManyMany"] as $relationship => $manyManySpec) { if (!empty($manyManySpec["Fields"])) { foreach ($manyManySpec["Fields"] as $fieldName => $delete) { if ($delete !== "1") { continue; } $this->deleteField("{$table}_{$relationship}", $fieldName); } } if (!empty($manyManySpec["Indexes"])) { foreach ($manyManySpec["Indexes"] as $indexName => $delete) { if ($delete !== "1") { continue; } $this->deleteIndex("{$table}_{$relationship}", $indexName); } } } } } } if (!Director::is_cli()) { echo "</div>"; $renderer->writeFooter(); } }
public function populate() { $_REQUEST['showqueries'] = 0; set_time_limit(3600); $renderer = DebugView::create(); $renderer->writeHeader(); $renderer->writeInfo("Orient Environment Builder: Do not run while logged in as a member", Director::absoluteBaseURL()); echo "<div class=\"build\">"; $numTestObjects = 100; $content .= "<br /><br />Creating {$numTestObjects} test objects.. <br />"; for ($i = 0; $i < $numTestObjects; $i++) { $rand = rand(1, 10); $testObj = new TestObject(); $testObj->Code = 'orient-test-' . $rand; $testObj->Title = 'OrientDB Test ' . $rand; $testObj->Sort = 1; $testObj->write(false, true, true); // $content .= "{$testObj->Title} <br />"; } $content .= "Creating inherited object <br />"; $child = Family_Child::create(); $child->update(array('Name' => "Name First", 'Title' => 'Child')); $result = $child->write(); $numPosts = 100; $content .= "Creating {$numPosts} posts and authors <br />"; for ($i = 0; $i < $numPosts; $i++) { $rand = rand(1, 9); $author = new Person(); $author->Name = "Person {$rand}"; $id = $author->write(); $post = new Post(); $post->Title = "Post Title {$rand}"; $post->AuthorID = $id; $post->write(); } $numArticles = 100; $content .= "Creating {$numArticles} articles and at least as many tags <br />"; for ($i = 0; $i < $numArticles; $i++) { $rand = rand(1, 999); $article = new Article(); $article->Title = "Article {$rand}"; $id = $article->write(); $range = array(1, 2); foreach ($range as $val) { $tag = new Tag(); $tag->Name = "Tag {$val}"; $tag->write(); $article->Tags()->add($tag); } } echo $content; echo "</div>"; $renderer->writeFooter(); }
public function populate() { $renderer = DebugView::create(); $renderer->writeHeader(); $renderer->writeInfo("Orient Environment Builder: Do not run while logged in as a member", Director::absoluteBaseURL()); echo "<div class=\"build\">"; $content = 'Creating some test objects.. <br /><br />'; for ($i = 0; $i < 50; $i++) { $rand = rand(1, 10); $testObj = new TestObject(); $testObj->Code = 'orient-test-' . $rand; $testObj->Title = 'OrientDB Test ' . $rand; $testObj->Sort = 1; $testObj->write(false, true, true); $content .= "{$testObj->Title} <br />"; } echo $content; echo "</div>"; $renderer->writeFooter(); }