当前位置: 首页>>代码示例>>PHP>>正文


PHP view::ui方法代码示例

本文整理汇总了PHP中view::ui方法的典型用法代码示例。如果您正苦于以下问题:PHP view::ui方法的具体用法?PHP view::ui怎么用?PHP view::ui使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在view的用法示例。


在下文中一共展示了view::ui方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _process

 function _process($all_settings)
 {
     $setting = new base_setting($this->app);
     $setlib = $setting->source();
     $typemap = array(SET_T_STR => 'text', SET_T_INT => 'number', SET_T_ENUM => 'select', SET_T_BOOL => 'bool', SET_T_TXT => 'text', SET_T_FILE => 'file', SET_T_IMAGE => 'image', SET_T_DIGITS => 'number');
     $tabs = array_keys($all_settings);
     $html = view::ui()->form_start(array('tabs' => $tabs, 'method' => 'POST'));
     foreach ($tabs as $tab => $tab_name) {
         foreach ($all_settings[$tab_name] as $set) {
             $current_set = $pre_set = $this->app->getConf($set);
             if ($_POST['set'] && array_key_exists($set, $_POST['set'])) {
                 if ($current_set != $_POST['set'][$set]) {
                     $current_set = $_POST['set'][$set];
                     $this->app->setConf($set, $_POST['set'][$set]);
                 }
             }
             $input_type = $typemap[$setlib[$set]['type']];
             $form_input = array('title' => $setlib[$set]['desc'], 'type' => $input_type, 'name' => "set[" . $set . "]", 'tab' => $tab, 'value' => $current_set, 'options' => $setlib[$set]['options']);
             if ($input_type == 'select') {
                 $form_input['required'] = true;
             }
             if ($input_type == 'image') {
                 $form_input = array_merge($form_input, array('width' => $setlib[$set]['width'], 'height' => $setlib[$set]['height']));
             }
             $html .= view::ui()->form_input($form_input);
         }
     }
     return $html .= view::ui()->form_end(1, app::get('ectools')->_('保存设置'));
 }
开发者ID:453111208,项目名称:bbc,代码行数:29,代码来源:setting.php

示例2: block_help

 function block_help($params, $content, $template)
 {
     if (null !== $content) {
         $help_types = array('info' => array('size' => 18, 'icon' => app::get('desktop')->res_url . '/images/bundle/tips_info.gif'), 'help' => array('size' => 18, 'icon' => app::get('desktop')->res_url . '/images/bundle/tips_help.gif'), 'dialog' => array('size' => 18, 'icon' => app::get('desktop')->res_url . '/images/bundle/tips_info.gif', 'dialog' => 1), 'link' => array('size' => 15, 'icon' => app::get('desktop')->res_url . '/images/bundle/tips_help.gif'), 'link-mid' => array('size' => 14, 'icon' => app::get('desktop')->res_url . '/images/bundle/tips_help_mid.gif'), 'link-small' => array('size' => 12, 'icon' => app::get('desktop')->res_url . '/images/bundle/tips_help_small.gif'));
         $params['dom_id'] = view::ui()->new_dom_id();
         if ($content = trim($content)) {
             $params['text'] = preg_replace(array('/\\n/', '/\\r/', '/\\"/', '/\'/'), array('<br>', '<br>', '&quot;', '&#39;'), $content);
         }
         $params['type'] = isset($help_types[$params['type']]) ? $help_types[$params['type']] : $help_types['help'];
         $pagedata = (array) $params;
         $output = view::make('desktop/helper.html', $pagedata)->render();
         return $output;
     }
 }
开发者ID:453111208,项目名称:bbc,代码行数:14,代码来源:helper.php

示例3: function_wapheader

 function function_wapheader()
 {
     $ret = '<base href="' . kernel::base_url(1) . '"/>';
     $path = app::get('site')->res_full_url;
     $pathtopm = app::get('topm')->res_full_url;
     $debug_css = config::get('app.debug', false);
     $debug_js = config::get('app.debug', false);
     $css_mini = $debug_css ? '' : '.min';
     $js_mini = $debug_js ? '' : '.min';
     $cssver = view::ui()->getVer($debug_css);
     $jsver = view::ui()->getVer($debug_js);
     if ($debug_css) {
         $ret .= '<link rel="stylesheet" href="' . $pathtopm . '/stylesheets/base.css' . $cssver . '" />';
     } else {
         $ret .= '<link rel="stylesheet" href="' . $pathtopm . '/stylesheets/base' . $css_mini . '.css' . $cssver . '" />';
     }
     $ret .= '<link rel="stylesheet" href="' . $path . '/stylesheets/widgets_edit' . $css_mini . '.css' . $cssver . '" />';
     $ret .= view::ui()->lang_script(array('src' => 'lang.js', 'app' => 'site'));
     $ret .= view::ui()->lang_script(array('src' => 'lang.js', 'app' => 'b2c', 'pdir' => 'js_mini'));
     if ($debug_js) {
         $ret .= '<script src="' . $path . '/scripts/lib/jquery.js' . $jsver . '"></script>
         <script src="' . $path . '/scripts/lib/jquery.cookie.js' . $jsver . '"></script>
         <script src="' . $pathtopm . '/scripts/gmu.js' . $jsver . '"></script>
         <script src="' . $pathtopm . '/scripts/common.js' . $jsver . '"></script>
         <script src="' . $pathtopm . '/scripts/zepto.js' . $jsver . '"></script>
         <script src="' . $path . '/scripts/tools.js' . $jsver . '"></script>
         <script src="' . $path . '/scripts/shopwidgets.js' . $jsver . '"></script>';
     } else {
         $ret .= '<script src="' . $path . '/scripts/jquery' . $js_mini . '.js' . $jsver . '"></script>
         <script src="' . $path . '/scripts/ui' . $js_mini . '.js' . $jsver . '"></script>
         <script src="' . $path . '/scripts/shopwidgets' . $js_mini . '.js' . $jsver . '"></script>';
     }
     if ($theme_info = app::get('site')->getConf('site.theme_' . app::get('site')->getConf('current_theme') . '_color')) {
         $theme_color_href = kernel::base_url(1) . '/themes/' . app::get('site')->getConf('current_theme') . '/' . $theme_info;
         $ret .= "<script>\n            window.addEvent('domready',function(){\n                new Element('link',{rel:'stylesheet',href:'" . $theme_color_href . "'}).inject(document.head);\n            });\n            </script>";
     }
     /* $ret .= '<script>
                         window.addEvent(\'domready\',function(){(parent.loadedPart[1])++});
                         parent.document.getElementById(\'loadpart\').style.display="none";
                         parent.document.getElementById(\'body\').style.display="block";
                     </script>';
     */
     foreach (kernel::serviceList('site_theme_view_helper') as $service) {
         if (method_exists($service, 'function_wapheader')) {
             $ret .= $service->function_wapheader();
         }
     }
     return $ret;
 }
开发者ID:453111208,项目名称:bbc,代码行数:49,代码来源:helper.php

示例4: new_mormal_tag

 function new_mormal_tag()
 {
     $ex_p = '&wg=' . urlencode($_GET['wg']) . '&type=' . urlencode($_GET['type']) . '&app_id=' . urlencode($_GET['app_id']);
     if ($_POST) {
         $this->begin();
         $tagmgr = $this->app->model('tag');
         $data = array('tag_name' => $_POST['tag_name'], 'tag_abbr' => $_POST['tag_abbr'], 'tag_type' => $_GET['type'], 'app_id' => $_GET['app_id'], 'tag_mode' => 'normal', 'tag_bgcolor' => $_POST['tag_bgcolor']);
         $tagmgr->save($data);
         $this->end();
     } else {
         $html = view::ui()->form_start(array('action' => $this->url . '&act=new_mormal_tag' . $ex_p));
         $html .= view::ui()->form_input(array('title' => app::get('desktop')->_('标签名'), 'name' => 'tag_name'));
         $html .= view::ui()->form_input(array('title' => app::get('desktop')->_('标签备注'), 'maxlength' => '50', 'name' => 'tag_abbr'));
         $html .= view::ui()->form_input(array('title' => app::get('desktop')->_('标签背景色'), 'type' => 'color', 'name' => 'tag_bgcolor'));
         $html .= view::ui()->form_end();
         echo $html;
     }
 }
开发者ID:453111208,项目名称:bbc,代码行数:18,代码来源:tags.php

示例5: service

 function service()
 {
     echo '<h4 class="head-title" >' . app::get('desktop')->_('系统配置') . '</h4>';
     if ($_POST) {
         $this->app->setConf('shopadminVcode', $_POST['shopamin_vocde']);
     }
     $services = app::get('base')->model('services');
     $filter = array('content_type' => 'service_category', 'content_path' => 'select', 'disabled' => 1);
     $all_category = $services->getList('*', $filter);
     $filter = array('content_type' => 'service', 'disabled' => 1);
     $all_services = $services->getList('*', $filter);
     foreach ($all_services as $k => $row) {
         $vars = get_class_vars($row['content_path']);
         $servicelist[$row['content_name']][$row['content_path']] = $vars['name'];
     }
     $html .= view::ui()->form_start(array('method' => 'POST'));
     foreach ($all_category as $ik => $item) {
         if ($item['content_name'] == 'ectools_regions.ectools_mdl_regions') {
             unset($all_category[$ik]);
             continue;
         }
         $current_set = app::get('base')->getConf('service.' . $item['content_name']);
         if (@array_key_exists($item['content_name'], $_POST['service'])) {
             if ($current_set != $_POST['service'][$item['content_name']]) {
                 $current_set = $_POST['service'][$item['content_name']];
                 app::get('base')->setConf('service.' . $item['content_name'], $current_set);
             }
         }
         $form_input = array('title' => $item['content_title'], 'type' => 'select', 'required' => true, 'name' => "service[" . $item['content_name'] . "]", 'tab' => $tab, 'value' => $current_set, 'options' => $servicelist[$item['content_name']]);
         $html .= view::ui()->form_input($form_input);
     }
     $select = $this->app->getConf('shopadminVcode');
     if ($select === 'true') {
         $html .= "<tr><th><label>" . app::get('desktop')->_('后台登录启用验证码') . "</label></th><td>&nbsp;&nbsp;<select name='shopamin_vocde' type='select' ><option value='true' selected='selected'>" . app::get('desktop')->_('是') . "</option><option value='false' >" . app::get('desktop')->_('否') . "</option></select></td></tr>";
     } else {
         $html .= "<tr><th><label>" . app::get('desktop')->_('后台登录启用验证码') . "</lable></th><td>&nbsp;&nbsp;<select name='shopamin_vocde' type='select' ><option value='true'>" . app::get('desktop')->_('是') . "</option><option value='false' selected='selected'>" . app::get('desktop')->_('否') . "</option></select></td></tr>";
     }
     $html .= view::ui()->form_end();
     $pagedata['_PAGE_CONTENT'] = $html;
     return $this->page(null, $pagedata);
 }
开发者ID:453111208,项目名称:bbc,代码行数:41,代码来源:system.php

示例6: function_header

 function function_header()
 {
     $ret = '<base href="' . kernel::base_url(1) . '"/>';
     $path = app::get('site')->res_full_url;
     $debug_css = config::get('app.debug', false);
     $debug_js = config::get('app.debug', false);
     $css_mini = $debug_css ? '' : '.min';
     $cssver = view::ui()->getVer($debug_css);
     $jsver = view::ui()->getVer($debug_js);
     $ret .= '<link rel="stylesheet" href="' . $path . '/stylesheets/widgets_edit' . $css_mini . '.css' . $cssver . '" />';
     $ret .= view::ui()->lang_script(array('src' => 'lang.js', 'app' => 'site'));
     if ($debug_js) {
         $ret .= '<script src="' . $path . '/scripts/lib/mootools.js' . $jsver . '"></script>
         <script src="' . $path . '/scripts/lib/moomore.js' . $jsver . '"></script>
         <script src="' . $path . '/scripts/jstools.js' . $jsver . '"></script>
         <script src="' . $path . '/scripts/switchable.js' . $jsver . '"></script>
         <script src="' . $path . '/scripts/dragdropplus.js' . $jsver . '"></script>
         <script src="' . $path . '/scripts/widgetsinstance.js' . $jsver . '"></script>';
     } else {
         $ret .= '<script src="' . $path . '/scripts/lib/mootools.min.js' . $jsver . '"></script>
         <script src="' . $path . '/scripts/ui.min.js' . $jsver . '"></script>
         <script src="' . $path . '/scripts/widgetsinstance.min.js' . $jsver . '"></script>';
     }
     if ($theme_info = app::get('site')->getConf('site.theme_' . app::get('site')->getConf('current_theme') . '_color')) {
         $theme_color_href = kernel::base_url(1) . '/themes/' . app::get('site')->getConf('current_theme') . '/' . $theme_info;
         $ret .= "<script>\n            window.addEvent('domready',function(){\n                new Element('link',{href:'" . $theme_color_href . "',rel:'stylesheet'}).injectBottom(document.head);\n             });\n            </script>";
     }
     /*$ret .= '<script>
                         window.addEvent(\'domready\',function(){(parent.loadedPart[1])++});
                         parent.document.getElementById(\'loadpart\').style.display="none";
                         parent.document.getElementById(\'body\').style.display="block";
                     </script>';
     */
     foreach (kernel::serviceList('site_theme_view_helper') as $service) {
         if (method_exists($service, 'function_header')) {
             $ret .= $service->function_header();
         }
     }
     return $ret;
 }
开发者ID:453111208,项目名称:bbc,代码行数:40,代码来源:helper.php

示例7: _img_list

    function _img_list()
    {
        $img = $this->app->model('image');
        $html = '';
        foreach ($img->getList('url,s_url,l_url,m_url,image_id,width,height,storage', $filter, 0, 20) as $item) {
            $url = '';
            if ($item['storage'] == 'filesystem') {
                $url = kernel::get_resource_host_url();
            }
            $url = $url . ($item['s_url'] ? $item['s_url'] : ($item['m_url'] ? $item['m_url'] : ($item['l_url'] ? $item['l_url'] : $item['url'])));
            if (max($item['width'], $item['height']) > 96) {
                $tag = ($item['width'] > $item['height'] ? 'width=' : 'height=') . '"96"';
            } else {
                $tag = '';
            }
            $html .= <<<EOF
            <div image_id="{$image_id}" style="text-align:center;vertical-align: middle;float:left;width:96px;height:96px;border:3px solid #ddd;margin:3px">
            <img {$tag} src="{$url}" />
            </div>
EOF;
        }
        $pager = view::ui()->pager(array('current' => 2, 'total' => 200, 'link' => 'javascript:' . $this->var_name . '.page(%d)', 'nobutton' => false));
        echo $html . $pager;
    }
开发者ID:453111208,项目名称:bbc,代码行数:24,代码来源:editor.php

示例8: index

 public function index()
 {
     $post = $_POST;
     $typemap = array(SET_T_STR => 'text', SET_T_INT => 'number', SET_T_ENUM => 'select', SET_T_BOOL => 'bool', SET_T_TXT => 'text', SET_T_FILE => 'file', SET_T_IMAGE => 'image', SET_T_DIGITS => 'number');
     $all_settings = config::get('sysconf');
     $tabs = array_keys($all_settings);
     $html = view::ui()->form_start(array('tabs' => $tabs, 'method' => 'POST', 'id' => 'setting_form'));
     $input_style = false;
     $arrJs = array();
     foreach ($tabs as $tab => $settings) {
         foreach ($all_settings[$settings] as $set => $setting) {
             $currentSet = $pre_set = app::get('sysconf')->getConf($set);
             if ($post['set'] && array_key_exists($set, $post['set'])) {
                 if ($currentSet !== $post['set'][$set]) {
                     $currentSet = $post['set'][$set];
                     app::get('sysconf')->setConf($set, $currentSet);
                 }
             }
             $inputType = $typemap[$setting['type']];
             $formInput = array('title' => $setting['desc'], 'type' => $typemap[$setting['type']], 'name' => "set[" . $set . "]", 'tab' => $tab, 'helpinfo' => $setting['helpinfo'], 'value' => $currentSet ? $currentSet : $setting['default'], 'options' => $setting['options'], 'vtype' => $setting['vtype'], 'class' => $setting['class'], 'id' => $setting['id'], 'default' => $setting['default']);
             if ($inputType == "select") {
                 $formInput['required'] = true;
             }
             if (isset($setting['extends_attr']) && $setting['extends_attr'] && is_array($setting['extends_attr'])) {
                 foreach ($setting['extends_attr'] as $key => $extends_attr) {
                     $formInput[$key] = $extends_attr;
                 }
             }
             $arrJs[] = $setting['javascript'];
             $html .= view::ui()->form_input($formInput);
         }
     }
     if (!$post) {
         $html .= view::ui()->form_end();
         $strJs = '<script type="text/javascript">window.addEvent(\'domready\',function(){';
         if (is_array($arrJs) && $arrJs) {
             foreach ($arrJs as $strJavascript) {
                 $strJs .= $strJavascript;
             }
         }
         $strJs .= '$("main").addEvent("click",function(el){
             el = el.target || el;
             if ($(el).get("id")){
                 var _id = $(el).get("id");
                 var _class_name = "";
                 if (_id.indexOf("-t") > -1){
                     _class_name = _id.substr(0, _id.indexOf("-t"));
                     $$("."+_class_name).getParent("tr").show();
                  }
             if (_id.indexOf("-f") > -1){
                 _class_name = _id.substr(0, _id.indexOf("-f"));
                 var _destination_node = $$("."+_class_name);
                 _destination_node.getParent("tr").hide();
                 _destination_node.each(function(item){if (item.getNext(".caution") && item.getNext(".caution").hasClass("error")) item.getNext(".caution").remove();});
             }
             }
         });';
         $strJs .= '});</script>';
         $pagedata['_PAGE_CONTENT'] .= $html . $strJs;
         return $this->page(null, $pagedata);
     } else {
         $this->begin();
         return $this->end(true, app::get('sysconf')->_('当前配置修改成功!'));
     }
 }
开发者ID:453111208,项目名称:bbc,代码行数:65,代码来源:setting.php

示例9: getFinderPagerHtml

 public function getFinderPagerHtml()
 {
     $pre_btn_addon = $this->pagerInfo['current'] > 1 ? '' : 'disabled="disabled"';
     $next_btn_addon = $this->pagerInfo['current'] < $this->pagerInfo['total'] ? '' : 'disabled="disabled"';
     $from = $this->pagerInfo['from'];
     $to = $this->pagerInfo['to'];
     $pager = view::ui()->desktoppager(array('current' => $this->pagerInfo['current'], 'total' => $this->pagerInfo['total'], 'link' => 'javascript:' . $this->var_name . '.page(%d);'));
     $pagedata = $this->getCommonPagedata();
     $pagedata['perPageSettingList'] = $this->plimit_in_sel;
     $pagedata['plimit'] = $this->pagelimit;
     $pagedata['from'] = $from;
     $pagedata['to'] = $to;
     $pagedata['pre_btn_addon'] = $pre_btn_addon;
     $pagedata['next_btn_addon'] = $next_btn_addon;
     $pagedata['pager'] = $pager;
     $pagedata['pinfo'] = $this->pagerInfo;
     return view::make('desktop/finder/view/pager.html', $pagedata)->render();
 }
开发者ID:453111208,项目名称:bbc,代码行数:18,代码来源:view.php

示例10: image_lib

 /**
  * 图片管理列表内容显示
  * @param string 图片的tag
  * @param int 第几页的页面
  * @return string html内容
  */
 function image_lib($tag = '', $page = 1)
 {
     $pagelimit = 12;
     //$otag = $this->app->model('tag');
     $oimage = $this->app->model('images');
     //$tags = $otag->getList('*',array('tag_type'=>'image'));
     $filter = array();
     if ($tag) {
         $filter = array('tag' => array($tag));
     }
     $images = $oimage->getList('*', $filter, $pagelimit * ($page - 1), $pagelimit);
     $count = $oimage->count($filter);
     $limitwidth = 100;
     foreach ($images as $key => $row) {
         $maxsize = max($row['width'], $row['height']);
         if ($maxsize > $limitwidth) {
             $size = 'width=';
             $size .= $row['width'] - $row['width'] * (($maxsize - $limitwidth) / $maxsize);
             $size .= ' height=';
             $size .= $row['height'] - $row['height'] * (($maxsize - $limitwidth) / $maxsize);
         } else {
             $size = 'width=' . $row['width'] . ' height=' . $row['height'];
         }
         $row['size'] = $size;
         $images[$key] = $row;
     }
     $pagedata['images'] = $images;
     $pagedata['pagers'] = view::ui()->pager(array('current' => $page, 'total' => ceil($count / $pagelimit), 'link' => '?app=image&ctl=admin_manage&act=image_lib&p[0]=' . $tag . '&p[1]=%d'));
     return view::make('image/image_lib.html', $pagedata);
 }
开发者ID:453111208,项目名称:bbc,代码行数:36,代码来源:manage.php

示例11: input_select

 function input_select($params)
 {
     if (is_string($params['options'])) {
         if (!$params['id']) {
             $params['id'] = view::ui()->new_dom_id();
         }
         $params['remote_url'] = $params['options'];
         $params['options'] = array($params['value'] => $params['value']);
         $script = '<script>$(\'' . $params['id'] . '\').addEvent(\'focus\',window.init_select)</script>';
     }
     if ($params['rows']) {
         foreach ($params['rows'] as $r) {
             $step[$r[$params['valueColumn']]] = intval($r['step']);
             $options[$r[$params['valueColumn']]] = $r[$params['labelColumn']];
         }
         unset($params['valueColumn'], $params['labelColumn'], $params['rows']);
     } else {
         $options = $params['options'];
         unset($params['options']);
     }
     $params['name'] = $params['search'] ? '_' . $params['name'] . '_search' : $params['name'];
     $params['class'] .= ' x-select';
     $value = $params['value'];
     unset($params['value']);
     $html = utils::buildTag($params, 'select', false);
     if (!$params['required'] && $params['vtype'] != 'required') {
         $html .= '<option></option>';
     }
     foreach ((array) $options as $k => $item) {
         if ($k === '0' || $k === 0) {
             $selected = $value === '0' || $value === 0;
         } else {
             $selected = $value == $k;
         }
         $t_step = $step[$k] ? str_repeat('&nbsp;', ($step[$k] - 1) * 3) : '';
         $html .= '<option' . ($params['noselect'] ? ' disabled=true ' : ' ') . ($selected ? ' selected="selected"' : '') . ' value="' . htmlspecialchars($k) . '">' . $t_step . htmlspecialchars($item) . '</option>';
     }
     $html .= '</select>';
     return $html . $script;
 }
开发者ID:453111208,项目名称:bbc,代码行数:40,代码来源:input.php

示例12: detail_edit

 public function detail_edit($id)
 {
     $qb = app::get('site')->database()->createQueryBuilder();
     $menu = $qb->select('*')->from('site_menus')->where('id=' . $qb->createPositionalParameter($id))->execute()->fetch();
     if (!$menu) {
         return '';
     }
     if (empty($menu['app'])) {
         $pagedata['menu'] = $menu;
         return view::make('site/admin/menu/edit_url.html', $pagedata);
     } else {
         $obj = kernel::service('site_menu.' . sprintf('%s_%s_%s', $menu['app'], $menu['ctl'], $menu['act']));
         if ($obj) {
             $config = $menu['config'];
             foreach ($obj->inputs($config) as $title => $input) {
                 $tmp['title'] = $title;
                 $tmp['input'] = view::ui()->input($input);
                 $html[] = $tmp;
             }
             $pagedata['menu'] = $menu;
             $pagedata['html'] = $html;
             return view::make('site/admin/menu/edit_app_module.html', $pagedata);
         } else {
             $pagedata['menu'] = $menu;
             return view::make('site/admin/menu/edit_module.html', $pagedata);
         }
     }
 }
开发者ID:453111208,项目名称:bbc,代码行数:28,代码来源:menu.php

示例13: main

    function main()
    {
        $finder_aliasname = $_GET['finder_aliasname'] ? $_GET['finder_aliasname'] : $_POST['finder_aliasname'];
        if ($_POST['col']) {
            $finder_aliasname = $finder_aliasname . '.' . $this->controller->user->user_id;
            $cols = $this->app->setConf('view.' . $this->object_name . '.' . $finder_aliasname, implode(',', $_POST['col']));
            if ($_POST['allcol']) {
                $this->app->setConf('listorder.' . $this->object_name . '.' . $finder_aliasname, implode(',', $_POST['allcol']));
            }
            header('Content-Type:application/json; charset=utf-8');
            echo '{success:"' . app::get('desktop')->_('设置成功') . '"}';
        } else {
            $in_use = array_flip($this->getColumnNames());
            $all_columns = $this->all_columns();
            $listorder = explode(',', $this->app->getConf('listorder.' . $this->object_name . '.' . $finder_aliasname . '.' . $this->controller->user->user_id));
            if ($listorder) {
                $ordered_columns = array();
                foreach ($listorder as $col) {
                    if (isset($all_columns[$col])) {
                        $ordered_columns[$col] = $all_columns[$col];
                        unset($all_columns[$col]);
                    }
                }
                $all_columns = array_merge((array) $ordered_columns, (array) $all_columns);
                $ordered_columns = null;
            }
            $domid = view::ui()->new_dom_id();
            $html = '<div class="gridlist">';
            $html .= '<form id="' . $domid . '" method="post" action="?' . $_SERVER['QUERY_STRING'] . '">';
            $mv_handler = view::ui()->img(array('src' => 'bundle/grippy.gif', 'class' => 'move-handler', 'app' => 'desktop'));
            $i = 0;
            foreach ($all_columns as $key => $col) {
                $i++;
                $html .= '<div class="row">';
                $html .= '<div class="row-line item"><input type="hidden" value="' . $key . '" name="allcol[]" />' . $mv_handler . '<input type="checkbox" ' . (isset($in_use[$key]) ? ' checked="checked" ' : '') . ' value="' . $key . '" name="col[]" id="finder-col-set-' . $i . '" />
                    <label for="finder-col-set-' . $i . '">' . app::get('desktop')->_($col['label']) . '</label></div>';
                $html .= '</div>';
            }
            $finder_id = $_GET['_finder']['finder_id'];
            $html .= '<!-----.mainHead-----&darr;&nbsp;' . app::get('desktop')->_('拖动改变顺序') . '-----.mainHead----->';
            $html .= '<!-----.mainFoot-----<div class="table-action"><button class="btn btn-primary" onclick="$(\'' . $domid . '\').fireEvent(\'submit\',{stop:$empty})"><span><span>' . app::get('desktop')->_('保存提交') . '</span></span></button></div>-----.mainFoot----->';
            $html .= '<input type="hidden" name="finder_aliasname" value="' . $finder_aliasname . '"/>';
            $html .= '</form>';
            $html .= '</div>';
            $html .= <<<EOF
            <script>
              (function(){
                var scrollAuto =  new Scroller(\$('{$domid}').getContainer());
                new Sortables(\$('{$domid}'),{clone:false,opacity:.5,handle:'.move-handler',onStart:function(){
                    \$('{$domid}').addClass('move-active');
                    scrollAuto.start();
                },onComplete:function(){
                    scrollAuto.stop();
                    \$('{$domid}').removeClass('move-active');
                }});
                \$('{$domid}').store('target',{update:\$('main').getFirst(),onComplete:function(){
                    if(!\$\$('#{$domid} .row input[type=checkbox]:checked').length) return alert('请至少选择一列');
                    else {
                        \$('{$domid}').getParent('.dialog').retrieve('instance').close();
                        window.finderGroup['{$finder_id}'].refresh();
                    }
                }});
              })();
            </script>
EOF;
            return $html;
        }
    }
开发者ID:453111208,项目名称:bbc,代码行数:68,代码来源:column.php

示例14: input_object

 function input_object($params)
 {
     $return_url = $params['return_url'] ? $params['return_url'] : '?app=desktop&ctl=editor&act=object_rows';
     $callback = $params['callback'] ? $params['callback'] : '';
     $init = $params['data']['init'] ? $params['data']['init'] : '';
     $params['breakpoint'] = isset($params['breakpoint']) ? $params['breakpoint'] : 20;
     $params['limitmax'] = $params['limitmax'] ? $params['limitmax'] : '';
     $extendvalue = $params['extendvalue'] ? $params['extendvalue'] : '';
     $object = $params['object'];
     if (strpos($params['object'], '@') !== false) {
         list($object, $app_id) = explode('@', $params['object']);
         $params['object'] = $object;
     } elseif ($params['app']) {
         $app_id = $params['app'];
     } else {
         throw new \InvalidArgumentException('missing app argument in typeo of object input tag in ' . __FILE__ . ' on line ' . __LINE__ . 'detail:' . var_export($params, 1));
     }
     $app = app::get($app_id);
     $o = $app->model($object);
     $dbschema = $o->get_schema();
     $params['app_id'] = $app_id;
     if (isset($params['filter'])) {
         if (!is_array($params['filter'])) {
             parse_str($params['filter'], $params['filter']);
         }
     }
     $params['domid'] = substr(md5(uniqid()), 0, 6);
     $key = $params['key'] ? $params['key'] : $dbschema['idColumn'];
     $textcol = $params['textcol'] ? $params['textcol'] : $dbschema['textColumn'];
     //显示列 可以多列显示 不完全修改 。。。。。。。
     $textcol = explode(',', $textcol);
     $_textcol = $textcol;
     $textcol = $textcol[0];
     $tmp_filter = $params['filter'] ? $params['filter'] : null;
     $count = $o->count($tmp_filter);
     if ($count <= $params['breakpoint'] && !$params['multiple'] && $params['select'] != 'checkbox') {
         if (strpos($textcol, '@') === false) {
             $list = $o->getList($key . ',' . $textcol, $tmp_filter);
             if (!$list[0]) {
                 $type = array();
             }
             foreach ($list as $row) {
                 $label = $row[$textcol];
                 if (!$label && method_exists($o, 'title_modifier')) {
                     $label = $o->title_modifier($row[$key]);
                 }
                 $type[$row[$key]] = $label;
             }
         } else {
             list($name, $table, $app_id) = explode('@', $textcol);
             $app = $app_id ? app::get($app_id) : $app;
             $mdl = $app->model($table);
             $list = $o->getList($key, $tmp_filter);
             foreach ($list as $row) {
                 $tmp_row = $mdl->getList($name, array($mdl->idColumn => $row[$key]), 0, 1);
                 $label = $tmp_row[0][$name];
                 if (!$label && method_exists($o, 'title_modifier')) {
                     $label = $o->title_modifier($row[$key]);
                 }
                 $type[$row[$key]] = $label;
             }
         }
         $tmp_params['name'] = $params['name'];
         $tmp_params['value'] = $params['value'];
         $tmp_params['type'] = $type;
         if ($callback) {
             $tmp_params['onchange'] = $callback . '(this)';
         }
         $str_filter = view::ui()->input($tmp_params);
         unset($tmp_params);
         return $str_filter;
     }
     $params['idcol'] = $keycol['keycol'] = $key;
     $params['textcol'] = implode(',', $_textcol);
     $params['_textcol'] = $_textcol;
     if ($params['value']) {
         if (strpos($params['view'], ':') !== false) {
             list($view_app, $view) = explode(':', $params['view']);
             $params['view_app'] = $view_app;
             $params['view'] = $view;
         }
         if (is_string($params['value'])) {
             $params['value'] = explode(',', $params['value']);
         }
         $params['items'] =& $o->getList('*', array($key => $params['value']), 0, -1);
         //过滤不存在的值
         //某些数据被添加后 可能原表数据已删除,但此处value中还存在。
         $_params_items_row_key = array();
         foreach ($params['items'] as $k => $_params_items_row) {
             $_params_items_row_key[] = $_params_items_row[$key];
             if ($extendvalue) {
                 $params['items'][$k]['extendvalue'] = $extendvalue[$_params_items_row[$key]];
             }
         }
         $params['value'] = implode(',', $_params_items_row_key);
     }
     if (isset($params['multiple']) && $params['multiple']) {
         if (isset($params['items']) && count($params['items'])) {
             $params['display_datarow'] = 'true';
         }
//.........这里部分代码省略.........
开发者ID:453111208,项目名称:bbc,代码行数:101,代码来源:input.php

示例15: main

 function main($object_name, $app, $filter = null, $cusrender = null)
 {
     if (strpos($_GET['object'], '@') !== false) {
         $tmp = explode('@', $object_name);
         $app = app::get($tmp[1]);
         $object_name = $tmp[0];
     }
     $object = $app->model($object_name);
     $datatypes = kernel::single('base_db_datatype_manage')->load();
     $this->dbschema = $object->get_schema();
     $finder_id = $_GET['_finder']['finder_id'];
     foreach (kernel::servicelist('extend_filter_' . get_class($object)) as $extend_filter) {
         $colums = $extend_filter->get_extend_colums($this->finder_aliasname);
         if ($colums[$object_name]) {
             $this->dbschema['columns'] = array_merge((array) $this->dbschema['columns'], (array) $colums[$object_name]['columns']);
         }
     }
     foreach ($this->dbschema['columns'] as $c => $v) {
         if (!$v['filtertype']) {
             continue;
         }
         if (isset($filter[$c])) {
             continue;
         }
         if (!is_array($v['type'])) {
             if (strpos($v['type'], 'decimal') !== false && $v['filtertype'] == 'number') {
                 $v['type'] = 'number';
             }
         }
         $columns[$c] = $v;
         if (!is_array($v['type']) && $v['type'] != 'bool' && isset($datatypes[$v['type']]) && isset($datatypes[$v['type']]['searchparams'])) {
             $addon = '<select search="1" name="_' . $c . '_search" class="x-input-select  inputstyle">';
             foreach ($datatypes[$v['type']]['searchparams'] as $n => $t) {
                 $addon .= "<option value='{$n}'>{$t}</option>";
             }
             $addon .= '</select>';
         } else {
             if ($v['type'] != 'bool') {
                 $addon = app::get('desktop')->_('是');
             } else {
                 $addon = '';
             }
         }
         $columns[$c]['addon'] = $addon;
         if ($v['type'] == 'last_modify') {
             $v['type'] = 'time';
         }
         $params = array('type' => $v['type'], 'name' => $v['finder_filter_name'] ? $v['finder_filter_name'] : $c);
         if ($v['type'] == 'bool' && $v['default']) {
             $params = array_merge(array('value' => $v['default']), $params);
         }
         if ($this->name_prefix) {
             $params['name'] = $this->name_prefix . '[' . $params['name'] . ']';
         }
         if ($v['type'] == 'region') {
             $params['app'] = 'ectools';
         }
         if ($v['default_value']) {
             $params['value'] = $v['default_value'];
         }
         $inputer = view::ui()->input($params);
         $columns[$c]['inputer'] = $inputer;
     }
     if ($cusrender) {
         return array('filter_cols' => $columns, 'filter_datatypes' => $datatypes);
     }
     if ($object->has_tag) {
         $pagedata['app_id'] = $app->app_id;
         $pagedata['tag_type'] = $object_name;
         $tag_inputer = view::make('desktop/finder/tag_inputer.html', $pagedata)->render();
         $columns['tag'] = array('filtertype' => true, 'filterdefault' => true, 'label' => app::get('desktop')->_('标签'), 'inputer' => $tag_inputer);
     }
     $pagedata['columns'] = $columns;
     $pagedata['datatypes'] = $datatypes;
     $pagedata['finder_id'] = $finder_id;
     return view::make('desktop/finder/finder_filter.html', $pagedata)->render();
 }
开发者ID:453111208,项目名称:bbc,代码行数:77,代码来源:render.php


注:本文中的view::ui方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。