예제 #1
0
파일: Application.php 프로젝트: dgilan/test
 /**
  * Injects particular page content into the main layout and sends it as response
  *
  * @param string $content
  */
 private static function _sendResponse($content)
 {
     $renderer = new Renderer(APP_PATH . '/layout.html.php');
     $renderer->assign(array('content' => $content, 'user' => Token::getUser(), 'route' => Router::getInstance()->getRoute()));
     $response = $renderer->render();
     Connection::getInstance()->disconnect();
     echo $response;
     Token::set('flush', null);
     exit;
 }
예제 #2
0
<?php

/**
 * Database Configuration
 */
use Kernel\Database\Connection;
/**
 * Here you can specify multiple database
 * connections by giving an alias.
 *
 * first param is the alias for the connection instance
 * second param is an array of connection parameters
 */
Connection::parameters('conn1', ['driver' => 'mysql', 'hostname' => 'localhost', 'database' => 'strife', 'username' => 'root', 'password' => '', 'charset' => 'utf8', 'port' => 3306]);
/**
 * Begin Transaction with database
 */
//Connection::initialize('conn1');
예제 #3
0
 /**
  * Updates item
  */
 public function update()
 {
     $this->_beforeUpdate();
     $id = isset($this->_fields['id']) ? $this->_fields['id'] : $this->getItem()->id;
     unset($this->_fields['id']);
     $values = array();
     foreach ($this->_fields as $key => $value) {
         array_push($values, "{$key}='{$value}'");
     }
     $set = implode(',', $values);
     $query = 'UPDATE ' . $this->getTable() . " SET {$set} WHERE id='{$id}'";
     Connection::getInstance()->execute($query);
 }