예제 #1
0
 /**
  * @copydoc DataSet::createToolbar
  */
 protected function loadToolbar()
 {
     $toolbar = new Toolbar('navigation');
     foreach (array(CalendarObject::PERIOD_CURRENT, CalendarObject::PERIOD_PREVIOUS, CalendarObject::PERIOD_NEXT) as $periodType) {
         $period = $this->getCalendar()->getPeriod($periodType);
         $control = new Link($periodType);
         $control->setAttribute('month', $period->month);
         $control->setAttribute('monthName', $period->monthName);
         $control->setAttribute('year', $period->year);
         $toolbar->attachControl($control);
     }
     return array($toolbar);
 }
예제 #2
0
 /**
  * Create toolbar
  *
  * @return Toolbar[]
  */
 protected function loadToolbar()
 {
     $result = [];
     if ($config = $this->getConfig()->getCurrentStateConfig()) {
         foreach ($config->toolbar as $toolbarDescription) {
             $toolbarName = (string) $toolbarDescription['name'] ? (string) $toolbarDescription['name'] : self::TB_PREFIX . $this->getName();
             $toolbar = new Toolbar($toolbarName);
             $toolbar->attachToComponent($this);
             $toolbar->loadXML($toolbarDescription);
             $toolbar->translate();
             $result[$toolbarName] = $toolbar;
         }
     }
     return $result;
 }