private function processData($alerts) { if (!empty($alerts) && !empty($alerts['alerts'])) { $csrf_token_url = osc_csrf_token_url(); foreach ($alerts['alerts'] as $aRow) { $row = array(); $options = array(); // first column $row['bulkactions'] = '<input type="checkbox" name="alert_id[]" value="' . $aRow['pk_i_id'] . '" /></div>'; $options[] = '<a onclick="return delete_alert(\'' . $aRow['pk_i_id'] . '\');" href="#">' . __('Delete') . '</a>'; if ($aRow['b_active'] == 1) { $options[] = '<a href="' . osc_admin_base_url(true) . '?page=users&action=status_alerts&alert_id[]=' . $aRow['pk_i_id'] . '&' . $csrf_token_url . '&status=0" >' . __('Deactivate') . '</a>'; } else { $options[] = '<a href="' . osc_admin_base_url(true) . '?page=users&action=status_alerts&alert_id[]=' . $aRow['pk_i_id'] . '&' . $csrf_token_url . '&status=1" >' . __('Activate') . '</a>'; } $options = osc_apply_filter('actions_manage_alerts', $options, $aRow); // create list of actions $auxOptions = '<ul>' . PHP_EOL; foreach ($options as $actual) { $auxOptions .= '<li>' . $actual . '</li>' . PHP_EOL; } $auxOptions .= '</ul>' . PHP_EOL; $actions = '<div class="actions">' . $auxOptions . '</div>' . PHP_EOL; // second column $row['email'] = '<a href="' . osc_admin_base_url(true) . '?page=items&userId=">' . $aRow['s_email'] . '</a>' . $actions; // third row $pieces = array(); $conditions = osc_get_raw_search((array) json_decode($aRow['s_search'], true)); if (isset($conditions['sPattern']) && $conditions['sPattern'] != '') { $pieces[] = sprintf(__("<b>Pattern:</b> %s"), $conditions['sPattern']); } if (isset($conditions['aCategories']) && !empty($conditions['aCategories'])) { $l = min(count($conditions['aCategories']), 4); $cat_array = array(); for ($c = 0; $c < $l; $c++) { $cat_array[] = $conditions['aCategories'][$c]; } if (count($conditions['aCategories']) > $l) { $cat_array[] = '<a href="#" class="more-tooltip" categories="' . osc_esc_html(implode(", ", $conditions['aCategories'])) . '" >' . __("...More") . '</a>'; } $pieces[] = sprintf(__("<b>Categories:</b> %s"), implode(", ", $cat_array)); } $row['alert'] = implode($pieces, ", "); // fourth row $row['date'] = osc_format_date($aRow['dt_date']); $row = osc_apply_filter('alerts_processing_row', $row, $aRow); $this->addRow($row); $this->rawRows[] = $aRow; } } }
<?php if ($aux['edit'] && count($aux['alerts']) > 0) { ?> <div class="settings-user"> <ul id="error_list"></ul> <form> <div class="form-horizontal"> <h3 class="render-title"><?php _e('Alerts'); ?> </h3> <div class="form-row"> <?php for ($k = 0; $k < count($aux['alerts']); $k++) { $array_conditions = (array) json_decode(base64_decode($aux['alerts'][$k]['s_search']), true); $raw_data = osc_get_raw_search($array_conditions); $new_search = new Search(); $new_search->setJsonAlert($array_conditions); $new_search->limit(0, 2); $results = $new_search->doSearch(); ?> <div class="form-label"> <?php echo sprintf(__('Alert #%d'), $k + 1); ?> <br/> <?php if (isset($raw_data['sPattern']) && $raw_data['sPattern'] != '') { ?> <?php echo sprintf(__("<b>Pattern:</b> %s"), $raw_data['sPattern']);