echo $row['interval']; ?> days</td> <td><?php if ($row['free_trial'] == '0') { ?> none<?php } else { echo $row['free_trial']; ?> days<?php } ?> </td> <td><a href="<?php echo dataset_link('customers/index', array('plan_id' => $row['id'])); ?> "><?php echo $row['num_customers']; ?> customers</a></td> <td class="options"><a href="<?php echo site_url('plans/edit/' . $row['id']); ?> ">edit</a></td> </tr> <?php } } else { ?> <tr><td colspan="8">Empty data set.</td></tr>
function profile_actions($subscription_id = FALSE, $action = FALSE) { // take input from POST if it wasn't passed if ($subscription_id == FALSE) { $subscription_id = $this->input->post('subscription_id'); } if ($action == FALSE) { $action = $this->input->post('action'); } // get subscription $this->load->model('billing/subscription_model'); $subscription = $this->subscription_model->get_subscription($subscription_id); if ($action == 'cancel') { if ($this->subscription_model->cancel_subscription($subscription['id'])) { $this->notices->SetNotice('Subscription cancelled successfully.'); } else { $this->notices->SetError('There was an error cancelling this subscription.'); } redirect('admincp/users/profile/' . $subscription['user_id']); } elseif ($action == 'update_cc') { redirect('admincp/billing/update_cc/' . $subscription['id']); } elseif ($action == 'change_plan') { redirect('admincp/billing/change_plan/' . $subscription['id']); } elseif ($action == 'change_price') { redirect('admincp/billing/change_price/' . $subscription['id']); } elseif ($action == 'view_all') { $this->load->helper('admincp/dataset_link'); $url = dataset_link('admincp/reports/invoices', array('subscription_id' => $subscription_id)); header('Location: ' . $url); } elseif ($action == 'log') { header('Location: ' . site_url('admincp/reports/subscription_log/' . $subscription_id)); } return TRUE; }
</td> </tr> <tr> <td class="label">End Date</td> <td><?php echo $end_date; ?> </td> </tr> <tr> <td class="label">Last Charge Date</td> <td><?php echo $last_charge_date; ?> (<a href="<?php echo dataset_link('transactions/index', array('recurring_id' => $id)); ?> ">view all charges</a>)</td> </tr> <?php if ($status == 'active') { ?> <tr> <td class="label">Next Charge Date</td> <td><?php echo $next_charge_date; ?> </td> </tr> <?php if (!empty($card_last_four)) {
function product_actions($action = FALSE, $product_id = FALSE) { // take input from POST if it wasn't passed if ($product_id == FALSE) { $product_id = $this->input->post('product_id'); } if ($action == FALSE) { $action = $this->input->post('action'); } // get product $this->load->model('products_model'); $product = $this->products_model->get_product($product_id); if ($action == 'details') { header('Location: ' . $product['admin_link']); } elseif ($action == 'edit') { redirect('admincp/store/edit/' . $product['id']); } elseif ($action == 'images') { redirect('admincp/store/product/' . $product['id']); } elseif ($action == 'view_orders') { $this->load->helper('admincp/dataset_link'); $url = dataset_link('admincp/reports/products', array('product_name' => $product['name'])); redirect($url); } return TRUE; }
?> ">Login to Account</a> </div> <h3>Records</h3> <div class="sidebar_content"> <a href="<?php echo dataset_link('admincp/users/logins/', array('username' => $user['username'])); ?> ">Login History</a><br /> <?php if (module_installed('billing', 'store')) { ?> <a href="<?php echo dataset_link('admincp/reports/invoices/', array('member_name' => $user['id'])); ?> ">Invoices</a> <?php } ?> </div> </div> <div style="float: left; width: 70%;"> <h1><?php echo $user['username']; ?> </h1> <h2 class="cat user">Member Data</h2> <ul class="data">
function activity() { // we'll place everything in here as timestamp => message $activity = array(); // get last 10 signups $result = $this->db->select('user_id')->select('user_first_name')->select('user_last_name')->select('user_signup_date')->from('users')->order_by('user_signup_date', 'DESC')->limit(10)->get(); foreach ($result->result_array() as $user) { $activity[strtotime($user['user_signup_date'])] = '<a href="' . site_url('admincp/users/profile/' . $user['user_id']) . '">' . $user['user_first_name'] . ' ' . $user['user_last_name'] . ' created a member account.</a>'; } if (module_installed('store', 'billing')) { // ... orders $result = $this->db->select('orders.order_id')->select('user_first_name')->select('user_last_name')->select('orders.amount')->select('orders.timestamp')->select('orders.subscription_id')->from('orders')->where('orders.status', '1')->join('users', 'users.customer_id = orders.customer_id')->order_by('orders.timestamp', 'DESC')->limit(10)->get(); foreach ($result->result_array() as $order) { $purchase_or_sub = !empty($order['subscription_id']) ? ' made a subscription payment of ' : ' made a purchase from the store for '; $activity[strtotime($order['timestamp'])] = '<a href="' . site_url('admincp/reports/invoice/' . $order['order_id']) . '">' . $order['user_first_name'] . ' ' . $order['user_last_name'] . $purchase_or_sub . setting('currency_symbol') . money_format("%!^i", $order['amount']) . '.</a>'; } } // ... logins $result = $this->db->select('user_first_name')->select('user_last_name')->select('users.user_id')->select('users.user_username')->select('user_logins.user_login_date')->select('user_logins.user_login_ip')->from('user_logins')->join('users', 'users.user_id = user_logins.user_id')->order_by('user_logins.user_login_date', 'DESC')->limit(10)->get(); foreach ($result->result_array() as $login) { $activity[strtotime($login['user_login_date'])] = '<a href="' . dataset_link('admincp/users/logins', array('username' => $login['user_username'])) . '">' . $login['user_first_name'] . ' ' . $login['user_last_name'] . ' logged in from <span class="tooltip" title="This is an IP address. It specifies from which computer/network the user logged in.">' . $login['user_login_ip'] . '</span>.</a>'; } if (module_installed('billing')) { // ... subscriptions $result = $this->db->select('subscriptions.subscription_id')->select('user_first_name')->select('user_last_name')->select('users.user_id')->select('plans.name')->select('subscriptions.timestamp')->from('subscriptions')->join('users', 'users.customer_id = subscriptions.customer_id')->join('plans', 'plans.plan_id', 'subscriptions.plan_id')->order_by('subscriptions.timestamp', 'DESC')->limit(10)->get(); foreach ($result->result_array() as $order) { $activity[strtotime($order['timestamp'])] = '<a href="' . site_url('admincp/users/profile/' . $order['user_id']) . '">' . $order['user_first_name'] . ' ' . $order['user_last_name'] . ' subscribed to ' . $order['name'] . '.</a>'; } } if (module_installed('twitter')) { // ... published to twitter $result = $this->db->select('tweet')->select('sent_time')->from('tweets_sent')->order_by('sent_time', 'DESC')->limit(10)->get(); foreach ($result->result_array() as $tweets) { $activity[strtotime($tweets['sent_time'])] = $tweets['tweet'] . ' was tweeted on <a href="' . site_url('admincp/twitter/tweet_logs') . '">Twitter</a>'; } } // ... published content $result = $this->db->select('content.content_id')->select('user_first_name')->select('user_last_name')->select('content_types.content_type_friendly_name')->select('content.content_date')->from('content')->join('users', 'users.user_id = content.user_id')->join('content_types', 'content.content_type_id = content_types.content_type_id')->order_by('content.content_date', 'DESC')->limit(10)->get(); $this->load->library('inflect'); foreach ($result->result_array() as $content) { $activity[strtotime($content['content_date'])] = '<a href="' . site_url('admincp/publish/edit/' . $content['content_id']) . '">' . $content['user_first_name'] . ' ' . $content['user_last_name'] . ' published a new ' . $this->inflect->singularize($content['content_type_friendly_name']) . '.</a>'; } // sort and show ksort($activity); $activity = array_reverse($activity, TRUE); $this->load->helper('time_since'); $count = 1; foreach ($activity as $time => $message) { if ($time > time()) { // future event, ignore... continue; } if ($count <= 20) { $date = time_since($time); if ($date === FALSE) { $date = date('M d, h:ia', $time); } echo '<li><div class="date">' . $date . '</div><div class="message">' . $message . '</div><div style="clear:both"></div></li>'; $count++; } else { break; } } return TRUE; }
function user_actions($action, $id) { $this->load->model('users/user_model'); $user = $this->user_model->get_user($id); if ($action == 'invoices') { header('Location: ' . dataset_link('admincp/reports/invoices', array('member_name' => $user['id']))); } if ($action == 'subscriptions') { header('Location: ' . dataset_link('admincp/reports/subscriptions', array('member_name' => $user['id']))); } elseif ($action == 'profile') { redirect('admincp/users/profile/' . $user['id']); } return TRUE; }