当前位置: 首页>>代码示例>>PHP>>正文


PHP elgg_get_widgets函数代码示例

本文整理汇总了PHP中elgg_get_widgets函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_get_widgets函数的具体用法?PHP elgg_get_widgets怎么用?PHP elgg_get_widgets使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了elgg_get_widgets函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: isAdded

 /**
  * Checks if version widget was already added
  * @return boolean
  */
 static function isAdded()
 {
     $widgets = elgg_get_widgets(ELGG_ENTITIES_ANY_VALUE, 'admin');
     foreach ($widgets as $column) {
         foreach ($column as $item) {
             if ($item->handler == 'version') {
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:socialweb,项目名称:PiGo,代码行数:16,代码来源:core_version.php

示例2: elgg_view_widgets

/**
 * Output a single column of widgets.
 *
 * @param ElggUser $user        The owner user entity.
 * @param string   $context     The context (profile, dashboard, etc.)
 * @param int      $column      Which column to output.
 * @param bool     $show_access Show the access control (true by default)
 */
function elgg_view_widgets($user, $context, $column, $show_access = true)
{
    $widgets = elgg_get_widgets($user->guid, $context);
    $column_widgets = $widgets[$column];
    $column_html = "<div class=\"elgg-widgets\" id=\"elgg-widget-col-{$column}\">";
    if (sizeof($column_widgets) > 0) {
        foreach ($column_widgets as $widget) {
            if (elgg_is_widget_type($widget->handler)) {
                $column_html .= elgg_view_entity($widget, array('show_access' => $show_access));
            }
        }
    }
    $column_html .= '</div>';
    return $column_html;
}
开发者ID:nogsus,项目名称:Elgg,代码行数:23,代码来源:widgets.php

示例3: elgg_extract

 *
 * @uses $vars['content']          Optional display box at the top of layout
 * @uses $vars['num_columns']      Number of widget columns for this layout (3)
 * @uses $vars['show_add_widgets'] Display the add widgets button and panel (true)
 * @uses $vars['exact_match']      Widgets must match the current context (false)
 * @uses $vars['show_access']      Show the access control (true)
 */
$num_columns = elgg_extract('num_columns', $vars, 2);
$show_add_widgets = elgg_extract('show_add_widgets', $vars, true);
$exact_match = elgg_extract('exact_match', $vars, false);
$show_access = elgg_extract('show_access', $vars, true);
$owner = elgg_get_page_owner_entity();
$widget_types = elgg_get_widget_types();
$context = elgg_get_context();
elgg_push_context('widgets');
$widgets = elgg_get_widgets($owner->guid, $context);
echo '<div class="elgg-layout-widgets">';
if (elgg_can_edit_widget_layout($context)) {
    if ($show_add_widgets) {
        echo elgg_view('page/layouts/widgets/add_button');
    }
    $params = array('widgets' => $widgets, 'context' => $context, 'exact_match' => $exact_match, 'show_access' => $show_access, 'class' => 'btn btn-primary mrgn-bttm-sm');
    echo elgg_view('page/layouts/widgets/add_panel', $params);
}
/*
if (isset($vars['content'])) {
	echo $vars['content'];
}
*/
//$widget_class = "elgg-col-1of{$num_columns}";
$widget_class = "col-sm-6";
开发者ID:smellems,项目名称:wet4,代码行数:31,代码来源:db_widgets.php

示例4: elseif

        // determine top row width
        if ($index_top_row == "two_column_left") {
            $top_row_width = 100 - $columns[0];
        }
        break;
}
if ($index_top_row == "full_row" || $num_columns === 2) {
    $top_row_width = 100;
} elseif ($index_top_row == "two_column_left") {
    $float = "float: left;";
}
$top_row_used = false;
if (!empty($index_top_row) && $index_top_row != "none") {
    $widget_types = elgg_get_widget_types("index", false);
    elgg_push_context('widgets');
    $widgets = elgg_get_widgets(elgg_get_page_owner_entity()->getGUID(), "index");
    $widget_content = "";
    if (isset($widgets[4])) {
        $column_widgets = $widgets[4];
        if (sizeof($column_widgets) > 0) {
            foreach ($column_widgets as $widget) {
                if (array_key_exists($widget->handler, $widget_types)) {
                    $widget_content .= elgg_view_entity($widget, array('show_access' => true));
                }
            }
        }
    }
    $top_row = "<div id='elgg-widget-col-4' class='elgg-widgets'>" . $widget_content . "</div>";
    if (elgg_is_admin_logged_in()) {
        $min_height = "min-height: 50px !important;";
    } else {
开发者ID:n8b,项目名称:VMN,代码行数:31,代码来源:custom_index.php

示例5: elgg_add_admin_widgets

/**
 * Adds default admin widgets to the admin dashboard.
 *
 * @param string $event
 * @param string $type
 * @param ElggUser $user
 *
 * @return null|true
 * @access private
 */
function elgg_add_admin_widgets($event, $type, $user)
{
    elgg_set_ignore_access(true);
    // check if the user already has widgets
    if (elgg_get_widgets($user->getGUID(), 'admin')) {
        return true;
    }
    // In the form column => array of handlers in order, top to bottom
    $adminWidgets = array(1 => array('control_panel', 'admin_welcome'), 2 => array('online_users', 'new_users', 'content_stats'));
    foreach ($adminWidgets as $column => $handlers) {
        foreach ($handlers as $position => $handler) {
            $guid = elgg_create_widget($user->getGUID(), $handler, 'admin');
            if ($guid) {
                $widget = get_entity($guid);
                /* @var ElggWidget $widget */
                $widget->move($column, $position);
            }
        }
    }
    elgg_set_ignore_access(false);
}
开发者ID:duanhv,项目名称:mdg-social,代码行数:31,代码来源:admin.php

示例6: elseif

        // determine top row width
        if ($index_top_row == "two_column_left") {
            $top_row_width = 100 - $columns[0];
        }
        break;
}
if ($index_top_row == "full_row" || $num_columns === 2) {
    $top_row_width = 100;
} elseif ($index_top_row == "two_column_left") {
    $float = "float: left;";
}
$top_row_used = false;
if (!empty($index_top_row) && $index_top_row != "none") {
    $widget_types = elgg_get_widget_types("index", false);
    elgg_push_context('widgets');
    $widgets = elgg_get_widgets(elgg_get_page_owner_guid(), $handler);
    $widget_content = "";
    if (isset($widgets[4])) {
        $column_widgets = $widgets[4];
        if (sizeof($column_widgets) > 0) {
            foreach ($column_widgets as $widget) {
                if (array_key_exists($widget->handler, $widget_types)) {
                    $widget_content .= elgg_view_entity($widget, array('show_access' => true));
                }
            }
        }
    }
    $top_row = "<div id='elgg-widget-col-4' class='elgg-widgets'>" . $widget_content . "</div>";
    if (elgg_can_edit_widget_layout($handler)) {
        $min_height = "min-height: 50px !important;";
    } else {
开发者ID:coldtrick,项目名称:widget_manager,代码行数:31,代码来源:extra_contexts.php

示例7: widget_manager_update_group_event_handler

/**
 * Sets the widget manager tool option. This is needed because in some situation the tool option is not available.
 *
 * And add/remove tool enabled widgets
 *
 * @param string $event       name of the system event
 * @param string $object_type type of the event
 * @param mixed  $object      object related to the event
 *
 * @return void
 */
function widget_manager_update_group_event_handler($event, $object_type, $object)
{
    if (!$object instanceof ElggGroup) {
        return;
    }
    $plugin_settings = elgg_get_plugin_setting("group_enable", "widget_manager");
    // make widget management mandatory
    if ($plugin_settings == "forced") {
        $object->widget_manager_enable = "yes";
    }
    // add/remove tool enabled widgets
    if ($plugin_settings == "forced" || $plugin_settings == "yes" && $object->widget_manager_enable == "yes") {
        $result = array("enable" => array(), "disable" => array());
        $params = array("entity" => $object);
        $result = elgg_trigger_plugin_hook("group_tool_widgets", "widget_manager", $params, $result);
        if (empty($result) || !is_array($result)) {
            return;
        }
        $current_widgets = elgg_get_widgets($object->getGUID(), "groups");
        // disable widgets
        $disable_widget_handlers = elgg_extract("disable", $result);
        if (!empty($disable_widget_handlers) && is_array($disable_widget_handlers)) {
            if (!empty($current_widgets) && is_array($current_widgets)) {
                foreach ($current_widgets as $column => $widgets) {
                    if (!empty($widgets) && is_array($widgets)) {
                        foreach ($widgets as $order => $widget) {
                            // check if a widget should be removed
                            if (in_array($widget->handler, $disable_widget_handlers)) {
                                // yes, so remove the widget
                                $widget->delete();
                                unset($current_widgets[$column][$order]);
                            }
                        }
                    }
                }
            }
        }
        // enable widgets
        $column_counts = array();
        $enable_widget_handlers = elgg_extract("enable", $result);
        if (!empty($enable_widget_handlers) || is_array($enable_widget_handlers)) {
            // ignore access restrictions
            // because if a group is created with a visibility of only group members
            // the group owner is not yet added to the acl and thus can't edit the newly created widgets
            $ia = elgg_set_ignore_access(true);
            if (!empty($current_widgets) && is_array($current_widgets)) {
                foreach ($current_widgets as $column => $widgets) {
                    // count for later balancing
                    $column_counts[$column] = count($widgets);
                    if (!empty($widgets) && is_array($widgets)) {
                        foreach ($widgets as $order => $widget) {
                            // check if a widget which sould be enabled isn't already enabled
                            $enable_index = array_search($widget->handler, $enable_widget_handlers);
                            if ($enable_index !== false) {
                                // already enabled, do add duplicate
                                unset($enable_widget_handlers[$enable_index]);
                            }
                        }
                    }
                }
            }
            // add new widgets
            if (!empty($enable_widget_handlers)) {
                foreach ($enable_widget_handlers as $handler) {
                    $widget_guid = elgg_create_widget($object->getGUID(), $handler, "groups", $object->access_id);
                    if (!empty($widget_guid)) {
                        $widget = get_entity($widget_guid);
                        if ($column_counts[1] <= $column_counts[2]) {
                            // move to the end of the first column
                            $widget->move(1, 9000);
                            $column_counts[1]++;
                        } else {
                            // move to the end of the second
                            $widget->move(2, 9000);
                            $column_counts[2]++;
                        }
                    }
                }
            }
            // restore access restrictions
            elgg_set_ignore_access($ia);
        }
    }
}
开发者ID:myhotfb,项目名称:widget_manager,代码行数:95,代码来源:events.php

示例8: elseif

        // determine top row width
        if ($index_top_row == "two_column_left") {
            $top_row_width = 100 - $columns[0];
        }
        break;
}
if ($index_top_row == "full_row" || $num_columns === 2) {
    $top_row_width = 100;
} elseif ($index_top_row == "two_column_left") {
    $float = "float: left;";
}
$top_row_used = false;
if (!empty($index_top_row) && $index_top_row != "none") {
    $widget_types = elgg_get_widget_types("index", false);
    elgg_push_context('widgets');
    $widgets = elgg_get_widgets(elgg_get_page_owner_guid(), "index");
    $widget_content = "";
    if (isset($widgets[4])) {
        $column_widgets = $widgets[4];
        if (sizeof($column_widgets) > 0) {
            foreach ($column_widgets as $widget) {
                if (array_key_exists($widget->handler, $widget_types)) {
                    $widget_content .= elgg_view_entity($widget, array('show_access' => true));
                }
            }
        }
    }
    $top_row = "<div id='elgg-widget-col-4' class='elgg-widgets'>" . $widget_content . "</div>";
    if (elgg_is_admin_logged_in()) {
        $min_height = "min-height: 50px !important;";
    } else {
开发者ID:coldtrick,项目名称:widget_manager,代码行数:31,代码来源:custom_index.php

示例9: custom_index_build_columns

    if (isset($vars['area3'])) {
        $vars['area1'] = $vars['area3'];
    }
    if (isset($vars['area4'])) {
        $vars['area2'] = $vars['area4'];
    }
}
$leftcolumn_widgets_view = custom_index_build_columns($area1widgets, $widgettypes);
$middlecolumn_widgets_view = custom_index_build_columns($area2widgets, $widgettypes);
$rightcolumn_widgets_view = custom_index_build_columns($area3widgets, $widgettypes);
$content = elgg_view_layout($ciw_layout, array('area1' => $leftcolumn_widgets_view, 'area2' => $middlecolumn_widgets_view, 'area3' => $rightcolumn_widgets_view, 'layoutmode' => 'index_mode'));
if (elgg_is_logged_in() && $ciw_showdashboard == "yes") {
    $user_guid = elgg_get_logged_in_user_guid();
    elgg_set_page_owner_guid($user_guid);
    elgg_set_context('dashboard');
    $dashboardwidgets = elgg_get_widgets($user_guid, elgg_get_context());
    $area1widgets = isset($dashboardwidgets[1]) ? $dashboardwidgets[1] : FALSE;
    $area2widgets = isset($dashboardwidgets[2]) ? $dashboardwidgets[2] : FALSE;
    $area3widgets = isset($dashboardwidgets[3]) ? $dashboardwidgets[3] : FALSE;
    /*
        $area1widgets = elgg_get_widgets($user_guid,elgg_get_context(),1);
        $area2widgets = elgg_get_widgets($user_guid,elgg_get_context(),2);
        $area3widgets = elgg_get_widgets($user_guid,elgg_get_context(),3);
    */
    if (empty($area1widgets) && empty($area2widgets) && empty($area3widgets)) {
        if (isset($vars['area3'])) {
            $vars['area1'] = $vars['area3'];
        }
        if (isset($vars['area4'])) {
            $vars['area2'] = $vars['area4'];
        }
开发者ID:smellems,项目名称:wet4,代码行数:31,代码来源:newsfeed.php

示例10: array

 for ($column_index = 1; $column_index <= $num_columns; $column_index++) {
     if (isset($widgets[$column_index])) {
         $column_widgets = $widgets[$column_index];
     } else {
         $column_widgets = array();
     }
     if (sizeof($column_widgets) > 0) {
         foreach ($column_widgets as $widget) {
             if ($widget) {
                 $widget->delete();
             }
         }
     }
 }
 // get default widgets and add them
 $widgets = elgg_get_widgets($site_guid, $context);
 $num_columns = count($widgets);
 for ($column_index = 1; $column_index <= $num_columns; $column_index++) {
     if (isset($widgets[$column_index])) {
         $column_widgets = $widgets[$column_index];
     } else {
         $column_widgets = array();
     }
     if (sizeof($column_widgets) > 0) {
         $line = 0;
         foreach ($column_widgets as $widget) {
             if ($widget) {
                 // change the container and owner
                 $new_widget = clone $widget;
                 $new_widget->container_guid = $owner_guid;
                 $new_widget->owner_guid = $owner_guid;
开发者ID:remy40,项目名称:gvrs,代码行数:31,代码来源:reinitialize.php

示例11: elseif

        // determine top row width
        if ($index_top_row == "two_column_left") {
            $top_row_width = 100 - $columns[0];
        }
        break;
}
if ($index_top_row == "full_row" || $num_columns === 2) {
    $top_row_width = 100;
} elseif ($index_top_row == "two_column_left") {
    $float = "float: left;";
}
$top_row_used = false;
if (!empty($index_top_row) && $index_top_row != "none") {
    $widget_types = elgg_get_widget_types("index", false);
    elgg_push_context('widgets');
    $widgets = elgg_get_widgets(elgg_get_page_owner_entity()->getGUID(), $handler);
    $widget_content = "";
    if (isset($widgets[4])) {
        $column_widgets = $widgets[4];
        if (sizeof($column_widgets) > 0) {
            foreach ($column_widgets as $widget) {
                if (array_key_exists($widget->handler, $widget_types)) {
                    $widget_content .= elgg_view_entity($widget, array('show_access' => true));
                }
            }
        }
    }
    $top_row = "<div id='elgg-widget-col-4' class='elgg-widgets'>" . $widget_content . "</div>";
    if (elgg_can_edit_widget_layout($handler)) {
        $min_height = "min-height: 50px !important;";
    } else {
开发者ID:n8b,项目名称:VMN,代码行数:31,代码来源:extra_contexts.php


注:本文中的elgg_get_widgets函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。