$haveInfoRecords = true;
}
+ // Not sure how to make the 'callback' use $this-> or this could get pulled out
+ function orderSort ($a, $b) { return (strcmp ($a['order'],$b['order'])); }
+
// In case we want to treat the widget data before sending it to the viewfile.
// May be able to avoid sending the (huge) Config array to the view
foreach ( $this->config[ 'addOns' ] as $a ) {
$addons[$a['slug']]['slug'] = $a['slug'];
$addons[$a['slug']]['index'] = $a['index'];
$addons[$a['slug']]['widgetData'] = apply_filters($a['slug'] . "-dashboard-widget", "");
-
$addons[$a['slug']]['widgetData'] = $this->queryWidgetLists($addons[$a['slug']]['widgetData']);
-
+
+ // Sort the component list based on the 'order'
+ uasort($addons[$a['slug']]['widgetData']['components'], 'orderSort');
} else {
echo "<br>" . $a['slug'] . " has no filter called " . $a['slug'] . "-dashboard-widget";
- //$widgetData[] = $a['slug'];
}
-
}
-
-
-
// Compile template data.
$templateData = array(
'lockedToMember' => $lockedToMember,
}
+ // public function orderSort ($a, $b) { return (strcmp ($a['order'],$b['order'])); }
+
public function queryWidgetLists( &$widgetData = false ) {
foreach ( $widgetData['components'] as &$widgetComponent ) {
<li>
<div class="summary-widget-handle collapsible-header"><pre> {$addon.widgetData.title}</pre></div>
<div class="summary-widget-body collapsible-body">
- {$addon.widgetData|@count}
-
-
-
{foreach $addon.widgetData.components as $component}
- Order: {$component.order}
+
{if isset($component.template)}
- {*if file_exists("./components/$component.component.html") // wouldn't it be great if this worked?*}
+ {**if file_exists("./components/$component.component.html") // wouldn't it be great if this worked?**}
- {* This will throw a serious error if the file does not exist *}
+ {** This will throw a serious error if the file does not exist **}
+ {if isset($component['order']) && $component['order'] !== ''}
+ <br>====<span>Throwing this component '{$component.template}'' in position {$component.order}</span>====<br>
+ {else}
+ <br>====<span>No order for this component '{$component.template}', thrown to the top</span>====<br>
+ {/if}
{include file="./components/{$component.template}.html"}
- {*/if*}
+ {**/if**}
{/if}
{/foreach}
<div class="results-number">