/**
  * 根据标签查找联系人
  * @param Group_Contact $group_contact
  * @return array
  */
 public function find_by_tags(Group_Contact $group_contact)
 {
     $keys = array();
     $others = array();
     //组织SQL
     foreach ($this->map as $field) {
         $name = (string) $field->name;
         $getprop = (string) $field->accessor;
         if ($getprop) {
             $value = call_user_func(array($group_contact, $getprop));
             if ($value) {
                 if (in_array($name, array('tels', 'emails', 'addresses', 'ims', 'urls', 'relations', 'events'))) {
                     if (in_array($name, array('tels', 'emails', 'ims'))) {
                         $others[$name] = $value;
                     }
                 } else {
                     $keys['gcp_contacts.' . $name] = $value;
                 }
             }
         }
     }
     if (!array_key_exists('gcp_contacts.deleted', $keys)) {
         $keys['gcp_contacts.deleted'] = 0;
     }
     if (!empty($others)) {
         $this->db->select('gcp_contacts.*')->from('gcp_contacts')->where($keys);
         $type = key($others);
         $other = $others[$type];
         $tmp = array();
         foreach ($other as $val) {
             $tmp[] = $val['value'];
         }
         $this->db->join('gcp_' . $type, 'gcp_contacts.gcid = gcp_' . $type . '.gcid', '', 'LEFT')->in('gcp_' . $type . '.value', $tmp);
         $query = $this->db->get();
     } else {
         $query = $this->db->getwhere('gcp_contacts', $keys);
     }
     $result = array();
     if ($query->count()) {
         $rows = $query->result_array(FALSE);
         foreach ($rows as $row) {
             $result[] = $row['gcid'];
         }
     }
     return $result;
 }
 /**
  * @desc Gets page ids and their categories from recentchanges and categorylins tables
  *
  * @param String $date date in format Ymd
  *
  * @return Array
  */
 private function getRecentChangedPages($date)
 {
     $betweenStart = $date . '000000';
     $betweenEnd = $date . '235959';
     $table = ['r' => 'recentchanges', 'c' => 'categorylinks'];
     $fields = ['r.rc_cur_id as id', 'c.cl_to as category'];
     $where = ['r.rc_cur_id > 0', 'rc_namespace' => NS_MAIN, 'rc_timestamp between ' . $betweenStart . ' and ' . $betweenEnd];
     $joins = ['c' => ['INNER JOIN', 'r.rc_cur_id = c.cl_from AND c.cl_to IN ("Artist", "Album", "Song")']];
     $options = ['DISTINCT', 'ORDER BY' => 'rc_timestamp desc', 'USE INDEX' => ['r' => 'rc_timestamp']];
     $result = $this->db->select($table, $fields, $where, __METHOD__, $options, $joins);
     $pages = [];
     if ($result->numRows() > 0) {
         while ($row = $result->fetchObject()) {
             $pages[] = $row;
         }
     }
     return $pages;
 }
 /**
  * @param array $params - params for informer
  * @return string - output data
  * 
  * get materials for informer from database fnd build informer
  */
 public function buildContent($params)
 {
     if ($this->heckAllParams($params)) {
         $table = $params['materials'];
         $sql = DataBase::select($table, DB_ALL, array('order' => $params['order'], 'limit' => $params['count']));
         if (count($sql) > 0) {
             foreach ($sql as $row) {
                 $temp = $this->template;
                 foreach ($row as $k => $value) {
                     $temp = str_replace('{' . strtoupper($k) . '}', $value, $temp);
                 }
                 $this->output .= $temp;
             }
             return $this->output;
         }
     }
     return null;
 }
    ob_end_clean();
    echo '{"success":false,"message":"error: no columns given to query"}';
    exit;
}
if ($objParseColumns->success == false) {
    ob_end_clean();
    echo '{"success":false,"message":"error: no columns given to query"}';
    exit;
}
$dataBase->parseJoin($strJoin);
$dataBase->parseRestrictions($strRestrictions);
$dataBase->parseOrderBy($strOrder);
$dataBase->parseGroupBy($strGroupBy);
$dataBase->parseLimit($strLimit);
$dataBase->parseValues($strValues);
ob_end_clean();
switch ($strQuery) {
    case 'SELECT':
        echo $dataBase->select();
        break;
    case 'INSERT':
        echo $dataBase->insert();
        break;
    case 'DELETE':
        echo $dataBase->delete();
        break;
    case 'UPDATE':
        echo $dataBase->update();
        break;
}
exit;
Beispiel #5
0
<?php

$idCliente = filter_input(INPUT_GET, "IdCliente");
$sNombre = filter_input(INPUT_GET, "Nombre");
$cEncabezado = $sNombre;
include './dataBaseClass/connection.php';
$cDb = new DataBase();
$result = $cDb->select(array("nombre", "nacimiento", "sexo"), "Dependiente", "idCliente = {$idCliente}", "", "");
?>
<div class="modal-dialog modal-lg">
    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button
            <h1 class="modal-title">Listado de Dependientes: <b><?php 
echo $cEncabezado;
?>
</b></h1>
        </div>
        <div class="modal-body" style="margin: 20px;">
            <table class="table table-responsive table-striped">
                <thead>
                    <tr>
                        <th>Nombre</th>
                        <th>Fecha Nacimiento</th>
                        <th>Sexo</th>
                    </tr>
                </thead>
                <tbody>
                    <?php 
while ($row = mysqli_fetch_array($result)) {
    ?>
Beispiel #6
0
                return true;
            } else {
                return false;
            }
        }
    }
    public function escapeString($data)
    {
        return $this->myconn->real_escape_string($data);
    }
    public function getSql()
    {
        $val = $this->myQuery;
        $this->myQuery = array();
        return $val;
    }
}
$obj = new DataBase();
//
$obj->connect("localhost", "root", "", "comunity_service");
//$obj->update('comunity_service','login',array('username'=>'Bernard!'),array('ID',3));
//$obj->tableExists("comunity_service",'login')
// $con=new DataBase();
// $con->connect("localhost","root","","comunity_service");
//select($table, $rows = '*', $where = null, $order = null);
$obj->delete('comunity_service', 'login', 'id=6');
$obj->select('comunity_service', 'login', '*', 'ID="1"', 'id DESC');
$res = $obj->getResult();
echo "<br/>";
print_r($res);
//$obj->getSql();
Beispiel #7
0
     $leftNavigation = array(new MenuList('Основное', '#/main/calendar', 'fa-dashboard', 'fa-angle-left pull-right', array(new MenuList('Календарь', '#/main/calendar', 'fa fa-calendar'), new MenuList('Калькулятор', '#/main/calculator', 'fa-calculator'))), new MenuList('Отзывы', '#/reviews', 'fa-commenting-o', 'fa-angle-left pull-right', array(new MenuList('Отзывы', '#/reviews', 'fa-list'))), new MenuList('Пользователи', '#/user/all', 'fa-user', 'fa-angle-left pull-right', array(new MenuList('Все', '#/user/all', 'fa-users'), new MenuList('Добавить', '#/user/add', 'fa-user-plus'))), new MenuList('Галерея', '#/galary/all', 'fa-th', 'fa-angle-left pull-right', array(new MenuList('Все', '#/galary/all', 'fa-photo'), new MenuList('Категории', '#/galary/categories', 'fa-list'), new MenuList('Загрузка', '#/galary/add', 'fa-upload'))));
     $_RETURN['status'] = 1;
     $_RETURN['data'] = $leftNavigation;
     echo json_encode($_RETURN);
 }
 // Список категорий и их итемов для калькуляции
 if ($_m == 'calcCategory') {
     $array = $Db->select('
         SELECT 
             c.id as catId,
             c.name as catName,
             c.image as catImage,
             i.id as iId,
             i.name as iName,
             i.description as iDesc,
             i.money as iMoney,
             i.ingredients as iIngredients,
             i.image as iImage
         
         FROM category c
         LEFT JOIN items i ON c.id = i.category
         WHERE c.visible = 1
         ORDER BY catId
         ');
     $newArr = array();
     foreach ($array as $cat) {
         if (!$newArr[$cat['catId']]) {
             $newArr[$cat['catId']] = array('id' => $cat['catId'], 'name' => $cat['catName'], 'image' => $cat['catImage'], 'items' => array());
         }
         if ($cat['iId']) {
             $newArr[$cat['catId']]['items'][$cat['iId']] = array('id' => $cat['iId'], 'name' => $cat['iName'], 'desc' => $cat['iDesc'], 'money' => $cat['iMoney'], 'ingredients' => $cat['iIngredients'], 'image' => $cat['iImage']);
Beispiel #8
0
 /**
  * 显示完整一条node的内容
  */
 static function load($name, $nid)
 {
     $cache_id = "node_{$name}";
     $data = \Yii::$app->cache->get($cache_id);
     echo $cache_id;
     exit;
     if ($data === false) {
         //取得 content_type 指定name的所有信息
         $structs = Field::tree($name);
         $master = self::table_master($name);
         //取得主node信息,_nid表
         $row = DataBase::select($master . " as node", array('where' => array('node.id=:id' => array(':id' => $nid))));
         foreach ($structs as $field => $options) {
             $fid = (int) $options['fid'];
             //字段ID
             $mysql = $options['mysql'];
             $table = self::table_name($name, $mysql);
             $tables[$table][] = $fid;
             $fs[$fid] = $field;
             //字段
             $i++;
         }
         $rows = DataBase::find_no_nid($tables, $nid, $fs);
         $data = (object) array_merge($row, $rows);
         \Yii::$app->cache->set($cache_id, $data);
     }
     return $data;
 }
Beispiel #9
0
<?php

session_start();
if (!isset($_SESSION['login_user']) || empty($_SESSION['login_user'])) {
    header("Location: /Cobranza/index.php");
    exit;
}
$idFile = filter_input(INPUT_GET, "id");
if (isset($idFile)) {
    $idFile = intval($idFile);
    if ($idFile <= 0) {
        die("El Id del Documento es incorrecto");
    } else {
        include './dataBaseClass/connection.php';
        $cDb = new DataBase();
        $result = $cDb->select(array("nombre", "type", "size", "content"), "ExpedienteElectronico", "id={$idFile}", "", "1");
        if ($result) {
            if (mysqli_num_rows($result) == 1) {
                $row = mysqli_fetch_assoc($result);
                header("Content-Type: " . $row['type']);
                header("Content-Length: " . $row['size']);
                header("Content-Disposition: inline; filename=" . $row['nombre']);
                echo $row['content'];
            } else {
                echo 'No existe un documento con ese ID';
            }
            mysqli_free_result($result);
        }
    }
} else {
    echo 'No se especifico un archivo';
Beispiel #10
0
<?php

require_once "database.php";
if ($_GET['action'] != "new" && !$_GET['id']) {
    die("No ID provided!");
}
switch ($_GET["action"]) {
    case "new":
        $db = new DataBase();
        $result = $db->get_new_id();
        die($result['id']);
        break;
    case "get":
        $db = new DataBase();
        $result = $db->select((int) $_GET['id']);
        if ($result) {
            $json = array();
            $json['lat'] = (double) $result['latitude'];
            $json['lng'] = (double) $result['longitude'];
            // This doesn't work in my arsys hosting
            //$encoded = json_encode($json);
            $encoded = '{"lat":' . $json['lat'] . ',"lng":' . $json['lng'] . '}';
        }
        die($encoded);
        break;
    case "post":
        $db = new DataBase();
        $id = (int) $_GET['id'];
        $lat = (double) $_GET['lat'];
        $lng = (double) $_GET['lng'];
        $db->insert($id, $lat, $lng);
Beispiel #11
0
<?php

session_start();
if (!isset($_SESSION['login_user'])) {
    header("Location: /Cobranza/login.php");
}
$lEdit = FALSE;
$id = filter_input(INPUT_GET, "idPaquete");
$tipoPoliza = filter_input(INPUT_GET, "tipoPoliza");
$cobertura = filter_input(INPUT_GET, "cobertura");
if ($id != "") {
    include '../dataBaseClass/connection.php';
    $cDb = new DataBase();
    $result = $cDb->select(array("idPaquete", "tipoPoliza", "cobertura"), "Paquete", "idPaquete = '{$id}' AND tipoPoliza = '{$tipoPoliza}' AND cobertura = '{$cobertura}'", "", "");
    if (mysqli_num_rows($result) > 0) {
        $row = mysqli_fetch_assoc($result);
        $lEdit = TRUE;
    }
}
$cEncabezado = $lEdit ? "Editando: " . $row['cobertura'] : "Editar paquetes";
?>

<div class="modal-dialog modal-lg">
    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button
            <h1 class="modal-title"><?php 
echo $cEncabezado;
?>
</h1>
        </div>
Beispiel #12
0
$lEdit = FALSE;
$idAgente = filter_input(INPUT_GET, "idAgente");
$nombre = filter_input(INPUT_GET, "nombre");
$clave = filter_input(INPUT_GET, "clave");
$row = array();
$row['idAgente'] = '';
$row['nombre'] = '';
$row['clave'] = '';
$row['direccion'] = '';
$row['telefono'] = '';
$row['movil'] = '';
$row['email'] = '';
if ($idAgente != "") {
    include '../dataBaseClass/connection.php';
    $cDb = new DataBase();
    $result = $cDb->select(array("idAgente", "nombre", "clave", "direccion", "telefono", "movil", "email"), "agente", "idAgente = '{$idAgente}'", "", "");
    if (mysqli_num_rows($result) > 0) {
        $row = mysqli_fetch_array($result);
        $lEdit = TRUE;
    }
}
$cEncabezado = $lEdit ? "Editando: " . $row['nombre'] : "Agregar agente";
?>

<div class="modal-dialog modal-lg">
    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button
            <h1 class="modal-title"><?php 
echo $cEncabezado;
?>
<?php

session_start();
if (!isset($_SESSION['login_user'])) {
    header("Location: /Cobranza/login.php");
}
$lEdit = FALSE;
$id = filter_input(INPUT_GET, "idTipo");
if ($id != "") {
    include '../dataBaseClass/connection.php';
    $cDb = new DataBase();
    $result = $cDb->select(array("idTipo", "nombre", "descripcion"), "TipoPoliza", "", "", "");
    if (mysqli_num_rows($result) > 0) {
        $row = mysqli_fetch_array($result);
        $lEdit = TRUE;
    }
}
$cEncabezado = $lEdit ? "Editando: " . $row['nombre'] : "Nuevo Tipo de Poliza";
?>

<div class="modal-dialog modal-lg">
    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button
            <h1 class="modal-title"><?php 
echo $cEncabezado;
?>
</h1>
        </div>
        <div class="modal-body" style="margin: 20px;">
            <form action="GuardaTipoPoliza.php" id="inputForm">