protected function build_block_elements()
 {
     // Subheader.
     $section_header_text = !empty($this->input['uploaded_files_header']) ? $this->input['uploaded_files_header'] : __('Available downloads', EXCHANGE_PLUGIN);
     $section_header_mods = array('type' => 'taped_header', 'colour' => exchange_slug_to_hex('blue-3'));
     $section_header = new SectionHeader($section_header_text, $this->element, $section_header_mods);
     $this->output .= $section_header->embed();
     // Paragraph.
     $paragraph_text = '<ul class="documentblock__file-list dont-break-out">';
     foreach ($this->input['add_file'] as $doc) {
         if (!is_numeric($doc['file'])) {
             continue;
         }
         if (function_exists('acf_get_attachment')) {
             $meta = acf_get_attachment($doc['file']);
         }
         if (empty($meta)) {
             continue;
         }
         $description = !empty($meta['description']) ? $meta['description'] : $meta['filename'];
         $paragraph_text .= '<li class="documentblock__file-list__item">';
         $paragraph_text .= '<a href="' . $meta['url'] . '" target="_blank">' . $description . '</a>';
         $paragraph_text .= '</li>';
     }
     $paragraph_text .= '</ul>';
     $paragraph = new Paragraph($paragraph_text, $this->element);
     $this->output .= $paragraph->embed();
 }
 /**
  * Overwrite initial output value for Grid blocks
  *
  * @since 0.1.0
  * @access protected
  **/
 protected function create_output()
 {
     // If a grid is created inside a story, make this into an aside class.
     if (is_single() || is_page()) {
         $el = 'aside';
     } else {
         $el = 'div';
     }
     $colour = '#' . $GLOBALS['EXCHANGE_PLUGIN_CONFIG']['COLOURS']['salmon-1-web'];
     $this->set_grid_items();
     // Create grid with posts embedded.
     if ($this->has_grid_items) {
         $this->set_modifier_class('colour', $colour);
         $this->set_attribute('data', 'background-colour', $colour);
         $this->set_attribute('data', 'equalizer', true);
         $this->set_attribute('data', 'equalize-on', 'medium');
         $this->set_attribute('data', 'children', count($this->grid_items));
         $header_text = __('Read more', 'exchange');
         if ('collaboration' === $this->context && 'has_stories' === $this->modifiers['related']) {
             $header_text = __('Shared stories', 'exchange');
         }
         $header = new SectionHeader($header_text, $this->element);
         $this->output .= $header->embed();
         $this->output_tag_open($el);
         foreach ($this->grid_items as $item) {
             $this->output .= $item->embed();
         }
         $this->output_tag_close($el);
     }
 }
function writeSectionHeader($title, $cp = false)
{
    $sh = new SectionHeader($title, $cp);
    $sh->start();
    $sh->end();
}
Example #4
0
     echo '</table><br>';
     if ($gallery->isPublic || $gallery->creator == $_SESSION["UserID"]) {
         // form for creating an album
         writeSectionHeader("Create an Album");
         $frm = new Form("field", "createAlbum", "galleries.php?gid=" . $_GET["gid"], "addAlbum");
         $frm->addHidden("gid", $_GET["gid"]);
         $frm->addFormElement("album_name", "text", "Name", "", true);
         $frm->addFormElement("album_description", "textarea", "Description", "", true);
         $frm->addFormElement("album_files", "file", "Zip File", "", true);
         $frm->method = "post";
         $frm->draw();
     }
 } else {
     writeHeader(3, "Nerdery Pictures", "Picture Galleries");
     writeCP();
     $sh = new SectionHeader("Picture Galleries", true);
     $sh->start();
     $sh->end();
     echo '<table border="0" cellpadding="2" cellspacing="0" width="700">';
     $each = getGalleries();
     $i = 0;
     while ($g = $each[$i]) {
         //print_r ($g);
         if (strtotime($g->lastModified) > strtotime($_SESSION["PrevVisit"])) {
             $classname = "modifiedLink";
         } else {
             $classname = "unmodifiedLink";
         }
         echo "<tr><td colspan=\"2\"><a href=\"galleries.php?gid=" . $g->id . "\"><span class=\"" . $classname . "\">" . $g->name . "</span></a></td></tr><tr><td width=\"20\"></td><td width=\"680\"><span class=\"itemText\">" . $g->description . " (" . strtotime($g->lastModified) . " - " . strtotime($_SESSION["PrevVisit"]) . " - " . (strtotime($g->lastModified) > strtotime($_SESSION["PrevVisit"])) . ")</span></td></tr>";
         $i++;
     }