public function display($tpl = '') { $P = $this->vhook_tpl . $tpl . '.php'; if (file_exists($P)) { parent::display($P); } }
public function display() { $this->assign('meta_title', $this->meta_title); $this->assign('post_url', $this->post_url); $this->assign('form_data', $this->form_data); $this->assign('form_items', $this->form_items); $this->assign('is_ajax', $this->is_ajax); parent::display($this->template); }
protected function display($templateFile = '', $charset = '', $contentType = '', $content = '', $prefix = '') { if (trim($_REQUEST['ajax']) && $this->data) { $dat = $this->data; isset($this->navs) && ($dat['navs'] = $this->navs); //$dat = array_merge((array)$dat,get_object_vars($this) ?: []); $this->success($dat); } else { parent::display($templateFile, $charset, $contentType, $content, $prefix); } }
public function display($templateFile = '', $charset = '', $contentType = '', $content = '', $prefix = '') { $this->assign('DEBUG', C('DEBUG')); $this->assign('BEAM', C('BEAM')); $this->assign('assets_path', C('DEBUG') ? '/src' : '/statics'); $encodeShopId = $this->shop['shop_id']; $shopId = \Common\Lib\Idhandler::decode($encodeShopId); $this->assign('shop_id', $shopId); $this->assign('shop_is_closed', $this->shop['is_closed']); $this->assign('encode_shop_id', $encodeShopId); $this->assign('default_image', C('DEFAULT_IMAGE')); parent::display($templateFile, $charset, $contentType, $content, $prefix); }
public function display($templateFile = '', $charset = '', $contentType = '', $content = '', $prefix = '') { parent::display($this->parseTemplate($templateFile), $charset, $contentType); }
public function display() { //额外已经构造好的表单项目与单个组装的的表单项目进行合并 $this->_form_items = array_merge($this->_form_items, $this->_extra_items); //编译表单值 if ($this->_form_data) { foreach ($this->_form_items as &$item) { if ($this->_form_data[$item['name']]) { $item['value'] = $this->_form_data[$item['name']]; } } } $this->assign('title', $this->_title); $this->assign('tab_list', $this->_tab_list); $this->assign('tab_url', $this->_tab_url); $this->assign('current_tab', $this->_current_tab); $this->assign('url', $this->_url); $this->assign('form_items', $this->_form_items); $this->assign('extra_html', $this->_extra_html); parent::display($this->_template); }
/** * 显示页面 * @author jry <*****@*****.**> */ public function display() { //编译data_list中的值 foreach ($this->_table_data_list as &$data) { //编译表格右侧按钮 foreach ($this->_right_button_list as $right_button) { //禁用按钮比较特殊,它需要根据数据当前状态判断是显示禁用还是启用 if ($right_button['type'] === 'forbid') { $right_button = $right_button[$data['status']]; } //将约定的标记[__data_id__]替换成真实的数据ID $right_button['href'] = preg_replace('/\\[__data_id__\\]/i', $data[$this->_table_data_list_key], $right_button['href']); //编译按钮属性 $right_button['attribute'] = $this->compileHtmlAttr($right_button); $data['right_button'] .= '<a ' . $right_button['attribute'] . '>' . $right_button['title'] . '</a> '; } //根据表格标题字段指定类型编译列表数据 foreach ($this->_table_column_list as &$column) { switch ($column['type']) { case 'status': switch ($data[$column['name']]) { case '-1': $data[$column['name']] = '<i class="fa fa-trash" style="color:red"></i>'; break; case '0': $data[$column['name']] = '<i class="fa fa-ban" style="color:red"></i>'; break; case '1': $data[$column['name']] = '<i class="fa fa-check" style="color:green"></i>'; break; } break; case 'icon': $data[$column['name']] = '<i class="' . $data[$field['name']] . '"></i>'; break; case 'date': $data[$column['name']] = time_format($data[$field['name']], 'Y-m-d'); break; case 'time': $data[$column['name']] = time_format($data[$field['name']]); break; case 'image': $data[$column['name']] = '<img src="' . get_cover($data[$field['name']]) . '">'; break; case 'type': $form_item_type = C('FORM_ITEM_TYPE'); $data[$column['name']] = $form_item_type[$data[$column['name']]][0]; break; } } } //编译top_button_list中的HTML属性 foreach ($this->_top_button_list as &$button) { $button['attribute'] = $this->compileHtmlAttr($button); } $this->assign('meta_title', $this->_meta_title); //页面标题 $this->assign('top_button_list', $this->_top_button_list); //顶部工具栏按钮 $this->assign('search', $this->_search); //搜索配置 $this->assign('tab_nav', $this->_tab_nav); //页面Tab导航 $this->assign('table_column_list', $this->_table_column_list); //表格的列 $this->assign('table_data_list', $this->_table_data_list); //表格数据 $this->assign('table_data_list_key', $this->_table_data_list_key); //表格数据主键字段名称 $this->assign('table_data_page', $this->_table_data_page); //表示个数据分页 $this->assign('right_button_list', $this->_right_button_list); //表格右侧操作按钮 $this->assign('extra_html', $this->_extra_html); //额外HTML代码 parent::display($this->_template); }
protected function display($templateFile = '', $charset = '', $contentType = '', $content = '', $prefix = '') { parent::display($this->parseTmplateName($templateFile), $charset, $contentType, $content, $prefix); }
public function display() { foreach ($this->tbody as $key => &$value) { if (count($this->rightbtns) != 0) { $value['rightbtns'] = $this->rightbtns; foreach ($value['rightbtns'] as $key => &$btn) { $btn['href'] = preg_replace('/__value__id_/', $value[$this->main_key], $btn['href']); } } } foreach ($this->tbody as $key => &$value) { foreach ($this->tbody_list as $key => $list) { switch ($list['name']) { case 'c_time': $value[$list['name']] = dateFormat($value[$list['name']]); break; case 'u_time': $value[$list['name']] = dateFormat($value[$list['name']]); break; case 'status': if ($value[$list['name']] == 1) { $value[$list['name']] = '<i class="fa fa-check text-navy"></i>'; } else { $value[$list['name']] = '<i class="fa fa-ban text-warning"></i>'; } break; case 'icon': $value[$list['name']] = '<i class="fa ' . $value[$list['name']] . '"></i>'; break; } } } $this->assign('meta_title', $this->meta_title); $this->assign('is_ajax', $this->is_ajax); $this->assign('tbody', $this->tbody); $this->assign('tbody_list', $this->tbody_list); $this->assign('thead', $this->thead); $this->assign('rightbtns', $this->rightbtns); $this->assign('topbtns', $this->topbtns); $this->assign('page_list', $this->page_list); parent::display($this->template); }
/** * 显示页面 * @author jry <*****@*****.**> */ public function display() { //编译data_list中的值 foreach ($this->_table_data_list as &$data) { //编译表格右侧按钮 if ($this->_right_button_list) { foreach ($this->_right_button_list as $right_button) { //禁用按钮与隐藏比较特殊,它需要根据数据当前状态判断是显示禁用还是启用 if ($right_button['type'] === 'forbid' || $right_button['type'] === 'hide') { $right_button = $right_button[$data['status']]; } //将约定的标记__data_id__替换成真实的数据ID $right_button['href'] = preg_replace('/__data_id__/i', $data[$this->_table_data_list_key], $right_button['href']); //编译按钮属性 $right_button['attribute'] = $this->compileHtmlAttr($right_button); $data['right_button'] .= '<a ' . $right_button['attribute'] . '>' . $right_button['title'] . '</a> '; } } //根据表格标题字段指定类型编译列表数据 foreach ($this->_table_column_list as &$column) { switch ($column['type']) { case 'status': switch ($data[$column['name']]) { case '-1': $data[$column['name']] = '<i class="fa fa-trash text-danger"></i>'; break; case '0': $data[$column['name']] = '<i class="fa fa-ban text-danger"></i>'; break; case '1': $data[$column['name']] = '<i class="fa fa-check text-success"></i>'; break; case '2': $data[$column['name']] = '<i class="fa fa-eye-slash text-warning"></i>'; break; } break; case 'icon': $data[$column['name']] = '<i class="' . $data[$column['name']] . '"></i>'; break; case 'date': $data[$column['name']] = time_format($data[$column['name']], 'Y-m-d'); break; case 'time': $data[$column['name']] = time_format($data[$column['name']]); break; case 'picture': $data[$column['name']] = '<img src="' . get_cover($data[$column['name']]) . '">'; break; case 'type': $form_item_type = C('FORM_ITEM_TYPE'); $data[$column['name']] = $form_item_type[$data[$column['name']]][0]; break; } } /** * 修改列表数据 * 有时候列表数据需要在最终输出前做一次小的修改 * 比如管理员列表ID为1的超级管理员右侧编辑按钮不显示删除 */ if ($this->_alter_data_list) { foreach ($this->_alter_data_list as $alter) { if ($data[$alter['condition']['key']] === $alter['condition']['value']) { $data = array_merge($data, $alter['alter_data']); } } } } //编译top_button_list中的HTML属性 if ($this->_top_button_list) { foreach ($this->_top_button_list as &$button) { $button['attribute'] = $this->compileHtmlAttr($button); } } $this->assign('meta_title', $this->_meta_title); //页面标题 $this->assign('top_button_list', $this->_top_button_list); //顶部工具栏按钮 $this->assign('search', $this->_search); //搜索配置 $this->assign('tab_nav', $this->_tab_nav); //页面Tab导航 $this->assign('table_column_list', $this->_table_column_list); //表格的列 $this->assign('table_data_list', $this->_table_data_list); //表格数据 $this->assign('table_data_list_key', $this->_table_data_list_key); //表格数据主键字段名称 $this->assign('table_data_page', $this->_table_data_page); //表示个数据分页 $this->assign('right_button_list', $this->_right_button_list); //表格右侧操作按钮 $this->assign('alter_data_list', $this->_alter_data_list); //表格数据列表重新修改的项目 $this->assign('extra_html', $this->_extra_html); //额外HTML代码 parent::display($this->_template); }
/** * 重写display方法,添加视图输出前标签位 */ protected function display($templateFile = '', $charset = '', $contentType = '', $content = '', $prefix = '') { Hook::listen('before_view', $this); return parent::display($templateFile, $charset, $contentType, $content, $prefix); }
public function display() { //编译button_list中的HTML属性 foreach ($this->_button_list as &$button) { $button['attr'] = $this->compileHtmlAttr($button['attr']); } //编译data_list中的值 foreach ($this->_data_list as &$data) { //编译表格右侧按钮 foreach ($this->_right_button_list as $right_button) { switch ($right_button['type']) { case 'edit': $right_button['link'] = '<a href="' . U($right_button['url'], array('id' => $data[$this->_data_list_primary_key])) . '">编辑</a> '; break; case 'forbid': switch ($data['status']) { case '1': $right_button['link'] = ' <a href="' . U(MODULE_NAME . '/' . CONTROLLER_NAME . '/setStatus', array('status' => 'forbid', 'model' => $right_button['model'], 'ids' => $data[$this->_data_list_primary_key])) . '" class="ajax-get confirm">禁用</a> '; break; case '0': $right_button['link'] = ' <a href="' . U(MODULE_NAME . '/' . CONTROLLER_NAME . '/setStatus', array('status' => 'resume', 'model' => $right_button['model'], 'ids' => $data[$this->_data_list_primary_key])) . '" class="ajax-get confirm">启用</a> '; break; case '-1': $right_button['link'] = ' <a href="' . U(MODULE_NAME . '/' . CONTROLLER_NAME . '/setStatus', array('status' => 'restore', 'model' => $right_button['model'], 'ids' => $data[$this->_data_list_primary_key])) . '" class="ajax-get confirm">还原</a> '; break; } break; case 'delete': $right_button['link'] = '<a href="' . U(MODULE_NAME . '/' . CONTROLLER_NAME . '/setStatus', array('status' => 'delete', 'model' => $right_button['model'], 'ids' => $data[$this->_data_list_primary_key])) . '" class="ajax-get confirm">删除</a> '; break; case 'recycle': $right_button['link'] = '<a href="' . U(MODULE_NAME . '/' . CONTROLLER_NAME . '/setStatus', array('status' => 'recycle', 'ids' => $data[$this->_data_list_primary_key])) . '" class="ajax-get confirm">回收</a> '; break; case 'self': if (!$right_button['attr']['addon']) { $right_button['attr']['href'] = U($right_button['attr']['href'] . $data[$this->_data_list_primary_key]); } else { $right_button['attr']['href'] = addons_url($right_button['attr']['href'] . '/id/' . $data[$this->_data_list_primary_key]); } $attr = $this->compileHtmlAttr($right_button['attr']); $right_button['link'] = '<a ' . $attr . '>' . $right_button['attr']['title'] . '</a> '; break; } $data['right_button'] .= $right_button['link']; } //根据表格标题字段指定类型编译列表数据 foreach ($this->_field_list as &$field) { switch ($field['type']) { case 'status': switch ($data[$field['name']]) { case '-1': $data[$field['name']] = '<i class="glyphicon glyphicon-trash" style="color:red"></i>'; break; case '0': $data[$field['name']] = '<i class="glyphicon glyphicon-ban-circle" style="color:red"></i>'; break; case '1': $data[$field['name']] = '<i class="glyphicon glyphicon-ok" style="color:green"></i>'; break; } break; case 'icon': $data[$field['name']] = '<i class="' . $data[$field['name']] . '"></i>'; break; case 'date': $data[$field['name']] = time_format($data[$field['name']], 'Y-m-d'); break; case 'time': $data[$field['name']] = time_format($data[$field['name']]); break; case 'image': $data[$field['name']] = '<img src="' . get_cover($data[$field['name']]) . '">'; break; case 'type': $form_item_type = C('FORM_ITEM_TYPE'); $data[$field['name']] = $form_item_type[$data[$field['name']]]; break; } } } $this->assign('title', $this->_title); $this->assign('button_list', $this->_button_list); $this->assign('search', $this->_search); $this->assign('tab_list', $this->_tab_list); $this->assign('tab_url', $this->_tab_url); $this->assign('current_tab', $this->_current_tab); $this->assign('field_list', $this->_field_list); $this->assign('data_list', $this->_data_list); $this->assign('data_list_primary_key', $this->_data_list_primary_key); $this->assign('right_button_list', $this->_right_button_list); $this->assign('page', $this->_page); $this->assign('extra_html', $this->_extra_html); parent::display($this->_template); }
public function display() { $this->assign('meta_title', $this->meta_title); $this->assign('post_url', $this->post_url); $this->assign('is_ajax', $this->is_ajax); $this->assign('set_coulmn', $this->set_coulmn); $this->assign('page_list', $this->page_list); $this->assign('page_items', $this->page_items); // var_dump($this);打印查看测试 parent::display($this->template); }
/** * 显示页面 * @author jry <*****@*****.**> */ public function display() { //额外已经构造好的表单项目与单个组装的的表单项目进行合并 $this->_form_items = array_merge($this->_form_items, $this->_extra_items); //编译表单值 if ($this->_form_data) { foreach ($this->_form_items as &$item) { if ($this->_form_data[$item['name']]) { $item['value'] = $this->_form_data[$item['name']]; } } } $this->assign('meta_title', $this->_meta_title); //页面标题 $this->assign('tab_nav', $this->_tab_nav); //页面Tab导航 $this->assign('post_url', $this->_post_url); //标题提交地址 $this->assign('form_items', $this->_form_items); //表单项目 $this->assign('ajax_submit', $this->_ajax_submit); //额外HTML代码 $this->assign('extra_html', $this->_extra_html); //是否ajax提交 parent::display($this->_template); }