public static function field($attrs) { $html[] = ''; if (is_array($attrs)) { $type = array_take('type', $attrs); $type = isset($type) ? $type : 'text'; $html[] = field::get($type, $attrs); } else { $html[] = $attrs; } return implode("\n", $html); }
/** * 控件组 * * @param $attrs array 控件参数 * @return string 控件代码 */ public static function group($attrs) { $html[] = '<div class="field-group">'; $fields = arr::take('fields', $attrs); if (is_array($fields)) { foreach ($fields as $field) { if (is_array($field)) { $type = arr::take('type', $field); $type = isset($type) ? $type : 'text'; $field['class'] = isset($field['class']) ? 'short ' . $field['class'] : 'short'; $html[] = ' <div class="field-group-item">'; $html[] = ' <label for="' . $field['name'] . '">' . arr::take('label', $field) . '</label>'; $html[] = ' ' . field::get($type, $field); $html[] = ' </div>'; } else { $html[] = $field; } } } else { $html[] = $fields; } $html[] = '</div>'; return implode("\n", $html); }
public static function _field($attrs) { if ($attrs['type'] == 'hidden') { $str = field::get($attrs); } else { $str = form::template(form::$template); $str = str_replace('{$label}', form::label($attrs), $str); $str = str_replace('{$description}', form::description($attrs), $str); $str = str_replace('{$field}', field::get($attrs), $str); $str = str_replace('{$display}', arr::take('display', $attrs) == 'none' ? ' style="display:none;"' : '', $str); } return $str; }
echo zotop::url('zotop/image/edit', array('image' => url::encode($img['path']))); ?> " class="dialog">编辑</a> <a href="<?php echo zotop::url('zotop/image/delete', array('image' => url::encode($img['path']), 'referer' => url::encode(url::location()))); ?> " class="confirm">删除</a> </div> </li> <?php } ?> </ul> </div> <div class="clearfix"><?php echo $pagination; ?> </div> <div class="buttons"> <?php echo field::get('hidden', array('id' => 'image', 'value' => $image)); ?> <?php echo field::get('button', array('id' => 'insert', 'value' => '插入图片')); ?> <?php echo field::get('button', array('id' => 'close', 'value' => '关闭', 'class' => 'zotop-dialog-close')); ?> </div> <?php $this->footer();
<?php $this->header(); echo html::script('$common/js/swfobject.js'); ?> <div class="" style="width:100%;height:460px;overflow:hidden;"> <div id="SourceEditorLoading" style="height:460px;line-height:460px;text-align:center;">正在加载编辑器,请稍后……</div> <div id="SourceEditorPannel"></div> <?php echo field::get('textarea', array('name' => 'source', 'value' => $content)); ?> <script type="text/javascript"> //显示按钮 dialog.setTitle('编辑:<?php echo $file; ?> ').setWidth(800).setTip('小提示:快捷键 Ctrl+S 可以快速保存').setButtons([{text:'保 存',callback:save},{text:'关 闭'}]); //加载编辑器 var so = new SWFObject("<?php echo url::decode('$common/swf/ScriptEditor.swf'); ?> ", "SourceEditor", "100%", "460", "9", "#ffffff"); so.addVariable("Language","<?php echo file::ext($file); ?> "); so.addVariable("AfterInit","setContent"); so.addParam("wmode", "Opaque"); so.write("SourceEditorPannel");
table::header('list sortable'); foreach ($configs as $config) { $type = $config['type']; $description = $config['description']; $settings = (array) json_decode($config['settings']); $attrs = array('type' => $config['type'] == 'folder' ? 'hidden' : $config['type'], 'name' => $config['id'], 'value' => $config['value'], 'valid' => $config['valid']); $attrs = array_merge($attrs, $settings); $column = array(); $input = ''; if ($type == 'folder') { $input .= '<div class="icon-area"><div class="zotop-icon zotop-icon-file folder"></div></div>'; $input .= '<a href="' . zotop::url('system/config/index/' . $config['id']) . '"><b>' . $config['title'] . '</b></a><h5>' . $config['description'] . '</h5>'; $input .= field::get($attrs); } else { $input .= '<div class="icon-area"><div class="zotop-icon zotop-icon-file txt"></div></div>'; $input .= '<div class="label-area"><b>' . $config['title'] . '</b><h5 class="red">' . $config['id'] . '</h5></div>'; $input .= '<div class="field-area">' . field::get($attrs) . '<span class="field-valid"></span><h5>' . $config['description'] . '</h5>' . '</div>'; } $column['input'] = $input; $column['manage edit'] = '<a href="' . zotop::url('system/config/edit/' . $config['id']) . '" class="dialog">修改</a>'; $column['manage delete'] = '<a href="' . zotop::url('system/config/delete/' . $config['id']) . '" class="confirm">删除</a>'; table::row($column, 'select field'); } table::footer(); form::buttons(array('type' => 'submit', 'value' => '保 存'), array('type' => 'back')); form::footer(); ?> <?php $this->bottom(); $this->footer();
<?php $this->header(); $this->top(); $this->navbar(); ?> <script> //设置按钮 dialog.setTitle("<?php echo zotop::t('编辑') . ' <span>' . $file . '</span>'; ?> "); </script> <style type="text/css"> body.dialog {width:750px;} body.dialog textarea.textarea{width:100%;height:450px;padding:0px;border:0px;overflow:auto;white-space:nowrap;} </style> <?php form::header(); form::field('<div>' . field::get(array('type' => 'code,textarea', 'name' => 'filecontent', 'value' => $filecontent, 'width' => '100%', 'height' => '450px')) . '</div>'); form::buttons(array('type' => 'submit', 'value' => '保 存'), array('type' => 'button', 'value' => '关闭', 'class' => 'zotop-dialog-close')); form::footer(); $this->footer();
<?php $this->header(); $this->top(); $this->navbar(); ?> <script> //设置按钮 dialog.setTitle("<?php echo zotop::t('编辑') . ' <span>' . $file . '</span>'; ?> "); </script> <style type="text/css"> body.dialog {width:750px;} body.dialog textarea.textarea{width:100%;height:450px;padding:0px;border:0px;overflow:auto;white-space:nowrap;} </style> <?php form::header(); form::field('<div>' . field::get(array('type' => 'templateeditor,code,textarea', 'name' => 'filecontent', 'value' => $filecontent, 'height' => '450px')) . '</div>'); form::buttons(array('type' => 'submit', 'value' => '保 存'), array('type' => 'button', 'value' => '关闭', 'class' => 'zotop-dialog-close')); form::footer(); $this->bottom(); $this->footer();
echo zotop::url('blog/index/index/' . $categoryid . '/' . $s); ?> "><span><?php echo $t; ?> </span></a></li> <?php } ?> </ul> <form class="smallsearch"> <?php echo field::get(array('type' => 'text', 'name' => 'keywords', 'title' => '请输入关键词进行搜索')); ?> <?php echo field::get(array('type' => 'submit', 'value' => '搜索')); ?> </form> </div> <?php form::header(array('valid' => 'false', 'class' => 'list', 'action' => zotop::url('blog/index/operation'))); $column = array(); $column['select'] = html::checkbox(array('name' => 'table', 'class' => 'selectAll')); $column['status w30 center'] = '状态'; $column['order w30 center'] = '权重'; $column['name'] = '名称'; $column['categoryid w50'] = '分类'; $column['comment w30 center'] = '评论'; $column['atime w120'] = '最后修改时间'; table::header('list', $column); foreach ($blogs['data'] as $blog) {
foreach ($configs as $config) { $type = $config['type']; $description = $config['description']; $settings = (array) json_decode($config['settings']); $attrs = array('name' => $config['id'], 'value' => $config['value']); $attrs = array_merge($attrs, $settings); $column = array(); $input = ''; if ($type == 'folder') { $input .= '<div style="float:left;width:50px;height:100%;text-align:center;"><img src="' . url::decode('$theme/image/fileext/big/folder.gif') . '" width="32px"></div>'; $input .= '<a href="' . zotop::url('zotop/config/index', array('parentid' => $config['id'])) . '"><b>' . $config['title'] . '</b></a><h5>' . $config['description'] . '</h5>'; $input .= field::get('hidden', $attrs); } else { $input .= '<div style="float:left;width:50px;height:100%;text-align:center;"><img src="' . url::decode('$theme/image/fileext/big/file.gif') . '" width="32px"></div>'; $input .= '<div style="float:left;width:160px;height:100%;"><b>' . $config['title'] . '</b><h5 class="red">' . $config['id'] . '</h5></div>'; $input .= '<div style="float:left;">' . field::get($type, $attrs) . '<h5>' . $config['description'] . '</h5>' . '</div>'; } $column['input'] = $input; $column['manage edit'] = '<a href="' . zotop::url('zotop/config/edit', array('id' => $config['id'])) . '" class="dialog">修改</a>'; $column['manage delete'] = '<a href="' . zotop::url('zotop/config/delete', array('id' => $config['id'])) . '" class="confirm">删除</a>'; table::row($column, 'select'); } table::footer(); form::bottom('<span class="zotop-tip">拖动并保存,改变顺序</span>'); form::footer(array(array('type' => 'submit', 'value' => '保 存'), array('type' => 'back'))); } ?> <?php $this->bottom(); $this->footer();