title);
$action = "blog/edit";
$title = $vars['entity']->title;
$body = $vars['entity']->description;
$tags = $vars['entity']->tags;
if ($vars['entity']->comments_on == 'Off') {
$comments_on = false;
} else {
$comments_on = true;
}
$access_id = $vars['entity']->access_id;
} else {
$task_guid = get_input("param2");
$task = false;
if ($task_guid) {
$td = getTaskData($task_guid);
if ($td) {
/*translation:Reflection for*/
$title = elgg_echo('task_manager:reflection_for').": ".$td->title;
$task = $td->task;
}
} else {
$title = elgg_echo("blog:addpost");
$title = "";
}
$action = "blog/add";
$tags = "";
$comments_on = true;
$description = "";
if (defined('ACCESS_DEFAULT'))
$access_id = ACCESS_DEFAULT;
else
$access_id = 0;
$container = $vars['container_guid'] ? elgg_view('input/hidden', array('internalname' => 'container_guid', 'value' => $vars['container_guid'])) : "";
}
// Just in case we have some cached details
if (empty($body) && empty($title)) {
$body = $vars['user']->blogbody;
if (!empty($body)) {
$title = $vars['user']->blogtitle;
$tags = $vars['user']->blogtags;
}
}
// set the required variables
$title_label = elgg_echo('title');
$title_textbox = elgg_view('input/text', array('internalname' => 'blogtitle', 'value' => $title));
if ($task) {
/*translation:Task*/
$task_box .= "
";
$task_box .= autop($task);
$task_box .= "
";
$task_box .= elgg_view('input/hidden', array('internalname' => 'task_guid', 'value' => $task_guid));
}
$text_label = elgg_echo('blog:text');
$text_textarea = elgg_view('input/longtext', array('internalname' => 'blogbody', 'value' => $body));
$tag_label = elgg_echo('tags');
$tag_input = elgg_view('input/tags', array('internalname' => 'blogtags', 'value' => $tags));
$competencies = elgg_view('competencies',$vars);
$competencies = "";
$access_label = elgg_echo('access');
//$comments_select = elgg_view('input/checkboxes', array('internalname' => 'comments_on', 'value' => ''));
if($comments_on)
$comments_on_switch = "checked=\"checked\"";
else
$comment_on_switch = "";
$access_input = elgg_view('input/access', array('internalname' => 'access_id', 'value' => $access_id));
$access_input = elgg_view('input/hidden', array('internalname' => 'access_id', 'value' => 1));
$submit_input = elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('publish')));
$conversation = elgg_echo('Conversation');
$publish = elgg_echo('publish');
$cat = elgg_echo('categories');
$preview = elgg_echo('blog:preview');
$privacy = elgg_echo('access');
$savedraft = elgg_echo('blog:draft:save');
$draftsaved = elgg_echo('blog:draft:saved');
$never = elgg_echo('blog:never');
$allowcomments = elgg_echo('blog:comments:allow');
// INSERT EXTRAS HERE
$extras = elgg_view('categories',$vars);
if (!empty($extras)) $extras = '';
?>
{$extras}
$container
EOT;
?>
'blogpost', 'value' => $vars['entity']->getGUID()));
} else {
$entity_hidden = '';
}
$form_body .= <<
$title_textbox
$task_box
$text_textarea
$tag_input
{$competencies}
$entity_hidden
EOT;
echo elgg_view('input/form', array('action' => "{$vars['url']}action/$action", 'body' => $form_body, 'internalid' => 'blogPostForm'));
?>