public function printStruct(IOutputStream $aDevice = null, $nDepth = 0) { if (!$aDevice) { $aDevice = Response::singleton()->printer(); } $aDevice->write(str_repeat("\t", $nDepth) . $this->summary() . "\r\n"); foreach ($this->iterator() as $aChild) { $aChild->printStruct($aDevice, $nDepth + 1); } }
public function render(File $aCompiledFile, IHashTable $aVariables = null, IOutputStream $aDevice = null, $bPreProcess = true, $bRendering = true) { if (!$aVariables) { $aVariables = $this->variables(); } if (!$aDevice) { $aDevice = $this->outputStream(); if (!$aDevice) { $aDevice = Response::singleton()->printer(); } } // 模板变量 $aRequest = Request::singleton(); if (!$aVariables->has('theRequest')) { $aVariables->set('theRequest', $aRequest); } if (!$aVariables->has('theParams')) { $aVariables->set('theParams', Request::singleton()); } $aVariables->set('theDevice', $aDevice); $aVariables->set('theUI', $this); include $aCompiledFile->path(); }
/** * @return org\jecat\framework\mvc\controller\Response */ public function response() { if (!$this->aResponse) { // 补充缺省的 frame 配置 if (empty($this->arrBeanConfig['rspn'])) { $this->aResponse = Response::singleton(); } else { if (!empty($this->arrBeanConfig['rspn']['class'])) { $this->arrBeanConfig['rspn']['class'] = 'org\\jecat\\framework\\mvc\\controller\\Response'; $this->aResponse = BeanFactory::singleton()->createBean($this->arrBeanConfig['rspn'], '*', false); } } } return $this->aResponse; }
public function createResponse(Application $aApp) { $aRespn = new Response($this->createResponseDevice()); $aRespn->setFilters(StdOutputFilterMgr::singleton()); return $aRespn; }
public function printStruct(IOutputStream $aOutput = null, $nDepth = 0) { if (!$aOutput) { $aOutput = Response::singleton()->printer(); } $aOutput->write("<pre>\r\n"); $sIndent = str_repeat("\t", $nDepth); $aOutput->write($sIndent . "--- VIEW ---\r\n"); $aOutput->write($sIndent . "\tname:\t" . $this->name() . "\r\n"); $aOutput->write($sIndent . "\tid:\t\t" . $this->id() . "\r\n"); $aOutput->write($sIndent . "\tclass:\t" . get_class($this) . "\r\n"); $aOutput->write($sIndent . "\ttpl:\t" . $this->template() . "\r\n"); $aOutput->write($sIndent . "\thash:\t" . spl_object_hash($this) . "\r\n"); if ($this->count()) { foreach ($this->nameIterator() as $aChildName) { $aOutput->write("{$sIndent}\tchild:\"{$aChildName}\" => "); if ($aChild = $this->getByName($aChildName)) { $aChild->printStruct($aOutput, $nDepth + 1); } else { $aOutput->write("<miss>\r\n"); } } } $aOutput->write("\r\n</pre>"); }
public function printStruct(IOutputStream $aOutput = null, $nDepth = 0) { if (!$aOutput) { $aOutput = Response::singleton()->printer(); } $aOutput->write("<pre>\r\n"); $aOutput->write(str_repeat("\t", $nDepth)); $aOutput->write($this->isList() ? "[Model List]" : "[Model]"); $aOutput->write("\r\n"); if (!empty($this->arrDatas)) { foreach ($this->arrDatas as $sName => $value) { $aOutput->write(str_repeat("\t", $nDepth) . "{$sName}: " . strval($value) . "\r\n"); } } foreach ($this->childNameIterator() as $sName) { $aOutput->write(str_repeat("\t", $nDepth) . "\"{$sName}\" =>\r\n"); $this->child($sName)->printStruct($aOutput, $nDepth + 1); } $aOutput->write("</pre>"); }
/** * @wiki /数据库/数据库调试 * * 每次调用 org\jecat\framework\db\DB::query() 或 DB::execute() 函数后,执行的sql都会记录在 DB 对像中, * 通过 DB::executeLog() 函数打印这些记录。 * * [example lang="php"] * // 打印数据库执行日志 * DB::singleton()->executeLog() ; * [/example] * * 如果 executeLog() 的参数为 false , 则返回一个包含sql执行日志的数组,并且不会打印到浏览器中。 * [example lang="php"] * // 取得数据库执行日志,不会立刻输出到浏览器 * $arrSqlLog = DB::singleton()->executeLog(false) ; * [/example] * */ public function executeLog($bPrint = true) { if ($bPrint) { Response::singleton()->printer()->write("<pre>\r\n" . print_r($this->arrExecuteLog, true) . "\r\n</pre>"); } else { return $this->arrExecuteLog; } }
public function printStruct(IOutputStream $aOutput = null, $nDepth = 0, $sDisplayTitle = null) { if (!$aOutput) { $aOutput = Response::singleton()->printer(); } $aOutput->write("<pre>\r\n\r\n"); $aOutput->write(str_repeat("\t", $nDepth)); if ($sDisplayTitle === null) { $sDisplayTitle = "<b>[Model] " . $this->name() . '</b>'; } $aOutput->write($sDisplayTitle . "\r\n"); // 数据 $this->printStructData($aOutput, $nDepth); // 子模型 $this->printStructChildren($aOutput, $nDepth); $aOutput->write("</pre>"); return; }