Advertisement
Guest User

Untitled

a guest
May 24th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.55 KB | None | 0 0
  1. public function renderResultsList()
  2. {
  3.  
  4. $res = array();
  5. $query = new DbQuery();
  6. $query->select('*');
  7. $query->from('registform', 'r');
  8. $query->leftJoin('registform_lang', 'rl', '(rl.id_reg = r.id_reg AND rl.id_lang = '.$this->context->language->id.')');
  9. $res = DB::getInstance()->executeS($query);
  10.  
  11. $this->_select = '
  12. cus.`id_customer`, cus.`firstname`, cus.`lastname`, cus.`email`, cus.`date_add`' ;
  13. $this->_join = '
  14. LEFT JOIN `' . _DB_PREFIX_ . 'customer` cus ON (a.`id_user` = cus.`id_customer`)';
  15.  
  16. foreach($res as $r) {
  17. $this->_select .= ', '' `field_'.$r['id_reg'].'`';
  18. }
  19.  
  20.  
  21.  
  22. $this->_orderBy = 'id_user';
  23. $this->_orderWay = 'ASC';
  24. $this->toolbar_btn = array();
  25. $this->show_toolbar = false;
  26. $this->_defaultOrderWay = 'asc';
  27. $this->lang = false;
  28. $this->position_identifier = 'id_reg';
  29. $this->list_simple_header = true;
  30. $this->_default_pagination = 100;
  31. $this->_group = 'GROUP BY a.`id_user`';
  32.  
  33. $this->fields_list = array(
  34. 'id_customer' => array(
  35. 'title' => $this->l('ID'),
  36. 'width' => 'auto',
  37. 'align' => 'center'
  38. ),
  39. 'firstname' => array(
  40. 'title' => $this->l('First name'),
  41. 'width' => 'auto',
  42. 'align' => 'center'
  43. ),
  44. 'lastname' => array(
  45. 'title' => $this->l('Last name'),
  46. 'width' => 'auto',
  47. 'align' => 'center'
  48. ),
  49. 'email' => array(
  50. 'title' => $this->l('Email'),
  51. 'width' => 'auto',
  52. 'align' => 'center'
  53. ),
  54. 'date_add' => array(
  55. 'title' => $this->l('Date add'),
  56. 'width' => 'auto',
  57. 'align' => 'center'
  58. )
  59. );
  60.  
  61.  
  62. foreach($res as $r){
  63. $this->fields_list['field_'.$r['id_reg']] = array('title' => $r['label'], 'width' => 'auto', 'align' => 'center', 'callback' => 'getResults');
  64. }
  65. $this->tpl_list_vars['title'] = $this->l('Results');
  66.  
  67. return parent::renderList();
  68. }
  69.  
  70. public function getResults($currentCellValue, $fullRow)
  71. {
  72. return $fullRow['reg_value'];
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement