Esempio n. 1
0
 /**
  * Tries to find default data, composing it to the 
  * {@link WidgetResultSet} and injecting this result set 
  * to the data-setter method of particular widget, specified
  * by widget_id parameter.
  *
  * If no data was found, empty {@link WidgetResultSet}
  * will be passed to widget.
  *
  * @param string id of the widget for which to make a lookup
  * @return WidgetResultSet with default data
  */
 static function findDefault($widget_id)
 {
     $wrs = new WidgetResultSet();
     if (($widget = Controller::getInstance()->getWidget($widget_id)) === null) {
         return $wrs;
     }
     if (($data_setter = $widget->getDataSetterMethod()) === null || $widget instanceof iNotSelectable) {
         return $wrs;
     }
     foreach (self::$pool as $v) {
         $d_o = $v['data_object'];
         if (($def = $d_o->getData($widget_id)) !== null && !$def instanceof WidgetResultSet) {
             $wrs->setDef($def);
         }
     }
     $widget->{$data_setter}($wrs);
 }
Esempio n. 2
0
 /**
  * Method description
  *
  * More detailed method description
  * @param    mixed $data
  * @return   void
  */
 function setData(WidgetResultSet $data)
 {
     $h = Header::get();
     $h->setTitleSeparator(Language::encodePair($data->get('separator')));
     $h->setTitleStart(Language::encodePair($data->get('start')));
     $h->setTitleEnd(Language::encodePair($data->get('end')));
     if ($data->get('add')) {
         $h->addTitleItem(Language::encodePair($data->get('add')));
     }
     parent::setData($data);
 }
Esempio n. 3
0
 /**
  * Method description
  *
  * More detailed method description
  * @param    array $data
  * @return   void
  */
 function setData(WidgetResultSet $data)
 {
     // should be true only once: upon the first setData call
     if ($this->str_memento === -1) {
         $this->str_memento = $this->getText();
     } else {
         $this->str = $this->str_memento;
     }
     $this->setText($data->get('text'));
     // May be not ?
     $this->setText($data->getDef());
 }
Esempio n. 4
0
 /**
  * Method description
  *
  * More detailed method description
  * @param    mixed $data
  * @return   void
  */
 function setData(WidgetResultSet $data)
 {
     $this->setCellspacing($data->get('cellspacing'));
     $this->setCellpadding($data->get('cellpadding'));
     $this->setFrame($data->get('frame'));
     $this->setBorder($data->get('border'));
     $this->setRules($data->get('rules'));
     $this->setWidth($data->get('width'));
     $this->setSummary($data->get('summary'));
     $this->setOddClass($data->get('odd'));
     $this->setEvenClass($data->get('even'));
     $this->setHoverClass($data->get('even'));
     parent::setData($data);
 }
Esempio n. 5
0
 /**
  * Method description
  *
  * More detailed method description
  * @param    array $data  
  * @return   void
  */
 function setData(WidgetResultSet $data)
 {
     $this->setAction($data->get('action'));
     $this->setEnctype($data->get('enctype'));
     $this->setMethod($data->get('method'));
     parent::setData($data);
 }
Esempio n. 6
0
 /**
  * Among the stored selectors search those, which are matched with the 
  * current widget's state.
  *
  * For matched selectors {@link WidgetResultSet} will be filled with the 
  * data, passed from the user's models.
  *
  * In order to reduce the lookups of result of matching given widget with
  * the particular selector, intermediate caching in $GLBALS is used.
  *
  * @param WComponent widget to be analyzed
  * @return WidgetResultSet with the data that should be passed to this widget
  */
 function findMatched(WComponent $widget)
 {
     $wrs = new WidgetResultSet();
     foreach ($this->fors as $selectors => $v) {
         foreach (explode(",", $selectors) as $selector) {
             // hit the cache, ie SelectorMatcher::matched for this widget and selector
             // was called
             if (array_key_exists($md5 = md5($selector . $widget->getId()), $GLOBALS['__m_cache'])) {
                 if ($GLOBALS['__m_cache'][$md5] === SelectorMatcher::FALSE_CACHE) {
                     continue;
                 } elseif ($GLOBALS['__m_cache'][$md5] === SelectorMatcher::TRUE_CACHE) {
                     @$wrs->merge($this->for_values[$selectors]);
                     @$wrs->setDef($this->default_values[$selectors]);
                     if (isset($this->f1s[$selectors])) {
                         unset($this->fors[$selectors]);
                         unset($this->for_values[$selectors]);
                     }
                 } elseif (SelectorMatcher::matched($widget, $selector, null, null)) {
                     @$wrs->merge($this->for_values[$selectors]);
                     @$wrs->setDef($this->default_values[$selectors]);
                     if (isset($this->f1s[$selectors])) {
                         unset($this->fors[$selectors]);
                         unset($this->for_values[$selectors]);
                     }
                 }
             } elseif ($GLOBALS['__m_cache'][$md5] = SelectorMatcher::matched($widget, $selector, null, null)) {
                 @$wrs->merge($this->for_values[$selectors]);
                 @$wrs->setDef($this->default_values[$selectors]);
                 if (isset($this->f1s[$selectors])) {
                     unset($this->fors[$selectors]);
                     unset($this->for_values[$selectors]);
                 }
             }
         }
     }
     //once again but now for selector with indexes
     foreach ($this->fors_array as $selectors => $arr) {
         foreach (explode(",", $selectors) as $selector) {
             $md5 = md5($selector . $widget->getId());
             if (array_key_exists($md5, $GLOBALS['__m_cache'])) {
                 if ($GLOBALS['__m_cache'][$md5] === SelectorMatcher::FALSE_CACHE) {
                     continue;
                 } elseif ($GLOBALS['__m_cache'][$md5] === SelectorMatcher::TRUE_CACHE) {
                     @$wrs->merge($this->for_values_array[$selectors][$matched = Controller::getInstance()->getDisplayModeParams()->getMatchedIndex()]);
                     @$wrs->setDef($this->default_values_array[$selectors][$matched]);
                     if (isset($this->f1s[$selectors])) {
                         unset($this->fors_array[$selectors]['index'][$matched]);
                         unset($this->fors_array[$selectors]['scope'][$matched]);
                         unset($this->for_values_array[$selectors][$matched]);
                     }
                 } elseif (SelectorMatcher::matched($widget, $selector, $arr['index'], $arr['scope'])) {
                     @$wrs->merge($this->for_values_array[$selectors][$matched = Controller::getInstance()->getDisplayModeParams()->getMatchedIndex()]);
                     @$wrs->setDef($this->default_values_array[$selectors][$matched]);
                     if (isset($this->f1s[$selectors])) {
                         unset($this->fors_array[$selectors]['index'][$matched]);
                         unset($this->fors_array[$selectors]['scope'][$matched]);
                         unset($this->for_values_array[$selectors][$matched]);
                     }
                 }
             } elseif ($GLOBALS['__m_cache'][$md5] = SelectorMatcher::matched($widget, $selector, $arr['index'], $arr['scope'])) {
                 @$wrs->merge($this->for_values_array[$selectors][$matched = Controller::getInstance()->getDisplayModeParams()->getMatchedIndex()]);
                 @$wrs->setDef($this->default_values_array[$selectors][$matched]);
                 if (isset($this->f1s[$selectors])) {
                     unset($this->fors_array[$selectors]['index'][$matched]);
                     unset($this->fors_array[$selectors]['scope'][$matched]);
                     unset($this->for_values_array[$selectors][$matched]);
                 }
             }
         }
     }
     return $wrs;
 }
Esempio n. 7
0
 /**
  * Method description
  *
  * More detailed method description
  * @param    array $data  
  * @return   void
  */
 function setData(WidgetResultSet $data)
 {
     $this->setSorter($data->get('sorter'));
     parent::setData($data);
 }
Esempio n. 8
0
 /**
  * Method description
  *
  * More detailed method description
  * @param    mixed $data
  * @return   void
  */
 function setData(WidgetResultSet $data)
 {
     if ($data->getDef() !== null) {
         ResultSetPool::set(t(new ResultSet())->f1("#" . $this->getId() . " wselectoption[value=" . $data->getDef() . "]")->set('selected', 1), ResultSetPool::SYSTEM_PRIORITY);
     }
     $this->setSize($data->get('size'));
     $this->setMultiple($data->get('multiple'));
     parent::setData($data);
 }
Esempio n. 9
0
 /**
  * Method description
  *
  * More detailed method description
  * @param    mixed $data
  * @return   void
  */
 function setData(WidgetResultSet $data)
 {
     $this->setLegend($data->getDef());
     $this->setLegend($data->get('legend'));
     parent::setData($data);
 }
Esempio n. 10
0
 /**
  * Method description
  *
  * More detailed method description
  * @param    mixed $data
  * @return   void
  */
 function setData(WidgetResultSet $data)
 {
     $this->setTabTitle($data->getDef());
     $this->setTabTitle($data->get('tab_title'));
     $this->setHref($data->get('href'));
     $this->setSelected($data->get('selected'));
     parent::setData($data);
 }
Esempio n. 11
0
 /**
  * Method description
  *
  * More detailed method description
  * @param    mixed $data
  * @return   void
  */
 function setData(WidgetResultSet $data)
 {
     $this->setStep($data->get('step'));
     $this->setMax($data->get('max'));
     $this->setMin($data->get('min'));
     $this->setText($data->get('text'));
     parent::setData($data);
 }
Esempio n. 12
0
 /**
  * Method description
  *
  * More detailed method description
  * @param    mixed $data
  * @return   void
  */
 function setData(WidgetResultSet $data)
 {
     $this->setAlign($data->get('align'));
     $this->setValign($data->get('valign'));
     parent::setData($data);
 }
Esempio n. 13
0
 /**
  * Method description
  *
  * More detailed method description
  * @param    mixed $data
  * @return   void
  */
 function setData(WidgetResultSet $data)
 {
     $this->setMaxLength($data->get('maxlength'));
     $this->setSize($data->get('size'));
     $this->setType($data->get('type'));
     parent::setData($data);
 }
Esempio n. 14
0
 /**
  * Method description
  *
  * More detailed method description
  * @param    array $data
  * @return   void
  */
 function setData(WidgetResultSet $data)
 {
     $controller = Controller::getInstance();
     if (isset($data->style)) {
         $this->setStyle($controller->getStyleByName($data->get('style')));
     }
     if (isset($data->javascript)) {
         $this->setJavaScript($controller->getJavaScriptByName($data->get('javascript')));
     }
     if (isset($data->visible)) {
         $this->setVisible($data->get('visible'));
     }
     if (isset($data->enabled)) {
         $this->setState($data->get('enabled'));
     }
     if (isset($data->title)) {
         $this->setTitle($data->get('title'));
     }
     if (isset($data->tooltip)) {
         $this->setTooltip($data->get('tooltip'));
     }
     if (isset($data->html_id)) {
         $this->setHTMLId($data->html_id);
     }
     if (isset($data->class)) {
         $this->setStyleClass($data->get('class'));
     }
     if (isset($data->hide_if_empty)) {
         $this->setHideIfEmpty($data->get('hide_if_empty'));
     }
     if (isset($data->hide_if_hidden)) {
         $this->setHideIfHidden($data->get('hide_if_hidden'));
     }
     $this->setDataSetted(true);
 }
Esempio n. 15
0
 /**
  * Method description
  *
  * More detailed method description
  * @param    mixed $data
  * @return   void
  */
 function setData(WidgetResultSet $data)
 {
     $this->setSrc($data->get('src'));
     $this->setAlt($data->get('alt'));
     $this->setType($data->get('type'));
     parent::setData($data);
 }
Esempio n. 16
0
 /**
  * Method description
  *
  * More detailed method description
  * @param    mixed $data
  * @return   void
  */
 function setData(WidgetResultSet $data)
 {
     $this->setDateFormat($data->get('dateformat'));
     parent::setData($data);
 }
Esempio n. 17
0
 /**
  * Method description
  *
  * More detailed method description
  * @param    mixed $data
  * @return   void
  */
 function setData(WidgetResultSet $data)
 {
     $this->setSrc($data->getDef());
     $this->setSrc($data->get('src'));
     $this->setWidth($data->get('width'));
     $this->setHeight($data->get('height'));
     $this->setBgColor($data->get('bgcolor'));
     parent::setData($data);
 }
Esempio n. 18
0
 /**
  * Method description
  *
  * More detailed method description
  * @param    mixed $data
  * @return   void
  */
 function setData(WidgetResultSet $data)
 {
     $this->setVar($data->get('var'));
     $this->setVar($data->getDef());
     parent::setData($data);
 }
Esempio n. 19
0
 /**
  * Method description
  *
  * More detailed method description
  * @param    mixed $data
  * @return   void
  */
 function setData(WidgetResultSet $data)
 {
     $this->setSize($data->get('size'));
     $this->setMaxFileSize($data->get('max_file_size'));
     parent::setData($data);
 }
Esempio n. 20
0
 /**
  * Method description
  *
  * More detailed method description
  * @param    mixed $data
  * @return   void
  */
 function setData(WidgetResultSet $data)
 {
     $this->setText($data->get('text'));
     $this->setText($data->getDef());
     parent::setData($data);
 }
Esempio n. 21
0
 /**
  * Method description
  *
  * More detailed method description
  * @param    array $data
  * @return   void
  */
 function setData(WidgetResultSet $data)
 {
     $this->setName($data->get('name'));
     $this->setValue($data->getDef());
     $this->setValue($data->get('value'));
     $this->setReadonly($data->get('readonly'));
     $this->setAdditionalID($data->get('additional_id'));
     $this->setDisabled($data->get('disabled'));
     parent::setData($data);
 }
Esempio n. 22
0
 /**
  * Method description
  *
  * More detailed method description
  * @param    mixed $data
  * @return   void
  */
 function setData(WidgetResultSet $data)
 {
     $this->setText($data->get('text'));
     $this->setValue($data->get('value'));
     $this->setValue($data->getDef());
     $this->setSelected($data->get('selected'));
     parent::setData($data);
 }
Esempio n. 23
0
 /**
  * Method description
  *
  * More detailed method description
  * @param    mixed $data
  * @return   void
  */
 function setData(WidgetResultSet $data)
 {
     $this->setCount($data->getDef());
     $this->setCount($data->get('count'));
     parent::setData($data);
 }
Esempio n. 24
0
 /**
  * Method description
  *
  * More detailed method description
  * @param    mixed $data
  * @return   void
  */
 function setData(WidgetResultSet $data)
 {
     $this->setFile($data->getDef());
     $this->setFile($data->get('file'));
     $this->setSrc($data->get('src'));
     $this->setWidth($data->get('width'));
     $this->setHeight($data->get('height'));
     $this->setAlt($data->get('alt'));
     $this->setMaxWidth($data->get('max_width'));
     $this->setMaxHeight($data->get('max_height'));
     $this->setWithPreview($data->get('with_preview'));
     parent::setData($data);
 }
Esempio n. 25
0
 /**
  * Method description
  *
  * More detailed method description
  * @param    array $data  
  * @return   void
  */
 function setData(WidgetResultSet $data)
 {
     $this->setWidth($data->get('width'));
     $this->setAlign($data->get('align'));
     $this->setAlign($data->get('valign'));
     $this->setColspan($data->get('colspan'));
     $this->setRowspan($data->get('rowspan'));
     parent::setData($data);
 }
Esempio n. 26
0
 /**
  * Method description
  *
  * More detailed method description
  * @param    mixed $data
  * @return   void
  */
 function setData(WidgetResultSet $data)
 {
     $this->setCols($data->get('cols'));
     $this->setRows($data->get('rows'));
     parent::setData($data);
 }
Esempio n. 27
0
 /**
  * Method description
  *
  * More detailed method description
  * @param    mixed $data
  * @return   void
  */
 function setData(WidgetResultSet $data)
 {
     $this->setHREF($data->getDef());
     $this->setAttribute('rel', $data->get('rel'));
     $this->setAttribute('rev', $data->get('rev'));
     $this->setName($data->get('name'));
     $this->setAttribute('target', $data->get('target'));
     /*if(($text = $data->getDef()) !== null && !$this->items->count())
                $this->items->setText($text);
            if(($text = $data->get('text')) !== null && !$this->items->count())
     		$this->items->setText($text);*/
     $href = $data->get('href');
     if (isset($href)) {
         if (is_array($href)) {
             $page = null;
             if (isset($href['page'])) {
                 $page = $href['page'];
                 unset($href['page']);
             }
             $this->setHREF(Controller::getInstance()->makeURL($page, $href));
         } else {
             $this->setHREF($href);
         }
     }
     parent::setData($data);
 }