예제 #1
0
 public static function read_by_params($params)
 {
     if (strlen($params['part_or_key']) == 16) {
         $quote = self::read_key($params['part_or_key']);
         $quote['part_or_key2'] = 'key';
         if (!Session::is_admin() && array_key_exists('key', $quote)) {
             $model = ['quote_id' => $quote['id'], 'ip' => $_SERVER['REMOTE_ADDR']];
             QuoteView::create($model);
         }
     } else {
         $quote = self::read_part($params['part_or_key']);
         $quote['part_or_key2'] = $params['part_or_key'];
     }
     return $quote;
 }
예제 #2
0
 public static function read_views($quote_id)
 {
     return QuoteView::read(['*'], FALSE, ['quote_id = ?', $quote_id]);
 }
예제 #3
0
    <table class="data">
      <thead>
        <th>Date</th>
        <th>Expires</th>
        <th>Company</th>
        <th>Contact/Email/Key</th>
        <th>Items</th>
        <th>Views</th>
      </thead>
      <tbody>
        <?php 
$quotes = Quote::read(['*'], FALSE, ['created > CURRENT_DATE - INTERVAL 2 MONTH'], 'created DESC');
foreach ($quotes as $quote) {
    $expiration = Util2::future_date(substr($quote['created'], 0, 10), 60);
    $items = QuoteItem::read_items($quote['id']);
    $views = QuoteView::read_views($quote['id']);
    $item_details = [];
    foreach ($items as $item) {
        $item_details[] = $item['quantity'] . ' ' . $item['part'];
    }
    $view_details = [];
    foreach ($views as $view) {
        $view_details[] = $view['created'] . ' ' . $view['ip'];
    }
    echo '<tr>';
    echo '<td>' . htmlspecialchars($quote['created']) . '</td>';
    echo '<td>' . htmlspecialchars($expiration) . '</td>';
    echo '<td>' . htmlspecialchars($quote['company']) . '</td>';
    echo '<td>' . htmlspecialchars($quote['technical_name']) . '<br/>';
    echo htmlspecialchars($quote['technical_email']) . '<br/>';
    echo '<a href="/order-form/' . $quote['key'] . '" target="_blank">' . htmlspecialchars($quote['key']) . '</a></td>';