public function __construct()
 {
     if (!template_session::is_admin() and !template_session::is_editor()) {
         if (get('ajax')) {
             exit(RUDE_AJAX_ACCESS_VIOLATION);
         }
         return false;
     }
     switch (get('task')) {
         case 'remove':
             $status = departments::remove(get('id'));
             break;
         case 'add':
             $status = departments::add(get('name'));
             break;
         case 'edit':
             $status = departments::edit(get('id'), get('name'));
             break;
         default:
             $status = false;
             break;
     }
     if (get('ajax')) {
         if ($status) {
             exit(RUDE_AJAX_OK);
         } else {
             exit(RUDE_AJAX_ERROR);
         }
     }
     return true;
 }
Пример #2
0
  Description: System File

  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
if (!defined('PARENT')) {
    $HEADERS->err403(true);
}
// Access..
if (!in_array($cmd, $userAccess) && $MSTEAM->id != '1') {
    $HEADERS->err403(true);
}
// Class..
include_once PATH . 'control/classes/class.departments.php';
$MSDEPT = new departments();
// Add..
if (isset($_POST['process'])) {
    if (trim($_POST['name'])) {
        $MSDEPT->add($MSTEAM->id);
        $OK1 = true;
    }
}
// Update..
if (isset($_POST['update'])) {
    if (trim($_POST['name'])) {
        $MSDEPT->update();
        $OK2 = true;
    }
}
$title = isset($_GET['edit']) ? $msg_dept5 : $msg_dept2;
include PATH . 'templates/header.php';
include PATH . 'templates/system/dept/dept.php';
include PATH . 'templates/footer.php';