<div id="bookshelf-canvas-div"> <?php // If the skin has pre-content setup, include it here. require_once "library/core/util-skin.php"; skin_include("block-dashboard-canvas-pre.php"); ?> <div id="bookshelf-canvas-container"> <?php require_once "library/core/class-story.php"; $cStory = new akStory(); $cStory->createSimpleChunk(STORY_CHUNK_SECTION, "Welcome"); $cStory->createSimpleChunk(STORY_CHUNK_FILE, "assets/blocks/bookshelf-canvas/welcome.html"); // CLEAN: Add intro text here? $cStory->emit(); ?> </div><!-- Close bookshelf-canvas-container --> <?php // If the skin has post-content setup, include it here. skin_include("block-dashboard-canvas-post.php"); ?> </div>
// Start is about 5 weeks ago (5 * 7 * 24 * 3600 secs ago) $timestart = $timenow - 3024000; // End is 2 weeks from now (2 * 7 * 24 * 3600 secs into the future) $timeend = $timenow + 1209600; $default_start = date('Y-m-d', $timestart); $default_end = date('Y-m-d', $timeend); $default_book = 103; // Default sermon book... $start_date = block_getParameter('sermon_start_date', $default_start); $end_date = block_getParameter('sermon_end_date', $default_end); $bookid = block_getParameter('sermon_book', $default_book); // Step 2: Generate list from DB $sermonList = db_sermonsByDateRange($bookid, $start_date, $end_date); // Step 3: Build a story, with a series header whenever it changes... $lastSeries = ''; $st = new akStory(); foreach (array_reverse($sermonList, true) as $sermon) { // Step 3.1: Emit a series header if it changes.... if ($lastSeries != $sermon->series) { $st->createSimpleChunk(STORY_CHUNK_SUBGROUP, $sermon->series); $st->lastSimpleChunk->url = "/sermon.php?date=" . $sermon->deliver_date; $lastSeries = $sermon->series; } // Step 3.2: Emit the sermon header $st->createSimpleChunk(STORY_CHUNK_TEXT, substr($sermon->deliver_date, 5) . ": " . $sermon->title); $st->lastSimpleChunk->url = "/sermon.php?date=" . $sermon->deliver_date; } $st->createSimpleChunk(STORY_CHUNK_META, '<a href="/sermon.php" title="Sermon Archive" class="story-link">(more in the archive...)</a>'); // Step 4: emit the story $st->emit(); ?>
<div id="block-staff-blog" class="block-content-addmargin"> <?php // Staff blog block (sidebar/multibar) // // Incorportate latest entries from all staff members into // a single blogblock // // Required parameters: // --------------------- // // Optional parameters: // --------------------- // Step 1: Pull parameters // Step 2: Generate list from blog books // Step 3: Build a story, with a series header whenever it changes... $st = new akStory(); $st->createSimpleChunk(STORY_CHUNK_META, "Coming "soon"..."); // Step 4: emit the story $st->emit(); ?> </div>
$timestart = $timenow - 3024000; // End is 2 weeks from now (2 * 7 * 24 * 3600 secs into the future) $timeend = $timenow + 1209600; $default_start = date('Y-m-d', $timestart); $default_end = date('Y-m-d', $timeend); $default_book = 103; // Default sermon book... $start_date = block_getParameter('sermon_start_date', $default_start); $end_date = block_getParameter('sermon_end_date', $default_end); $bookid = block_getParameter('sermon_book', $default_book); // Step 2: Generate list from DB // CLEAN: For now, just get _everything_ $sermonList = db_sermonsByDateRange($bookid, '1000-10-10', '3000-10-10'); // Step 3: Build a story, with a series header whenever it changes... $lastSeries = ''; $st = new akStory(); $st->createSimpleChunk(STORY_CHUNK_HEADLINE, "Sermon Archive"); foreach (array_reverse($sermonList, true) as $sermon) { // Step 3.1: Emit a series header if it changes.... if ($lastSeries != $sermon->series) { $st->createSimpleChunk(STORY_CHUNK_TEXT, "<br/>"); $st->createSimpleChunk(STORY_CHUNK_SUBGROUP, $sermon->series); $st->lastSimpleChunk->url = "/sermon.php?date=" . $sermon->deliver_date; $lastSeries = $sermon->series; } // Step 3.2: Emit the sermon header $st->createSimpleChunk(STORY_CHUNK_TEXT, substr($sermon->deliver_date, 5) . ": " . $sermon->title); $st->lastSimpleChunk->url = "/sermon.php?date=" . $sermon->deliver_date; } // Step 4: emit the story $st->emit();
global $auth_user; // // REQUIRED PARAMETERS: // <none> // // OPTIONAL PARAMETERS // 'max_count' -- Max # of entries to load // 'max_chars' -- Max # of characters from text to load // /* Step 1: Get parameters */ $max_count = block_getParameter('max_count', 5); $max_chars = block_getParameter('max_chars', 150); /* Step 2: Get list of announcements */ $list = db_announcementList($max_count); /* Step 3: Start the story */ $st = new akStory(); /* Step 3: Build the HTML output */ if ($list == null) { $st->createSimpleChunk(STORY_CHUNK_META, "(no current announcements)"); } else { foreach ($list as $a) { $st->createSimpleChunk(STORY_CHUNK_TEXT, "<br/>"); $st->createSimpleChunk(STORY_CHUNK_SUBGROUP, $a->title); $st->createSimpleChunk(STORY_CHUNK_FILE, $a->text); $st->createSimpleChunk(STORY_CHUNK_META, "Posted: " . $auth_user->format_date($a->edit_time)); } } $st->emit(); ?> </div>
$sermonList = db_sermonsByDateRange(103, $sermon_date, $sermon_date); // Step 3: Check for failure if (null == $sermonList) { $st = new akStory(); $st->createSimpleChunk(STORY_CHUNK_ERROR, "No sermon found for " . $sermon_date); $st->emit(); return; } function file_size($size) { $filesizename = array(" Bytes", " KB", " MB", " GB", " TB", " PB", " EB", " ZB", " YB"); return $size ? round($size / pow(1024, $i = floor(log($size, 1024))), 2) . $filesizename[$i] : '0 Bytes'; } // Step 4: Got (at least) one $sermon = $sermonList[$sermon_date]; $st = new akStory(); $st->createSimpleChunk(STORY_CHUNK_HEADLINE, "Sermon: " . $sermon_date); //$st->createSimpleChunk(STORY_CHUNK_SECTION,$sermon->series); // Step 4.1: Title emit $st->createSimpleChunk(STORY_CHUNK_GROUP, $sermon->title); // Step 4.2: Notes/synopsis $st->createSimpleChunk(STORY_CHUNK_FILE, $sermon->text); // Step 4.3: Audio? $sermonPath = dirname($sermon->text); $audioFile = $sermonPath . '/' . $sermon_date . '.mp3'; if (is_readable($audioFile)) { /* Found one -- make a link */ $st->createSimpleChunk(STORY_CHUNK_TEXT, '<a href="' . $audioFile . '" title="Sermon Audio File (MP3)">Sermon Audio</a> (MP3 file, ' . file_size(filesize($audioFile)) . ')'); } else { /* No Audio */ $st->createSimpleChunk(STORY_CHUNK_META, "No audio available");
// Optional parameters: // --------------------- // event_list_size Max # of events to retrieve/display // // Step 1: Pull parameters $default_book = BOOK_ID_CALENDAR; // Default events book... $default_count = 8; // Default # to list $bookid = block_getParameter('event_book', $default_book); $count = block_getParameter('event_count', $default_count); // Step 2: Generate list from DB $eventList = db_eventsUpcoming($bookid, $count); // Step 3: Build a story, with a date header whenever it changes... $lastDate = ''; $st = new akStory(); if (null == $eventList) { $st->createSimpleChunk(STORY_CHUNK_TEXT, "No upcoming events posted."); } else { foreach ($eventList as $event) { // Step 3.1: Emit a series header if it changes.... $eventDate = new DateTime($event->startdate); if ($lastDate != $eventDate->format("F")) { $lastDate = $eventDate->format("F"); $st->createSimpleChunk(STORY_CHUNK_SUBGROUP, $lastDate); //$st->lastSimpleChunk->url = "/event.php?date=".$eventDate->format("Y-m"); } // Step 3.2: Emit the event header $st->createSimpleChunk(STORY_CHUNK_TEXT, $eventDate->format("m-d") . ': ' . $event->title); $st->lastSimpleChunk->url = "/event.php?id=" . $event->id; }
// Optional parameters: // --------------------- // Step 1: Setup parameters $devo_maxlen = block_getParameter('devo_maxlen', 300); $text_width = block_getParameter('text_width', 200); $today = time(); $upperurl = "http://devotional.upperroom.org/devotionals/" . date('Y-m-d', $today); // Step 2: Import via URL file open into a DOM object $upperHTML = file_get_contents($upperurl); $dom = new DOMDocument(); @$dom->loadHTML($upperHTML); // Step 3: Parse out the bits we care about $scripsnip = $dom->getElementById('scripture_snippet'); $scripkids = $scripsnip->childNodes; $scripref = preg_replace("/\\(.*\\)/", "", $scripsnip->childNodes->item(3)->textContent); $scripref = str_replace("- ", "", $scripref); $devo = ltrim(rtrim($scripsnip->nextSibling->textContent)); // Step 4: Truncate to a reasonable size, but only on a word boundary... if (strlen($devo) > $devo_maxlen) { $devo = substr($devo, 0, $devo_maxlen); $devo = substr($devo, 0, strrpos($devo, " ")) . "..."; } // Step 3: Create $st = new akStory(); $st->createSimpleChunk(STORY_CHUNK_META, $scripsnip->childNodes->item(1)->textContent . "<br/>" . $scripref); $st->createSimpleChunk(STORY_CHUNK_TEXT, $devo); $st->createSimpleChunk(STORY_CHUNK_META, "<a href='" . $upperurl . "' title='go to UpperRoom.org'>(read more at UpperRoom.org)</a>"); $st->emit(); ?> </div>
// Step 2: Generate entry from DB /* Lookup */ $ev = db_getEventById($event_id); /* Failure check */ if (null == $ev) { $st = new akStory(); $st->createSimpleChunk(STORY_CHUNK_ERROR, "No event found for id=" . $event_id); $st->emit(); return; } // Step 3: Get event details /* Lookup */ $ev_story = db_getStoryById($ev->story); /* Failure check */ if (null == $ev_story) { $st = new akStory(); $st->createSimpleChunk(STORY_CHUNK_ERROR, "No details found for event id=" . $event_id); $st->emit(); return; } // Step 4: Add date/time to event details story if (null == $ev->enddate) { // Single-day $ev_story->createSimpleChunk(STORY_CHUNK_META, "Scheduled for: " . $ev->startdate . " at " . $ev->starttime); } else { // Multi-dat $ev_story->createSimpleChunk(STORY_CHUNK_META, "Scheduled from: " . $ev->startdate . " at " . $ev->starttime); $ev_story->createSimpleChunk(STORY_CHUNK_META, " until " . $ev->enddate . " at " . $ev->endtime); } // Step 5: Add decoration? Next/Prev? Others in this series? // Step 6: Emit that bad boy.
private function cook() { /* Create base object */ $s = new akStory("story-id-" . $this->id); /* Set metadata */ $s->book = $this->book; $s->author = $this->author; $s->create_time = $this->create_time; $s->edit_time = $this->edit_time; $s->deliver_date = $this->deliver_date; $s->is_frozen = $this->is_frozen; $s->keywords = $this->keywords; $s->series = $this->series; /* Create chunks from entries, in priority order */ if ($this->title) { $s->createSimpleChunk(STORY_CHUNK_HEADLINE, $this->title); } if ($this->section_title) { $s->createSimpleChunk(STORY_CHUNK_SECTION, $this->section_title); } if ($this->banner) { $s->createSimpleChunk(STORY_CHUNK_BANNER, $this->banner); } if ($this->lede) { $s->createSimpleChunk(STORY_CHUNK_LEDE, $this->lede); } if ($this->text) { $s->createSimpleChunk(STORY_CHUNK_FILE, $this->text); } /* Set it to our private member */ $this->story = $s; }