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


PHP CDbCriteria::addBetweenCondition方法代码示例

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


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

示例1: search

 /**
  * Retrieves a list of models based on the current search/filter conditions.
  *
  * Typical usecase:
  * - Initialize the model fields with values from filter form.
  * - Execute this method to get CActiveDataProvider instance which will filter
  * models according to data in model fields.
  * - Pass data provider to CGridView, CListView or any similar widget.
  *
  * @return CActiveDataProvider the data provider that can return the models
  * based on the search/filter conditions.
  */
 public function search($patientId = null)
 {
     // @todo Please modify the following code to remove attributes that should not be searched.
     $criteria = new CDbCriteria();
     if (isset($patientId)) {
         $criteria->addSearchCondition('patient_id', $patientId, true, 'AND');
     }
     // 搜尋就醫時間
     if (!empty($this->searchByDateFrom) && !empty($this->searchByDateTo)) {
         $criteria->addBetweenCondition('date', $this->searchByDateFrom, $this->searchByDateTo);
     }
     // 搜尋回診時間
     if (!empty($this->searchByNextBackDateFrom) && !empty($this->searchByNextBackDateTo)) {
         $criteria->addBetweenCondition('next_back_to_clinic_date', $this->searchByNextBackDateFrom, $this->searchByNextBackDateTo);
     }
     if (is_null($patientId)) {
         $criteria->with = array('patient');
     }
     $criteria->compare('patient.name', $this->searchByPatient, true);
     $criteria->compare('t.id', $this->id, true);
     $criteria->compare('date', $this->date, true);
     $criteria->compare('purpose', $this->purpose, true);
     $criteria->compare('plan', $this->plan, true);
     $criteria->compare('result', $this->result, true);
     $criteria->compare('next_back_to_clinic_date', $this->next_back_to_clinic_date, true);
     $criteria->compare('next_back_to_clinic_notes', $this->next_back_to_clinic_notes, true);
     $criteria->order = 'next_back_to_clinic_date DESC, date DESC';
     return new CActiveDataProvider($this, array('criteria' => $criteria));
 }
开发者ID:luckily,项目名称:casehistory,代码行数:41,代码来源:MedicalRecord.php

示例2: search

 /**
  * Retrieves a list of models based on the current search/filter conditions.
  *
  * Typical usecase:
  * - Initialize the model fields with values from filter form.
  * - Execute this method to get CActiveDataProvider instance which will filter
  * models according to data in model fields.
  * - Pass data provider to CGridView, CListView or any similar widget.
  *
  * @return CActiveDataProvider the data provider that can return the models
  * based on the search/filter conditions.
  */
 public function search()
 {
     // @todo Please modify the following code to remove attributes that should not be searched.
     $criteria = new CDbCriteria();
     $aJoin = array();
     $criteria->compare('id', $this->id);
     $criteria->compare('quantidade', $this->quantidade);
     $criteria->compare('observacao', $this->observacao, true);
     $criteria->compare('data_hora', $this->data_hora, true);
     $criteria->compare('ordem_servico_id', $this->ordem_servico_id);
     $criteria->compare('excluido', $this->excluido);
     if (!empty($this->data_hora_inicial) && !empty($this->data_hora_final)) {
         $this->data_hora_inicial_grid = $this->data_hora_inicial;
         $this->data_hora_final_grid = $this->data_hora_final;
         $criteria->addBetweenCondition('date(data_hora)', $this->data_hora_inicial, $this->data_hora_final);
     } else {
         if (!empty($this->data_hora_inicial_grid) && !empty($this->data_hora_final_grid)) {
             $this->data_hora_inicial = $this->data_hora_inicial_grid;
             $this->data_hora_final = $this->data_hora_final_grid;
             $criteria->addBetweenCondition('date(data_hora)', $this->data_hora_inicial, $this->data_hora_final);
         }
     }
     if (!empty($this->produto_id)) {
         $criteria->addCondition("produto.titulo like '%" . $this->produto_id . "%'");
     }
     if (!empty($this->usuario_id)) {
         $criteria->addCondition("usuario.nome like '%" . $this->usuario_id . "%'");
     }
     if (!empty($aJoin)) {
         $criteria->join = implode(' ', $aJoin);
     }
     $criteria->with = array('produto', 'usuario');
     return new CActiveDataProvider($this, array('criteria' => $criteria));
 }
开发者ID:bgstation,项目名称:erp,代码行数:46,代码来源:LogRetiradaProduto.php

示例3: search

 /**
  * Настройки поиска
  * @return \CActiveDataProvider
  */
 public function search()
 {
     $criteria = new CDbCriteria();
     $criteria->compare('bhid', $this->bhid);
     $criteria->addSearchCondition('player_ip', $this->player_ip);
     $criteria->addSearchCondition('player_id', $this->player_id);
     $criteria->addSearchCondition('player_nick', $this->player_nick);
     $criteria->compare('admin_ip', $this->admin_ip, true);
     $criteria->compare('admin_id', $this->admin_id, true);
     if ($this->admin_nick) {
         $criteria->compare('admin_nick', $this->admin_nick, true);
     }
     $criteria->compare('ban_type', $this->ban_type, true);
     $criteria->addSearchCondition('ban_reason', $this->ban_reason, true);
     if ($this->ban_created) {
         $start = strtotime("{$this->ban_created} 00:00:00");
         $end = strtotime("{$this->ban_created} 23:59:59");
         $criteria->addBetweenCondition('ban_created', $start, $end);
     }
     $criteria->compare('ban_length', $this->ban_length);
     $criteria->compare('server_ip', $this->server_ip, true);
     $criteria->compare('server_name', $this->server_name, true);
     if ($this->unban_created) {
         $start = strtotime("{$this->unban_created} 00:00:00");
         $end = strtotime("{$this->unban_created} 23:59:59");
         $criteria->addBetweenCondition('unban_created', $start, $end);
     }
     $criteria->compare('unban_reason', $this->unban_reason, true);
     $criteria->compare('unban_admin_nick', $this->unban_admin_nick, true);
     $criteria->compare('map_name', $this->map_name, true);
     $criteria->order = '`bhid` DESC';
     return new CActiveDataProvider($this, array('criteria' => $criteria, 'pagination' => array('pageSize' => Yii::app()->config->bans_per_page)));
 }
开发者ID:DmitriyS,项目名称:CS-Bans,代码行数:37,代码来源:History.php

示例4: actionSearch

 public function actionSearch()
 {
     $model = new SearchMonth('search');
     $paper = new PaperApproval('search');
     $criteria = new CDbCriteria();
     $criteria->with = array('member', 'place');
     $criteria->scopes = array('desc', 'notAccept');
     if (isset($_POST['SearchMonth'])) {
         $model->attributes = $_POST['SearchMonth'];
         if ($model->validate()) {
             if ($model->validate()) {
                 if ($model->month != null) {
                     $dateStart = 1;
                     $dateEnd = cal_days_in_month(CAL_GREGORIAN, $model->month, $model->year);
                     // จำนวนวันของเดือน นั้นของปี
                     $timeStart = '00:00:00';
                     $timeEnd = '23:59:59';
                     $start = "{$model->year}-{$model->month}-{$dateStart} {$timeStart}";
                     $end = "{$model->year}-{$model->month}-{$dateEnd} {$timeEnd}";
                     Yii::app()->user->setState('start', $start);
                     Yii::app()->user->setState('end', $end);
                     $criteria->addBetweenCondition('t.create_at', $start, $end);
                 } else {
                     $timeStart = '00:00:00';
                     $timeEnd = '23:59:59';
                     $start = "{$model->year}-1-1 {$timeStart}";
                     $end = "{$model->year}-12-31} {$timeEnd}";
                     Yii::app()->user->setState('start', $start);
                     Yii::app()->user->setState('end', $end);
                     $criteria->addBetweenCondition('t.create_at', $start, $end);
                 }
             }
         } else {
             $this->renderPartial('/error/_error', array('models' => array($model)));
             Yii::app()->end();
         }
     } else {
         $start = Yii::app()->user->getState('start');
         $end = Yii::app()->user->getState('end');
         $criteria->addBetweenCondition('t.create_at', $start, $end);
     }
     if (isset($_GET['PaperApproval'])) {
         $paper->attributes = $_GET['PaperApproval'];
         $criteria->compare('paper_no', $paper->paper_no, true);
         $criteria->compare('member.name', $paper->member_id, true);
         $criteria->compare('go', $paper->go, true);
         $criteria->compare('request', $paper->request, true);
         $criteria->compare('responsible', $paper->responsible);
         $criteria->compare('place.name', $paper->place_id, true);
         $criteria->compare('t.status', $paper->status);
     }
     $dataProvider = new CActiveDataProvider($paper, array('criteria' => $criteria, 'pagination' => array('pageSize' => Yii::app()->params['pageSize'])));
     $this->renderPartial('_list', array('model' => $paper, 'dataProvider' => $dataProvider), false, true);
 }
开发者ID:vasitjuntong,项目名称:carsnru,代码行数:54,代码来源:NotAcceptController.php

示例5: run

 public function run()
 {
     $this->controller->_seoTitle = '交易记录 - ' . $this->controller->_setting['site_name'];
     $this->controller->loadModel();
     $model = new UserTrade();
     $criteria = new CDbCriteria();
     //查询条件
     $create_time_start = Yii::app()->request->getParam('create_time_start');
     $create_time_end = Yii::app()->request->getParam('create_time_end');
     $trade_type = Yii::app()->request->getParam('trade_type');
     $trade_status = Yii::app()->request->getParam('trade_status');
     $create_time_start && $criteria->addBetweenCondition('time_create', strtotime($create_time_start), strtotime($create_time_end));
     if ($trade_type && $trade_type != 'all') {
         $criteria->addColumnCondition(['type' => $trade_type]);
     }
     if ($trade_status && $trade_status != 'all') {
         $criteria->addColumnCondition(['status' => $trade_status]);
     }
     $criteria->addColumnCondition(array('user_id' => Yii::app()->user->id));
     $count = $model->count($criteria);
     $pages = new CPagination($count);
     $pages->pageSize = 10;
     $pages->applyLimit($criteria);
     $lists = $model->findAll($criteria);
     //加载css js
     Yii::app()->clientScript->registerScriptFile($this->controller->_static_public . "/js/jquery/jquery.js");
     Yii::app()->clientScript->registerScriptFile($this->controller->_static_public . "/js/My97DatePicker/WdatePicker.js", CClientScript::POS_END);
     $this->controller->render('list_trade', array('lists' => $lists, 'pages' => $pages, 'create_time_start' => $create_time_start, 'create_time_end' => $create_time_end, 'trade_type' => $trade_type, 'trade_status' => $trade_status));
 }
开发者ID:github-zjh,项目名称:task,代码行数:29,代码来源:TradeAction.php

示例6: actionEvents

 public function actionEvents()
 {
     /**
      * @var $task Task
      * @var $cmd CDbCommand
      */
     $result = array('success' => 1);
     if (isset($_GET['from']) && isset($_GET['to'])) {
         $start = date(Task::DF_INTER, intval($_GET['from']) / 1000);
         $end = date(Task::DF_INTER, intval($_GET['to']) / 1000);
         //echo $start."\n".$end;
         $criteria = new CDbCriteria();
         $criteria->addBetweenCondition('start_date', $start, $end);
         if ($this->_user()->role == User::ROLE_USER) {
             $cmd = Yii::app()->db->createCommand();
             $taskIds = $cmd->select('task_id')->from(Job::model()->tableName())->where('organization_id = :id AND (updated_at BETWEEN :start AND :end)', array(':id' => $this->_user()->organization_id, ':start' => $start, ':end' => $end))->queryColumn();
             $criteria->addInCondition('id', $taskIds);
         }
         $tasks = Task::model()->findAll($criteria, array('order' => array('priority' => 'DESC')));
         $data = array();
         foreach ($tasks as $task) {
             $data[] = array('id' => $task->id, 'title' => $task->name, 'url' => Yii::app()->createUrl('task/view', array('id' => $task->id)), 'start' => strtotime($task->created_at) . '000', 'end' => strtotime($task->created_at) + 1800 . '000', 'class' => 'priority-' . $task->priority);
         }
         $result['result'] = $data;
     }
     $this->renderJSON($result);
 }
开发者ID:nsarvar,项目名称:performance,代码行数:27,代码来源:CalendarController.php

示例7: actionExportar

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionExportar()
 {
     $clave = Configuraciones::model()->findByPk(1);
     if ($_POST['clave'] == $clave->super_usuario) {
         if ($_POST['filtro'] == 1) {
             $laFechaDesde = Yii::app()->dateformatter->format("yyyy-MM-dd", $_POST['fecha_desde']);
             $laFechaHasta = Yii::app()->dateformatter->format("yyyy-MM-dd", $_POST['fecha_hasta']);
             $attribs = array('estado' => 'Activo');
             $criteria = new CDbCriteria(array('order' => 'id DESC'));
             $criteria->addBetweenCondition('fecha', $laFechaDesde, $laFechaHasta);
             $rows = Ventas::model()->findAllByAttributes($attribs, $criteria);
         } else {
             $rows = Ventas::model()->findAll("estado = 'Activo'");
         }
         // Export it
         $this->toExcel($rows, array('id::ID', 'paciente.nombreCompleto::Paciente', 'paciente.n_identificacion', 'descripcion', 'forma_pago', 'total1', 'forma_pago2', 'total2', 'tarjeta_tipo', 'tarjeta_aprobacion', 'tarjetaCuentaBanco.numero::Tarjeta Cuenta', 'tarjeta_tipo2', 'tarjeta_aprobacion2', 'tarjetaCuentaBanco2.numero::Tarjeta Cuenta 2', 'sub_total', 'total_iva', 'descuento', 'descuento_valor::Valor con Descuento', 'descuento_total::Total de Descuento', 'total_venta::Total de Venta', 'personal0.nombreCompleto::Realizado por', 'fecha::Fecha'));
     } else {
         Yii::app()->user->setFlash('error', "Clave incorrecta para realizar la exportación.");
         $model = new Ventas('search');
         $model->unsetAttributes();
         // clear any default values
         if (isset($_GET['Ventas'])) {
             $model->attributes = $_GET['Ventas'];
         }
         $this->layout = 'main';
         $lasVentas = Ventas::model()->count();
         if ($lasVentas == 0) {
             $this->render('vacio', array('model' => $model));
         } else {
             $this->render('admin', array('model' => $model));
         }
     }
 }
开发者ID:josterricardo,项目名称:proyecto-cirugia,代码行数:37,代码来源:VentasController.php

示例8: searchTotal

 public function searchTotal()
 {
     // Warning: Please modify the following code to remove attributes that
     // should not be searched.
     $criteria = new CDbCriteria();
     //$criteria->compare('date',$this->date,true);
     $criteria->compare('total_sub', $this->total_sub);
     $criteria->compare('total_unsub', $this->total_unsub);
     $criteria->compare('access_event', $this->access_event);
     $criteria->compare('access_play', $this->access_play);
     $criteria->compare('total_play_all', $this->total_play_all);
     $criteria->compare('total_msisdn_valid', $this->total_msisdn_valid);
     $criteria->compare('listen_music', $this->listen_music);
     $criteria->compare('download_music', $this->download_music);
     $criteria->compare('play_video', $this->play_video);
     $criteria->compare('download_video', $this->download_video);
     $criteria->compare('have_transaction', $this->have_transaction);
     if (is_array($this->date)) {
         $criteria->addBetweenCondition('date', $this->date[0], $this->date[1]);
     } else {
         $criteria->compare('date', $this->date, true);
     }
     $data = GameEventReportAllModel::model()->findAll($criteria);
     return $data;
 }
开发者ID:giangnh264,项目名称:mobileplus,代码行数:25,代码来源:GameEventReportAllModel.php

示例9: ActionOperationLogList

 /**
  * 操作日志列表
  */
 public function ActionOperationLogList()
 {
     $criteria = new CDbCriteria();
     // 判断查询类型 (分页查询 / 条件查询)
     $searchType = Yii::app()->request->getParam('searchType');
     if ($searchType === 'page') {
         $search_condition = unserialize(base64_decode(Yii::app()->request->getParam('search_condition')));
         // 对分布传来的数据进行还原
     } else {
         // 如有搜索条件 则获取条件并过滤条件数组中的空格与空值
         if (!empty($_POST['search'])) {
             foreach ($_POST['search'] as $key => $val) {
                 $search_condition[$key] = trim($val);
             }
             $search_condition = array_filter($search_condition);
         } else {
             $search_condition = '';
         }
     }
     // 增加搜索条件 [S]
     // 搜索条件中包含时间 则添加时间查询条件
     if (!empty($search_condition['start_time']) || !empty($search_condition['end_time'])) {
         // 如起始时间与结束时间一致 则查询同一个时间点的数据
         if (!empty($search_condition['start_time']) && !empty($search_condition['end_time']) && $search_condition['start_time'] == $search_condition['end_time']) {
             $criteria->addSearchCondition('CreationDate', $search_condition['start_time']);
         } else {
             // 1.只按起始时间查询 2.只按结束时间查询 3.按起始+结束时间段查询
             if (!empty($search_condition['start_time']) && empty($search_condition['end_time'])) {
                 $criteria->addCondition('CreationDate >= :start_time');
                 $criteria->params[':start_time'] = $search_condition['start_time'] . ' 23:59:59';
             } else {
                 if (empty($search_condition['start_time']) && !empty($search_condition['end_time'])) {
                     $criteria->addCondition('CreationDate <= :end_time');
                     $criteria->params[':end_time'] = $search_condition['end_time'] . ' 23:59:59';
                 } else {
                     $criteria->addBetweenCondition('CreationDate', $search_condition['start_time'], $search_condition['end_time']);
                 }
             }
         }
     }
     // 搜索条件中包含真实姓名 则添加关联查询及条件
     if (!empty($search_condition['real_name'])) {
         $criteria->with = array('account' => array('joinType' => 'INNER JOIN', 'condition' => 'account.RealName="' . $search_condition['real_name'] . '"'));
     }
     //增加搜索条件 [E]
     // 分页配置
     $criteria->order = 't.ID DESC';
     $count = OperationLog::model()->count($criteria);
     $pager = new CPagination($count);
     if (!empty($search_condition)) {
         //判断是否存在搜索条件,并对搜索条件进行数据处理(便于url传输)
         $pager->params = array('search_condition' => base64_encode(serialize($search_condition)), 'searchType' => 'page');
     }
     $pager->pageSize = 20;
     $pager->applyLimit($criteria);
     // 获取日志列表
     $operation_log_list = OperationLog::model()->findAll($criteria);
     // 跳转至用户操作日志页面
     $this->render('list_operation_log', array('operation_log_list' => $operation_log_list, 'pages' => $pager, 'search_condition' => $search_condition));
 }
开发者ID:lovecheng,项目名称:brs-demo2,代码行数:63,代码来源:OperationLogController.php

示例10: actionExportar

 public function actionExportar()
 {
     $clave = Configuraciones::model()->findByPk(1);
     if ($_POST['clave'] == $clave->super_usuario) {
         if ($_POST['filtro'] == 1) {
             $laFechaDesde = Yii::app()->dateformatter->format("yyyy-MM-dd", $_POST['fecha_desde']);
             $laFechaHasta = Yii::app()->dateformatter->format("yyyy-MM-dd", $_POST['fecha_hasta']);
             $attribs = array();
             $criteria = new CDbCriteria(array('order' => 'id DESC'));
             $criteria->addBetweenCondition('fecha_sola', $laFechaDesde, $laFechaHasta);
             $rows = MedicamentosBiologicos::model()->findAllByAttributes($attribs, $criteria);
         } else {
             $rows = MedicamentosBiologicos::model()->findAll();
         }
         // Export it
         $this->toExcel($rows, array('id::ID', 'medicamento'));
     } else {
         Yii::app()->user->setFlash('error', "Clave incorrecta para realizar la exportación.");
         $model = new MedicamentosBiologicos('search');
         $model->unsetAttributes();
         // clear any default values
         if (isset($_GET['MedicamentosBiologicos'])) {
             $model->attributes = $_GET['MedicamentosBiologicos'];
         }
         $this->render('admin', array('model' => $model));
     }
 }
开发者ID:josterricardo,项目名称:proyecto-cirugia,代码行数:27,代码来源:MedicamentosBiologicosController.php

示例11: actionExportar

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionExportar()
 {
     $clave = Configuraciones::model()->findByPk(1);
     if ($_POST['clave'] == $clave->super_usuario) {
         if ($_POST['filtro'] == 1) {
             $laFechaDesde = Yii::app()->dateformatter->format("yyyy-MM-dd", $_POST['fecha_desde']);
             $laFechaHasta = Yii::app()->dateformatter->format("yyyy-MM-dd", $_POST['fecha_hasta']);
             $attribs = array('estado' => 'Activo');
             $criteria = new CDbCriteria(array('order' => 'id DESC'));
             $criteria->addBetweenCondition('fecha_sola', $laFechaDesde, $laFechaHasta);
             $rows = Egresos::model()->findAllByAttributes($attribs, $criteria);
         } else {
             $rows = Egresos::model()->findAll("estado = 'Activo'");
         }
         // Export it
         $this->toExcel($rows, array('id::ID', 'proveedor.nombre', 'factura.factura_n', 'forma_pago', 'valor_egreso', 'iva_valor', 'total_egreso', 'centroCosto.nombre', 'personal.nombreCompleto', 'fecha_sola::Fecha'));
     } else {
         Yii::app()->user->setFlash('error', "Clave incorrecta para realizar la exportación.");
         $model = new Egresos('search');
         $model->unsetAttributes();
         // clear any default values
         $this->layout = 'main';
         if (isset($_GET['Egresos'])) {
             $model->attributes = $_GET['Egresos'];
         }
         $losEgresos = Egresos::model()->count();
         if ($losEgresos == 0) {
             $this->render('vacio', array('model' => $model));
         } else {
             $this->render('admin', array('model' => $model));
         }
     }
 }
开发者ID:josterricardo,项目名称:proyecto-cirugia,代码行数:37,代码来源:EgresosController.php

示例12: actionIndex

 public function actionIndex()
 {
     // total semua pemasukan
     $criteria = new CDbCriteria();
     $criteria->addBetweenCondition('TANGGAL_ORDER', date('Y-m-01', strtotime('this month')), date('Y-m-t', strtotime('this month')));
     $kredit = Order::model()->findAll($criteria);
     $total = 0;
     foreach ($kredit as $k) {
         $total += $k->TOTAL;
     }
     // menghitung total order
     $order_c = Order::model()->count();
     // menghitung total pasien
     $pelanggan_c = Pasien::model()->count();
     // get data order hari ini
     $criteria2 = new CDbCriteria();
     $criteria2->condition = 'date(TANGGAL_ORDER) = date(NOW())';
     $hariini = Order::model()->count($criteria2);
     // get barang yang tanggal expired
     $expired = Item::getExpired();
     // data obat habis
     $criteria = new CDbCriteria();
     $criteria->order = 'TANGGAL_ORDER DESC';
     $criteria->limit = '5';
     $dataProvider = new CActiveDataProvider('Pasien', array('pagination' => false, 'criteria' => $criteria));
     $this->render('index', array('total' => $total, 'order' => $order_c, 'pelanggan' => $pelanggan_c, 'hariini' => $hariini, 'expired' => $expired));
 }
开发者ID:bangphe,项目名称:klinik,代码行数:27,代码来源:DefaultController.php

示例13: actionExportar

 public function actionExportar()
 {
     $clave = Configuraciones::model()->findByPk(1);
     if ($_POST['clave'] == $clave->super_usuario) {
         if ($_POST['filtro'] == 1) {
             $laFechaDesde = Yii::app()->dateformatter->format("yyyy-MM-dd", $_POST['fecha_desde']);
             $laFechaHasta = Yii::app()->dateformatter->format("yyyy-MM-dd", $_POST['fecha_hasta']);
             $attribs = array();
             $criteria = new CDbCriteria(array('order' => 'id DESC'));
             $criteria->addBetweenCondition('fecha', $laFechaDesde, $laFechaHasta);
             $rows = Presupuesto::model()->findAllByAttributes($attribs, $criteria);
         } else {
             $rows = Presupuesto::model()->findAll();
         }
         // Export it
         $this->toExcel($rows, array('id::ID', 'paciente.nombreCompleto', 'paciente.n_identificacion::Cedula', 'estado', 'fecha', 'total', 'vendedor.nombreCompleto::Vendido Por'));
     } else {
         Yii::app()->user->setFlash('error', "Clave incorrecta para realizar la exportación.");
         $model = new Presupuesto('search');
         $model->unsetAttributes();
         // clear any default values
         $this->layout = 'main';
         if (isset($_GET['Presupuesto'])) {
             $model->attributes = $_GET['Presupuesto'];
         }
         $this->render('admin', array('model' => $model));
     }
 }
开发者ID:josterricardo,项目名称:proyecto-cirugia,代码行数:28,代码来源:PresupuestoController.php

示例14: getCityInRadius

 public static function getCityInRadius($geonameid, $radKm)
 {
     $gradus = $radKm / 111.144;
     $City = City::model()->findByPk($geonameid);
     $criteria = new CDbCriteria();
     $criteria->addBetweenCondition('latitude', $City->latitude - $gradus, $City->latitude + $gradus);
     $criteria->addBetweenCondition('longitude', $City->longitude - $gradus, $City->longitude + $gradus);
     $criteria->select = 'geonameid,latitude,longitude';
     $result = City::model()->findAll($criteria);
     $return = [$geonameid];
     foreach ($result as $row) {
         $dist = self::getDistance($City->latitude, $City->longitude, $row['latitude'], $row['longitude']);
         if ($dist < $radKm * 1000) {
             $return[] = $row['geonameid'];
         }
     }
     return $return;
 }
开发者ID:alexanderkuz,项目名称:test-yii2,代码行数:18,代码来源:City.php

示例15: actionIndex

 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     $user = Yii::app()->user;
     if (Yii::app()->request->isPostRequest) {
         $type = $_POST['type'];
         if ($type == 'login') {
             $identity = new UserIdentity($_POST['LoginForm']['email'], $_POST['LoginForm']['password']);
             if ($identity->authenticate()) {
                 $user->login($identity);
                 $this->redirect('/');
             } else {
             }
         }
         return;
     }
     // renders the view file 'protected/views/site/index.php'
     // using the default layout 'protected/views/layouts/main.php'
     if ($user->isGuest) {
         $this->render('login', array('userinput' => Yii::app()->request->isPostRequest ? $_POST['LoginForm'] : array()));
     } else {
         $criteria = new CDbCriteria();
         if ($user->isChannel()) {
             if ($user->getChannelId()) {
                 $criteria->compare('channel_id', Yii::app()->user->getChannelId());
             } else {
                 echo '此账户尚未开通,请联系管理员';
                 return;
             }
         } else {
             //管理员
             $channel_id = $user->getChannelId();
             if ($user->getChannelId()) {
                 $criteria->compare('channel_id', Yii::app()->user->getChannelId());
             }
         }
         //添加搜索条件
         if ($_GET) {
             $tag = $_GET['tag'];
             $adv_name = $_GET['adv_name'];
             $adv_id = "";
             if ($adv_name) {
                 $advertise = Advertise::model();
                 $adv_id = $advertise->getAdvId($adv_name);
             }
             $startTime = $_GET['startTime'];
             $endTime = $_GET['endTime'];
             $criteria->compare('tag', $tag);
             $criteria->compare('adv_id', $adv_id);
             if ($startTime) {
                 $criteria->addBetweenCondition('date', $startTime, $endTime);
             }
         }
         $criteria->order = "date desc";
         $dataProvider = new CActiveDataProvider('AdvData', array('criteria' => $criteria, 'pagination' => array('pageSize' => 20, 'pageVar' => 'page')));
         $this->render('index', array('attributes' => array('date', 'adv.name', 'tag', 'download_number', 'price', 'total_price', 'star_level'), 'current_channel_id' => $user->getChannelId(), 'channels' => Yii::app()->user->isAdmin() ? Channel::model()->findAll() : array(), 'dataProvider' => $dataProvider));
     }
 }
开发者ID:qyt1988528,项目名称:union,代码行数:61,代码来源:SiteController.php


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