コード例 #1
0
ファイル: Resources.php プロジェクト: msigley/shopp
 /**
  * Delivers order export files to the browser
  *
  * @author Jonathan Davis
  * @since 1.1
  *
  * @return void
  **/
 public function export_purchases()
 {
     if (!current_user_can('shopp_financials') || !current_user_can('shopp_export_orders')) {
         exit;
     }
     if (!isset($_POST['settings']['purchaselog_columns'])) {
         $Purchase = ShoppPurchase::exportcolumns();
         $Purchased = ShoppPurchased::exportcolumns();
         $_POST['settings']['purchaselog_columns'] = array_keys(array_merge($Purchase, $Purchased));
         $_POST['settings']['purchaselog_headers'] = 'on';
     }
     shopp_set_formsettings();
     // Save workflow setting
     $format = shopp_setting('purchaselog_format');
     if (empty($format)) {
         $format = 'tab';
     }
     switch ($format) {
         case 'csv':
             new PurchasesCSVExport();
             break;
         case 'iif':
             new PurchasesIIFExport();
             break;
         default:
             new PurchasesTabExport();
     }
     exit;
 }
コード例 #2
0
ファイル: Reports.php プロジェクト: msigley/shopp
 /**
  * Renders the admin screen
  *
  * @author Jonathan Davis
  * @since 1.3
  *
  * @return void
  **/
 public function screen()
 {
     if (!current_user_can('shopp_financials')) {
         wp_die(__('You do not have sufficient permissions to access this page.', 'Shopp'));
     }
     extract($this->options, EXTR_SKIP);
     $Report = $this->Report;
     $Report->pagination();
     $ListTable = ShoppUI::table_set_pagination($screen, $Report->total, $Report->pages, $per_page);
     $ranges = array('all' => __('Show All Orders', 'Shopp'), 'today' => __('Today', 'Shopp'), 'week' => __('This Week', 'Shopp'), 'month' => __('This Month', 'Shopp'), 'quarter' => __('This Quarter', 'Shopp'), 'year' => __('This Year', 'Shopp'), 'yesterday' => __('Yesterday', 'Shopp'), 'lastweek' => __('Last Week', 'Shopp'), 'last30' => __('Last 30 Days', 'Shopp'), 'last90' => __('Last 3 Months', 'Shopp'), 'lastmonth' => __('Last Month', 'Shopp'), 'lastquarter' => __('Last Quarter', 'Shopp'), 'lastyear' => __('Last Year', 'Shopp'), 'custom' => __('Custom Dates', 'Shopp'));
     $exports = array('tab' => __('Tab-separated.txt', 'Shopp'), 'csv' => __('Comma-separated.csv', 'Shopp'));
     $format = shopp_setting('report_format');
     if (!$format) {
         $format = 'tab';
     }
     $columns = array_merge(ShoppPurchase::exportcolumns(), ShoppPurchased::exportcolumns());
     $selected = shopp_setting('purchaselog_columns');
     if (empty($selected)) {
         $selected = array_keys($columns);
     }
     $reports = self::reports();
     $report_title = isset($reports[$report]) ? $reports[$report]['name'] : __('Report', 'Shopp');
     include $this->ui('reports.php');
 }
コード例 #3
0
ファイル: Service.php プロジェクト: jonathandavis/shopp
 /**
  * Interface processor for the orders list interface
  *
  * @author Jonathan Davis
  *
  * @return void
  **/
 public function orders()
 {
     if (!current_user_can('shopp_orders')) {
         wp_die(__('You do not have sufficient permissions to access this page.', 'Shopp'));
     }
     global $Shopp, $Orders;
     $defaults = array('page' => false, 'update' => false, 'newstatus' => false, 'paged' => 1, 'per_page' => 20, 'status' => false, 's' => '', 'range' => '', 'startdate' => '', 'enddate' => '');
     $args = array_merge($defaults, $_GET);
     extract($args, EXTR_SKIP);
     $s = stripslashes($s);
     $statusLabels = shopp_setting('order_status');
     if (empty($statusLabels)) {
         $statusLabels = array('');
     }
     $txnstatus_labels = Lookup::txnstatus_labels();
     $Purchase = new ShoppPurchase();
     $Orders = $this->orders;
     $ordercount = $this->ordercount;
     $num_pages = ceil($ordercount->total / $per_page);
     $ListTable = ShoppUI::table_set_pagination($this->screen, $ordercount->total, $num_pages, $per_page);
     $ranges = array('all' => __('Show All Orders', 'Shopp'), 'today' => __('Today', 'Shopp'), 'week' => __('This Week', 'Shopp'), 'month' => __('This Month', 'Shopp'), 'quarter' => __('This Quarter', 'Shopp'), 'year' => __('This Year', 'Shopp'), 'yesterday' => __('Yesterday', 'Shopp'), 'lastweek' => __('Last Week', 'Shopp'), 'last30' => __('Last 30 Days', 'Shopp'), 'last90' => __('Last 3 Months', 'Shopp'), 'lastmonth' => __('Last Month', 'Shopp'), 'lastquarter' => __('Last Quarter', 'Shopp'), 'lastyear' => __('Last Year', 'Shopp'), 'lastexport' => __('Last Export', 'Shopp'), 'custom' => __('Custom Dates', 'Shopp'));
     $exports = array('tab' => __('Tab-separated.txt', 'Shopp'), 'csv' => __('Comma-separated.csv', 'Shopp'), 'xls' => __('Microsoft® Excel.xls', 'Shopp'), 'iif' => __('Intuit® QuickBooks.iif', 'Shopp'));
     $formatPref = shopp_setting('purchaselog_format');
     if (!$formatPref) {
         $formatPref = 'tab';
     }
     $exportcolumns = array_merge(ShoppPurchase::exportcolumns(), ShoppPurchased::exportcolumns());
     $selected = shopp_setting('purchaselog_columns');
     if (empty($selected)) {
         $selected = array_keys($exportcolumns);
     }
     $Gateways = $Shopp->Gateways;
     include $this->ui('orders.php');
 }
コード例 #4
0
ファイル: Purchase.php プロジェクト: borkweb/shopp
 public function __construct()
 {
     $this->purchase_cols = ShoppPurchase::exportcolumns();
     $this->purchased_cols = ShoppPurchased::exportcolumns();
     $this->defined = array_merge($this->purchase_cols, $this->purchased_cols);
     $this->sitename = get_bloginfo('name');
     $this->headings = shopp_setting('purchaselog_headers') == "on";
     $this->selected = shopp_setting('purchaselog_columns');
     $this->date_format = get_option('date_format');
     $this->time_format = get_option('time_format');
     shopp_set_setting('purchaselog_lastexport', current_time('timestamp'));
 }
コード例 #5
0
ファイル: Orders.php プロジェクト: msigley/shopp
 protected function bottom_tablenav()
 {
     if (!current_user_can('shopp_financials') || !current_user_can('shopp_export_orders')) {
         return;
     }
     $exporturl = add_query_arg(urlencode_deep(array_merge(stripslashes_deep($_GET), array('src' => 'export_purchases'))));
     echo '<div class="alignleft actions">' . '	</form><form action="' . esc_url($exporturl) . '" id="log" method="post">' . '		<button type="button" id="export-settings-button" name="export-settings" class="button-secondary">' . Shopp::__('Export Options') . '</button>' . '	<div id="export-settings" class="hidden">' . '		<div id="export-columns" class="multiple-select">' . '			<ul>';
     $even = true;
     echo '				<li' . ($even ? '' : ' class="odd"') . '><input type="checkbox" name="selectall_columns" id="selectall_columns" /><label for="selectall_columns"><strong>' . Shopp::__('Select All') . '</strong></label></li>';
     $even = !$even;
     echo '				<li' . ($even ? '' : ' class="odd"') . '><input type="hidden" name="settings[purchaselog_headers]" value="off" /><input type="checkbox" name="settings[purchaselog_headers]" id="purchaselog_headers" value="on" /><label for="purchaselog_headers"><strong>' . Shopp::__('Include column headings') . '</strong></label></li>';
     $even = !$even;
     $exportcolumns = array_merge(ShoppPurchase::exportcolumns(), ShoppPurchased::exportcolumns());
     $selected = shopp_setting('purchaselog_columns');
     if (empty($selected)) {
         $selected = array_keys($exportcolumns);
     }
     foreach ($exportcolumns as $name => $label) {
         if ('cb' == $name) {
             continue;
         }
         echo '				<li' . ($even ? '' : ' class="odd"') . '><input type="checkbox" name="settings[purchaselog_columns][]" value="' . esc_attr($name) . '" id="column-' . esc_attr($name) . '" ' . (in_array($name, $selected) ? ' checked="checked"' : '') . ' /><label for="column-' . esc_attr($name) . '">' . esc_html($label) . '</label></li>';
         $even = !$even;
     }
     echo '			</ul>' . '		</div>';
     PurchasesIIFExport::settings();
     $exports = array('tab' => Shopp::__('Tab-separated.txt'), 'csv' => Shopp::__('Comma-separated.csv'), 'iif' => Shopp::__('Intuit&reg; QuickBooks.iif'));
     $format = shopp_setting('purchaselog_format');
     if (!$format) {
         $format = 'tab';
     }
     echo '		<br />' . '		<select name="settings[purchaselog_format]" id="purchaselog-format">' . '			' . menuoptions($exports, $format, true) . '		</select>' . '		</div>' . '	<button type="submit" id="download-button" name="download" value="export" class="button-secondary"' . (count($this->items) < 1 ? ' disabled="disabled"' : '') . '>' . Shopp::__('Download') . '</button>' . '	<div class="clear"></div>' . '	</form>' . '</div>';
 }