case 'make_private':
             $sql = 'UPDATE ' . EQUIPMENT_STATUS_TABLE . ' SET ispublic=0 ' . ' WHERE status_id IN (' . implode(',', db_input($_POST['ids'])) . ')';
             if (db_query($sql) && ($num = db_affected_rows())) {
                 if ($num == $count) {
                     $msg = 'Selected status made PRIVATE';
                 } else {
                     $warn = "{$num} of {$count} selected status made PRIVATE";
                 }
             } else {
                 $errors['err'] = 'Unable to disable selected status PRIVATE';
             }
             break;
         case 'delete':
             $i = 0;
             foreach ($_POST['ids'] as $k => $v) {
                 if (($c = Equipment_Status::lookup($v)) && $c->delete()) {
                     $i++;
                 }
             }
             if ($i == $count) {
                 $msg = 'Selected Equipment status deleted successfully';
             } elseif ($i > 0) {
                 $warn = "{$i} of {$count} selected status deleted";
             } elseif (!$errors['err']) {
                 $errors['err'] = 'Unable to delete selected Equipment status';
             }
             break;
         default:
             $errors['err'] = 'Unknown action/command';
     }
 }
Exemplo n.º 2
0
    Copyright (c)  2013 XpressTek
    http://www.xpresstek.net

    Released under the GNU General Public License WITHOUT ANY WARRANTY.
    See LICENSE.TXT for details.

    vim: expandtab sw=4 ts=4 sts=4:
**********************************************************************/
require 'staff.inc.php';
require_once EQUIPMENT_INCLUDE_DIR . 'class.equipment.php';
$category = null;
$eq_status = null;
if ($_REQUEST['cid'] && !($category = Equipment_Category::lookup($_REQUEST['cid']))) {
    $errors['err'] = 'Unknown or invalid equipment category';
}
if ($_REQUEST['status_id'] && !($eq_status = Equipment_Status::lookup($_REQUEST['status_id']))) {
    $errors['err'] = 'Unknown or invalid equipment status';
}
$inc = 'equipment_lists.inc.php';
//Equipment landing page.
if ($category && $_REQUEST['a'] != 'search') {
    $inc = 'equipment_list.inc.php';
} else {
    if ($eq_status) {
        $inc = 'equipment_status_list.inc.php';
    }
}
$nav->setTabActive('equipment');
require_once STAFFINC_DIR . 'header.inc.php';
require_once EQUIPMENT_STAFFINC_DIR . $inc;
require_once STAFFINC_DIR . 'footer.inc.php';