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


PHP Reports::save方法代码示例

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


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

示例1: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Reports();
     $type = $_GET['type'];
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Reports'])) {
         $model->attributes = $_POST['Reports'];
         $model->type = $type;
         if ($type == 'ledger') {
             if ($model->save()) {
                 $this->redirect(array('view', 'id' => $model->id));
             }
         } else {
             $this->redirect(array('indexTransactionType', 'type' => $type, 'model' => $model));
         }
     }
     $this->render('create', array('model' => $model, 'type' => $type));
 }
开发者ID:KhemPoudel,项目名称:billingapp,代码行数:23,代码来源:ReportsController.php

示例2: executeAdd

 public function executeAdd(sfWebRequest $request)
 {
     if ($request->isMethod('post')) {
         $name = $request->getParameter('reports')['name'];
         if (!$name) {
             $this->forwardToSecureAction();
         }
         if (!in_array($name, array_keys(Reports::getGlobalReports($this->getUser())))) {
             $this->info_message = $this->getI18N()->__("You are not allowed to print this kind of report.");
             return $this->renderPartial("info_msg", array("info_message" => $this->info_message));
         }
         $default_vals = array();
         foreach ($request->getRequestParameters() as $rp_key => $rp_value) {
             if (strpos($rp_key, 'default_vals[') !== false && strpos($rp_key, ']') !== false && strpos($rp_key, ']') - strpos($rp_key, '[') > 1) {
                 $default_vals[substr($rp_key, strpos($rp_key, '[') + 1, strpos($rp_key, ']') - strpos($rp_key, '[') - 1)] = $rp_value;
             }
         }
         $this->setWidgetsOptions($name);
         $this->form = new ReportsForm(null, array('fields' => $this->widgets, 'name' => $name, 'model_name' => $request->getParameter('catalogue', 'taxonomy'), 'with_js' => $request->getParameter('with_js', false), 'default_vals' => $default_vals, 'current_user' => $this->getUser()));
         $this->form->bind($request->getParameter($this->form->getName()));
         if ($this->form->isValid()) {
             if (isset($request->getParameter('reports')['loan_id']) && count(Doctrine::getTable('Loans')->getPrintableLoans(array($request->getParameter('reports')['loan_id']), $this->getUser())) == 0) {
                 $this->info_message = $this->getI18n()->__("You don't have the necessary credentials to print this loan");
             } else {
                 $this->info_message = $this->getI18n()->__("Your report has been saved. It will be availlable tomorrow");
                 $report = new Reports();
                 $report->fromArray(array('name' => $name, 'user_ref' => $this->getUser()->getId(), 'lang' => $this->getUser()->getCulture(), 'format' => $request->getParameter('reports')['format'], 'comment' => $request->getParameter('reports')['comment']));
                 $report->setParameters($request->getParameter('reports'));
                 // Save the report whatever it's a fast or a non fast one
                 $report->save();
                 //if it's a fast report, it can be downloaded directly
                 if (Reports::getIsFast($name)) {
                     $response = $this->processDownload($report);
                     if ($response != 0) {
                         $message = json_encode($this->getPartial("info_msg", array("info_message" => $this->info_message)));
                         return $this->renderText('{ "report_url" : "' . $this->generateUrl("default", array("module" => "report", "action" => "downloadFile", "id" => $response), TRUE) . '", "message": ' . $message . ' }');
                     }
                 }
             }
             return $this->renderPartial("info_msg", array("info_message" => $this->info_message));
         }
         $val = $this->renderPartial("report_form", array('form' => $this->form, 'fields' => $this->widgets, 'fields_options' => $this->widgets_options, 'fields_at_second_line' => $this->widgets_second_line_count, 'model_name' => $request->getParameter('catalogue', 'taxonomy'), 'fast' => Reports::getIsFast($name), 'with_js' => $request->getParameter('with_js', false), 'default_vals' => $default_vals));
         return $val;
     }
 }
开发者ID:naturalsciences,项目名称:Darwin,代码行数:45,代码来源:actions.class.php

示例3: reportPost

 public function reportPost($attr)
 {
     $check = Reports::model()->findByAttributes(array('post_id' => $attr['post_id']));
     if ($check) {
         return 1;
     } else {
         $model = new Reports();
         $model->setAttributes($attr);
         $model->created_at = time();
         $model->status = 0;
         $model->updated_at = time();
         // $model->type = Yii::app()->params['USER_REPORT'];
         $rel = new UserPostRelationship();
         $rel->user_id = $attr['from'];
         $rel->post_id = $attr['post_id'];
         $rel->created_at = time();
         $rel->updated_at = time();
         $rel->type = Yii::app()->params['USER_REPORT'];
         if ($model->save(FALSE) && $rel->save(FALSE)) {
             return 2;
         }
     }
     return 3;
 }
开发者ID:huynt57,项目名称:image_chooser,代码行数:24,代码来源:Posts.php

示例4: dirname

<?php

include dirname(__FILE__) . '/../../bootstrap/Doctrine.php';
$t = new lime_test(4, new lime_output_color());
$u = Doctrine::getTable('Users')->getUserByPassword("root", "evil");
$reports = Doctrine::getTable('Reports')->getTaskReports();
$t->is(count($reports), 0, '"0" Tasks report available');
$report = new Reports();
$report->setParameters(array('name' => 'annual_stat_collection', 'collection_ref' => 1, 'date_from' => '01-01-2000', 'date_to' => '31-12-2012'));
$report->setUserRef($u->getId());
$report->setName('annual_stat_collection');
$report->setLang('en');
$report->setFormat('pdf');
$report->save();
$reports = Doctrine::getTable('Reports')->getTaskReports();
$t->is(count($reports), 1, '"1" Task report available');
$reports = Doctrine::getTable('Reports')->getUserReport($u->getId());
$t->is(count($reports), 1, '"1" report available for user "' . $u->getGivenName() . '"');
foreach ($reports as $report) {
    $t->is($report->getParameters()->count(), 3, '"3" parameters (collection_ref,date_from,date_to) set for "' . $report->getName() . '"');
}
开发者ID:naturalsciences,项目名称:Darwin,代码行数:21,代码来源:ReportsTableTest.php

示例5: cheque

 public function cheque()
 {
     Session::put('goToChecklist', 'true');
     //Initializations
     $amt = Input::get('amt');
     $num = Input::get('num');
     $date = Input::get('date');
     $taskdetails_id = Input::get('taskdetails_id');
     $check = 0;
     //Validation Process
     if (ctype_alnum(str_replace(array(' ', '-', '.'), '', $num))) {
         $check = $check + 1;
     }
     if (ctype_digit(str_replace(array(' ', ',', '.'), '', $amt))) {
         $check = $check + 1;
     }
     if (trim(Input::get('date')) == "01/01/70") {
         $check = 0;
     }
     if ($check == 2) {
         $taskd = TaskDetails::find($taskdetails_id);
         $docs = Document::find($taskd->doc_id);
         if ($taskd->status == "Done") {
             Session::put('errorchecklist', 'Saved failed. Task was already completed by another user.');
             return Redirect::back();
         }
         $id = $docs->pr_id;
         //Cheque
         $timestamp = strtotime($date);
         $dateFinished = date("Y-m-d H:i:s", $timestamp);
         $dateFinished = substr($dateFinished, 0, strrpos($dateFinished, ' '));
         $reports = Reports::whereDate($dateFinished)->first();
         if ($reports == null) {
             $reports = new Reports();
             $reports->date = $dateFinished;
             $reports->chequeCount = 1;
         } else {
             $reports->chequeCount = $reports->chequeCount + 1;
         }
         $reports->save();
         //End Cheque
         $delcount = Count::where('doc_id', $docs->id)->delete();
         $userx = User::get();
         foreach ($userx as $userv) {
             $count = new Count();
             $count->user_id = $userv->id;
             $count->doc_id = $docs->id;
             $count->save();
         }
         Session::put('successchecklist', 'Task completed.');
         $taskd = TaskDetails::find($taskdetails_id);
         $taskd->status = "Done";
         $taskd->custom1 = $amt;
         $taskd->custom2 = $num;
         $taskd->custom3 = $date;
         $taskd->save();
         $tasknext = TaskDetails::find($taskdetails_id + 1);
         $tasknextc = TaskDetails::where('id', $taskdetails_id + 1)->where('doc_id', $docs->pr_id)->count();
         date_default_timezone_set("Asia/Manila");
         $upDate = date('Y-m-d H:i:s');
         DB::table('purchase_request')->where('id', $id)->update(array('updated_at' => $upDate));
         DB::table('taskdetails')->where('id', $taskdetails_id)->update(array('dateFinished' => $upDate));
         if ($tasknextc != 0) {
             //Project Type Filter
             $counter = 1;
             $tasknext = TaskDetails::find($taskdetails_id + $counter);
             while ($tasknext->status == "Lock" || $tasknext->status == "Done") {
                 $counter = $counter + 1;
                 $tasknext = TaskDetails::find($taskdetails_id + $counter);
             }
             $tasknext->status = "New";
             $tasknext->save();
             //End Project Type Filter
         } else {
             $purchase = Purchase::find($docs->pr_id);
             $purchase->status = "Closed";
             $purchase->save();
             $request_id = Input::get('pr_id');
             return Redirect::to("purchaseRequest/vieweach/{$request_id}");
         }
     } else {
         Session::put('errorchecklist', 'Invalid input.');
         return Redirect::back()->withInput();
     }
     return Redirect::back();
 }
开发者ID:iHunt101,项目名称:procurementTrackingSystem,代码行数:86,代码来源:PurchaseRequestController.php

示例6: janisawesome

 public function janisawesome()
 {
     function generateRandomString($length = 10)
     {
         $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
         $randomString = '';
         for ($i = 0; $i < $length; $i++) {
             $randomString .= $characters[rand(0, strlen($characters) - 1)];
         }
         return $randomString;
     }
     function generateRandomAmount()
     {
         $length = rand(4, 8);
         $randomString = '';
         for ($i = 0; $i < $length; $i++) {
             $randomString .= rand(1, 9);
         }
         return $randomString;
     }
     $numLoop = 1;
     while ($numLoop < 301) {
         $purchase = new Purchase();
         $document = new Document();
         $purchase->projectPurpose = generateRandomString();
         $purchase->sourceOfFund = generateRandomString();
         $controlAmt = generateRandomAmount();
         $controlAmt .= ".00";
         $purchase->amount = number_format($controlAmt);
         $purchase->office = "1";
         $purchase->requisitioner = "1";
         $purchase->dateRequested = date('Y-m-d H:i:s');
         $purchase->dateReceived = date('Y-m-d H:i:s');
         $purchase->status = 'Active';
         $purchase->otherType = " ";
         // Get latest control number
         $cn = 0;
         $purchase_controlNo = Purchase::orderBy('ControlNo', 'DESC')->first();
         if (!$purchase_controlNo == NuLL) {
             $cn = $purchase_controlNo->controlNo;
         }
         $cn += 1;
         $purchase->controlNo = $cn;
         if (Input::get('otherType') == ' ') {
             $purchase->projectType = "None";
         } else {
             $purchase->projectType = "None";
         }
         // Set creator id
         $user_id = Auth::user()->id;
         $purchase->created_by = $user_id;
         $purchase_save = $purchase->save();
         if ($purchase_save) {
             if ($controlAmt < 50000) {
                 $amtControl = 1;
             } else {
                 if ($controlAmt >= 50000 && $controlAmt <= 500000) {
                     $amtControl = 2;
                 } else {
                     if ($controlAmt >= 500000) {
                         $amtControl = 3;
                     }
                 }
             }
             $document->pr_id = $purchase->id;
             $document->work_id = $amtControl;
             $document_save = $document->save();
             if ($document_save) {
                 $doc_id = $document->id;
                 $workflow = Workflow::find($document->work_id);
                 $section = Section::where('workflow_id', $document->work_id)->orderBy('section_order_id', 'ASC')->get();
                 $firstnew = 0;
                 // Set due date;
                 $new_purchase = Purchase::find($purchase->id);
                 $workflow_id = "1";
                 $workflow = Workflow::find($workflow_id);
                 $addToDate = $workflow->totalDays;
                 date_default_timezone_set("Asia/Manila");
                 $dueDate = date('Y-m-d H:i:s', strtotime("+{$addToDate} days"));
                 $new_purchase->dueDate = $dueDate;
                 $new_purchase->save();
                 $tasks = Task::where('wf_id', $document->work_id)->orderBy('section_id', 'ASC')->orderBy('order_id', 'ASC')->get();
                 foreach ($tasks as $task) {
                     $task_details = new TaskDetails();
                     $task_details->task_id = $task->id;
                     $stringamount = $new_purchase->amount;
                     $stringamount = str_replace(str_split(','), '', $stringamount);
                     $amount = (double) $stringamount;
                     if ($firstnew == 0) {
                         $task_details->status = "New";
                     } else {
                         $task_details->status = "Pending";
                     }
                     //Project Type
                     if ($task->taskName == "PRE-PROCUREMENT CONFERENCE" || $task->taskName == "ADVERTISEMENT" || $task->taskName == "PRE-BID CONFERENCE") {
                         $task_details->status = "Lock";
                         if ($new_purchase->projectType == "Goods/Services") {
                             if ($task->taskName == "PRE-PROCUREMENT CONFERENCE" || $task->taskName == "ADVERTISEMENT") {
                                 if ($amount > 2000000) {
                                     $task_details->status = "Pending";
//.........这里部分代码省略.........
开发者ID:iHunt101,项目名称:procurementTrackingSystem,代码行数:101,代码来源:BaseController.php

示例7: actionReport

 /**
  * 举报
  */
 public function actionReport()
 {
     $this->checkLogin();
     $data = array();
     $type = zmf::filterInput($_POST['t'], 't', 1);
     $url = zmf::filterInput($_POST['u'], 't', 1);
     $desc = zmf::filterInput($_POST['desc'], 't', 1);
     $sid = zmf::filterInput($_POST['k']);
     $allowType = array('posts', 'attachments', 'comments', 'question', 'answer', 'poipost', 'poitips');
     if (!in_array($type, $allowType)) {
         //Forbidden::updateTimes();
         $this->jsonOutPut(0, Yii::t('default', 'forbiddenaction'));
     }
     if (!isset($sid) or !is_numeric($sid)) {
         $this->jsonOutPut(0, Yii::t('default', 'selectreporttarget'));
     }
     $data['uid'] = zmf::uid();
     $data['logid'] = $sid;
     $data['classify'] = $type;
     $data['url'] = $url;
     $data['desc'] = $desc;
     $data['ip'] = ip2long(Yii::app()->request->userHostAddress);
     $data['status'] = Posts::STATUS_STAYCHECK;
     $data['cTime'] = zmf::now();
     $fm = new Reports();
     $fm->attributes = $data;
     if ($fm->validate()) {
         if ($fm->save()) {
             $this->jsonOutPut(1, Yii::t('default', 'reportsuccess'));
         }
     } else {
         $this->jsonOutPut(0, Yii::t('default', 'unkownerror'));
     }
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:37,代码来源:AjaxController.php


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