Example #1
0
 private function createForm($sCreateLang)
 {
     $this->setTitle($this->t_("title", array('pagename' => $this->getPageName())));
     //primary lang for page creation
     $sDefaultLang = self::globalCfgLangDefault();
     $asAllLangs = self::globalCfgLangs();
     if (!in_array($sCreateLang, $asAllLangs)) {
         $sCreateLang = $sDefaultLang;
     }
     $asAvailableLangs = self::globalCfgLangs();
     foreach ($asAvailableLangs as $i => $sAvailableLang) {
         if (!AnwCurrentSession::isActionAllowed($this->getoPage()->getName(), 'create', $sAvailableLang)) {
             unset($asAvailableLangs[$i]);
         }
     }
     $this->out .= $this->tpl()->startForm($this->getPageName(), AnwUtils::link($this->getoPage(), "create"), $sCreateLang, $asAvailableLangs, AnwContentClasses::getContentClasses());
     foreach ($asAvailableLangs as $sAvailableLang) {
         if ($sAvailableLang != $sCreateLang) {
             //find default translation name
             $sPageNameDefault = AnwPage::buildTranslationNameDefault($this->getPageName(), $sCreateLang, $sAvailableLang);
             $sInputName = $this->getInputName($sAvailableLang);
             $sCheckBoxName = $this->getChkName($sAvailableLang);
             $this->out .= $this->tpl()->translationRow($sAvailableLang, $sPageNameDefault, $sCheckBoxName, $sInputName);
         } else {
             $this->out .= $this->tpl()->translationRowCurrent($sCreateLang, $this->getPageName());
         }
     }
     $this->out .= $this->tpl()->endForm(AnwUtils::link(self::globalCfgHomePage()));
 }
Example #2
0
 function init()
 {
     // feed title
     $oContentField = new AnwContentFieldPage_string(self::FIELD_TITLE);
     $oContentField->indexAs(self::PUB_TITLE);
     $this->addContentField($oContentField);
     // feed description
     $oContentField = new AnwContentFieldPage_xhtml(self::FIELD_DESCRIPTION);
     $this->addContentField($oContentField);
     // feed match
     $oContentField = new AnwContentFieldPage_string(self::FIELD_MATCH);
     $oContentField->setDefaultValue('*');
     $oContentField->setTranslatable(false);
     $oContentField->addForbiddenPattern('/^$/');
     $oContentMultiplicity = new AnwContentMultiplicity_multiple();
     $oContentMultiplicity->setSortable(false);
     $oContentField->setMultiplicity($oContentMultiplicity);
     $this->addContentField($oContentField);
     // feed contentclass
     $oContentField = new AnwContentFieldPage_checkboxGroup(self::FIELD_CONTENTCLASS);
     $oContentField->setTranslatable(false);
     $asEnumValues = array();
     $aoContentClasses = AnwContentClasses::getContentClasses();
     foreach ($aoContentClasses as $oContentClass) {
         $asEnumValues[$oContentClass->getName()] = $oContentClass->getName();
     }
     $oContentField->setEnumValues($asEnumValues);
     $oContentMultiplicity = new AnwContentMultiplicity_multiple();
     $oContentMultiplicity->setSortable(false);
     $oContentField->setMultiplicity($oContentMultiplicity);
     $this->addContentField($oContentField);
     // feed limit
     $oContentField = new AnwContentFieldPage_integer(self::FIELD_LIMIT);
     $oContentField->setTranslatable(false);
     $oContentField->setDefaultValue(15);
     $oContentField->setValueMin(1);
     $oContentField->setValueMax(50);
     $this->addContentField($oContentField);
 }