Exemplo n.º 1
0
 /**
  * getPagesByCategory
  * @author Cornelius Hansjakob <*****@*****.**>
  * @version 1.0
  */
 public function getPagesByCategory()
 {
     try {
         $this->getModelPages();
         $intCategoryId = $this->objGenericData->Setup()->getField('top_category')->getValue();
         $intLabelId = $this->objGenericData->Setup()->getField('top_label')->getValue();
         $intLimitNumber = $this->objGenericData->Setup()->getField('top_number')->getValue();
         $intSortType = $this->objGenericData->Setup()->getField('top_sorttype')->getValue();
         $intSortOrder = $this->objGenericData->Setup()->getField('top_sortorder')->getValue();
         $objPages = $this->objModelPages->loadsByCategory($this->intRootLevelId, $intCategoryId, $intLabelId, $intLimitNumber, $intSortType, $intSortOrder);
         return $objPages;
     } catch (Exception $exc) {
         $this->core->logger->err($exc);
     }
 }
 /**
  * addFolderStartGlobal
  * @param array $arrArgs
  * @return boolean
  * @author Thomas Schedler <*****@*****.**>
  * @version 1.0
  */
 private function addFolderStartGlobal($arrArgs)
 {
     try {
         if (array_key_exists('GenericSetup', $arrArgs) && $arrArgs['GenericSetup'] instanceof GenericSetup) {
             $objGenericSetup = $arrArgs['GenericSetup'];
             $strGlobalType = $this->strRootLevelGroupKey . '_overview';
             $intTemplateId = $this->core->sysConfig->global_types->{$strGlobalType}->default_templateId;
             $objTemplateData = $this->getModelTemplates()->loadTemplateById($intTemplateId);
             if (count($objTemplateData) == 1) {
                 $objTemplate = $objTemplateData->current();
                 /**
                  * set form id from template
                  */
                 $strFormId = $objTemplate->genericFormId;
                 $intFormVersion = $objTemplate->version;
                 $intFormTypeId = $objTemplate->formTypeId;
             } else {
                 throw new Exception('Not able to create a generic data object, because there is no form id!');
             }
             $objGenericData = new GenericData();
             $objGenericData->Setup()->setFormId($strFormId);
             $objGenericData->Setup()->setFormVersion($intFormVersion);
             $objGenericData->Setup()->setFormTypeId($intFormTypeId);
             $objGenericData->Setup()->setTemplateId($intTemplateId);
             $objGenericData->Setup()->setActionType($this->core->sysConfig->generic->actions->add);
             $objGenericData->Setup()->setLanguageId($arrArgs['LanguageId']);
             $objGenericData->Setup()->setFormLanguageId($this->core->intZooluLanguageId);
             $objGenericData->Setup()->setParentId($arrArgs['ParentId']);
             $objGenericData->Setup()->setRootLevelId($objGenericSetup->getRootLevelId());
             $objGenericData->Setup()->setRootLevelGroupId($this->intRootLevelGroupId);
             $objGenericData->Setup()->setElementTypeId($this->core->sysConfig->global_types->{$strGlobalType}->id);
             $objGenericData->Setup()->setCreatorId($objGenericSetup->getCreatorId());
             $objGenericData->Setup()->setStatusId($objGenericSetup->getStatusId());
             $objGenericData->Setup()->setShowInNavigation($objGenericSetup->getShowInNavigation());
             $objGenericData->Setup()->setModelSubPath('global/models/');
             $objGenericData->addFolderStartElement($objGenericSetup->getCoreField('title')->getValue());
             return true;
         } else {
             throw new Exception('There ist now GenericSetup in the args array!');
         }
     } catch (Exception $exc) {
         $this->core->logger->err($exc);
         return false;
     }
 }
 /**
  * changetemplateAction
  * @author Thomas Schedler <*****@*****.**>
  * @version 1.0
  */
 public function changetemplateAction()
 {
     $this->core->logger->debug('global->controllers->ElementController->changetemplateAction()');
     try {
         $objGenericData = new GenericData();
         $objGenericData->Setup()->setFormId($this->objRequest->getParam("formId"));
         $objGenericData->Setup()->setFormVersion($this->objRequest->getParam("formVersion"));
         $objGenericData->Setup()->setFormTypeId($this->objRequest->getParam("formTypeId"));
         $objGenericData->Setup()->setTemplateId($this->objRequest->getParam("templateId"));
         $objGenericData->Setup()->setElementId($this->objRequest->getParam("id"));
         $objGenericData->Setup()->setElementLinkId($this->objRequest->getParam("linkId", -1));
         $objGenericData->Setup()->setElementTypeId($this->objRequest->getParam("elementTypeId"));
         $objGenericData->Setup()->setParentTypeId($this->objRequest->getParam("parentTypeId"));
         $objGenericData->Setup()->setRootLevelId($this->objRequest->getParam("rootLevelId"));
         $objGenericData->Setup()->setRootLevelGroupId($this->objRequest->getParam("rootLevelGroupId"));
         $objGenericData->Setup()->setParentId($this->objRequest->getParam("parentFolderId"));
         $objGenericData->Setup()->setActionType($this->core->sysConfig->generic->actions->edit);
         $objGenericData->Setup()->setLanguageId($this->getItemLanguageId());
         $objGenericData->Setup()->setFormLanguageId($this->core->intZooluLanguageId);
         $objGenericData->Setup()->setModelSubPath('global/models/');
         /**
          * change Template
          */
         $objGenericData->changeTemplate($this->objRequest->getParam("newTemplateId"));
         $this->objRequest->setParam("formId", $objGenericData->Setup()->getFormId());
         $this->objRequest->setParam("templateId", $objGenericData->Setup()->getTemplateId());
         $this->objRequest->setParam("formVersion", $objGenericData->Setup()->getFormVersion());
         $this->getForm($this->core->sysConfig->generic->actions->edit);
         /**
          * load generic data
          */
         $this->objForm->setGenericSetup($objGenericData->Setup());
         $this->addGlobalSpecificFormElements();
         /**
          * set action
          */
         if (intval($this->objRequest->getParam('id')) > 0) {
             $this->objForm->setAction('/zoolu/global/element/edit');
         } else {
             $this->objForm->setAction('/zoolu/global/element/add');
         }
         /**
          * prepare form (add fields and region to the Zend_Form)
          */
         $this->objForm->prepareForm();
         /**
          * get form title
          */
         $this->view->formtitle = $this->objForm->Setup()->getFormTitle();
         /**
          * output of metainformation to hidden div
          */
         $this->setViewMetaInfos();
         $this->view->form = $this->objForm;
         $this->renderScript('element/form.phtml');
     } catch (Exception $exc) {
         $this->core->logger->err($exc);
         exit;
     }
 }
Exemplo n.º 4
0
 /**
  * getProvincesByCountry
  * @author Thomas Schedler <*****@*****.**>
  */
 public function getProvincesByCountry($strCountry)
 {
     try {
         $this->getModelLocations();
         $intUnitId = $this->objGenericData->Setup()->getField('entry_location')->getValue();
         $intTypeId = $this->objGenericData->Setup()->getField('entry_type')->getValue();
         $objProvinces = $this->objModelLocations->loadProvincesByCountry($strCountry, $intUnitId, $intTypeId);
         return $objProvinces;
     } catch (Exception $exc) {
         $this->core->logger->err($exc);
     }
 }
Exemplo n.º 5
0
 /**
  * changetemplateAction
  * @author Thomas Schedler <*****@*****.**>
  * @version 1.0
  */
 public function changetemplateAction()
 {
     $this->core->logger->debug('cms->controllers->PageController->changetemplateAction()');
     try {
         $objGenericData = new GenericData();
         $objGenericData->Setup()->setFormId($this->objRequest->getParam("formId"));
         $objGenericData->Setup()->setFormVersion($this->objRequest->getParam("formVersion"));
         $objGenericData->Setup()->setFormTypeId($this->objRequest->getParam("formTypeId"));
         $objGenericData->Setup()->setTemplateId($this->objRequest->getParam("templateId"));
         $objGenericData->Setup()->setElementId($this->objRequest->getParam("id"));
         $objGenericData->Setup()->setActionType($this->core->sysConfig->generic->actions->edit);
         $objGenericData->Setup()->setLanguageId($this->objRequest->getParam("languageId", $this->core->sysConfig->languages->default->id));
         $objGenericData->Setup()->setFormLanguageId(Zend_Auth::getInstance()->getIdentity()->languageId);
         $objGenericData->Setup()->setModelSubPath('cms/models/');
         /**
          * change Template
          */
         $objGenericData->changeTemplate($this->objRequest->getParam("newTemplateId"));
         $this->objRequest->setParam("formId", $objGenericData->Setup()->getFormId());
         $this->objRequest->setParam("templateId", $objGenericData->Setup()->getTemplateId());
         $this->objRequest->setParam("formVersion", $objGenericData->Setup()->getFormVersion());
         $this->getForm($this->core->sysConfig->generic->actions->edit);
         /**
          * load generic data
          */
         $this->objForm->setGenericSetup($objGenericData->Setup());
         $this->addPageSpecificFormElements();
         /**
          * set action
          */
         $this->objForm->setAction('/zoolu/cms/page/edit');
         /**
          * prepare form (add fields and region to the Zend_Form)
          */
         $this->objForm->prepareForm();
         /**
          * get form title
          */
         $this->view->formtitle = $this->objForm->Setup()->getFormTitle();
         /**
          * output of metainformation to hidden div
          */
         $this->setViewMetaInfos();
         $this->view->form = $this->objForm;
         $this->renderScript('page/form.phtml');
     } catch (Exception $exc) {
         $this->core->logger->err($exc);
         exit;
     }
 }
Exemplo n.º 6
0
 /**
  * addAction
  * @author Cornelius Hansjakob <*****@*****.**>
  * @version 1.0
  */
 public function addAction()
 {
     $this->core->logger->debug('core->controllers->FolderController->addAction()');
     $this->getForm($this->core->sysConfig->generic->actions->add);
     $this->addFolderSpecificFormElements();
     /**
      * set action
      */
     $this->objForm->setAction('/zoolu/core/folder/add');
     if ($this->objRequest->isPost() && $this->objRequest->isXmlHttpRequest()) {
         $arrFormData = $this->objRequest->getPost();
         $this->objForm->Setup()->setFieldValues($arrFormData);
         /**
          * prepare form (add fields and region to the Zend_Form)
          */
         $this->objForm->prepareForm();
         if ($this->objForm->isValid($arrFormData)) {
             /**
              * set action
              */
             $this->objForm->setAction('/zoolu/core/folder/edit');
             $intFolderId = $this->objForm->saveFormData();
             $this->objForm->Setup()->setElementId($intFolderId);
             $this->objForm->getElement('id')->setValue($intFolderId);
             $this->objForm->Setup()->setActionType($this->core->sysConfig->generic->actions->edit);
             $this->view->assign('blnShowFormAlert', true);
             /**
              * add defautl start page
              */
             if (array_key_exists("rootLevelTypeId", $arrFormData) && $arrFormData["rootLevelTypeId"] == $this->core->sysConfig->root_level_types->portals) {
                 $intTemplateId = $this->core->sysConfig->page_types->page->startpage_templateId;
                 $this->getModelTemplates();
                 $objTemplateData = $this->objModelTemplates->loadTemplateById($intTemplateId);
                 if (count($objTemplateData) == 1) {
                     $objTemplate = $objTemplateData->current();
                     /**
                      * set form id from template
                      */
                     $strFormId = $objTemplate->genericFormId;
                     $intFormVersion = $objTemplate->version;
                     $intFormTypeId = $objTemplate->formTypeId;
                 } else {
                     throw new Exception('Not able to create a generic data object, because there is no form id!');
                 }
                 $objGenericData = new GenericData();
                 $objGenericData->Setup()->setFormId($strFormId);
                 $objGenericData->Setup()->setFormVersion($intFormVersion);
                 $objGenericData->Setup()->setFormTypeId($intFormTypeId);
                 $objGenericData->Setup()->setTemplateId($intTemplateId);
                 $objGenericData->Setup()->setActionType($this->core->sysConfig->generic->actions->add);
                 $objGenericData->Setup()->setLanguageId($this->objRequest->getParam("languageId", $this->core->sysConfig->languages->default->id));
                 $objGenericData->Setup()->setFormLanguageId(Zend_Auth::getInstance()->getIdentity()->languageId);
                 $objGenericData->Setup()->setParentId($intFolderId);
                 $objGenericData->Setup()->setRootLevelId($this->objForm->Setup()->getRootLevelId());
                 $objGenericData->Setup()->setElementTypeId($this->core->sysConfig->page_types->page->id);
                 $objGenericData->Setup()->setCreatorId($this->objForm->Setup()->getCreatorId());
                 $objGenericData->Setup()->setStatusId($this->objForm->Setup()->getStatusId());
                 $objGenericData->Setup()->setShowInNavigation($this->objForm->Setup()->getShowInNavigation());
                 $objGenericData->Setup()->setModelSubPath('cms/models/');
                 $objGenericData->addStartPage($this->objForm->Setup()->getCoreField('title')->getValue());
                 $this->view->assign('selectNavigationItemNow', true);
                 $this->view->assign('itemId', 'folder' . $intFolderId);
             }
         } else {
             $this->view->assign('blnShowFormAlert', false);
         }
     } else {
         /**
          * prepare form (add fields and region to the Zend_Form)
          */
         $this->objForm->prepareForm();
     }
     /**
      * get form title
      */
     $this->view->formtitle = $this->objForm->Setup()->getFormTitle();
     /**
      * output of metainformation to hidden div
      */
     $this->setViewMetaInfos();
     $this->view->form = $this->objForm;
     $this->renderScript('folder/form.phtml');
 }