public function actionIndex() { $files = []; $dir = \Gbox::$components->debug->getPath(); if ($handle = opendir($dir)) { while (false !== ($entry = readdir($handle))) { if ($entry != '.' && $entry != '..' && strpos($entry, 'debug') === 0) { $data = Json::decode(file_get_contents(\Gbox::$components->debug->getFile($entry))); if ($data[0]['session'] == session_id()) { // $files[] = $entry; $files[filemtime($dir . $entry)] = $entry; } } } closedir($handle); krsort($files); } Session::set('files-debug', $files); if (!($current = \Gbox::getRequest()->get('id'))) { reset($files); $current = current($files); Session::set('files-debug-current', $current); } Session::set('files-debug-current', $current); return $this->render('index', ['files' => $files]); }
private function saveReportInFile($data) { if (\Gbox::getRequest()->getModule() == 'debug') { return; } $file = file_get_contents($this->file); $datafile = json_decode($file); unset($file); $datafile[] = $data; file_put_contents($this->file, json_encode($datafile)); unset($datafile); }
public function render($view, $params = [], $context = null) { $this->setContextIfNull($context); $viewFile = Url::to('@views/' . $this->controller . '/' . $view . '.' . $this->defaultExtension); $layoutFile = Url::to('@layouts/' . $this->context->getLayout() . '.php'); ob_start(); $this->renderFile($viewFile, $params, $context); $content = ob_get_contents(); ob_end_clean(); ob_start(); $this->renderFileLayout($layoutFile, ['content' => $content], $context); $out = ob_get_contents(); ob_end_clean(); \Gbox::getResponse()->data = $out; }
public static function to($route = '@web', $query = []) { if (is_array($route)) { $route = implode('/', $route); } $routes = explode('/', $route); // if (empty($routes[0])) // $routes[0] = '@web'; if (strpos($routes[0], '@') === 0) { if ($path = \Gbox::getAlias($routes[0])) { $routes[0] = $path; } } $to = implode('/', $routes); if (count($query) != 0) { $to = $to . '?' . http_build_query($query); } return $to; }
public function __construct($config = []) { if (array_key_exists('method', $config)) { $this->method = $config['method']; } if (array_key_exists('action', $config)) { $this->action = $config['action']; } else { $this->action = \Gbox::getRequest()->getUrl(); } if (array_key_exists('template', $config)) { $this->template = $config['template']; } if (array_key_exists('options', $config)) { $this->options = $config['options']; } $html = '<form'; $html .= ' action="' . $this->action . '"'; $html .= ' method="' . $this->method . '"'; $html .= array_key_exists('class', $this->options) ? ' class="' . $this->options['class'] . '"' : ''; $html .= '>'; echo $html; }
echo 'active'; } ?> ">Sendmail</a> </div> </div> <div class="col-md-9"> <div class="panel-group" id="accordion-debug" role="tablist" aria-multiselectable="true"> <?php $i = -1; ?> <?php foreach (\Gbox::$components->debug->getData(Session::get('files-debug-current')) as $record) { ?> <?php if (\Gbox::getRequest()->get('type') != '' && $record['type'] != \Gbox::getRequest()->get('type')) { continue; } ?> <?php $i++; ?> <div class="panel panel-default"> <div class="panel-heading" role="tab" id="heading-<?php echo $i; ?> "> <h4 class="panel-title"> <a role="button" data-toggle="collapse" data-parent="#accordion-debug" href="#collapse-<?php echo $i; ?>
public function getDb() { return \Gbox::getConfig()->db; }
echo Html::submitButton("Iniciar sesiĆ³n", ["class" => "btn btn-primary"]); ?> </div> </div> <?php $form->end(); ?> </div> <div class="col-md-5 col-md-offset-2"> <?php $form = new Form(['method' => 'post', 'action' => URL::to('@web/account/sign-up')]); ?> <input type="hidden" name="quick_sign_up" value="1" /> <div class="panel panel-default"> <div class="panel-heading"><h3 class="panel-title"><strong>Registrarme en <?php echo Gbox::getConfig()->params['app_name']; ?> </strong></h3></div> <div class="panel-body"> <?php echo $form->field($modelSignUp, 'email')->input('email'); ?> <?php echo $form->field($modelSignUp, 'password')->input('password'); ?> <?php echo $form->field($modelSignUp, 'password_confirm')->input('password'); ?> </div> <div class="panel-footer text-right"> <?php
use Gbox\helpers\Url; use Gbox\helpers\Html; use app\widgets\Bootstrap; use Gbox\helpers\Form; ?> <div class="row"> <div class="col-md-6"> <?php echo $msg ? Bootstrap::Alert($msg, $model->hasErrors() ? 'danger' : 'success') : ''; ?> <?php $form = new Form(['method' => 'post']); ?> <?php echo Gbox::getRequest()->post('quick_sign_up') === '1' ? '<input type="hidden" name="quick_sign_up" value="1" />' : ''; ?> <div class="panel panel-default"> <div class="panel-heading"><h3 class="panel-title"><strong><?php echo $this->title; ?> </strong></h3></div> <div class="panel-body"> <p><strong>Datos personales</strong></p> <?php echo $form->field($model, 'firstname')->input('text', ['placeholder' => $model->getAttrLabel('firstname')])->label(false); ?> <?php echo $form->field($model, 'lastname')->input('text', ['placeholder' => $model->getAttrLabel('lastname')])->label(false); ?> <hr />