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


PHP Report::insert方法代码示例

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


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

示例1: savereport_POST

function savereport_POST(Web &$w)
{
    $w->Report->navigation($w, "Create Report");
    // get type of statement: select/insert/update/delete
    $_POST['sqltype'] = $w->Report->getSQLStatementType($_POST['report_code']);
    // insert report into database
    $report = new Report($w);
    $report->fill($_POST);
    $report->insert();
    // if insert successful, make creator a MEMBER of this report
    if ($report->id) {
        $arr['report_id'] = $report->id;
        $arr['user_id'] = $w->session('user_id');
        $mem = new ReportMember($w);
        $mem->fill($arr);
        $mem->insert();
    }
    $w->msg("Report created", "/report/index/");
}
开发者ID:itillawarra,项目名称:cmfive,代码行数:19,代码来源:savereport.php

示例2: addAction

 public function addAction()
 {
     if ($_POST['sToken'] != Helper::getStoken()) {
         return $this->alert('sToken 錯誤', '/');
     }
     try {
         $this->_checkReportData($_POST);
     } catch (Exception $e) {
         return $this->alert($e->getMessage(), '/');
     }
     if ($report = Report::find_by_news_link($_POST['news_link'])) {
         return $this->alert('這個連結已經被人回報過了,將會把您導向該回報去', '/index/log/' . $report->id);
     }
     if ($normaled_news_link = URLNormalizer::query($_POST['news_link']) and $report = Report::find_by_news_link_unique($normaled_news_link->normalized_id)) {
         return $this->alert('這個連結已經被人回報過了,將會把您導向該回報去', '/index/log/' . $report->id);
     }
     $now = time();
     $report = Report::insert(array('news_title' => strval($_POST['news_title']), 'news_link' => strval($_POST['news_link']), 'news_link_unique' => $normaled_news_link ? $normaled_news_link->normalized_id : '', 'report_title' => strval($_POST['report_title']), 'report_link' => strval($_POST['report_link']), 'created_at' => $now, 'updated_at' => $now));
     ReportChangeLog::insert(array('report_id' => $report->id, 'updated_at' => $now, 'updated_from' => intval(ip2long($_SERVER['REMOTE_ADDR'])), 'updated_by' => strval($this->view->user->user_id), 'old_values' => '', 'new_values' => json_encode($report->toArray())));
     return $this->alert('新增成功', '/index/log/' . $report->id);
 }
开发者ID:swallowcc,项目名称:newshelper-backend,代码行数:21,代码来源:IndexController.php

示例3: insertMultipeReports

function insertMultipeReports()
{
    // This creates multiple reports and saves them
    global $tool, $form, $report_types;
    $from = $_POST['date1'];
    $to = $_POST['date2'];
    $name = $_POST['name'];
    if ($name == '') {
        $form->warning("Invalid Name, can not be empty");
        return false;
    }
    // Check From date
    if (is_numeric($from) && date($from)) {
        $start_stamp = date($from);
    } elseif ($from != '' && strtotime($from)) {
        $start_stamp = strtotime($from);
    } else {
        $form->warning("Invalid start date {$from}");
        return false;
    }
    // Check To date
    if (is_numeric($to) && date($to)) {
        $end_stamp = date($to);
    } elseif ($to != '' && strtotime($to)) {
        $end_stamp = strtotime($to);
    } else {
        $form->warning("Invalid End date {$to}");
        return false;
    }
    flush();
    $i = 1;
    $total = count($_POST[profile_id]);
    print "<p><b>Creating {$total} reports for {$name}, please be patient as this may take a few minutes<br></p></b>";
    flush();
    foreach ($_POST[profile_id] as $profile_id) {
        $profile = new CheckReportProfile($profile_id);
        print "creating report {$i} of {$total}: " . $profile->get_name() . " Type (" . $profile->get_report_type() . ").<br>";
        flush();
        $report_checks = array();
        foreach ($profile->get_checks() as $check_id => $check_name) {
            array_push($report_checks, $check_id);
        }
        $report_type = $profile->get_report_type();
        $timers = get_report_data($start_stamp, $end_stamp, $report_type, $report_checks);
        $report = new Report();
        $report->set_name($name);
        $report->set_profile_id($profile_id);
        $report->set_report_type($profile->get_report_type());
        $report->set_start_time($from);
        $report->set_end_time($to);
        $report->set_ok_secs($timers[ok]);
        $report->set_warning_secs($timers[warning]);
        $report->set_critical_secs($timers[critical]);
        $report->set_unknown_secs($timers[unknown]);
        $report->set_other_secs($timers[other]);
        $report->set_no_data_secs($timers[no_data]);
        $new_id = $report->insert();
        if (is_numeric($new_id)) {
            //print "new is is $new_id<br>";
        } else {
            print "insert failed! reason: " . $report->get_error() . "<br>";
        }
        $i++;
    }
    print "<br><br>Done! You're reports are available here: <a href='" . $_SERVER['PHP_SELF'] . "?action=display_reports_by_name&name={$name}'> Availability Report {$name}</a><br>";
}
开发者ID:precurse,项目名称:netharbour,代码行数:66,代码来源:monitor.php


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