protected function createComponentForm()
 {
     $comp = $this->listingFormFactory->create();
     $monthNumber = $this->listing->getMonth();
     $comp['month']->setItems([$monthNumber => TimeUtils::getMonthName($monthNumber)]);
     $comp['year']->setItems([$this->listing->getYear() => $this->listing->getYear()]);
     $comp['save']->caption = 'Vytvořit kopii';
     $comp->onSuccess[] = [$this, 'processForm'];
     return $comp;
 }
예제 #2
0
 public function actionSearch($id)
 {
     $this->listing = $this->getEntireListingByID($id);
     $listings = $this->listingFacade->findPartialListingsDataForSelect($this->listing->year, $this->listing->month);
     unset($listings[$this->listing->listingID]);
     if (empty($listings)) {
         $this->flashMessage('Váš účet neobsahuje další výčetky za ' . TimeUtils::getMonthName($this->listing->month) . ' ' . $this->listing->year . ' a proto není možné
             využít Vámi požadovanou funkcionalitu.', 'warning');
         $this->redirect('Listing:detail', ['id' => $this->listing->listingID]);
     }
     $this->listings = $listings;
 }
예제 #3
0
 public function actionSearch($id)
 {
     $this->listingResult = $this->getListingByID($id);
     $listing = $this->listingResult->getListing();
     $listings = $this->listingsFacade->findListingsToMerge($listing->getUser(), $listing->getYear(), $listing->getMonth());
     unset($listings[$listing->getId()]);
     if (empty($listings)) {
         $this->flashMessage('Váš účet neobsahuje další výčetky za ' . TimeUtils::getMonthName($listing->getMonth()) . ' ' . $listing->getYear() . ' a proto není možné
             využít Vámi požadovanou funkcionalitu.', 'warning');
         $this->redirect('Listing:detail', ['id' => $listing->getId()]);
     }
     $this->listings = $this->prepareListingsForSearchSelect($listings);
 }
 public function processForm(Form $form, $values)
 {
     if ($this->listing === null) {
         $this->listing = new Listing($values['year'], $values['month'], $this->owner);
     }
     $this->listing->description = $values['description'];
     $this->listing->hourlyWage = $values['hourlyWage'];
     $this->listingFacade->saveListing($this->listing);
     $this->presenter->flashMessage('Výčetka pro ' . TimeUtils::getMonthName($values['month']) . ' ' . $values['year'] . ' byla uložena.', 'success');
     if (isset($this->presenter->backlink)) {
         $this->presenter->restoreRequest($this->presenter->backlink);
     }
     $this->presenter->redirect('Listing:overview', array('month' => $values['month'], 'year' => $values['year']));
 }
예제 #5
0
 /**
  * @return string
  */
 public function entireDescription()
 {
     $desc = TimeUtils::getMonthName($this->month) . ' ' . $this->year;
     if (isset($this->description)) {
         $desc .= ' - ' . $this->description;
     }
     /* else {
            $desc .= ' - Bez popisu';
        }*/
     return $desc;
 }
예제 #6
0
 public function monthNameByNumber($number)
 {
     return TimeUtils::getMonthName($number);
 }
예제 #7
0
 public function getPdfTitle()
 {
     // {listingId}i-{monthName}-{year}[-{description}]
     $description = $this->listingPdfDataAdapter->getListingDescription() != '' ? '-' . Strings::webalize($this->listingPdfDataAdapter->getListingDescription()) : null;
     return Strings::webalize($this->listingPdfDataAdapter->getListingId() . 'i-' . TimeUtils::getMonthName($this->listingPdfDataAdapter->getListingMonth()) . '-' . $this->listingPdfDataAdapter->getListingYear()) . $description;
 }
 public function getNotificationMessage(Listing $newListing, User $sender)
 {
     $period = TimeUtils::getMonthName($newListing->month) . ' ' . $newListing->year;
     $m = new SentMessage($this->constructSubject($sender->username, $period), $this->constructMessage($sender->username, $newListing->getUser()->username, $period, $this->linkGenerator->link('Front:Listing:detail', ['id' => $newListing->getId()])), $sender);
     return $m;
 }
예제 #9
0
 public function actionCopy($id)
 {
     $this->listing = $this->getListingByID($id);
     $this['simpleCopyForm']['month']->setDefaultValue(TimeUtils::getMonthName($this->listing->month));
     $this['simpleCopyForm']['year']->setDefaultValue($this->listing->year);
     $this['simpleCopyForm']['description']->setDefaultValue($this->listing->description == null ? 'Popis nebyl zadán' : $this->listing->description);
 }
예제 #10
0
 public function getNotificationMessage(Listing $listing, $senderName, $recipientName)
 {
     $period = TimeUtils::getMonthName($listing->month) . ' ' . $listing->year;
     $m = new Message($this->constructSubject($senderName, $period), $this->constructMessage($senderName, $recipientName, $period, $this->linkGenerator->link('Front:Listing:detail', ['id' => $listing->listingID])), 0);
     return $m;
 }