50 $xml =
"\n<ArticleMap>";
53 $xml .=
"</ArticleMap>";
58 function import($doc,
$tx)
71 trace(
"Searching for blog with identifier '$identifier'", 2);
80 if (!checkRole(
$page->role))
86 echo $pageView->drawView();
90 catch(DataNotFoundException $e)
103 echo
"<p id='inline_editing'><a href='#' onclick='new BlogManager().editBlog({$blog->blog_id}); return false;'>Edit</a> <a href='#' onclick='new ArticleManager().editArticle(\"\", {$blog->blog_id}); return false;'>Add an Article</a></p>";
109 $blogs = Query::create(
Blog,
"ORDER BY title")->execute();
118 trace(
"BlogManager registerSearchables", 3);
119 $searchables[
"blog"] = array(
Blog);
132 $form->hide(
"owner_id",
"created_date");
135 $blogTypes = array_keys(
$blogView->handlers);
136 $blogTypes = array_combine($blogTypes, $blogTypes);
138 $orderSelect =
new SelectFieldRenderer(
$form,
"default_article_order",
"Default Article Order", array(
"DESC" =>
"Newest to Oldest",
"ASC" =>
"Oldest to Newest",
"SORT" =>
"Sorted Order"));
143 $typeSelect =
new SelectFieldRenderer(
$form,
"blog_type",
"Blog Type", $blogTypes);
145 $form->alias(
"image_id",
"Image");
146 $form->alias(
"enable_rss_feed",
"Enable RSS Feed");
147 $form->alias(
"max_rss_articles",
"Max # of Articles in RSS Feed");
148 $form->annotate(
"max_rss_articles",
"(A value of zero means no limit)");
159 "Blog Definition" =>
"blog_form",
160 "Articles" =>
"blog_articles"
163 $bar =
new TabBar(
"tabs",
$tabs,
"blog_id=$blog_id");
171 $form->required(
"title");
172 $form->allowDelete =
true;
173 $redirect =
"/admin/blog_articles?blog_id={$blog->blog_id}";
176 $form->alias(
"image_id",
"Associated Image");
177 $form->readonly(
"created_date");
178 $form->hide(
"author_id");
179 $form->hide(
"article_type");
184 $form->getRenderer(
"archive_date")->validator->required =
false;
191 $styles .=
"<link href=\"/fakoli/css/tabs.css\" rel=\"stylesheet\"/>\n";
199 $mgr->upgrade($version);
204 Settings::setDefaultValue(
"blog",
"allow_subscription_options",
"0", Boolean,
"Whether to allow users to choose subscription type options. Cron job must be setup for the website to call handler file 'send_digest'.");
205 Settings::setDefaultValue(
"blog",
"weekly_digest_day",
"Mon", String,
"The day of the week when the weekly digest will be sent for sites that allow that option.",
"",
"Sun\nMon\nTue\nWed\nThu\nFri\nSat");
206 Settings::setDefaultValue(
"blog",
"subscribe_button_format",
"Subscribe to {title}", String,
"Format string to use for subscribe buttons");
207 Settings::setDefaultValue(
"blog",
"enable_extended_subscription_fields",
false, Boolean,
"Ask subscribers for their name and organization when subscribing");
223 $sitename =
$config[
"sitename"];
225 $message =
"This is an automated message from {$sitename}. You have successfully subscribed to the {Blog.title}.<br><br>To unsubscribe, <a href='{getUnsubscribeUrl()}'>click here</a> or follow this link: {getUnsubscribeUrl()}.";
228 $message =
"Greetings. This is an automated message from {$sitename}. A new post has been published on {Blog.title}. Click the link below to read it.<br><br>{getBlogUrl()}?article_id=[article_id]<br><br>You are receiving this message because you subscribed to {Blog.title}. To unsubscribe, please follow this link: {getUnsubscribeUrl()}";
231 $message =
"This is an automated message from {$sitename}. You have successfully unsubscribed to the {Blog.title}.";
248 MergeCode::setDefaultMergeCode(
"article_id",
"",
"BlogSubscriber",
"ID of the article whose publication is the cause of the subscriber email being sent. This value is provided in the calling code b/c it can't be accessed through the blog subscriber.");
277 trace(
"Component blog is deleting objects dependent on user_id {$user_id}", 3);
280 $blog->delete(
"WHERE owner_id={$user_id}");
301 if($subscription && $subscription->subscription_type !=
$blogSubscriber->subscription_type)
304 $subscription->filter =
new InclusionFilter(
"subscription_type");
305 $subscription->save();
307 $form->data = $subscription;
309 else if(!$subscription)
313 $blogSubscriber->subscription_token = BlogSubscriptionManager::generateToken();
323 $mgr =
new BlogSubscriptionManager();
Defines the Article class.
static findByIdentifier($identifier)
static registerSerializationHandler()
static buildBlogForm($blog, $redirect, $blogView)
static setDefaultEmailTemplates()
For blog, need default templates: blog_subscription blog_published blog_unsubscribe_confirmation.
static deleteUser($user)
Respond to fired event DeleteUser.
static buildBlogArticleForm($article, $blog)
static registerTaxonomyClasses($classes)
static displayBlog($identifier, &$continue)
static registerSolrAdapter()
static registerVersionedContent()
static registerScheduledTaskWorkers()
static enumerateItems($items)
static upgradeComponent($version)
static setDefaultMergeCodes()
Merge codes: blog_title article_id blog_identifier unsubscribe_url blog_url.
static saveBlogSubscription($form)
Custom save handlerf or blog_subscription_form.
static inlineEditingControls($blog)
static registerSearchables($searchables)
static blogTabs($blog_id)
BlogSerializationHandler()
static findByIdentifier($identifier, $constraint="")
ComponentPageView generates the page content for a component page, substituting page fields,...
static setDefaultTemplate($name, $recipients, $subject, $message, $class_name, $sender_email="")
Create a default template for emails that are sent through Fakoli components (e.g....
static using()
Import the datamodels, views and manifest for the specified component(s).
static storeRedirectPage()
Store the page from which a user has been redirected when prompted to login or create an account.
static setDefaultMergeCode($name, $map, $class_name, $description="")
Create a default merge codes for emails that are sent through Fakoli components (e....
static registerWorker($component, $task_name, $handler, $hourly=false)
Registers a Scheduled Task worker method.
static serialize($class, $constraint="")
Serializes the specified DataItems to XML.
registerHandler($component, $title, $handler)
Registers a serialization handler for a component.
static unserialize($class, $doc, $tx, $save=true)
Instantiates DataItems from the supplied XML document and stores them in the database.
static getValue($component, $name)
Retrieve the value of the specified Setting.
static setDefaultValue($component, $name, $value, $field_type="String", $annotation="", $category="", $options="", $weight=0)
Sets the default value of the given component setting.
static checkPermission($component, $name, $account=null)
Check whether a user has a specific permission.
static getRolesArray()
Retrieves the array of roles and their names for the current site for use in a CMS form.
static registerVersionedContent()
static enableVersioning($form)