Exemple #1
0
if ($vars['guid']) {
    // add a delete button if editing
    $delete_url = "action/blog/delete?guid={$vars['guid']}";
    $delete_link = elgg_view('output/confirmlink', array('href' => $delete_url, 'text' => elgg_echo('delete'), 'class' => 'elgg-button elgg-button-delete float-alt'));
}
// published blogs do not get the preview button
if (!$vars['guid'] || $blog && $blog->status != 'published') {
    $preview_button = elgg_view('input/submit', array('value' => elgg_echo('preview'), 'name' => 'preview', 'class' => 'mls'));
}
$save_button = elgg_view('input/submit', array('value' => elgg_echo('save'), 'name' => 'save'));
$action_buttons = $save_button . $preview_button . $delete_link;
$title_label = elgg_echo('title');
$title_input = elgg_view('input/text', array('name' => 'title', 'id' => 'blog_title', 'value' => $vars['title']));
$excerpt_label = elgg_echo('blog:excerpt');
$excerpt_input = elgg_view('input/text', array('name' => 'excerpt', 'id' => 'blog_excerpt', 'value' => _elgg_html_decode($vars['excerpt'])));
if (elgg_plugin_exists('blog_tools')) {
    $icon_remove_input = "";
    if ($vars["guid"]) {
        $icon_label = elgg_echo("blog_tools:label:icon:exists");
        if ($blog->icontime) {
            $icon_remove_input = "<br /><img src='" . $blog->getIconURL() . "' />";
            $icon_remove_input .= "<br />";
            $icon_remove_input .= elgg_view("input/checkbox", array("name" => "remove_icon", "value" => "yes"));
            $icon_remove_input .= elgg_echo("blog_tools:label:icon:remove");
        }
    } else {
        $icon_label = elgg_echo("blog_tools:label:icon:new");
    }
    $icon_input = elgg_view("input/file", array("name" => "icon", "id" => "blog_icon"));
}
$body_label = elgg_echo('blog:body');
Exemple #2
0
<?php

$fd = $vars['form_data'];
$event_calendar_hide_access = elgg_get_plugin_setting('hide_access', 'event_calendar');
$body = '<fieldset>';
$body .= '<legend>' . elgg_echo('event_calendar:permissions:header') . '</legend>';
if ($event_calendar_hide_access == 'yes') {
    $event_calendar_default_access = elgg_get_plugin_setting('default_access', 'event_calendar');
    if ($event_calendar_default_access) {
        $body .= elgg_view("input/hidden", array('name' => 'access_id', 'value' => $event_calendar_default_access));
    } else {
        $body .= elgg_view("input/hidden", array('name' => 'access_id', 'value' => ACCESS_DEFAULT));
    }
} else {
    $body .= '<p><label>' . elgg_echo('event_calendar:read_access') . '</label>';
    $body .= elgg_view("input/access", array('name' => 'access_id', 'value' => $fd['access_id']));
    $body .= '</p>';
}
if (elgg_plugin_exists('entity_admins')) {
    $body .= elgg_echo('event_calendar:share_ownership:label');
    $body .= '<br />';
    $body .= elgg_echo('event_calendar:share_ownership:description');
    $body .= elgg_view('input/entity_admins_dropdown', array('entity' => $vars['event']));
}
$body .= '</fieldset>';
echo $body;
Exemple #3
0
function shoutout_list_attached_entities($shoutout)
{
    $options = array('relationship_guid' => $shoutout->guid, 'relationship' => 'shoutout_attached_entity', 'limit' => 1);
    $entities = elgg_get_entities_from_relationship($options);
    if ($entities) {
        $entity = $entities[0];
        if (elgg_instanceof($entity, 'object', 'poll')) {
            if (elgg_plugin_exists('polls')) {
                if ($user_guid = elgg_get_logged_in_user_guid()) {
                    elgg_load_library('elgg:polls');
                    $can_vote = !polls_check_for_previous_vote($entity, $user_guid);
                    if ($can_vote) {
                        return elgg_view('polls/poll_widget', array('entity' => $entity));
                    } else {
                        return elgg_echo('shoutout:see_poll_results') . elgg_view('polls/summary_link', array('entity' => $entity));
                    }
                } else {
                    return elgg_echo('shoutout:login_or_see_poll_results') . elgg_view('polls/summary_link', array('entity' => $entity));
                }
            }
        }
    }
}
function sched_conf_sync_event_for_conference($conf, $event = NULL)
{
    if (!$event) {
        $event = new ElggObject();
        $event->subtype = 'event_calendar';
        $event->owner_guid = $conf->owner_guid;
        $event->container_guid = $conf->container_guid;
        $new_event = TRUE;
    } else {
        $new_event = FALSE;
    }
    $event->access_id = $conf->access_id;
    $event->title = $conf->title;
    $event->description = $conf->description;
    $event->venue = elgg_echo('sched_conf:venue', array($conf->application));
    $event->start_date = $conf->start_date;
    $event->end_date = '';
    $event->start_time = $conf->start_time;
    $event->tags = $conf->tags;
    if (elgg_plugin_exists('event_calendar')) {
        elgg_load_library('elgg:event_calendar');
        $event->real_end_time = event_calendar_get_end_time($event);
    }
    $event->save();
    // TODO - need to do something with BBB if an existing event is changed as well
    if ($new_event && $conf->application == 'bbb') {
        sched_conf_create_bbb_conf($conf, $event);
    }
    return $event;
}
Exemple #5
0
function event_calendar_queue_reminders()
{
    // game plan - get all events up to 60 days ahead
    // with no reminder sent
    // compute reminder period
    // if <= current time, set reminder_queued flag and queue the
    // notification message using the message_queue plugin
    if (elgg_plugin_exists('message_queue')) {
        $now = time();
        // oops - this does not work for repeated events
        // need extra stuff for that
        /*$options = array(
        			'type' => 'object',
        			'subtype' => 'event_calendar',
        			'metadata_name_value_pairs' => array(
        				array('name' => 'reminder_queued', 'value' => 'no'),
        				array('name' => 'send_reminder', 'value' => 1),
        				array('name' => 'start_date', 'value' => $now + 60*24*60*60, 'operand' => '>='),
        			),
        			'limit' => 0,
        		);
        		$events = elgg_get_entities_from_metadata($options);
        		*/
        $event_list = event_calendar_get_events_between($now, $now + 60 * 24 * 60 * 60, FALSE, 0);
        foreach ($event_list as $es) {
            $e = $es['event'];
            if ($e->send_reminder) {
                $reminder_period = 60 * $e->reminder_interval * $e->reminder_number;
                if ($e->repeats) {
                    // repeated events require more complex handing
                    foreach ($es['data'] as $d) {
                        // if event falls in the reminder period
                        if ($d->start_time - $reminder_period >= $now) {
                            // and the reminder has not already been queued
                            if (!event_calendar_repeat_reminder_logged($e, $d->start_time)) {
                                // set the reminder queued flag
                                event_calendar_repeat_reminder_log($e, $d->start_time);
                                // queue the reminder for sending
                                event_calendar_queue_reminder($e);
                            }
                            break;
                        }
                    }
                } else {
                    // if this is just a normal non-repeated event, then we just need to set a flag and queue the reminder
                    if ($e->reminder_queued != 'yes' && $e->start_date - $now <= $reminder_period) {
                        $e->reminder_queued = 'yes';
                        event_calendar_queue_reminder($e);
                    }
                }
            }
        }
    }
}