Skip to content

Commit

Permalink
视图方法添加默认值,解决php7安装报错问题
Browse files Browse the repository at this point in the history
  • Loading branch information
idoubi committed May 21, 2018
1 parent 7ced06f commit 1671e84
Showing 1 changed file with 7 additions and 18 deletions.
25 changes: 7 additions & 18 deletions App/Common/Controller/CommonController.class.php
Expand Up @@ -606,7 +606,7 @@ public function setDeleteMap($map) {
* 添加表单字段
* @author 艾逗笔<765532665@qq.com>
*/
public function addFormField($name, $title, $type, $extra = null) {
public function addFormField($name, $title, $type = 'text', $extra = []) {
if (is_array($name)) {
$this->model['fields'][] = $name;
} else {
Expand Down Expand Up @@ -755,7 +755,7 @@ public function setDeleteSuccessInfo($info) {
* 添加显示项
* @author 艾逗笔<765532665@qq.com>
*/
public function addListItem($name, $title, $format, $extra) {
public function addListItem($name, $title = '', $format = '', $extra = []) {
if (is_array($name)) {
$this->model['lists'][] = $name;
} else {
Expand All @@ -774,7 +774,7 @@ public function addListItem($name, $title, $format, $extra) {
* 添加面包屑
* @author 艾逗笔<765532665@qq.com>
*/
public function addCrumb($title, $url, $class) {
public function addCrumb($title, $url = '', $class = '') {
if (is_array($title)) {
$this->model['crumb'][] = $title;
} else {
Expand All @@ -787,21 +787,16 @@ public function addCrumb($title, $url, $class) {
}
return $this;
}

/**
* 设置面包屑
* @author 艾逗笔<765532665@qq.com>
*/

public function setCrumb($crumb) {
$this->model['crumb'] = $crumb;
return $this;
}

/**
* 添加导航
* @author 艾逗笔<765532665@qq.com>
*/
public function addNav($title, $url, $class) {
public function addNav($title, $url = '', $class = '') {
if (is_array($title)) {
$this->model['nav'][] = $title;
} else {
Expand All @@ -817,7 +812,6 @@ public function addNav($title, $url, $class) {

/**
* 设置导航
* @author 艾逗笔<765532665@qq.com>
*/
public function setNav($nav) {
$this->model['nav'] = $nav;
Expand All @@ -826,9 +820,8 @@ public function setNav($nav) {

/**
* 添加子导航
* @author 艾逗笔<765532665@qq.com>
*/
public function addSubNav($title, $url, $class) {
public function addSubNav($title, $url = '', $class = '') {
if (is_array($title)) {
$this->model['subnav'][] = $title;
} else {
Expand All @@ -844,7 +837,6 @@ public function addSubNav($title, $url, $class) {

/**
* 设置子导航
* @author 艾逗笔<765532665@qq.com>
*/
public function setSubNav($subnav) {
$this->model['subnav'] = $subnav;
Expand All @@ -861,9 +853,8 @@ public function setSideNav($sidenav) {

/**
* 添加操作按钮
* @author 艾逗笔<765532665@qq.com>
*/
public function addButton($title, $url, $class = 'btn btn-primary', $attr = '') {
public function addButton($title, $url = '', $class = 'btn btn-primary', $attr = '') {
if (is_array($title)) {
$this->model['btn'][] = $title;
} else {
Expand All @@ -880,7 +871,6 @@ public function addButton($title, $url, $class = 'btn btn-primary', $attr = '')

/**
* 设置提示信息
* @author 艾逗笔<765532665@qq.com>
*/
public function setTip($tip) {
$this->model['tip'] = $tip;
Expand All @@ -889,7 +879,6 @@ public function setTip($tip) {

/**
* 显示模板
* @author 艾逗笔<765532665@qq.com>
*/
public function display($templateFile='',$charset='',$contentType='',$content='',$prefix='') {
global $_G;
Expand Down

0 comments on commit 1671e84

Please sign in to comment.