Example #1
0
 function detail_info($param_id)
 {
     //获取该项记录集合
     $users = $this->app->model('users');
     $roles = $this->app->model('roles');
     $workgroup = $roles->getList('*');
     $sdf_users = $users->dump($param_id);
     if ($_POST) {
         $_POST['pam_account']['account_id'] = $param_id;
         if ($sdf_users['super'] == 1) {
             $users->editUser($_POST);
             //echo "修改成功";
         } elseif ($_POST['super'] == 0 && $_POST['role']) {
             foreach ($_POST['role'] as $roles) {
                 $_POST['roles'][] = array('role_id' => $roles);
             }
             $users->editUser($_POST);
             $users->save_per($_POST);
         } else {
             echo "<script>alert('请至少选择一个工作组')</script>";
         }
     }
     //返回无内容信息
     if (empty($sdf_users)) {
         return '无内容';
     }
     $hasrole = $this->app->model('hasrole');
     foreach ($workgroup as $key => $group) {
         $rolesData = $hasrole->getList('*', array('user_id' => $param_id, 'role_id' => $group['role_id']));
         if ($rolesData) {
             $check_id[] = $group['role_id'];
             $workgroup[$key]['checked'] = "true";
         } else {
             $workgroup[$key]['checked'] = "false";
         }
     }
     $ui = new base_component_ui($this);
     $html .= $ui->form_start();
     //foreach($arrGroup as  $arrVal){  $html .= $ui->form_input($arrVal); }
     $render = $this->app->render();
     $render->pagedata['workgroup'] = $workgroup;
     $render->pagedata['account_id'] = $param_id;
     $render->pagedata['name'] = $sdf_users['name'];
     $render->pagedata['super'] = $sdf_users['super'];
     $render->pagedata['status'] = $sdf_users['status'];
     if (!$sdf_users['super']) {
         $render->pagedata['per'] = $users->detail_per($check_id, $param_id);
     }
     $html .= $render->fetch('users/users_detail.html');
     $html .= $ui->form_end();
     return $html;
 }
Example #2
0
 public function input_element($type, $params = false)
 {
     if (!self::$inputer) {
         if (vmc::is_online()) {
             self::$inputer = vmc::servicelist('html_input');
         } else {
             self::$inputer = array('base_view_input' => new base_view_input());
         }
     }
     if ($params === false) {
         foreach (self::$inputer as $inputer) {
             $inputer->app = $this->app;
             if (method_exists($inputer, 'input_' . $type)) {
                 return true;
             }
         }
     } else {
         foreach (self::$inputer as $inputer) {
             $inputer->app = $this->app;
             if (method_exists($inputer, 'input_' . $type)) {
                 $html = $inputer->{'input_' . $type}($params);
             }
         }
         return $html;
     }
     return false;
 }
Example #3
0
 function chkpassword()
 {
     $account_id = $this->user->get_id();
     $users = $this->app->model('users');
     $sdf = $users->dump($account_id, '*', array(':account@pam' => array('*'), 'roles' => array('*')));
     $old_password = $sdf['account']['login_password'];
     if ($_POST) {
         $this->begin();
         if (md5(trim($_POST['old_login_password'])) != $old_password) {
             //echo "旧密码不正确";
             $this->end(false, '旧密码不正确');
         } elseif ($_POST['new_login_password'] != $_POST[':account@pam']['login_password']) {
             //echo "两次密码不一致";
             $this->end(false, '两次密码不一致');
         } else {
             $_POST['pam_account']['account_id'] = $account_id;
             $_POST['pam_account']['login_password'] = md5(trim($_POST['new_login_password']));
             $users->save($_POST);
             //echo "密码修改成功";
             $this->end(true, '密码修改成功');
         }
     }
     $ui = new base_component_ui($this);
     $arrGroup = array(array('title' => '旧密码', 'type' => 'password', 'name' => 'old_login_password', 'required' => true), array('title' => '新密码', 'type' => 'password', 'name' => 'new_login_password', 'required' => true), array('title' => '再次输入新密码', 'type' => 'password', 'name' => ':account@pam[login_password]', 'required' => true));
     $html .= $ui->form_start();
     foreach ($arrGroup as $arrVal) {
         $html .= $ui->form_input($arrVal);
     }
     $html .= $ui->form_end();
     echo $html;
     //return $html;
 }
Example #4
0
 public function detail_log($rule_id)
 {
     $render = $this->app->render();
     $gcruleMdl = $this->app->model('member_giftcardrule');
     $giftcard = $gcruleMdl->getList('*', array('rule_id' => $rule_id));
     $giftcard = $giftcard[0];
     //日志分页
     $page = $_POST['page'] ? $_POST['page'] : 1;
     $pageLimit = 10;
     $glog = $gcruleMdl->getGiftcardLogList($rule_id, $page - 1, $pageLimit);
     $ui = new base_component_ui($this->app);
     $render->pagedata['gclogList'] = $glog;
     $render->pagedata['result'] = array('SUCCESS' => app::get('b2c')->_('成功'), 'FAILURE' => app::get('b2c')->_('失败'));
     $pager = array('current' => $page, 'total' => ceil($glog['page'] / $pageLimit), 'link' => 'javascript:W.page(\'index.php?app=b2c&ctl=admin_member_giftcardrule&act=index&_finder[finder_id]=' . $_GET['_finder']['finder_id'] . '&action=detail&finder_id=' . $_GET['_finder']['finder_id'] . '&id=' . $rule_id . '&finderview=detail_log&finder_name=' . $_GET['_finder']['finder_id'] . '\', {update:$E(\'.subtableform\').parentNode, method:\'post\', data:\'&page=%d\'});');
     $render->pagedata['pager'] = $ui->pager($pager);
     $render->pagedata['pagestart'] = ($page - 1) * $pageLimit;
     return $render->fetch('admin/member/giftcard_info.html', $this->app->app_id);
 }
Example #5
0
 function input_siteimage($params)
 {
     $ui = new base_component_ui($this);
     $domid = $ui->new_dom_id();
     $input_name = $params['name'];
     $input_value = $params['value'];
     if ($input_value) {
         $image_url = base_storager::image_path($input_value);
     }
     $render = app::get('seller')->render();
     $render->pagedata = $params;
     $render->pagedata['id'] = $domid;
     $render->pagedata['name'] = $input_name;
     $render->pagedata['url'] = $image_url;
     $render->pagedata['image_id'] = $input_value;
     $render->pagedata['tag'] = $params['tag'];
     return $render->fetch('ui/input_image_seller.html');
 }
Example #6
0
 function block_help($params, $content, &$template_object)
 {
     if (null !== $content) {
         $help_types = array('info' => array('size' => 18, 'icon' => app::get('desktop')->res_url . '/tips_info.gif'), 'dialog' => array('size' => 18, 'icon' => app::get('desktop')->res_url . '/tips_info.gif', 'dialog' => 1), 'link' => array('size' => 15, 'icon' => app::get('desktop')->res_url . '/tips_help.gif'), 'link-mid' => array('size' => 14, 'icon' => app::get('desktop')->res_url . '/tips_help_mid.gif'), 'link-small' => array('size' => 12, 'icon' => app::get('desktop')->res_url . '/tips_help_small.gif'));
         $params['dom_id'] = base_component_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['info'];
         $vars = $template_object->_vars;
         unset($template_object->_vars['docid']);
         //$template_object->_vars = array_merge($params,$vars);
         $template_object->_vars = $params;
         $tmp = $template_object->_fetch_compile_include('desktop', 'helper.html');
         $template_object->_vars = $vars;
         return $tmp;
     }
 }
Example #7
0
 function main($object_name, $app, $filter = null, $controller = 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);
     $ui = new base_component_ui($this->controller, $app);
     require APP_DIR . '/base/datatypes.php';
     $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>';
         } elseif ($v['type'] == 'skunum') {
             $addon = '<select search="1" name="_' . $c . '_search" class="x-input-select  inputstyle">';
             $__select = array('nequal' => app::get('base')->_('='), 'than' => app::get('base')->_('>'), 'lthan' => app::get('base')->_('<'));
             foreach ($__select 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' => $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';
         }
         $inputer = $ui->input($params);
         $columns[$c]['inputer'] = $inputer;
     }
     if ($cusrender) {
         return array('filter_cols' => $columns, 'filter_datatypes' => $datatypes);
     }
     $render = new base_render(app::get('desktop'));
     if ($object->has_tag) {
         $render->pagedata['app_id'] = $app->app_id;
         $render->pagedata['tag_type'] = $object_name;
         $tag_inputer = $render->fetch('finder/tag_inputer.html');
         $columns['tag'] = array('filtertype' => true, 'filterdefault' => true, 'label' => app::get('desktop')->_('标签'), 'inputer' => $tag_inputer);
     }
     if (is_null($this->finder)) {
         $render->pagedata['panel_id'] = '_c';
     } else {
         $render->pagedata['panel_id'] = $this->finder->getId();
     }
     $render->pagedata['columns'] = $columns;
     $render->pagedata['datatypes'] = $datatypes;
     $render->pagedata['finder_id'] = $finder_id;
     return $render->display($this->finder->getFile(), $app->app_id, true);
 }
Example #8
0
 function create_remove()
 {
     $ui = new base_component_ui($this);
     return "<span style='margin:0 5px;cursor:pointer;float:left' onclick=\"\$(this).getParent('li').remove();\">" . $ui->img(array('src' => 'bundle/delecate.gif', 'app' => 'desktop')) . "</span>";
 }
Example #9
0
    /**
     * 重新生成图片入口
     * @param nulll
     * @return string html js刷新finder
     */
    function rebuild()
    {
        $ui = new base_component_ui($this);
        if ($_POST['size']) {
            $queue = app::get('base')->model('queue');
            parse_str($_POST['filter'], $filter);
            $data = array('queue_title' => app::get('image')->_('重新生成图片'), 'start_time' => time(), 'params' => array('filter' => $filter, 'watermark' => $_POST['watermark'], 'size' => $_POST['size'], 'queue_time' => time()), 'worker' => 'image_rebuild.run');
            $queue->insert($data);
            header('Content-Type:text/jcmd; charset=utf-8');
            echo '{success:"' . app::get('image')->_('执行成功') . '"}';
        } else {
            $html .= $ui->form_start(array('id' => 'rebuild_form', 'method' => 'post'));
            $size = array('L' => app::get('image')->_('大图'), 'M' => app::get('image')->_('中图'), 'S' => app::get('image')->_('小图'));
            foreach ($size as $k => $v) {
                $html .= $ui->form_input(array('title' => app::get('image')->_('生成') . $v, 'type' => 'checkbox', 'name' => 'size[]', 'value' => $k, 'checked' => 'checked'));
            }
            $html .= '<tr><td colspan="2" style="height:1px;background:#ccc;overflow:hidden;padding:0"></td><tr>';
            $filter = $_POST;
            unset($filter['_finder']);
            $filter = htmlspecialchars(utils::http_build_query($filter));
            $html .= $ui->form_input(array('title' => app::get('image')->_('使用水印'), 'type' => 'bool', 'name' => 'watermark', 'value' => 1));
            $html .= '<tr><td><input type="hidden" name="filter" value="' . $filter . '" /></td></tr>';
            $html .= $ui->form_end();
            echo $html;
            echo <<<EOF
<script>
   \$('rebuild_form').store('target',{
        
        onComplete:function(){
                 \$('rebuild_form').getParent('.dialog').retrieve('instance').close();
             
        }
   
   });

</script>
EOF;
        }
    }
Example #10
0
 public function pagination($current, $count, $get)
 {
     //本控制器公共分页函数
     $app = app::get('b2c');
     $render = $app->render();
     $ui = new base_component_ui($this->app);
     //unset($get['singlepage']);
     $link = 'index.php?app=b2c&ctl=admin_member&act=ajax_html&id=' . $get['id'] . '&finder_act=' . $get['page'] . '&' . $get['page'] . '=%d';
     $this->pagedata['pager'] = $ui->pager(array('current' => $current, 'total' => ceil($count / $this->pagelimit), 'link' => $link));
 }
Example #11
0
 function chkpassword()
 {
     $account_id = $this->user->get_id();
     $users = $this->app->model('users');
     $sdf = $users->dump($account_id, '*', array(':account@pam' => array('*'), 'roles' => array('*')));
     $old_password = $sdf['account']['login_password'];
     $filter['account_id'] = $account_id;
     $filter['account_type'] = pam_account::get_account_type($this->app->app_id);
     $use_pass_data['login_name'] = $sdf['account']['login_name'];
     $use_pass_data['createtime'] = $sdf['account']['createtime'];
     $filter['login_password'] = pam_encrypt::get_encrypted_password(trim($_POST['old_login_password']), pam_account::get_account_type($this->app->app_id), $use_pass_data);
     $pass_row = app::get('pam')->model('account')->getList('account_id', $filter);
     if ($_POST) {
         $this->begin();
         if (!$pass_row) {
             $this->end(false, app::get('desktop')->_('原始密码不正确'));
         } elseif (!(strlen($_POST['new_login_password']) >= 6 && preg_match("/\\d+/", $_POST['new_login_password']) && preg_match("/[a-zA-Z]+/", $_POST['new_login_password']))) {
             $this->end(false, app::get('desktop')->_('密码必须同时包含字母及数字且长度不能小于6!'));
         } elseif ($_POST['new_login_password'] != $_POST[':account@pam']['login_password']) {
             $this->end(false, app::get('desktop')->_('两次密码不一致'));
         } elseif ($sdf['account']['login_name'] == $_POST['new_login_password']) {
             $this->end(false, app::get('desktop')->_('用户名与密码不能相同'));
         } else {
             $_POST['pam_account']['account_id'] = $account_id;
             $_POST['pam_account']['login_password'] = pam_encrypt::get_encrypted_password(trim($_POST['new_login_password']), pam_account::get_account_type($this->app->app_id), $use_pass_data);
             $users->save($_POST);
             $this->end(true, app::get('desktop')->_('密码修改成功'));
         }
     }
     $ui = new base_component_ui($this);
     $arrGroup = array(array('title' => app::get('desktop')->_('原始密码'), 'type' => 'password', 'name' => 'old_login_password', 'required' => true), array('title' => app::get('desktop')->_('新密码'), 'type' => 'password', 'name' => 'new_login_password', 'required' => true), array('title' => app::get('desktop')->_('再次输入新密码'), 'type' => 'password', 'name' => ':account@pam[login_password]', 'required' => true));
     $html .= $ui->form_start(array('method' => 'POST'));
     foreach ($arrGroup as $arrVal) {
         $html .= $ui->form_input($arrVal);
     }
     $html .= $ui->form_end();
     echo $html;
     //return $html;
 }
Example #12
0
 function input_select($params)
 {
     if (is_string($params['options'])) {
         $ui = new base_component_ui($this);
         if (!$params['id']) {
             $params['id'] = $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-input-select inputstyle';
     $value = $params['value'];
     unset($params['value']);
     $html = utils::buildTag($params, 'select', false);
     if (!$params['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' . ($selected ? ' selected="selected"' : '') . ' value="' . htmlspecialchars($k) . '">' . $t_step . htmlspecialchars($item) . '</option>';
     }
     $html .= '</select>';
     return $html . $script;
 }
Example #13
0
 function input_object($params)
 {
     $return_url = $params['return_url'] ? $params['return_url'] : 'index.php?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;
     $extend = $params['extend'] ? $params['extend'] : '';
     $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 {
         $app_id = $this->app->app_id;
     }
     $app = app::get($app_id);
     $o = $app->model($object);
     $render = new base_render(app::get('desktop'));
     $ui = new base_component_ui($app);
     $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 = $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 ($extend) {
                 $params['items'][$k]['extend'] = $extend[$_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';
         }
         $render->pagedata['_input'] = $params;
         return $render->fetch('finder/input.html');
     } else {
         if ($params['value'] && $params['select'] != 'checkbox') {
             $string = $params['items'][0][$textcol];
         } else {
             $string = $params['emptytext'] ? $params['emptytext'] : app::get('desktop')->_('请选择...');
         }
         $str_app = $params['app'];
         unset($params['app']);
         if ($params['data']) {
             $_params = (array) $params['data'];
             unset($params['data']);
             $params = array_merge($params, $_params);
         }
         if ($params['select'] == 'checkbox') {
             if ($params['default_id']) {
                 $params['domid'] = $params['default_id'];
             }
             $params['type'] = 'checkbox';
         } else {
             $id = "handle_" . $params['domid'];
             $params['type'] = 'radio';
             $getdata = '&singleselect=radio';
         }
         if (is_array($params['items'])) {
             foreach ($params['items'] as $key => $item) {
                 $items[$key] = $item[$params['idcol']];
                 $params['items'][$key]['extend'] = $params['extend'][$key];
             }
         }
         $params['return_url'] = urlencode($return_url);
         $vars = $params;
         $vars['items'] = $items;
         $getobject = array('obj_filter' => $vars['obj_filter'], 'filter' => $vars['filter'], 'name' => $vars['name'], 'object' => $vars['object']);
         $getobject = utils::http_build_query($getobject);
         $object = utils::http_build_query($vars);
         //$url = 'index.php?app=desktop&act=alertpages&goto='.urlencode('index.php?app=desktop&ctl=editor&act=finder_common&app_id='.$app_id.'&'.$object.$getdata);
         $url = 'index.php?app=desktop&act=alertpages&goto=' . urlencode('index.php?app=desktop&ctl=editor&act=finder_common&app_id=' . $app_id . '&' . $getobject . $getdata);
         $render->pagedata['string'] = $string;
         $render->pagedata['url'] = $url;
         $render->pagedata['app'] = 'app=' . $str_app;
         $render->pagedata['return_url'] = $return_url;
         $render->pagedata['id'] = $id;
         $render->pagedata['params'] = $params;
         $render->pagedata['object'] = $object;
         $render->pagedata['callback'] = $callback;
         $render->pagedata['init'] = $init;
         return $render->fetch('finder/input_radio.html');
     }
 }
Example #14
0
 function input_goods_select($params)
 {
     $return_url = $params['return_url'] ? $params['return_url'] : 'index.php?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;
     $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 {
         $app_id = $this->app->app_id;
     }
     $app = app::get($app_id);
     $o = $app->model($object);
     $render = new base_render(app::get('b2c'));
     $ui = new base_component_ui($app);
     $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 = $ui->input($tmp_params);
         unset($tmp_params);
         return $str_filter;
     }
     $params['idcol'] = $keycol['keycol'] = $key;
     $params['textcol'] = implode(',', $_textcol);
     $params['_textcol'] = $_textcol;
     unset($params['app']);
     if ($params['data']) {
         $_params = (array) $params['data'];
         unset($params['data']);
         $params = array_merge($params, $_params);
     }
     if (is_array($params['items'])) {
         foreach ($params['items'] as $key => $item) {
             $items[$key] = $item[$params['idcol']];
         }
     }
     $params['return_url'] = urlencode($params['return_url']);
     $vars = $params;
     $vars['items'] = $items;
     $object = utils::http_build_query($vars);
     $url = 'index.php?app=b2c&ctl=admin_goods&act=finder_goods_select';
     $render->pagedata['string'] = $string;
     $render->pagedata['url'] = $url;
     $render->pagedata['return_url'] = $return_url;
     $render->pagedata['id'] = $id;
     $render->pagedata['params'] = $params;
     $render->pagedata['object'] = $object;
     $render->pagedata['callback'] = $callback;
     $render->pagedata['init'] = $init;
     $render->pagedata['value'] = $params['value'];
     /** 得到商品的数量 **/
     if ($params['value']) {
         $arr_values = json_decode($params['value']);
         $render->pagedata['goods_cnt'] = count($arr_values);
     }
     return $render->fetch('admin/goods/input_radio.html');
 }
Example #15
0
    function tag_edit($id)
    {
        $this->url = 'index.php?app=' . $_GET['app'] . '&ctl=' . $_GET['ctl'];
        $render = app::get('desktop')->render();
        //return $render->fetch('admin/tag/detail.html',$this->app->app_id);
        $mdl_tag = app::get('desktop')->model('tag');
        $tag = $mdl_tag->dump($id, '*');
        $ui = new base_component_ui(null, app::get('desktop'));
        $html = $ui->form_start(array('action' => $this->url . '&act=new_mormal_tag' . $ex_p, 'id' => 'tag_form_add', 'method' => 'post'));
        $html .= $ui->form_input(array('title' => app::get('desktop')->_('标签名'), 'name' => 'tag_name', 'value' => $tag['tag_name']));
        $html .= $ui->form_input(array('title' => app::get('desktop')->_('标签备注'), 'name' => 'tag_abbr', 'value' => $tag['tag_abbr']));
        $html .= $ui->form_input(array('title' => app::get('desktop')->_('标签颜色'), 'type' => 'color', 'name' => 'tag_bgcolor', 'value' => $tag['tag_bgcolor']));
        //$html .= $ui->form_input(array('title'=>app::get('desktop')->_('标签字体色'),'type'=>'color','name'=>'tag_fgcolor','value'=>$tag['tag_fgcolor']));
        $html .= '<input type="hidden" name="tag_id" value="' . $id . '"/>';
        $html .= '<input type="hidden" name="app_id" value="' . $tag['app_id'] . '"/>';
        $html .= '<input type="hidden" name="type" value="' . $tag['tag_type'] . '"/>';
        $html .= $ui->form_end();
        echo $html;
        echo <<<EOF
<script>
window.addEvent('domready', function(){
    \$('tag_form_add').store('target',{
        onComplete:function(){
            
           if(window.finderGroup['{$_GET['finder_id']}'])
            window.finderGroup['{$_GET['finder_id']}'].refresh();
            
            if(\$('tag_form_add').getParent('.dialog'))
            \$('tag_form_add').getParent('.dialog').retrieve('instance').close();
        }
    });
});
</script>
EOF;
    }
Example #16
0
File: input.php Project: noikiy/snk
    function input_time($params)
    {
        $name = $params['name'];
        $value = $params['value'];
        $placehoder = $params['placehoder'];
        $id = base_component_ui::new_dom_id();
        if ($value && !strpos($value, ':')) {
            $value = date('Y-m-d H:i', $value);
        }
        $_return = <<<EOF
        <div id="{$id}" class="input-group date">
\t\t\t\t<input type="text" class="form-control" placehoder="{$placehoder}"  name="{$name}" value="{$value}">
\t\t\t\t<span class="input-group-btn">
    \t\t\t\t<button class="btn default date-set" type="button">
                    <i class="fa fa-clock-o"></i>
                    </button>
\t\t\t\t</span>
\t\t</div>
        <script charset="utf-8">
            \$('#{$id}').datetimepicker({
    \t\t\tautoclose: true,
    \t\t\tisRTL: Metronic.isRTL(),
    \t\t\tlanguage:'zh-CN',
    \t\t\tformat: "yyyy-mm-dd hh:ii",
                pickerPosition: (Metronic.isRTL() ? "bottom-right" : "bottom-left")
\t\t});
        </script>
EOF;
        return $_return;
    }
Example #17
0
 function input_object($params)
 {
     $params['breakpoint'] = $params['breakpoint'] ? $params['breakpoint'] : 20;
     $object = $params['object'];
     if (strpos($params['object'], '@') !== false) {
         list($object, $app_id) = explode('@', $params['object']);
     } elseif ($params['app']) {
         $app_id = $params['app'];
     } else {
         $app_id = $this->app->app_id;
     }
     $app = app::get($app_id);
     $o = $app->model($object);
     $render = new base_render(app::get('desktop'));
     $ui = new base_component_ui($app);
     $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'];
     $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);
             foreach ($list as $row) {
                 $type[$row[$key]] = $row[$textcol];
             }
         } 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);
                 $type[$row[$key]] = $tmp_row[0][$name];
             }
         }
         $tmp_params['name'] = $params['name'];
         $tmp_params['type'] = $type;
         $str_filter = $ui->input($tmp_params);
         unset($tmp_params);
         return $str_filter;
     }
     $params['idcol'] = $keycol['keycol'] = $key;
     $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);
     }
     if (isset($params['multiple']) && $params['multiple']) {
         $render->pagedata['_input'] = $params;
         return $render->fetch('finder/input.html');
     } else {
         if ($params['value']) {
             $string = $params['items'][0][$textcol];
         } else {
             $string = $params['emptytext'] ? $params['emptytext'] : '请选择...';
         }
         unset($params['app']);
         if ($params['data']) {
             $_params = (array) $params['data'];
             unset($params['data']);
             $params = array_merge($params, $_params);
         }
         if ($params['select'] == 'checkbox') {
             $params['type'] = 'checkbox';
         } else {
             $id = "handle_" . $params['domid'];
             $params['type'] = 'radio';
             $getdata = '&singleselect=radio';
         }
         if (is_array($params['items'])) {
             foreach ($params['items'] as $key => $item) {
                 $items[$key] = $item[$params['idcol']];
             }
         }
         $vars = $params;
         $vars['items'] = $items;
         $object = http_build_query($vars);
         $url = 'index.php?app=desktop&act=alertpages&goto=' . urlencode('index.php?app=desktop&ctl=editor&act=finder_common&app_id=' . $app_id . '&' . $object . $getdata);
         $render->pagedata['string'] = $string;
         $render->pagedata['url'] = $url;
         $render->pagedata['id'] = $id;
         $render->pagedata['params'] = $params;
         $render->pagedata['object'] = $object;
         return $render->fetch('finder/input_radio.html');
     }
 }
Example #18
0
 public function detail_logs($order_id)
 {
     $render = app::get('base')->render();
     $order = $this->app->model('archive_orders');
     $aOrder = $order->dump($order_id);
     $order = $this->app->model('archive_orders');
     $page = $_POST['page'] ? $_POST['page'] : 1;
     $pageLimit = 10;
     $aLog = $order->getOrderLogList($order_id, $page - 1, $pageLimit);
     $ui = new base_component_ui($this->app);
     $render->pagedata['logs'] = $aLog;
     $render->pagedata['result'] = array('SUCCESS' => app::get('b2c')->_('成功'), 'FAILURE' => app::get('b2c')->_('失败'));
     $pager = array('current' => $page, 'total' => ceil($aLog['page'] / $pageLimit), 'link' => 'javascript:W.page(\'index.php?app=b2c&ctl=admin_archive_order&act=index&_finder[finder_id]=' . $_GET['_finder']['finder_id'] . '&finder_id=' . $_GET['_finder']['finder_id'] . '&id=' . $order_id . '&finderview=detail_logs&finder_name=' . $_GET['_finder']['finder_id'] . '&action=detail&p[0]=_PPP_\', {update:$E(\'.tableform\').parentNode, method:\'post\', data:\'&page=%d\'});', 'token' => '_PPP_');
     $render->pagedata['pager'] = $ui->pager($pager);
     $render->pagedata['pagestart'] = ($page - 1) * $pageLimit;
     return $render->fetch('admin/order/order_logs.html', $this->app->app_id);
 }
Example #19
0
 function gen_form()
 {
     $mem_schema = $this->app->model('members')->_columns();
     $ui = new base_component_ui($this);
     foreach ($this->getList() as $item) {
         $item_schema = $mem_schema[$item['attr_column']];
         if (isset($item_schema)) {
             $title = $item_schema['label'] ? $item_schema['label'] : $item['attr_name'];
             if ($item_schema['sdfpath']) {
                 $a_temp = explode("/", $item_schema['sdfpath']);
                 if (count($a_temp) > 1) {
                     $name = array_shift($a_temp);
                     if (count($a_temp)) {
                         foreach ($a_temp as $value) {
                             $name .= '[' . $value . ']';
                         }
                     }
                 }
             } else {
                 $name = $item['attr_column'];
             }
         } else {
             $title = $item['attr_name'];
             $name = $item['attr_column'];
         }
         $type = $item['attr_type'];
         #地区组件需要传入app
         if ($item['attr_column'] == 'area') {
             $input['app'] = 'ectools';
         }
         if ($item['attr_type'] == 'select' || $item['attr_type'] == 'checkbox') {
             $input['options'] = unserialize($item['attr_option']);
         }
         $input['required'] = $item['attr_required'] == 'true' ? true : false;
         $input['name'] = $name;
         $input['title'] = $title;
         $input['type'] = $type;
         $html .= $ui->form_input($input);
         unset($input);
     }
     return $html;
 }