示例#1
0
                    </th>
                    <td>
                        <?php 
        $c = array();
        // change between websites within this customer?
        // or websites all together?
        $res = module_website::get_websites(array('customer_id' => isset($_REQUEST['customer_id']) ? (int) $_REQUEST['customer_id'] : false));
        //$res = module_website::get_websites();
        while ($row = array_shift($res)) {
            $c[$row['website_id']] = $row['name'];
        }
        echo print_select_box($c, 'website_id', $job['website_id']);
        ?>

                        <?php 
        if ($job['website_id'] && module_website::can_i('view', 'Websites')) {
            ?>

                            <a href="<?php 
            echo module_website::link_open($job['website_id'], false);
            ?>
"><?php 
            _e('Open');
            ?>
</a>
                        <?php 
        }
        ?>

                        <?php 
        _h('This will be the ' . module_config::c('project_name_single', 'Website') . ' this job is assigned to - and therefor the customer. Every job should have a' . module_config::c('project_name_single', 'Website') . ' assigned. Clicking the open link will take you to the ' . module_config::c('project_name_single', 'Website'));
示例#2
0
								    <?php 
                    }
                    ?>

							    </tr>
						    <?php 
                }
                ?>

						    </tbody>
					    </table>
				    </div>
			        <?php 
                $fieldset_data['elements_before'] = ob_get_clean();
            }
            echo module_form::generate_fieldset($fieldset_data);
        }
    }
    // and a hook for our new change request plugin
    hook_handle_callback('website_main', $website_id);
}
hook_handle_callback('layout_column_half', 'end');
$form_actions = array('class' => 'action_bar action_bar_center', 'elements' => array(array('type' => 'save_button', 'name' => 'butt_save', 'value' => _l('Save ' . module_config::c('project_name_single', 'Website'))), array('ignore' => !((int) $website_id && module_website::can_i('delete', 'Websites')), 'type' => 'delete_button', 'name' => 'butt_del', 'value' => _l('Delete')), array('type' => 'button', 'name' => 'cancel', 'value' => _l('Cancel'), 'class' => 'submit_button', 'onclick' => "window.location.href='" . module_website::link_open(false) . "';")));
echo module_form::generate_form_actions($form_actions);
?>




</form>
示例#3
0
 * Deploy: 9809 f200f46c2a19bb98d112f2d32a8de0c4
 * Envato: 4ffca17e-861e-4921-86c3-8931978c40ca
 * Package Date: 2015-11-25 02:55:20 
 * IP Address: 67.79.165.254
 */
$search = isset($_REQUEST['search']) && is_array($_REQUEST['search']) ? $_REQUEST['search'] : array();
if (isset($_REQUEST['customer_id'])) {
    $search['customer_id'] = $_REQUEST['customer_id'];
}
$websites = module_website::get_websites($search);
?>


<h2>
    <?php 
if (module_website::can_i('create', 'Websites')) {
    ?>

	<span class="button">
		<?php 
    echo create_link("Add New " . module_config::c('project_name_single', 'Website'), "add", module_website::link_open('new'));
    ?>

	</span>
    <?php 
}
?>

	<?php 
echo _l('Customer ' . module_config::c('project_name_plural', 'Websites'));
?>
示例#4
0
 public function handle_hook($hook)
 {
     switch ($hook) {
         case "invoice_paid":
             $foo = func_get_args();
             $invoice_id = (int) $foo[1];
             if ($invoice_id > 0) {
                 // see if any subscriptions match this invoice.
                 //module_cache::clear_cache();
                 $invoice = module_invoice::get_invoice($invoice_id);
                 $subscription = get_single('subscription_history', 'invoice_id', $invoice_id);
                 if ($subscription) {
                     // mark subscription as paid and move onto the next date.
                     update_insert('subscription_history_id', $subscription['subscription_history_id'], 'subscription_history', array('paid_date' => $invoice['date_paid']));
                     $subscription_owner = get_single('subscription_owner', 'subscription_owner_id', $subscription['subscription_owner_id']);
                     $this->update_next_due_date($subscription['subscription_id'], $subscription_owner['owner_table'], $subscription_owner['owner_id']);
                     /*if($subscription['customer_id']){
                           $this->update_next_due_date($subscription['subscription_id'],$subscription['customer_id'],true);
                       }else{
                           $this->update_next_due_date($subscription['subscription_id'],$subscription['member_id'],false);
                       }*/
                 }
             }
             break;
         case "home_alerts":
             $alerts = array();
             if (module_config::c('subscription_alerts', 1) && self::can_i('view', 'Subscriptions')) {
                 // find renewals due in a certain time.
                 $time = date('Y-m-d', strtotime('+' . module_config::c('alert_days_in_future', 5) . ' days'));
                 $key = _l('Subscription Due');
                 if (class_exists('module_dashboard', false)) {
                     module_dashboard::register_group($key, array('columns' => array('full_link' => _l('Name'), 'type' => _l('Type'), 'subscription_name' => _l('Subscription'), 'automatic_renew' => _l('Automatic Renew'), 'automatic_email' => _l('Automatic Email'), 'next_due_date' => _l('Next Due Date'), 'days' => _l('Day Count'))));
                 }
                 $db_fields = get_fields('subscription');
                 $sql = "SELECT s.*, so.* ";
                 if (isset($db_fields['invoice_prior_days'])) {
                     $sql .= ", DATE_SUB(so.next_due_date, INTERVAL `invoice_prior_days` DAY) AS next_generation_date ";
                 }
                 $sql .= " FROM `" . _DB_PREFIX . "subscription_owner` so ";
                 $sql .= " LEFT JOIN `" . _DB_PREFIX . "subscription` s USING (subscription_id)";
                 if (isset($db_fields['invoice_prior_days'])) {
                     $sql .= " WHERE DATE_SUB(so.next_due_date, INTERVAL `invoice_prior_days` DAY) <= '" . $time . "'";
                 } else {
                     $sql .= " WHERE so.next_due_date <= '" . $time . "'";
                 }
                 $sql .= " AND so.`deleted` = 0";
                 //                    echo $sql;
                 $items = qa($sql);
                 foreach ($items as $item) {
                     //                        echo '<hr>';print_r($item);echo '<hr>';
                     $alert_res = process_alert(isset($item['next_generation_date']) ? $item['next_generation_date'] : $item['next_due_date'], $key);
                     if ($alert_res) {
                         switch ($item['owner_table']) {
                             case 'member':
                                 $permission_check = module_member::get_member($item['owner_id']);
                                 if (!$permission_check || $permission_check['member_id'] != $item['owner_id'] || !module_member::can_i('view', 'Members')) {
                                     continue 2;
                                 }
                                 $alert_res['full_link'] = module_member::link_open($item['owner_id'], true);
                                 break;
                             case 'website':
                                 $permission_check = module_website::get_website($item['owner_id']);
                                 if (!$permission_check || $permission_check['website_id'] != $item['owner_id'] || !module_website::can_i('view', 'Websites')) {
                                     continue 2;
                                 }
                                 $alert_res['full_link'] = module_website::link_open($item['owner_id'], true);
                                 break;
                             case 'customer':
                                 $permission_check = module_customer::get_customer($item['owner_id']);
                                 if (!$permission_check || $permission_check['customer_id'] != $item['owner_id'] || !module_customer::can_i('view', 'Customers')) {
                                     continue 2;
                                 }
                                 $alert_res['full_link'] = module_customer::link_open($item['owner_id'], true);
                                 break;
                         }
                         $alert_res['name'] = $item['name'];
                         $alert_res['link'] = '#';
                         if (preg_match('@href="([^"]+)"@', $alert_res['full_link'], $link_match)) {
                             $alert_res['link'] = $link_match[1];
                         }
                         $alert_res['type'] = $item['owner_table'];
                         $alert_res['subscription_name'] = module_subscription::link_open($item['subscription_id'], true);
                         $alert_res['next_due_date'] = isset($item['next_generation_date']) ? print_date($item['next_generation_date']) : print_date($item['next_due_date']);
                         $alert_res['automatic_renew'] = $item['automatic_renew'] ? _l('Yes') : _l('No');
                         $alert_res['automatic_email'] = $item['automatic_email'] ? _l('Yes') : _l('No');
                         $alerts[] = $alert_res;
                     }
                 }
             }
             return $alerts;
             break;
     }
 }
            function customer_admin_email_generate_invoice_list($invoices, $customer_id)
            {
                ob_start();
                $colspan = 9;
                $colspan2 = 0;
                $invoice_total = array();
                $invoice_total_due = array();
                foreach ($invoices as $invoice) {
                    if (!isset($invoice_total[$invoice['currency_id']])) {
                        $invoice_total[$invoice['currency_id']] = 0;
                    }
                    if ($invoice['c_total_amount'] == 0) {
                        $invoice = module_invoice::get_invoice($invoice['invoice_id']);
                    }
                    $invoice_total[$invoice['currency_id']] += $invoice['c_total_amount'];
                    if (!isset($invoice_total_due[$invoice['currency_id']])) {
                        $invoice_total_due[$invoice['currency_id']] = 0;
                    }
                    $invoice_total_due[$invoice['currency_id']] += $invoice['c_total_amount_due'];
                }
                $table_manager = module_theme::new_table_manager();
                $columns = array();
                $columns['invoice_number'] = array('title' => 'Invoice Number', 'callback' => function ($invoice) {
                    //echo module_invoice::link_open($invoice['invoice_id'],true,$invoice);
                    echo '<a href="' . module_invoice::link_public($invoice['invoice_id']) . '">' . htmlspecialchars($invoice['name']) . '</a>';
                }, 'cell_class' => 'row_action');
                $columns['invoice_status'] = array('title' => 'Status', 'callback' => function ($invoice) {
                    echo htmlspecialchars($invoice['status']);
                });
                $columns['invoice_create_date'] = array('title' => 'Create Date', 'callback' => function ($invoice) {
                    if (!$invoice['date_create'] || $invoice['date_create'] == '0000-00-00') {
                        //echo print_date($invoice['date_created']);
                    } else {
                        echo print_date($invoice['date_create']);
                    }
                });
                $columns['invoice_due_date'] = array('title' => 'Due Date', 'callback' => function ($invoice) {
                    if ((!$invoice['date_paid'] || $invoice['date_paid'] == '0000-00-00') && strtotime($invoice['date_due']) < time()) {
                        echo '<span class="error_text">';
                        echo print_date($invoice['date_due']);
                        echo '</span>';
                    } else {
                        echo print_date($invoice['date_due']);
                    }
                });
                $columns['invoice_sent_date'] = array('title' => 'Sent Date', 'callback' => function ($invoice) {
                    if ($invoice['date_sent'] && $invoice['date_sent'] != '0000-00-00') {
                        ?>

				            <?php 
                        echo print_date($invoice['date_sent']);
                        ?>

				        <?php 
                    } else {
                        ?>

				            <span class="error_text"><?php 
                        _e('Not sent');
                        ?>
</span>
				        <?php 
                    }
                });
                $columns['invoice_paid_date'] = array('title' => 'Paid Date', 'callback' => function ($invoice) {
                    if ($invoice['date_paid'] && $invoice['date_paid'] != '0000-00-00') {
                        ?>

				            <?php 
                        echo print_date($invoice['date_paid']);
                        ?>

				        <?php 
                    } else {
                        if ($invoice['date_cancel'] && $invoice['date_cancel'] != '0000-00-00') {
                            ?>

				            <span class="error_text"><?php 
                            _e('Cancelled');
                            ?>
</span>
				        <?php 
                        } else {
                            if ($invoice['overdue']) {
                                ?>

				            <span class="error_text" style="font-weight: bold; text-decoration: underline;"><?php 
                                _e('Overdue');
                                ?>
</span>
				        <?php 
                            } else {
                                ?>

				            <span class="error_text"><?php 
                                _e('Not paid');
                                ?>
</span>
				        <?php 
                            }
                        }
                    }
                });
                if (class_exists('module_website', false) && module_website::is_plugin_enabled() && module_website::can_i('view', module_config::c('project_name_plural', 'Websites'))) {
                    $colspan++;
                    $columns['invoice_website'] = array('title' => module_config::c('project_name_single', 'Website'), 'callback' => function ($invoice) {
                        if (isset($invoice['website_ids'])) {
                            foreach ($invoice['website_ids'] as $website_id) {
                                if ((int) $website_id > 0) {
                                    echo module_website::link_open($website_id, true);
                                    echo '<br/>';
                                }
                            }
                        }
                    });
                }
                $columns['invoice_job'] = array('title' => 'Job', 'callback' => function ($invoice) {
                    foreach ($invoice['job_ids'] as $job_id) {
                        if ((int) $job_id > 0) {
                            //echo module_job::link_open($job_id,true);
                            $job_data = module_job::get_job($job_id);
                            echo '<a href="' . module_job::link_public($job_id) . '">' . htmlspecialchars($job_data['name']) . '</a>';
                            if ($job_data['date_start'] && $job_data['date_start'] != '0000-00-00' && $job_data['date_renew'] && $job_data['date_renew'] != '0000-00-00') {
                                _e(' (%s to %s)', print_date($job_data['date_start']), print_date(strtotime("-1 day", strtotime($job_data['date_renew']))));
                            }
                            echo "<br/>\n";
                        }
                    }
                    hook_handle_callback('invoice_admin_list_job', $invoice['invoice_id']);
                });
                if (!isset($_REQUEST['customer_id']) && module_customer::can_i('view', 'Customers')) {
                    $colspan++;
                    $columns['invoice_customer'] = array('title' => 'Customer', 'callback' => function ($invoice) {
                        echo module_customer::link_open($invoice['customer_id'], true);
                    });
                }
                $columns['c_invoice_total'] = array('title' => 'Invoice Total', 'callback' => function ($invoice) {
                    echo dollar($invoice['total_amount'], true, $invoice['currency_id']);
                });
                $columns['c_invoice_total_due'] = array('title' => 'Amount Due', 'callback' => function ($invoice) {
                    echo dollar($invoice['total_amount_due'], true, $invoice['currency_id']);
                    ?>

				        <?php 
                    if ($invoice['total_amount_credit'] > 0) {
                        ?>

				        <span class="success_text"><?php 
                        echo _l('Credit: %s', dollar($invoice['total_amount_credit'], true, $invoice['currency_id']));
                        ?>
</span>
				            <?php 
                    }
                });
                if (class_exists('module_extra', false)) {
                    ob_start();
                    $colspan2 += module_extra::print_table_header('invoice');
                    // used in the footer calc.
                    ob_end_clean();
                    $table_manager->display_extra('invoice', function ($invoice) {
                        module_extra::print_table_data('invoice', $invoice['invoice_id']);
                    });
                }
                $table_manager->set_columns($columns);
                $table_manager->row_callback = function ($row_data) {
                    // load the full vendor data before displaying each row so we have access to more details
                    if (isset($row_data['invoice_id']) && (int) $row_data['invoice_id'] > 0) {
                        return module_invoice::get_invoice($row_data['invoice_id']);
                    }
                    return array();
                };
                $table_manager->set_rows($invoices);
                if (module_config::c('invoice_list_show_totals', 1)) {
                    $footer_rows = array();
                    foreach ($invoice_total + $invoice_total_due as $currency_id => $foo) {
                        $currency = get_single('currency', 'currency_id', $currency_id);
                        $footer_rows[] = array('invoice_number' => array('data' => '<strong>' . _l('%s Totals:', $currency && isset($currency['code']) ? $currency['code'] : '') . '</strong>', 'cell_colspan' => $colspan - 2, 'cell_class' => 'text-right'), 'c_invoice_total' => array('data' => '<strong>' . dollar(isset($invoice_total[$currency_id]) ? $invoice_total[$currency_id] : 0, true, $currency_id) . '</strong>'), 'c_invoice_total_due' => array('data' => '<strong>' . dollar(isset($invoice_total_due[$currency_id]) ? $invoice_total_due[$currency_id] : 0, true, $currency_id) . '</strong>'), 'row_bulk_action' => array('data' => ' ', 'cell_colspan' => $colspan2));
                    }
                    $table_manager->set_footer_rows($footer_rows);
                }
                $table_manager->pagination = false;
                $table_manager->print_table();
                return ob_get_clean();
            }
示例#6
0
// hack to add a "group" option to the pagination results.
if (class_exists('module_group', false)) {
    module_group::enable_pagination_hook(array('fields' => array('owner_id' => 'website_id', 'owner_table' => 'website', 'name' => 'name', 'email' => '')));
}
if (class_exists('module_table_sort', false)) {
    module_table_sort::enable_pagination_hook(array('table_id' => 'website_list', 'sortable' => array('website_name' => array('field' => 'name', 'current' => 1), 'website_url' => array('field' => 'url'), 'website_customer' => array('field' => 'customer_name'), 'website_status' => array('field' => 'status'), 'website_group' => array('group_sort' => true, 'owner_table' => 'website', 'owner_id' => 'website_id'))));
}
// hack to add a "export" option to the pagination results.
if (class_exists('module_import_export', false) && module_website::can_i('view', 'Export ' . module_config::c('project_name_plural', 'Websites'))) {
    module_import_export::enable_pagination_hook(array('name' => module_config::c('project_name_single', 'Website') . ' Export', 'fields' => array(module_config::c('project_name_single', 'Website') . ' ID' => 'website_id', 'Customer Name' => 'customer_name', 'Customer Contact First Name' => 'customer_contact_fname', 'Customer Contact Last Name' => 'customer_contact_lname', 'Customer Contact Email' => 'customer_contact_email', module_config::c('project_name_single', 'Website') . ' Name' => 'name', 'URL' => 'url', module_config::c('project_name_single', 'Website') . ' Status' => 'status'), 'extra' => array('owner_table' => 'website', 'owner_id' => 'website_id')));
}
$header_buttons = array();
if (module_website::can_i('create', 'Websites')) {
    $header_buttons[] = array('url' => module_website::link_open('new'), 'type' => 'add', 'title' => _l('Add New ' . module_config::c('project_name_single', 'Website')));
}
if (class_exists('module_import_export', false) && module_website::can_i('view', 'Import ' . module_config::c('project_name_plural', 'Websites'))) {
    $link = module_import_export::import_link(array('callback' => 'module_website::handle_import', 'callback_preview' => 'module_website::handle_import_row_debug', 'name' => module_config::c('project_name_plural', 'Websites'), 'return_url' => $_SERVER['REQUEST_URI'], 'group' => 'website', 'fields' => array(module_config::c('project_name_single', 'Website') . ' ID' => 'website_id', 'Customer Name' => 'customer_name', 'Customer Contact First Name' => 'customer_contact_fname', 'Customer Contact Last Name' => 'customer_contact_lname', 'Customer Contact Email' => 'customer_contact_email', module_config::c('project_name_single', 'Website') . ' Name' => 'name', 'URL' => 'url', module_config::c('project_name_single', 'Website') . ' Status' => 'status', 'Notes' => 'notes'), 'options' => array('duplicates' => array('label' => _l('Duplicates'), 'form_element' => array('name' => 'duplicates', 'type' => 'select', 'blank' => false, 'value' => 'ignore', 'options' => array('ignore' => _l('Skip Duplicates'), 'overwrite' => _l('Overwrite/Update Duplicates'))))), 'extra' => array('owner_table' => 'website', 'owner_id' => 'website_id')));
    $header_buttons[] = array('url' => $link, 'type' => 'add', 'title' => _l("Import " . module_config::c('project_name_plural', 'Websites')));
}
print_heading(array('type' => 'h2', 'main' => true, 'title' => _l('Customer ' . module_config::c('project_name_plural', 'Websites')), 'button' => $header_buttons));
?>



<form action="" method="post">


<?php 
$search_bar = array('elements' => array('name' => array('title' => _l('Name/URL:'), 'field' => array('type' => 'text', 'name' => 'search[generic]', 'value' => isset($search['generic']) ? $search['generic'] : '', 'size' => 30)), 'status' => array('title' => _l('Status:'), 'field' => array('type' => 'select', 'name' => 'search[status]', 'value' => isset($search['status']) ? $search['status'] : '', 'options' => module_website::get_statuses()))));
echo module_form::search_bar($search_bar);
/** START TABLE LAYOUT **/
示例#7
0
                ?>
</span>
        <?php 
            } else {
                ?>

            <span class="error_text"><?php 
                _e('Not paid');
                ?>
</span>
        <?php 
            }
        }
    }
});
if (class_exists('module_website', false) && module_website::is_plugin_enabled() && module_website::can_i('view', module_config::c('project_name_plural', 'Websites'))) {
    $colspan++;
    $columns['invoice_website'] = array('title' => module_config::c('project_name_single', 'Website'), 'callback' => function ($invoice) {
        if (isset($invoice['website_ids'])) {
            foreach ($invoice['website_ids'] as $website_id) {
                if ((int) $website_id > 0) {
                    echo module_website::link_open($website_id, true);
                    echo '<br/>';
                }
            }
        }
    });
}
if (module_job::is_plugin_enabled() && module_job::can_i('view', 'Jobs')) {
    $columns['invoice_job'] = array('title' => 'Job', 'callback' => function ($invoice) {
        foreach ($invoice['job_ids'] as $job_id) {