Exemplo n.º 1
0
 public function has_dependencies($id = 0)
 {
     if ($id != 0) {
         // Create and investigate profile
         $profile = new profile($id);
         return $profile->has_dependencies();
     } else {
         $database = $_SESSION['database'];
         $this->id = $database->prepare_input($this->id);
         $employees_query = $database->query("select 1 from " . TABLE_EMPLOYEES . " where profiles_id = '" . (int) $this->id . "'");
         $employees_result = $database->fetch_array($employees_query);
         return tep_not_null($employees_result);
     }
 }
            // OK, entry can be saved
            $administration_profile = new profile($_POST['profiles_id']);
            $administration_profile->fill($_POST['profiles_name'], $_POST['profiles_rights_login'], $_POST['profiles_rights_projectlisting'], $_POST['profiles_rights_timeregistration'], $_POST['profiles_rights_analysis'], $_POST['profiles_rights_administration']);
            $administration_profile->save();
            // Clear all values except mPath
            foreach ($_POST as $key => $value) {
                if ($key != 'mPath') {
                    unset($_POST[$key]);
                }
            }
        }
        break;
    case 'delete_entry':
        // Check for dependencies
        $administration_profile = new profile($_POST['profiles_id']);
        if ($administration_profile->has_dependencies()) {
            $error_level = 2;
            // Related employee(s) exist
            $_POST['action'] = '';
        }
        break;
    case 'delete_entry_confirmed':
        $administration_profile = new profile($_POST['profiles_id']);
        $administration_profile->delete();
        unset($_POST['profiles_id']);
        $_POST['action'] = '';
        break;
}
// Create a new profile object with id == 0 (default)
$_SESSION['profile'] = new profile();
// header //