本文整理汇总了PHP中CActiveDataProvider::setData方法的典型用法代码示例。如果您正苦于以下问题:PHP CActiveDataProvider::setData方法的具体用法?PHP CActiveDataProvider::setData怎么用?PHP CActiveDataProvider::setData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CActiveDataProvider
的用法示例。
在下文中一共展示了CActiveDataProvider::setData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionView
public function actionView($id)
{
$company = Company::model()->findByPk($id);
if (!$company) {
throw new CHttpException(404, 'Company not found');
}
$usersDataProvider = new CActiveDataProvider(User::class);
$usersDataProvider->setData($company->users);
$usersDataProvider->sort = false;
$this->render('view', ['company' => $company, 'usersDataProvider' => $usersDataProvider]);
}
示例2: actionIndex
/**
* Manages all models.
*/
public function actionIndex($cat = null)
{
if (!$cat) {
$cat = SnapUtil::config('boxomatic/supplier_product_feature_category');
}
$BoxoCart = new BoxoCart();
if (isset($_GET['set-date'])) {
$BoxoCart->setDelivery_date_id($_GET['set-date']);
}
if (isset($_POST['BoxoCart']['location_id'])) {
$BoxoCart->location_id = $_POST['BoxoCart']['location_id'];
$this->refresh();
}
if (isset($_POST['Order']) && isset($_POST['add_to_cart'])) {
if ($BoxoCart->addItems($_POST['Order'])) {
Yii::app()->user->setFlash('success', 'Item added to cart.');
#redirect to category
if ($cat == 'box') {
$this->redirect(array('shop/index', 'date' => Yii::app()->request->getParam('date'), 'cat' => SnapUtil::config('boxomatic/redirectBoxCategory')));
}
}
$this->refresh();
}
if (isset($_POST['Order']) && (isset($_POST['update_cart']) || isset($_POST['checkout']))) {
if ($BoxoCart->updateItems($_POST['Order'])) {
Yii::app()->user->setFlash('success', 'Cart updated.');
}
if (isset($_POST['checkout'])) {
$this->redirect(array('shop/checkout'));
}
$this->refresh();
}
$userId = Yii::app()->user->id;
$User = BoxomaticUser::model()->findByPk($userId);
$Category = Category::model()->findByPk($cat);
$DeliveryDate = false;
$dpProducts = false;
$Location = $BoxoCart->Location;
if ($Location) {
if (!$BoxoCart->DeliveryDate) {
$DeliveryDate = $BoxoCart->getNextDeliveryDate();
} else {
$DeliveryDate = $BoxoCart->DeliveryDate;
}
$BoxoCart->setDelivery_date_id($DeliveryDate->id);
$products = SupplierProduct::getAvailableItems($DeliveryDate->id, $cat);
$dpProducts = new CActiveDataProvider('SupplierProduct');
$dpProducts->setData($products);
}
$this->render('index', array('dpProducts' => $dpProducts, 'DeliveryDate' => $DeliveryDate, 'Category' => $Category, 'Customer' => $User, 'curCat' => $cat, 'BoxoCart' => $BoxoCart, 'Location' => $Location));
}
示例3: actionIndex
public function actionIndex()
{
$user = User::model()->findByPk(Yii::app()->user->getId());
$topList = $user->topContacts;
$pieces = explode(',', $topList);
$contacts = array();
foreach ($pieces as $piece) {
$contact = Contacts::model()->findByPk($piece);
if (isset($contact)) {
$contacts[] = $contact;
}
}
$dataProvider = new CActiveDataProvider('Contacts');
$dataProvider->setData($contacts);
$this->render('index', array('dataProvider' => $dataProvider));
}
示例4: actionIndex
public function actionIndex()
{
$OrganID = Yii::app()->user->getOrganID();
$criteria = new CDbCriteria();
$arr['LicensePlate'] = Yii::app()->request->getParam("LicensePlate");
$arr['ReserveTime'] = Yii::app()->request->getParam("ReserveTime");
$ReserveTime = strtotime($arr['ReserveTime']);
$arr['ReserveNum'] = Yii::app()->request->getParam("ReserveNum");
// $arr['Make'] = Yii::app()->request->getParam("Make");
$arr['Car'] = Yii::app()->request->getParam("Car");
$arr['Code'] = Yii::app()->request->getParam("Code");
// $arr['Engine'] = Yii::app()->request->getParam("Engine");
if (!empty($arr['LicensePlate'])) {
// 车牌号
$criteria->addSearchCondition('licenseplate', "{$arr['LicensePlate']}", "AND");
}
// if (!empty($arr['Make'])) {// 厂家
// $criteria->addSearchCondition('Make', "{$arr['Make']}", "AND");
// }
if (!empty($arr['Code'])) {
// 车型编码
$criteria->addCondition("Code = '{$arr['Code']}'", "AND");
}
// if (!empty($arr['Engine'])) {// 发动机
// $criteria->addSearchCondition('Engine', "{$arr['Engine']}", "AND");
// }
if (!empty($arr['ReserveTime'])) {
// 预约时间
$criteria->addSearchCondition('ReserveTime', "{$ReserveTime}", "AND");
}
if (!empty($arr['ReserveNum'])) {
// 预约号
$criteria->addSearchCondition('ReserveNum', "{$arr['ReserveNum']}", "AND");
}
$criteria->order = "t.ID DESC";
//排序条件:t.CreateTime,t.ID倒叙
$criteria->addCondition("t.OrganID = {$OrganID}");
$dataProvider = new CActiveDataProvider('ServiceReserve', array('criteria' => $criteria, 'pagination' => array('pageSize' => '10')));
$data = $dataProvider->getData();
//var_dump($data);die;
foreach ($data as $key => $val) {
$val['ReserveTime'] = date("Y-m-d", $val['ReserveTime']) . " " . $val['BeginTime'] . ":00-" . $val['EndTime'] . ":00";
}
$dataProvider->setData($data);
$this->render('index', array('dataProvider' => $dataProvider, 'arr' => $arr));
}
示例5: actionIndex
public function actionIndex()
{
$this->pageTitle = Yii::app()->name . '-订单总览';
$organID = Yii::app()->user->getOrganID();
$criteria = new CDbCriteria();
$criteria->condition = 't.IsDelete=0 and BuyerID=' . $organID;
$criteria->with = 'goodsinfo';
$criteria->order = 't.CreateTime DESC';
//搜索条件
$this->search($criteria);
//订单数量
$count = OrderService::getordercount($organID);
$dataProvider = new CActiveDataProvider('PapOrder', array('criteria' => $criteria, 'pagination' => array('pageSize' => 5)));
$datas = $dataProvider->getData();
foreach ($datas as $vv) {
foreach ($vv->goodsinfo as $v) {
$v = self::getVersionGoods($v);
}
}
$dataProvider->setData($datas);
$this->render('index', array('dataProvider' => $dataProvider, 'count' => $count));
}
示例6: servicegetmanagelist
public static function servicegetmanagelist()
{
$OrganID = Yii::app()->user->getOrganID();
$criteria = new CDbCriteria();
$criteria->with = array('vehicle' => array('with' => array('owner')));
$criteria->order = "t.UpdateTime DESC,t.ID DESC";
//排序条件:t.CreateTime,t.ID倒叙
$criteria->addCondition("t.OrganID = {$OrganID}", "AND");
$criteria->addCondition("t.Status = 0", "AND");
$dataProvider = new CActiveDataProvider('ServiceRecord', array('criteria' => $criteria, 'pagination' => array('pageSize' => '4')));
// return $dataProvider;
$data = $dataProvider->getData();
foreach ($data as $k => $val) {
if ($val['ServiceType'] == 2) {
$val['ServiceType'] = "配件服务";
} elseif ($val['ServiceType'] == 3) {
$val['ServiceType'] = "全部服务";
} else {
$val['ServiceType'] = "保养服务";
}
}
$dataProvider->setData($data);
return $dataProvider;
}
示例7: toExcel
/**
* Attached action to export a data provider into excel or other formats
* Usage:
* In your controller, create a method
* public function behaviours()
* {
* return array(
* 'eexcelview'=>array(
* 'class'=>'ext.eexcelview.EExcelBehavior',
* ),
* );
* }
* Then, to use
* public function actionToCSV()
* {
* $model = Sala::model()->findAll();
*
* $columns = array(
* 'id',
* 'nombre',
* array(
* 'name' => 'relatedModel.name',
* 'header' => 'Related Model Name',
* 'footer'=>'Total Balance: 10',
* ),
* );
*
* $this->actionExcel($model, $columns, 'MyTitle', array(), 'CSV');
* }
* Of course, this is only a wrapper so you can edit in many ways to allow more specialization
* @param null string|CDataProvider|array $model the data provider for the grid.
* @param null array $columns array with specif columns and its format. Defaults to all attributes.
* @param null string $title title for the file
* @param null array $documentDetails details of the document
* @param null string $exportType format to export (Excel5,Excel2007, PDF, HTML, CSV). Defaults to Excel2007 (xlsx)
*/
public function toExcel($model = null, $columns = array(), $title = null, $documentDetails = array(), $exportType = 'Excel2007')
{
// Be sure to be attached to an instance of CController
if (!$this->owner instanceof CController) {
Yii::log('EExcelBehavior can only be attached to an instance of CControler', 'error', 'system.base.CBehavior');
return;
}
/**
* We need a data provider in order to create a CGridView. Actually we could pass a CActiveDataProvider instance or
* a CArrayDataProvider instance, we should be able to handle both cases
*/
// First, check if is null
if (!isset($model)) {
// Get the controller name as the model
$model = ucfirst($this->owner->id);
$dataProvider = new CActiveDataProvider($model);
} elseif (is_string($model)) {
// We fetch all records
$dataProvider = new CActiveDataProvider($model);
} elseif (is_array($model)) {
// If is an array, we assume is an array of Model instance
// so let's add that data to the CDataprovider
if (empty($model)) {
// If we got an empty array as model... we can't do much with that information
Yii::log('Empty array passed as data, nothing to do *here*', 'info', 'system.base.CBehavior');
return;
} else {
// At this point we should do type checking on every entry of the array againts a model
// But as we don't know what model is, we must try and catch an exception
// Get model name
$className = get_class($model[0]);
// get the class from the first element
try {
// Set an CActiveDataProvider for this model
$dataProvider = new CActiveDataProvider($className);
// And add the data
$dataProvider->setData($model);
} catch (Excetion $e) {
// Something went wrong
Yii::log($e->getMessage(), 'info', 'system.base.CBehavior');
return;
}
}
} elseif (is_subclass_of($model, 'CDataProvider')) {
// We use the provided data set
$dataProvider = $model;
} else {
// We have no valid data set
Yii::log('Invalid data set provided', 'error', 'system.base.CBehavior');
return;
}
/**
* Next, we need to check if user passed an array for columns, if not, we define an empty one meaning we want
* all columns by default
*/
if (!is_array($columns)) {
$columns = array();
}
/**
* Finally we export the contents specified
*/
$config = array('title' => $title, 'exportType' => $exportType, 'dataProvider' => $dataProvider, 'columns' => $columns);
$arg = CMap::mergeArray($config, $documentDetails);
$this->owner->widget('ext.eexcelview.EExcelView', $arg);
//.........这里部分代码省略.........
示例8: getOrderlist
public static function getOrderlist($params)
{
$payment = $params['Payment'];
$BuyerName = $params['BuyerName'];
$Status = $params['Status'];
$EvaStatus = $params['EvaStatus'];
$OrderSN = $params['search_text'];
$starttime = $params['starttime'];
$endtime = $params['endtime'];
$pageSize = $params['pageSize'] ? $params['pageSize'] : 10;
$criteria = new CDbCriteria();
$criteria->order = "t.CreateTime desc";
$criteria->condition = "t.SellerID = {$params['OrganID']} and t.IsDelete=0";
//订单类型
if ($payment && in_array($payment, array(1, 2))) {
$criteria->addCondition("t.Payment = {$payment}", "AND");
}
//买家查询
if ($BuyerName) {
$BuyerName = EvaluateService::checkKey(urldecode($BuyerName));
$model = self::getOrgan(array('OrganName' => $BuyerName));
$idArr = array();
foreach ($model as $v) {
$idArr[] = $v->ID;
}
$criteria->addInCondition("t.BuyerID", $idArr);
}
//订单状态
if ($Status && in_array($Status, array(1, 2, 3, 5, 9, 10))) {
if ($Status == 5) {
$criteria->addCondition("t.Status = 3 and t.ReturnStatus!=0", "AND");
} else {
if ($Status == 3) {
$criteria->addCondition("t.Status = 3 and t.ReturnStatus=0", "AND");
} else {
$criteria->addCondition("t.Status = {$Status}", "AND");
}
}
} else {
if ($params['SendStatus']) {
$criteria->addCondition("t.Status in(1,2)", "AND");
}
}
//订单评价
if ($EvaStatus && $EvaStatus == 1) {
$criteria->addCondition("t.EvaStatus in(0,15) and t.Status=9", "AND");
} else {
if ($EvaStatus == 2) {
$criteria->addCondition("t.EvaStatus in(16,20) and t.Status=9", "AND");
}
}
//订单号
if ($OrderSN) {
$OrderSN = EvaluateService::checkKey(urldecode($OrderSN));
$criteria->addCondition("t.OrderSN like '%{$OrderSN}%'");
}
//下单时间
if ($starttime && $endtime) {
$criteria->addCondition("t.CreateTime > {$starttime} and t.CreateTime < {$endtime}+3600*24", 'AND');
} else {
if ($starttime) {
$criteria->addCondition("t.CreateTime > {$starttime}", 'AND');
} else {
if ($endtime) {
$criteria->addCondition("t.CreateTime < {$endtime}+3600*24", 'AND');
}
}
}
$data = new CActiveDataProvider('PapOrder', array('criteria' => $criteria, 'pagination' => array('pageSize' => $pageSize)));
$datas = $data->getData();
foreach ($datas as $vv) {
foreach ($vv->goodsinfo as $v) {
$v = self::getVersionGoods($v);
}
}
$data->setData($datas);
return $data;
}
示例9: getDataProvider
/**
* @inheritdoc
*/
public function getDataProvider(SearchForm $searchForm)
{
$criteria = new CDbCriteria();
$criteria->compare('id', $searchForm->id);
$criteria->compare('username', $searchForm->username, true);
$criteria->compare('email', $searchForm->email, true);
$criteria->compare('firstname', $searchForm->firstName, true);
$criteria->compare('lastname', $searchForm->lastName, true);
$criteria->compare('created_on', $searchForm->createdOn);
$criteria->compare('updated_on', $searchForm->updatedOn);
$criteria->compare('last_visit_on', $searchForm->lastVisitOn);
$criteria->compare('email_verified', $searchForm->emailVerified);
$criteria->compare('is_active', $searchForm->isActive);
$criteria->compare('is_disabled', $searchForm->isDisabled);
$dataProvider = new CActiveDataProvider('User', array('criteria' => $criteria, 'keyAttribute' => 'id'));
$identities = array();
foreach ($dataProvider->getData() as $row) {
$identities[] = self::createFromUser($row);
}
$dataProvider->setData($identities);
return $dataProvider;
}
示例10: actionManageDropDowns
public function actionManageDropDowns()
{
$dataProvider = new CActiveDataProvider('Dropdowns');
$model = new Dropdowns();
$dropdowns = $dataProvider->getData();
foreach ($dropdowns as $dropdown) {
$temp = json_decode($dropdown->options);
$str = "";
foreach ($temp as $item) {
$str .= $item . ", ";
}
$str = substr($str, 0, -2);
$dropdown->options = $str;
}
$dataProvider->setData($dropdowns);
$this->render('manageDropDowns', array('dataProvider' => $dataProvider, 'model' => $model, 'dropdowns' => $dataProvider->getData()));
}
示例11: actionUpdate1
public function actionUpdate1()
{
//SEGUNDA TELA NO UPDATE DE UM TEST CONTEXT
//VERIFICA SE EXISTEM ELEMENTOS QUE AINDA NÃO FORAM USADOS.
//CASO NÃO EXISTAM MAIS ELEMENTOS DISPONÍVEIS, ELE REDIRECIONA AUTOMATICAMNETE PARA A TERCEIRA TELA.
$idTestContext = Yii::app()->user->getState('idTestContext');
$idDevice = Yii::app()->user->getState('idDevice');
//BOTÃO CANCELAR
if (isset($_POST['buttonCancel'])) {
$this->redirect("/mtcontrool/index.php/testContext/admin");
}
$arrayModels = ElementInst::model()->findAll('id_test_context=' . $idTestContext);
$arrayTypes = array();
foreach ($arrayModels as $item) {
$item->sent = $item->behavior_screen;
$arrayTypes[$item->id_element] = $item->element_type;
}
//FUNÇÃO CALLBACK DE ORDENAÇÃO.
function order($a, $b)
{
$retval = strnatcmp($a['id_element'], $b['id_element']);
if (!$retval) {
return strnatcmp($b['description'], $a['description']);
}
return $retval;
}
//VERIFICA QUAIS ELEMENTOS ESTÃO ASSICIADOS AO DEVIDE.
//E CRIA UM NOVO FORM PARA CADA UM DESSES ELEMENTOS
//ISSO PERMITIRÁ QUE NOVAS INSTANCIA DE ELEMENTOS SEJAM CRIADAS.
$arrayExclude = array();
$flag = 0;
$exclude = null;
$elements = new Element();
$elements = Element::model()->with('elementDevices')->findAll('ID_DEVICE=' . $idDevice);
if (sizeof($arrayModels) > 0) {
//$elements=Element::model()->with('elementDevices')->findAll('ID_DEVICE=' . $idDevice);
foreach ($elements as $i => $element) {
$model = new ElementInst();
$model->id_element = $element->id;
$model->id_test_context = $idTestContext;
foreach ($arrayTypes as $key => $value) {
if ($model->id_element == $key) {
$model->element_type = $value;
}
}
if ($model->element_type != '') {
array_push($arrayExclude, $element->id);
} else {
$flag = 1;
}
array_push($arrayModels, $model);
}
//ORDENA O ARRAY DE MODELOS DE FORMA QUE OS MODELOS NÃO PREENCHIDOS FIQUEM POR ULTIMO.
usort($arrayModels, 'order');
$exclude = json_encode($arrayExclude);
if (sizeof($arrayExclude) > 0 and $flag == 1) {
//$this->redirect(Yii::app()->createUrl("/elementInst/create", array("idTestContext"=>$idTestContext,"idDevice"=>$idDevice,"exclude"=>$arrayExclude)));
}
} else {
//$this->redirect(Yii::app()->createUrl("/elementInst/create", array("idTestContext"=>$idTestContext,"idDevice"=>$idDevice)));
}
$arrayExcluded = array();
if ($exclude != null) {
$exclude = json_decode($exclude);
foreach ($elements as $key => $item) {
foreach ($exclude as $value) {
if ($item->id == $value) {
array_push($arrayExcluded, $elements[$key]);
unset($elements[$key]);
}
}
}
$elements = array_values($elements);
}
$listElements = CHtml::listData($elements, 'id', 'description');
$dataProvider = new CActiveDataProvider('Element');
$dataProvider->setData($elements);
//ORDENA O ARRAY DE MODELOS DE FORMA QUE OS MODELOS NÃO PREENCHIDOS FIQUEM POR ULTIMO.
usort($arrayModels, 'order');
$count_elements = 0;
foreach (array_keys($_POST) as $key) {
if (strpos($key, "ElementInst") === 0) {
//Key matches, test value.
$count_elements++;
}
}
//SALVA OS DADOS NO BANCO DE DADOS
$count_saved = 0;
if ($count_elements > 0) {
foreach ($arrayModels as $key => $model) {
if (isset($_POST["description" . $key])) {
if (trim($_POST["description" . $key]) != "") {
$model->description = $_POST["description" . $key];
if ($model->element_type == "interval") {
$model->start_param = $_POST["start_param" . $key];
$model->end_param = $_POST["end_param" . $key];
}
if ($model->save()) {
$count_saved++;
} else {
//.........这里部分代码省略.........
示例12: array
<?php
/* @var $this StatementsController */
/* @var $model Statements */
$this->breadcrumbs = array('Statements' => array('index'), $model->idStatement);
$url = "http://skif.znu.edu.ua:8080/request_report-1.0-1.0-SNAPSHOT/statement.jsp?filter=" . $model->number . "&format=6";
$this->menu = array(array('label' => 'Створити', 'url' => array('create'), 'icon' => "icon-plus-sign"), array('label' => 'Змінити', 'url' => array('update', 'id' => $model->idStatement), 'icon' => " icon-pencil"), array('label' => 'Перелік відомостей', 'url' => array('admin'), 'icon' => "icon-list-alt"), array('label' => 'Перелік слухачів', 'url' => array('/preuniversity/person'), 'icon' => " icon-user"), array('label' => 'Друкувати', 'url' => $url, 'icon' => "icon-print"));
?>
<h1>Відомість № <?php
echo $model->number;
?>
</h1>
<?php
if (isset($model->Subjects1ID)) {
$model->Subjects1ID = $model->subj1->SubjectName;
}
if (isset($model->Subjects2ID)) {
$model->Subjects2ID = $model->subj2->SubjectName;
}
if (isset($model->Subjects3ID)) {
$model->Subjects3ID = $model->subj3->SubjectName;
}
$this->widget('bootstrap.widgets.TbDetailView', array('data' => $model, 'type' => array('bordered', 'condensed', 'striped'), 'attributes' => array('number', 'created', 'specFullName', 'Subjects1ID', 'Subjects2ID', 'Subjects3ID', 'SubjectsDate1', 'SubjectsDate2', 'SubjectsDate3')));
$data = new CActiveDataProvider('Statementpersons');
$data->setData($itemsmodel);
$this->widget('bootstrap.widgets.TbGridView', array('type' => 'striped bordered', 'id' => 'speciality-price-grid', 'dataProvider' => $data, 'template' => "{items}", 'columns' => array(array("name" => "Fio", "header" => "ФИО"), array("name" => "Hash", "header" => "Hash"), array('class' => 'bootstrap.widgets.TbEditableColumn', 'name' => 'Subject1Val', 'editable' => array('url' => $this->createUrl('statements/editfield', array('field' => 'Subject1Val')), 'mode' => 'inline', 'inputclass' => 'span1', 'type' => 'text', 'title' => 'Введіть оцінку')), array('class' => 'bootstrap.widgets.TbEditableColumn', 'name' => 'Subject2Val', 'editable' => array('url' => $this->createUrl('statements/editfield'), 'mode' => 'inline', 'inputclass' => 'span1', 'type' => 'text', 'title' => 'Введіть оцінку')), array('class' => 'bootstrap.widgets.TbEditableColumn', 'name' => 'Subject3Val', 'editable' => array('url' => $this->createUrl('statements/editfield'), 'mode' => 'inline', 'inputclass' => 'span1', 'type' => 'text', 'title' => 'Введіть оцінку')))));
示例13: getrecords
public static function getrecords($Item)
{
$OrganID = Yii::app()->user->getOrganID();
$time = Yii::app()->request->getParam('time');
$criteria = new CDbCriteria();
if ($Item == 1) {
$criteria->addCondition("Item = 1 or Item = 3", "AND");
$criteria->addCondition("OrganID=" . $OrganID, "AND");
} elseif ($Item == 0) {
$criteria->addCondition("Item = 0 or Item = 2", "AND");
$criteria->addCondition("OrganID =" . $OrganID, "AND");
}
if (strtotime(Yii::app()->request->getParam('starttime'))) {
$StartTime = Yii::app()->request->getParam('starttime');
}
if (strtotime(Yii::app()->request->getParam('endtime'))) {
$endtime = Yii::app()->request->getParam('endtime');
}
if (Yii::app()->request->getParam('time')) {
$Time = Yii::app()->request->getParam('time');
}
if ($StartTime && $EndTime) {
$StartTime = strtotime($StartTime);
$EndTime = (int) (strtotime($EndTime) + 60 * 60 * 24);
$criteria->addBetweenCondition('CreateTime', "{$StartTime}", "{$EndTime}", "AND");
} elseif ($StartTime) {
$StartTime = strtotime($StartTime);
$criteria->addCondition("CreateTime >= " . $StartTime);
} elseif ($EndTime) {
$EndTime = (int) (strtotime($EndTime) + 60 * 60 * 24);
$criteria->addCondition("CreateTime <= " . $EndTime, "AND");
}
if ($Time && !$StartTime && !$EndTime) {
$newtime = time();
$datetime = strtotime(date("Y-m-d", $newtime));
if ($Time == 1) {
$criteria->addBetweenCondition('CreateTime', "{$datetime}", "{$newtime}", "AND");
} elseif ($Time == 2) {
$oldtime = (int) ($datetime - 60 * 60 * 24 * 30);
$criteria->addBetweenCondition('CreateTime', "{$oldtime}", "{$newtime}", "AND");
} elseif ($Time == 3) {
$oldtime = (int) ($datetime - 60 * 60 * 24 * 30 * 3);
$criteria->addBetweenCondition('CreateTime', "{$oldtime}", "{$newtime}", "AND");
}
}
// $criteria->addCondition('OrganID =' . $OrganID, 'AND');
// $criteria->addCondition('Item =' . $Item, 'AND');
// $criteria->order = 'ID desc';
$dataProvider = new CActiveDataProvider('PapTransactionRecords', array('criteria' => $criteria));
$datas = $dataProvider->getData();
foreach ($datas as $v) {
if ($v->Item == '2') {
$v->Item = '买方退货:' . $v->BusinessNO;
$v->OrganID = OrderreturnService::idgetname($v->GetID);
$v->view = "<a class='view' href='" . Yii::app()->createUrl('pap/Cashdeposit/info', array('id' => $v->ID)) . "' title='详情'>查看详情</a>";
}
if ($v->Item == '0') {
$v->Item = '充值';
$v->OrganID = '北京嘉配科技有限公司';
$v->view = '';
}
if ($v->Item == '1') {
$v->Item = '充值';
$v->OrganID = OrderreturnService::idgetname($v->OrganID);
$v->view = '';
}
if ($v->Item == '3') {
$v->Item = '违规处罚';
$v->OrganID = CashdepositService::idgetunion($v->GetID);
$v->view = "<a class='view' href='" . Yii::app()->createUrl('pap/Cashdeposit/infos', array('id' => $v->ID)) . "' title='详情'>查看详情</a>";
}
}
$dataProvider->setData($datas);
return $dataProvider;
}
示例14: getDelername2
public static function getDelername2($params)
{
//PapOrder 经销商
$organID = Yii::app()->user->getOrganID();
$criteria = new CDbCriteria();
$criteria->group = 't.SellerID';
$criteria->select = 't.SellerID,t.SellerName ';
$criteria->addCondition("t.BuyerID={$organID} and t.SellerID!='' and t.SellerName!=''");
if ($params['SellerName']) {
$criteria->addCondition("t.SellerName like '%{$params['SellerName']}%'", "AND");
}
$dataProvider = new CActiveDataProvider('PapOrder', array('criteria' => $criteria, 'pagination' => array('pageSize' => 8)));
$data = $dataProvider->getData();
foreach ($data as $key => $value) {
$data[$key] = $value;
$SellerID = $value['SellerID'];
$res = F::getOrgan($SellerID);
$data[$key]['SellerName'] = $res['OrganName'];
}
$data = $dataProvider->setData($data);
return $dataProvider;
}
示例15: getDataProvider
/**
* @inheritdoc
*/
public function getDataProvider(SearchForm $searchForm)
{
$criteria = new CDbCriteria();
$criteria->compare('usuario_id', $searchForm->id);
$criteria->compare('usuario', $searchForm->username, true);
$criteria->compare('codigo_onapre', $searchForm->codigo_onapre, true);
$criteria->compare('correo', $searchForm->email, true);
//$criteria->compare('firstname', $searchForm->firstName,true);
//$criteria->compare('lastname', $searchForm->lastName,true);
$criteria->compare('creado_el', $searchForm->createdOn);
$criteria->compare('actualizado_el', $searchForm->updatedOn);
$criteria->compare('last_visit_on', $searchForm->lastVisitOn);
$criteria->compare('correo_verificado', $searchForm->emailVerified);
$criteria->compare('esta_activo', $searchForm->isActive);
$criteria->compare('esta_deshabilitado', $searchForm->isDisabled);
$dataProvider = new CActiveDataProvider('Usuarios', array('criteria' => $criteria, 'keyAttribute' => 'usuario_id'));
$identities = array();
foreach ($dataProvider->getData() as $row) {
$identities[] = self::createFromUser($row);
}
$dataProvider->setData($identities);
return $dataProvider;
}