GetAvailable() публичный статический Метод

Get available widgets for user
public static GetAvailable ( integer | null $uid = NULL ) : array
$uid integer | null
Результат array of IWidget
Пример #1
0
 public function testGetAvailable()
 {
     $widgets = WidgetManager::GetAvailable();
     $this->assertTrue(is_array($widgets));
     $this->assertGreaterThan(0, sizeof($widgets));
     foreach ($widgets as $widget) {
         $this->assertContains('IWidget', class_implements($widget));
     }
 }
Пример #2
0
 /**
  * Set default widgets for g_user
  * @param int $p_uid
  * @return void
  */
 public static function SetDefaultWidgets($p_uid)
 {
     // contexts used on homepage
     $contexts = array(new WidgetContext('dashboard1'), new WidgetContext('dashboard2'));
     foreach (WidgetManager::GetAvailable($p_uid) as $widget) {
         $extension = $widget->getExtension();
         if (in_array($extension->getClass(), self::$defaults)) {
             $order = (int) array_search($extension->getClass(), self::$defaults);
             // get order
             $context = $contexts[$order % sizeof($contexts)];
             // pick context
             self::AddWidget($extension->getId(), $context, (int) $p_uid, $order);
         }
     }
 }
Пример #3
0
<div class="links">
    <a href="<?php 
echo $Campsite['WEBSITE_URL'];
?>
/admin/" title="<?php 
echo $translator->trans('Go to dashboard', array(), 'home');
?>
"><?php 
echo $translator->trans('Go to dashboard', array(), 'home');
?>
</a>
</div>

<ul id="widgets">
    <?php 
foreach (WidgetManager::GetAvailable() as $widget) {
    ?>
    <li>
        <h3><?php 
    echo $widget->getTitle();
    ?>
</h3>
        <p><a href="#<?php 
    echo $widget->getExtension()->getId();
    ?>
" class="add"><?php 
    echo $translator->trans('Add to dashboard', array(), 'home');
    ?>
</a>&nbsp;</p>
        <p><?php 
    echo $translator->trans($widget->getDescription());