本文整理汇总了PHP中Report::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Report::add方法的具体用法?PHP Report::add怎么用?PHP Report::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Report
的用法示例。
在下文中一共展示了Report::add方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __invoke
/**
* @param $params
* @return Report
*/
public function __invoke($params)
{
$deliveryMonitoringService = $this->getServiceLocator()->get(DeliveryMonitoringService::CONFIG_ID);
$deliveryClass = new \core_kernel_classes_Class('http://www.tao.lu/Ontologies/TAODelivery.rdf#AssembledDelivery');
$deliveries = $deliveryClass->getInstances(true);
$deliveryExecutionService = \taoDelivery_models_classes_execution_ServiceProxy::singleton();
$this->report = new Report(Report::TYPE_INFO, 'Updating of delivery monitoring cache...');
foreach ($deliveries as $delivery) {
if ($delivery->exists()) {
$deliveryExecutions = $deliveryExecutionService->getExecutionsByDelivery($delivery);
foreach ($deliveryExecutions as $deliveryExecution) {
$data = $deliveryMonitoringService->getData($deliveryExecution, true);
if ($deliveryMonitoringService->save($data)) {
$this->report->add(new Report(Report::TYPE_SUCCESS, "Delivery execution {$deliveryExecution->getUri()} successfully updated."));
} else {
$errors = $data->getErrors();
$errorsStr = " " . PHP_EOL;
array_walk($errors, function ($val, $key) use(&$errorsStr) {
$errorsStr .= " {$key} - {$val}" . PHP_EOL;
});
$this->report->add(new Report(Report::TYPE_ERROR, "Delivery execution {$deliveryExecution->getUri()} was not updated. {$errorsStr}"));
}
}
}
}
return $this->report;
}
示例2: go
public function go()
{
$fieldNames = array();
$headers = array();
foreach ($this->fields as $field) {
$fieldNames[] = $field->getName();
$headers[] = $field->getLabel();
}
$report = new Report($this->format);
if (!$this->exportOnlyHeaders) {
$title = new TextContent($this->label, array('bold' => true));
$report->add($title);
$data = $this->getData($fieldNames);
} else {
$data = array();
}
$table = new TableContent($headers, $data);
$report->add($table);
$report->output();
}
示例3: helpAction
/**
* Set help report
* @param string $message error message to be shown before help information
*/
private function helpAction($message = null)
{
if ($message !== null) {
$this->report = new Report(Report::TYPE_ERROR, $message . PHP_EOL);
}
$helpReport = new Report(Report::TYPE_INFO, "Usage: " . __CLASS__ . " <mode> [<args>]" . PHP_EOL . PHP_EOL . "Available modes:" . PHP_EOL . " list get list of all deliveries" . PHP_EOL . " compile recompile deliveries" . PHP_EOL);
if ($this->report) {
$this->report->add($helpReport);
} else {
$this->report = $helpReport;
}
}
示例4: addReport
/**
* @param $type
* @param string $message
*/
protected function addReport($type, $message)
{
$this->report->add(new Report($type, $message));
}
示例5: run
public function run($args)
{
Yii::import('application.modules.Reports.models.*');
if (!($query_type_events = ReportQueryType::model()->find('name=?', array('Events')))) {
$query_type_events = new ReportQueryType();
$query_type_events->name = 'Events';
$query_type_events->display_order = 1;
if (!$query_type_events->save()) {
print_r($query_type_events->getErrors(), true);
exit;
}
}
if (!($query_type_patients = ReportQueryType::model()->find('name=?', array('Patients')))) {
$query_type_patients = new ReportQueryType();
$query_type_patients->name = 'Patients';
$query_type_patients->display_order = 1;
if (!$query_type_patients->save()) {
print_r($query_type_patients->getErrors(), true);
exit;
}
}
/* input data types */
$ridt_number = ReportInputDataType::add('number', 1);
$ridt_dropdown_from_table = ReportInputDataType::add('dropdown_from_table', 2);
$ridt_date = ReportInputDataType::add('date', 3);
$ridt_diagnoses = ReportInputDataType::add('diagnoses', 4);
$ridt_checkbox = ReportInputDataType::add('checkbox', 5);
$ridt_checkbox_optional_match = ReportInputDataType::add('checkbox_optional_match', 6);
/* report item data types */
$rimt_total = ReportItemDataType::add('total');
$rimt_mean_and_range = ReportItemDataType::add('mean_and_range');
$rimt_number_and_percentage = ReportItemDataType::add('number_and_percentage');
$rimt_number_and_percentage_pair = ReportItemDataType::add('number_and_percentage_pair');
$rimt_list = ReportItemDataType::add('list');
$rimt_string = ReportItemDataType::add('string');
$rimt_date = ReportItemDataType::add('date');
$rimt_nhsdate = ReportItemDataType::add('NHSDate');
$rimt_conditional = ReportItemDataType::add('conditional');
$rimt_list_from_element_relation = ReportItemDataType::add('list_from_element_relation');
$rimt_element_relation = ReportItemDataType::add('element_relation');
$rimt_number = ReportItemDataType::add('number');
/* rule types */
$rule_one_of = ReportValidationRuleType::add('One of');
/* Cataract Outcomes */
Yii::import('application.modules.OphTrOperationnote.models.*');
$opnote = EventType::model()->find('class_name=?', array('OphTrOperationnote'));
$element_proclist = ElementType::model()->find('event_type_id=? and class_name=?', array($opnote->id, 'ElementProcedureList'));
$element_surgeon = ElementType::model()->find('event_type_id=? and class_name=?', array($opnote->id, 'ElementSurgeon'));
$element_cataract = ElementType::model()->find('event_type_id=? and class_name=?', array($opnote->id, 'ElementCataract'));
$report = Report::add(array('query_type_id' => $query_type_events->id, 'subspecialty_id' => 4, 'name' => 'Cataract outcomes', 'description' => 'Cataract outcomes report', 'icon' => 'treatment_operation', 'display_order' => 1, 'can_print' => 1, 'can_download' => 1));
$dataset1 = $report->addDataset('dataset1');
$el_proclist = $dataset1->addElement($element_proclist->id);
$el_proclist->addField('eye_id');
$el_surgeon = $dataset1->addElement($element_surgeon->id);
$el_surgeon->addField('surgeon_id');
$el_surgeon->addField('assistant_id');
$el_surgeon->addField('supervising_surgeon_id');
$el_cataract = $dataset1->addElement($element_cataract->id);
$dataset1->addInput(array('data_type_id' => $ridt_dropdown_from_table->id, 'data_type_param1' => 'Firm', 'data_type_param2' => 'getCataractList', 'name' => 'firm_id', 'description' => 'Firm', 'display_order' => 1));
$dataset1->addInput(array('data_type_id' => $ridt_dropdown_from_table->id, 'data_type_param1' => 'User', 'data_type_param2' => 'getListSurgeons', 'name' => 'surgeon_id', 'description' => 'Surgeon', 'display_order' => 2, 'or_id' => 1));
$dataset1->addInput(array('data_type_id' => $ridt_dropdown_from_table->id, 'data_type_param1' => 'User', 'data_type_param2' => 'getListSurgeons', 'name' => 'assistant_id', 'description' => 'Assistant surgeon', 'display_order' => 3, 'or_id' => 1));
$dataset1->addInput(array('data_type_id' => $ridt_dropdown_from_table->id, 'data_type_param1' => 'User', 'data_type_param2' => 'getListSurgeons', 'name' => 'supervising_surgeon_id', 'description' => 'Supervising surgeon', 'display_order' => 4, 'or_id' => 1));
$dataset1->addInput(array('data_type_id' => $ridt_date->id, 'name' => 'date_from', 'description' => 'Date from', 'default_value' => '-12 months', 'display_order' => 5, 'required' => 1));
$dataset1->addInput(array('data_type_id' => $ridt_date->id, 'name' => 'date_to', 'description' => 'Date to', 'default_value' => 'now', 'display_order' => 6, 'required' => 1));
$dataset1->addItem(array('data_type_id' => $rimt_total->id, 'name' => 'Cataracts', 'data_field' => 'cataracts', 'subtitle' => 'Number of cataracts performed', 'display_order' => 1));
$dataset1->addItem(array('data_type_id' => $rimt_mean_and_range->id, 'name' => 'Age', 'data_field' => 'age', 'data_input_field' => 'age', 'subtitle' => 'Age of patients', 'display_order' => 2));
$item = $dataset1->addItem(array('data_type_id' => $rimt_number_and_percentage_pair->id, 'name' => 'Eyes', 'data_field' => 'eyes', 'subtitle' => 'Eyes', 'display_order' => 3));
$item->addPairField(array('name' => 'left', 'field' => 'eye_id', 'value' => '1'));
$item->addPairField(array('name' => 'right', 'field' => 'eye_id', 'value' => '2'));
$dataset1->addItem(array('data_type_id' => $rimt_mean_and_range->id, 'name' => 'Final visual acuity', 'data_field' => 'final_visual_acuity', 'subtitle' => 'Final visual acuity', 'display_order' => 4));
$pc_rupture = CataractComplications::model()->find('name=?', array('PC rupture'));
$pc_ruptures = $dataset1->addItem(array('data_type_id' => $rimt_number_and_percentage->id, 'name' => 'PC ruptures', 'data_field' => 'pc_ruptures', 'subtitle' => 'PC ruptures', 'display_order' => 5, 'element_id' => $el_cataract->id, 'element_relation' => 'complications', 'element_relation_field' => 'complication_id', 'element_relation_value' => $pc_rupture->id));
$complications = $dataset1->addItem(array('data_type_id' => $rimt_number_and_percentage->id, 'name' => 'Complications', 'data_field' => 'complications', 'subtitle' => 'All complications', 'display_order' => 7, 'element_id' => $el_cataract->id, 'element_relation' => 'complications'));
$dataset2 = $report->addDataset('dataset2');
$el_cataract = $dataset2->addElement($element_cataract->id);
$avg_pc_ruptures = $dataset2->addItem(array('data_type_id' => $rimt_number_and_percentage->id, 'name' => 'Average', 'data_field' => 'pc_rupture_average', 'subtitle' => 'Average', 'display_order' => 6, 'element_id' => $el_cataract->id, 'element_relation' => 'complications', 'element_relation_field' => 'complication_id', 'element_relation_value' => $pc_rupture->id, 'display' => 0));
$avg_complications = $dataset2->addItem(array('data_type_id' => $rimt_number_and_percentage->id, 'name' => 'Average', 'data_field' => 'complication_average', 'subtitle' => 'Average', 'display_order' => 8, 'element_id' => $el_cataract->id, 'element_relation' => 'complications', 'display' => 0));
$graph = $report->addGraph('Cataract complication rate', 1);
$graph->addItem(array('report_item_id' => $pc_ruptures->id, 'name' => 'PC rupture rate', 'subtitle' => 'percentage', 'range' => 10, 'display_order' => 1, 'show_scale' => 0));
$graph->addItem(array('report_item_id' => $avg_pc_ruptures->id, 'name' => 'Average rate', 'subtitle' => 'institution average', 'range' => 10, 'display_order' => 2));
$graph->addItem(array('report_item_id' => $complications->id, 'name' => 'Complication rate', 'subtitle' => 'percentage', 'range' => 10, 'display_order' => 3, 'show_scale' => 0));
$graph->addItem(array('report_item_id' => $avg_complications->id, 'name' => 'Average rate', 'subtitle' => 'institution average', 'range' => 10, 'display_order' => 4));
/* Operations */
$report = Report::add(array('query_type_id' => $query_type_events->id, 'subspecialty_id' => null, 'name' => 'Operations', 'description' => 'Operations', 'icon' => 'treatment_operation', 'display_order' => 3, 'can_print' => 1, 'can_download' => 1));
$dataset1 = $report->addDataset('dataset1');
$el_proclist = $dataset1->addElement($element_proclist->id);
$el_proclist->addField('eye_id');
$el_proclist->addJoin(array('join_table' => 'eye', 'join_clause' => 'eye_id = eye.id', 'join_select' => 'eye.name as eye'));
$el_surgeon = $dataset1->addElement($element_surgeon->id);
$el_surgeon->addField('surgeon_id');
$el_surgeon->addField('assistant_id');
$el_surgeon->addField('supervising_surgeon_id');
$el_cataract = $dataset1->addElement($element_cataract->id, 1);
$surgeon_id = $dataset1->addInput(array('data_type_id' => $ridt_dropdown_from_table->id, 'data_type_param1' => 'User', 'data_type_param2' => 'getListSurgeons', 'name' => 'surgeon_id', 'description' => 'Surgeon', 'display_order' => 1, 'required' => 1, 'include' => 0));
$dataset1->addInput(array('data_type_id' => $ridt_checkbox_optional_match->id, 'name' => 'match_surgeon', 'default_value' => 1, 'description' => 'Match surgeon', 'display_order' => 2, 'data_type_param1' => 'surgeon_id', 'data_type_param2' => 'surgeon_id', 'or_id' => 1));
$dataset1->addInput(array('data_type_id' => $ridt_checkbox_optional_match->id, 'name' => 'match_assistant_surgeon', 'default_value' => 1, 'description' => 'Match assistant surgeon', 'display_order' => 3, 'data_type_param1' => 'surgeon_id', 'data_type_param2' => 'assistant_id', 'or_id' => 1));
$dataset1->addInput(array('data_type_id' => $ridt_checkbox_optional_match->id, 'name' => 'match_supervising_surgeon', 'default_value' => 1, 'description' => 'Match supervising surgeon', 'display_order' => 4, 'data_type_param1' => 'surgeon_id', 'data_type_param2' => 'supervising_surgeon_id', 'or_id' => 1));
$dataset1->addInput(array('data_type_id' => $ridt_date->id, 'name' => 'date_from', 'description' => 'Date from', 'default_value' => '-12 months', 'display_order' => 5, 'required' => 1));
$dataset1->addInput(array('data_type_id' => $ridt_date->id, 'name' => 'date_to', 'description' => 'Date to', 'default_value' => 'now', 'display_order' => 6, 'required' => 1));
$operations = $dataset1->addItem(array('data_type_id' => $rimt_list->id, 'name' => 'Operations', 'data_field' => 'operations', 'subtitle' => 'Operations', 'display_order' => 1));
//.........这里部分代码省略.........