public static function tcButtonShortcodes() { global $wpdb; $query = @$wpdb->prepare("SELECT * FROM " . CRP_TABLE_PORTFOLIOS); $results = $wpdb->get_results($query, ARRAY_A); $shortcodes = array(); for ($i = 0; $i < count($results); $i++) { $shortcode = new stdClass(); $shortcode->id = $results[$i]["id"]; $shortcode->title = $results[$i]["title"]; $shortcode->shortcode = CRPHelper::shortcodeWithPID($results[$i]["id"]); $shortcodes[] = $shortcode; } return $shortcodes; }
function fetchData() { global $wpdb; $query = @$wpdb->prepare("SELECT * FROM " . CRP_TABLE_PORTFOLIOS); $results = $wpdb->get_results($query, ARRAY_A); for ($i = 0; $i < count($results); $i++) { $pid = $results[$i]["id"]; $results[$i]["pcount"] = $wpdb->get_var("SELECT COUNT(*) FROM " . CRP_TABLE_PROJECTS . " WHERE pid='{$pid}'"); $results[$i]["shortcode"] = CRPHelper::shortcodeWithPID($pid); //Build row actions $actions = array('options' => sprintf('<a href="#" style="float: right; margin-right: 5px; margin-top: 2px; cursor: not-allowed !important;"><i class="fa fa-cog fa-fw" style="font-size: 17px; color: #2980b9"></i></a>', $_REQUEST['page'], 'options', $pid), 'edit' => sprintf('<a href="?page=%s&action=%s&id=%s" style="float: right; margin-right: 7px; margin-top: 2px;"><i class="fa fa-pencil-square-o" style="font-size: 17px; color: #2980b9"></i></a>', $_REQUEST['page'], 'edit', $pid), 'delete' => sprintf('<a href="?page=%s&action=%s&id=%s" style="float: right; margin-right: 10px; margin-top: 0px;"><i class="fa fa-times" style="font-size: 19px; color: #c0392b"></i></a>', $_REQUEST['page'], 'delete', $pid)); $results[$i]["options"] = $actions['delete'] . $actions['options'] . $actions['edit']; } return $results; }