예제 #1
0
 public function action_add()
 {
     // check if trying to save
     if (Request::current()->method() == Request::POST) {
         return $this->_add();
     }
     $this->set_title(__('Create widget'));
     $this->template->content = View::factory('widgets/add', array('types' => Widget_Manager::map()));
 }
예제 #2
0
파일: widget.php 프로젝트: ZerGabriel/cms-1
 public function type()
 {
     $widget_types = Widget_Manager::map();
     $type = $this->type;
     foreach ($widget_types as $group => $types) {
         if (isset($types[$type])) {
             $type = $types[$type];
         }
     }
     return $type;
 }
예제 #3
0
 public function get_widget_list()
 {
     $widget_settings = Model_User_Meta::get(Dashboard::WIDGET_SETTINGS_KEY, array());
     $types = Widget_Manager::map('dashboard_widgets');
     $attached_types = array();
     foreach ($widget_settings as $widget) {
         $attached_types[$widget->type()] = $widget->is_multiple();
     }
     foreach ($types as $key => $data) {
         if (Arr::get($attached_types, $key) === FALSE) {
             unset($types[$key]);
         }
     }
     $this->json = (string) View::factory('dashboard/widgets', array('types' => $types));
 }
예제 #4
0
 /**
  * 
  * @return string
  */
 public function type($as_key = TRUE)
 {
     if ($as_key === TRUE) {
         return $this->_type;
     }
     $widget_types = Widget_Manager::map();
     $type = $this->_type;
     foreach ($widget_types as $group => $types) {
         if (isset($types[$type])) {
             $type = $types[$type];
         }
     }
     return $type;
 }