function log_write($data, FileDownload $file, IDownloader $downloader) { $cache = Environment::getCache("FileDownloader/log"); $log = array(); $tid = (string) $file->getTransferId(); if (!isset($cache["registry"])) { $cache["registry"] = array(); } $reg = $cache["registry"]; $reg[$tid] = true; $cache["registry"] = $reg; if (isset($cache[$tid])) { $log = $cache[$tid]; } Debugger::fireLog("Data: " . $data . "; " . $downloader->end); $data = $data . ": " . Helpers::bytes($file->transferredBytes) . " <->; "; if ($downloader instanceof AdvancedDownloader and $downloader->isInitialized()) { $data .= "position: " . Helpers::bytes($downloader->position) . "; "; //$data .= "length: ".Helpers::bytes($downloader->length)."; "; $data .= "http-range: " . Helpers::bytes($downloader->start) . "-" . Helpers::bytes($downloader->end) . "; "; $data .= "progress (con: " . round($file->transferredBytes / $downloader->end * 100) . "% X "; $data .= "file: " . round($downloader->position / $file->sourceFileSize * 100) . "%)"; } $log[] = $data; $cache[$tid] = $log; }
protected function createComponentGrid($name) { $grid = new \Gridder\Gridder($this, $name); $grid->setTranslator($this->context->translator); $persister = new \Gridder\Persisters\SessionPersister($this->getSession('gridder')); $grid->setPersister($persister); $array = array(); $start = microtime(); for ($i = 1; $i <= 2000; $i++) { $array[] = array('id' => (int) $i, 'name' => 'name' . $i); } $stop = microtime(); \Nette\Diagnostics\Debugger::fireLog($stop - $start); $dataSource = new \Gridder\Sources\ArraySource($array); $dataSource->setPrimaryKey('id'); $grid->setDataSource($dataSource); $grid->addColumn('id')->setAlias('Idecko')->setFilter('text'); $grid->addColumn('name')->setFilter('text'); /* $ac = $grid->addActionColumn('actions'); $ac->addAction('test', 'delete!'); $ac->addAction('test2', 'delete!'); $ac->addAction('test3', 'delete!'); */ /* $grid->addOperation('test', function($records){ $message = sprintf('You have selected %s records in method %s', count($records), __FUNCTION__); $type = 'ok'; return new \Gridder\Message($message, $type); })->setAlias('TEST'); $operation = new \Gridder\Operation('ohohoo'); $callback = callback($this, 'mehehe'); $operation->setAlias('BUBUBU')->setCallback($callback); $grid->addOperation($operation); * */ }
function flog($message) { Debugger::fireLog($message); }
function f($var) { \Nette\Diagnostics\Debugger::fireLog($var); }