コード例 #1
0
ファイル: DataTable.php プロジェクト: sam-it/yii1-datatables
 protected function createDataArray()
 {
     \Yii::beginProfile('createDataArray');
     $data = [];
     Yii::beginProfile('getData');
     if (!$this->config['serverSide']) {
         $paginator = $this->dataProvider->getPagination();
         if ($this->dataProvider instanceof \CActiveDataProvider) {
             $this->dataProvider->criteria->order = '';
         }
         $this->dataProvider->setPagination(false);
         $source = $this->dataProvider->getData(true);
         $this->dataProvider->setPagination($paginator);
     } else {
         $source = $this->dataProvider->getData();
     }
     Yii::endProfile('getData');
     Yii::beginProfile('renderCells');
     // Get column name map.
     $names = array_map([$this, 'getColumnName'], $this->columns);
     foreach ($source as $i => $r) {
         $row = [];
         foreach ($this->columns as $j => $column) {
             $name = $names[$j];
             $row[$name] = $column->getDataCellContent($i);
         }
         $metaRow = [];
         if ($this->addMetaData !== false) {
             Yii::beginProfile('addMetaData');
             if (is_callable([$r, 'getKeyString'])) {
                 $metaRow['data-key'] = call_user_func([$r, 'getKeyString']);
             }
             if (is_array($this->addMetaData)) {
                 foreach ($this->addMetaData as $field) {
                     $metaRow["data-{$field}"] = \CHtml::value($r, $field);
                 }
             }
             Yii::endProfile('addMetaData');
         }
         if (isset($this->rowCssClassExpression)) {
             $metaRow['class'] = $this->evaluateExpression($this->rowCssClassExpression, array('row' => $i, 'data' => $r));
         }
         $row['metaData'] = $metaRow;
         $data[] = $row;
     }
     \Yii::endProfile('renderCells');
     \Yii::endProfile('createDataArray');
     return $data;
 }
コード例 #2
0
 public function actionFeed()
 {
     Yii::import('aiajaya.extensions.efeed.*');
     // RSS 2.0 is the default type
     $feed = new EFeed();
     $feed->title = 'Gästebuch von ' . Yii::app()->name;
     $feed->description = 'Das Gästebuch vom ' . Yii::app()->name;
     $feed->addChannelTag('language', 'de-de');
     $feed->addChannelTag('pubDate', date(DATE_RSS, time()));
     $feed->addChannelTag('link', $this->createAbsoluteUrl('/page/guestbook/list'));
     // * self reference
     $feed->addChannelTag('atom:link', $this->createAbsoluteUrl('/page/guestbook/feed'));
     $criteria = new CDbCriteria(array('order' => '`createDate` DESC'));
     $dataProvider = new CActiveDataProvider('Comment', array('pagination' => array('pageSize' => 0), 'criteria' => $criteria));
     foreach ($dataProvider->getData() as $comment) {
         $item = $feed->createNewItem();
         $item->title = $comment->getBaseModel()->commentName;
         $item->link = $this->createAbsoluteUrl('/page/page/get', array('key' => $comment->getBaseModel()->key));
         $item->date = $comment->createDate;
         $item->description = $comment->message;
         $item->addTag('author', $comment->name);
         //$item->addTag('guid', 'http://www.ramirezcobos.com/',array('isPermaLink'=>'true'));
         $feed->addItem($item);
     }
     $feed->generateFeed();
     Yii::app()->end();
 }
コード例 #3
0
 public function actionGetBidHistory($id)
 {
     $dataAdapter = new CActiveDataProvider('Bidding', array('criteria' => array('condition' => 'fk_user = 1', 'limit' => '10', 'order' => 'id_bidding DESC')));
     $this->apiResponse['data'] = $dataAdapter->getData();
     $this->apiResponse['success'] = true;
     $this->sendResponse();
 }
コード例 #4
0
ファイル: UsersController.php プロジェクト: dsyman2/X2CRM
 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id)
 {
     $user = User::model()->findByPk($id);
     $dataProvider = new CActiveDataProvider('Actions', array('criteria' => array('order' => 'complete DESC', 'condition' => 'assignedTo=\'' . $user->username . '\'')));
     $actionHistory = $dataProvider->getData();
     $this->render('view', array('model' => $this->loadModel($id), 'actionHistory' => $actionHistory));
 }
 public function actionIndex()
 {
     if (Yii::app()->user->isGuest) {
         Yii::app()->user->loginRequired();
     }
     $settings = array();
     // Get user settings.
     $criteria = new CDbCriteria(array('condition' => 'uid=' . Yii::app()->user->id));
     $dataProvider = new CActiveDataProvider('DashboardPortlet', array('criteria' => $criteria));
     $data = $dataProvider->getData();
     if (isset($data[0])) {
         $userSettings = unserialize($data[0]->settings);
         foreach ($userSettings as $class => $properties) {
             $settings[$properties['column']][$properties['weight']] = array('class' => $class, 'visible' => $properties['visible'], 'weight' => $properties['weight']);
         }
         foreach ($settings as $key => $value) {
             // Sort all portlets in every column by weight.
             ksort($settings[$key]);
         }
     }
     // Use the default portlets settings if user did not set any portlet before.
     if (empty($settings)) {
         $deaultSettings = $this->getModule()->portlets;
         foreach ($deaultSettings as $class => $properties) {
             $column = isset($properties['column']) ? $properties['column'] : 0;
             $settings[$column][$properties['weight']] = array('class' => $class, 'visible' => isset($properties['visible']) ? $properties['visible'] : true, 'weight' => $properties['weight']);
         }
     }
     $this->render('index', array('portlets' => $settings));
 }
コード例 #6
0
 /**
  * getListItems - Phương thức dùng để lấy dữ liệu
  */
 public function getListItems($category_id = null)
 {
     Yii::import('application.modules.products.models.ProductItem');
     $model = new ProductItem('search');
     $model->unsetAttributes();
     $criteria = new CDbCriteria();
     $criteria->order = 'created DESC';
     if ($category_id) {
         Yii::import('application.modules.products.models.ProductCategory');
         $categories = ProductCategory::model()->findByPk($category_id);
         if (!$categories) {
             return null;
         }
         $this->__category = $categories;
         $descendants = $categories->descendants()->findAll('is_active = 1');
         $arrCat = array($category_id);
         foreach ($descendants as $cat) {
             $arrCat[] = $cat->id;
         }
         $criteria->with = array('categoryitem');
         $criteria->together = true;
         foreach ($arrCat as $cat) {
             $criteria->compare('categoryitem.category_id', $cat, false, 'OR');
         }
     }
     $criteria->compare('status', 1);
     $search = new CActiveDataProvider($model, array('criteria' => $criteria, 'pagination' => array('pageSize' => Yii::app()->getModule('products')->entriesShow)));
     $data = $search->getData();
     $this->__pagination = $search->pagination;
     return $data;
 }
コード例 #7
0
 /**
  * Manages all models.
  */
 public function actionDashboard()
 {
     /* Wall Post */
     $model = new OmmuWalls();
     /* Get Walll */
     $criteria = new CDbCriteria();
     $criteria->condition = 'publish = :publish';
     $criteria->params = array(':publish' => 1);
     $criteria->order = 'creation_date DESC';
     $dataProvider = new CActiveDataProvider('OmmuWalls', array('criteria' => $criteria, 'pagination' => array('pageSize' => 5)));
     $data = '';
     $wall = $dataProvider->getData();
     if (!empty($wall)) {
         foreach ($wall as $key => $item) {
             $data .= Utility::otherDecode($this->renderPartial('/wall/_view', array('data' => $item), true, false));
         }
     }
     $pager = OFunction::getDataProviderPager($dataProvider);
     if ($pager[nextPage] != '0') {
         $summaryPager = 'Displaying 1-' . $pager[currentPage] * $pager[pageSize] . ' of ' . $pager[itemCount] . ' results.';
     } else {
         $summaryPager = 'Displaying 1-' . $pager[itemCount] . ' of ' . $pager[itemCount] . ' results.';
     }
     $nextPager = $pager['nextPage'] != 0 ? Yii::app()->createUrl('wall/get', array($pager['pageVar'] => $pager['nextPage'])) : 0;
     $this->pageTitle = Yii::t('phrase', 'Welcome') . ', ' . Yii::app()->user->displayname . '!';
     $this->pageDescription = Yii::t('phrase', 'Welcome to your social network control panel. Here you can manage and modify every aspect of your social network. Directly below, you will find a quick snapshot of your social network including some useful statistics.');
     $this->pageMeta = '';
     $this->render('application.webs.admin.admin_dashboard', array('model' => $model, 'data' => $data, 'pager' => $pager, 'summaryPager' => $summaryPager, 'nextPager' => $nextPager));
 }
コード例 #8
0
 public function actionExcel($id)
 {
     $po = $this->loadModel($id);
     $poItemCriteria = new CDbCriteria();
     $poItemCriteria->with = array('material');
     $poItemCriteria->compare('po_number', $id);
     $poItemDataProvider = new CActiveDataProvider('PoItems', array('criteria' => $poItemCriteria, 'pagination' => false));
     Yii::import('ext.phpexcel.XPHPExcel');
     $objPHPExcel = XPHPExcel::createPHPExcel();
     $objReader = PHPExcel_IOFactory::createReader('Excel5');
     $objPHPExcel = $objReader->load(Yii::app()->basePath . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . "templates" . DIRECTORY_SEPARATOR . "PO_Template.xls");
     $objPHPExcel->getProperties()->setCreator(Yii::app()->user->name)->setLastModifiedBy(Yii::app()->user->name)->setTitle("PO Order-" . $id);
     //->setSubject("Office 2007 XLSX Test Document")
     //->setDescription("Sales Order#")
     //->setKeywords("office 2007 openxml php")
     //->setCategory("Test result file");
     // Add the data
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue('C2', $po->po_number)->setCellValue('C3', Yii::app()->dateFormatter->formatDateTime($po->maturity_date, "short", null))->setCellValue('C4', Yii::app()->dateFormatter->formatDateTime($po->created, "short", null))->setCellValue('C5', Yii::app()->dateFormatter->formatDateTime($po->updated, "short", null))->setCellValue('E2', $po->comp->name)->setCellValue('E3', $po->contact)->setCellValue('E4', $po->contact_telephone)->setCellValue('C6', $po->paymentTerm->description)->setCellValue('C7', $po->is_open ? "Open" : "Closed")->setCellValue('A8', "Comments:\r" . $po->comments);
     $row = 13;
     //$i = 1;
     // Write the sale items now
     $items = $poItemDataProvider->getData();
     foreach ($items as $item) {
         $objPHPExcel->setActiveSheetIndex(0)->setCellValue("B" . $row, $item->material->cat->description . "-" . $item->material->description)->setCellValue("D" . $row, $item->qty)->setCellValue("E" . $row, $item->qty_units)->setCellValue("F" . $row, $item->unit_price)->setCellValue("G" . $row, $item->price_units)->setCellValue("H" . $row, $item->qty_recieved)->setCellValue("I" . $row, $item->qty_diff);
         //$i++;
         $row++;
     }
     $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
     // Redirect output to a client’s web browser
     //header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
     header('Content-Type: application/vnd.ms-excel');
     header('Content-Disposition: attachment;filename=' . '"PurchaseOrder-' . $id . '.xls"');
     header('Cache-Control: max-age=0');
     $objWriter->save('php://output');
 }
コード例 #9
0
 public function actionIndex()
 {
     $with = array('active_keywords');
     $whereType = "and t.type='" . Globals::TYPE_REGISTRATION . "' and active_keywords.type='" . Globals::TYPE_ACTIVE . "'";
     $this->layout = '//layouts/memberList';
     $dataProvider = new CActiveDataProvider('ActiveModel', array('criteria' => array('order' => 't.id DESC', 'with' => $with, 'condition' => "t.wechatId = {$this->wechatInfo->id} {$whereType}", 'together' => true), 'pagination' => array('pageSize' => Page::SIZE, 'pageVar' => 'page')));
     $this->render('index', array('data' => $dataProvider->getData(), 'pages' => $dataProvider->getPagination(), 'wechatInfo' => $this->wechatInfo));
 }
コード例 #10
0
ファイル: SiteController.php プロジェクト: nellka/mebel
 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     //$this->redirect('/card/index');
     //$dataProvider=new CActiveDataProvider('Product');
     $dataProvider = new CActiveDataProvider('Product', array('pagination' => array('pageSize' => 100)));
     $products = $dataProvider->getData();
     $model = new Order();
     $this->render('index', compact('model', 'products'));
 }
コード例 #11
0
ファイル: Controller.php プロジェクト: tiger2soft/travelman
 /**
  * 手机客户端的分页,防止分页重复,与网页显示无关
  * @param  CActiveDataProvider $dataProvider
  *
  */
 public function page(CActiveDataProvider &$dataProvider, $more = true)
 {
     $total = $dataProvider->getTotalItemCount();
     $pageSzie = $dataProvider->getPagination()->getPageSize();
     $dataProvider->getPagination()->pageVar = 'page';
     $pageCount = ceil($total / $pageSzie);
     if ($dataProvider->getTotalItemCount() == 0) {
         $this->send(ERROR_EMPTY, 'data empty', $more);
     } else {
         if (isset($_GET['page'])) {
             if ($pageCount >= $_GET['page']) {
                 $this->send(0, $dataProvider->getData(), $more, array('page' => $pageCount));
             }
         } else {
             $this->send(ERROR_NONE, $dataProvider->getData(), $more, array('page' => $pageCount));
         }
     }
 }
コード例 #12
0
 /**
  * @param bool $ajax
  */
 public function actionIndex($ajax = false)
 {
     if ($ajax) {
         $dataProvider = new CActiveDataProvider('SurveillanceSections', ['criteria' => ['condition' => "tool='surveillance'", 'select' => 'sectionId, sectionName, description']]);
         echo CJSON::encode(['aaData' => $dataProvider->getData()]);
         return;
     }
     $this->render('index');
 }
コード例 #13
0
 public function getRoomTypeList()
 {
     $dataProvider = new CActiveDataProvider('RoomType');
     $roomTypes = $dataProvider->getData();
     $roomTypesDropdown = array();
     foreach ($roomTypes as $roomType) {
         $roomTypesDropdown[$roomType->id] = $roomType->description;
     }
 }
コード例 #14
0
 public function actionIndex()
 {
     $roleDataProvider = new CActiveDataProvider('AuthItem', array('criteria' => array('condition' => 'type=2')));
     echo '<pre>';
     var_dump($roleDataProvider->getData());
     echo '</pre>';
     exit;
     $this->render('index');
 }
コード例 #15
0
 public function run($args)
 {
     ignore_user_abort(true);
     set_time_limit(0);
     $dataProvider = new CActiveDataProvider('Category', array('criteria' => array('order' => 'id ASC'), 'pagination' => false));
     foreach ($dataProvider->getData() as $category) {
         echo $category->name;
     }
 }
コード例 #16
0
ファイル: NavPage.php プロジェクト: stan5621/jp_edu_online
 /**
  * 将page组装成nav item
  * Enter description here ...
  */
 public static function getPageItems()
 {
     $pageDataProvider = new CActiveDataProvider('BottomText', array('criteria' => array('order' => 'weight asc ')));
     $items = array();
     foreach ($pageDataProvider->getData() as $page) {
         $item['content'] = $page->content;
         $items[] = $item;
     }
     return $items;
 }
コード例 #17
0
 public function actionFindUser($group, $term)
 {
     $dataProvider = new CActiveDataProvider('User', array('criteria' => array('select' => array('id', 'email')), 'pagination' => array('pageSize' => 500)));
     $criteria = $dataProvider->getCriteria();
     $criteria->compare('email', $term, true);
     $result = CHtml::listData($dataProvider->getData(), 'id', 'email');
     $members = Yii::app()->db->createCommand()->select('userid')->from(AuthAssignment::model()->tableName())->where('itemname=:group', array(':group' => $group))->queryColumn();
     echo CJSON::encode(array_diff_key($result, array_flip($members)));
     Yii::app()->end();
 }
コード例 #18
0
 /**
  * Lists all models.
  * @param $ajax bool
  */
 public function actionIndex($ajax = false)
 {
     if ($ajax) {
         $dataProvider = new CActiveDataProvider('EconomicMethods', ['criteria' => ['with' => ['econMethodGroup']]]);
         //			print_r($dataProvider->getData()); die;
         echo json_encode(['aaData' => ModelToArray::convertModelToArray($dataProvider->getData())]);
         return;
     }
     $this->render('index');
 }
コード例 #19
0
 /**
  * Lists all models.
  * @param $ajax bool
  */
 public function actionIndex($ajax = false)
 {
     if ($ajax) {
         $dataProvider = new CActiveDataProvider('EvaAttributesAssessmentMethods', ['criteria' => ['with' => ['evaAttributes']]]);
         //print_r(ModelToArray::convertModelToArray($dataProvider->getData())); die;
         echo json_encode(['aaData' => ModelToArray::convertModelToArray($dataProvider->getData())]);
         return;
     }
     $this->render('index');
 }
コード例 #20
0
ファイル: GroupController.php プロジェクト: 00606/wechat
 public function actionUser()
 {
     $this->layout = '//layouts/list';
     $group = GroupModel::model()->findall();
     foreach ($group as $v) {
         $groupList[$v->group_id] = $v->name;
     }
     $dataProvider = new CActiveDataProvider('UserModel', array('criteria' => array('order' => 'uid desc'), 'pagination' => array('pageSize' => Page::SIZE)));
     $this->render('userList', array('data' => $dataProvider->getData(), 'pages' => $dataProvider->getPagination(), 'group' => $groupList));
 }
コード例 #21
0
ファイル: DefaultController.php プロジェクト: kostya1017/our
    public function actionIndex($confirm = 0)
    {
        $this->layout = '//layouts/column1';
        if ($confirm) {
            $this->render('cvconfirm');
        } else {
            $formModel = new JobForm();
            $cvModel = new JobCv();
            $job = new Job();
            $jobProvider = new CActiveDataProvider('Job', array('criteria' => array('condition' => 'active = 1', 'order' => 'category_id ASC, title ASC'), 'pagination' => false));
            $jobCategory = JobCategory::model()->findAll();
            foreach ($jobProvider->getData() as $data) {
                $formModel->{$data['id']} = null;
            }
            if (isset($_POST['JobForm'])) {
                $listJob = '<ul>';
                $oneChecked = false;
                foreach ($_POST['JobForm'] as $key => $item) {
                    if (is_numeric($key) && $item == '1') {
                        $oneChecked = true;
                        $jobChecked = Job::model()->findByPk($key);
                        $listJob .= '<li>' . $jobChecked->title . ' (' . $jobChecked->category->name . ')</li>';
                    }
                }
                $listJob .= '</ul>';
                $cvModel->date = date('Y-m-d H:i:s');
                $cvModel->cv = $_POST['JobCv']['cv'];
                if (!$oneChecked) {
                    $cvModel->addError('cv', Yii::t('jobModule.common', 'Vous devez cocher au moins un emploi'));
                } elseif ($cvModel->save()) {
                    foreach ($_POST['JobForm'] as $attribute => $value) {
                        if (is_numeric($attribute) && $value == '1') {
                            $jobId = (int) $attribute;
                            Yii::app()->db->createCommand('INSERT INTO job_job_cv (job_id, job_cv_id) VALUES (:job_id, :job_cv_id)')->execute(array(':job_id' => $jobId, ':job_cv_id' => $cvModel->id));
                        }
                    }
                    $subject = 'Postulation pour une offre d’emploi';
                    $body = '
					<p>Bonjour,<br/><br/>
					Vous avez reçu une candidature pour un ou plusieurs emplois à partir du site Web d`Arianne Phosphate Inc.<br/>
					' . $listJob . '<br/>
					<a href="' . $this->createAbsoluteUrl('admincv/read', array('id' => $cvModel->id)) . '">Voir les détails de la candidature</a><br/><br/>
					</p>
					';
                    $attachment = "./" . $cvModel->cvHandler->dir . "/" . Helper::encodeFileName($cvModel->cv);
                    if (($mailerError = Helper::sendMail($this->module->cvEmail, $subject, $body, $attachment)) !== true) {
                        throw new CHttpException(500, $mailerError);
                    }
                    $this->redirect($this->createUrl('index', array('confirm' => 1)));
                }
            }
            $this->render('index', array('jobProvider' => $jobProvider, 'categories' => $jobCategory, 'formModel' => $formModel, 'cvModel' => $cvModel));
        }
    }
コード例 #22
0
ファイル: CustomerController.php プロジェクト: zwq/unpei
 public function actionSelfquestion()
 {
     $criteria = new CDbCriteria();
     $criteria->order = 'ID DESC';
     $criteria->addCondition("Promoter = '" . Yii::app()->user->getOrganID() . "'");
     //接收表单数据(查询条件)
     $title = Yii::app()->request->getParam("Title");
     $organName = Yii::app()->request->getParam("OrganName");
     $state = Yii::app()->request->getParam("State");
     if (!empty($title)) {
         $criteria->addSearchCondition("Title", "{$title}");
     }
     if (!empty($organName)) {
         $criteria->addSearchCondition("OrganName", "{$organName}");
     }
     if (!empty($state)) {
         $criteria->addCondition("State = {$state}");
     }
     $dataProvider = new CActiveDataProvider('Question', array('criteria' => $criteria, 'pagination' => array('pageSize' => '15')));
     $data = $dataProvider->getData();
     foreach ($data as $key => $val) {
         $val['SubmitTime'] = date("Y-m-d h:i:s", $val['SubmitTime']);
         //状态
         if ($val['State'] == 1) {
             $val['State'] = "待分配";
         } elseif ($val['State'] == 2) {
             $val['State'] = "待解答";
         } elseif ($val['State'] == 3) {
             $val['State'] = "待反馈";
         } elseif ($val['State'] == 4) {
             $val['State'] = "完结";
         } elseif ($val['State'] == 5) {
             $val['State'] = "重新开启";
         } elseif ($val['State'] == 6) {
             $val['State'] = "待回访";
         }
         //类型
         if ($val['Type'] == 1) {
             $val['Type'] = "账号问题";
         } elseif ($val['Type'] == 2) {
             $val['Type'] = "交易问题";
         } elseif ($val['Type'] == 3) {
             $val['Type'] = "商品问题";
         } elseif ($val['Type'] == 4) {
             $val['Type'] = "数据问题";
         } elseif ($val['Type'] == 5) {
             $val['Type'] = "意见和建议";
         } elseif ($val['Type'] == 6) {
             $val['Type'] = "其他";
         }
     }
     $this->render("selfquestion", array('dataProvider' => $dataProvider, 'title' => $title, 'organName' => $organName, 'state' => $state));
 }
コード例 #23
0
ファイル: NewsController.php プロジェクト: hntvu/db_for_site
 /**
  * Lists all models.
  */
 public function actionIndex($controller, $alias = NULL)
 {
     if ($alias != NULL) {
         $model = new News();
         $criteria = new CDbCriteria();
         $criteria->join = 'INNER JOIN menu c ON c.id = t.idmenu';
         $criteria->condition = 'c.alias="' . $alias . '"' . ' AND c.controller ="' . $controller . '"';
         $criteria->order = 'datecreate DESC';
         $dataProvider = new CActiveDataProvider('News', array('criteria' => $criteria, 'pagination' => array('pageSize' => 3)));
         $model = $dataProvider->getData();
         $this->render('index', array('dataProvider' => $dataProvider, 'model' => $model));
     }
 }
コード例 #24
0
ファイル: ArticleController.php プロジェクト: piond/new_rsud
 protected function getArticleTags($id)
 {
     $tag = array();
     $criteria = new CDbCriteria(array('alias' => '_articletags', 'condition' => '_articletags.article_id=' . $id, 'with' => array('tags' => array('alias' => '_tags', 'order' => 'tag'))));
     $dataProvider = new CActiveDataProvider('Articletags', array('criteria' => $criteria));
     foreach ($dataProvider->getData() as $tags) {
         $_tagsId = $tags['tags']['tag_id'];
         $_tagName = $tags['tags']['tag'];
         $tag[$_tagsId] = $_tagName;
     }
     $tag = implode($tag, ',');
     return $tag;
 }
コード例 #25
0
 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id)
 {
     $model = $this->loadModel($id);
     $criteria = new CDbCriteria();
     $criteria->compare('invoice_id', $id);
     $invoice_transaction = new CActiveDataProvider('Transaction', array('criteria' => $criteria));
     $total_amount = 0;
     foreach ($invoice_transaction->getData() as $key) {
         $total_amount = $total_amount + $key->total;
     }
     $criteriaCustomer = new CDbCriteria();
     $criteriaCustomer->compare('id', $model->customer_id);
     $customer = new CActiveDataProvider('Customer', array('criteria' => $criteriaCustomer));
     $this->render('view', array('customer' => $customer, 'model' => $model, 'invoice_transaction' => $invoice_transaction, 'total_amount' => $total_amount));
 }
コード例 #26
0
 public function actionIndex($to_user_id = null)
 {
     $to_user = User::model()->throw404IfNull()->findByPk($to_user_id);
     $user_id = Yii::app()->user->id;
     $criteria = new CDbCriteria();
     $criteria->order = 'date_create DESC';
     $criteria->addCondition("to_user_id = {$user_id} OR from_user_id = {$user_id}");
     if ($to_user_id) {
         $criteria->addCondition("to_user_id = {$to_user_id} OR from_user_id = {$to_user_id}");
     }
     $data_provider = new CActiveDataProvider('Message', array('criteria' => $criteria));
     $messages = $data_provider->getData();
     krsort($messages);
     $this->render('index', array('messages' => $messages, 'to_user' => $to_user));
 }
コード例 #27
0
ファイル: TbKanbanListView.php プロジェクト: GsHatRed/Yiitest
 public function renderKanban()
 {
     $data = $this->dataProvider->getData();
     $n = count($data);
     echo "<ul class=\"kanban-ul\">\n";
     if ($n > 0) {
         for ($i = 0; $i < $n; ++$i) {
             $this->renderCard($i);
         }
     } else {
         $this->renderEmptyText();
     }
     echo "</ul>\n";
     echo "<div class=\"clearfix\"></div>\n";
 }
コード例 #28
0
ファイル: ReserveController.php プロジェクト: zwq/unpei
 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));
 }
コード例 #29
0
ファイル: OpenController.php プロジェクト: 00606/wechat
 public function actionReplay()
 {
     $this->layout = '/layouts/memberList';
     $type = Yii::app()->request->getParam('type');
     $type = $type ? $type : GiftModel::TYPE_KEYWORDS;
     switch ($type) {
         case GiftModel::TYPE_KEYWORDS:
             $with = array('open_keywords', 'open_openPlatForm');
             $whereType = " and t.type ='" . GiftModel::TYPE_KEYWORDS . "' and open_keywords.type='" . OpenReplayModel::OPEN_TYPE . "'";
             break;
         case GiftModel::TYPE_MENU:
             $with = array('open_menuaction', 'open_openPlatForm');
             $whereType = " and t.type ='" . GiftModel::TYPE_MENU . "'";
             break;
     }
     $dataProvider = new CActiveDataProvider('OpenReplayModel', array('criteria' => array('order' => 't.id DESC', 'with' => $with, 'condition' => "t.wechatId = {$this->wechatInfo->id} {$whereType}", 'together' => true), 'pagination' => array('pageSize' => Page::SIZE, 'pageVar' => 'page')));
     $this->render('replay', array('data' => $dataProvider->getData(), 'pages' => $dataProvider->getPagination(), 'type' => $type, 'wechatInfo' => $this->wechatInfo));
 }
コード例 #30
0
ファイル: WheelController.php プロジェクト: 00606/wechat
 public function actionIndex()
 {
     $type = Yii::app()->request->getParam('type');
     $type = $type ? $type : Globals::TYPE_KEYWORDS;
     switch ($type) {
         case Globals::TYPE_KEYWORDS:
             $with = array('wheel_keywords');
             $whereType = "and t.type='" . Globals::TYPE_KEYWORDS . "'\n                and wheel_keywords.type='" . Globals::TYPE_WHEEL . "'";
             break;
         case Globals::TYPE_MENU:
             $with = array('wheel_menuaction');
             $whereType = "and t.type='" . Globals::TYPE_MENU . "'";
             break;
     }
     $this->layout = '//layouts/memberList';
     $dataProvider = new CActiveDataProvider('WheelModel', array('criteria' => array('order' => 't.id DESC', 'with' => $with, 'condition' => "t.wechatId = {$this->wechatInfo->id} {$whereType}", 'together' => true), 'pagination' => array('pageSize' => Page::SIZE, 'pageVar' => 'page')));
     $this->render('index', array('data' => $dataProvider->getData(), 'pages' => $dataProvider->getPagination(), 'type' => $type, 'wechatInfo' => $this->wechatInfo));
 }