1 | <?php |
||
30 | class NotificationsController extends AppController |
||
31 | { |
||
32 | public $components = array('RequestHandler', 'OrderSearch'); |
||
33 | |||
34 | public $helpers = array('Html', 'Form', 'Reports'); |
||
35 | |||
36 | public $uses = array('Notification', 'Developer', 'Report'); |
||
37 | |||
38 | 1 | public function beforeFilter(Event $event) |
|
44 | |||
45 | public function index() |
||
46 | { |
||
47 | // no need to do anything here. Just render the view. |
||
48 | } |
||
49 | |||
50 | public function data_tables() |
||
51 | { |
||
52 | $current_developer = TableRegistry::get('Developers')-> |
||
53 | findById($this->request->session()->read('Developer.id'))->all()->first(); |
||
54 | |||
55 | $aColumns = array( |
||
56 | 'report_id' => 'Reports.id', |
||
57 | 'error_message' => 'Reports.error_message', |
||
58 | 'error_name' => 'Reports.error_name', |
||
59 | 'pma_version' => 'Reports.pma_version', |
||
60 | 'exception_type' => 'Reports.exception_type', |
||
61 | 'created_time' => 'Notifications.created', |
||
62 | ); |
||
63 | |||
64 | $orderConditions = $this->OrderSearch->getOrder($aColumns); |
||
65 | $searchConditions = $this->OrderSearch->getSearchConditions($aColumns); |
||
66 | |||
67 | $aColumns['id'] = 'Notifications.id'; |
||
68 | $params = array( |
||
69 | 'contain' => 'Reports', |
||
70 | 'fields' => $aColumns, |
||
71 | 'conditions' => array( |
||
72 | 'AND' => array( |
||
73 | array('Notifications.developer_id ' => $current_developer['id']), |
||
74 | $searchConditions, |
||
75 | ), |
||
76 | ), |
||
77 | 'order' => $orderConditions, |
||
78 | ); |
||
79 | //$current_developer = Sanitize::clean($current_developer); |
||
80 | |||
81 | $pagedParams = $params; |
||
82 | $pagedParams['limit'] = intval($this->request->query('iDisplayLength')); |
||
|
|||
83 | $pagedParams['offset'] = intval($this->request->query('iDisplayStart')); |
||
84 | |||
85 | $rows = $this->Notifications->find('all', $pagedParams); |
||
86 | //$rows = Sanitize::clean($rows); |
||
87 | |||
88 | // Make the display rows array |
||
89 | $dispRows = array(); |
||
90 | $tmp_row = array(); |
||
91 | foreach ($rows as $row) { |
||
92 | $tmp_row[0] = '<input type="checkbox" name="notifs[]" value="' |
||
93 | . $row['id'] |
||
94 | . '"/>'; |
||
95 | $tmp_row[1] = '<a href="' |
||
96 | . Router::url( |
||
97 | array( |
||
98 | 'controller' => 'reports', |
||
99 | 'action' => 'view', |
||
100 | $row['report_id'], |
||
101 | ) |
||
102 | ) |
||
103 | . '">' |
||
104 | . $row['report_id'] |
||
105 | . '</a>'; |
||
106 | $tmp_row[2] = $row['error_name']; |
||
107 | $tmp_row[3] = $row['error_message']; |
||
108 | $tmp_row[4] = $row['pma_version']; |
||
109 | $tmp_row[5] = ($row['exception_type']) ? ('php') : ('js'); |
||
110 | $tmp_row[6] = $row['created_time']; |
||
111 | array_push($dispRows, $tmp_row); |
||
112 | } |
||
113 | |||
114 | $response = array( |
||
115 | 'iTotalDisplayRecords' => count($dispRows), |
||
116 | 'iTotalRecords' => $this->Notifications->find('all', $params)->count(), |
||
117 | 'sEcho' => intval($this->request->query('sEcho')), |
||
118 | 'aaData' => $dispRows, |
||
119 | ); |
||
120 | $this->autoRender = false; |
||
121 | $this->response->body(json_encode($response)); |
||
122 | |||
123 | return $this->response; |
||
124 | } |
||
125 | |||
126 | /** |
||
127 | * To carry out mass actions on Notifications. |
||
128 | * Currently it deletes them (marks them "read"). |
||
129 | * Can be Extended for other mass operations as well. |
||
130 | * Expects an array of Notification Ids as a POST parameter. |
||
131 | */ |
||
132 | 1 | public function mass_action() |
|
149 | } |
||
150 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.