public function __construct($input = NULL) { if ($input == NULL) { $input = $this->getDefaultActionData(); } if (TasksappValidator::checkId($input['action_id'])) { $this->action_id = $input['action_id']; } else { $this->action_id = NULL; } $this->action = $input['action']; $this->importance = $input['importance']; if (TasksappValidator::checkDate($input['dateDue'])) { $this->dateDue = $input['dateDue']; } else { $this->dateDue = '0000-00-00'; } $this->context = $input['context']; $this->notes = $input['notes']; $this->done = intval($input['done']); $this->project_id = $input['project_id']; $this->client_id = $input['client_id']; }
/** * Verifies that the project data is safe to be saved to the database * * Uses the Validator class to make sure that all of the data passed in to * populate the ivars is valid. An error is raised for any that fail, and * this should be used to provide feedback to the user to fix any details * that are not correct. * * @return Bool * */ public function verifyData() { $returnValue = True; if (!TasksappValidator::checkId($this->project_id) && $this->project_id != NULL) { $this->errorArray['project_id'] = True; $returnValue = False; } if (!TasksappValidator::checkId($this->client_id)) { $this->errorArray['client_id'] = True; $returnValue = False; } if (!TasksappValidator::checkString($this->name)) { $this->errorArray['name'] = True; $returnValue = False; } /** * Removing check on notes as we want to allow any thing to be stored * here as long as it is escaped correctly * * if(!TasksappValidator::isBlank($this->notes)) { * $this->errorArray['notes'] = True; * $returnValue = False; * } */ if (!TasksappValidator::checkImportance($this->importance)) { $this->errorArray['importance'] = True; $returnValue = False; } if (!TasksappValidator::checkDone($this->done)) { $this->errorArray['done'] = True; $returnValue = False; } return $returnValue; }