/** * @param ReportWizardForm $formModel */ protected function setCommonAttributes(ReportWizardForm $formModel) { $formModel->id = $this->report->getId(); $formModel->description = $this->report->getDescription(); $formModel->moduleClassName = $this->report->getModuleClassName(); if ($this->report->getOwner()->id > 0) { $formModel->ownerId = (int) $this->report->getOwner()->id; $formModel->ownerName = strval($this->report->getOwner()); } $formModel->name = $this->report->getName(); $formModel->type = $this->report->getType(); $formModel->filtersStructure = $this->report->getFiltersStructure(); $formModel->currencyConversionType = $this->report->getCurrencyConversionType(); $formModel->spotConversionCurrencyCode = $this->report->getSpotConversionCurrencyCode(); if ($this->report->isNew()) { $formModel->setIsNew(); } $formModel->setExplicitReadWriteModelPermissions($this->report->getExplicitReadWriteModelPermissions()); $formModel->filters = $this->report->getFilters(); $formModel->orderBys = $this->report->getOrderBys(); $formModel->groupBys = $this->report->getGroupBys(); $formModel->displayAttributes = $this->report->getDisplayAttributes(); $formModel->drillDownDisplayAttributes = $this->report->getDrillDownDisplayAttributes(); $formModel->chart = $this->report->getChart(); }
$do_report_folder = new ReportFolder(); $report_folders = $do_report_folder->get_report_folders(); $report_name = ''; $idreport_folder = 0 ; $description = ''; $e_set_report_data = new Event("Report->eventSaveReport"); $e_set_report_data->addParam("step","7"); if (isset($edit) && $edit == 1) { $edit_msg = _('Update Report'); $e_set_report_data->addParam("mode","edit"); $e_set_report_data->addParam("sqrecord",$sqcrm_record_id); $do_report = new Report(); $do_report->getId($sqcrm_record_id); $report_name = $do_report->name; $idreport_folder = $do_report->idreport_folder; $description = $do_report->description; } else { $edit_msg = _('Create Report'); $e_set_report_data->addParam("mode","add"); } echo '<form class="form-horizontal" id="Report__eventSaveReport" name="Report__eventSaveReport" action="/eventcontroler.php" method="post">'; echo $e_set_report_data->getFormEvent(); ?> <div class="container-fluid"> <div class="row"> <div class="col-md-12"> <div class="box_content"> <p><strong><?php echo $edit_msg;?> > <?php echo _('Step 7');?></strong></p>
public function setReport(Report $report) { $this->rid = $report->getId(); }
// CUSTOM REPORTS $reports = array_var($customReports, $type_id, array()); ?> <div class="report_header"><?php echo lang('custom reports'); ?> </div> <?php if (count($reports) > 0) { ?> <ul> <?php foreach ($reports as $report) { ?> <li style="padding-top:4px"><div><a style="font-weight:bold;margin-right:15px" class="internalLink" href="<?php echo get_url('reporting', 'view_custom_report', array('id' => $report->getId())); ?> "><?php echo $report->getObjectName(); ?> </a> <?php if ($report->canEdit(logged_user())) { ?> <a style="margin-right:5px" class="internalLink coViewAction ico-edit" href="<?php echo get_url('reporting', 'edit_custom_report', array('id' => $report->getId())); ?> "><?php echo lang('edit'); ?> </a>
function add_custom_report() { if (logged_user()->isGuest()) { flash_error(lang('no access permissions')); ajx_current("empty"); return; } tpl_assign('url', get_url('reporting', 'add_custom_report')); $report_data = array_var($_POST, 'report'); if (is_array($report_data)) { tpl_assign('report_data', $report_data); $conditions = array_var($_POST, 'conditions'); if (!is_array($conditions)) { $conditions = array(); } tpl_assign('conditions', $conditions); $columns = array_var($_POST, 'columns'); if (is_array($columns) && count($columns) > 0) { tpl_assign('columns', $columns); $newReport = new Report(); if (!$newReport->canAdd(logged_user())) { flash_error(lang('no access permissions')); ajx_current("empty"); return; } // if $newReport->setName($report_data['name']); $newReport->setDescription($report_data['description']); $newReport->setObjectType($report_data['object_type']); $newReport->setOrderBy($report_data['order_by']); $newReport->setIsOrderByAsc($report_data['order_by_asc'] == 'asc'); try { DB::beginWork(); $newReport->save(); $allowed_columns = $this->get_allowed_columns($report_data['object_type'], true); foreach ($conditions as $condition) { if ($condition['deleted'] == "1") { continue; } foreach ($allowed_columns as $ac) { if ($condition['field_name'] == $ac['id']) { $newCondition = new ReportCondition(); $newCondition->setReportId($newReport->getId()); $newCondition->setCustomPropertyId($condition['custom_property_id']); $newCondition->setFieldName($condition['field_name']); $newCondition->setCondition($condition['condition']); $condValue = array_key_exists('value', $condition) ? $condition['value'] : ''; if ($condition['field_type'] == 'boolean') { $newCondition->setValue(array_key_exists('value', $condition)); } else { if ($condition['field_type'] == 'date') { if ($condValue != '') { $dtFromWidget = DateTimeValueLib::dateFromFormatAndString(user_config_option('date_format'), $condValue); $newCondition->setValue(date("m/d/Y", $dtFromWidget->getTimestamp())); } } else { $newCondition->setValue($condValue); } } $newCondition->setIsParametrizable(isset($condition['is_parametrizable'])); $newCondition->save(); } } } asort($columns); //sort the array by column order foreach ($columns as $column => $order) { if ($order > 0) { $newColumn = new ReportColumn(); $newColumn->setReportId($newReport->getId()); if (is_numeric($column)) { $newColumn->setCustomPropertyId($column); } else { $newColumn->setFieldName($column); } $newColumn->save(); } } DB::commit(); flash_success(lang('custom report created')); ajx_current('back'); } catch (Exception $e) { DB::rollback(); flash_error($e->getMessage()); ajx_current("empty"); } } } $selected_type = array_var($_GET, 'type', ''); $types = array(array("", lang("select one")), array("Companies", lang("companies")), array("Contacts", lang("contacts")), array("MailContents", lang("email type")), array("ProjectEvents", lang("events")), array("ProjectFiles", lang("file")), array("ProjectMilestones", lang("milestone")), array("ProjectMessages", lang("message")), array("ProjectTasks", lang("task")), array("Users", lang("user")), array("ProjectWebpages", lang("webpage")), array("Projects", lang("workspace"))); if ($selected_type != '') { tpl_assign('allowed_columns', $this->get_allowed_columns($selected_type)); } tpl_assign('object_types', $types); tpl_assign('selected_type', $selected_type); }
public function __construct(Report $report) { $this->_report = $report; KalturaLog::debug('Report #' . $report->getId()); }
// CUSTOM REPORTS $reports = array_var($customReports, $type_id, array()); ?> <div class="report_header"><?php echo lang('custom reports') ?></div> <?php if(count($reports) > 0){ $alt = true; ?> <ul> <?php foreach($reports as $report){ $alt = !$alt; ?> <li style="padding-top:4px"> <div style="max-width:700px;<?php echo $alt ? 'background-color:#ECEFF7;' : '';?>"> <a style="font-weight:bold;margin-right:15px" class="internalLink" href="<?php echo get_url('reporting','view_custom_report', array('id' => $report->getId()))?>"><?php echo $report->getObjectName() ?></a> <div style="float:right;padding-left:15px;"> <?php if ($report->canEdit(logged_user())) { ?> <a style="margin-right:5px" class="internalLink coViewAction ico-edit" href="<?php echo get_url('reporting','edit_custom_report', array('id' => $report->getId()))?>"><?php echo lang('edit') ?></a> <?php } ?> <?php if ($report->canDelete(logged_user())) { ?> <a style="margin-right:5px" class="internalLink coViewAction ico-delete" href="javascript:og.deleteReport(<?php echo $report->getId() ?>)"><?php echo lang('delete') ?></a> <?php } ?> </div> <div style="float:right;max-width:700px;" id="report-<?php echo $report->getId();?>"> <span class="breadcrumb"></span> <script> <?php $crumbOptions = json_encode($report->getMembersToDisplayPath()); $crumbJs = " og.getCrumbHtml($crumbOptions) ";?> var crumbHtml = <?php echo $crumbJs;?>; $("#report-<?php echo $report->getId()?> .breadcrumb").html(crumbHtml);
public function delete(Report &$report) { $this->db->query("delete from Report where id=" . $report->getId()); }
function generatePDFReport(Report $report, $results) { $results['columns'][] = lang("status"); $types = self::get_report_column_types($report->getId()); $ot = ObjectTypes::findById($report->getReportObjectTypeId()); eval('$managerInstance = ' . $ot->getHandlerClass() . "::instance();"); $externalCols = $managerInstance->getExternalColumns(); $filename = str_replace(' ', '_', $report->getObjectName()) . date('_YmdHis'); $pageLayout = $_POST['pdfPageLayout']; $fontSize = $_POST['pdfFontSize']; include_once LIBRARY_PATH . '/pdf/fpdf.php'; $pdf = new FPDF($pageLayout); $pdf->setTitle($report->getObjectName()); $pdf->AddPage(); $pdf->SetFont('Arial', '', $fontSize); $pdf->Cell(80); $report_title = iconv(mb_internal_encoding(), "ISO-8859-1", html_entity_decode($report->getObjectName(), ENT_COMPAT)); $pdf->Cell(30, 10, $report_title); $pdf->Ln(20); $colSizes = array(); $maxValue = array(); $fixed_col_sizes = array(); foreach ($results['rows'] as $row) { $i = 0; array_shift($row); foreach ($row as $k => $value) { if (!isset($maxValue[$i])) { $maxValue[$i] = ''; } if (strlen(strip_tags($value)) > strlen($maxValue[$i])) { $maxValue[$i] = strip_tags($value); } $i++; } } $k = 0; foreach ($maxValue as $str) { $col_title_len = $pdf->GetStringWidth($results['columns'][$k]); $colMaxTextSize = max($pdf->GetStringWidth($str), $col_title_len); $db_col = $results['columns'][$k]; $colType = array_var($types, array_var($results['db_columns'], $db_col, ''), ''); if ($colType == DATA_TYPE_DATETIME && !($report->getObjectTypeName() == 'event' && $results['db_columns'][$db_col] == 'start')) { $colMaxTextSize = $colMaxTextSize / 2; if ($colMaxTextSize < $col_title_len) { $colMaxTextSize = $col_title_len; } } $fixed_col_sizes[$k] = $colMaxTextSize; $k++; } $fixed_col_sizes = self::fix_column_widths($pageLayout == 'P' ? 172 : 260, $fixed_col_sizes); $max_char_len = array(); $i = 0; foreach ($results['columns'] as $col) { $colMaxTextSize = $fixed_col_sizes[$i]; $colFontSize = $colMaxTextSize + 5; $colSizes[$i] = $colFontSize; $col_name = iconv(mb_internal_encoding(), "ISO-8859-1", html_entity_decode($col, ENT_COMPAT)); $pdf->Cell($colFontSize, 7, $col_name); $max_char_len[$i] = self::get_max_length_from_pdfsize($pdf, $colFontSize); $i++; } $lastColX = $pdf->GetX(); $pdf->Ln(); $pdf->Line($pdf->GetX(), $pdf->GetY(), $lastColX, $pdf->GetY()); foreach ($results['rows'] as $row) { $i = 0; $more_lines = array(); $col_offsets = array(); foreach ($row as $k => $value) { if ($k == 'object_type_id') { continue; } $db_col = isset($results['db_columns'][$results['columns'][$i]]) ? $results['db_columns'][$results['columns'][$i]] : ''; $cell = format_value_to_print($db_col, html_to_text($value), $k == 'link' ? '' : array_var($types, $k), array_var($row, 'object_type_id'), '', is_numeric(array_var($results['db_columns'], $k)) ? "Y-m-d" : user_config_option('date_format')); $cell = iconv(mb_internal_encoding(), "ISO-8859-1", html_entity_decode($cell, ENT_COMPAT)); $splitted = self::split_column_value($cell, $max_char_len[$i]); $cell = $splitted[0]; if (count($splitted) > 1) { array_shift($splitted); $ml = 0; foreach ($splitted as $sp_val) { if (!isset($more_lines[$ml]) || !is_array($more_lines[$ml])) { $more_lines[$ml] = array(); } $more_lines[$ml][$i] = $sp_val; $ml++; } $col_offsets[$i] = $pdf->x; } $pdf->Cell($colSizes[$i], 7, $cell); $i++; } foreach ($more_lines as $ml_values) { $pdf->Ln(); foreach ($ml_values as $col_idx => $col_val) { $pdf->SetX($col_offsets[$col_idx]); $pdf->Cell($colSizes[$col_idx], 7, $col_val); } } $pdf->Ln(); $pdf->SetDrawColor(220, 220, 220); $pdf->Line($pdf->GetX(), $pdf->GetY(), $lastColX, $pdf->GetY()); $pdf->SetDrawColor(0, 0, 0); } $filename = ROOT . "/tmp/" . gen_id() . ".pdf"; $pdf->Output($filename, "F"); download_file($filename, "application/pdf", $report->getObjectName(), true); unlink($filename); die; }
/** * Adds an object to the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when you override doSelect*() * methods in your stub classes -- you may need to explicitly add objects * to the cache in order to ensure that the same objects are always returned by doSelect*() * and retrieveByPK*() calls. * * @param Report $value A Report object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool(Report $obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getId(); } // if key === null self::$instances[$key] = $obj; } }
public function setLastReportId(Host &$host, Report &$report) { if ($host == null || $host->getId() == -1 || $report == null || $report->getId() == -1) { Utils::log(LOG_DEBUG, "Exception", __FILE__, __LINE__); throw new Exception("Host or Report pobject is not valid or Host.id or Report.id is not set"); } return $this->getPakiti()->getDao("Host")->setLastReportId($host->getId(), $report->getId()); }
public function newQuestion($id) { try { $report = new Report($id); if (!$report->allowQuestion()) { throw new fValidationException('Not allowed to ask question.'); } $category = fRequest::get('category', 'integer'); if ($category == 0) { throw new fValidationException('Please choose a category.'); } $question = new Question(); $question->setUsername(fAuthorization::getUserToken()); $question->setReportId($report->getId()); if ($category < 0) { $question->setCategory($category); } else { $question->setCategory(Question::ABOUT_PROBLEM_HIDDEN); $problem = new Problem($category); $question->setProblemId($problem->getId()); } $question->setAskTime(new fTimestamp()); $question->setQuestion(trim(fRequest::get('question'))); if (strlen($question->getQuestion()) < 10) { throw new fValidationException('Question too short (minimum 10 bytes).'); } if (strlen($question->getQuestion()) > 500) { throw new fValidationException('Question too long (maximum 500 bytes).'); } $question->store(); fMessaging::create('success', 'Question saved.'); } catch (fExpectedException $e) { fMessaging::create('warning', $e->getMessage()); } catch (fUnexpectedException $e) { fMessaging::create('error', $e->getMessage()); } Util::redirect("/contest/{$id}"); }
/** * Adds an object to the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when you override doSelect*() * methods in your stub classes -- you may need to explicitly add objects * to the cache in order to ensure that the same objects are always returned by doSelect*() * and retrieveByPK*() calls. * * @param Report $value A Report object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool(Report $obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getId(); } if (isset(self::$instances[$key]) || count(self::$instances) < kConf::get('max_num_instances_in_pool')) { self::$instances[$key] = $obj; kMemoryManager::registerPeer('ReportPeer'); } } }
public function updateReport(Report &$report) { if ($report == null || $report->getId() == -1) { Utils::log(LOG_DEBUG, "Exception", __FILE__, __LINE__); throw new Exception("Report object is not valid or Report.id is not set"); } Utils::log(LOG_DEBUG, "Updating the report", __FILE__, __LINE__); $this->getPakiti()->getDao("Report")->update($report); }