A Thermodynamic Approach to Nonlocal Plasticity and Related Variational Principles