Example #1
0
	function getScaffoldingFilters($linkData)
	{
		$filters=new LPC_HTML_fragment();
		$attrs=$this->getScaffoldingAttributes();
		foreach($attrs as $attName) {
			if (!empty($this->dataStructure['fields'][$attName]['link_class'])) {
				if (!isset($linkData[$attName]))
					// no filters for anonymous links
					continue;
				if (empty($linkData[$attName]['meta']['type'])) {
					$filter = $this->getScaffoldingFilterString();
					$filter->SQL_key = $linkData[$attName]['SQL_key'];
					$filter->input_size = 10;
					$filters->a($filter, $attName);
				}
				continue;
			}
			if (
				empty($this->dataStructure['fields'][$attName]['type']) ||
				'text' == $this->dataStructure['fields'][$attName]['base_type']
			) {
				$filter = $this->getScaffoldingFilterString();
				$filter->input_size = 10;
				$filter->SQL_key = $this->getFieldName($attName);
				$filters->a($filter, $attName);
			} elseif ('boolean' == $this->dataStructure['fields'][$attName]['base_type']) {
				$filter = $this->getScaffoldingFilterBoolean();
				$filter->SQL_key = $this->getFieldName($attName);
				$filters->a($filter, $attName);
			}
		}
		if ($this::$i18n_class) {
			$i18n_obj = new $this::$i18n_class();
			$i18n_filters = $i18n_obj->getScaffoldingFilters();
			$filters->content = array_merge($filters->content, $i18n_filters->content);
		}
		return $filters;
	}
Example #2
0
	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;
	}
Example #3
0
	public function render()
	{
		if (!$this->content || $this->unconditional_preparation)
			$this->prepare();
		return parent::render();
	}