diff --git a/Conjuro/Conjuro.php b/Conjuro/Conjuro.php index b3ab218..984b468 100644 --- a/Conjuro/Conjuro.php +++ b/Conjuro/Conjuro.php @@ -221,19 +221,11 @@ * Render a set of cotnrols based on metadata list */ public function renderContent($metaList,$data){ - if (is_array($metaList)) - foreach($metaList as $meta){//ControlInfo - /* - $this->rhtml( - 'div', - ['id'=>$meta['container-id'],'class'=>'control '.$meta['container-class'],'data-type'=>$meta['@']], - fn()=>$this->control($meta['@'])->render($meta,$data) - ); - */ - $this->control($meta['@'])->render($meta,$data); - } - else + if ($metaList['@']) $this->control($metaList['@'])->render($metaList,$data); + else + foreach($metaList as $meta) + $this->control($meta['@'])->render($meta,$data); } /** diff --git a/content/controls/common-admin.php b/content/controls/common-admin.php new file mode 100644 index 0000000..2e0e566 --- /dev/null +++ b/content/controls/common-admin.php @@ -0,0 +1,27 @@ +do("get-panel-links") as $lnk){ + c()->control("admin-panel-button")->render($lnk,$data); + } + } + }, + new class("admin-panel-button") extends Control{ + protected function renderControl($meta,$data) { + echo '
'; + echo ''; + echo ''.$meta["title"].''; + echo '
'; + } + } + ]; +?> \ No newline at end of file diff --git a/content/controls/common.php b/content/controls/common.php index b595a53..f2a3403 100644 --- a/content/controls/common.php +++ b/content/controls/common.php @@ -10,7 +10,10 @@ }, new class("img") extends Control{ protected function renderControl($meta,$data) { - echo ''; + c()->rhtml( + 'img', + ['id'=>$meta['id'],'class'=>$meta['class'],'src'=>$meta['src']] + ); } }, new class("builder") extends Control{ @@ -18,5 +21,39 @@ include "Conjuro/Builder.php"; } }, + new class("form") extends Control{ + protected function renderControl($meta,$data) { + $cols=$meta["columns"]; + c()->rhtml( + 'form', + ['id'=>$meta['id'],'class'=>$meta['class']], + fn()=>c()->rhtml( + 'table', + ['class'=>'form-body-table'], + function() use($meta,$data){ + echo ''; + $col=0; + foreach($meta['childs'] as $child){ + c()->renderContent($child,$data); + if($col++>=$cols){ + echo ''; + } + } + echo ''; + } + ) + ); + } + }, + new class("form-data") extends Control{ + protected function renderControl($meta,$data) { + if ($meta['id']){ + $lid=$meta["id"].'-label'; + $vid=$meta["id"].'-value'; + } + c()->rhtml('td',['id'=>$lid,'class'=>'form-data-label '.$meta["class"]],fn()=>print(htmlentities($meta["label"]))); + c()->rhtml('td',['id'=>$vid,'class'=>'form-data-value '.$meta["class"]]); + } + } ]; ?> \ No newline at end of file diff --git a/content/fragment/layout-admin.php b/content/fragment/layout-admin.php index c97b3ca..9a5a3db 100644 --- a/content/fragment/layout-admin.php +++ b/content/fragment/layout-admin.php @@ -15,6 +15,7 @@
showContent("header");?>
+
showContent("body");?>