コード例 #1
0
 /**
  * Handles the extra contexts page
  *
  * @param array  $page    page elements
  * @param string $handler handler of the current page
  *
  * @return boolean
  */
 public static function extraContexts($page, $handler)
 {
     if (!widget_manager_is_extra_context($handler)) {
         return false;
     }
     echo elgg_view_resource('widget_manager/extra_contexts', ['handler' => $handler]);
     return true;
 }
コード例 #2
0
ファイル: page_handlers.php プロジェクト: n8b/VMN
/**
 * Handles the extra contexts page
 *
 * @param array  $page    page elements
 * @param string $handler handler of the current page
 * 
 * @return boolean
 */
function widget_manager_extra_contexts_page_handler($page, $handler)
{
    $result = false;
    $extra_contexts = elgg_get_plugin_setting("extra_contexts", "widget_manager");
    if (widget_manager_is_extra_context($handler)) {
        $result = true;
        // make nice lightbox popup title
        add_translation(get_current_language(), array("widget_manager:widgets:lightbox:title:" . strtolower($handler) => $handler));
        // backwards compatibility
        set_input("handler", $handler);
        include dirname(dirname(__FILE__)) . "/pages/extra_contexts.php";
    }
    return $result;
}
コード例 #3
0
ファイル: Widgets.php プロジェクト: coldtrick/widget_manager
 /**
  * Adds index widget handlers as allowed handlers to the extra context handlers
  *
  * @param string $hook_name    name of the hook
  * @param string $entity_type  type of the hook
  * @param bool   $return_value current return value
  * @param array  $params       hook parameters
  *
  * @return void
  */
 public static function addExtraContextsWidgets($hook_name, $entity_type, $return_value, $params)
 {
     $context = elgg_extract('context', $params);
     if (!widget_manager_is_extra_context($context)) {
         return;
     }
     foreach ($return_value as $id => $widget_definition) {
         if (!in_array('index', $widget_definition->context)) {
             continue;
         }
         if (!in_array($context, $widget_definition->context)) {
             $widget_definition->context[] = $context;
         }
         $return_value[$id] = $widget_definition;
     }
     return $return_value;
 }
コード例 #4
0
ファイル: widgets.php プロジェクト: coldtrick/widget_manager
    echo elgg_view('page/layouts/widgets/add_button', ['context' => $context, 'exact_match' => $exact_match, 'show_access' => $show_access]);
}
if (empty($widgets) || $context !== 'dashboard') {
    echo elgg_extract('content', $vars);
}
if ($context == 'groups') {
    $groups_top_row = '';
    if (isset($widgets[3]) && sizeof($widgets[3]) > 0) {
        foreach ($widgets[3] as $widget) {
            if (array_key_exists($widget->handler, $widget_types)) {
                $groups_top_row .= elgg_view_entity($widget, ['show_access' => $show_access]);
            }
        }
    }
    echo elgg_format_element('div', ['id' => 'elgg-widget-col-3', 'class' => 'elgg-col-1of1 elgg-widgets widget-manager-groups-widgets-top-row'], $groups_top_row);
} elseif (in_array($context, ['index', 'dashboard']) || widget_manager_is_extra_context($context)) {
    foreach ($widgets as $index => $column) {
        if ($index > $num_columns) {
            if (!isset($widgets[$num_columns])) {
                $widgets[$num_columns] = [];
            }
            // add overflow column widgets to the max column
            $widgets[$num_columns] = array_merge($widgets[$index], $widgets[$num_columns]);
            unset($widgets[$index]);
        }
    }
}
for ($column_index = 1; $column_index <= $num_columns; $column_index++) {
    $column_widgets = elgg_extract($column_index, $widgets, []);
    $column_content = '';
    foreach ($column_widgets as $widget) {
コード例 #5
0
ファイル: widgets.php プロジェクト: n8b/VMN
         if ($style) {
             echo "<style type='text/css'>" . $style . "</style>";
         }
     }
 }
 if ($context == "groups") {
     echo "<div class=\"elgg-col-1of1 elgg-widgets widget-manager-groups-widgets-top-row\" id=\"elgg-widget-col-3\">";
     if (isset($widgets[3]) && sizeof($widgets[3]) > 0) {
         foreach ($widgets[3] as $widget) {
             if (array_key_exists($widget->handler, $widget_types)) {
                 echo elgg_view_entity($widget, array('show_access' => $show_access));
             }
         }
     }
     echo "</div>";
 } elseif (in_array($context, array("index", "dashboard")) || widget_manager_is_extra_context($context)) {
     foreach ($widgets as $index => $column) {
         if ($index > $num_columns) {
             if (!isset($widgets[$num_columns])) {
                 $widgets[$num_columns] = array();
             }
             // add overflow column widgets to the max column
             $widgets[$num_columns] = array_merge($widgets[$index], $widgets[$num_columns]);
             unset($widgets[$index]);
         }
     }
 }
 $widget_class = "elgg-col-1of{$num_columns}";
 for ($column_index = 1; $column_index <= $num_columns; $column_index++) {
     if (isset($widgets[$column_index])) {
         $column_widgets = $widgets[$column_index];