public static function getInstance()
 {
     if (null === self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Example #2
0
 private function __construct()
 {
     $this->classloader = Classloader::getInstance();
     $this->classloader->initLoadLib();
     $this->dataConnector = DataConnector::getInstance();
     $this->routingEngine = RoutingEngine::getInstance();
     $this->templateEngine = TemplateEngine::getInstance();
 }
Example #3
0
 public static function getConnection()
 {
     if (self::$connection == null) {
         $dbConfig = Rays::app()->getDbConfig();
         self::$connection = mysql_connect($dbConfig['host'], $dbConfig['user'], $dbConfig['password']) or die(mysql_error());
         mysql_select_db($dbConfig['db_name']) or die(mysql_error());
         mysql_query("set names " . $dbConfig['charset']) or die(mysql_error());
     }
     return self::$connection;
 }
Example #4
0
 public function __construct($res, $type = false, $item_type = false, $data_type = false)
 {
     if (!$item_type) {
         $item_type = "JSONCommonDataItem";
     }
     if (!$data_type) {
         $data_type = "CommonDataProcessor";
     }
     $this->data_separator = ",\n";
     parent::__construct($res, $type, $item_type, $data_type);
 }
Example #5
0
<?php

$db = new SQLite3('../../common/testdata.sqlite');
require "../../common/connector/data_connector.php";
require "../../common/connector/db_sqlite3.php";
ConnectorSecurity::$xss = DHX_SECURITY_SAFEHTML;
$conn = new DataConnector($db, "SQLite3");
$conn->render_table("films", "id", "title,year,votes,rating,rank");
Example #6
0
<?php

session_start();
include_once "check.php";
include_once "defines.php";
include_once "ClassLibrary/Text.php";
include_once "ClassLibrary/DataConnector.php";
include_once "DataAccessObjects/ContractDAO.php";
include_once "DataTransferObjects/ContractDTO.php";
include_once "DataAccessObjects/SubContractDAO.php";
include_once "DataTransferObjects/SubContractDTO.php";
include_once "DataAccessObjects/BusinessPartnerDAO.php";
include_once "DataTransferObjects/BusinessPartnerDTO.php";
$slpCode = $_REQUEST["slpCode"];
// Abre a conexao com o banco de dados
$dataConnector = new DataConnector('both');
$dataConnector->OpenConnection();
if ($dataConnector->mysqlConnection == null || $dataConnector->sqlserverConnection == null) {
    echo 'Não foi possível se connectar ao bando de dados!';
    exit;
}
// Cria os objetos de mapeamento objeto-relacional
$contractDAO = new ContractDAO($dataConnector->mysqlConnection);
$contractDAO->showErrors = 1;
$subContractDAO = new SubContractDAO($dataConnector->mysqlConnection);
$subContractDAO->showErrors = 1;
// Busca os contratos pertencentes ao vendedor
$contractArray = $contractDAO->RetrieveRecordArray("vendedor=" . $slpCode . " AND id > 0 ORDER BY convert(numero, signed)");
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
// SOFTWARE NAME: Thematic Mapping Engine
// SOFTWARE RELEASE: 1.6
// COPYRIGHT NOTICE: Copyright (C) 2008 Bjorn Sandvik,
//                   bjorn@thematicmapping.org
// SOFTWARE LICENSE: GNU General Public License version 3 (GPLv3)
// NOTICE: >
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of version 3 of the GNU General
//  Public License as published by the Free Software Foundation.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//  GNU General Public License for more details.
//  http://www.gnu.org/licenses/
//
//
// This file shows how maps can be created with the DataConnector
// and ThematicMap classes.
// Can be changed to another data connector class
require_once 'TME_MySQL_DataConnector.php';
// Include engine class
require_once 'TME_Engine.php';
$dataConnector = new DataConnector();
$dataStore = $dataConnector->getDataStore(1230, 2005, 0);
// indicator / year / region
$parameters = array('mapType' => 'prism', 'indicator' => 1230, 'year' => 2005, 'classification' => 'equal');
// Create thematic map object
$map = new ThematicMap($dataStore, $parameters);
$file = $map->getKML();
echo "<p><a href='{$file}'>{$file}</a>";
Example #8
0
<?php

require_once "../../../common/config.php";
$data = new DataConnector($conn, $dbtype);
$data->add_section("config", '
		<columns stack="true">
			<column id="package"		header="Name"			width="200"></column>
			<column id="section"		header="Section"		width="120"></column>
			<column id="size"			header="Size"			width="80"></column>
			<column id="architecture"	header="PC"				width="60"></column>
		</columns>
		<height>100</height>
		<autowidth>true</autowidth>
	');
$data->render_table("packages_plain", "id", "package, size, architecture, section");
Example #9
0
<?php

session_start();
require_once "../codebase/connector/scheduler_connector.php";
$res = mysql_connect("localhost", "root", "");
mysql_select_db("calendar");
// $conn = new SchedulerConnector($res);
$details = new DataConnector($res);
$details->configure("cus", "c_id", "c_id,c_fname");
$conn = new SchedulerConnector($res);
$conn->mix("cus", $details, array("c_id" => "c_id"));
// function my_update($data){
//     $data->add_field("c_id",1);
//  $data->set_value("c_id","10");
//     //will be included in update processing
// }
// $conn->event->attach("beforeUpdate","my_update");
$conn->enable_log("temp.log");
$c_id = $_SESSION["login"];
$type = $_GET['type'];
$eid = $_GET['eid'];
// $conn->render_table("bookevent","event_id","start_date,end_date,event_name");
function insert_session($action)
{
    $action->add_field("cid", $_SESSION["login"]);
    $action->add_field("eid", $_GET["eid"]);
}
$conn->event->attach("beforeProcessing", "insert_session");
// $conn->event->attach("Select","select * from bookevent where c_id={c_id}");
// $conn->render_table("bookevent","event_id","start_date,end_date,event_name,cid");
// $conn->render_sql("select * from bookevent where c_id = ".$c_id." AND `start_date` >= '2015-07-08 00:00:00' AND `end_date` <= '2015-07-11 00:00:00' ","event_id","start_date,end_date,event_name,rec_type,event_pid,event_length,details,event_location,lat,lng");
Example #10
0
 /**
  * Creats table of the model like it is defined.
  * This is very usefull for the install process in your webapp.
  */
 public function createDatabaseTable()
 {
     $notFirst = false;
     $query = 'CREATE TABLE ' . $this->table . ' (';
     foreach ($this->attributes as $attribute) {
         if ($notFirst) {
             $query .= ',';
         } else {
             $notFirst = true;
         }
         $query .= $attribute[0] . ' ' . $attribute[1];
     }
     $query .= ');';
     DataConnector::getInstance()->query($query);
 }
Example #11
0
<?php

require_once "../../../common/config.php";
$data = new DataConnector($conn, $dbtype);
$data->render_table("packages_plain", "id", "package,version,maintainer");
//  modify it under the terms of version 3 of the GNU General
//  Public License as published by the Free Software Foundation.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//  GNU General Public License for more details.
//  http://www.gnu.org/licenses/
//
//
// Can be changed to another data connector class
require_once 'TME_MySQL_DataConnector.php';
// Check if a task is specified
if (isset($_REQUEST['task'])) {
    // Make connection object
    $dataConnector = new DataConnector();
    // Check which task
    switch ($_REQUEST['task']) {
        // Fetch all statistical indicators in database
        case 'indicators':
            // Returns JSON encoded array of indicators
            echo $dataConnector->getIndicators();
            break;
            // Fetch available years for one indicator
        // Fetch available years for one indicator
        case 'indYears':
            $indicatorID = (int) $_REQUEST['id'];
            // Avoid exploitation
            // Returns JSON encoded array of available years for one indicator
            echo $dataConnector->getIndicatorYears($indicatorID);
            break;
Example #13
0
<?php

require_once "../lib/DataConnector.class.php";
$myCon = new DataConnector("192.168.1.10", "8550", "rtls_user", "welcome");
$xmlRequest = new DOMDocument("1.0", "utf-8");
$xmlRequest->formatOutput  =  true;
$request = $xmlRequest->createElement("request");
$request = $xmlRequest->appendChild($request);
$params = $xmlRequest->createElement("PARAMS");
$params = $request->appendChild($params);
$params->appendChild($xmlRequest->createElement("fields", "all"));
try {
    $xmlResponse = $myCon->request($xmlRequest, "epe/pos/taglist");
    echo $xmlResponse->saveXML();
} catch (CannotConnectException $e) {
    echo $e->getMessage();
}
Example #14
0
        $ano = $colunas[0];
        $tipo = "year";
    }
    if (empty($barSize)) {
        $barSize = 5000;
    }
    if (empty($maxHeight)) {
        $maxHeight = 2000000;
    }
    $parametersTME = array('mapType' => 'bar', 'indicator' => 'valores', 'year' => $ano, 'classification' => 'quantile', 'mapTitle' => $_GET["titulo"], 'timeType' => $tipo, 'dirtmp' => $dir_tmp, 'barSize' => $barSize, 'maxHeight' => $maxHeight, 'outlinecolor' => $_GET["outlinecolor"], 'numvertices' => $_GET["numvertices"], 'symbolType' => 'polygon');
}
$nomeTemp = array_merge($_GET, $_POST);
$nomeTemp = md5(implode("", $nomeTemp));
$nomeFile = $dir_tmp . "/tme" . $nomeTemp . ".kmz";
//sesion e aberto com isso
$dataConnector = new DataConnector($_GET["sid"], $verificaSID);
if (!file_exists($nomeFile)) {
    $dataStore = $dataConnector->getDataStore($_GET["nomelayer"], $colunas, $_GET["colunanomeregiao"], $_GET["titulo"], $_GET["descricao"], "", $parametersTME["mapType"]);
} else {
    $dataStore = "";
}
$url = $_SESSION["tmpurl"] . "/tme" . $nomeTemp . ".kmz";
// Create thematic map object
$map = new ThematicMap($dataStore, $parametersTME, $nomeTemp);
$file = $map->getKML($dataConnector->url, $download, $nomeFile);
$nomeArquivo = $map->nomeArquivo;
$legenda = str_replace("kmz", "png", basename($nomeArquivo));
$legenda = str_replace("tme", "legend", $legenda);
$legenda = str_replace(basename($nomeArquivo), $legenda, $file);
if (isset($inclusao) && $inclusao == true) {
    $download = true;
Example #15
0
 protected function parse_request()
 {
     parent::parse_request();
     if (isset($_GET[$this->parent_name])) {
         $this->request->set_relation($_GET[$this->parent_name]);
     } else {
         $this->request->set_relation("0");
     }
     $this->request->set_limit(0, 0);
     //netralize default reaction on dyn. loading mode
 }
Example #16
0
 private function logToDatabase($msg, $type)
 {
     DataConnector::getInstance()->query("INSERT INTO log (id,time,type,message,url) VALUES  (NULL,NOW(),{$type},{$msg}," . $_SERVER['REQUEST_URI'] . ")");
 }
<?php

session_start();
include_once "../check.php";
include_once "../defines.php";
include_once "../ClassLibrary/DataConnector.php";
include_once "../DataTransferObjects/ContractBonusDTO.php";
include_once "../DataAccessObjects/ContractBonusDAO.php";
include_once "../DataTransferObjects/CounterDTO.php";
include_once "../DataAccessObjects/CounterDAO.php";
$subContractId = 0;
if (isset($_REQUEST["subContractId"]) && $_REQUEST["subContractId"] != 0) {
    $subContractId = $_REQUEST["subContractId"];
}
// Abre a conexao com o banco de dados
$dataConnector = new DataConnector('mySql');
$dataConnector->OpenConnection();
if ($dataConnector->mysqlConnection == null) {
    echo 'Não foi possível se connectar ao bando de dados!';
    exit;
}
$nivelAutorizacao = GetAuthorizationLevel($dataConnector->mysqlConnection, $functionalities["gerenciamentoContratos"]);
if ($nivelAutorizacao <= 1) {
    DisplayNotAuthorizedWarning();
    exit;
}
// Cria os objetos de mapeamento objeto-relacional
$contractBonusDAO = new ContractBonusDAO($dataConnector->mysqlConnection);
$contractBonusDAO->showErrors = 1;
$counterDAO = new CounterDAO($dataConnector->mysqlConnection);
$counterDAO->showErrors = 1;
Example #18
0
 public static function executeSQL($sql)
 {
     DataConnector::getConnection();
     mysql_query($sql) or die(mysql_error());
 }