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]); }
public function __construct($context = null) { $this->setContextIfNull($context); $request = \Gbox::getRequest(); // $this->controller = strtolower($request->getController()); $this->controller = strtolower(preg_replace('/([A-Z]+)/', "-\$1", lcfirst($request->getController()))); }
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 __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; ?>
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 />