function getDefault($className,$attName,$languageID=0) { if (!$languageID) $languageID=LPC_Language::getCurrent()->id; if (!isset(self::$currentInstance)) self::$currentInstance=new LPC_Scaffolding_default(); $sd=&self::$currentInstance; $ds=$sd->search( array('className','attName','language'), array($className,$attName,$languageID) ); if (!$ds) return ""; return $ds[0]->getAttr('defaultValue'); }
public function render($indent=0) { $lang = LPC_Language::getCurrent(); $POSIX = $lang->getAttr("locale_POSIX"); if (strlen($POSIX) > 1) // at least 2 $this->setAttr("lang", substr($POSIX, 0, 2)); $this->prepareContent($this->content); if ($this->doctype & LPC_HTML_doctype::type_XHTML1) $this->setAttr("xmlns","http://www.w3.org/1999/xhtml"); if (!$this->body->content || self::RM_NONE == $this->renderMode) return ''; if (!$this->beforeRender($indent)) return ''; if (self::RM_RAW == $this->renderMode) return $this->body->renderContent($indent); if (self::RM_HTML != $this->renderMode) throw new RuntimeException("Unknown render mode: [".$this->renderMode."]"); $title=""; if ($this->title) { $titleObj=new LPC_HTML_fragment(); $titleObj->content=$this->title; $titleObj->compact=true; $title=$titleObj->render(); } if (strlen(trim($title))) $this->content['head']->content['title']->content=sprintf($this->title_format,$title); else $this->content['head']->content['title']->content=$this->title_default; $content=$this->output(LPC_HTML_doctype::$doctypes[$this->doctype],$indent); // <!DOCTYPE...> $content.=parent::render($indent); $this->onRender($indent); return $content; }
static function getCacheKey($messageKey,$langID=0) { if (!$langID) $langID=LPC_Language::getCurrent()->id; return "LPC.i18n.".$langID."-".$messageKey; }
function initI18nChild($id,$langID=0) { $this->checkI18nChild(); if (!$langID) $langID=LPC_Language::getCurrent()->id; $this->setAttr($this->user_fields['i18n_parent'],$id); $this->setAttr($this->user_fields['i18n_language'],$langID); }
header("Location: ".LPC_URI::getCurrent()->delVar('langID')->toString()); exit; } } $langSelect=new LPC_HTML_node('div'); $langSelect->setAttr('style','float: right'); $langSelect->a(_LH('scaffoldingSelectLang')." "); $langs=new LPC_HTML_select(); $langSelect->a($langs); $langObjs=new LPC_Language(); $langObjs=$langObjs->search(NULL,NULL,'name'); foreach($langObjs as $langObj) $langs->addOption($langObj->getAttr('name'),$langObj->id); $langs->setAttr('onChange',"window.location=location.pathname+location.search+(location.search?'&':'?')+'langID='+this.options[this.selectedIndex].value;"); $langs->selected=LPC_Language::getCurrent()->id; LPC_Page::getCurrent()->a($langSelect); function exposeDirClasses($dir) { $result=array( 'name'=>array(), 'formal'=>array(), ); $d = dir($dir); while (false !== ($entry = $d->read())) { $fname=$dir."/".$entry; $class=substr($entry,0,-4); // First skip filesystem entries and known auxiliary classes if (!validClassFile($fname) || !validClassName($class))