public function graphics() { if (!OW::getRequest()->isAjax()) { OW::getDocument()->getMasterPage()->getMenu(OW_Navigation::ADMIN_APPEARANCE)->getElement('sidebar_menu_item_themes_customize')->setActive(true); } $images = $this->themeService->findAllCssImages(); $assignArray = array(); /* @var $image BOL_ThemeImage */ foreach ($images as $image) { $assignArray[] = $this->imageObjToArray($image); } $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')); $cmp = OW::getClassInstance('ADMIN_CMP_UploadedFileList'); $this->initFloatbox(array('layout' => 'floatbox')); $this->addComponent('filelist', $cmp); 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(); } }
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(); } }