Esempio n. 1
0
 /**
  * Renders view for given action and layout. If $file is given, that is used
  * for a view filename (e.g. customFunkyView.ctp).
  * Adds timers, for all subsequent rendering, and injects the debugKit toolbar.
  *
  * @param string $action Name of action to render for
  * @param string $layout Layout to use
  * @param string $file Custom filename for view
  * @return string Rendered Element
  */
 function render($action = null, $layout = null, $file = null)
 {
     DebugKitDebugger::startTimer('viewRender', __('Rendering View', true));
     $out = parent::render($action, $layout, $file);
     DebugKitDebugger::stopTimer('viewRender');
     DebugKitDebugger::stopTimer('controllerRender');
     if (isset($this->loaded['toolbar'])) {
         $this->loaded['toolbar']->postRender();
     }
     //Temporary work around to hide the SQL dump at page bottom
     Configure::write('debug', 0);
     return $this->output;
 }
Esempio n. 2
0
 /**
  * Renders view for given action and layout. If $file is given, that is used
  * for a view filename (e.g. customFunkyView.ctp).
  * Adds timers, for all subsequent rendering, and injects the debugKit toolbar.
  *
  * @param string $action Name of action to render for
  * @param string $layout Layout to use
  * @param string $file Custom filename for view
  * @return string Rendered Element
  */
 function render($action = null, $layout = null, $file = null)
 {
     DebugKitDebugger::startTimer('viewRender', __d('debug_kit', 'Rendering View', true));
     $out = parent::render($action, $layout, $file);
     DebugKitDebugger::stopTimer('viewRender');
     DebugKitDebugger::stopTimer('controllerRender');
     DebugKitDebugger::setMemoryPoint(__d('debug_kit', 'View render complete', true));
     if (empty($this->params['requested']) && isset($this->loaded['toolbar'])) {
         $backend = $this->loaded['toolbar']->getName();
         $this->loaded['toolbar']->{$backend}->send();
     }
     if (empty($this->output)) {
         return $out;
     }
     return $this->output;
 }
Esempio n. 3
0
 /**
  * Renders view for given action and layout. If $file is given, that is used
  * for a view filename (e.g. customFunkyView.ctp).
  * Adds timers, for all subsequent rendering, and injects the debugKit toolbar.
  *
  * @param string $action Name of action to render for
  * @param string $layout Layout to use
  * @param string $file Custom filename for view
  * @return string Rendered Element
  */
 function render($action = null, $layout = null, $file = null)
 {
     DebugKitDebugger::startTimer('viewRender', __d('debug_kit', 'Rendering View', true));
     $out = parent::render($action, $layout, $file);
     DebugKitDebugger::stopTimer('viewRender');
     DebugKitDebugger::stopTimer('controllerRender');
     DebugKitDebugger::setMemoryPoint(__d('debug_kit', 'View render complete', true));
     if (isset($this->loaded['toolbar'])) {
         $backend = $this->loaded['toolbar']->getName();
         $this->loaded['toolbar']->{$backend}->send();
     }
     if (empty($this->output)) {
         return $out;
     }
     //Temporary work around to hide the SQL dump at page bottom
     Configure::write('debug', 0);
     return $this->output;
 }
 /**
  * afterSave, stop the timer started from a save.
  *
  * @param string $Model
  * @param string $created
  * @return void
  */
 public function afterSave(Model $Model, $created)
 {
     DebugKitDebugger::stopTimer($Model->alias . '_save');
     return true;
 }
 /**
  * test getting all the set timers.
  *
  * @return void
  **/
 function testGetTimers()
 {
     DebugKitDebugger::startTimer('test1', 'this is my first test');
     DebugKitDebugger::stopTimer('test1');
     usleep(50);
     DebugKitDebugger::startTimer('test2');
     DebugKitDebugger::stopTimer('test2');
     $timers = DebugKitDebugger::getTimers();
     $this->assertEqual(count($timers), 3);
     $this->assertTrue(is_float($timers['test1']['time']));
     $this->assertTrue(isset($timers['test1']['message']));
     $this->assertTrue(isset($timers['test2']['message']));
 }
Esempio n. 6
0
 /**
  * Queries the datasource and returns a result set array.
  *
  * @param string $type Type of find operation (all / first / count / neighbors / list / threaded)
  * @param array $query Option fields (conditions / fields / joins / limit / offset / order / page / group / callbacks)
  * @return array Array of records
  * @link http://book.cakephp.org/2.0/en/models/deleting-data.html#deleteall
  */
 public function find($type = 'first', $query = array())
 {
     DebugKitDebugger::startTimer($this->name . '::find(' . $type . ')');
     $results = parent::find($type, $query);
     DebugKitDebugger::stopTimer($this->name . '::find(' . $type . ')');
     return $results;
 }
Esempio n. 7
0
 /**
  * beforeRender callback
  *
  * Calls beforeRender on all the panels and set the aggregate to the controller.
  *
  * @return void
  **/
 function beforeRender(&$controller)
 {
     DebugKitDebugger::stopTimer('controllerAction');
     $vars = array();
     $panels = array_keys($this->panels);
     foreach ($panels as $panelName) {
         $panel =& $this->panels[$panelName];
         $vars[$panelName]['content'] = $panel->beforeRender($controller);
         $elementName = Inflector::underscore($panelName) . '_panel';
         if (isset($panel->elementName)) {
             $elementName = $panel->elementName;
         }
         $vars[$panelName]['elementName'] = $elementName;
         $vars[$panelName]['plugin'] = $panel->plugin;
         $vars[$panelName]['disableTimer'] = true;
     }
     $controller->set(array('debugToolbarPanels' => $vars, 'debugToolbarJavascript' => $this->javascript));
     DebugKitDebugger::startTimer('controllerRender', __('Render Controller Action', true));
 }
Esempio n. 8
0
 /**
  * beforeRender callback
  *
  * Calls beforeRender on all the panels and set the aggregate to the controller.
  *
  * @return void
  **/
 function beforeRender(&$controller)
 {
     DebugKitDebugger::stopTimer('controllerAction');
     $vars = $this->_gatherVars($controller);
     $this->_saveState($controller, $vars);
     $controller->set(array('debugToolbarPanels' => $vars, 'debugToolbarJavascript' => $this->javascript));
     DebugKitDebugger::startTimer('controllerRender', __d('debug_kit', 'Render Controller Action', true));
     DebugKitDebugger::setMemoryPoint(__d('debug_kit', 'Controller render start', true));
 }
/**
 * beforeRender callback
 *
 * Calls beforeRender on all the panels and set the aggregate to the controller.
 *
 * @return void
 **/
	public function beforeRender($controller) {
		if (!class_exists('DebugKitDebugger')) {
			return null;
		}
		DebugKitDebugger::stopTimer('controllerAction');
		$vars = $this->_gatherVars($controller);
		$this->_saveState($controller, $vars);

		$controller->set(array('debugToolbarPanels' => $vars, 'debugToolbarJavascript' => $this->javascript));
		DebugKitDebugger::startTimer('controllerRender', __d('debug_kit', 'Render Controller Action'));
		DebugKitDebugger::setMemoryPoint(__d('debug_kit', 'Controller render start'));
	}
Esempio n. 10
0
/**
 * Renders view for given action and layout.
 * Adds timers, for all subsequent rendering, and injects the debugKit toolbar.
 *
 * @param string $action Name of action to render for
 * @param string $layout Layout to use
 * @return string Rendered Element
 */
	public function render($action = null, $layout = null) {
		DebugKitDebugger::startTimer('viewRender', __d('debug_kit', 'Rendering View'));

		$out = parent::render($action, $layout);

		DebugKitDebugger::stopTimer('viewRender');
		DebugKitDebugger::stopTimer('controllerRender');
		DebugKitDebugger::setMemoryPoint(__d('debug_kit', 'View render complete'));

		if (empty($this->request->params['requested']) && $this->Helpers->attached('Toolbar')) {
			$backend = $this->Helpers->Toolbar->getName();
			$this->Helpers->Toolbar->{$backend}->send();
		}
		if (empty($this->output)) {
			return $out;
		}
		return $this->output;
	}