예제 #1
0
파일: index.php 프로젝트: kitsune/ConAsset
     }
 }
 if ($_GET['type'] == 'box') {
     $box = new Box($connection);
     /*echo '<pre>';
     		nl2br(var_dump($_POST));
     		echo '</pre>';
     		*/
     if (isset($_POST['submit'])) {
         if ($_GET['action'] == 'add') {
             $box->loadFromPage();
             $box->insert();
         } else {
             if ($_GET['action'] == 'edit') {
                 $box->loadFromPage();
                 $box->update();
             } else {
                 if ($_GET['action'] == 'find') {
                     $box->findBox($_POST['barcode']);
                 } else {
                     if ($_GET['action'] == 'checkout') {
                         $connection->query("SELECT a_barcode FROM assets WHERE a_box = '{$_POST['barcode']}' and a_checkout_to = ''");
                         if ($connection->result_size() <= 0) {
                             throw new Exception('no assets or all assets checked out inside box with barcode: ' . $_POST['barcode']);
                         }
                         $barcodes = array();
                         while ($row = $connection->fetch_row()) {
                             $barcodes[] = $row[0];
                         }
                         foreach ($barcodes as $barcode) {
                             $the_asset = new Asset($connection);