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


PHP Operation::include_related方法代码示例

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


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

示例1: get_persons_graph_drilldown_json

 protected function get_persons_graph_drilldown_json($person_id, $filter_orderby)
 {
     $operations = new Operation();
     $operations->select('*');
     $operations->where_related_person('id', (int) $person_id);
     $operations->order_by('created', 'asc');
     $operations->include_related('product_quantity');
     $operations->include_related('product_quantity/product');
     $operations->include_related('service_usage');
     $operations->include_related('service_usage/service');
     $operations->get_iterated();
     $series = array();
     $days = array();
     $days_plus_amount = array();
     $days_minus_amount = array();
     $current_day_index = '';
     foreach ($operations as $operation) {
         $day_index = date('d.m.Y', strtotime($operation->created));
         if ($day_index != $current_day_index) {
             $days_plus_amount[$day_index] = 0;
             $days_minus_amount[$day_index] = 0;
             $days[] = $day_index;
             $current_day_index = $day_index;
         }
         if ($operation->type == Operation::TYPE_ADDITION && (int) $operation->amount > 0) {
             $days_plus_amount[$day_index] += (double) $operation->amount;
         } elseif ($operation->type == Operation::TYPE_SUBTRACTION) {
             if ($operation->subtraction_type == Operation::SUBTRACTION_TYPE_DIRECT && (double) $operation->amount > 0) {
                 $days_minus_amount[$day_index] += (double) $operation->amount;
             } elseif ($operation->subtraction_type == Operation::SUBTRACTION_TYPE_PRODUCTS && !is_null($operation->product_quantity_id) && !is_null($operation->product_quantity_product_id) && (double) $operation->product_quantity_quantity * (double) $operation->product_quantity_price > 0) {
                 $days_minus_amount[$day_index] += (double) $operation->product_quantity_quantity * (double) $operation->product_quantity_price;
             } elseif ($operation->subtraction_type == Operation::SUBTRACTION_TYPE_SERVICES && !is_null($operation->service_usage_id) && !is_null($operation->service_usage_service_id) && (double) $operation->service_usage_quantity * (double) $operation->service_usage_price > 0) {
                 $days_minus_amount[$day_index] += (double) $operation->service_usage_quantity * (double) $operation->service_usage_price;
             }
         }
     }
     $total_plus = 0;
     $total_minus = 0;
     $series_item_start = new stdClass();
     $series_item_start->name = 'Začiatok sústredenia';
     $series_item_start->y = 0;
     $series[] = $series_item_start;
     if (count($days) > 0) {
         foreach ($days as $day) {
             $series_item = new stdClass();
             $series_item->name = $day;
             if ($filter_orderby == 'amount_left') {
                 $total_plus += $days_plus_amount[$day];
                 $total_minus += $days_minus_amount[$day];
                 $series_item->y = $total_plus - $total_minus;
             } elseif ($filter_orderby == 'amount_acquired') {
                 $series_item->y = $days_plus_amount[$day];
             } else {
                 $series_item->y = $days_minus_amount[$day];
             }
             if ($series_item->y > 0 || $filter_orderby == 'amount_left') {
                 $series[] = $series_item;
             }
         }
     }
     $series_item_end = new stdClass();
     $series_item_end->name = 'Koniec sústredenia';
     $series_item_end->y = 0;
     $series[] = $series_item_end;
     return $series;
 }
开发者ID:andrejjursa,项目名称:lstme-ledcoin,代码行数:66,代码来源:ledcoin.php

示例2: transactions

 public function transactions($person_id = NULL, $page_size = 20, $page = 1)
 {
     if (is_null($person_id)) {
         add_error_flash_message('Osoba sa nenašla.');
         redirect(site_url('operations'));
     }
     $person = new Person();
     $person->where('admin', 0);
     $person->get_by_id((int) $person_id);
     if (!$person->exists()) {
         add_error_flash_message('Osoba sa nenašla.');
         redirect(site_url('operations'));
     }
     $operations = new Operation();
     $operations->where_related_person($person);
     $operations->include_related('admin', array('name', 'surname'));
     $operations->include_related('workplace', 'title');
     $operations->order_by('created', 'desc');
     $operations->get_paged_iterated($page, $page_size);
     $this->parser->parse('web/controllers/operations/transactions.tpl', array('person' => $person, 'operations' => $operations, 'title' => 'Administrácia / LEDCOIN / Prehľad transakcií / ' . $person->name . ' ' . $person->surname, 'back_url' => site_url('operations'), 'form' => $this->get_transaction_pagination_form($operations->paged)));
 }
开发者ID:andrejjursa,项目名称:lstme-ledcoin,代码行数:21,代码来源:operations.php


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