예제 #1
0
파일: Pages.php 프로젝트: forthrobot/inuvik
 public function prepare_items()
 {
     $this->id = 'pages';
     $settings = ShoppPages()->settings();
     $template = array('id' => '', 'title' => '', 'slug' => '', 'description' => '');
     foreach ($settings as $name => $page) {
         $page['id'] = $name;
         $this->items[$name] = (object) array_merge($template, $page);
     }
     $per_page = 25;
     $total = count($this->items);
     $this->set_pagination_args(array('total_items' => $total, 'total_pages' => $total / $per_page, 'per_page' => $per_page));
     shopp_custom_script('pageset', 'var pages = ' . json_encode($this->items) . ';');
 }
예제 #2
0
 /**
  * Service constructor
  *
  * @return void
  * @author Jonathan Davis
  **/
 public function __construct()
 {
     parent::__construct();
     if (isset($_GET['id'])) {
         wp_enqueue_script('postbox');
         shopp_enqueue_script('colorbox');
         shopp_enqueue_script('jquery-tmpl');
         shopp_enqueue_script('orders');
         shopp_localize_script('orders', '$om', array('co' => __('Cancel Order', 'Shopp'), 'mr' => __('Mark Refunded', 'Shopp'), 'pr' => __('Process Refund', 'Shopp'), 'dnc' => __('Do Not Cancel', 'Shopp'), 'ro' => __('Refund Order', 'Shopp'), 'cancel' => __('Cancel', 'Shopp'), 'rr' => __('Reason for refund', 'Shopp'), 'rc' => __('Reason for cancellation', 'Shopp'), 'mc' => __('Mark Cancelled', 'Shopp'), 'stg' => __('Send to gateway', 'Shopp')));
         shopp_enqueue_script('address');
         shopp_custom_script('address', 'var regions = ' . json_encode(Lookup::country_zones()) . ';');
         add_action('load-' . $this->screen, array($this, 'workflow'));
         add_action('load-' . $this->screen, array($this, 'layout'));
         do_action('shopp_order_management_scripts');
     } else {
         add_action('load-' . $this->screen, array($this, 'loader'));
         add_action('admin_print_scripts', array($this, 'columns'));
     }
     do_action('shopp_order_admin_scripts');
 }
예제 #3
0
 public static function editor($Customer, $type = 'billing')
 {
     shopp_custom_script('orders', 'var address = [];');
     ob_start();
     include SHOPP_ADMIN_PATH . '/customers/address.php';
     return ob_get_clean();
 }
예제 #4
0
 /**
  * Renders footer content and extra scripting as needed
  *
  * @author Jonathan Davis
  * @since 1.1
  *
  * @return void
  **/
 public function footer()
 {
     $globals = false;
     if (isset($this->behaviors['global'])) {
         $globals = $this->behaviors['global'];
         unset($this->behaviors['global']);
     }
     $script = '';
     if (!empty($globals)) {
         $script .= "\t" . join("\n\t", $globals) . "\n";
     }
     if (!empty($this->behaviors)) {
         $script .= 'jQuery(window).ready(function($){' . "\n";
         $script .= "\t" . join("\t\n", $this->behaviors) . "\n";
         $script .= '});' . "\n";
     }
     shopp_custom_script('shopp', $script);
 }
예제 #5
0
파일: Taxes.php 프로젝트: msigley/shopp
    public function prepare_items()
    {
        $this->id = 'taxrates';
        $defaults = array('paged' => 1, 'per_page' => 25, 'action' => false);
        $args = array_merge($defaults, $_GET);
        extract($args, EXTR_SKIP);
        $rates = (array) shopp_setting('taxrates');
        $this->items = array();
        foreach ($rates as $index => $taxrate) {
            $this->items[$index] = array_merge(self::$template, array('id' => $index), $taxrate);
        }
        $specials = array(ShoppTax::ALL => Shopp::__('All Markets'));
        if (ShoppTax::euvat(false, ShoppBaseLocale()->country(), ShoppTax::EUVAT)) {
            $specials[ShoppTax::EUVAT] = Shopp::__('European Union');
        }
        $this->countries = array_filter(array_merge($specials, (array) shopp_setting('target_markets')));
        $this->zones = ShoppLookup::country_zones();
        $total = count($this->items);
        $this->set_pagination_args(array('total_items' => $total, 'total_pages' => $total / $per_page, 'per_page' => $per_page));
        shopp_custom_script('taxrates', '
			var suggurl = "' . wp_nonce_url(admin_url('admin-ajax.php'), 'wp_ajax_shopp_suggestions') . '",
				rates   = ' . json_encode($this->items) . ',
				zones   = ' . json_encode($this->zones) . ',
				lookup  = ' . json_encode(ShoppLookup::localities()) . ',
				taxrates = [];
		');
    }
예제 #6
0
    public function prepare_items()
    {
        $active = (array) shopp_setting('active_shipping');
        $Shopp = Shopp::object();
        $Shipping = $Shopp->Shipping;
        $Shipping->settings();
        // Load all installed shipping modules for settings UIs
        $Shipping->ui();
        // Setup setting UIs
        $settings = array();
        // Registry of loaded settings for table-based shipping rates for JS
        $this->items = array();
        // Registry for activated shipping rate modules
        $this->installed = array();
        // Registry of available shipping modules installed
        foreach ($Shipping->active as $name => $Module) {
            if (version_compare($Shipping->modules[$name]->since, '1.2') == -1) {
                continue;
            }
            // Skip 1.1 modules, they are incompatible
            $default_name = strtolower($name);
            $fullname = $Module->methods();
            $this->installed[$name] = $fullname;
            if ($Module->ui->tables) {
                $defaults[$default_name] = $Module->ui->settings();
                $defaults[$default_name]['name'] = $fullname;
                $defaults[$default_name]['label'] = Shopp::__('Shipping Method');
            }
            if (array_key_exists($name, $active)) {
                $ModuleSetting = $active[$name];
            } else {
                continue;
            }
            // Not an activated shipping module, go to the next one
            $Entry = new StdClass();
            $Entry->id = sanitize_title_with_dashes($name);
            $Entry->label = $Shipping->modules[$name]->name;
            $Entry->type = $Shipping->modules[$name]->name;
            $Entry->setting = $name;
            if ($this->request('id') == $Entry->setting) {
                $Entry->editor = $Module->ui();
            }
            // Setup shipping service shipping rate entries and settings
            if (!is_array($ModuleSetting)) {
                $Entry->destinations = array($Shipping->active[$name]->destinations);
                $this->items[$name] = $Entry;
                continue;
            }
            // Setup shipping calcualtor shipping rate entries and settings
            foreach ($ModuleSetting as $id => $m) {
                $Entry->setting = "{$name}-{$id}";
                $Entry->settings = shopp_setting($Entry->setting);
                if ($this->request('id') == $Entry->setting) {
                    $Entry->editor = $Module->ui();
                }
                if (isset($Entry->settings['label'])) {
                    $Entry->label = $Entry->settings['label'];
                }
                $Entry->destinations = array();
                $min = $max = false;
                if (isset($Entry->settings['table']) && is_array($Entry->settings['table'])) {
                    foreach ($Entry->settings['table'] as $tablerate) {
                        $destination = false;
                        $d = ShippingSettingsUI::parse_location($tablerate['destination']);
                        if (!empty($d['zone'])) {
                            $Entry->destinations[] = $d['zone'] . ' (' . $d['countrycode'] . ')';
                        } elseif (!empty($d['area'])) {
                            $Entry->destinations[] = $d['area'];
                        } elseif (!empty($d['country'])) {
                            $Entry->destinations[] = $d['country'];
                        } elseif (!empty($d['region'])) {
                            $Entry->destinations[] = $d['region'];
                        }
                    }
                    if (!empty($Entry->destinations)) {
                        $Entry->destinations = array_keys(array_flip($Entry->destinations));
                    }
                    // Combine duplicate destinations
                }
                $this->items[$Entry->setting] = $Entry;
                $settings[$Entry->setting] = shopp_setting($Entry->setting);
                $settings[$Entry->setting]['id'] = $Entry->setting;
                $settings[$Entry->setting] = array_merge($defaults[$default_name], $settings[$Entry->setting]);
                if (isset($settings[$Entry->setting]['table'])) {
                    usort($settings[$Entry->setting]['table'], array('ShippingFramework', '_sorttier'));
                    foreach ($settings[$Entry->setting]['table'] as &$r) {
                        if (isset($r['tiers'])) {
                            usort($r['tiers'], array('ShippingFramework', '_sorttier'));
                        }
                    }
                }
            }
            // end foreach ( $ModuleSetting )
        }
        // end foreach ( $Shipping->active )
        $this->set_pagination_args(array('total_items' => count($this->items), 'total_pages' => 1));
        $postcodes = ShoppLookup::postcodes();
        foreach ($postcodes as &$postcode) {
            $postcode = !empty($postcode);
        }
        $lookup = array('regions' => array_merge(array('*' => Shopp::__('Anywhere')), ShoppLookup::regions()), 'regionmap' => ShoppLookup::regions('id'), 'countries' => ShoppLookup::countries(), 'areas' => ShoppLookup::country_areas(), 'zones' => ShoppLookup::country_zones(), 'postcodes' => $postcodesscre);
        shopp_custom_script('shiprates', '
			var shipping = ' . json_encode(array_map('sanitize_title_with_dashes', array_keys($this->installed))) . ',
				defaults = ' . json_encode($defaults) . ',
				settings = ' . json_encode($settings) . ',
				lookup   = ' . json_encode($lookup) . ';');
    }
예제 #7
0
function contact_meta_box($Purchase)
{
    $screen = get_current_screen();
    $pre = 'page_';
    $page = substr($screen->id, strpos($screen->id, $pre) + strlen($pre));
    ?>
	<script id="customer-editor" type="text/x-jquery-tmpl">
	<?php 
    ob_start();
    ?>

	<div class="editor ${action}">
		<input type="hidden" name="order-action" value="${action}" />
		<p class="inline-fields">
			<span>
			<input type="text" name="customer[firstname]" id="customer-firstname" value="${firstname}" /><br />
			<label for="address-city"><?php 
    _e('First Name', 'Shopp');
    ?>
</label>
			</span>
			<span>
			<input type="text" name="customer[lastname]" id="customer-lastname" value="${lastname}" /><br />
			<label for="address-city"><?php 
    _e('Last Name', 'Shopp');
    ?>
</label>
			</span>
		</p>
		<p>
			<input type="text" name="customer[company]" id="customer-company" value="${company}" /><br />
			<label for="address-address"><?php 
    _e('Company', 'Shopp');
    ?>
</label>
		</p>
		<p>
			<input type="text" name="customer[email]" id="customer-email" value="${email}" /><br />
			<label for="customer-email"><?php 
    _e('Email', 'Shopp');
    ?>
</label>
		</p>
		<p>
			<input type="text" name="customer[phone]" id="customer-phone" value="${phone}" /><br />
			<label for="customer-phone"><?php 
    _e('Phone', 'Shopp');
    ?>
</label>
		</p>
		<?php 
    if ('wordpress' == shopp_setting('account_system')) {
        ?>
		<p class="loginname">
			<input type="text" name="customer[loginname]" id="customer-loginname" value="${loginname}" /><br />
			<label for="customer-loginname"><?php 
        _e('Login Name', 'Shopp');
        ?>
</label>
		</p>
		<?php 
    }
    ?>
		<div>
			<input type="submit" id="cancel-edit-customer" name="cancel-edit-customer" value="<?php 
    Shopp::esc_attr_e('Cancel');
    ?>
" class="button-secondary" />
			<input type="submit" name="save" value="<?php 
    Shopp::esc_attr_e('Save Customer');
    ?>
" class="button-primary alignright" />
		</div>
		<?php 
    if (!isset($_POST['select-customer'])) {
        ?>
		<p class="change-button"><br class="clear" /><input type="submit" id="change-customer" name="change-customer" value="<?php 
        _e('Change Customer', 'Shopp');
        ?>
" class="button-secondary" /></p>
		<?php 
    }
    ?>
	</div>
	<?php 
    $editcustomer = ob_get_contents();
    ob_end_clean();
    echo $editcustomer;
    $customer = array('${action}' => 'update-customer', '${firstname}' => $Purchase->firstname, '${lastname}' => $Purchase->lastname, '${company}' => $Purchase->company, '${email}' => $Purchase->email, '${phone}' => $Purchase->phone, '${marketing}' => isset($Purchase->marketing) ? $Purchase->marketing : false, '${login}' => 'wordpress' == shopp_setting('account_system'));
    $js = preg_replace('/\\${([-\\w]+)}/', '$1', json_encode($customer));
    shopp_custom_script('orders', 'var customer = ' . $js . ';');
    ?>
	</script>

	<script id="customer-s" type="text/x-jquery-tmpl">
	<?php 
    $s = isset($_REQUEST['s']) ? $_REQUEST['s'] : false;
    ob_start();
    if (isset($_POST['select-customer']) && empty($s)) {
        $searchurl = wp_nonce_url(ShoppAdminController::url(array('page' => $page, 'id' => $Purchase->id)), 'wp_ajax_shopp_select_customer');
    } else {
        $searchurl = wp_nonce_url(add_query_arg(array('action' => 'shopp_select_customer', 'page' => $page, 'id' => $Purchase->id), admin_url('admin-ajax.php')), 'wp_ajax_shopp_select_customer');
    }
    if (!isset($_POST['select-customer']) || isset($_POST['select-customer']) && !empty($s)) {
        $iframe = true;
    }
    if (!empty($s)) {
        $searchurl = add_query_arg('s', $s, $searchurl);
    }
    ?>
	<form id="customer-search" action="<?php 
    echo $searchurl;
    ?>
" method="post" <?php 
    if ($iframe) {
        ?>
target="customer-search-results"<?php 
    }
    ?>
><input type="hidden" name="change-customer" value="true" /><input type="hidden" name="action" value="shopp_select_customer" /><input type="hidden" name="page" value="<?php 
    echo esc_attr($page);
    ?>
" /><?php 
    wp_nonce_field('wp_ajax_shopp_select_customer');
    ?>
<p><input type="search" name="s" value="<?php 
    echo esc_attr($s);
    ?>
" placeholder="<?php 
    _e('Search...', 'Shopp');
    ?>
" /></p>
	</form>
	<?php 
    if ($iframe) {
        ?>
	<iframe id="customer-search-results" name="customer-search-results" src="<?php 
        echo esc_url($searchurl);
        ?>
"></iframe>
	<form action="<?php 
        echo ShoppAdminController::url(array('page' => $page, 'id' => (int) $Purchase->id));
        ?>
" method="POST">
	<div><input type="submit" id="cancel-change-customer" name="cancel-change-customer" value="<?php 
        _e('Cancel', 'Shopp');
        ?>
" class="button-secondary" /></div>
	</form>
	<?php 
    }
    ?>
	<?php 
    $search = ob_get_contents();
    ob_end_clean();
    echo $search;
    ?>
	</script>

	<script id="change-customer-ui" type="text/x-jquery-tmpl">
	<?php 
    ob_start();
    ?>
	<h4><?php 
    _e('Search for Customer', 'Shopp');
    ?>
</h4>
	<?php 
    echo ShoppUI::template($search);
    ?>
	<form id="change-customer" action="<?php 
    echo ShoppAdminController::url(array('id' => (int) $Purchase->id));
    ?>
" method="POST">
	<h4><?php 
    _e('Add New Customer', 'Shopp');
    ?>
</h4>
	<input type="hidden" name="change-customer" value="true" />
	<?php 
    echo ShoppUI::template($editcustomer, array('${action}' => 'new-customer', '${savelabel}' => __('Add New Customer', 'Shopp')));
    ?>
	</form>
	<?php 
    $changecustomer = ob_get_contents();
    ob_end_clean();
    echo $changecustomer;
    ?>
	</script>


	<?php 
    if (isset($_POST['select-customer'])) {
        $customer = array();
    }
    if (isset($_REQUEST['s']) && isset($_REQUEST['select-customer'])) {
        echo ShoppUI::template($search);
        return;
    } elseif (isset($_POST['select-customer'])) {
        echo ShoppUI::template($changecustomer);
        return;
    } elseif (isset($_REQUEST['edit-customer'])) {
        ?>
			<form action="<?php 
        echo ShoppAdminController::url(array('id' => (int) $Purchase->id));
        ?>
" method="POST">
			<?php 
        echo ShoppUI::template($editcustomer, $customer);
        ?>
			</form>
		<?php 
        return;
    }
    ?>
	<div id="change-customer-editor"></div>
	<form action="<?php 
    echo ShoppAdminController::url(array('id' => (int) $Purchase->id));
    ?>
" method="post" id="customer-editor-form"></form>
	<div class="display">
		<form action="<?php 
    echo ShoppAdminController::url(array('id' => $Purchase->id));
    ?>
" method="get">
		<?php 
    $targets = shopp_setting('target_markets');
    ?>
			<input type="hidden" id="edit-customer-data" value="<?php 
    echo esc_attr(json_encode($customer));
    ?>
" />
			<input type="hidden" name="page" value="<?php 
    echo $page;
    ?>
" />
			<input type="hidden" name="id" value="<?php 
    echo $Purchase->id;
    ?>
" />
			<input type="submit" id="edit-customer" name="edit-customer" value="<?php 
    _e('Edit', 'Shopp');
    ?>
" class="button-secondary button-edit" />
		</form>
	<?php 
    $avatar = get_avatar($Purchase->email, 64);
    $customer_url = add_query_arg(array('page' => 'shopp-customers', 'id' => $Purchase->customer), admin_url('admin.php'));
    $customer_url = apply_filters('shopp_order_customer_url', $customer_url);
    $email_url = 'mailto:' . $Purchase->email . '?subject=' . sprintf(__('RE: %s: Order #%s', 'Shopp'), get_bloginfo('sitename'), $Purchase->id);
    $email_url = apply_filters('shopp_order_customer_email_url', $email_url);
    $phone_url = 'callto:' . preg_replace('/[^\\d+]/', '', $Purchase->phone);
    $phone_url = apply_filters('shopp_order_customer_phone_url', $phone_url);
    $accounts = shopp_setting('account_system');
    $wp_user = false;
    if ('wordpress' == $accounts) {
        $Customer = new ShoppCustomer($Purchase->customer);
        $WPUser = get_userdata($Customer->wpuser);
        $edituser_url = add_query_arg('user_id', $Customer->wpuser, admin_url('user-edit.php'));
        $edituser_url = apply_filters('shopp_order_customer_wpuser_url', $edituser_url);
    }
    ?>
	<div class="alignleft"><?php 
    echo $avatar;
    ?>
</div>
	<div class="alignleft">
	<span class="fn"><a href="<?php 
    echo esc_url($customer_url);
    ?>
"><?php 
    echo esc_html("{$Purchase->firstname} {$Purchase->lastname}");
    ?>
</a></span>
	<?php 
    if ('wordpress' == $accounts && !empty($WPUser->user_login)) {
        ?>
<br /><span class="wplogin"><a href="<?php 
        echo esc_attr($edituser_url);
        ?>
"><?php 
        echo esc_html($WPUser->user_login);
        ?>
</a></span><?php 
    }
    ?>
	<?php 
    if (!empty($Purchase->company)) {
        echo '<br /> <div class="org">' . esc_html($Purchase->company) . '</div>';
    }
    ?>
	<?php 
    if (!empty($Purchase->email)) {
        echo '<br /><span class="email"><a href="' . esc_url($email_url) . '">' . esc_html($Purchase->email) . '</a></span>';
    }
    ?>
	<?php 
    if (!empty($Purchase->phone)) {
        echo '<br /><span class="phone"><a href="' . esc_attr($phone_url) . '">' . esc_html($Purchase->phone) . '</a></span>';
    }
    ?>
	<p class="customer <?php 
    echo $Purchase->Customer->marketing == "yes" ? 'marketing' : 'nomarketing';
    ?>
"><?php 
    $Purchase->Customer->marketing == "yes" ? _e('Agreed to marketing', 'Shopp') : _e('No marketing', 'Shopp');
    ?>
</p>
	</div>
	<br class="clear" />
	</div>
	<?php 
}
예제 #8
0
파일: Payments.php 프로젝트: msigley/shopp
 public function prepare_items()
 {
     $defaults = array('paged' => 1, 'per_page' => 25, 'action' => false);
     $args = array_merge($defaults, $_GET);
     extract($args, EXTR_SKIP);
     $start = $per_page * ($paged - 1);
     $edit = false;
     $Gateways = Shopp::object()->Gateways;
     $Gateways->settings();
     // Load all installed gateways for settings UIs
     do_action('shopp_setup_payments_init');
     $Gateways->ui();
     // Setup setting UIs
     $activated = $Gateways->activated();
     foreach ($activated as $slug => $classname) {
         $Gateway = $Gateways->get($classname);
         $Gateway->payid = $slug;
         $this->items[] = $Gateway;
         if ($this->request('id') == $slug) {
             $this->editor = $Gateway->ui();
         }
     }
     add_action('shopp_gateway_module_settings', array($Gateways, 'templates'));
     $total = count($this->items);
     $this->set_pagination_args(array('total_items' => $total, 'total_pages' => $total / $per_page, 'per_page' => $per_page));
     $installed = array();
     foreach ((array) $Gateways->modules as $slug => $module) {
         $installed[$slug] = $module->name;
     }
     asort($installed);
     $this->installed = $installed;
     shopp_custom_script('payments', 'var gateways = ' . json_encode(array_map('sanitize_title_with_dashes', array_keys($installed))) . ';' . ($event ? "jQuery(document).ready(function(\$) { \$(document).trigger('" . $event . "Settings',[\$('#payments-settings-table tr." . $event . "-editing')]); });" : ''));
 }
예제 #9
0
 public function behaviors($script)
 {
     shopp_custom_script('payments', $script);
 }
예제 #10
0
파일: Modules.php 프로젝트: borkweb/shopp
 public function behaviors($script)
 {
     shopp_custom_script('shopp', $script);
 }
예제 #11
0
 /**
  * Outputs debug structures to the browser console.
  *
  * @since 1.3.9
  *
  * @param mixed $data The data to display in the console.
  * @return void
  **/
 public static function debug($data)
 {
     $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
     list($debugcall, $callby, ) = $backtrace;
     $stack = array();
     foreach ($backtrace as $id => $call) {
         if ('debug' == $caller['function']) {
             continue;
         }
         $ref = empty($call['file']) ? 'Call #' . $id : basename($call['file']) . ' @ ' . $call['line'];
         $stack[$ref] = isset($call['class']) ? $call['class'] . $call['type'] . $call['function'] . "()" : $call['function'];
     }
     $callstack = (object) $stack;
     $caller = (empty($callby['class']) ? '' : $callby['class'] . $callby['type']) . $callby['function'] . '() from ' . $debugcall['file'] . ' @ ' . $debugcall['line'];
     shopp_custom_script('shopp', "\n\t\t\tconsole.group('Debug " . $caller . "');\n\t\t\tconsole.debug(" . json_encode($data) . ");\n\t\t\tconsole.log('Call stack: %O', " . json_encode($stack) . ");\n\t\t\tconsole.groupEnd();\n\t\t");
 }
예제 #12
0
파일: Orders.php 프로젝트: msigley/shopp
 public function json(array $data = array())
 {
     $data = preg_replace('/\\${([-\\w]+)}/', '$1', json_encode($data));
     shopp_custom_script('orders', 'address["' . $this->type . '"] = ' . $data . ';');
 }
예제 #13
0
		<input type="submit" id="cancel-edit-customer" name="cancel-edit-customer" value="<?php 
Shopp::esc_attr_e('Cancel');
?>
" class="button-secondary" />
		<input type="submit" name="save" value="<?php 
Shopp::esc_attr_e('Update');
?>
" class="button-primary alignright" />
	</div>
</div>
<?php 
$editcustomer = ob_get_clean();
echo $editcustomer;
$customer = array('${action}' => 'update-customer', '${id}' => $Purchase->customer, '${firstname}' => $Purchase->firstname, '${lastname}' => $Purchase->lastname, '${company}' => $Purchase->company, '${email}' => $Purchase->email, '${phone}' => $Purchase->phone, '${login}' => 'wordpress' == shopp_setting('account_system'));
$js = preg_replace('/\\${([-\\w]+)}/', '$1', json_encode($customer));
shopp_custom_script('orders', 'var customer = ' . $js . ';');
?>
</script>

<?php 
if (isset($_POST['select-customer'])) {
    $customer = array();
}
if (isset($_REQUEST['s']) && isset($_REQUEST['select-customer'])) {
    echo ShoppUI::template($search);
    return;
} elseif (empty($Purchase->customer)) {
    echo ShoppUI::template($editcustomer);
    return;
} elseif (isset($_REQUEST['edit-customer'])) {
    ?>
예제 #14
0
 public function prepare_items()
 {
     $defaults = array('paged' => 1, 'per_page' => 25, 'action' => false, 'selected' => array());
     $args = array_merge($defaults, $_GET);
     extract($args, EXTR_SKIP);
     $start = $per_page * ($paged - 1);
     $edit = false;
     $ImageSetting = new ShoppImageSetting($edit);
     $table = $ImageSetting->_table;
     $columns = 'SQL_CALC_FOUND_ROWS *';
     $where = array("type='{$ImageSetting->type}'", "context='{$ImageSetting->context}'");
     $limit = "{$start},{$per_page}";
     $options = compact('columns', 'useindex', 'table', 'joins', 'where', 'groupby', 'having', 'limit', 'orderby');
     $query = sDB::select($options);
     $this->items = sDB::query($query, 'array', array($ImageSetting, 'loader'));
     $found = sDB::found();
     $json = array();
     $skip = array('created', 'modified', 'numeral', 'context', 'type', 'sortorder', 'parent');
     foreach ($this->items as &$Item) {
         if (method_exists($Item, 'json')) {
             $json[$Item->id] = $Item->json($skip);
         }
     }
     shopp_custom_script('imageset', 'var images = ' . json_encode($json) . ';');
     $this->set_pagination_args(array('total_items' => $found, 'total_pages' => $found / $per_page, 'per_page' => $per_page));
 }
예제 #15
0
파일: Storage.php 프로젝트: borkweb/shopp
 public function behaviors($script)
 {
     shopp_custom_script('system-settings', $script);
 }
예제 #16
0
<?php

$editaddress = ShoppAdminCustomerBillingAddressBox::editor($Customer, 'shipping');
$address = array('${type}' => 'shipping', '${address}' => $Customer->Shipping->address, '${xaddress}' => $Customer->Shipping->xaddress, '${city}' => $Customer->Shipping->city, '${state}' => $Customer->Shipping->state, '${postcode}' => $Customer->Shipping->postcode, '${country}' => $Customer->Shipping->country, '${statemenu}' => Shopp::menuoptions($Customer->_shipping_states, $Customer->Shipping->state, true), '${countrymenu}' => Shopp::menuoptions($Customer->_countries, $Customer->Shipping->country, true));
$js = preg_replace('/\\${([-\\w]+)}/', '$1', json_encode($address));
shopp_custom_script('customers', 'address["shipping"] = ' . $js . ';');
?>
<div id="shipping-address-editor" class="editor">
<?php 
echo ShoppUI::template($editaddress, $address);
?>
</div>
예제 #17
0
<script id="address-editor" type="text/x-jquery-tmpl">
<?php 
$editaddress = ShoppAdminCustomerBillingAddressBox::editor($Customer, 'billing');
echo $editaddress;
$address = array('${type}' => 'billing', '${address}' => $Customer->Billing->address, '${xaddress}' => $Customer->Billing->xaddress, '${city}' => $Customer->Billing->city, '${state}' => $Customer->Billing->state, '${postcode}' => $Customer->Billing->postcode, '${country}' => $Customer->Billing->country, '${statemenu}' => Shopp::menuoptions($Customer->_billing_states, $Customer->Billing->state, true), '${countrymenu}' => Shopp::menuoptions($Customer->_countries, $Customer->Billing->country, true));
$js = preg_replace('/\\${([-\\w]+)}/', '$1', json_encode($address));
shopp_custom_script('customers', 'address["billing"] = ' . $js . ';');
?>
</script>
<div id="billing-address-editor" class="editor">
<?php 
echo ShoppUI::template($editaddress, $address);
?>
</div>