构造器用途: 设置所有的控制器成员变量
一些成员变量用途:
调用AdminControllerCore中的方法 public function addRowAction($action)
// Declare an action to use for each row in the list
//在后台列表页面(list)中的每一行中,声明一种操作(修改,删除等)
protected $actions = array(); //操作列表数组
$this->addRowAction('edit');//增加编辑功能操作到操作列表
=====__construct()控制器 end=========
======== initProcess()初始化进程start=========
初始化进程用途:根据get或post过来的值,调用控制器中的相应方法进行处理。
如:增加,修改,删除,批量处理,导入导出等,有自己的规范
顺序:
/* Delete object image */
$_GET['deleteImage']
/* Delete object */
$_GET['delete'.$this->table]
/* Change object statuts (active, inactive) */
$_GET['status'.$this->table] or ($_GET['status' and Tools::getValue($this->identifier))
/* Move an object */
$_GET['position']
Tools::isSubmit('submitAdd'.$this->table)
|| Tools::isSubmit('submitAdd'.$this->table.'AndStay')
|| Tools::isSubmit('submitAdd'.$this->table.'AndPreview')
|| Tools::isSubmit('submitAdd'.$this->table.'AndBackToParent')
$_GET['add'.$this->table]
isset($_GET['update'.$this->table]) && isset($_GET[$this->identifier])
//商品同步,
isset($_GET['synchronize'.$this->table]) && isset($_GET[$this->identifier])
$_GET['view'.$this->table]
$_GET['details'.$this->table]
$_GET['export'.$this->table]
/* Cancel all filters for this tab */
$_POST['submitReset'.$this->list_id]
Tools::isSubmit('submitOptions'.$this->table) || Tools::isSubmit('submitOptions')
Tools::getValue('action') &&
method_exists($this, 'process'.ucfirst(Tools::toCamelCase(Tools::getValue('action'))))
Tools::isSubmit('submitFields') &&
$this->required_database &&
$this->tabAccess['add'] === '1' &&
$this->tabAccess['delete'] === '1'
$this->bulk_actions
!empty($this->fields_options) && empty($this->fields_list)
没有任何参数
======== initProcess()初始化进程 end=========
==============postProcess() start=======
对action过来的值进行处理的方法,对 initProcess()的加强,有自己的规范????????
==============postProcess() end=======
======initContent() 初始化内容 start==========
用途:这个也是初始化smarty模板的变量,
给所有默认的 views, list and form,以及调用其他的初始化函
顺序:
$this->display == 'edit' || $this->display == 'add'
$this->display == 'view'
$this->display == 'details'
!$this->ajax
这个显示数据列表:
$this->content .= $this->renderModulesList();
$this->content .= $this->renderKpis();
$this->content .= $this->renderList();//Function used to render the list to display for this controller
显示数据列表
/** @var array Cache for query results */
protected $_list = array();
//Get the current objects' list form the database
$this->getList($this->context->language->id);
$this->_list = Db::getInstance()->executeS($this->_listsql, true, false);
HelperList()
//This function sets various display options for helper list
$this->setHelperDisplay($helper);
/** @var array List to be generated */
protected $fields_list;
$helper->is_cms = $this->is_cms;
$helper->sql = $this->_listsql;
$list = $helper->generateList($this->_list, $this->fields_list);
????????????????
$this->content .= $this->renderOptions();
// if we have to display the required fields form
if ($this->required_database)
$this->content .= $this->displayRequiredFields();
======initContent() 初始化内容 end==========
转载于:https://my.oschina.net/u/2615982/blog/610067