Skip to content

Commit

Permalink
Codify coding standard
Browse files Browse the repository at this point in the history
  • Loading branch information
allnato committed Dec 2, 2016
1 parent 2939bc2 commit d9b45b9
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 3 deletions.
2 changes: 0 additions & 2 deletions application/controllers/CSOcontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ public function activity_page($orgInitials,$pageID) {
// Show 404 :-(
show_404();
}


$this->load->view('cso_activity_page', $activity);
}

Expand Down
43 changes: 42 additions & 1 deletion contributing.md
Original file line number Diff line number Diff line change
@@ -1 +1,42 @@
# Coding Standards
## Coding Standards
Since the CSO Finance Dashboard is built on-top of CodeIgniter 3, the **PHP scripting language** will be utilized. </br>
As a result, standard PHP practices and conventions will be followed.

### Function naming conventions
Considering CodeIgniter follows the MVC framework, the following functions naming conventions is followed for both contollers and models:
<br><br>

#### Loading view pages.

For functions that loads html pages, all function names must be in lowercase and the spaces is delimited by an underscore. <br>
An example can be seen below.
```
public function activity_page($orgInitials,$pageID) {
// Redirect to login if session does not exists.
$this->checkSession();
// Load ActitivityModel.php
$this->load->model('CSOmodel');
...
$this->load->view('cso_activity_page', $activity);
}
```

#### CRUD Functions
For functions that performs CRUD (Create, Retrieve, Update, and Delete functions), function names should follow Camel Case naming convention. An example can be seen below.

```
public function checkSession(){
if($this->session->has_userdata('email')){
return;
}
redirect(site_url('login'));
}
```

#### Important Note
If a function both performs CURD and loading of html, **the loading of view naming convention is followed.**


## Creating Issues

0 comments on commit d9b45b9

Please sign in to comment.