当前位置: 首页>>代码示例>>PHP>>正文


PHP CRequest::setLimit方法代码示例

本文整理汇总了PHP中CRequest::setLimit方法的典型用法代码示例。如果您正苦于以下问题:PHP CRequest::setLimit方法的具体用法?PHP CRequest::setLimit怎么用?PHP CRequest::setLimit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRequest的用法示例。


在下文中一共展示了CRequest::setLimit方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: CRequest

 *
 * @package    Mediboard
 * @subpackage dPhospi
 * @author     SARL OpenXtrem <dev@openxtrem.com>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkAdmin();
$original_trigger_code = CValue::post("original_trigger_code");
$do_it = CValue::post("do_it");
$count = CValue::post("count", 10);
$auto = CValue::post("auto");
$request = new CRequest();
$request->addSelect(array("CAST(GROUP_CONCAT(movement_id) AS CHAR) AS ids", "original_trigger_code", "start_of_movement", "sejour_id"))->addTable("movement")->addWhere(array("original_trigger_code" => "= '{$original_trigger_code}'"))->addGroup(array("original_trigger_code", "start_of_movement", "sejour_id"))->addHaving("COUNT(movement_id) > 1");
if ($do_it) {
    $request->setLimit($count);
}
$mov = new CMovement();
$query = $request->makeSelect();
$list = $mov->_spec->ds->loadList($query);
if (!$do_it) {
    CAppUI::setMsg(count($list) . " doublons à traiter");
} else {
    foreach ($list as $_mvt) {
        $ids = explode(",", $_mvt["ids"]);
        sort($ids);
        // IMPORTANT, must use the first movement created as a reference
        $first = new CMovement();
        $first->load($ids[0]);
        $second = new CMovement();
        $second->load($ids[1]);
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:31,代码来源:do_remove_movement_duplicates.php

示例2: CRequest

$ds = CSQLDataSource::get($dsn);
$columns = CImportTools::getColumnsInfo($ds, $table);
$orderby = "";
if ($order_column) {
    $order_column = preg_replace('/[^-_\\w]/', "", $order_column);
    if (in_array($order_column, array_keys($columns))) {
        if (!in_array($order_way, array("ASC", "DESC"))) {
            $order_way = "ASC";
        }
        $orderby = "{$order_column} {$order_way}";
    }
}
$request = new CRequest();
$request->addTable($table);
$request->addSelect("*");
$request->setLimit("{$start},{$count}");
if ($orderby) {
    $request->addOrder($orderby);
}
if ($where_column) {
    $where = array($where_column => $ds->prepare("=?", $where_value));
    $request->addWhere($where);
}
$rows = $ds->loadList($request->makeSelect());
$request->setLimit(null);
$request->order = null;
$total = $ds->loadResult($request->makeSelectCount());
$counts = array(10, 50, 100, 200, 500, 1000, 5000);
$smarty = new CSmartyDP();
$smarty->assign("rows", $rows);
$smarty->assign("columns", $columns);
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:31,代码来源:ajax_vw_table_data.php

示例3: getRandomValue

 /**
  * Get random value
  *
  * @param string $field       Field name
  * @param bool   $is_not_null Search field not null
  *
  * @return mixed
  */
 function getRandomValue($field, $is_not_null = false)
 {
     $ds = $this->getDS();
     $query = new CRequest();
     $query->addSelect($field);
     $query->addTable($this->_spec->table);
     if ($is_not_null) {
         $query->addWhereClause($field, "IS NOT NULL");
     }
     $query->addOrder("RAND()");
     $query->setLimit(1);
     return $ds->loadResult($query->makeSelect());
 }
开发者ID:fbone,项目名称:mediboard4,代码行数:21,代码来源:CMbObject.class.php

示例4: loadIds

 /**
  * Object list for given statements
  *
  * @param array        $where Array of where clauses
  * @param array|string $order Order SQL statement
  * @param string       $limit MySQL limit clause
  * @param array|string $group Group by SQL statement
  * @param array        $ljoin Array of left join clauses
  *
  * @return integer[] List of found IDs, null if module is not installed
  */
 function loadIds($where = null, $order = null, $limit = null, $group = null, $ljoin = null)
 {
     if (!$this->_ref_module) {
         return null;
     }
     $request = new CRequest();
     $request->addLJoin($ljoin);
     $request->addWhere($where);
     $request->addGroup($group);
     $request->addOrder($order);
     $request->setLimit($limit);
     $ds = $this->_spec->ds;
     return $ds->loadColumn($request->makeSelectIds($this));
 }
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:25,代码来源:CStoredObject.class.php

示例5: elseif

         $request_b->addOrder("patients.nom ASC, sejour.entree_prevue ASC");
     } elseif ($interv_filled) {
         $request_b->addSelect("operations.operation_id, patients.patient_id" . $other_fields);
         $request_b->addTable("operations");
         $request_b->addOrder("patients.nom ASC, operations.date ASC");
     } else {
         $request_b->addSelect("patients.patient_id");
         $request_b->addTable("patients");
         $request_b->addOrder("patients.nom ASC");
     }
     $request_b->addLJoin($ljoin);
     $request_b->addRJoin($rjoinMix);
     $request_b->addWhere($where);
     $request_b->addWhere($whereMix);
     if (!$export) {
         $request_b->setLimit("{$start},30");
     }
     $results = array_merge($results, $ds->loadList($request_b->makeSelect()));
 }
 foreach ($results as $_result) {
     $_patient_id = $_result["patient_id"];
     $pat = new CPatient();
     $pat->load($_patient_id);
     // Recherche sur un antécédent
     if (isset($_result["antecedent_id"])) {
         $_atcd = new CAntecedent();
         $_atcd->load($_result["antecedent_id"]);
         $pat->_ref_antecedent = $_atcd;
     } else {
         // On affiche tous les antécédents du patient
         $dossier_medical = $pat->loadRefDossierMedical(false);
开发者ID:fbone,项目名称:mediboard4,代码行数:31,代码来源:ajax_recherche_dossier_clinique.php

示例6: array

/** @var CErrorLog[] $error_logs */
$error_logs = array();
/** @var CUser[] $users */
$users = array();
if ($group_similar && $group_similar !== 'no') {
    if ($group_similar === 'signature') {
        $groupby = "signature_hash";
    }
    if ($group_similar === 'similar') {
        $groupby = "text, stacktrace_id, param_GET_id, param_POST_id";
    }
    $request = new CRequest();
    $request->addWhere($where);
    $request->addOrder($order);
    $request->addGroup($groupby);
    $request->setLimit($limit);
    $fields = array("GROUP_CONCAT(error_log_id) AS similar_ids", "GROUP_CONCAT(user_id)      AS similar_user_ids", "GROUP_CONCAT(server_ip)    AS similar_server_ips", "MIN(datetime) AS datetime_min", "MAX(datetime) AS datetime_max");
    $error_logs_similar = $ds->loadList($request->makeSelectCount($error_log, $fields));
    $request->setLimit(null);
    $total = count($ds->loadList($request->makeSelectCount($error_log, $fields)));
    $user_ids = array();
    foreach ($error_logs_similar as $_info) {
        $similar_ids = explode(",", $_info["similar_ids"]);
        $error_log = new CErrorLog();
        $error_log->load(reset($similar_ids));
        $error_log->_similar_ids = $similar_ids;
        $error_log->_similar_count = $_info["total"];
        $error_log->_datetime_min = $_info["datetime_min"];
        $error_log->_datetime_max = $_info["datetime_max"];
        $error_log->_similar_user_ids = array_unique(explode(",", $_info["similar_user_ids"]));
        $error_log->_similar_server_ips = array_unique(explode(",", $_info["similar_server_ips"]));
开发者ID:fbone,项目名称:mediboard4,代码行数:31,代码来源:ajax_list_error_logs.php

示例7: CSejour

$dPconfig["sa"]["trigger_sejour"] = "facture";
$limit = CValue::get("limit", 10);
$day = CValue::get("day", 3);
$sejour = new CSejour();
$ds = $sejour->getDS();
$request = new CRequest();
$request->addSelect("sejour.sejour_id");
$request->addTable("sejour");
$request->addLJoinClause("rpu", "rpu.sejour_id = sejour.sejour_id");
$request->addWhereClause("annule", "!='1'");
$request->addWhereClause("facture", "!='1'");
$request->addWhereClause("sortie_reelle", "BETWEEN '" . CMbDT::dateTime("-{$day}DAY") . "' AND '" . CMbDT::dateTime() . "'");
$request->addWhereClause("rpu.sejour_id", "IS NOT NULL");
$request->addGroup("sejour.sejour_id");
$request->addHaving("count(*) = 1");
$request->setLimit($limit);
$list_sejour = $ds->loadList($request->makeSelect());
foreach ($list_sejour as $_sejour_id) {
    $sejour = new CSejour();
    $sejour->load($_sejour_id["sejour_id"]);
    if (!($nda = $sejour->getTagNDA())) {
        continue;
    }
    $rpu = $sejour->loadRefRPU();
    if ($rpu->mutation_sejour_id) {
        $sejour_reliquat = $rpu->loadRefSejourMutation();
        if (!($nda = $sejour_reliquat->getTagNDA())) {
            continue;
        }
        $consultations = $sejour_reliquat->loadRefsConsultations();
        foreach ($consultations as $_consultation) {
开发者ID:fbone,项目名称:mediboard4,代码行数:31,代码来源:facturer_codable.php

示例8: json_encode

 * $Id$
 *
 * @category HL7
 * @package  Mediboard
 * @author   SARL OpenXtrem <dev@openxtrem.com>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
CCanDo::checkAdmin();
$field = CValue::get('field');
$class = CValue::get('class');
/** @var CMbObject $object */
$object = new $class();
$ds = $object->getDS();
//Récupération du nombre patient correspondant à nos critères
$query = new CRequest();
$query->addSelect("COUNT(*)");
$query->addTable($object->_spec->table);
$query->addWhereClause($field, "IS NOT NULL");
$value = $ds->loadResult($query->makeSelect());
//nombre aléatoire entre 1 et le resultat de notre recherche
$nombre = rand("1", $value);
//Réucpération du champ voulut du patient choisit aléatoirement
$query = new CRequest();
$query->addSelect($field);
$query->addTable($object->_spec->table);
$query->addWhereClause($field, "IS NOT NULL");
$query->setLimit("{$nombre}, 1");
$value = $ds->loadResult($query->makeSelect());
echo json_encode(array("value" => $value, "field" => $field));
开发者ID:fbone,项目名称:mediboard4,代码行数:31,代码来源:ajax_random_field.php


注:本文中的CRequest::setLimit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。