/** * @covers Fabfuel\Prophiler\Toolbar::__construct * @covers Fabfuel\Prophiler\Toolbar::render * @uses Fabfuel\Prophiler\Toolbar * @uses Fabfuel\Prophiler\Iterator\ComponentFilteredIterator * @uses Fabfuel\Prophiler\Toolbar\Formatter\TimelineFormatter */ public function testRender() { $profiler = $this->getMock('Fabfuel\\Prophiler\\ProfilerInterface'); $profiler->expects($this->exactly(2))->method('getDuration')->willReturn(1); $toolbar = new Toolbar($profiler); $output = $toolbar->render(); $this->assertRegExp('/1000 ms/', $output); }
/** * Display module contents * * @return void */ public function display() { if (!\App::isAdmin()) { return; } // Get the toolbar. $toolbar = \Toolbar::render('toolbar'); // Get the view require $this->getLayoutPath($this->params->get('layout', 'default')); }
/** * @covers Fabfuel\Prophiler\Toolbar::__construct * @covers Fabfuel\Prophiler\Toolbar::render * @uses Fabfuel\Prophiler\Toolbar * @uses Fabfuel\Prophiler\Iterator\ComponentFilteredIterator * @uses Fabfuel\Prophiler\Toolbar\Formatter\TimelineFormatter */ public function testRender() { $profiler = $this->getMockBuilder('Fabfuel\\Prophiler\\Profiler')->disableOriginalConstructor()->getMock(); $profiler->expects($this->exactly(2))->method('getDuration')->willReturn(100); $toolbar = new Toolbar($profiler); $dispatcher = $this->getMockBuilder('Phalcon\\Mvc\\Dispatcher')->getMock(); $toolbar->dispatcher = $dispatcher; $output = $toolbar->render(); $this->assertNotEmpty($output); }
public function render() { if (count($this->listFields) > 0) { $fieldNames = $this->listFields; } else { $fieldNames = $this->getDefaultFieldNames(); } foreach ($fieldNames as $i => $fieldName) { $fieldNames[$i] = substr($fieldName, 0, 1) == "." ? $this->redirectedPackage . $fieldName : $fieldName; } $this->setupList(); $params["fields"] = $fieldNames; $params["page"] = 0; $params["sort_field"] = array(array("field" => end(explode('.', reset($fieldNames))), "type" => "DESC")); $params['hardConditions'] = $this->listConditions; $this->table->setParams($params); return $this->toolbar->render() . $this->table->render(); }
/** * Default controller action. This is the default action which is executed * when no action is specified for a given call. * @see lib/controllers/Controller::getContents() */ public function getContents() { if (count($this->listFields) > 0) { $fieldNames = $this->listFields; } else { if ($this->app != null) { $fieldNames = $this->app->xpath("/app:app/app:list/app:field"); $concatenatedLabels = $this->app->xpath("/app:app/app:list/app:field/@label"); } else { $fieldNames = array(); $keyField = $this->model->getKeyField(); $fieldNames[$keyField] = "{$this->model->package}.{$keyField}"; $fields = $this->model->getFields(); foreach ($fields as $i => $field) { if ($field["reference"] == "") { $fieldNames[$i] = $this->model->package . "." . $field["name"]; } else { $modelInfo = Model::resolvePath($field["reference"]); $fieldNames[$i] = $modelInfo["model"] . "." . $field["referenceValue"]; } } } } foreach ($fieldNames as $i => $fieldName) { $fieldNames[$i] = substr((string) $fieldName, 0, 1) == "." ? $this->redirectedPackage . (string) $fieldName : (string) $fieldName; } if (count($this->fieldNames) > 0) { $fieldNames = $this->fieldNames; } if ($this->apiMode === false) { $this->setupList(); $params["fields"] = $fieldNames; $params["page"] = 0; $params["sort_field"] = array(array("field" => $this->model->database . "." . $this->model->getKeyField(), "type" => "DESC")); $this->table->setParams($params); $return = '<div id="table-wrapper">' . $this->toolbar->render() . $this->table->render() . '</div>'; } else { $params["fields"] = $fieldNames; $params["page"] = 0; $params["sort_field"] = array(array("field" => $this->model->database . "." . $this->model->getKeyField(), "type" => "DESC")); $return = json_encode(SQLDBDataStore::getMulti($params)); } return $return; }
<?php defined('_EXE') or die('Restricted access'); ?> <?php Toolbar::addTitle("Parrilla", "glyphicon-star"); //Export button Toolbar::addButton(array("title" => "Exportar", "app" => "parrilla", "action" => "export", "class" => "primary", "spanClass" => "share-alt", "noAjax" => true)); Toolbar::render(); ?> <form method="post" name="mainForm" id="mainForm" action="<?php echo Url::site(); ?> " class="form-horizontal" role="form" autocomplete="off"> <input type="hidden" name="app" id="app" value="parrilla"> <input type="hidden" name="action" id="action" value="export"> <div class="form-group"> <label for="fecha" class="col-sm-2 control-label"> Fecha </label> <div class="col-sm-3"> <input type="text" name="fecha" class="form-control" id="fecha" value="<?php echo date("d-m-Y"); ?> " placeholder="Fecha"> </div> <div class="col-sm-3"> <input type="text" name="hour" class="form-control hourMask" id="hour" value="07:00" placeholder="Hora">