You are here

public function FrxEditor::blockLinks in Forena Reports 7.4

File

./FrxEditor.inc, line 1106
FrxEditor.inc Wrapper XML class for working with DOM object. It provides helper Enter description here ... @author metzlerd

Class

FrxEditor
@file FrxEditor.inc Wrapper XML class for working with DOM object. It provides helper Enter description here ... @author metzlerd

Code

public function blockLinks($block_name, $frx, $attrs, $id = '', $context = array()) {
  $o = '';
  if (!$context) {
    $context = array();
  }
  $parms = Frx::Data()
    ->getContext('parm');
  if ($parms && is_array($context)) {
    $context = array_merge($parms, $context);
  }
  $class = @(string) $attrs['class'];
  $frx_class = strpos($class, 'Frx') !== FALSE;
  if ($frx_class) {
    $frx_class = FALSE;
    foreach ($this
      ->templateOptions() as $key => $label) {
      if (strpos($class, $key) !== FALSE) {
        $frx_class = TRUE;
      }
    }
  }
  $block_tag = (string) $frx['block'];
  if ($frx_class || $block_tag) {
    $block_label = (string) $frx['block'] ? $block_name : '#' . $id;
    $block_link = str_replace('/', '.', $block_name);
    $report_name = str_replace('/', '.', $this->desc['base_name']);
    $b = Frx::RepoMan()
      ->loadBlock($block_name);
    $options = array();
    if ($context) {
      $options['query'] = $context;
    }

    // Add the prepend link.
    if ($block_tag) {

      // If we have a block tag we're going to prepend another data block?
      $o .= '<div class="forena-edit-links">' . $this
        ->l_icon("reports/{$report_name}/edit/select-data/prepend-data/{$id}", 'plus.svg', 'Insert Data', null, t("Data")) . "</div>";
    }
    else {

      //$o .= '<div class="forena-edit-links">' . $this->l_icon("reports/$report_name/edit/prepend-section/$block_link/$id", 'plus.svg', 'Add Data').  "</div>";
    }

    // Add the block or ID link
    $o .= '<div class="forena-edit-links">' . l($block_label, "reports/{$report_name}/edit/edit-data/{$block_link}/{$id}", $options) . ' ' . $this
      ->l_icon("reports/{$report_name}/edit/delete-data/{$id}", 'minus.svg', 'Remove Data', $context) . "</div>";
  }
  return $o;
}