示例#1
0
 /**
  * 
  * @param array $types
  * @param integer $ds_id
  * @return array
  */
 public static function get_related(array $types, $ds_id = NULL)
 {
     $db_widgets = Widget_Manager::get_widgets($types);
     $widgets = array();
     foreach ($db_widgets as $id => $widget) {
         if ($ds_id !== NULL and $ds_id != $widget->ds_id) {
             continue;
         }
         $widgets[$id] = $widget->name;
     }
     return $widgets;
 }
示例#2
0
 /**
  * 
  * @param integer $ds_id
  * @return array
  */
 public static function clear_cache($ds_id, array $widget_types = array())
 {
     $objects = Widget_Manager::get_widgets($widget_types);
     $cleared_ids = array();
     foreach ($objects as $id => $data) {
         $widget = Widget_Manager::load($id);
         if ($widget->ds_id == $ds_id) {
             $cleared_ids[] = $widget->id;
             $widget->clear_cache();
         }
     }
     return $cleared_ids;
 }