/** * Sets some values depending on the parameters. * * Set the rights for each user (owner, userId and the normal access tab). * * @return array POST values with some changes. */ public function setParams() { $args = func_get_args(); $params = $args[0]; $model = $args[1]; $newItem = isset($args[2]) ? $args[2] : false; return Default_Helpers_Right::addRightsToAssignedUser('userId', $params, $model, $newItem); }
/** * Set some values deppend on the params. * * Set the author, solvedBy, solvedDate. * Also set the rights for each user (owner, assigned and the normal access tab). * * @return array POST values with some changes. */ public function setParams() { $args = func_get_args(); $params = $args[0]; $model = $args[1]; $newItem = isset($args[2]) ? $args[2] : false; if ($newItem) { $params['author'] = (int) Phprojekt_Auth::getUserId(); $params['date'] = date("Y-m-d"); if ($params['status'] == Helpdesk_Models_Helpdesk::STATUS_SOLVED) { $params['solvedBy'] = (int) Phprojekt_Auth::getUserId(); $params['solvedDate'] = date("Y-m-d"); } } else { // The author comes as a STRING but must be saved as an INT (and it doesn't change since the item creation) $params['author'] = (int) $model->author; } if (!$newItem && isset($params['status'])) { if ($params['status'] != Helpdesk_Models_Helpdesk::STATUS_SOLVED) { // Status != 'Solved' - The solver should be null (the solved date can't be deleted, but should be) $params['solvedBy'] = 0; } else { // Status 'Solved' - If it has just been changed to this state, save user and date if ($model->status != Helpdesk_Models_Helpdesk::STATUS_SOLVED) { $params['solvedBy'] = (int) Phprojekt_Auth::getUserId(); $params['solvedDate'] = date("Y-m-d"); } else { // The solver comes as a STRING but must be saved as an INT (and the Id doesn't change) $params['solvedBy'] = (int) $model->solvedBy; } } } return Default_Helpers_Right::addRightsToAssignedUser('assigned', $params, $model, $newItem); }