function actualizarPassword($newpassword, $token) { $conex = DataBase::getInstance(); $stid = oci_parse($conex, "UPDATE FISC_USERS SET \n\t\t\t\t\t\tpassword=:newpassword\n\t\t\t\t WHERE token=:token"); if (!$stid) { oci_free_statement($stid); oci_close($conex); return false; } // Realizar la lógica de la consulta oci_bind_by_name($stid, ':token', $token); oci_bind_by_name($stid, ':newpassword', $newpassword); $r = oci_execute($stid, OCI_NO_AUTO_COMMIT); if (!$r) { oci_free_statement($stid); oci_close($conex); return false; } $r = oci_commit($conex); if (!$r) { oci_free_statement($stid); oci_close($conex); return false; } oci_free_statement($stid); // Cierra la conexión Oracle oci_close($conex); return true; }
public function delete($id) { $db = DataBase::getInstance(); $conn = $db->conn; $query = "DELETE from " . static::$table . " WHERE " . static::$key . "={$id}"; return $conn->exec($query); }
function __construct($path) { $this->ruta = $path; include_once "class.db.php"; include_once $this->ruta . "inc/clases/class.pac.php"; $this->conexion = DataBase::getInstance(); }
public function getById($id) { $this->conex = DataBase::getInstance(); $stid = oci_parse($this->conex, "SELECT *\n\t\t\tFROM FISC_CIUDADANO WHERE ID_CIUDADANO=:id"); if (!$stid) { $e = oci_error($this->conex); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); } // Realizar la lógica de la consulta oci_bind_by_name($stid, ':id', $id); $r = oci_execute($stid); if (!$r) { $e = oci_error($stid); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); } // Obtener los resultados de la consulta $alm = new FiscCiudadano(); while ($fila = oci_fetch_array($stid, OCI_ASSOC + OCI_RETURN_NULLS)) { $it = new ArrayIterator($fila); while ($it->valid()) { $alm->__SET(strtolower($it->key()), $it->current()); $it->next(); } } //Libera los recursos oci_free_statement($stid); // Cierra la conexión Oracle oci_close($this->conex); //retorna el resultado de la consulta return $alm; }
public function __construct() { try { $this->pdo = DataBase::getInstance(); } catch (Exception $e) { die($e->getMessage()); } }
function __construct($path) { $this->ruta = $path; include_once "class.dbremota.php"; include_once "class.db.php"; include_once $this->ruta . "inc/clases/class.leercfdi.php"; $this->conexion = DataBaseRemota::getInstance(); $this->conexion_local = DataBase::getInstance(); }
public static function getUserFromDatabase($i_UserID) { // @var Database $dataBase = DataBase::getInstance(); $tableName = $dataBase->getTableForPersonID($i_UserID); $className = $dataBase->getClassNameForTable($tableName); $returnVal = $dataBase->getObjectForClass("ID = " . $i_UserID, $tableName, $className); return $returnVal; }
/** * Connects to the database * * @access private * @return bool */ private function _connect() { try { self::$_dataBase = DataBase::getInstance(); return true; } catch (Exception $ex) { trigger_error("Error: ActiveRecord can't get a DataBase instance, please check database configuration in config.xml", E_USER_ERROR); return false; } }
protected function adapterSourceObject() { if (strtoupper($this->source) == 'DB') { $this->db = DataBase::getInstance(); } else { if (strtoupper($this->source) == 'REDIS') { $this->db = Redis::getInstance(); } } }
function __construct() { /** * Object of Registry class * @var Registry $registry */ $registry = Registry::getInstance(); $this->db = DataBase::getInstance(); $this->db_config = $registry->getValue('db_config'); $this->sessionEngineObj = SessionEngine::getInstance(); }
function __construct() { /* * Object of Settings class * * @var Settings * */ $settings = Settings::getInstance(); $this->db = DataBase::getInstance(); $this->db_config = $settings->getDBConfig(); }
public function get($courriel) { $cnx = DataBase::getInstance(); $pstmt = $cnx->prepare("SELECT * FROM user WHERE courriel = :c"); $pstmt->execute(array('c' => $courriel)); $result = $pstmt->fetch(PDO::FETCH_OBJ); if ($result) { $u = new User(); $u->loadFromObject($result); $pstmt->closeCursor(); DataBase::close(); return $u; } $pstmt->closeCursor(); DataBase::close(); return NULL; }
public function findAll() { $liste = array(); $cnx = DataBase::getInstance(); $pstmt = $cnx->prepare("SELECT * FROM alerts ORDER BY active=1 DESC"); $pstmt->execute(); while ($result = $pstmt->fetch(PDO::FETCH_OBJ)) { $p = new Alert(); $p->setId($result->id); $p->setTitle($result->title); $p->setText($result->text); $p->setDate($result->date); $p->setActive($result->active); array_push($liste, $p); } $pstmt->closeCursor(); DataBase::close(); return $liste; }
public function getproductDetails($pdtid) { $post = new \Modules\Blog\Models\Post(); //$this->render->view('Modules.Blog.Views.index',array('a'=>'This is A','b'=>'This is B')); $this->render->addJS('a.js'); $this->render->addCSS('a.css'); $this->render->addCSS('css/default.css'); $this->render->with("title", "This is New Title"); $this->render->alam = "This is Alam"; $this->render->template('Modules.Blog.Views.index', array('a' => 'This is A', 'b' => 'This is B')); exit; //echo View::test(); //$post->id=26; //$post->title="asdasdasd"; //$post->save(); //$post->delete(array(7,8,9)); // $post->id=26; // $post->title="This is Koushik Post Modified"; // $post->save(); // echo $post; //print_r($post->select('*')->where('id','>',5)->andWhere('id','<',8)->first()); // $post->title="First Post"; // $post->save(); // echo $post->id; $db = DataBase::getInstance(); $db->setQuery("Select a from test")->query(); //$db2=DataBase::getInstance(); //$db2->setQuery("INSERT INTO `users`(`username`,`password`) VALUES('bisu','33333')")->query(); //print_r($db2->getQueries()); // //echo baseURL; // echo Config::get('database.default','test'); // echo '<hr>'; // Config::set('database.default','bisu'); // Config::set('database.mysql.passwordp','rootwdp'); // echo '<hr>'; // echo Config::get('database.default','test'); // echo '<hr>'; echo "You want to see the details od {$pdtid}"; }
/** * * **/ public function agregar(&$jefe) { $this->conex = DataBase::getInstance(); $consulta = "INSERT INTO FISC_JEFE_OFICINA (\n\t\t\tid_jefe,\n\t\t\tnacionalidad,\n\t\t\tprimer_nombre,\n\t\t\tsegundo_nombre,\n\t\t\tprimer_apellido ,\n\t\t\tsegundo_apellido,\n\t\t\ttratamineto_protocolar,\n\t\t\tnumero_resolucion,\n\t\t\tfecha_resolucion\n \t\t)\n\t\t\tvalues\n\t\t\t(\n\t\t\t\t:id_jefe,\n\t\t\t\t:nacionalidad,\n\t\t\t\t:primer_nombre,\n\t\t\t\t:segundo_nombre\n\t\t\t\t:primer_apellido\n\t\t\t\t:segundo_apellido\n\t\t\t\t:tratamineto_protocolar,\n\t\t\t\t:numero_resolucion,\n\t\t\t\t:fecha_resolucion\n\t\t\t)"; foreach ($jefes as $jefe) { $stid = oci_parse($this->conex, $consulta); if (!$stid) { echo "Desde el parse 3"; $e = oci_error($this->conex); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); oci_rollback($this->conex); //$error = true; //self::eliminar($id_den); //$e = oci_error($this->conex); //trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); //Libera los recursos oci_free_statement($stid); // Cierra la conexión Oracle oci_close($this->conex); return false; } $id_jefe = $jefe->__GET('id_jefe'); $nacionalidad = $jefe->__GET('nacionalidad'); $primer_nombre = $jefe->__GET('primer_nombre'); $segundo_nombre = $jefe->__GET('segundo_nombre'); $primer_apellido = $jefe->__GET('primer_apellido'); $segundo_apellido = $jefe->__GET('segundo_apellido'); $tratamineto_protocolar = $jefe->__GET('tratamineto_protocolar'); $numero_resolucion = $jefe->__GET('numero_resolucion'); $fecha_resolucion = $jefe->__GET('fecha_resolucion'); // Realizar la lógica de la consulta oci_bind_by_name($stid, ':id_jefe', $id_jefe); oci_bind_by_name($stid, ':nacionalidad', $nacionalidad); oci_bind_by_name($stid, ':primer_nombre', $primer_nombre); oci_bind_by_name($stid, ':segundo_nombre', $segundo_nombre); oci_bind_by_name($stid, ':primer_apellido', $primer_apellido); oci_bind_by_name($stid, ':segundo_apellido', $segundo_apellido); oci_bind_by_name($stid, ':tratamineto_protocolar', $tratamineto_protocolar); oci_bind_by_name($stid, ':numero_resolucion', $numero_resolucion); oci_bind_by_name($stid, ':fecha_resolucion', $fecha_resolucion); $r = oci_execute($stid, OCI_NO_AUTO_COMMIT); if (!$r) { echo "Desde el execute 3"; $e = oci_error($this->conex); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); //$error = true; //self::eliminar($id_den); oci_rollback($this->conex); //$e = oci_error($stid); //trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); //Libera los recursos oci_free_statement($stid); // Cierra la conexión Oracle oci_close($this->conex); return false; } } //END FOREACH $r = oci_commit($this->conex); if (!$r) { oci_free_statement($stid); oci_close($this->conex); return false; } oci_free_statement($stid); // Cierra la conexión Oracle oci_close($this->conex); return true; }
function __construct() { include_once "class.db.php"; $this->conexion = DataBase::getInstance(); }
/** * * **/ public function agregar(&$oficina, &$jefe) { $this->conex = DataBase::getInstance(); /****************INSERTAR EN LA TABLA OFICINA_ADMINISTRATIVA************************/ $consulta = "INSERT INTO FISC_OFICINA_ADMINISTRATIVA (\n\t\t\tid_oficina,\n\t\t\tid_region,\n\t\t\tid_estado,\n\t\t\tid_jefe,\n\t\t\tsiglas,\n\t\t\tnombre,\n\t\t\tdireccion\n\t\t\t)\nvalues\n(\n\t:id_oficina,\n\t:id_region,\n\t:id_estado,\n\t:id_jefe,\n\t:siglas,\n\t:nombre,\n\t:direccion\n\t)"; $stid = oci_parse($this->conex, $consulta); if (!$stid) { echo "Desde el parse 3"; $e = oci_error($this->conex); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); oci_rollback($this->conex); //$error = true; //self::eliminar($id_den); //$e = oci_error($this->conex); //trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); //Libera los recursos oci_free_statement($stid); // Cierra la conexión Oracle oci_close($this->conex); return false; } $id_oficina = $oficina->__GET('id_oficina'); $id_region = $oficina->__GET('id_region'); $id_estado = $oficina->__GET('id_estado'); $id_jefe = $oficina->__GET('id_jefe'); $siglas = $oficina->__GET('siglas'); $nombre = $oficina->__GET('nombre'); $direccion = $oficina->__GET('direccion'); oci_bind_by_name($stid, ':id_oficina', $id_oficina); oci_bind_by_name($stid, ':id_region', $id_region); oci_bind_by_name($stid, ':id_estado', $id_estado); oci_bind_by_name($stid, ':id_jefe', $id_jefe); oci_bind_by_name($stid, ':siglas', $siglas); oci_bind_by_name($stid, ':nombre', $nombre); oci_bind_by_name($stid, ':direccion', $direccion); $r = oci_execute($stid, OCI_NO_AUTO_COMMIT); if (!$r) { echo "Desde el execute 3"; $e = oci_error($this->conex); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); //$error = true; //self::eliminar($id_den); oci_rollback($this->conex); //$e = oci_error($stid); //trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); //Libera los recursos oci_free_statement($stid); // Cierra la conexión Oracle oci_close($this->conex); return false; } /**************** FIN INSERTAR EN LA TABLA OFICINA_ADMINISTRATIVA************************/ /**************** CONSULTAR JEFE_OFICINA************************/ $stid_jefe = oci_parse($this->conex, "SELECT * FROM FISC_JEFE_OFICINA WHERE ID_JEFE = :id"); if (!$stid_jefe) { $e = oci_error($this->conex); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); } // Realizar la lógica de la consulta oci_bind_by_name($stid_jefe, ':id', $id_jefe); $r = oci_execute($stid_jefe); if (!$r) { $e = oci_error($stid_jefe); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); } // Obtener los resultados de la consulta $result_jefe = oci_fetch_array($stid_jefe, OCI_ASSOC + OCI_RETURN_NULLS); //Libera los recursos oci_free_statement($stid_jefe); // Cierra la conexión Oracle //retorna el resultado de la consulta /**************** CONSULTAR JEFE_OFICINA************************/ if ($result_jefe == false) { /**************** INSERTAR EN LA TABLA JEFE_OFICINA************************/ $consulta = "INSERT INTO FISC_JEFE_OFICINA (\n\t\tID_JEFE,\n\t\tNACIONALIDAD,\n\t\tPRIMER_NOMBRE,\n\t\tSEGUNDO_NOMBRE,\n\t\tPRIMER_APELLIDO,\n\t\tSEGUNDO_APELLIDO,\n\t\tTRATAMIENTO_PROTOCOLAR,\n\t\tNUMERO_RESOLUCION,\n\t\tFECHA_RESOLUCION\n\t\t)\nvalues\n(\n\t:id_jefe,\n\t:nacionalidad,\n\t:primer_nombre,\n\t:segundo_nombre,\n\t:primer_apellido,\n\t:segundo_apellido,\n\t:tratamiento_protocolar,\n\t:numero_resolucion,\n\t:fecha_resolucion\n\t)"; $stid = oci_parse($this->conex, $consulta); if (!$stid) { echo "Desde el parse 3"; $e = oci_error($this->conex); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); oci_rollback($this->conex); //$error = true; //self::eliminar($id_den); //$e = oci_error($this->conex); //trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); //Libera los recursos oci_free_statement($stid); // Cierra la conexión Oracle oci_close($this->conex); return false; } $id_jefe = $jefe->__GET('id_jefe'); $nacionalidad = $jefe->__GET('nacionalidad'); $primer_nombre = $jefe->__GET('primer_nombre'); $segundo_nombre = $jefe->__GET('segundo_nombre'); $primer_apellido = $jefe->__GET('primer_apellido'); $segundo_apellido = $jefe->__GET('segundo_apellido'); $tratamiento_protocolar = $jefe->__GET('tratamineto_protocolar'); $numero_resolucion = $jefe->__GET('numero_resolucion'); $fecha_resolucion = $jefe->__GET('fecha_resolucion'); oci_bind_by_name($stid, ':id_jefe', $id_jefe); oci_bind_by_name($stid, ':nacionalidad', $nacionalidad); oci_bind_by_name($stid, ':primer_nombre', $primer_nombre); oci_bind_by_name($stid, ':segundo_nombre', $segundo_nombre); oci_bind_by_name($stid, ':primer_apellido', $primer_apellido); oci_bind_by_name($stid, ':segundo_apellido', $segundo_apellido); oci_bind_by_name($stid, ':tratamiento_protocolar', $tratamiento_protocolar); oci_bind_by_name($stid, ':numero_resolucion', $numero_resolucion); oci_bind_by_name($stid, ':fecha_resolucion', $fecha_resolucion); $r = oci_execute($stid, OCI_NO_AUTO_COMMIT); if (!$r) { echo "Desde el execute 3"; $e = oci_error($this->conex); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); //$error = true; //self::eliminar($id_den); oci_rollback($this->conex); //$e = oci_error($stid); //trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); //Libera los recursos oci_free_statement($stid); // Cierra la conexión Oracle oci_close($this->conex); return false; } } /**************** FIN INSERTAR EN LA TABLA JEFE_OFICINA************************/ /**************** CONSOLIDAR LOS CAMBIOS EN LAS TABLAS ************************/ $r = oci_commit($this->conex); if (!$r) { oci_free_statement($stid); oci_close($this->conex); return false; } /**************** CONSOLIDAR LOS CAMBIOS EN LAS TABLAS ************************/ oci_free_statement($stid); oci_close($this->conex); return true; }
//Es una Persona Jurídica if ($denunciante == 'empresa') { $filtro = htmlentities($_POST["opciones"]); $valor = htmlentities($_POST["valor"]); } else { if ($denunciante == 'persona') { /*echo htmlentities($_POST["nacionalidad"])." ". htmlentities($_POST["cedula"]);*/ $ciudadano = new Ciudadano(); $ciudadanod = new CiudadanoDAO(); $denuncia = new Denuncia(); $denunciad = new DenunciaDAO(); $nac = htmlentities($_POST["nacionalidad"]); $ced = prepara_cedula(htmlentities($_POST["cedula"])); $id_ciu = $nac . $ced; $consulta = "SELECT ID_ASEGURADO FROM SIRA.ASEGURADO WHERE ID_CIUDADANO =:id"; $conex = DataBase::getInstance(); // Preparar la sentencia $stid = oci_parse($conex, "SELECT * FROM SIRA.EMPRESA WHERE ID_EMPRESA IN(SELECT ID_EMPRESA FROM SIRA.ASEGURADO_EMPRESA WHERE ID_ASEGURADO IN(SELECT ID_ASEGURADO FROM SIRA.ASEGURADO WHERE ID_CIUDADANO = '" . $id_ciu . "') )"); # AND ID_ESTATUS_ASEGURADO = 'A' if (!$stid) { $e = oci_error($conex); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); } // Realizar la lógica de la consulta #oci_bind_by_name($stid, ':id', $id_ciu); $r = oci_execute($stid); if (!$r) { $e = oci_error($stid); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); } $result = array();
/** * Метод удаляет запись из таблицы * @param $id - идентификатор * @return bool - успешно/не успешно */ public function delete($id) { $db = DataBase::getInstance(); return $db->delete(self::TABLE_NAME, $id); }
function __construct() { parent::__construct(); $this->connection = DataBase::getInstance(); }
function conectaBaseDatos() { return DataBase::getInstance(); }
<?php header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache"); header("Content-type: application/json"); // session_start(); // $user = $_SESSION['user']; // // include database handler file include '../core/orchid.db.php'; // database instance $db = DataBase::getInstance(); // data // $db->setQuery('SELECT * FROM orchid_db.products order by Code desc, CreationDate desc Limit 3'); $db->setQuery("SELECT * from users where User = '******'"); // get data in array format $usuario = $db->loadObjectList(); // convert data to json a pull echo $_GET['callback'] . '(' . json_encode($usuario) . ');'; // destroy connection $db = null;
<?php if ($__GEOLOC_ASK_USER_SHARE_POSITION__ == true && !$page_object->isCrawlerBot()) { ?> launchGeoLocalisation(true); <?php } else { ?> launchGeoLocalisation(false); <?php } ?> } </script> <?php } else { echo $page_object->render(); } // End If page is not caching } else { // call current page page cache echo $page_object->render(); } } // Disconnect DataBase if (DB_ACTIVE) { DataBase::getInstance(false)->disconnect(); } unset($_SESSION['websitephp_register_object']); if (DEBUG && $_GET['mime'] == "text/html") { $page_object->displayExecutionTime(); }
protected function getcol($col) { $db = DataBase::getInstance(); $_filename = $db->escape($this->filename); $_pagename = $db->escape($this->page->getpagename()); $query = "SELECT {$col} FROM attach"; $query .= " WHERE (pagename = '{$_pagename}' AND filename = '{$_filename}')"; $row = $db->fetch($db->query($query)); return $row != false ? $row[$col] : false; }
public function __construct($i_ConversationID) { $this->m_ConversationID = $i_ConversationID; $this->m_ConversationObject = DataBase::getInstance()->getObjectForClass("conversation_code = " . $this->m_ConversationID, Database::ConversationTable, 'Conversation'); }
/** * Method prepareFieldsArray * @access public * @param mixed $properties [default value: array(] * @return mixed * @since 1.2.1 */ public function prepareFieldsArray($properties = array()) { $this->fields_array = array(); $list_attribute = $this->database_object->getDbTableAttributes(); $list_attribute_type = $this->database_object->getDbTableAttributesType(); $auto_increment_id = $this->database_object->getDbTableAutoIncrement(); // Add properties to apply on all fields if (isset($properties[ModelViewMapper::PROPERTIES_ALL]) && is_array($properties[ModelViewMapper::PROPERTIES_ALL])) { $apply_all_array = $properties[ModelViewMapper::PROPERTIES_ALL]; foreach ($apply_all_array as $property_name => $property_value) { for ($i = 0; $i < sizeof($list_attribute); $i++) { $property[$property_name] = $property_value; if (isset($properties[$list_attribute[$i]])) { // Handle child override of global property if (!isset($properties[$list_attribute[$i]][$property_name])) { $properties[$list_attribute[$i]] = array_merge($properties[$list_attribute[$i]], $property); } } else { $properties[$list_attribute[$i]] = $property; } } } } // check foreign keys $db_table_foreign_keys = $this->database_object->getDbTableForeignKeys(); foreach ($db_table_foreign_keys as $fk_attribute => $value) { if (isset($properties[$fk_attribute])) { $fk_property = $properties[$fk_attribute]; if (isset($fk_property["fk_attribute"])) { // create combobox $cmb = new ComboBox($this->form_or_page); // get foreign key data $query = "select distinct " . $value["column"] . " as id, " . $fk_property["fk_attribute"] . " as value from " . $value["table"]; if (isset($fk_property["fk_where"])) { $query .= " where " . $fk_property["fk_where"]; } if (isset($fk_property["fk_orderby"])) { $query .= " order by " . $fk_property["fk_orderby"]; } $stmt = DataBase::getInstance()->prepareStatement($query); $row = DataBase::getInstance()->stmtBindAssoc($stmt, $row); while ($stmt->fetch()) { $cmb->addItem(utf8encode($row['id']), utf8encode($row['value'])); } // add combo box in properties $value['cmb_obj'] = $cmb; $properties[$fk_attribute] = array_merge($properties[$fk_attribute], $value); } } } foreach ($list_attribute as $i => $attribute) { $wspobject = "TextBox"; $attribute_properties = array(); if (is_array($properties[$attribute])) { $attribute_properties = $properties[$attribute]; } if (isset($attribute_properties["display"]) && $attribute_properties["display"] == false) { continue; } $is_update_ok = true; if (isset($attribute_properties["update"]) && $attribute_properties["update"] == false) { $is_update_ok = false; } $method = "get" . $this->getFormatValue($attribute); $value = call_user_func_array(array($this->database_model_object, $method), array()); if ($attribute != $auto_increment_id && $is_update_ok) { // get property cmb_obj if (isset($attribute_properties['cmb_obj'])) { $field = $attribute_properties['cmb_obj']; } else { if (isset($attribute_properties["wspobject"]) && $attribute_properties["wspobject"] != "") { $wspobject = $attribute_properties["wspobject"]; } else { if ($list_attribute_type[$i] == "datetime") { $wspobject = "Calendar"; } else { if ($list_attribute_type[$i] == "boolean") { $wspobject = "CheckBox"; } } } if ($wspobject == "Calendar") { $field = new Calendar($this->form_or_page); } else { if ($wspobject == "CheckBox") { $field = new CheckBox($this->form_or_page); } else { if ($wspobject == "TextArea") { $field = new TextArea($this->form_or_page); } else { if ($wspobject == "Editor") { $field = new Editor($this->form_or_page); if (isset($attribute_properties["editor_param"]) && $attribute_properties["editor_param"] != "") { $field->setToolbar($attribute_properties["editor_param"]); } } else { if ($wspobject == "ComboBox") { $field = new ComboBox($this->form_or_page); if (isset($attribute_properties["combobox_values"])) { if (is_array($attribute_properties["combobox_values"])) { for ($j = 0; $j < sizeof($attribute_properties["combobox_values"]); $j++) { $field->addItem($attribute_properties["combobox_values"][$j]['value'], $attribute_properties["combobox_values"][$j]['text']); } } else { throw new NewException(get_class($this) . "->prepareFieldsArray() error: the property combobox_values need to be an array.", 0, getDebugBacktrace(1)); } } } else { $field = new TextBox($this->form_or_page); if ($list_attribute_type[$i] == "integer" || $list_attribute_type[$i] == "double") { $field->setWidth(70); } if (in_array($attribute, $key_attributes)) { $lv = new LiveValidation(); $field->setLiveValidation($lv->addValidatePresence()); } } } } } } } // Handle Checkbox case that only support value as "on" or "off" if (get_class($field) == "CheckBox") { if ($value == "1") { $field->setValue("on"); } else { $field->setValue("off"); } } else { if (get_class($field) == "Calendar") { $field->setValue($value); } else { $field->setValue(utf8encode($value)); } } if (isset($attribute_properties["width"]) && method_exists($field, "setWidth")) { $field->setWidth($attribute_properties["width"]); } if (isset($attribute_properties["height"]) && method_exists($field, "setHeight")) { $field->setHeight($attribute_properties["height"]); } if (isset($attribute_properties["class"]) && method_exists($field, "setClass")) { $field->setClass($attribute_properties["class"]); } if (isset($attribute_properties["style"]) && method_exists($field, "setStyle")) { $field->setStyle($attribute_properties["style"]); } if (isset($attribute_properties["disable"])) { if ($attribute_properties["disable"] == true && method_exists($field, "disable")) { $field->disable(); } else { if ($attribute_properties["disable"] == false && method_exists($field, "enable")) { $field->enable(); } } } if (get_class($field) != "Calendar") { if (isset($attribute_properties["strip_tags"]) && $attribute_properties["strip_tags"] == true && method_exists($field, "setStripTags")) { if (isset($attribute_properties["allowable_tags"])) { $field->setStripTags($attribute_properties["allowable_tags"]); } else { $field->setStripTags(""); // no tag allowed } } } } else { if (isset($attribute_properties['cmb_obj'])) { $field_tmp = $attribute_properties['cmb_obj']; $field_tmp->setValue($value); $value = $field_tmp->getText(); } if (get_class($value) == "DateTime") { $value = $value->format("Y-m-d"); } $field = new Object(utf8encode($value)); } $this->fields_array[$attribute] = $field; } return $this->fields_array; }
public function registrar2(Denuncia $data, FiscEmpresa $empresa) { $this->conex = DataBase::getInstance(); /*Consultar Empresa*/ $id_empresa = $empresa->__GET('id_fisc_empresa'); $consulta_empresa = "SELECT * FROM FISC_EMPRESA WHERE ID_FISC_EMPRESA= '" . $id_empresa . "'"; $compemp = oci_parse($this->conex, $consulta_empresa); if (!$compemp) { return false; } $exemp = oci_execute($compemp); if (!$exemp) { return false; } $empresa_result = oci_fetch_assoc($compemp); /*Consultar Empresa*/ /*Verificar existencia de empresa*/ if (!isset($empresa_result['ID_EMPRESA'])) { /*Insertando en la tabla FISC_EMPRESA*/ $id_emp = $empresa->__GET('id_fisc_empresa'); $rif = $empresa->__GET('rif_fisc_empresa'); $nombre = $empresa->__GET('nombre_fisc_empresa'); $telefono = $empresa->__GET('telefono_fisc_empresa'); $email = $empresa->__GET('email_fisc_empresa'); $direccion = $empresa->__GET('direccion_fisc_empresa'); $referencia = $empresa->__GET('punto_ref_fisc_empresa'); $denuncias = 1; //clave foranea de tabla denuncia $fiscalizaciones = 3; //clave foranea de tabla fiscalizaciones $consulta = "INSERT INTO FISC_EMPRESA (\n\t\t\t\tID_FISC_EMPRESA, \n\t\t\t\tRIF_FISC_EMPRESA,\n\t\t\t\tNOMBRE_FISC_EMPRESA, \n\t\t\t\tTELEFONO_FISC_EMPRESA, \n\t\t\t\tEMAIL_FISC_EMPRESA, \n\t\t\t\tDIRECCION_FISC_EMPRESA, \n\t\t\t\tDENUNCIAS_FISC_EMPRESA, \n\t\t\t\tPUNTO_REF_FISC_EMPRESA, \n\t\t\t\tFISCALIZACIONES_FISC_EMPRESA)\nvalues\n(\n\t:id_emp,\n\t:rif_emp,\n\t:nombre, \n\t:telefono,\n\t:email,\n\t:direccion,\n\t:denuncias,\n\t:ref,\n\t:fiscalizaciones\n\t)"; $stid = oci_parse($this->conex, $consulta); if (!$stid) { echo "Desde el parse 1"; $e = oci_error($this->conex); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); //Libera los recursos oci_free_statement($stid); // Cierra la conexión Oracle oci_close($this->conex); return false; } oci_bind_by_name($stid, ':id_emp', $id_emp); oci_bind_by_name($stid, ':rif_emp', $rif); oci_bind_by_name($stid, ':nombre', $nombre); oci_bind_by_name($stid, ':telefono', $telefono); oci_bind_by_name($stid, ':email', $email); oci_bind_by_name($stid, ':direccion', $direccion); oci_bind_by_name($stid, ':denuncias', $denuncias); oci_bind_by_name($stid, ':ref', $referencia); oci_bind_by_name($stid, ':fiscalizaciones', $fiscalizaciones); $r = oci_execute($stid, OCI_NO_AUTO_COMMIT); if (!$r) { echo "Desde el execute 1"; $e = oci_error($this->conex); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); //Revertimos los cambios //oci_rollback($this->conex); //Libera los recursos oci_free_statement($stid); // Cierra la conexión Oracle oci_close($this->conex); return false; } /*Insertando en la tabla FISC_EMPRESA*/ } /*Verificar existencia de empresa*/ /*Insertando en la tabla FISC_APODERADO*/ $id_den = $data->__GET('id_denuncia'); $id_ciu = $data->__GET('id_ciudadano'); $motivo = $data->__GET('motivo_denuncia'); $sts = $data->__GET('estatus_denuncia'); $fecha = $data->__GET('fecha_denuncia'); $rif = $data->__GET('rif'); $descripcion = $data->__GET('descripcion'); $responsable = $data->__GET('responsable'); //$apoderado = $data->__GET('apoderado'); $consulta = "INSERT INTO FISC_APODERADO(\n\tid_denuncia,\n\tid_ciudadano,\n\trif,\n\tmotivo_denuncia,\n\testatus_denuncia,\n\tfecha_denuncia,\n\tdescripcion, \n\tresponsable)\nvalues (\n\t:id_den,\n\t:id_ciu,\n\t:rif,\n\t:mot,\n\t:sts,\n\t:fec,\n\t:descrip,\n\t:responsable)"; $stid = oci_parse($this->conex, $consulta); /*values ( :id_den,:id_ciu,:rif,:mot,:sts, :fec,:descrp,:creator,:upd)");*/ if (!$stid) { echo "Desde el parse 2"; $e = oci_error($this->conex); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); //$e = oci_error($this->conex); //trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); //Libera los recursos oci_free_statement($stid); // Cierra la conexión Oracle oci_close($this->conex); return false; } // Realizar la lógica de la consulta oci_bind_by_name($stid, ':id_den', $id_den); oci_bind_by_name($stid, ':id_ciu', $id_ciu); oci_bind_by_name($stid, ':rif', $rif); oci_bind_by_name($stid, ':mot', $motivo); oci_bind_by_name($stid, ':sts', $sts); oci_bind_by_name($stid, ':fec', $fecha); oci_bind_by_name($stid, ':descrip', $descripcion); oci_bind_by_name($stid, ':responsable', $responsable); //oci_bind_by_name($stid, ':apoderado', $apoderado); /* oci_bind_by_name($stid, ':creator', $data->__GET('createdby')); oci_bind_by_name($stid, ':updater', $data->__GET('updatedby')); oci_bind_by_name($stid, ':upd', $data->__GET('updatedate')); */ $r = oci_execute($stid, OCI_NO_AUTO_COMMIT); if (!$r) { echo "Desde el execute 2"; $e = oci_error($this->conex); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); //Revertimos los cambios oci_rollback($this->conex); //Libera los recursos oci_free_statement($stid); // Cierra la conexión Oracle oci_close($this->conex); return false; } //Libera los recursos oci_free_statement($stid); /*Insertando en la tabla FISC_APODERADO*/ //No ocurrió ningún fallo al insertar los datos de la denuncia /*Insertando en la tabla FISC_DOCUMENTOS $documentos = $data->__GET('documentos'); //$error = false; for($i=0;$i<count($documentos);$i++) { $consulta = "INSERT INTO FISC_DOC_DEN( id_denuncia, id_documento) values ( :id_den,:id_doc)"; $stid = oci_parse($this->conex, $consulta); if (!$stid) { echo "Desde el parse 3"; $e = oci_error($this->conex); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); oci_rollback($this->conex); //$error = true; //self::eliminar($id_den); //$e = oci_error($this->conex); //trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); //Libera los recursos oci_free_statement($stid); // Cierra la conexión Oracle oci_close($this->conex); return false; } oci_bind_by_name($stid, ':id_den', $id_den); oci_bind_by_name($stid, ':id_doc', $documentos[$i]); $r = oci_execute($stid, OCI_NO_AUTO_COMMIT); if (!$r) { echo "Desde el execute 3"; $e = oci_error($this->conex); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); //$error = true; //self::eliminar($id_den); oci_rollback($this->conex); //$e = oci_error($stid); //trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); //Libera los recursos oci_free_statement($stid); // Cierra la conexión Oracle oci_close($this->conex); return false; } } Insertando en la tabla FISC_DOCUMENTOS*/ //Verificar existencia de Apoderado /* if( !isset($apoderado_result['ID_APODERADO'])) { //Insertando en la tabla FISC_APODERADO $nombres_apoderado = $data->__GET('nombres_apoderado'); $apellidos_apoderado = $data->__GET('apellidos_apoderado'); $consulta = "INSERT INTO FISC_APODERADO( id_apoderado, nombres_apoderado, apellidos_apoderado) values ( :id_apo, :name_apo, :ape_apo)"; $stid_apo = oci_parse($this->conex, $consulta); if (!$stid_apo) { echo "Desde el parse 4"; $e = oci_error($this->conex); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); oci_rollback($this->conex); //$error = true; //self::eliminar($id_den); //$e = oci_error($this->conex); //trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); //Libera los recursos oci_free_statement($stid); // Cierra la conexión Oracle oci_close($this->conex); return false; } oci_bind_by_name($stid_apo, ':id_apo', $id_apoderado); oci_bind_by_name($stid_apo, ':name_apo', $nombres_apoderado); oci_bind_by_name($stid_apo, ':ape_apo', $apellidos_apoderado); $execute_apo = oci_execute($stid_apo, OCI_NO_AUTO_COMMIT); if (!$execute_apo) { echo "Desde el execute 4"; $e = oci_error($this->conex); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); //$error = true; //self::eliminar($id_den); oci_rollback($this->conex); //$e = oci_error($stid); //trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); //Libera los recursos oci_free_statement($stid); // Cierra la conexión Oracle oci_close($this->conex); return false; } //Insertando en la tabla FISC_APODERADO }//Verificar existencia de Apoderado */ $r = oci_commit($this->conex); if (!$r) { oci_close($this->conex); return false; } // Cierra la conexión Oracle oci_close($this->conex); return true; }
/** * オートリンク用正規表現を作り直す。 */ function refresh() { $db = DataBase::getInstance(); $db->query("DELETE FROM autolink"); $this->expression = array(); }
/** * Constructor */ public function __construct() { $this->db = DataBase::getInstance(); }
public function obtener($clave, $valor) { $this->conex = DataBase::getInstance(); $consulta = "SELECT *\n\t\tFROM FISC_EMPRESA \n\t\tWHERE " . strtoupper($clave) . "= :valor"; $stid = oci_parse($this->conex, $consulta); if (!$stid) { $e = oci_error($this->conex); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); } // Realizar la lógica de la consulta oci_bind_by_name($stid, ':valor', $valor); $r = oci_execute($stid); if (!$r) { $e = oci_error($stid); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); } // Obtener los resultados de la consulta $result = array(); while ($fila = oci_fetch_array($stid, OCI_ASSOC + OCI_RETURN_NULLS)) { $it = new ArrayIterator($fila); $alm = new FiscEmpresa(); while ($it->valid()) { $alm->__SET(strtolower($it->key()), $it->current()); $it->next(); } $result[] = $alm; } //Libera los recursos oci_free_statement($stid); // Cierra la conexión Oracle oci_close($this->conex); //retorna el resultado de la consulta return $result; }