Ejemplo n.º 1
0
 public function __construct($TITLE, $CONTROL_PANEL, $MODE = NULL, $THEAD, $SELECTABLE = '')
 {
     $this->HEADER = '<div class="panel-heading">' . $TITLE . '</div>';
     $this->CONTROL_PANEL = '<ul class="nav nav-pills nav-justified">';
     foreach ($CONTROL_PANEL as $KEY => $VALUE) {
         $this->CONTROL_PANEL .= '<li><a' . (isset($VALUE['href']) ? ' href="' . $VALUE['href'] . '"' : '') . (isset($VALUE['id']) ? ' id="' . $VALUE['id'] . '"' : '') . ' class="CONTROL_PANEL list-group-item' . (isset($VALUE['class']) ? ' ' . $VALUE['class'] : '') . '">' . $KEY . '</a></li>';
     }
     $this->CONTROL_PANEL .= '</ul>';
     if (isset($MODE) && is_array($MODE)) {
         foreach ($MODE as $KEY => $VALUE) {
             $this->MODE[] = isset($VALUE) ? portal::warp($_GET['subnav'], $VALUE) : '';
         }
     } else {
         $this->MODE = isset($MODE) ? portal::warp($_GET['subnav'], $MODE) : '';
     }
     $this->TABLE = '<table class="' . $SELECTABLE . ' table table-hover">';
     $this->TABLE .= '<thead><tr>';
     foreach ($THEAD as $KEY => $VALUE) {
         $this->TABLE .= '<th><a href="?' . self::orderBy($VALUE) . '" class="list-group-item">' . $KEY . ' <span class="' . self::orderByIcon($VALUE) . '"></span></a></th>';
     }
     $this->TABLE .= '</tr></thead>';
     $this->TABLE .= portal::warp($_GET['subnav'], 'TBODY');
     $this->TABLE .= '</table>';
 }
Ejemplo n.º 2
0
<?php

/* =======================================================================
 * (C) 2015 Stephen Palmer
 * All Rights Reserved
 * File: warp.php
 * Description: Navigateable script that takes advantage of portal's warp
 *              function. This is primarily used for signing into the site. 
 *              Accepts get parameters for the page/class and the 
 *              action/function. Warp picks up the slack from there.
 * Author: Stephen Palmer <*****@*****.**>
 * PHP Version: 5.4
 * ======================================================================= */
session_start();
require_once '../classes/portal.php';
portal::warp($_GET['nav'], $_GET['action']);
Ejemplo n.º 3
0
 public static function edit()
 {
     $DB = portal::database();
     extract($_GET);
     $IDS = json_decode($id);
     foreach ($IDS as $ID) {
         $SQL_CONCAT[] = " inventory.ID = ? ";
     }
     $DB->query("SELECT inventory.ID AS 'INVENTORY_ID',\r\n                        SKU,\r\n                        CATEGORY_ID,\r\n                        CLASSIFICATION_ID,\r\n                        inventory.WEIGHT,\r\n                        CHARACTERISTICS\r\n                        FROM inventory \r\n                        LEFT JOIN category ON CATEGORY_ID = category.ID \r\n                        LEFT JOIN classification ON CLASSIFICATION_ID = classification.ID\r\n                        LEFT JOIN inventory_characteristic ON inventory.ID = INVENTORY_ID\r\n                        WHERE " . implode(' OR ', $SQL_CONCAT), $IDS);
     $INVENTORY = $DB->fetch_assoc_all();
     $CATEGORIES = portal::warp('category', 'getCategory');
     $CLASSIFICATIONS = portal::warp('classification', 'getClassification');
     $PANEL = '<div class="panel panel-default">
                       <form method="POST" action="processes/update.php?page=inventoryReview&action=update">
                       <div class="panel-heading">
                           Edit Inventory
                       </div>';
     foreach ($INVENTORY as $KEY => $VALUE) {
         extract($VALUE);
         $DEFAULT_CHARACTERISTIC = portal::warp('classification', 'getClassificationCharacteristic', array('CATEGORY_ID' => $CATEGORY_ID, 'CLASSIFICATION_ID' => $CLASSIFICATION_ID));
         $CHARACTERISTICS = json_decode($CHARACTERISTICS);
         $PANEL .= '<div class="row" style="padding-bottom:15px;">
                            <div class="col-lg-4">
                                <div class="input-group">
                                    <span class="input-group-addon">
                                        Category
                                    </span>
                                    <select class="form-control">';
         foreach ($CATEGORIES as $KEY => $VALUE) {
             extract($VALUE);
             $PANEL .= '<option value="' . $ID . '"' . ($ID === $CATEGORY_ID ? ' selected' : '') . '>' . $CATEGORY . '</option>';
         }
         $PANEL .= '</select>
                                </div>
                            </div>
                            <div class="col-lg-4">
                                <div class="input-group">
                                    <span class="input-group-addon">
                                        Classification
                                    </span>
                                    <select class="form-control">';
         foreach ($CLASSIFICATIONS as $KEY => $VALUE) {
             extract($VALUE);
             $PANEL .= '<option value="' . $ID . '"' . ($ID === $CLASSIFICATION_ID ? ' selected' : '') . '>' . $CLASSIFICATION . '</option>';
         }
         $PANEL .= '</select>
                                </div>
                            </div>';
         $PANEL .= '<div class="col-lg-4">
                                <div class="input-group">
                                    <span class="input-group-addon">
                                        Condition
                                    </span>
                                    <select name="inventory[Condition]" class="inventory-control form-control">';
         $OPTIONS = array('New', 'Pre-Owned', 'Damaged');
         foreach ($OPTIONS as $OPTION) {
             $PANEL .= '<option value="' . $OPTION . '"' . ($OPTION === $CHARACTERISTICS->Condition ? ' selected' : '') . '>' . $OPTION . '</option>';
         }
         $PANEL .= '</select>
                                </div>
                            </div>
                            <div class="col-lg-4">
                                <div class="input-group">
                                    <span class="input-group-addon">
                                        Quantity
                                    </span>
                                    <input type="text" class="form-control" value="' . $CHARACTERISTICS->Quantity . '">
                                </div>
                            </div>';
         foreach ($DEFAULT_CHARACTERISTIC as $KEY => $VALUE) {
             extract($VALUE);
             $PANEL .= '<div class="col-lg-4">
                                <div class="input-group">
                                    <span class="input-group-addon">
                                        ' . $CHARACTERISTIC . '
                                    </span>
                                    <input type="text" class="form-control" value="' . $CHARACTERISTICS->{$CHARACTERISTIC} . '">
                                </div>
                            </div>';
         }
         $PANEL .= '    <div class="col-lg-4">
                                <div class="input-group">
                                    <span class="input-group-addon">
                                        SKU
                                    </span>
                                    <input type="text" class="form-control" value="' . $SKU . '">
                                </div>
                            </div>
                        </div>';
     }
     $PANEL .= '   <div class="row">
                           <div class="col-xs-3 col-xs-offset-3">
                               <button type="submit" class="btn btn-default form-control">
                                   Update
                               </button>
                           </div>
                           <div class="col-xs-3">
                               <button name="cancel" type="submit" class="btn btn-default form-control">
                                   Cancel
                               </button>
                           </div>
                       </div>
                       </form>
                   </div>';
     return $PANEL;
 }
Ejemplo n.º 4
0
<?php

session_start();
require_once '../classes/portal.php';
if (portal::isSignedIn() && isset($_GET['page']) && isset($_GET['action'])) {
    $ORIGIN = $_SERVER['HTTP_REFERER'];
    $ORIGIN = explode('?', $ORIGIN);
    $ORIGIN = '?' . $ORIGIN[1];
    $ORIGIN = explode('&action', $ORIGIN);
    $ORIGIN = $ORIGIN[0];
    if (!isset($_POST['cancel'])) {
        portal::warp($_GET['page'], $_GET['action']);
    }
    portal::redirect('../' . $ORIGIN);
} else {
    portal::redirect();
}
Ejemplo n.º 5
0
 public static function selectCharacteristic($ECHO = TRUE)
 {
     $DEFAULT_CHARACTERISTICS = portal::warp('characteristic', 'getCharacteristic');
     $SELECT = ' <div class="col-lg-6 col-lg-offset-3">
                         <div class="input-group">
                             <span class="input-group-addon">
                                 Characteristic
                             </span>
                             <select class="form-control" name="mapping[CHARACTERISTIC_ID][]">
                                 <option></option>';
     foreach ($DEFAULT_CHARACTERISTICS as $CHARACTERISTIC) {
         extract($CHARACTERISTIC);
         $SELECT .= '        <option value="' . $ID . '">' . $CHARACTERISTIC . '</option>';
     }
     $SELECT .= '        </select>
                             <span class="input-group-btn">
                                 <button type="button" class="removeCharacteristic btn btn-default">
                                     <span class="glyphicon glyphicon-remove"></span>
                                 </button>
                             </span>
                         </div>
                     </div>';
     if (!$ECHO) {
         return $SELECT;
     }
     echo $SELECT;
 }
Ejemplo n.º 6
0
 public static function edit()
 {
     $DB = portal::database();
     extract($_GET);
     $IDS = json_decode($id);
     foreach ($IDS as $ID) {
         $SQL_CONCAT[] = " user_account.ID = ? ";
     }
     $DB->query("SELECT user_account.ID AS 'USER_ACCOUNT_ID',\r\n                               USER_NAME_ID,\r\n                               USER_NAME,\r\n                               USER_TYPE_ID,\r\n                               USER_EMAIL \r\n                        FROM user_account \r\n                               LEFT JOIN user_name ON USER_NAME_ID = user_name.ID \r\n                               LEFT JOIN user_email ON USER_EMAIL_ID = user_email.ID\r\n                        WHERE " . implode(' OR ', $SQL_CONCAT), $IDS);
     $RESULTS = $DB->fetch_assoc_all();
     $PANEL = '<div id="new" class="panel panel-default" style="margin-bottom:0px;">
                     <div class="panel-heading">Edit User</div>
                     <div class="panel-body">
                         <form method="POST" action="processes/update.php?page=user&action=update">';
     foreach ($RESULTS as $KEY => $VALUE) {
         extract($VALUE);
         $PANEL .= '<div class="row" style="padding-bottom:15px;">
                            <input type="hidden" name="USERS[' . $USER_ACCOUNT_ID . '][USER_NAME_ID]" value="' . $USER_NAME_ID . '">
                            <div class="col-lg-6">
                                <div class="input-group">
                                    <span class="input-group-addon">
                                        Username
                                    </span>
                                    <input type="text" name="USERS[' . $USER_ACCOUNT_ID . '][USER_NAME]" value="' . $USER_NAME . '" class="form-control">
                                </div>
                            </div>
                            <div class="col-lg-6">
                                <div class="input-group">
                                    <span class="input-group-addon">
                                        Password
                                    </span>
                                    <input type="password" name="USERS[' . $USER_ACCOUNT_ID . '][USER_PASS]" class="form-control">
                                </div>
                            </div>
                            <div class="col-lg-6">
                                <div class="input-group">
                                    <span class="input-group-addon">
                                        Type
                                    </span>
                                    <select name="USERS[' . $USER_ACCOUNT_ID . '][USER_TYPE_ID]" class="form-control">';
         $USER_TYPES = portal::warp('user_type', 'getUserType');
         foreach ($USER_TYPES as $VALUE) {
             extract($VALUE);
             $PANEL .= '<option value="' . $ID . '"' . ($ID === $USER_TYPE_ID ? ' selected' : '') . '>' . $USER_TYPE . '</option>';
         }
         $PANEL .= '            </select>
                                </div>
                            </div>
                            <div class="col-lg-6">
                                <div class="input-group">
                                    <span class="input-group-addon">
                                        Conf Password
                                    </span>
                                    <input type="password" name="USERS[' . $USER_ACCOUNT_ID . '][CONF_PASS]" class="form-control">
                                </div>
                            </div>
                            <div class="col-lg-6">
                                <div class="input-group">
                                    <span class="input-group-addon">
                                        Email Address
                                    </span>
                                    <input type="text" name="USERS[' . $USER_ACCOUNT_ID . '][USER_EMAIL]" value="' . $USER_EMAIL . '" class="form-control">
                                </div>
                            </div>
                        </div>';
     }
     $PANEL .= '     <div class="row">
                                 <div class="col-lg-3 col-lg-offset-3">
                                     <button type="submit" class="btn btn-default form-control">Update Users</button>
                                 </div>
                                 <div class="col-lg-3">
                                     <button name="cancel" type="submit" class="btn btn-default form-control">Cancel</button>
                                 </div>
                             </div>
                         </form>
                     </div>
                 </div>';
     return $PANEL;
 }
Ejemplo n.º 7
0
<?php

$FILTERS = isset($_GET['filters']) ? json_decode($_GET['filters']) : NULL;
$CATEGORIES = portal::warp('category', 'getCategory');
$CATEGORY_OPTIONS = array('<option></option>');
foreach ($CATEGORIES as $KEY => $VALUE) {
    extract($VALUE);
    $CATEGORY_OPTIONS[] = '<option value="' . $ID . '">' . $CATEGORY . '</option>';
}
$CATEGORY_OPTIONS = implode(',', $CATEGORY_OPTIONS);
$CLASSIFICATIONS = portal::warp('classification', 'getClassification');
$CLASSIFICATION_OPTIONS = array('<option></option>');
foreach ($CLASSIFICATIONS as $KEY => $VALUE) {
    extract($VALUE);
    $CLASSIFICATION_OPTIONS[] = '<option value="' . $ID . '">' . $CLASSIFICATION . '</option>';
}
$CLASSIFICATION_OPTIONS = implode(',', $CLASSIFICATION_OPTIONS);
$CONDITIONS = array('New', 'Pre-Owned', 'Damaged');
$CONDITION_OPTIONS = array('<option></option>');
foreach ($CONDITIONS as $VALUE) {
    $CONDITION_OPTIONS[] = '<option value="' . $VALUE . '">' . $VALUE . '</option>';
}
$CONDITION_OPTIONS = implode(',', $CONDITION_OPTIONS);
$URL = '?' . $_SERVER['QUERY_STRING'];
if (isset($_GET['id'])) {
    $TEMP = explode('&id', $URL);
    $URL = $TEMP[0];
}
$ACTION = array('edit' => '&action=edit');
$TITLE = 'Review Inventory Items';
$CONTROL_PANEL = array('Select All' => array('id' => 'select_all'), 'Deselect All' => array('id' => 'deselect_all'), 'Edit Item' => array('id' => 'edit', 'href' => strpos($_SERVER['QUERY_STRING'], '&action=edit') ? portal::scrubString($ACTION, '', $URL) : portal::scrubString($ACTION, '', $URL) . $ACTION['edit']), 'Delete Item' => array('id' => 'delete'));
Ejemplo n.º 8
0
$CATEGORY_OPTIONS = array();
foreach ($CATEGORIES as $KEY => $VALUE) {
    extract($VALUE);
    $CATEGORY_OPTIONS[] = '<option value="' . $ID . '"' . (isset($_GET['category']) && $ID === $_GET['category'] ? ' selected' : '') . '>' . $CATEGORY . '</option>';
}
$CATEGORY_OPTIONS = implode(',', $CATEGORY_OPTIONS);
if (isset($_GET['category'])) {
    $CLASSIFICATIONS = portal::warp('category', 'getCategoryClassification', array('ID' => $_GET['category']));
    $CLASSIFICATION_OPTIONS = array();
    foreach ($CLASSIFICATIONS as $KEY => $VALUE) {
        extract($VALUE);
        $CLASSIFICATION_OPTIONS[] = '<option value="' . $ID . '"' . (isset($_GET['classification']) && $ID === $_GET['classification'] ? ' selected' : '') . '>' . $CLASSIFICATION . '</option>';
    }
    $CLASSIFICATION_OPTIONS = implode('', $CLASSIFICATION_OPTIONS);
}
$CONDITION_OPTIONS = array('New', 'Pre-Owned', 'Damaged');
foreach ($CONDITION_OPTIONS as $OPTION) {
    $CONDITION_OPTIONS[] = '<option value="' . $OPTION . '">' . $OPTION . '</option>';
}
$CONDITION_OPTIONS = implode('', $CONDITION_OPTIONS);
if (isset($_GET['category']) && isset($_GET['classification'])) {
    $CHARACTERISTICS = portal::warp('classification', 'getClassificationCharacteristic', array('CATEGORY_ID' => $_GET['category'], 'CLASSIFICATION_ID' => $_GET['classification']));
    $CHARACTERISTIC_FIELDS = array();
    foreach ($CHARACTERISTICS as $KEY => $VALUE) {
        extract($VALUE);
        $CHARACTERISTIC_FIELDS[] = '<div class="col-lg-4">
                                          ' . $CHARACTERISTIC . '<input type="text" class="form-control" name="inventory[' . $CHARACTERISTIC . ']">
                                      </div>';
    }
    $CHARACTERISTIC_FIELDS = implode('', $CHARACTERISTIC_FIELDS);
}