class ActionErrors {
var $errors = array();
-
+
function ActionErrors() {
}
-
+
function isEmpty() {
- return (count($this->errors)>0 ? false : true );
+ return (count($this->errors)>0 ? false : true);
}
-
+
+ function exist() {
+ return (count($this->errors)>0 ? true : false);
+ }
+
+ function no() {
+ return (count($this->errors)>0 ? false : true);
+ }
+
+ function yes() {
+ return (count($this->errors)>0 ? true : false);
+ }
+
function add($message, $arg0 = '', $arg1 = '') {
$patterns = array ("/\{0\}/","/\{1\}/");
$replace = array ($arg0, $arg1);
$this->errors[]["message"] = $message;
}
- function addAll($arr) {
- if (is_array($arr)) {
- foreach ($arr as $k=>$v) {
- $this->errors[$k] = $v;
- }
- }
- }
-
function get($key) {
return $this->errors["$key"]["message"];
}
$errors->add($i18n->getKey('error.not_equal'), $i18n->getKey('label.password'), $i18n->getKey('label.confirm_password'));
}
- if ($errors->isEmpty() && $cl_password1) {
+ if ($errors->no() && $cl_password1) {
if (ttUserHelper::setPassword($user->id, $cl_password1)) {
header('Location: admin_teams.php');
exit();
if ($cl_manager_login != $team_details['manager_login'])
if (ttUserHelper::getUserByLogin($cl_manager_login)) $errors->add($i18n->getKey('error.user_exists'));
- if ($errors->isEmpty()) {
+ if ($errors->no()) {
$update_result = ttTeamHelper::update($team_id, array('name'=>$cl_team_name));
if ($update_result) {
$update_result = ttUserHelper::update($team_details['manager_id'], array(