@@ 133-184 (lines=52) @@ | ||
130 | * @since 1.7.0 |
|
131 | * @return data |
|
132 | */ |
|
133 | public function generate_report( $report ) { |
|
134 | ||
135 | $data = array(); |
|
136 | ||
137 | $this->csv_output = true; |
|
138 | ||
139 | // Handle orderby |
|
140 | $orderby = ''; |
|
141 | if ( !empty( $_GET['orderby'] ) ) { |
|
142 | if ( array_key_exists( esc_html( $_GET['orderby'] ), $this->get_sortable_columns() ) ) { |
|
143 | $orderby = esc_html( $_GET['orderby'] ); |
|
144 | } // End If Statement |
|
145 | } |
|
146 | ||
147 | // Handle order |
|
148 | $order = 'ASC'; |
|
149 | if ( !empty( $_GET['order'] ) ) { |
|
150 | $order = ( 'ASC' == strtoupper($_GET['order']) ) ? 'ASC' : 'DESC'; |
|
151 | } |
|
152 | ||
153 | // Handle search |
|
154 | $search = false; |
|
155 | if ( !empty( $_GET['s'] ) ) { |
|
156 | $search = esc_html( $_GET['s'] ); |
|
157 | } // End If Statement |
|
158 | $this->search = $search; |
|
159 | ||
160 | $args = array( |
|
161 | 'orderby' => $orderby, |
|
162 | 'order' => $order, |
|
163 | ); |
|
164 | if ( $this->search ) { |
|
165 | $args['search'] = $this->search; |
|
166 | } // End If Statement |
|
167 | ||
168 | // Start the csv with the column headings |
|
169 | $column_headers = array(); |
|
170 | $columns = $this->get_columns(); |
|
171 | foreach( $columns AS $key => $title ) { |
|
172 | $column_headers[] = $title; |
|
173 | } |
|
174 | $data[] = $column_headers; |
|
175 | ||
176 | $this->items = $this->get_lesson_statuses( $args ); |
|
177 | ||
178 | // Process each row |
|
179 | foreach( $this->items AS $item) { |
|
180 | $data[] = $this->get_row_data( $item ); |
|
181 | } |
|
182 | ||
183 | return $data; |
|
184 | } |
|
185 | ||
186 | /** |
|
187 | * Generates the overall array for a single item in the display |
@@ 134-185 (lines=52) @@ | ||
131 | * @since 1.7.0 |
|
132 | * @return data |
|
133 | */ |
|
134 | public function generate_report( $report ) { |
|
135 | ||
136 | $data = array(); |
|
137 | ||
138 | $this->csv_output = true; |
|
139 | ||
140 | // Handle orderby |
|
141 | $orderby = ''; |
|
142 | if ( !empty( $_GET['orderby'] ) ) { |
|
143 | if ( array_key_exists( esc_html( $_GET['orderby'] ), $this->get_sortable_columns() ) ) { |
|
144 | $orderby = esc_html( $_GET['orderby'] ); |
|
145 | } // End If Statement |
|
146 | } |
|
147 | ||
148 | // Handle order |
|
149 | $order = 'ASC'; |
|
150 | if ( !empty( $_GET['order'] ) ) { |
|
151 | $order = ( 'ASC' == strtoupper($_GET['order']) ) ? 'ASC' : 'DESC'; |
|
152 | } |
|
153 | ||
154 | // Handle search |
|
155 | $search = false; |
|
156 | if ( !empty( $_GET['s'] ) ) { |
|
157 | $search = esc_html( $_GET['s'] ); |
|
158 | } // End If Statement |
|
159 | $this->search = $search; |
|
160 | ||
161 | $args = array( |
|
162 | 'orderby' => $orderby, |
|
163 | 'order' => $order, |
|
164 | ); |
|
165 | if ( $this->search ) { |
|
166 | $args['search'] = $this->search; |
|
167 | } // End If Statement |
|
168 | ||
169 | // Start the csv with the column headings |
|
170 | $column_headers = array(); |
|
171 | $columns = $this->get_columns(); |
|
172 | foreach( $columns AS $key => $title ) { |
|
173 | $column_headers[] = $title; |
|
174 | } |
|
175 | $data[] = $column_headers; |
|
176 | ||
177 | $this->items = $this->get_course_statuses( $args ); |
|
178 | ||
179 | // Process each row |
|
180 | foreach( $this->items AS $item) { |
|
181 | $data[] = $this->get_row_data( $item ); |
|
182 | } |
|
183 | ||
184 | return $data; |
|
185 | } |
|
186 | ||
187 | /** |
|
188 | * Generates the overall array for a single item in the display |