/**
  * getForm
  * @author Thomas Schedler <*****@*****.**>
  * @version 1.0
  */
 private function getForm($intActionType = null)
 {
     $this->core->logger->debug('properties->controllers->LocationController->getForm(' . $intActionType . ')');
     try {
         $objRequest = $this->getRequest();
         $strFormId = $objRequest->getParam("formId", $this->core->sysConfig->form->ids->locations->default);
         $intElementId = $objRequest->getParam("id") != '' ? $objRequest->getParam("id") : null;
         $objFormHandler = FormHandler::getInstance();
         $objFormHandler->setFormId($strFormId);
         $objFormHandler->setActionType($intActionType);
         $objFormHandler->setLanguageId(1);
         //TODO : get Language id
         $objFormHandler->setFormLanguageId($this->core->intZooluLanguageId);
         $objFormHandler->setElementId($intElementId);
         $this->objForm = $objFormHandler->getGenericForm();
         /**
          * add location & unit specific hidden fields
          */
         $this->objForm->addElement('hidden', 'rootLevelId', array('value' => $objRequest->getParam("rootLevelId"), 'decorators' => array('Hidden')));
         $this->objForm->addElement('hidden', 'parentId', array('value' => $objRequest->getParam("parentId"), 'decorators' => array('Hidden')));
         /**
          * add currlevel hidden field
          */
         $this->objForm->addElement('hidden', 'currLevel', array('value' => $objRequest->getParam("currLevel"), 'decorators' => array('Hidden'), 'ignore' => true));
     } catch (Exception $exc) {
         $this->core->logger->err($exc);
         exit;
     }
 }
 /**
  * getForm
  */
 private function getForm($intActionType = null)
 {
     $this->core->logger->debug('properties->controllers->CategoryController->getForm(' . $intActionType . ')');
     try {
         $strFormId = $this->objRequest->getParam("formId");
         $intElementId = $this->objRequest->getParam("id") != '' ? $this->objRequest->getParam("id") : null;
         $objFormHandler = FormHandler::getInstance();
         $objFormHandler->setFormId($strFormId);
         $objFormHandler->setActionType($intActionType);
         $objFormHandler->setLanguageId($this->objRequest->getParam("languageId", $this->core->sysConfig->languages->default->id));
         $objFormHandler->setFormLanguageId(Zend_Auth::getInstance()->getIdentity()->languageId);
         $objFormHandler->setElementId($intElementId);
         $this->objForm = $objFormHandler->getGenericForm();
         /**
          * add folder specific hidden fields
          */
         $this->objForm->addElement('hidden', 'rootLevelId', array('value' => $this->objRequest->getParam("rootLevelId"), 'decorators' => array('Hidden')));
         $this->objForm->addElement('hidden', 'parentId', array('value' => $this->objRequest->getParam("parentId"), 'decorators' => array('Hidden')));
         $this->objForm->addElement('hidden', 'categoryTypeId', array('value' => $this->objRequest->getParam("categoryTypeId"), 'decorators' => array('Hidden')));
         /**
          * add currlevel hidden field
          */
         $this->objForm->addElement('hidden', 'currLevel', array('value' => $this->objRequest->getParam("currLevel"), 'decorators' => array('Hidden'), 'ignore' => true));
     } catch (Exception $exc) {
         $this->core->logger->err($exc);
         exit;
     }
 }
Ejemplo n.º 3
0
 /**
  * setViewMetaInfos
  * @author Cornelius Hansjakob <*****@*****.**>
  * @version 1.0
  */
 private function setViewMetaInfos()
 {
     if (is_object($this->objForm) && $this->objForm instanceof GenericForm) {
         $arrSecurityCheck = array();
         if (!Security::get()->isAllowed(Security::RESOURCE_ROOT_LEVEL_PREFIX . $this->objForm->Setup()->getRootLevelId(), Security::PRIVILEGE_VIEW, false, false)) {
             $arrSecurityCheck = array('ResourceKey' => Security::RESOURCE_ROOT_LEVEL_PREFIX . $this->objForm->Setup()->getRootLevelId() . '_%d', 'Privilege' => Security::PRIVILEGE_VIEW, 'CheckForAllLanguages' => false, 'IfResourceNotExists' => false);
         }
         $blnGeneralDeleteAuthorization = Security::get()->isAllowed(Security::RESOURCE_ROOT_LEVEL_PREFIX . $this->objForm->Setup()->getRootLevelId(), Security::PRIVILEGE_DELETE, false, false);
         $blnGeneralUpdateAuthorization = Security::get()->isAllowed(Security::RESOURCE_ROOT_LEVEL_PREFIX . $this->objForm->Setup()->getRootLevelId(), Security::PRIVILEGE_UPDATE, false, false);
         $this->view->authorizedDelete = $this->objForm->Setup()->getIsStartElement(false) == true || $this->objForm->Setup()->getActionType() == $this->core->sysConfig->generic->actions->add ? false : ($blnGeneralDeleteAuthorization == true ? $blnGeneralDeleteAuthorization : Security::get()->isAllowed(Security::RESOURCE_ROOT_LEVEL_PREFIX . $this->objForm->Setup()->getRootLevelId() . '_' . $this->objForm->Setup()->getLanguageId(), Security::PRIVILEGE_DELETE, false, false));
         $this->view->authorizedUpdate = $blnGeneralUpdateAuthorization == true ? $blnGeneralUpdateAuthorization : Security::get()->isAllowed(Security::RESOURCE_ROOT_LEVEL_PREFIX . $this->objForm->Setup()->getRootLevelId() . '_' . $this->objForm->Setup()->getLanguageId(), Security::PRIVILEGE_UPDATE, false, false);
     }
 }
Ejemplo n.º 4
0
 /**
  * addFolderSpecificFormElements
  * @author Thomas Schedler <*****@*****.**>
  * @version 1.0
  */
 protected function addFolderSpecificFormElements()
 {
     if (is_object($this->objForm) && $this->objForm instanceof GenericForm) {
         /**
          * add folder specific hidden fields
          */
         $this->objForm->addElement('hidden', 'creator', array('value' => $this->objForm->Setup()->getCreatorId(), 'decorators' => array('Hidden')));
         $this->objForm->addElement('hidden', 'idStatus', array('value' => $this->objForm->Setup()->getStatusId(), 'decorators' => array('Hidden')));
         $this->objForm->addElement('hidden', 'rootLevelId', array('value' => $this->objForm->Setup()->getRootLevelId(), 'decorators' => array('Hidden')));
         $this->objForm->addElement('hidden', 'rootLevelTypeId', array('value' => $this->objForm->Setup()->getRootLevelTypeId(), 'decorators' => array('Hidden')));
         $this->objForm->addElement('hidden', 'parentFolderId', array('value' => $this->objForm->Setup()->getParentId(), 'decorators' => array('Hidden')));
         $this->objForm->addElement('hidden', 'isUrlFolder', array('value' => $this->objForm->Setup()->getUrlFolder(), 'decorators' => array('Hidden')));
         $this->objForm->addElement('hidden', 'showInNavigation', array('value' => $this->objForm->Setup()->getShowInNavigation(), 'decorators' => array('Hidden'), 'ignore' => true));
     }
 }
Ejemplo n.º 5
0
 /**
  * addPageSpecificFormElements
  * @author Thomas Schedler <*****@*****.**>
  * @version 1.0
  */
 protected function addPageSpecificFormElements()
 {
     if (is_object($this->objForm) && $this->objForm instanceof GenericForm) {
         /**
          * add page specific hidden fields
          */
         $this->objForm->addElement('hidden', 'creator', array('value' => $this->objForm->Setup()->getCreatorId(), 'decorators' => array('Hidden')));
         $this->objForm->addElement('hidden', 'idStatus', array('value' => $this->objForm->Setup()->getStatusId(), 'decorators' => array('Hidden')));
         $this->objForm->addElement('hidden', 'rootLevelId', array('value' => $this->objForm->Setup()->getRootLevelId(), 'decorators' => array('Hidden')));
         $this->objForm->addElement('hidden', 'rootLevelTypeId', array('value' => $this->objForm->Setup()->getRootLevelTypeId(), 'decorators' => array('Hidden')));
         $this->objForm->addElement('hidden', 'parentFolderId', array('value' => $this->objForm->Setup()->getParentId(), 'decorators' => array('Hidden')));
         $this->objForm->addElement('hidden', 'pageTypeId', array('value' => $this->objForm->Setup()->getElementTypeId(), 'decorators' => array('Hidden')));
         $this->objForm->addElement('hidden', 'isStartPage', array('value' => $this->objForm->Setup()->getIsStartElement(), 'decorators' => array('Hidden')));
         $this->objForm->addElement('hidden', 'publishDate', array('value' => $this->objForm->Setup()->getPublishDate('Y-m-d H:i:s'), 'decorators' => array('Hidden')));
         $this->objForm->addElement('hidden', 'showInNavigation', array('value' => $this->objForm->Setup()->getShowInNavigation(), 'decorators' => array('Hidden')));
         $this->objForm->addElement('hidden', 'parentTypeId', array('value' => $this->objForm->Setup()->getParentTypeId(), 'decorators' => array('Hidden')));
     }
 }
Ejemplo n.º 6
0
 /**
  * setViewMetaInfos
  * @author Daniel Rotter <*****@*****.**>
  * @version 1.0
  */
 private function setViewMetaInfos()
 {
     if (is_object($this->objForm) && $this->objForm instanceof GenericForm) {
         $this->view->version = $this->objForm->Setup()->getFormVersion();
         $this->view->publisher = $this->objForm->Setup()->getPublisherName();
         $this->view->changeUser = $this->objForm->Setup()->getChangeUserName();
         $this->view->publishDate = $this->objForm->Setup()->getPublishDate('d. M. Y, H:i');
         $this->view->changeDate = $this->objForm->Setup()->getChangeDate('d. M. Y, H:i');
         $this->view->statusOptions = HtmlOutput::getOptionsOfSQL($this->core, 'SELECT id AS VALUE, (SELECT statusTitles.title AS DISPLAY FROM statusTitles WHERE statusTitles.idStatus = status.id AND statusTitles.idLanguages = ' . $this->objForm->Setup()->getFormLanguageId() . ') AS DISPLAY FROM status', $this->objForm->Setup()->getStatusId());
         $this->view->creatorOptions = HtmlOutput::getOptionsOfSQL($this->core, 'SELECT id AS VALUE, CONCAT(fname, \' \', sname) AS DISPLAY FROM users', $this->objForm->Setup()->getCreatorId());
         $this->view->arrPublishDate = DateTimeHelper::getDateTimeArray($this->objForm->Setup()->getPublishDate());
         $this->view->monthOptions = DateTimeHelper::getOptionsMonth(false, $this->objForm->Setup()->getPublishDate('n'));
         $this->view->blnIsStartPage = $this->objForm->Setup()->getIsStartElement(false);
         if ($this->objForm->Setup()->getField('url')) {
             $this->view->pageurl = $this->objForm->Setup()->getField('url')->getValue();
         }
         if ($this->objForm->Setup()->getActionType() == $this->core->sysConfig->generic->actions->edit && $this->objForm->Setup()->getElementTypeId() != $this->core->sysConfig->page_types->link->id) {
             $this->view->languageOptions = HtmlOutput::getOptionsOfSQL($this->core, 'SELECT id AS VALUE, languageCode AS DISPLAY FROM languages', $this->objForm->Setup()->getFormLanguageId());
         }
     }
 }
Ejemplo n.º 7
0
 /**
  * getForm
  * @author Cornelius Hansjakob <*****@*****.**>
  * @version 1.0
  */
 private function getForm($intActionType = null)
 {
     $this->core->logger->debug('contacts->controllers->ContactController->getForm(' . $intActionType . ')');
     try {
         $objRequest = $this->getRequest();
         $strFormId = $objRequest->getParam("formId");
         $intElementId = $objRequest->getParam("id") != '' ? $objRequest->getParam("id") : null;
         /**
          * if there is no formId
          */
         if ($strFormId == '') {
             throw new Exception('Not able to create a form, because there is no form id!');
         }
         $objFormHandler = FormHandler::getInstance();
         $objFormHandler->setFormId($strFormId);
         $objFormHandler->setActionType($intActionType);
         $objFormHandler->setLanguageId($this->getItemLanguageId($intActionType));
         $objFormHandler->setFormLanguageId($this->core->intZooluLanguageId);
         $objFormHandler->setElementId($intElementId);
         $this->objForm = $objFormHandler->getGenericForm();
         /**
          * add contact & unit specific hidden fields
          */
         $this->objForm->addElement('hidden', 'rootLevelId', array('value' => $objRequest->getParam("rootLevelId"), 'decorators' => array('Hidden')));
         $this->objForm->addElement('hidden', 'parentId', array('value' => $objRequest->getParam("parentId"), 'decorators' => array('Hidden')));
         /**
          * add currlevel hidden field
          */
         $this->objForm->addElement('hidden', 'currLevel', array('value' => $objRequest->getParam("currLevel"), 'decorators' => array('Hidden'), 'ignore' => true));
         /**
          * add elementTye hidden field (folder, element, ...)
          */
         $this->objForm->addElement('hidden', 'elementType', array('value' => $this->objRequest->getParam("elementType"), 'decorators' => array('Hidden'), 'ignore' => true));
     } catch (Exception $exc) {
         $this->core->logger->err($exc);
         exit;
     }
 }
Ejemplo n.º 8
0
 /**
  * addGlobalSpecificFormElements
  * @author Thomas Schedler <*****@*****.**>
  * @version 1.0
  */
 protected function addGlobalSpecificFormElements()
 {
     if (is_object($this->objForm) && $this->objForm instanceof GenericForm) {
         /**
          * add element specific hidden fields
          */
         $this->objForm->addElement('hidden', 'creator', array('value' => $this->objForm->Setup()->getCreatorId(), 'decorators' => array('Hidden')));
         $this->objForm->addElement('hidden', 'idStatus', array('value' => $this->objForm->Setup()->getStatusId(), 'decorators' => array('Hidden')));
         $this->objForm->addElement('hidden', 'rootLevelId', array('value' => $this->objForm->Setup()->getRootLevelId(), 'decorators' => array('Hidden')));
         $this->objForm->addElement('hidden', 'rootLevelTypeId', array('value' => $this->objForm->Setup()->getRootLevelTypeId(), 'decorators' => array('Hidden')));
         $this->objForm->addElement('hidden', 'rootLevelGroupId', array('value' => $this->objForm->Setup()->getRootLevelGroupId(), 'decorators' => array('Hidden')));
         $this->objForm->addElement('hidden', 'parentFolderId', array('value' => $this->objForm->Setup()->getParentId(), 'decorators' => array('Hidden')));
         $this->objForm->addElement('hidden', 'elementTypeId', array('value' => $this->objForm->Setup()->getElementTypeId(), 'decorators' => array('Hidden')));
         $this->objForm->addElement('hidden', 'isStartGlobal', array('value' => $this->objForm->Setup()->getIsStartElement(), 'decorators' => array('Hidden')));
         $this->objForm->addElement('hidden', 'publishDate', array('value' => $this->objForm->Setup()->getPublishDate('Y-m-d H:i:s'), 'decorators' => array('Hidden')));
         $this->objForm->addElement('hidden', 'showInNavigation', array('value' => $this->objForm->Setup()->getShowInNavigation(), 'decorators' => array('Hidden')));
         $this->objForm->addElement('hidden', 'languageFallback', array('value' => $this->objForm->Setup()->getLanguageFallbackId(), 'decorators' => array('Hidden')));
         $this->objForm->addElement('hidden', 'parentTypeId', array('value' => $this->objForm->Setup()->getParentTypeId(), 'decorators' => array('Hidden')));
         /**
          * element link Id form the tree view
          */
         $this->objForm->addElement('hidden', 'linkId', array('value' => $this->objForm->Setup()->getElementLinkId(), 'decorators' => array('Hidden')));
     }
 }
/**
 * buildProdcutLanguageVariant
 */
function buildProdcutLanguageVariant($objProduct)
{
    global $objConsoleOpts, $core;
    // product form
    $objProductForm = new GenericForm();
    $objProductForm->Setup()->setElementId($objProduct->id);
    $objProductForm->Setup()->setElementLinkId($objProduct->linkGlobalId);
    $objProductForm->Setup()->setFormId($objProduct->genericFormId);
    $objProductForm->Setup()->setTemplateId($objProduct->templateId);
    $objProductForm->Setup()->setFormVersion($objProduct->version);
    $objProductForm->Setup()->setActionType($core->sysConfig->generic->actions->edit);
    $objProductForm->Setup()->setLanguageId($objConsoleOpts->fromLanguageId);
    $objProductForm->Setup()->setFormLanguageId($core->sysConfig->languages->default->id);
    $objProductForm->Setup()->setModelSubPath('global/models/');
    // load basic generic form
    $objProductForm->Setup()->loadGenericForm();
    // load generic form structur
    $objProductForm->Setup()->loadGenericFormStructure();
    // init data type object
    $objProductForm->initDataTypeObject();
    // load data
    $objProductForm->loadFormData();
    // set fallback language
    $objProductForm->Setup()->setLanguageFallbackId($objConsoleOpts->toLanguageId);
    // reset fields
    foreach ($objProductForm->Setup()->FieldNames() as $strField => $intType) {
        if ($strField != 'title' && $strField != 'internal_links_title' && $strField != 'internal_links' && $strField != 'category' && $strField != 'label') {
            $objProductForm->Setup()->getField($strField)->setValue(null);
        }
    }
    // reset multi regions
    foreach ($objProductForm->Setup()->MultiplyRegionIds() as $intRegionId) {
        $objProductForm->Setup()->getRegion($intRegionId)->resetRegionInstances();
    }
    // set new language
    $objProductForm->saveFormData();
}
/**
 * buildProdcutLanguageVariant
 */
function buildProdcutLanguageVariant($objProduct)
{
    global $objConsoleOpts, $core;
    // product form
    $objProductForm = new GenericForm();
    $objProductForm->Setup()->setElementId($objProduct->id);
    $objProductForm->Setup()->setElementLinkId($objProduct->linkGlobalId);
    $objProductForm->Setup()->setFormId($objProduct->genericFormId);
    $objProductForm->Setup()->setTemplateId($objProduct->templateId);
    $objProductForm->Setup()->setFormVersion($objProduct->version);
    $objProductForm->Setup()->setActionType($core->sysConfig->generic->actions->edit);
    $objProductForm->Setup()->setLanguageId($objConsoleOpts->fromLanguageId);
    $objProductForm->Setup()->setFormLanguageId($core->sysConfig->languages->default->id);
    $objProductForm->Setup()->setModelSubPath('global/models/');
    // load basic generic form
    $objProductForm->Setup()->loadGenericForm();
    // load generic form structur
    $objProductForm->Setup()->loadGenericFormStructure();
    // init data type object
    $objProductForm->initDataTypeObject();
    // load data
    $objProductForm->loadFormData();
    // set new language
    $objProductForm->Setup()->setLanguageId($objConsoleOpts->toLanguageId);
    //rest url
    if ($objProductForm->Setup()->getField('url')) {
        $objProductForm->Setup()->getField('url')->setValue('');
    }
    // set new language
    $objProductForm->saveFormData();
}
/**
 * buildProdcutLanguageVariant
 */
function buildProdcutUrl($objProduct)
{
    global $objConsoleOpts, $core;
    // product form
    $objProductForm = new GenericForm();
    $objProductForm->Setup()->setElementId($objProduct->id);
    $objProductForm->Setup()->setElementLinkId($objProduct->linkGlobalId);
    $objProductForm->Setup()->setFormId($objProduct->genericFormId);
    $objProductForm->Setup()->setTemplateId($objProduct->templateId);
    $objProductForm->Setup()->setFormVersion($objProduct->version);
    $objProductForm->Setup()->setActionType($core->sysConfig->generic->actions->edit);
    $objProductForm->Setup()->setLanguageId($objConsoleOpts->languageId);
    $objProductForm->Setup()->setFormLanguageId($core->sysConfig->languages->default->id);
    $objProductForm->Setup()->setModelSubPath('global/models/');
    // load basic generic form
    $objProductForm->Setup()->loadGenericForm();
    // load generic form structur
    $objProductForm->Setup()->loadGenericFormStructure();
    // init data type object
    $objProductForm->initDataTypeObject();
    // load data
    $objProductForm->loadFormData();
    // product url form
    $objProductUrlForm = new GenericForm();
    $objProductUrlForm->Setup()->setElementId($objProduct->id);
    $objProductUrlForm->Setup()->setElementLinkId($objProduct->linkGlobalId);
    $objProductUrlForm->Setup()->setFormId($objProduct->genericFormId);
    $objProductUrlForm->Setup()->setTemplateId($objProduct->templateId);
    $objProductUrlForm->Setup()->setFormVersion($objProduct->version);
    $objProductUrlForm->Setup()->setActionType($core->sysConfig->generic->actions->edit);
    $objProductUrlForm->Setup()->setLanguageId($objConsoleOpts->urlLanguageId);
    $objProductUrlForm->Setup()->setFormLanguageId($core->sysConfig->languages->default->id);
    $objProductUrlForm->Setup()->setModelSubPath('global/models/');
    // load basic generic form
    $objProductUrlForm->Setup()->loadGenericForm();
    // load generic form structur
    $objProductUrlForm->Setup()->loadGenericFormStructure();
    // init data type object
    $objProductUrlForm->initDataTypeObject();
    // load data
    $objProductUrlForm->loadFormData();
    //rest url
    if ($objProductForm->Setup()->getField('url') && $objProductUrlForm->Setup()->getField('title') && $objProductUrlForm->Setup()->getField('title')->getValue() != '') {
        $_POST['url_EditableUrl'] = trim($objProductUrlForm->Setup()->getField('title')->getValue(), ' _-+!?');
        $objProductForm->Setup()->getField('url')->save($objProduct->linkGlobalId, 'global');
        $objProductForm->Setup()->getField('url')->removeUrlHistory($objProduct->linkGlobalId, 'global');
    }
}
Ejemplo n.º 12
0
 /**
  * getGenericForm
  * @author Cornelius Hansjakob <*****@*****.**>
  * @version 1.1
  * @return GenericForm
  */
 public function getGenericForm()
 {
     try {
         //TODO : get Form from cache or create ??
         $objForm = new GenericForm();
         $objForm->Setup()->setFormId($this->strFormId);
         $objForm->Setup()->setTemplateId($this->intTemplateId);
         $objForm->Setup()->setFormVersion($this->intFormVersion);
         $objForm->Setup()->setActionType($this->intActionType);
         $objForm->Setup()->setLanguageId($this->intLanguageId);
         $objForm->Setup()->setFormLanguageId($this->intFormLanguageId);
         $objForm->Setup()->setElementId($this->intElementId);
         /**
          * load basic generic form
          */
         $objForm->Setup()->loadGenericForm();
         /**
          * load generic form structur
          */
         $objForm->Setup()->loadGenericFormStructure();
         /**
          * init data type object
          */
         $objForm->initDataTypeObject();
         return $objForm;
     } catch (Exception $exc) {
         $this->core->logger->err($exc);
     }
 }