[blog_id] => 
	    [author_id] => 
	    [content] => 
	    [public] => 0
	)
*/
$all_events = Events::FindAll();
$counter = 0;
foreach ($all_events as $event) {
    //if ( $counter == 1 ) break; // For testing
    $newentry = MyActiveRecord::Create('Blog_Entries');
    $newentry->title = esc_html($event->title);
    $newentry->slug = slug($event->title);
    $newentry->date = $event->date_start . " " . $event->time_start;
    // format = 2012-03-14 08:03:17
    $newentry->blog_id = 1;
    $newentry->author_id = 2;
    // manually set to the owner of the site
    $newentry->content = $event->description;
    $newentry->public = 1;
    if ($newentry->save()) {
        echo "&ldquo;" . esc_html($newentry->title) . "&rdquo; saved<br />";
    }
    // Now take the venue and convert it to a Category. Categories need to be created first and match names exactly.
    $event_type = $event->getEventType();
    $category_match = Categories::FindByName(slug($event_type->name));
    $newentry->updateSelectedCategories(array($category_match->id));
    // updateSelectedCategories does not return true on success, so, we can't echo a nice statement if this works.
    $counter++;
}
echo "{$counter} events converted to blog entries<br />";
Пример #2
0
    $template = isset($area) && isset($page) ? $page->getTemplateForArea($area) : "static-template";
}
$current_user = Users::GetCurrentUser();
$admin_class = is_object($current_user) ? 'loggedin' : 'no-loggedin';
// CUSTOM
$var0 = getRequestVarAtIndex(0);
$var1 = getRequestVarAtIndex(1);
$var2 = getRequestVarAtIndex(2);
$var3 = getRequestVarAtIndex(3);
if (BLOG_INSTALL && $var0 == BLOG_STATIC_AREA) {
    $blogarea = Areas::FindById(3);
    // Might need to change this on a per project basis
    $page_title = $blogarea->get_seo_title(" | " . SITE_NAME);
    $bodyclass = "blog archive";
    if ($var1 == "category") {
        $category = Categories::FindByName($var2);
        $description = $category->get_excerpt(160);
        $page_title = $category->get_seo_title(" | " . $blogarea->get_seo_title() . " | " . SITE_NAME);
        $bodyclass = "blog category-archive";
    }
    if ($var1 == "view" && $var2 != "") {
        $blogitem = Blog_Entries::FindById($var2);
        $description = $blogitem->get_excerpt(160);
        $page_title = $blogitem->get_seo_title(" | " . $blogarea->get_seo_title() . " | " . SITE_NAME);
        $bodyclass = "blog single-entry";
    }
} elseif (CALENDAR_INSTALL && $var0 == CALENDAR_STATIC_AREA) {
    $page_title = "Event Calendar | " . SITE_NAME;
    $bodyclass = "calendar";
    if (getRequestVarAtIndex(5)) {
        $event = Events::FindById(getRequestVarAtIndex(5));