Пример #1
0
 static function _getUrlSchemeFromServerVar($server)
 {
     return Helper_URL::getUrlSchemeFromServerVar($server);
 }
Пример #2
0
/**
 * @var Exception $exception
 */
?>
<!DOCTYPE html>
<html>
<?php 
echo View::factory('head');
?>
<body>
<div class="navbar navbar-fixed-top">
    <div class="navbar-inner">
        <div class="container">
            <a class="brand" href="<?php 
echo Helper_URL::create();
?>
">Re:admin</a>
        </div>
    </div>
</div>
<div class="container">
    <div class="content">
        <h3>Exception</h3>
        <div class="well">
            <div class="accordion" id="accordion">
            <?php 
while ($exception) {
    ?>
                <div class="accordion-group">
                    <div class="accordion-heading">
Пример #3
0
 static function addPageToUrl($url, $page)
 {
     return Helper_URL::addGetToUrl($url, $page != 1 ? "page={$page}" : NULL);
 }
Пример #4
0
 function addGetToUrl($url, $get)
 {
     return Helper_URL::addGetToUrl($url, $get);
 }
Пример #5
0
 static function composeImages($controller, $obj, $dir, $fieldName = 'Images')
 {
     $getMethod = 'get' . $fieldName;
     $imgs = array();
     if (is_callable(array($obj, $getMethod))) {
         $imgs = $obj->{$getMethod}();
     }
     $images = array();
     if ($imgs) {
         foreach ($imgs as $img) {
             $relPath = "/content/{$dir}/" . rawurlencode($img);
             if (strpos($img, '/') === 0) {
                 $relPath = $img;
             }
             $image = $img;
             if (!Helper_URL::isURL($img)) {
                 $image = $controller->composeResource($relPath);
             }
             $images[] = $image;
         }
     }
     return $images;
 }
Пример #6
0
 static function getTestEcommerceProduct($controller, $idx)
 {
     $product = self::getTestProduct($controller, $idx);
     $product['wish_count'] = $idx * 7 * 7;
     $product['options'] = array();
     $product['general_options'] = array();
     if ($idx % 2) {
         $product['options']['size'] = array('S', 'M', 'L', 'XL');
     }
     if ($idx != 5 && $idx != 8) {
         $product['options']['color'] = array('Red', 'Light Green', 'Blue');
     }
     $decorations = self::_getProductDecorations($controller);
     if (isset($decorations[$idx - 1])) {
         $decoration = Helper_URL::constructFid($decorations[$idx - 1]);
         $product['decoration'] = $decoration;
     }
     $product['is_backorder'] = $idx % 3 == 1;
     $product['stock'] = ($idx - 1) % 4 + 1;
     $product['sold_stock'] = ($idx - 1) % 20 * 7;
     $product['is_in_stock'] = !(bool) ($idx % 3 == 1);
     $product['variants'] = array('|Red' => 'available', '|Blue' => 'no_stock');
     $product['detailed_variants'] = array('|Red' => array('price' => 5000.5, 'stock' => 5), '|Blue' => array('price' => 1000.5, 'stock' => 0));
     if ($idx % 2) {
         $product['variants'] = array('S|Red' => 'no_stock', 'M|Red' => 'available', 'S|Light Green' => 'available', '|Blue' => 'no_stock');
         $product['detailed_variants'] = array('S|Red' => array('price' => 1000.5, 'stock' => 0), 'M|Red' => array('price' => 2000, 'stock' => 1000000), 'S|Light Green' => array('price' => 2000.5, 'stock' => 4), '|Blue' => array('price' => 10000, 'stock' => 0));
     }
     $product['prices_by_color'] = array('Red' => 20.5, 'Blue' => 3000, 'Pink' => 40);
     if ($idx == 7) {
         $product['options']['size'] = array('S', 'M', 'L', 'XL');
         unset($product['options']['color']);
         $product['variants'] = array('S|' => 'available', 'L|' => 'no_stock');
         $product['detailed_variants'] = array('S|' => array('price' => 3000.5, 'stock' => 3), 'L|' => array('price' => 1000.5, 'stock' => 0));
     }
     if ($idx == 4) {
         $product['variants'] = array();
         $product['detailed_variants'] = array();
     }
     $titles = array('Size', 'Color');
     foreach ($product['options'] as $key => $val) {
         $i = 0;
         if ($key == 'size') {
             $i = 1;
         } else {
             if ($key == 'color') {
                 $i = 2;
             }
         }
         $genkey = 'option' . $i;
         $genopt = array('title' => isset($titles[($i - 1) % 2]) ? $titles[($i - 1) % 2] : "Option {$i}", 'value' => "{$genkey}_value", 'options' => $val);
         $product['general_options'][$genkey] = $genopt;
         $i++;
     }
     return $product;
 }