refactor parts of the procedural code of mantis[1] to object orientation. Involves highly repetitive work, which can not easily be automized.
Requires knowledge in PHP5, implementation guidelines of eZ Components[2], GIT[3] and the ability to install and test the changes.
The current sourcecode can be cloned by
git clone git://[login to view URL]
[1] [login to view URL]
[2] [login to view URL]
[3] [login to view URL](software)
## Deliverables
The task requires to refactor a lot of functions like the one below into class methods and applying the following changes: - function parameters which are properties of the object can be omitted from the method parameters - The method name is shortened, because it doesn't need to reference the classes name anymore and written in camel case - all calls to the former function needs to be searched in the rest of the code and refactored to calls to the new object's method. This required to get a reference to the object beforehand, which can be done by mntsBaseUser::getById( $id ) There are already class stubs in the models/ directory. The old code is in the core/ directory. If a class is in models/mntsBaseUser, then the old code is in core/user_api.php. It is recommended that the programmer uses a powerful editor like VIM, emacs, ... which can help in automating many tasks. I'm a PHP programmer myself and can be contacted during the project via instant messaging. function user_get_access_level( $p_user_id, $p_project_id = ALL_PROJECTS ) { $t_access_level = user_get_field( $p_user_id, 'access_level' ); if( $t_access_level >= ADMINISTRATOR ) { return $t_access_level; } $t_project_access_level = project_get_local_user_access_level( $p_project_id, $p_user_id ); if( false === $t_project_access_level ) { return $t_access_level; } else { return $t_project_access_level; } } class mntsBaseUser extends mntsBaseModel { public function getAccessLevel( $p_project_id = ALL_PROJECTS ) { $t_access_level = $this->accessLevel; if( $t_access_level >= ADMINISTRATOR ) { return $t_access_level; } $t_project_access_level = project_get_local_user_access_level( $p_project_id, $this->id ); if( false === $t_project_access_level ) { return $t_access_level; } else { return $t_project_access_level; } } }