Ejemplo n.º 1
0
 private function prepareMarkup($photo, $layout = null)
 {
     $markup = array();
     $photo->title = UTIL_HtmlTag::autoLink($photo->title);
     $photo->url = OW::getStorage()->getFileUrl($this->themeService->getUserfileImagesDir() . $photo->getFilename());
     $photo->addDatetime = UTIL_DateTime::formatSimpleDate($photo->addDatetime, true);
     $markup['photo'] = $photo;
     $action = new BASE_ContextAction();
     $action->setKey('photo-moderate');
     $context = new BASE_CMP_ContextAction();
     $context->addAction($action);
     $lang = OW::getLanguage();
     $action = new BASE_ContextAction();
     $action->setKey('delete');
     $action->setParentKey('photo-moderate');
     $action->setLabel($lang->text('base', 'delete'));
     $action->setId('photo-delete');
     $action->addAttribute('rel', $photo->id);
     $context->addAction($action);
     $markup['contextAction'] = $context->render();
     $document = OW::getDocument();
     $onloadScript = $document->getOnloadScript();
     if (!empty($onloadScript)) {
         $markup['onloadScript'] = $onloadScript;
     }
     $scriptFiles = $document->getScripts();
     if (!empty($scriptFiles)) {
         $markup['scriptFiles'] = $scriptFiles;
     }
     $css = $document->getStyleDeclarations();
     if (!empty($css)) {
         $markup['css'] = $css;
     }
     $cssFiles = $document->getStyleSheets();
     if (!empty($cssFiles)) {
         $markup['cssFiles'] = $cssFiles;
     }
     $meta = $document->getMeta();
     if (!empty($meta)) {
         $markup['meta'] = $meta;
     }
     return $markup;
 }
Ejemplo n.º 2
0
 public function graphics()
 {
     $images = $this->themeService->findAllCssImages();
     $assignArray = array();
     /* @var $value BOL_ThemeImage */
     foreach ($images as $value) {
         $assignArray[] = array('url' => OW::getStorage()->getFileUrl($this->themeService->getUserfileImagesDir() . $value->getFilename()), 'delUrl' => OW::getRouter()->urlFor(__CLASS__, 'deleteImage', array('image-id' => $value->getId())), 'cssUrl' => $this->themeService->getUserfileImagesUrl() . $value->getFilename());
     }
     $this->assign('images', $assignArray);
     $form = new UploadGraphicsForm();
     $form->setEnctype(FORM::ENCTYPE_MULTYPART_FORMDATA);
     $this->addForm($form);
     $this->assign('confirmMessage', OW::getLanguage()->text('admin', 'theme_graphics_image_delete_confirm_message'));
     if (OW::getRequest()->isPost()) {
         try {
             $this->themeService->addImage($_FILES['file']);
         } catch (Exception $e) {
             OW::getFeedback()->error(OW::getLanguage()->text('admin', 'theme_graphics_upload_form_fail_message'));
             $this->redirect();
         }
         OW::getFeedback()->info(OW::getLanguage()->text('admin', 'theme_graphics_upload_form_success_message'));
         $this->redirect();
     }
 }