Esempio n. 1
0
/**
 * Init proposals plugin.
 */
function proposals_init()
{
    if (!elgg_is_active_plugin('crud')) {
        return;
    }
    // register proposals library
    elgg_register_library('elgg:proposals', elgg_get_plugins_path() . 'proposals/lib/proposals.php');
    // add to the main css
    elgg_extend_view('css/elgg', 'proposals/css');
    // Add group option
    add_group_tool_option('proposals', elgg_echo('proposals:enableproposals'), false);
    elgg_extend_view('groups/tool_latest', 'proposals/group_module');
    //
    $action_path = elgg_get_plugins_path() . 'proposals/actions/proposals';
    elgg_register_action("proposals/vote", "{$action_path}/vote.php");
    elgg_register_plugin_hook_handler('permissions_check:annotate', 'object', 'proposals_user_can_vote');
    // data types
    $variables = array('title' => 'text', 'description' => 'longtext', 'access_id' => 'access');
    $crud = crud_register_type('decision', $variables);
    $crud->children_type = 'proposal';
    // the following is to not overwrite module if assemblies set it
    // before, since we don't need explicit module.
    if ($crud->module == 'decision') {
        $crud->module = 'proposals';
    }
    //$crud->module = 'proposals';
    $crud->owner_menu = 'group';
    $variables = array('title' => 'text', 'description' => 'longtext', 'tags' => 'tags', 'access_id' => 'access', 'improves_guid' => array('type' => 'url', 'input_view' => 'hidden', 'output_view' => 'proposal', 'default_value' => get_input('improves')));
    $crud = crud_register_type('proposal', $variables);
    #$crud->children_type = 'agenda_point';
    $crud->module = 'proposals';
}
Esempio n. 2
0
/**
 * Init assemblies plugin.
 */
function assemblies_init()
{
    if (!elgg_is_active_plugin('crud')) {
        return;
    }
    elgg_register_library('elgg:assemblies', elgg_get_plugins_path() . 'assemblies/lib/assemblies.php');
    // add to the main css
    elgg_extend_view('css/elgg', 'assemblies/css');
    // notifications
    register_notification_object('object', 'assembly', elgg_echo('assemblies:newpost'));
    elgg_register_plugin_hook_handler('notify:entity:message', 'object', 'assemblies_notify_message');
    // handler for link to assembly menu item
    elgg_register_plugin_hook_handler('crud:decision:view_buttons', 'view_buttons', 'assemblies_decision_view_buttons');
    // Add group option
    add_group_tool_option('assemblies', elgg_echo('assemblies:enableassemblies'), false);
    #elgg_extend_view('groups/tool_latest', 'assemblies/group_module');
    elgg_extend_view('groups/profile/summary', 'assemblies/group_module');
    // add a assemblies widget
    elgg_register_widget_type('assembly', elgg_echo('assemblies'), elgg_echo('assemblies:widget:description'));
    // register actions
    $action_path = elgg_get_plugins_path() . 'assemblies/actions/assemblies';
    elgg_register_action("assemblies/link", "{$action_path}/link.php");
    //elgg_register_action('assemblies/save', "$action_path/save.php");
    //elgg_register_action('assemblies/delete', "$action_path/delete.php");
    // entity menu
    elgg_register_plugin_hook_handler('register', 'menu:entity', 'assemblies_entity_menu_setup');
    // ecml
    elgg_register_plugin_hook_handler('get_views', 'ecml', 'assemblies_ecml_views_hook');
    // specific actions
    $action_path = elgg_get_plugins_path() . 'assemblies/actions/assemblies';
    elgg_register_action("assemblies/general", "{$action_path}/general.php");
    // data types
    $variables = array('title' => array('type' => 'text', 'default_value' => elgg_echo('assemblies:general_assembly')), 'category' => array('type' => 'tags', 'default_value' => 'informativos, debate'), 'date' => 'date', 'time' => 'time', 'location' => 'text', 'access_id' => 'access');
    $crud = crud_register_type('assembly', $variables, 'ElggAssembly');
    $crud->children_type = 'decision';
    $crud->children_categories = 'category';
    $crud->module = 'assemblies';
    $crud->list_order = 'date';
    $crud->list_order_direction = 'DESC';
    $crud->owner_menu = 'group';
    $crud->title_extend = 'date';
    $crud->list_tabs = 'date';
    $variables = array('title' => 'text', 'description' => 'longtext', 'proposal' => array('type' => 'longtext', 'embedded' => 'description'), 'status' => array('type' => 'crud/select', 'default_value' => 'new', 'options' => array('draft', 'new', 'accepted', 'discarded', 'delayed')), 'category' => array('type' => 'crud/parentselect', 'property' => 'category'), 'mode' => array('type' => 'crud/select', 'default_value' => 'conjunctural', 'options' => array('permanent', 'conjunctural')), 'tags' => 'tags', 'access_id' => 'access');
    if (elgg_is_active_plugin('crud')) {
        $crud = crud_register_type('decision', $variables);
        #$crud->children_type = 'agenda_point';
        $crud->module = 'assemblies';
        $crud->embed = 'firstchild';
        $crud->icon_var = 'status';
        $crud->list_tabs = 'status';
    }
}