Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added labels for cmsmodules

  • Loading branch information...
commit 6e8d1814f256166955d6da6361777e5d89fd4db6 1 parent 3a6fcb8
@dicabrio authored
Showing with 126 additions and 653 deletions.
  1. +0 −51 application/modules/blog/blog.class.php
  2. +0 −135 application/modules/blog/blogarchivecmsmodule.class.php
  3. +0 −110 application/modules/blog/blogarchivepagemodule.class.php
  4. +0 −105 application/modules/blog/blogcontroller.class.php
  5. +0 −77 application/modules/blog/blogdataset.class.php
  6. +0 −48 application/modules/blog/textlinepagemodule.class.php
  7. +1 −1  application/modules/general/baseview.class.php
  8. +1 −1  application/modules/general/breadcrumb.class.php
  9. +44 −21 application/modules/imageupload/imageuploadcmsmodule.class.php
  10. +5 −2 application/modules/media/mediacontroller.class.php
  11. +7 −3 application/modules/page/pagecontroller.class.php
  12. +4 −2 application/modules/template/templatecontroller.class.php
  13. +1 −1  application/modules/text/textblockcmsmodule.class.php
  14. +45 −26 application/modules/text/textlinecmsmodule.class.php
  15. +2 −2 application/templates/contact/contactconfig.php
  16. +7 −7 application/templates/imageupload/imageuploadform.php
  17. +1 −2  application/templates/menu/menu.php
  18. +2 −2 application/templates/pricelist/pricelistfeed.php
  19. +3 −4 application/templates/text/textblock.php
  20. +3 −4 application/templates/text/textline.php
  21. +0 −49 lib/modules/general/menu.class.php
View
51 application/modules/blog/blog.class.php
@@ -1,51 +0,0 @@
-<?php
-/**
- * Description of Blog
- *
- * Every blog is in fact a page. This page is of a type: 'blog' :)
- *
- * @author robertcabri
- */
-class Blog extends Page {
-
- public function __construct($id = null) {
- parent::__construct($id);
-
- if ($id > 0) {
- $this->setAttr('type', 'blog');
- }
- }
-
- public static function findAll() {
-
- $blogs = parent::findAll('Page', parent::ALL, new Criteria("type=:type", array('type' => 'blog')));
- return $blogs;
-
- }
-
- public static function findActive($numberIncrement=10, $numberStart=0) {
-
- $numberIncrement = intval($numberIncrement);
- if ($numberIncrement == 0) {
- $numberIncrement = 10;
- }
-
- $now = date('Y-m-d H:i:s');
- $crit = new Criteria("type=:type
- AND active = :active
- AND publishtime < :time
- AND (expiretime = '0000-00-00 00:00:00' OR expiretime > :time)", array('type' => 'blog', 'active' => 1, 'time' => $now));
-
- return parent::findAll('Page', parent::ALL, $crit, 'created DESC', intval($numberStart).','.$numberIncrement);
- }
-
- public function countAllActive() {
-
- $now = date('Y-m-d H:i:s');
- return (int)parent::countBySql("SELECT COUNT(1) FROM `page` WHERE type=:type
- AND active = :active
- AND publishtime < :time
- AND (expiretime = '0000-00-00 00:00:00' OR expiretime > :time)", array('type' => 'blog', 'active' => 1, 'time' => $now));
- }
-
-}
View
135 application/modules/blog/blogarchivecmsmodule.class.php
@@ -1,135 +0,0 @@
-<?php
-
-class BlogarchiveCmsModule implements CmsModuleController {
-
- /**
- * @var PageModule
- */
- private $oPageModule;
-
- /**
- * @var PageText
- */
- private $oTextContent;
-
- /**
- * @var Form
- */
- private $form;
-
- /**
- *
- * @var FormMapper
- */
- private $mapper;
-
- /**
- *
- * @var Input
- */
- private $amountElement;
-
- private $amount;
-
- /**
- * construct the text line module
- *
- * @param string $sIdentifier
- * @param Page $oPage
- * @return void
- */
- public function __construct(PageModule $oMod, Form $form) {
-
- $this->oPageModule = $oMod;
- $this->form = $form;
- $this->htmlEditor = false;
-
- // load the data
- $this->load();
- $this->defineForm();
- }
-
- /**
- * Load the data for this module
- */
- private function load() {
-
- $this->oTextContent = PageText::getByPageModule($this->oPageModule);
- $values = explode(',', $this->oTextContent->getContent());
-
- if (!isset($values[1])) {
- $this->amount = 10;
- $this->templateFile = $this->templateFile = new TemplateFile();
- } else {
- $this->amount = $values[0];
- $this->templateFile = $this->templateFile = new TemplateFile($values[1]);
- }
-
- $module = current(Module::getForTemplates('blog'));
- $this->options = TemplateFile::findByModule($module);
- }
-
- private function defineForm() {
-
- $this->amountElement = new Input('text', $this->oPageModule->getIdentifier().'_amount', $this->amount);
-
- $this->selectElement = new Select($this->oPageModule->getIdentifier());
- $this->selectElement->setValue($this->templateFile->getID());
- $this->selectElement->addOption(0, Lang::get('general.choose'));
-
- foreach ($this->options as $templateOption) {
- $this->selectElement->addOption($templateOption->getID(), $templateOption->getTitle());
- }
- $this->form->addFormElement($this->amountElement->getName(), $this->amountElement);
- $this->form->addFormElement($this->selectElement->getName(), $this->selectElement);
- }
-
- /**
- * add form mapping
- *
- * @param FormMapper $mapper
- */
- public function addFormMapping(FormMapper $mapper) {
-
- $this->mapper = $mapper;
- $this->mapper->addFormElementToDomainEntityMapping($this->selectElement->getName(), "TemplateFile");
-
- }
-
- /**
- * (non-PHPdoc)
- * @see modules/Module#getEditor()
- */
- public function getEditor() {
-
- $view = new View(Conf::get('general.dir.templates').'/blog/blogcmsmodule.php');
- $view->assign('form', $this->form);
- $view->assign('identifier', $this->oPageModule->getIdentifier());
-
- return $view;
-
- }
-
- /**
- *
- * @param $oReq
- * @return boolean
- */
- public function handleData() {
-
- $sModIdentifier = $this->oPageModule->getIdentifier();
- $templateFile = $this->mapper->getModel($sModIdentifier);
- $amount = $this->mapper->getModel($sModIdentifier.'_amount');
-
- $this->oTextContent->setContent($amount.','.$templateFile->getID());
- $this->oTextContent->setPageModule($this->oPageModule);
- $this->oTextContent->save();
-
- }
-
- public function getIdentifier() {
-
- return $this->oPageModule->getIdentifier();
-
- }
-}
View
110 application/modules/blog/blogarchivepagemodule.class.php
@@ -1,110 +0,0 @@
-<?php
-
-class BlogarchivePageModule implements PageModuleController {
-
- /**
- * @var PageModule
- */
- private $pageModule;
- /**
- * @var Page
- */
- private $page;
- /**
- * @var Request
- */
- private $request;
- /**
- * @var PageModuleController
- */
- private $imageUploadModule;
- /**
- * @var PageModuleController
- */
- private $textBlockModule;
-
- /**
- *
- * @param PageModule $module
- * @param Page $oPage
- * @param Request $request
- * @return void
- */
- public function __construct(PageModule $module, Page $page, Request $request) {
-
- $this->pageModule = $module;
- $this->page = $page;
- $this->request = $request;
- }
-
- private function buildBlogArray(Page $blog) {
-
- $pageModule = $blog->getModule('subject');
- $pageTextSubject = PageText::getByPageModule($pageModule);
-
- $pageModule = $blog->getModule('summary');
- $pageTextSummary = PageText::getByPageModule($pageModule);
-
- return array('subject' => $pageTextSubject->getContent(), 'name' => $blog->getName(), 'summary' => $pageTextSummary->getContent());
-
- }
-
- /**
- * get contents for this module as a string or an object that has a __toString method implemented
- *
- * @return string
- */
- public function getContents() {
-
- $oTextContent = PageText::getByPageModule($this->pageModule);
- $formshizzle = explode(',', $oTextContent->getContent());
-
- $amountToStart = 0;
- $amountPerPage = intval($formshizzle[0]);
- $page = intval($this->request->get('page'));
-
- if ($page > 1) {
- $amountToStart = ($page * $amountPerPage) - $amountPerPage;
- } else {
- $page = 1;
- }
-
- $activeBlogs = Blog::findActive($amountPerPage, $amountToStart);
- $amountOfActiveBlogs = Blog::countAllActive();
-
- $blogArticlesForTemplate = array();
- foreach ($activeBlogs as $blog) {
- $blogArticlesForTemplate[] = $this->buildBlogArray($blog);
- }
-
- try {
-
- $tplFile = new TemplateFile($formshizzle[1]);
- $view = new View(Conf::get('upload.dir.templates').'/'.$tplFile->getFilename());
- $view->assign('wwwurl', Conf::get('general.url.www'));
- $view->assign('articles', $blogArticlesForTemplate);
-// $view->assign('pages', ceil($amountOfActiveBlogs / $amountPerPage));
-// $view->assign('page', $page);
-
- return $view;
- } catch (Exception $e) {
-
- $str = '<ul id="blogrecent">';
- foreach ($activeBlogs as $blog) {
- $str .= '<li><a href="'.$blog->getName().'">'.$blog->getTitle().'</a></li>';
- }
- $str .= '</ul>';
-
- return $str;
- }
- }
-
- /**
- * @return string
- */
- public function getIdentifier() {
-
- return '';
- }
-
-}
View
105 application/modules/blog/blogcontroller.class.php
@@ -1,105 +0,0 @@
-<?php
-
-/**
- * Description of BlogController
- *
- * @author robertcabri
- */
-class BlogController extends CmsController {
- //put your code here
- const C_CURRENT_FOLDER = 'currentPageFolder';
-
- public function __construct($method) {
- // we should check for permissions
- parent::__construct('blog/' . $method, Lang::get('blog.title'));
-
- $this->getSession()->set('pagesavedredirect', 'blog');
- }
-
- public function _index() {
-
- $blogItems = Blog::findAll();
-
- $actions = new Menu('actions');
- $actions->addItem(new MenuItem(Conf::get('general.cmsurl.www') . '/blog/editblog', Lang::get('blog.button.newblog')));
-
- $oPageDataSet = new PageDataSet();
- $oPageDataSet->setValues($blogItems);
-
- $oTable = new Table($oPageDataSet);
-
- $blogOverview = new View(Conf::get('general.dir.templates') . '/page/pageoverview.php');
- $blogOverview->assign('aErrors', array());
- $blogOverview->assign('sSucces', false);
- $blogOverview->assign('actions', $actions);
- $blogOverview->assign('oOverview', $oTable);
-
- $oBaseView = parent::getBaseView();
- $oBaseView->assign('oModule', $blogOverview);
-
- return $oBaseView->getContents();
- }
-
- /**
- *
- * edit an existing page
- * @return string
- */
- public function editblog() {
-
- $blogFolderNameSetting = Setting::getByName('blogfoldername');
-
- // get the folder for blog pages
- $folder = PageFolder::findByName($blogFolderNameSetting->getValue());
- if ($folder == null) {
- $folder = new PageFolder();
- $folder->update($blogFolderNameSetting->getValue(), '');
- $folder->hide();
- $folder->save();
- }
-
- // get the template for blog pages
- $blogTemplateIDSetting = Setting::getByName('blogtemplateid');
- $template = new TemplateFile($blogTemplateIDSetting->getValue());
-
- $blogID = Util::getUrlSegment(2);
- $blog = new Blog($blogID);
- $blog->setTemplate($template);
- $blog->setParent($folder);
-
- $this->getSession()->set('page', $blog);
-
- $this->_redirect('page/editpage/' . $blogID);
- }
-
- public function deletepage() {
-
- $aErrors = array();
- $data = parent::getConnection();
- $data->beginTransaction();
-
- try {
-
- $page = new Page(intval(Util::getUrlSegment(2)));
- $page->delete();
-
- $data->commit();
-
- $this->_redirect('blog');
- } catch (RecordException $e) {
-
- $this->session;
- $aErrors[] = 'blog.somthingwrong';
- $aErrors[] = $e->getMessage();
- }
-
-
- $data->rollBack();
- return $this->_index($aErrors);
- }
-
- public function _default() {
- return __CLASS__;
- }
-
-}
View
77 application/modules/blog/blogdataset.class.php
@@ -1,77 +0,0 @@
-<?php
-/**
- *
- *
- */
-class BlogDataSet extends AbstractTableDataSet {
-
- private $iRecordCount;
-
- public function __construct() {
-
- $this->iRecordCount = 0;
-
- $this->addColumn(0, '');
- $this->addColumn(1, 'title');
- $this->addColumn(2, 'actions');
-
- }
-
- private function constuctTitle($image, $title) {
- return '<img src="'.Conf::get('general.url.images').'/'.$image.'" alt="" />'.$title;
- }
-
- private function constructFolderLine(PageFolder $folder) {
-
- $folderid = $folder->getID();
- $sTitle = $this->constuctTitle('icon-folder.png', Html::getAnchor($folder->getName(), Conf::get('general.cmsurl.www').'/page/folder/'.$folder->getID()));
-
- $this->constructLine($folderid, $sTitle, array('editfolder', 'deletefolder'));
-
- }
-
- private function constructPageLine(Blog $blog) {
- $blogID = $blog->getID();
- $sTitle = $this->constuctTitle('icon-file.png', $blog->getPage()->getName());
-
- $this->constructLine($blogID, $sTitle, array('editblog', 'deleteblog'));
- }
-
- /**
- *
- * @param int $pid
- * @param string $title
- * @param array $actions
- */
- private function constructLine($pid, $title, $actions) {
-
- $this->setValueAt('', $this->iRecordCount, 0);
- $this->setValueAt($title, $this->iRecordCount, 1);
-
- $actionstring = "";
- foreach ($actions as $action) {
-
- $attributes = array('class' => 'button '.$action);
- if (in_array($action, array('deletepage','deletefolder'))) {
- $attributes['confirm'] = Lang::get('page.sure'.$action);
- }
-
- $actionstring .= Html::getAnchor( Lang::get('page.button.'.$action),
- Conf::get('general.cmsurl.www').'/page/'.$action.'/'.$pid,
- $attributes).'&nbsp;';
- }
-
- $this->setValueAt($actionstring, $this->iRecordCount, 2);
- }
-
- /**
- * @param array $aTemplateRecords
- */
- public function setValues($blogItems) {
-
- foreach ($blogItems as $blogItems) {
- $this->constructPageLine($blogItems);
- $this->iRecordCount++;
- }
- }
-}
View
48 application/modules/blog/textlinepagemodule.class.php
@@ -1,48 +0,0 @@
-<?php
-
-class TextlinePageModule implements PageModuleController {
-
- /**
- * @var PageModule
- */
- private $oPageModule;
-
- /**
- * @var PageText
- */
- private $oTextContent;
-
- /**
- * construct the text line module
- *
- * @param string $sIdentifier
- * @param Page $oPage
- * @return void
- */
- public function __construct(PageModule $oMod, Page $page, Request $request) {
-
- $this->oPageModule = $oMod;
- $this->load();
-
- }
-
- private function load() {
-
- $this->oTextContent = PageText::getByPageModule($this->oPageModule);
-
- }
-
- /**
- * @return string
- */
- public function getContents() {
-
- return $this->oTextContent->getContent();
-
- }
-
- public function getIdentifier() {
-
- return $this->oPageModule->getIdentifier();
- }
-}
View
2  application/modules/general/baseview.class.php
@@ -51,7 +51,7 @@ public function addStyle($sLink) {
* @param string $sKey
* @param Menu $oMenu
*/
- public function addMenu($sKey, Menu $oMenu) {
+ public function addMenu($sKey, ActionMenu $oMenu) {
$this->aMenus[$sKey] = $oMenu;
}
View
2  application/modules/general/breadcrumb.class.php
@@ -1,6 +1,6 @@
<?php
-class BreadCrumb extends Menu {
+class BreadCrumb extends ActionMenu {
public function __construct() {
parent::__construct('breadcrumb');
View
65 application/modules/imageupload/imageuploadcmsmodule.class.php
@@ -5,7 +5,7 @@ class ImageuploadCmsModule implements CmsModuleController {
/**
* @var PageModule
*/
- private $oPageModule;
+ private $pageModule;
/**
* @var Form
*/
@@ -21,7 +21,7 @@ class ImageuploadCmsModule implements CmsModuleController {
/**
* @var string
*/
- private $defaultImage;
+ private $defaultimage;
/**
* @var FormElement
*/
@@ -35,6 +35,12 @@ class ImageuploadCmsModule implements CmsModuleController {
* @var FormElement
*/
private $descriptionInputName;
+
+ /**
+ *
+ * @var string
+ */
+ private $label;
/**
* construct the imageupload module
@@ -48,7 +54,7 @@ class ImageuploadCmsModule implements CmsModuleController {
*/
public function __construct(PageModule $oMod, Form $form) {
- $this->oPageModule = $oMod;
+ $this->pageModule = $oMod;
$this->form = $form;
$this->load();
@@ -56,29 +62,34 @@ public function __construct(PageModule $oMod, Form $form) {
}
private function load() {
-
- $mediaItem = Relation::getSingle('pagemodule', 'media', $this->oPageModule);
+
+ $this->label = 'Imageupload : '.$this->pageModule->getIdentifier();
+ $this->defaultimage = Setting::getByName('defaultimage')->getValue();
+
+ $this->getParam('label');
+ $this->getParam('defaultimage');
+
+ $mediaItem = Relation::getSingle('pagemodule', 'media', $this->pageModule);
if ($mediaItem === null) {
$mediaItem = new Media();
- Relation::remove('pagemodule', 'media', $this->oPageModule);
+ Relation::remove('pagemodule', 'media', $this->pageModule);
}
$this->mediaItem = $mediaItem;
- $this->defaultImage = Setting::getByName('defaultimage')->getValue();
}
private function defineForm() {
// define upload field
- $this->fileInput = new Input('file', $this->oPageModule->getIdentifier());
+ $this->fileInput = new Input('file', $this->pageModule->getIdentifier());
$this->fileInputName = $this->fileInput->getName();
$this->form->addFormElement($this->fileInput);
// define description (alt text) field
- $this->titleInput = new Input("text", $this->oPageModule->getIdentifier() . "title", $this->mediaItem->getTitle());
+ $this->titleInput = new Input("text", $this->pageModule->getIdentifier() . "title", $this->mediaItem->getTitle());
$this->titleInputName = $this->titleInput->getName();
$this->form->addFormElement($this->titleInput);
- $this->descriptionInput = new TextArea($this->oPageModule->getIdentifier() . "description", $this->mediaItem->getDescription());
+ $this->descriptionInput = new TextArea($this->pageModule->getIdentifier() . "description", $this->mediaItem->getDescription());
$this->descriptionInputName = $this->descriptionInput->getName();
$this->form->addFormElement($this->descriptionInput);
}
@@ -97,8 +108,8 @@ public function addFormMapping(FormMapper $mapper) {
*/
public function getEditor() {
- $oView = new View(Conf::get('general.dir.templates') . '/imageupload/imageuploadform.php');
- $oView->form = $this->form;
+ $view = new View(Conf::get('general.dir.templates') . '/imageupload/imageuploadform.php');
+ $view->assign('form', $this->form);
$filename = false;
$alttext = false;
@@ -112,13 +123,18 @@ public function getEditor() {
}
}
- $oView->filename = $filename;
- $oView->alttext = $alttext;
- $oView->defaultimage = $this->getDefaultImage();
- $oView->sIdentifier = $this->oPageModule->getIdentifier();
+ $view->assign('filename', $filename);
+ $view->assign('alttext', $alttext);
+ $view->assign('defaultimage', $this->getDefaultImage());
+ $view->assign('identifier', $this->pageModule->getIdentifier());
+ $view->assign('label', $this->label);
+// $view->alttext = $alttext;
+// $view->defaultimage = $this->getDefaultImage();
+// $view->sIdentifier = $this->pageModule->getIdentifier();
+// $view->label = $this->label;
- return $oView;
+ return $view;
}
/**
@@ -128,7 +144,7 @@ public function getEditor() {
public function handleData() {
// when overhere... there shouldn't be any errors from the form
- $sModIdentifier = $this->oPageModule->getIdentifier();
+ $sModIdentifier = $this->pageModule->getIdentifier();
$title = $this->mapper->getModel($sModIdentifier . "title");
$description = $this->mapper->getModel($sModIdentifier . "description");
@@ -148,7 +164,7 @@ public function handleData() {
$this->mediaItem->save();
if ($new) {
- Relation::add('pagemodule', 'media', $this->oPageModule, $this->mediaItem);
+ Relation::add('pagemodule', 'media', $this->pageModule, $this->mediaItem);
}
}
}
@@ -159,7 +175,7 @@ public function handleData() {
*/
public function getIdentifier() {
- return $this->oPageModule->getIdentifier();
+ return $this->pageModule->getIdentifier();
}
/**
@@ -168,7 +184,14 @@ public function getIdentifier() {
*/
protected function getDefaultImage() {
- return $this->defaultImage;
+ return $this->defaultimage;
+ }
+
+ private function getParam($name) {
+ $value = $this->pageModule->getParameter($name);
+ if ($value !== null) {
+ $this->{$name} = $value;
+ }
}
}
View
7 application/modules/media/mediacontroller.class.php
@@ -10,11 +10,14 @@ public function __construct($sMethod) {
}
- public function _index($aErrors = array(), $iParentID=0) {
+ public function _index() {
+
+ $aErrors = array();
+ $iParentID = 0;
$media = Media::find();
- $actions = new Menu('actions');
+ $actions = new ActionMenu('actions');
$actions->addItem(new MenuItem(Conf::get('general.cmsurl.www').'/media/editmedia', Lang::get('media.button.newitem')));
$tableDataSet = new MediaDataSet();
View
10 application/modules/page/pagecontroller.class.php
@@ -36,7 +36,11 @@ public function folder($sId='') {
return $this->_index(array(), $iItemID);
}
- public function _index($aErrors = array(), $iParentID=0, $sSuccess = false) {
+ public function _index() {
+
+ $aErrors = array();
+ $iParentID = 0;
+ $sSuccess = '';
$session = $this->getSession();
$session->set(self::C_CURRENT_FOLDER, $iParentID);
@@ -44,7 +48,7 @@ public function _index($aErrors = array(), $iParentID=0, $sSuccess = false) {
$folder = new PageFolder($iParentID);
$stuff = $folder->getChildren();
- $actions = new Menu('actions');
+ $actions = new ActionMenu('actions');
$actions->addItem(new MenuItem(Conf::get('general.cmsurl.www') . '/page/editpage', Lang::get('page.button.newpage')));
// $actions->addItem(new MenuItem(Conf::get('general.cmsurl.www').'/page/editfolder', Lang::get('page.button.newfolder')));
@@ -133,7 +137,7 @@ public function editpage() {
$button = new ActionButton(Lang::get('general.button.save'));
$button->addAttribute('class', 'save button');
- $this->form->addSubmitButton($button, new PageSaveHandler($this->formMapper, $page));
+ $this->form->addSubmitButton($button, new PageSaveHandler($this->formMapper, $page, $pageEditView));
$this->form->listen($oReq);
$view = $pageEditView->getView();
View
6 application/modules/template/templatecontroller.class.php
@@ -26,7 +26,9 @@ public function folder($sId='') {
* @param int $iParentID
* @return string
*/
- public function _index($aErrors = array(), $iParentID = 0) {
+ public function _index() {
+ $aErrors = array();
+ $iParentID = 0;
$session = Session::getInstance();
$session->set(self::C_CURRENT_FOLDER, $iParentID);
@@ -34,7 +36,7 @@ public function _index($aErrors = array(), $iParentID = 0) {
$parentFolder = new TemplateFileFolder($iParentID);
$aItems = $parentFolder->getChildren();
- $actions = new Menu('actions');
+ $actions = new ActionMenu('actions');
$actions->addItem(new MenuItem(Conf::get('general.cmsurl.www').'/template/edittemplate', Lang::get('template.button.newfile')));
$actions->addItem(new MenuItem(Conf::get('general.cmsurl.www').'/template/editfolder', Lang::get('template.button.newfolder')));
View
2  application/modules/text/textblockcmsmodule.class.php
@@ -107,7 +107,7 @@ protected function enableHtmlEditor() {
public function getEditor() {
$view = new View(Conf::get('general.dir.templates').'/text/textblock.php');
- $view->assign('sIdentifier', $this->pageModule->getIdentifier());
+ $view->assign('identifier', $this->pageModule->getIdentifier());
$view->assign('form', $this->form);
$view->assign('htmlEditor', $this->htmlEditor);
$view->assign('label', $this->label);
View
71 application/modules/text/textlinecmsmodule.class.php
@@ -7,12 +7,12 @@ class TextlineCmsModule implements CmsModuleController {
/**
* @var PageModule
*/
- private $oPageModule;
+ private $pageModule;
/**
* @var PageText
*/
- private $oTextContent;
+ private $textContent;
/**
* @var Form
@@ -24,21 +24,25 @@ class TextlineCmsModule implements CmsModuleController {
*/
private $mapper;
- private $contentFormElement;
+ /**
+ *
+ * @var int
+ */
+ private $maxlength;
/**
* construct the imageupload module
*
- * @param PageModule $oMod
+ * @param PageModule $module
* @param Form $form
* @param FormMapper $mapper
* @param CmsController $oCmsController
*
* @return void
*/
- public function __construct(PageModule $oMod, Form $form) {
+ public function __construct(PageModule $module, Form $form) {
- $this->oPageModule = $oMod;
+ $this->pageModule = $module;
$this->form = $form;
// load the data
@@ -46,11 +50,16 @@ public function __construct(PageModule $oMod, Form $form) {
}
private function load() {
-
- $this->oTextContent = PageText::getByPageModule($this->oPageModule);
- $this->contentFormElement = new Input('text', $this->oPageModule->getIdentifier(), $this->oTextContent->getContent());
- $this->form->addFormElement($this->contentFormElement);
+ $this->maxlength = 255;
+ $this->label = 'Text Line : '.$this->pageModule->getIdentifier();
+
+ $this->getParam('maxlength');
+ $this->getParam('label');
+
+ $this->textContent = PageText::getByPageModule($this->pageModule);
+
+ $this->form->addFormElement(new Input('text', $this->pageModule->getIdentifier(), $this->textContent->getContent()));
}
@@ -69,29 +78,28 @@ public function addFormMapping(FormMapper $mapper) {
*/
public function getEditor() {
- $oView = new View(Conf::get('general.dir.templates').'/text/textline.php');
- $oView->sMaxLength = self::MAX_LENGTH;
- $oView->sIdentifier = $this->oPageModule->getIdentifier();
- $oView->form = $this->form;
+ $view = new View(Conf::get('general.dir.templates').'/text/textline.php');
+ $view->assign('maxlength', $this->maxlength);
+ $view->assign('identifier', $this->pageModule->getIdentifier());
+ $view->assign('form', $this->form);
+ $view->assign('label', $this->label);
- return $oView;
+ return $view;
}
/**
- *
- * @param $oReq
- * @return boolean
+ * @todo substract the additional information when exceeds maxlength
+ *
*/
public function handleData() {
+
+ $modIdentifier = $this->pageModule->getIdentifier();
+ $text = $this->mapper->getModel($modIdentifier);
- $sModIdentifier = $this->oPageModule->getIdentifier();
- $text = $this->mapper->getModel($sModIdentifier);
-
- $this->oTextContent->setContent($text);
- $this->oTextContent->setPageModule($this->oPageModule);
- $this->oTextContent->save();
+ $this->textContent->setContent($text);
+ $this->textContent->setPageModule($this->pageModule);
+ $this->textContent->save();
- return true;
}
/**
@@ -100,6 +108,17 @@ public function handleData() {
*/
public function getIdentifier() {
- return $this->oPageModule->getIdentifier();
+ return $this->pageModule->getIdentifier();
+ }
+
+ /**
+ *
+ * @param string $name
+ */
+ private function getParam($name) {
+ $value = $this->pageModule->getParameter($name);
+ if ($value !== null) {
+ $this->{$name} = $value;
+ }
}
}
View
4 application/templates/contact/contactconfig.php
@@ -1,13 +1,13 @@
<div class="pagemodule">
<div class="modulelabel">
<h2>Contact</h2>
- <p>id: <?php echo $sIdentifier; ?></p>
+ <p>id: <?php echo $identifier; ?></p>
</div>
<div class="modulecontent">
<table>
<tr>
<td>Ontvangst email:&nbsp;&nbsp; </td>
- <td><?php echo $form->getFormElementByName($sIdentifier); ?></td>
+ <td><?php echo $form->getFormElementByName($identifier); ?></td>
</tr>
<tr>
<td>Bedanktpagina:&nbsp;&nbsp;</td>
View
14 application/templates/imageupload/imageuploadform.php
@@ -1,7 +1,7 @@
-<div class="pagemodule <?php echo $sIdentifier; ?>">
+<div class="pagemodule <?php echo $identifier; ?>">
<div class="modulelabel">
<h2><?php echo Lang::get('imageupload.title'); ?></h2>
- <p>id: <?php echo $sIdentifier; ?><p>
+ <p>id: <?php echo $identifier; ?><p>
</div>
<div class="modulecontent">
<?php if ($filename) : ?>
@@ -21,12 +21,12 @@
<br />
<br />
</p>
- <?php echo $form->getFormElement($sIdentifier); ?><br /><br />
- <label style="width: 100px; float: left;" for="<?php echo $sIdentifier."title"; ?>"><?php echo Lang::get('imageupload.alttext'); ?></label>
- <?php echo $form->getFormElement($sIdentifier."title")->addAttribute('style', 'width: 230px; margin: 0 0 5px 0;'); ?>
+ <?php echo $form->getFormElement($identifier); ?><br /><br />
+ <label style="width: 100px; float: left;" for="<?php echo $identifier."title"; ?>"><?php echo Lang::get('imageupload.alttext'); ?></label>
+ <?php echo $form->getFormElement($identifier."title")->addAttribute('style', 'width: 230px; margin: 0 0 5px 0;'); ?>
<?php if (isset($extended) && $extended == true) : ?>
- <label style="width: 100px; float: left;" for="<?php echo $sIdentifier."description"; ?>"><?php echo Lang::get('imageupload.description'); ?></label>
- <?php echo $form->getFormElement($sIdentifier."description")->addAttribute('style', 'width: 230px;'); ?>
+ <label style="width: 100px; float: left;" for="<?php echo $identifier."description"; ?>"><?php echo Lang::get('imageupload.description'); ?></label>
+ <?php echo $form->getFormElement($identifier."description")->addAttribute('style', 'width: 230px;'); ?>
<?php endif; ?>
</div>
View
3  application/templates/menu/menu.php
@@ -1,5 +1,4 @@
-
-<ul id="<?php echo $sIdentifier; ?>">
+<ul id="<?php echo $identifier; ?>">
<?php foreach ($menuItems as $oMenuItem) : ?>
<?php if ($oMenuItem->getIdentifier() == null) : ?><li><?php else: ?><li class="<?php echo $oMenuItem->getIdentifier(); ?>"><?php endif; ?>
<?php if ($oMenuItem->getLink() !== false) : ?><a href="<?php echo $oMenuItem->getLink(); ?>"><?php echo $oMenuItem->getLabel(); ?></a><?php else : ?><?php echo $oMenuItem->getLabel(); ?><?php endif; ?>
View
4 application/templates/pricelist/pricelistfeed.php
@@ -1,7 +1,7 @@
<div class="modulelabel">
<h2><?php echo Lang::get('pricelist.title'); ?></h2>
- <p>id: <?php echo $sIdentifier; ?> </p>
+ <p>id: <?php echo $identifier; ?> </p>
</div>
<div class="modulecontent">
- <?php echo $form->getFormElement($sIdentifier)->addAttribute('maxlenght', $sMaxLength); ?>
+ <?php echo $form->getFormElement($identifier)->addAttribute('maxlenght', $sMaxLength); ?>
</div>
View
7 application/templates/text/textblock.php
@@ -14,17 +14,16 @@
}
?>
-<div class="pagemodule <?php echo $sIdentifier; ?>">
+<div class="pagemodule <?php echo $identifier; ?>">
<div class="modulelabel">
- <h2><?php echo Lang::get('textblock.title'); ?></h2>
- <p>id: <?php echo $sIdentifier; ?><p>
+ <h2><?php echo $label; ?></h2>
</div>
<?php if (isset($htmlEditor) && $htmlEditor == true) : ?>
<div class="modulecontent yui-skin-sam">
<?php else : ?>
<div class="modulecontent">
<?php endif; ?>
- <?php echo $form->getFormElement($sIdentifier)->addAttribute('class', 'moduletextblock '.$sIdentifier)->addAttribute('rows', 50)->addAttribute('cols', 50); ?>
+ <?php echo $form->getFormElement($identifier)->addAttribute('class', 'moduletextblock '.$identifier)->addAttribute('rows', 50)->addAttribute('cols', 50); ?>
</div>
<div class="clear">&nbsp;</div>
</div>
View
7 application/templates/text/textline.php
@@ -1,10 +1,9 @@
-<div class="pagemodule <?php echo $sIdentifier; ?>">
+<div class="pagemodule <?php echo $identifier; ?>">
<div class="modulelabel">
- <h2><?php echo Lang::get('textline.title'); ?></h2>
- <p>id: <?php echo $sIdentifier; ?> </p>
+ <h2><?php echo $label; ?></h2>
</div>
<div class="modulecontent">
- <?php echo $form->getFormElement($sIdentifier)->addAttribute('maxlenght', $sMaxLength); ?>
+ <?php echo $form->getFormElement($identifier)->addAttribute('maxlenght', $maxlength); ?>
</div>
<div class="clear">&nbsp;</div>
</div>
View
49 lib/modules/general/menu.class.php
@@ -1,49 +0,0 @@
-<?php
-
-class Menu {
-
- /**
- * @var array
- */
- private $menuitems = array();
- /**
- * @var View
- */
- private $oView;
-
- /**
- * Enter description here...
- *
- * @param string $sIdentifier
- * @param string $sTemplateFilename
- */
- public function __construct($sIdentifier, $sTemplateFilename='') {
- $this->oView = new View(Conf::get('general.dir.templates').'/menu/menu.php');
- $this->oView->assign('sIdentifier', $sIdentifier);
- }
-
- /**
- * @param MenuItem $oItem
- */
- public function addItem(MenuItem $oItem) {
- $this->menuitems[] = $oItem;
- }
-
- /**
- * @return string
- */
- public function getContents() {
-
- $this->oView->assign('menuItems', $this->menuitems);
- return $this->oView->getContents();
- }
-
- public function __toString() {
- try {
- return $this->getContents();
- } catch (Exception $e) {
- return $e->getMessage();
- }
- }
-
-}
Please sign in to comment.
Something went wrong with that request. Please try again.