Esempio n. 1
0
 function GetPIDOfLaspedContract($days = '')
 {
     global $db;
     $rep_obj = new report();
     $tmp_reporting_table_1 = $rep_obj->SetReportingLink('care_tz_insurance', 'PID', 'care_person', 'pid');
     $tmp_reporting_table_2 = $rep_obj->TMP_GroupBy($tmp_reporting_table_1, 'care_tz_insurance_PID');
     $rep_obj->DisconnectReportingTable($tmp_reporting_table_1);
     $now = time();
     $seconds = $days * 24 * 60;
     $asked_time = $now - $seconds;
     $this->setTable($tmp_reporting_table_2);
     $this->sql = "SELECT selian_pid, date_reg, name_first, name_2, name_3, name_middle, name_last, name_maiden, name_others FROM {$this->coretable} WHERE end_date < {$asked_time}";
     $mysql_ptr = $db->Execute($this->sql);
 }
 /**
  * Contructor.
  *
  * @param string $id An identifier for this table (optional).
  * @retrn none
  */
 function curriculareport($id = '')
 {
     parent::report($id);
     $this->type = 'class';
     $this->title = get_string('reportcurricula', 'block_curr_admin');
     $this->fileformats = array('pdf' => 'PDF', 'csv' => 'CSV', 'excel' => 'Excel');
 }
 /**
  * Contructor.
  *
  * @param string $id An identifier for this table (optional).
  * @retrn none
  */
 function enrolreport($id = '')
 {
     parent::report($id);
     $this->type = 'class';
     $this->title = 'Enrolment Report';
     $this->fileformats = array('pdf' => 'PDF', 'csv' => 'CSV', 'excel' => 'Excel');
 }
 /**
  * Contructor.
  *
  * @param string $id An identifier for this table (optional).
  * @retrn none
  */
 function reclocreport($id = '')
 {
     parent::report($id);
     $this->loc = '';
     $this->usrid = 0;
     $this->type = 'recloc';
     $this->fileformats = array('pdf' => 'PDF', 'csv' => 'CSV', 'excel' => 'Excel');
 }
Esempio n. 5
0
 function _constructor($options)
 {
     if (isset($options['id'])) {
         parent::_construct($options['id']);
     } else {
         parent::_construct();
     }
 }
 /**
  * Contructor.
  *
  * @param string $id An identifier for this table (optional).
  * @retrn none
  */
 function induserreport($id = '')
 {
     parent::report($id);
     $this->usrid = 0;
     $this->hideins = false;
     $this->type = 'induser';
     $this->fileformats = array('pdf' => 'PDF', 'csv' => 'CSV', 'excel' => 'Excel');
 }
 /**
  * Contructor.
  *
  * @param string $id An identifier for this table (optional).
  * @retrn none
  */
 function transcriptreport($id = '')
 {
     parent::report($id);
     $this->usrid = 0;
     $this->hideins = false;
     $this->type = 'induser';
     $this->title = get_string('user_transcript', 'block_curr_admin');
     $this->fileformats = array('pdf' => 'PDF', 'csv' => 'CSV', 'excel' => 'Excel');
 }
 /**
  * Contructor.
  *
  * @param string $id An identifier for this table (optional).
  * @retrn none
  */
 function classrosterreport($id = '')
 {
     parent::report($id);
     $this->clsid = 0;
     $this->hideins = false;
     $this->hidestu = false;
     $this->hidesyl = false;
     $this->type = 'classroster';
     $this->fileformats = array('pdf' => 'PDF', 'csv' => 'CSV', 'excel' => 'Excel');
 }
Esempio n. 9
0
 public static function get_list_with_session($session_id)
 {
     $session = session::get_session($session_id);
     if ($session != null && $session->is_valid()) {
         $user_group = new user_group();
         $report_privileg_list = array();
         $user_group_list = $user_group->get_list(array("user_id"), array($session->user_id));
         for ($i = 0; $i < count($user_group_list); $i++) {
             $report_privileg = new report_privileg();
             $report_privileg_list = array_merge($report_privileg_list, $report_privileg->get_list(array("group_id", "privileg_id"), array($user_group_list[$i]->group_id, report_privileg::PRIVILEG_ID_ACCESS)));
         }
         $report_list = array();
         $report = new report();
         for ($i = 0; $i < count($report_privileg_list); $i++) {
             array_push($report_list, $report->get($report_privileg_list[$i]->report_id));
         }
         $session->update();
         return $report_list;
     }
     return array();
 }
Esempio n. 10
0
 public static function load_structur_with_session($id, $session_id)
 {
     global $dbconnection;
     $object = new report();
     $reportlist = $object->get_list_with_session($session_id);
     $found = false;
     for ($i = 0; $i < count($reportlist); $i++) {
         if ($reportlist[$i]->id * 1 === $id * 1) {
             $object = $reportlist[$i];
             $found = true;
         }
     }
     if ($found === false) {
         return null;
     }
     $rw = new report_wrapper();
     $rw->id = $object->id;
     $rw->name = $object->name;
     $rw->report_element_list = ormlib::get_list_from_instance(new report_element(), array("report_id"), array($id));
     for ($i = 0; $i < count($rw->report_element_list); $i++) {
         $rw->report_element_field_list = array_merge($rw->report_element_field_list, ormlib::get_list_from_instance(new report_element_field(), array("report_element_id"), array($rw->report_element_list[$i]->id)));
     }
     for ($i = 0; $i < count($rw->report_element_field_list); $i++) {
         $rw->report_element_metadata_mapping[] = ormlib::get_from_instance(new metadata_field(), array("id"), array($rw->report_element_field_list[$i]->metadata_field_id));
     }
     $help = ormlib::get_list_from_instance(new report_metadata_condition(), array("report_id"), array($rw->id));
     for ($i = 0; $i < count($help); $i++) {
         $rw->report_metadata_field_condition[] = ormlib::get_from_instance(new metadata_field(), array("id"), array($help[$i]->metadata_field_id));
         $table = ormlib::get_from_instance(new metadata_table(), array("id"), array($rw->report_metadata_field_condition[$i]->metadata_table_id));
         $values = array();
         if ($rw->report_metadata_field_condition[$i]->type * 1 === 1) {
             $result = $dbconnection->do_query_data_response("select " . $rw->report_metadata_field_condition[$i]->name_in_table . " from " . $table->name . " group by " . $rw->report_metadata_field_condition[$i]->name_in_table);
             while ($myrow = mysql_fetch_array($result)) {
                 $values[] = $myrow[0];
             }
         }
         $rw->report_values[$rw->report_metadata_field_condition[$i]->name] = $values;
     }
     return $rw;
 }
Esempio n. 11
0
 function test_makeSqlFilter()
 {
     $this->assertEquals('select * from table where (1 = 1) AND (NPNr = 13)', report::_makeSqlFilter('select * from table where 1=1', 'NPNr = 13'), 'Test1a');
     $this->assertEquals('select * from table where (1 = 1) AND (NPNr = 13)', report::_makeSqlFilter('select * from table where 1=1;', 'NPNr = 13'), 'Test1b');
     // No semicolon
     $this->assertEquals('select * from table where (1 = 1) AND (NPNr = 13) group by NPNR', report::_makeSqlFilter('select * from table where 1=1 group by NPNR', 'NPNr = 13'), 'Test2a');
     // One semicolon
     $this->assertEquals('select * from table where (1 = 1) AND (NPNr = 13) group by NPNR', report::_makeSqlFilter('select * from table where 1=1 group by NPNR;', 'NPNr = 13'), 'Test2a');
     // Two semicolons
     $this->assertEquals('select * from table where (1 = 1) AND (NPNr = 13) group by NPNR', report::_makeSqlFilter('select * from table where 1=1 group by NPNR;;', 'NPNr = 13'), 'Test2c');
     // Two semicolons separated by a blank
     $this->assertEquals('select * from table where (1 = 1) AND (NPNr = 13) group by NPNR', report::_makeSqlFilter('select * from table where 1=1 group by NPNR; ;', 'NPNr = 13'), 'Test2d');
     // Invalid statement but has to be parsed and modified as expected
     // 1. all semicolons and whitespaces at the end have to be removed
     // 2. semicolon in the middle must remain
     $this->assertEquals('select * from table where (; a) AND (NPNr = 13)', report::_makeSqlFilter('select * from table where ; a ;;; ;;;', 'NPNr = 13'), 'Test3a');
 }
Esempio n. 12
0
 public static function get_structur_with_session($session_id)
 {
     $report_list = report::get_list_with_session($session_id);
     if (count($report_list) > 0) {
         $rn = new report_navigation();
         $report_nav_list = $rn->get_list();
         //Turn Report Navigation List into Report Navigation Structur List
         $rns_list = array();
         for ($i = 0; $i < count($report_nav_list); $i++) {
             $rns_list[] = $report_nav_list[$i]->to_report_navigation_structur();
         }
         //Create Structur
         for ($i = 0; $i < count($rns_list); $i++) {
             $rns = $rns_list[$i];
             for ($j = 0; $j < count($rns_list); $j++) {
                 if ($i != $j) {
                     if ($rns->add_navigation($rns_list[$j])) {
                         array_splice($rns_list, $j, 1);
                         $j--;
                     }
                 }
             }
         }
         $rnr = new report_navigation_report();
         $rnr_list = $rnr->get_list();
         for ($i = 0; $i < count($rnr_list); $i++) {
             for ($j = 0; $j < count($report_list); $j++) {
                 if ($report_list[$j]->id === $rnr_list[$i]->report_id) {
                     for ($k = 0; $k < count($rns_list); $k++) {
                         $rns_list[$k]->add_navigation(new report_navigation_structur(0, $report_list[$j]->name, $rnr_list[$i]->report_navigation_id, $report_list[$j]->id, $report_list[$j]->description));
                     }
                     $j = count($report_list);
                 }
             }
         }
         return $rns_list;
     } else {
         return null;
     }
 }
Esempio n. 13
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $insert = $request->all();
     $safeName = false;
     //upload image
     if ($file = Input::file('image')) {
         $fileName = $file->getClientOriginalName();
         $extension = $file->getClientOriginalExtension() ?: 'png';
         $folderName = '/uploads/';
         $destinationPath = Config::get('app.path') . $folderName;
         $safeName = time() . "_" . str_random(10) . '.' . $extension;
         $file->move($destinationPath, $safeName);
         $insert['image'] = $safeName ? $folderName . $safeName : '';
     }
     if (isset(Report::$boolean)) {
         foreach (report::$boolean as $field) {
             if (isset($insert[$field]) && $insert[$field] == "on") {
                 $insert[$field] = 1;
             }
         }
     }
     report::create($insert);
     return redirect('admin/reports')->with('success', Lang::get('message.success.create'));
 }
Esempio n. 14
0
 public function allDateReports()
 {
     /*** Instantiate a new Report model ***/
     $model = new report();
     /*** set a template variable ***/
     $this->registry->template->welcome = 'All Summaries By Date';
     /*** Get all Summaries ***/
     //Breaks it up into different sections on the screen for reporting
     //These functions are in applicationModel with descriptions within it
     //** Start Section for States ** //
     // Assigns $allstate
     $this->registry->template->alldatestate = $model->allDateStates();
     //** Start Section for Boat Types ** //
     // Assigns $allboat
     $this->registry->template->alldateboat = $model->allDateBoatTypes();
     //** Start Section for all Previous Interactions ** //
     // Assigns $allprev
     $this->registry->template->alldateprev = $model->allDatePreviousInteractions();
     //** Start Section for allDrained ** //
     // Assigns $alldrained
     $this->registry->template->alldatedrained = $model->allDateDrained();
     //** Start Section for allRinsed ** //
     // Assigns $allrinsed
     $this->registry->template->alldaterinsed = $model->allDateRinsed();
     //** Start Section for allDried ** //
     // Assigns $alldried
     $this->registry->template->alldatedried = $model->allDateDried();
     //** Start Section for allAwareness ** //
     // Assigns $allaware
     $this->registry->template->alldateaware = $model->allDateAwareness();
     //** Start Section for allSpeciesFound ** //
     // Assigns $allfound
     $this->registry->template->alldatefound = $model->allDateSpeciesFound();
     //** Start Section for allSpecimenSent ** //
     // Assigns $allsent
     $this->registry->template->alldatesent = $model->allDateSpecimenSent();
     /*** load the view***/
     $this->registry->template->show($this->name, 'allDateReports');
 }
 *  php detect_big_differences.php 1231231231231 1231231231232 1231231231233
 */
include __DIR__ . '/inc.php';
// Removing the script name.
array_shift($argv);
if (empty($argv)) {
    echo 'Error: You need to specify the runs filenames without their .php sufix.' . PHP_EOL;
    exit(1);
}
if (count($argv) == 1) {
    echo 'Error: You should specify, at least, two runs to compare.' . PHP_EOL;
    exit(1);
}
// The filename without .php.
$timestamps = $argv;
$report = new report();
if (!$report->parse_runs($timestamps)) {
    echo 'Error: The selected runs are not comparable.' . PHP_EOL;
    foreach ($report->get_errors() as $var => $error) {
        echo $var . ': ' . $error . PHP_EOL;
    }
    exit(1);
}
// Uses the thresholds specified in the .properties files.
if (!$report->calculate_big_differences()) {
    echo 'Error: No way to get the default thresholds...' . PHP_EOL;
    exit(1);
}
$branches = $report->get_big_differences();
// Report changes.
$exitcode = 0;
Esempio n. 16
0
                    if ($ret) {
                        $this->title['host'][$target_id] = $ret['host_name'];
                    }
                }
                return $this->title['host'][$target_id];
                break;
            case 'host-instance':
                if (empty($this->title['instance'][$target_id])) {
                    $ret = pdo_get_instance_byid($this->pdo, $target_id);
                    if ($ret) {
                        $this->title['instance'][$target_id] = $ret['service_name'] . ':' . $ret['port_num'];
                    }
                }
                return $this->title['instance'][$target_id];
                break;
            case 'global':
                return 'global';
                break;
        }
    }
    private function get_color($i)
    {
        $lib = array('#333333', '#ff6600', '#fcd202', '#b0de09', '#0d8ecf', '#21CF12', '#666699', '#003333', '#990066', '#009966', '#EB2D2D', '#4A57E9', '#2B0EA0', '#587A01');
        return !empty($lib[$i]) ? $lib[$i] : $lib[$i % 10];
    }
}
$param = json_decode($params['param'], true);
$r = new report();
$r->_init_($cfg['alert'], $pdo_log, $pdo);
$ret = $r->start($param);
require_once SC_PATH . '/ajax/report.phtml';
Esempio n. 17
0
 function print_a_type()
 {
     report::print_a_type();
 }
Esempio n. 18
0
<?php

//****************************************************************************************
//Generated by Cobalt, a rapid application development framework. http://cobalt.jvroig.com
//Cobalt developed by JV Roig (jvroig@jvroig.com)
//****************************************************************************************
require 'path.php';
init_cobalt('Add report');
require 'components/get_listview_referrer.php';
if (xsrf_guard()) {
    init_var($_POST['btn_cancel']);
    init_var($_POST['btn_submit']);
    require 'components/query_string_standard.php';
    require 'subclasses/report.php';
    $dbh_report = new report();
    $object_name = 'dbh_report';
    require 'components/create_form_data.php';
    extract($arr_form_data);
    if ($_POST['btn_cancel']) {
        log_action('Pressed cancel button');
        redirect("listview_report.php?{$query_string}");
    }
    if ($_POST['btn_submit']) {
        log_action('Pressed submit button');
        $message .= $dbh_report->sanitize($arr_form_data)->lst_error;
        extract($arr_form_data);
        if ($dbh_report->check_uniqueness($arr_form_data)->is_unique) {
            //Good, no duplicate in database
        } else {
            $message = "Record already exists with the same primary identifiers!";
        }
Esempio n. 19
0
 public function order_report()
 {
     $seller_id = $this->seller['seller_id'];
     $search = IFilter::act(IReq::get('search'));
     /* //必须为已支付状态
        $search['pay_status='] = 1;
        //必须为未发货状态
        $search['distribution_status='] = 0; */
     $condition = Util::search($search);
     $where = "go.seller_id = " . $seller_id;
     $where .= $condition ? " and " . $condition : "";
     //拼接sql
     $orderHandle = new IQuery('order_goods as og');
     $orderHandle->order = "o.id desc";
     $orderHandle->fields = "o.*,p.name as payment_name";
     $orderHandle->join = "left join goods as go on go.id=og.goods_id left join order as o on o.id=og.order_id left join payment as p on p.id = o.pay_type";
     $orderHandle->where = $where;
     $orderList = $orderHandle->find();
     //pr($orderList);
     //对订单进行重构
     if (empty($orderList)) {
         IError::show(403, "数据为空");
         exit;
     } else {
         $addrObj = new IModel("address");
         foreach ($orderList as $k => $v) {
             if ($v['address_id']) {
                 $order_addr = explode(',', $v['address_id']);
                 $count = count($order_addr);
                 for ($i = 0; $i < $count; $i++) {
                     $new = $v;
                     $new['old_book_count'] = $count;
                     $new['one_book_price'] = round($new['order_amount'] / $count, 2);
                     $addr_detil = $this->getAddr($addrObj, $order_addr[$i]);
                     if ($addr_detil) {
                         $new['accept_name'] = $addr_detil['accept_name'];
                         $new['province_val'] = $addr_detil['province_val'];
                         $new['city_val'] = $addr_detil['city_val'];
                         $new['area_val'] = $addr_detil['area_val'];
                         $new['address'] = $addr_detil['address'];
                         $new['school'] = $addr_detil['school'];
                         $new['grade'] = $addr_detil['grade'];
                         $new['class'] = $addr_detil['class'];
                         $new['mobile'] = $addr_detil['mobile'];
                         $new['telphone'] = $addr_detil['telphone'];
                     } else {
                         $new['province_val'] = '';
                         $new['city_val'] = '';
                         $new['area_val'] = '';
                         $new['school'] = '';
                         $new['grade'] = '';
                         $new['class'] = '';
                     }
                     $new_order[] = $new;
                 }
             }
         }
     }
     //pr($new_order);
     //构建 Excel table
     $strTable = '<table width="500" border="1">';
     $strTable .= '<tr>';
     $strTable .= '<td style="text-align:center;font-size:12px;width:120px;">订单编号</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="100">下单日期</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="*">收货人</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="*">省</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="*">市</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="*">区</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="*">学校</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="*">年级</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="*">班级</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="*">电话</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="*">订单金额</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="*">原有本数</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="*">单本金额</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="*">支付方式</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="*">支付状态</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="*">支付时间</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="*">发货状态</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="*">商品信息</td>';
     $strTable .= '</tr>';
     foreach ($new_order as $k => $val) {
         $strTable .= '<tr>';
         $strTable .= '<td style="text-align:center;font-size:12px;">&nbsp;' . $val['order_no'] . '</td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . $val['create_time'] . ' </td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . $val['accept_name'] . ' </td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . $val['province_val'] . ' </td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . $val['city_val'] . ' </td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . $val['area_val'] . ' </td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . $val['school'] . ' </td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . $val['grade'] . ' </td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . $val['class'] . ' </td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">&nbsp;' . $val['telphone'] . '&nbsp;' . $val['mobile'] . ' </td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . $val['order_amount'] . ' </td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . $val['old_book_count'] . ' </td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . $val['one_book_price'] . ' </td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . $val['payment_name'] . ' </td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . Order_Class::getOrderPayStatusText($val) . ' </td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . $val['pay_time'] . ' </td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . Order_Class::getOrderDistributionStatusText($val) . ' </td>';
         $orderGoods = Order_class::getOrderGoods($val['id']);
         $strGoods = "";
         foreach ($orderGoods as $good) {
             $strGoods .= "商品编号:" . $good->goodsno . " 商品名称:" . $good->name;
             if ($good->value != '') {
                 $strGoods .= " 规格:" . $good->value;
             }
             $strGoods .= "<br />";
         }
         unset($orderGoods);
         $strTable .= '<td style="text-align:left;font-size:12px;">' . $strGoods . ' </td>';
         $strTable .= '</tr>';
     }
     $strTable .= '</table>';
     //输出成EXcel格式文件并下载
     $reportObj = new report();
     $reportObj->setFileName('order');
     $reportObj->toDownload($strTable);
     exit;
 }
 function operation($id, $operation, $returl)
 {
     global $_CAMILA;
     if ($operation == 'delete') {
         require_once CAMILA_DIR . 'datagrid/form.class.php';
         require_once CAMILA_DIR . 'datagrid/elements/form/hidden.php';
         $form3 = new phpform('camila', 'cf_worktable_admin.php');
         $form3->submitbutton = camila_get_translation('camila.worktable.delete');
         $form3->drawrules = false;
         new form_hidden($form3, 'custom', $id);
         new form_hidden($form3, 'worktable_op', $operation);
         if ($returl != '') {
             new form_hidden($form3, 'returl', $returl);
         }
         if ($form3->process()) {
             $result = $_CAMILA['db']->Execute('select tablename,scriptname from ' . CAMILA_TABLE_WORKT . ' where id=' . $_CAMILA['db']->qstr($id));
             if ($result === false) {
                 camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg());
             }
             $table = $result->fields['tablename'];
             $script = $result->fields['scriptname'];
             $result = $_CAMILA['db']->Execute('delete from ' . CAMILA_TABLE_WORKT . ' where id=' . $_CAMILA['db']->qstr($id));
             if ($result === false) {
                 camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg());
             }
             $result = $_CAMILA['db']->Execute('delete from ' . CAMILA_TABLE_WORKC . ' where (wt_id=' . $_CAMILA['db']->qstr($id) . ' and is_deleted<>' . $_CAMILA['db']->qstr('y') . ')');
             if ($result === false) {
                 camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg());
             }
             $stmt = sprintf($_CAMILA['db']->_dropSeqSQL, $table);
             $result = $_CAMILA['db']->Execute($stmt);
             //if ($result === false)
             //    camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg());
             $record = array();
             $record['visible'] = 'no';
             $record['active'] = 'no';
             $updateSQL = $_CAMILA['db']->AutoExecute(CAMILA_TABLE_PAGES, $record, 'UPDATE', 'url=' . $_CAMILA['db']->qstr($script));
             //if (!$updateSQL) {
             //    camila_information_text(camila_get_translation('camila.worktable.db.error'));
             //    $success3 = false;
             //}
         } else {
             camila_information_text(camila_get_translation('camila.worktable.delete.areyousure'));
             $result = $_CAMILA['db']->Execute('select short_title from ' . CAMILA_TABLE_WORKT . ' where id=' . $_CAMILA['db']->qstr($id));
             if ($result === false) {
                 camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg());
             }
             $name = $result->fields['short_title'];
             $myText = new CHAW_text($name, HAW_TEXTFORMAT_BOLD);
             $myText->set_br(2);
             $_CAMILA['page']->add_text($myText);
             $form3->draw();
             $success = false;
         }
     } elseif ($operation == 'rebuild') {
         require_once CAMILA_DIR . 'datagrid/form.class.php';
         require_once CAMILA_DIR . 'datagrid/elements/form/hidden.php';
         $form3 = new phpform('camila', 'cf_worktable_admin.php');
         $form3->submitbutton = camila_get_translation('camila.worktable.delete');
         $form3->drawrules = false;
         new form_hidden($form3, 'custom', $id);
         new form_hidden($form3, 'worktable_op', $operation);
         if ($returl != '') {
             new form_hidden($form3, 'returl', $returl);
         }
         if ($form3->process()) {
             $this->configure_table($id, true, $returl);
         } else {
             camila_information_text(camila_get_translation('camila.worktable.rebuild.areyousure'));
             $result = $_CAMILA['db']->Execute('select short_title from ' . CAMILA_TABLE_WORKT . ' where id=' . $_CAMILA['db']->qstr($id));
             if ($result === false) {
                 camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg());
             }
             $name = $result->fields['short_title'];
             $myText = new CHAW_text($name, HAW_TEXTFORMAT_BOLD);
             $myText->set_br(2);
             $_CAMILA['page']->add_text($myText);
             $form3->draw();
             $success = false;
         }
     } elseif ($operation == 'showtemplatefields') {
         $stmt = "select wt_id,name,name_abbrev,col_name as colname_form, col_name as colname_table from " . CAMILA_TABLE_WORKC . ' where (wt_id=' . $_CAMILA['db']->qstr($id) . ' and is_deleted<>' . $_CAMILA['db']->qstr('y') . ') order by name';
         require_once CAMILA_DIR . 'datagrid/report.class.php';
         $report = new report($stmt);
         $report->mapping = camila_get_translation('camila.worktable.mapping.worktable');
         $report->process();
         $report->fields['colname_form']->onprint = camila_configurator_template_fieldname_form;
         $report->fields['colname_form']->dummy = true;
         $report->fields['colname_form']->orderable = false;
         $report->fields['colname_table']->onprint = camila_configurator_template_fieldname_table;
         $report->fields['colname_table']->dummy = true;
         $report->fields['colname_table']->orderable = false;
         $report->fields['wt_id']->print = false;
         $report->fields['name']->orderable = false;
         $report->fields['name_abbrev']->orderable = false;
         $report->drawfilterbox = false;
         $report->drawnavigationbox = false;
         $report->draw();
     }
     if ($success) {
         $myText = new CHAW_text(camila_get_translation('camila.worktable.db.importok'));
         $_CAMILA['page']->add_text($myText);
     }
 }
 if (isset($_REQUEST['camila_rest'])) {
     $report_fields = str_replace('cf_bool_is_special,', '', $report_fields);
     $report_fields = str_replace('cf_bool_is_selected,', '', $report_fields);
     $default_fields = $report_fields;
 }
 if ($_CAMILA['page']->camila_exporting()) {
     $mapping = 'created=Data creazione#last_upd=Ultimo aggiornamento#last_upd_by=Utente ult. agg.#last_upd_src=Sorgente Ult. agg.#last_upd_by_name=Nome Utente ult. agg.#last_upd_by_surname=Cognome Utente ult. agg.#mod_num=Num. mod.#id=Cod. riga#created_by=Utente creaz.#created_src=Sorgente creaz.#created_by_surname=Cognome Utente creaz.#created_by_name=Nome Utente creaz.#cf_bool_is_special=contrassegnati come speciali#cf_bool_is_selected=selezionati#data1=Data#richiedente=Richiedente#richiesta=Richiesta#tiporichiesta=Tipo Richiesta#priorit=Priorità#assegnatariorichiesta=Assegnatario richiesta#stato=Stato#note=Note';
 } else {
     $mapping = 'created=Data creazione#last_upd=Ultimo aggiornamento#last_upd_by=Utente ult. agg.#last_upd_src=Sorgente Ult. agg.#last_upd_by_name=Nome Utente ult. agg.#last_upd_by_surname=Cognome Utente ult. agg.#mod_num=Num. mod.#id=Cod. riga#created_by=Utente creaz.#created_src=Sorgente creaz.#created_by_surname=Cognome Utente creaz.#created_by_name=Nome Utente creaz.#cf_bool_is_special=contrassegnati come speciali#cf_bool_is_selected=selezionati#data1=Data#richiedente=Richiedente#richiesta=Richiesta#tiporichiesta=Tipo Richiesta#priorit=Priorità#assegnatariorichiesta=Assegnatario rich.#stato=Stato#note=Note';
 }
 $filter = '';
 if ($_CAMILA['user_visibility_type'] == 'personal') {
     $filter = ' where created_by=' . $_CAMILA['db']->qstr($_CAMILA['user']);
 }
 $stmt = 'select ' . $report_fields . ' from worktable_worktable2';
 $report = new report($stmt . $filter, '', 'data1', 'asc', $mapping, null, 'id', 'cf_bool_is_special,cf_bool_is_selected,data1,richiedente,richiesta,tiporichiesta,priorit,assegnatariorichiesta,stato,note', '', isset($_REQUEST['camila_rest']) ? false : true, isset($_REQUEST['camila_rest']) ? false : true);
 if (true && !isset($_REQUEST['camila_rest'])) {
     $report->additional_links = array(camila_get_translation('camila.report.insertnew') => basename($_SERVER['PHP_SELF']) . '?camila_update=new');
     $myImage1 = new CHAW_image(CAMILA_IMG_DIR . 'wbmp/add.wbmp', CAMILA_IMG_DIR . 'png/add.png', '-');
     $report->additional_links_images = array(camila_get_translation('camila.report.insertnew') => $myImage1);
     if ($_CAMILA['adm_user_group'] == CAMILA_ADM_USER_GROUP || CAMILA_WORKTABLE_IMPORT_ENABLED) {
         $report->additional_links[camila_get_translation('camila.worktable.import')] = 'cf_worktable_wizard_step4.php?camila_custom=' . $wt_id . '&camila_returl=' . urlencode($_SERVER['PHP_SELF']);
     }
 }
 if ($_CAMILA['adm_user_group'] == CAMILA_ADM_USER_GROUP) {
     $report->additional_links[camila_get_translation('camila.worktable.rebuild')] = 'cf_worktable_admin.php?camila_custom=' . $wt_id . '&camila_worktable_op=rebuild' . '&camila_returl=' . urlencode($_SERVER['PHP_SELF']);
     $report->additional_links[camila_get_translation('camila.worktable.reconfig')] = 'cf_worktable_wizard_step2.php?camila_custom=' . $wt_id . '&camila_returl=' . urlencode($_SERVER['PHP_SELF']);
 }
 if (CAMILA_WORKTABLE_CONFIRM_VIA_MAIL_ENABLED) {
     $report->additional_links[camila_get_translation('camila.worktable.confirm')] = basename($_SERVER['PHP_SELF']) . '?camila_visible_cols_only=y&camila_worktable_export=dataonly&camila_pagnum=-1&camila_export_filename=WORKTABLE&camila_export_action=sendmail&hidden=camila_xls&camila_export_format=camila_xls&camila_xls=Esporta';
     $myImage1 = new CHAW_image(CAMILA_IMG_DIR . 'wbmp/accept.wbmp', CAMILA_IMG_DIR . 'png/accept.png', '-');
Esempio n. 22
0
<?php

$PAGE = "S_REPORT_WEEKLY_EDIT";
require_once '../_init_auth.php';
require_once 'report/class.Report.php';
try {
    $report = new report($request);
    $param['page'] = $PAGE;
    //日付取得
    if (isset($request['target_date']) && !empty($request['target_date'])) {
        //サブメニューから遷移
        $date = date('Ymd', strtotime($request['target_date']));
        $termid = getTermId($date);
        $param['date'] = $date;
        $year = getYear($request['target_date']);
        $month = getMonth($request['target_date']);
        $param['target_date'] = $date;
    } else {
        $param['errors'][] = "システムエラーが発生しました。";
        renderTemplate('error.tpl', $param);
        exit;
    }
    $authority = $_SESSION[SESSION_GROUP_CD];
    if (isset($request['id']) && !empty($request['id'])) {
        $staff_id = $request['id'];
    }
    //新入社員情報取得
    if (isset($request['id'])) {
        $employee = $report->getEmpData($request['id']);
    }
    if (!isset($request['id']) || !$employee) {
<?php

include __DIR__ . '/compare/inc.php';
$report = new report();
if (!empty($_GET['timestamps'])) {
    // Create the report.
    $report->make($_GET['timestamps'], $_GET['threadgroupname']);
}
// Render it.
$renderer = new report_renderer($report);
$renderer->render();
Esempio n. 24
0
 public function goods_report()
 {
     //搜索条件
     $search = IFilter::act(IReq::get('search'), 'strict');
     //条件筛选处理
     list($join, $where) = goods_class::getSearchCondition($search);
     //拼接sql
     $goodsHandle = new IQuery('goods as go');
     $goodsHandle->order = "go.sort asc,go.id desc";
     $goodsHandle->distinct = "go.id";
     $goodsHandle->fields = "go.id, go.name,go.sell_price,go.store_nums,go.sale,go.is_del,go.create_time,seller.true_name";
     $goodsHandle->join = $join;
     $goodsHandle->where = $where;
     $goodsHandle->limit = 'all';
     $goodsList = $goodsHandle->find();
     //构建 Excel table;
     $strTable = '<table width="500" border="1">';
     $strTable .= '<tr>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="*">商品名称</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="160">分类</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="60">售价</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="60">库存</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="60">销量</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="60">发布时间</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="60">状态</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="60">隶属商户</td>';
     $strTable .= '</tr>';
     foreach ($goodsList as $k => $val) {
         $strTable .= '<tr>';
         $strTable .= '<td style="text-align:center;font-size:12px;">&nbsp;' . $val['name'] . '</td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . goods_class::getGoodsCategory($val['id']) . ' </td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . $val['sell_price'] . ' </td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . $val['store_nums'] . ' </td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . $val['sale'] . ' </td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . $val['create_time'] . ' </td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . goods_class::statusText($val['is_del']) . ' </td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . $val['true_name'] . '&nbsp;</td>';
         $strTable .= '</tr>';
     }
     $strTable .= '</table>';
     unset($goodsList);
     $reportObj = new report();
     $reportObj->setFileName('goods');
     $reportObj->toDownload($strTable);
     exit;
 }
Esempio n. 25
0
        </td>
    </tr>     
    
<table>

</FORM>
<?php 
$v0 = $_POST['empresalist'];
if (isset($_POST['empresalist']) && $_POST['empresalist'] != "" && isset($_POST['buscar']) && isset($_POST['fechaInicio']) && $_POST['fechaInicio'] != "" && isset($_POST['fechaFin']) && $_POST['fechaFin'] != "") {
    $fechaInicio = $_POST['fechaInicio'];
    $fechaFin = $_POST['fechaFin'];
    $empresalist = $_POST['empresalist'];
    $centro = $_POST['centro'];
    $usuariolist = $_POST['usuariolist'];
    $concepto = $_POST['concepto'];
    $reporte = new report();
    $datos = $reporte->Reporte_Gastos($fechaInicio, $fechaFin, $empresalist, $usuariolist, $centro, $concepto);
    $aux = "";
    $aux .= "<html>";
    $aux .= "<table  align='center' cellspacing='4' cellpadding='4' >";
    $aux .= "<td style=\"font-size: 12px;\"><br><br><strong>Empresa</strong></td>";
    $aux .= "<td style=\"font-size: 12px;\"><br><br><strong>Departamento</strong></td>";
    $aux .= "<td style=\"font-size: 12px;\"><br><br><strong>Usuario</strong></td>";
    $aux .= "<td style=\"font-size: 12px;\"><br><br><strong>Concepto</strong></td>";
    $aux .= "<td style=\"font-size: 12px;\"><br><br><strong>Total Aprobado</strong></td>";
    $suma = 0;
    foreach ($datos as $fila) {
        $aux .= "<tr>";
        $aux .= "<td style=\"font-size: 10px;\" align='left'>{$fila['e_codigo']}</td>";
        $aux .= "<td style=\"font-size: 10px;\" align='left'>{$fila['cc_centrocostos']}</td>";
        $aux .= "<td style=\"font-size: 10px;\" align='left'>{$fila['u_nombre']}</td>";
Esempio n. 26
0
    $log->Fatal("Error: " . $text . " (File: " . $_SERVER['PHP_SELF'] . ")");
    die;
}
// Get/Set Task ID - as sent from cronjob when this script is called and is stored in DB.nodes table also
$tid = $_GET['id'];
// get task details from DB
$taskResult = $db->q("SELECT * FROM tasks WHERE id = {$tid} AND status = '1'");
$taskRow = mysql_fetch_assoc($taskResult);
$command = $taskRow['catCommand'];
$taskname = $taskRow['taskname'];
// create connection report file
$reportFilename = 'compareReport' . $date . '.html';
$reportDirectory = 'compareReports';
$serverIp = getHostByName(getHostName());
// get server IP address for CLI scripts
$report = new report($config_reports_basedir, $reportFilename, $reportDirectory, $serverIp);
$report->createFile();
$title = "rConfig Report - " . $taskname;
$report->header($title, $title, basename($_SERVER['PHP_SELF']), $tid, $startTime);
$reportFail = '<font color="red">Fail</font>';
$reportPass = '******';
// Get active nodes for a given task ID
// Query to retireve row for given ID (tidxxxxxx is stored in nodes and is generated when task is created)
$getNodesSql = "SELECT id, deviceName, deviceIpAddr, deviceUsername, devicePassword, deviceEnableMode, deviceEnablePassword, nodeCatId, deviceAccessMethodId, connPort FROM nodes WHERE taskId" . $tid . " = 1 AND status = 1";
if ($result = $db->q($getNodesSql)) {
    // push rows to $devices array
    $devices = array();
    while ($row = mysql_fetch_assoc($result)) {
        array_push($devices, $row);
    }
    foreach ($devices as $device) {
<?php

include __DIR__ . '/webapp/inc.php';
$report = new report();
if (!empty($_GET['timestamps'])) {
    // Create the report.
    $report->make($_GET['timestamps']);
}
// Render it.
$renderer = new report_renderer($report);
$renderer->render();
Esempio n. 28
0
<?php

$PAGE = "S_REPORT_DAILY_EDIT";
require_once '../_init_auth.php';
require_once 'report/class.Report.php';
require_once 'report/class.Edit.php';
try {
    $param['page'] = $PAGE;
    $edit = new edit($request);
    $report = new report($request);
    $error = false;
    //日付取得
    if (isset($request['target_date']) && !empty($request['target_date'])) {
        //サブメニューから遷移
        $date = date('Ymd', strtotime($request['target_date']));
        //         $date = 20140101;
        $termid = getTermId($date);
        $year = getYear($request['target_date']);
        $month = getMonth($request['target_date']);
        //         $preg = '%02d%02d';
        //         $date =  sprintf('%04d', substr($date, 4, 4));
        //         $param['target_date'] = $date;
    } else {
        $param['errors'][] = "システムエラーが発生しました。";
        renderTemplate('error.tpl', $param);
        exit;
    }
    //新入社員情報取得
    $authority = $_SESSION[SESSION_GROUP_CD];
    //新入社員以外エラー
    if (in_array(ACCOUNT_NEW_EMP, $_SESSION[SESSION_GROUP_CD])) {
Esempio n. 29
0
/**
 * Performs the report function.
 *
 * @param array $formdata the form data
 * @param int $type the report type
 * @param string $saveto File to save the pdf report to.
 * @return bool False on failure
 * @uses $CFG, $DB
 */
function report_ncccscensus_generate_report($formdata, $type = REPORT_NCCCSCENSUS_ACTION_VIEW, $saveto = false)
{
    global $CFG, $DB;
    require_once $CFG->libdir . '/moodlelib.php';
    $reportname = 'report_ncccscensus';
    $cid = $formdata->id;
    // In case the form is hacked, set a default startdate to today at midnight.
    if (empty($formdata->startdate)) {
        $formdata->startdate = usergetmidnight(time(), get_user_timezone());
    }
    // In case the form is hacked, set a default enddate to today at midnight.
    if (empty($formdata->enddate)) {
        $formdata->enddate = $formdata->startdate;
    }
    // Advance enddate to tomorrow's midnight.
    $formdata->enddate += DAYSECS - 1;
    // This flag determines if we should display grouped users or not.
    $nogroups = isset($formdata->disablegroups) ? true : false;
    if ($nogroups) {
        $group = false;
    } else {
        // If group specified, do some validation.
        $group = isset($formdata->group) ? $formdata->group : false;
        // In case the form is hacked, the group could be invalid.
        if ($group === false || $group < 0) {
            throw new report_ncccscensus_exception('cannotfindgroup');
        }
        if ($group > 0) {
            // Validate the group ID.
            if (!groups_group_exists($group)) {
                throw new report_ncccscensus_exception('cannotfindgroup');
            }
            // Validate the group ID with respect to the course ID.
            $groupdata = groups_get_course_data($cid);
            $groupfound = false;
            foreach ($groupdata->groups as $groupobject) {
                if ($groupobject->id == $group) {
                    $groupfound = true;
                    break;
                }
            }
            if (!$groupfound) {
                throw new report_ncccscensus_exception('invalidgroupid');
            }
            // User could still hack form to view a group that they don't have the capability to see.
            $context = context_course::instance($cid);
            if (has_capability('moodle/site:accessallgroups', $context)) {
                $userid = 0;
            } else {
                if (has_capability('moodle/course:managegroups', $context)) {
                    $userid = $USER->id;
                } else {
                    $userid = false;
                }
            }
            if ($userid === false) {
                throw new report_ncccscensus_exception('invalidgroupid');
            }
            if ($userid != 0) {
                $grouprecs = groups_get_all_groups($course->id, $userid, 0, 'g.id, g.name');
                $groupnotfound = true;
                foreach ($grouprecs as $grouprec) {
                    if ($grouprec->id == $group) {
                        $groupnotfound = false;
                        break;
                    }
                }
                if ($groupnotfound) {
                    throw new report_ncccscensus_exception('invalidgroupid');
                }
            }
        }
    }
    $users = array();
    if ($nogroups) {
        $users = report_ncccscensus_get_users($cid, REPORT_NCCCSCENSUS_EXCLUDE_GROUP_MEMBERS);
    } else {
        if ($group > 0) {
            $users = report_ncccscensus_get_users($cid, $group);
        } else {
            $users = report_ncccscensus_get_users($cid);
        }
    }
    $results = report_ncccscensus_build_grades_array($cid, $users, $formdata->startdate, $formdata->enddate);
    if (empty($results)) {
        return false;
    }
    if ($type == REPORT_NCCCSCENSUS_ACTION_VIEW) {
        $headers = array('student' => get_string('studentfullnamehtml', $reportname));
        $showstudentid = report_ncccscensus_check_field_status('showstudentid', 'html');
    } else {
        if ($type == REPORT_NCCCSCENSUS_ACTION_CSV) {
            $headers = array('student' => get_string('studentfullnamecsv', $reportname));
            $showstudentid = report_ncccscensus_check_field_status('showstudentid', 'csv');
        } else {
            $headers = array('student' => get_string('studentfullnamepdf', $reportname));
            $showstudentid = report_ncccscensus_check_field_status('showstudentid', 'pdf');
        }
    }
    if ($showstudentid) {
        $headers['studentid'] = get_string('studentid', $reportname);
    }
    $headers['activity'] = get_string('activityname', $reportname);
    $headers['module'] = get_string('activitymodule', $reportname);
    $headers['status'] = get_string('submissionstatus', $reportname);
    $headers['datesubmitted'] = get_string('submissiondate', $reportname);
    $headers['grade'] = get_string('grade', $reportname);
    $headers['gradedate'] = get_string('gradedate', $reportname);
    $context = context_course::instance($cid);
    $namesarrayview = array();
    $namesarraypdf = array();
    $instructors = ' - ';
    $viewlink = ': <a href="' . $CFG->wwwroot . '/user/view.php?id=';
    if (!empty($CFG->coursecontact)) {
        $coursecontactroles = explode(',', $CFG->coursecontact);
        sort($coursecontactroles);
        // If a user has multiple roles, we do not want to show user multiple times as a contact.
        $teachers = array();
        foreach ($coursecontactroles as $roleid) {
            $roleid = (int) $roleid;
            if ($users = get_role_users($roleid, $context, true)) {
                $role = $DB->get_record('role', array('id' => $roleid));
                $rolename = format_string(role_get_name($role, $context));
                foreach ($users as $teacher) {
                    // The $teachers array tracks whether a user is already a course contact.
                    if (!isset($teachers[$teacher->id])) {
                        $teachers[$teacher->id] = true;
                        $fullname = fullname($teacher, has_capability('moodle/site:viewfullnames', $context));
                        $namesarrayview[] = $rolename . $viewlink . $teacher->id . '&amp;course=' . SITEID . '">' . $fullname . '</a>';
                        $namesarraycsv[] = $rolename . ': ' . $fullname;
                        $namesarraypdf[] = $rolename . ': ' . $fullname;
                    }
                }
            }
        }
    }
    if ($type != REPORT_NCCCSCENSUS_ACTION_PDF) {
        if ($type == REPORT_NCCCSCENSUS_ACTION_VIEW) {
            // Create legend for HTML view.
            $legend = new html_table();
            $legend->head = array(get_string('legend', $reportname));
            $legend->headspan = array(2);
            $legendrow1colour = new html_table_cell();
            $legendrow1colour->style = 'width: 50px; background-color: ' . get_config('report_ncccscensus', 'gradeoverridecolour');
            $legendrow1[] = $legendrow1colour;
            $legendrow1[] = get_string('legendgradeoverride', $reportname);
            $legendrow2colour = new html_table_cell();
            $legendrow2colour->style = 'width: 50px; background-color: ' . get_config('report_ncccscensus', 'gradenogradecolour');
            $legendrow2[] = $legendrow2colour;
            $legendrow2[] = get_string('legendnograde', $reportname);
            $legend->data = array($legendrow1, $legendrow2);
            $legendalign = array('center', 'left');
            $legend->align = $legendalign;
        }
        $table = new html_table();
        $table->head = $headers;
        $align = array('left');
        $numheaders = count($headers);
        for ($i = 1; $i < $numheaders; $i++) {
            $align[] = 'center';
        }
        $table->align = $align;
        $table->data = array();
        foreach ($results as $result) {
            $datum = array();
            $datum[] = $result->student;
            if ($showstudentid) {
                $datum[] = $result->studentid;
            }
            $datum[] = $result->activity;
            $datum[] = $result->module;
            $status = $result->status;
            $grade = $result->grade;
            if ($type == REPORT_NCCCSCENSUS_ACTION_VIEW && $grade == get_string('nograde', $reportname)) {
                $specialstatus = new html_table_cell($status);
                $specialstatus->style = 'background-color: ' . get_config('report_ncccscensus', 'gradenogradecolour');
                $status = $specialstatus;
            } else {
                if ($type == REPORT_NCCCSCENSUS_ACTION_VIEW && $result->overridden) {
                    $specialstatus = new html_table_cell($status);
                    $specialstatus->style = 'background-color: ' . get_config('report_ncccscensus', 'gradeoverridecolour');
                    $status = $specialstatus;
                }
            }
            $datum[] = $status;
            $datum[] = $result->submitdate;
            if ($type == REPORT_NCCCSCENSUS_ACTION_VIEW && $grade == get_string('nograde', $reportname)) {
                $nograde = new html_table_cell($grade);
                $nograde->style = 'background-color: ' . get_config('report_ncccscensus', 'gradenogradecolour');
                $grade = $nograde;
            } else {
                if ($type == REPORT_NCCCSCENSUS_ACTION_VIEW && $result->overridden) {
                    $overriddengrade = new html_table_cell($grade);
                    $overriddengrade->style = 'background-color: ' . get_config('report_ncccscensus', 'gradeoverridecolour');
                    $grade = $overriddengrade;
                }
            }
            $datum[] = $grade;
            $datum[] = $result->date;
            $table->data[] = $datum;
        }
    }
    $course = $DB->get_record('course', array('id' => $cid));
    if ($group > 0) {
        $groupname = groups_get_group_name($group);
    }
    $datestring = 'n/j/y';
    $reportrange = date($datestring, $formdata->startdate) . ' - ' . date($datestring, $formdata->enddate);
    if ($type != REPORT_NCCCSCENSUS_ACTION_VIEW) {
        $date = usergetdate(time(), get_user_timezone());
        $filename = 'CensusRpt2_';
        $filename .= date('MdY_Hi', mktime($date['hours'], $date['minutes'], 0, $date['mon'], $date['mday'], $date['year']));
    }
    if ($type == REPORT_NCCCSCENSUS_ACTION_VIEW) {
        if (report_ncccscensus_check_field_status('showcoursename', 'html')) {
            echo '<b>' . get_string('coursetitle', $reportname) . ':</b> ' . $course->fullname . '<br>';
        }
        if (report_ncccscensus_check_field_status('showcoursecode', 'html')) {
            echo '<b>' . get_string('coursecode', $reportname) . ':</b> ' . $course->shortname . '<br>';
        }
        // Only show course ID if present.
        if (report_ncccscensus_check_field_status('showcourseid', 'html') && $course->idnumber !== '') {
            echo '<b>' . get_string('courseid', $reportname) . ':</b> ' . $course->idnumber . '<br>';
        }
        if (report_ncccscensus_check_field_status('showteachername', 'html')) {
            if (!empty($namesarrayview)) {
                $instructors = implode(', ', $namesarrayview);
                echo '<b>' . get_string('instructor', $reportname) . ':</b> ' . $instructors . '<br>';
            }
        }
        echo '<b>' . get_string('reportrange', $reportname) . ':</b> ' . $reportrange . '<br>';
        if (isset($groupname)) {
            echo '<b>' . get_string('section', $reportname) . ':</b> ' . $groupname . '<br>';
        } else {
            echo '<b>' . get_string('section', $reportname) . ':</b> ' . get_string('allgroupspdf', $reportname) . '<br>';
        }
        echo '<br>';
        echo html_writer::table($table);
        echo '<div id="studentfootnote" style="font-size:10px;">' . get_string('studentfootnote', $reportname) . '</div>';
        echo '<br>';
        echo html_writer::table($legend);
        echo '<br><div align="center"><a href="' . $CFG->wwwroot . '/report/ncccscensus/index.php?id=' . $formdata->id . '">';
        echo get_string('backtoreport', 'report_ncccscensus') . '</a></div>';
    } else {
        if ($type == REPORT_NCCCSCENSUS_ACTION_PDF) {
            $topheaders = array();
            $topheaders['student'] = get_string('student', $reportname);
            $topheaders['activity'] = get_string('activity', $reportname);
            $topheaders['submission'] = get_string('submission', $reportname);
            $topheaders['grade'] = get_string('grade', $reportname);
            $bottomheaders = array();
            $bottomheaders['student'] = array('fullname' => get_string('studentfullnamepdf', $reportname));
            $showstudentid = report_ncccscensus_check_field_status('showstudentid', 'pdf');
            if ($showstudentid) {
                $bottomheaders['student']['id'] = get_string('studentidpdf', $reportname);
            }
            $bottomheaders['activity'] = array('name' => get_string('activityname', $reportname), 'module' => get_string('activitymodule', $reportname));
            $bottomheaders['submission'] = array('status' => get_string('submissionstatus', $reportname), 'date' => get_string('submissiondate', $reportname));
            $bottomheaders['grade'] = array('grade' => get_string('grade', $reportname), 'date' => get_string('gradedatepdf', $reportname));
            require_once 'report.class.php';
            $censusreport = new report();
            $censusreport->topheaders = $topheaders;
            $censusreport->bottomheaders = $bottomheaders;
            $censusreport->data = array();
            foreach ($results as $result) {
                $fieldarray = array();
                $fieldarray['studentfullname'] = $result->student;
                if ($showstudentid) {
                    $fieldarray['studentid'] = $result->studentid;
                }
                $fieldarray['activityname'] = $result->activity;
                $fieldarray['activitymodule'] = $result->module;
                $fieldarray['submissionstatus'] = $result->status;
                $fieldarray['submissiondate'] = $result->submitdate;
                $fieldarray['gradegrade'] = $result->grade;
                $fieldarray['gradedate'] = $result->date;
                $censusreport->data[] = array('data' => $fieldarray, 'override' => $result->overridden != 0 ? true : false, 'nograde' => $result->grade == get_string('nograde', $reportname) ? true : false);
            }
            $censusreport->filename = $filename . '.pdf';
            if (report_ncccscensus_check_field_status('showcoursename', 'pdf')) {
                $censusreport->top[] = array(get_string('coursetitlepdf', $reportname) . ':', $course->fullname);
            }
            if (report_ncccscensus_check_field_status('showcoursecode', 'pdf')) {
                $censusreport->top[] = array(get_string('coursecodepdf', $reportname) . ':', $course->shortname);
            }
            if (report_ncccscensus_check_field_status('showcourseid', 'pdf') && $course->idnumber !== '') {
                $censusreport->top[] = array(get_string('courseid', $reportname) . ':', $course->idnumber);
            }
            if (report_ncccscensus_check_field_status('showteachername', 'pdf')) {
                if (!empty($namesarrayview)) {
                    $instructors = implode(', ', $namesarrayview);
                }
                $censusreport->top[] = array(get_string('instructor', $reportname) . ':', strip_tags($instructors));
            }
            $censusreport->top[] = array(get_string('reportrangepdf', $reportname) . ':', $reportrange);
            if (isset($groupname)) {
                $censusreport->top[] = array(get_string('group', $reportname) . ':', $groupname);
            } else {
                if ($group !== false) {
                    $censusreport->top[] = array(get_string('group', $reportname) . ':', get_string('allgroupspdf', $reportname));
                }
            }
            if (report_ncccscensus_check_field_status('showsignatureline', 'pdf')) {
                $censusreport->signatureline = true;
            }
            if (report_ncccscensus_check_field_status('showdateline', 'pdf')) {
                $censusreport->dateline = true;
            }
            if ($footermessage = get_config('report_ncccscensus', 'footermessage')) {
                $censusreport->bottom .= $footermessage;
            }
            $censusreport->download($saveto);
            return true;
        } else {
            if ($type == REPORT_NCCCSCENSUS_ACTION_CSV) {
                if (!empty($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) {
                    header('Expires: 0');
                    header('Cache-Control: private, pre-check=0, post-check=0, max-age=0, must-revalidate');
                    header('Connection: Keep-Alive');
                    header('Content-Language: ' . current_language());
                    header('Keep-Alive: timeout=5, max=100');
                    header('Pragma: no-cache');
                    header('Pragma: expires');
                    header('Expires: Mon, 20 Aug 1969 09:23:00 GMT');
                    header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
                }
                header('Content-Transfer-Encoding: ascii');
                header('Content-Disposition: attachment; filename=' . $filename . '.csv');
                header('Content-Type: text/comma-separated-values');
                $output = fopen('php://output', 'w');
                fputcsv($output, array(get_string('ncccscensusreport_title', 'report_ncccscensus')));
                fputcsv($output, array());
                if (report_ncccscensus_check_field_status('showcoursename', 'csv')) {
                    fputcsv($output, array(get_string('coursetitle', $reportname), $course->fullname));
                }
                if (report_ncccscensus_check_field_status('showcoursecode', 'csv')) {
                    fputcsv($output, array(get_string('coursecode', $reportname), $course->shortname));
                }
                if (report_ncccscensus_check_field_status('showcourseid', 'csv') && $course->idnumber !== '') {
                    fputcsv($output, array(get_string('courseid', $reportname), $course->idnumber));
                }
                if (!empty($namesarrayview) && report_ncccscensus_check_field_status('showteachername', 'csv')) {
                    fputcsv($output, array_merge(array(get_string('instructor', $reportname)), $namesarraycsv));
                }
                fputcsv($output, array(get_string('reportrange', $reportname), $reportrange));
                if (isset($groupname)) {
                    fputcsv($output, array(get_string('section', $reportname), $groupname));
                } else {
                    fputcsv($output, array(get_string('section', $reportname), get_string('allgroups', $reportname)));
                }
                fputcsv($output, array());
                fputcsv($output, $table->head);
                foreach ($table->data as $row) {
                    fputcsv($output, $row);
                }
                $showsignatureline = report_ncccscensus_check_field_status('showsignatureline', 'csv');
                $showdateline = report_ncccscensus_check_field_status('showdateline', 'csv');
                if ($showsignatureline || $showdateline) {
                    fputcsv($output, array());
                    if ($showsignatureline) {
                        fputcsv($output, array(get_string('certified', $reportname)));
                        fputcsv($output, array(get_string('signature', $reportname) . get_string('underscores', $reportname)));
                    }
                    if ($showdateline) {
                        fputcsv($output, array(get_string('date') . get_string('underscores', 'report_ncccscensus')));
                    }
                }
                fclose($output);
            }
        }
    }
}
Esempio n. 30
0
<?php

$PAGE = "S_REPORT_MONTHLY_EDIT";
require_once '../_init_auth.php';
require_once 'report/class.Report.php';
require_once 'target/class.Target.php';
try {
    $param['page'] = $PAGE;
    $report = new report($request);
    $target = new target($request);
    //日付取得
    if (isset($request['target_date']) && !empty($request['target_date'])) {
        //サブメニューから遷移
        $date = date('Ymd', strtotime($request['target_date']));
        $termid = getTermId($date);
        $param['date'] = $date;
        $year = getYear($request['target_date']);
        $month = getMonth($request['target_date']);
        $month = sprintf('%01d', $month);
        $param['target_date'] = $date;
    } else {
        $param['errors'][] = "システムエラーが発生しました。";
        renderTemplate('error.tpl', $param);
        exit;
    }
    //新入社員情報取得
    if (isset($request['id'])) {
        $employee = $report->getEmpData($request['id']);
    } else {
        $param['errors'][] = "システムエラーが発生しました。";
        renderTemplate('error.tpl', $param);