コード例 #1
0
 private function prepare()
 {
     $model = $this->em->reflection("program");
     $this->template->programs = $model->getProgramByContentId($this->content->id);
     $this->template->content = $this->content;
     $this->template->mainImage = $this->mainImage();
 }
コード例 #2
0
 public function createComponentProgramHighlightBlock()
 {
     $sectionId = $this->context->getParameters()['sectionId'];
     $programModel = $this->entityModel->reflection('Program');
     $highlightFacade = new Model\Facade\ProgramHighlightFacade($this->entityModel, $programModel);
     $control = new ProgramHighlightBlockControl($highlightFacade, $sectionId);
     return $control;
 }
コード例 #3
0
 public function actionExport()
 {
     $sectionId = $this->context->getParameters()['sectionId'];
     $connector = new NatsuConnector($this->entityModel->reflection('Program'), $sectionId);
     $exporter = new CondroidExport($connector);
     $xml = $exporter->run($countPrograms);
     header('Content-type: text/xml');
     header('X-Programme-Count: ' . $countPrograms);
     echo $xml;
     exit;
 }
コード例 #4
0
ファイル: SignPresenter.php プロジェクト: bombush/NatsuCon
 /**
  * Forget form factory.
  * @return Nette\Application\UI\Form
  */
 protected function createComponentForgetForm()
 {
     $form = $this->factoryForget->create();
     $this->factoryForget->setManager($this->userManager);
     $emailModel = $this->entityModel->reflection("email");
     $emailModel->setTable("emailtemplate");
     $this->factoryForget->setEmailModel($emailModel);
     $form->onSuccess[] = function ($form) {
         $form->getPresenter()->flashMessage("Požadavek o změnu hesla odeslán na e-mail!");
         $form->getPresenter()->redirect('Sign:forget');
     };
     return $form;
 }
コード例 #5
0
 public function createComponentProgramGrid()
 {
     $programModel = $this->entityModel->reflection('Program');
     $programGrid = new ProgramGridControl($programModel);
     $programGrid->setProgramStart($this->context->getParameters()['programStart']);
     $programGrid->setProgramEnd($this->context->getParameters()['programEnd']);
     $programGrid->setSectionId($this->context->getParameters()['sectionId']);
     $programGrid->setCanUserPublish($this->canUserPublishProgram());
     return $programGrid;
 }
コード例 #6
0
ファイル: ContentPresenter.php プロジェクト: bombush/NatsuCon
 public function createComponentPermissionControl()
 {
     $this->factoryPermission->setContentId($this->contentId);
     $this->factoryPermission->setEm($this->entityModel);
     $pM = $this->entityModel->reflection("permission");
     $this->factoryPermission->setRoles($pM->getRoles());
     $this->factoryPermission->setContentPermission($pM->getPermissionById($this->permissionId));
     $form = $this->factoryPermission->create();
     $form->onSuccess[] = function ($form) {
         $form->getPresenter()->flashMessage("Uloženo");
         $form->getPresenter()->redirect('Content:permissions', $this->contentId);
     };
     return $form;
 }
コード例 #7
0
 protected function resolveAddAttachments(EntityModel $modelAttachment, array $actions, $contentId)
 {
     foreach ($actions as $uploadName) {
         $metaUploadName = $uploadName . '_meta';
         if (!isset($_POST[$metaUploadName]) || !is_array($_POST[$metaUploadName])) {
             throw new \Exception('Upload is missing meta inputs');
         }
         $meta = $_POST[$metaUploadName];
         $mime = $meta['mime'];
         $filename = $_POST[$uploadName . '_meta']['filename'];
         $thumbPrototypeB64 = $_POST[$uploadName . '_thumbPrototype'];
         $thumbPrototype = ImageBase64Upload::saveTmp($thumbPrototypeB64, 'thumbPrototype_' . $filename);
         $fullImageB64 = $_POST[$uploadName];
         //if headimage, use thumb prototype as full size image
         $fullImage = $mime == 'HEADIMAGE' ? ImageBase64Upload::saveTmp($thumbPrototypeB64, $filename) : ImageBase64Upload::saveTmp($fullImageB64, $filename);
         $row = ['contentId' => $contentId, 'file' => $fullImage];
         if ($mime == 'IMAGE') {
             $attachment = new ImageAttachment();
         } elseif ($mime == 'HEADIMAGE') {
             $attachment = new MainimageAttachment();
         } else {
             throw new \Exception('Unknown mime: ' . $mime);
         }
         $attachment->setRow(ArrayHash::from($row));
         $attachment->setThumbPrototypeFullPath($thumbPrototype->getFullTmpFilePath());
         $url = $attachment->create();
         $thumbPrototype->unlink();
         $attachmentData = ['contentId' => $contentId, 'mime' => $mime, 'title' => $filename, 'url' => $url];
         $modelAttachment->insert($attachmentData);
     }
 }