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


PHP Companies::findByProject方法代码示例

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


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

示例1: export

 /**
  * Exports time records
  * 
  * @param void
  * @return null
  */
 function export()
 {
     $object_visibility = array_var($_GET, 'visibility', VISIBILITY_NORMAL);
     $exportable_modules = explode(',', array_var($_GET, 'modules', null));
     if (!is_foreachable($exportable_modules)) {
         $exportable_modules = null;
     }
     // if
     require_once PROJECT_EXPORTER_MODULE_PATH . '/models/ProjectExporterOutputBuilder.class.php';
     $output_builder = new ProjectExporterOutputBuilder($this->active_project, $this->smarty, $this->active_module, $exportable_modules);
     if (!$output_builder->createOutputFolder()) {
         $this->serveData($output_builder->execution_log, 'execution_log', null, FORMAT_JSON);
     }
     // if
     $output_builder->createAttachmentsFolder();
     $timerecords = TimeRecords::findByProject($this->active_project, STATE_VISIBLE, $object_visibility);
     $distinct_months = array();
     foreach ($timerecords as $timerecord) {
         $date = $timerecord->getRecordDate();
         $exists = false;
         for ($x = 0; $x < count($distinct_months); $x++) {
             if ($distinct_months[$x]['month'] == $date->getMonth() && $distinct_months[$x]['year'] == $date->getYear()) {
                 $exists = true;
             }
             // if
         }
         // for
         if (!$exists) {
             $distinct_months[] = array("year" => $date->getYear(), "month" => $date->getMonth(), "month_string" => $date->date_data['month'], "beginning_of_month" => DateTimeValue::beginningOfMonth($date->getMonth(), $date->getYear()), "end_of_month" => DateTimeValue::endOfMonth($date->getMonth(), $date->getYear()));
         }
         // if
     }
     // foreach
     $people = ProjectUsers::findUsersByProject($this->active_project);
     $companies = Companies::findByProject($this->active_project);
     $total_times = array();
     foreach ($people as $person) {
         $person->temp_total_time = TimeRecords::getTotalUserTimeOnProject($this->active_project, $person);
     }
     // foreach
     $output_builder->setFileTemplate($this->active_module, $this->controller_name, 'index');
     $output_builder->smarty->assign(array("distinct_months" => $distinct_months, "people" => $people, "companies" => $companies, "total_times" => $total_times, "timerecords" => $timerecords));
     $output_builder->outputToFile('index');
     // export monthly report
     if (is_foreachable($distinct_months)) {
         $output_builder->setFileTemplate($this->active_module, $this->controller_name, 'monthly');
         foreach ($distinct_months as $distinct_month) {
             $output_builder->smarty->assign(array('current_month' => $distinct_month, 'start_date' => DateTimeValue::beginningOfMonth($distinct_month[month], $distinct_month['year']), 'end_date' => DateTimeValue::endOfMonth($distinct_month['month'], $distinct_month['year'])));
             $output_builder->outputToFile('monthly_' . $distinct_month['month'] . '_' . $distinct_month['year']);
         }
         // foreach
     }
     // if
     // export report for persons
     if (is_foreachable($people)) {
         $output_builder->setFileTemplate($this->active_module, $this->controller_name, 'person');
         foreach ($people as $person) {
             $output_builder->smarty->assign(array('current_person' => $person));
             $output_builder->outputToFile('user_' . $person->getId());
         }
         // foreach
     }
     // if
     $this->serveData($output_builder->execution_log, 'execution_log', null, FORMAT_JSON);
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:71,代码来源:TimetrackingController.class.php


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