dotProject Recipe: changing the tab names and content
April 29, 2007
Dotproject | PHP | Snippets | Web Building

tabs.jpg

The Projects page comes with a set of tabs, based on a combination of the project status fields and whether or not a project is active or archived, and includes a Gannt chart tab.

We changed the values used for Project Status to

0|Not Defined 2|Pending Content 3|In Progress 4|In Review 5|Complete

(to do this use: System Admin: System Lookup Values:click edit icon next to ProjectStatus)


Ads by Google

Posted by ellen at April 29, 2007 05:05 PM

Of course we wanted the tabs on the Project page to reflect these new status categories, but simply changing these values is not enough to change the content of the tabs. To do that, you will need to make the following changes:


In modules/projects/index.php
search for the line "$titleBlock->show();" and add the new tab names to the list as shown.


$titleBlock->show();

$project_types = dPgetSysVal("ProjectStatus");

$active = 0;
$complete = 0;

$pending = 0; //added new
$review = 0; //added new

$archive = 0;
$proposed = 0;

Search for


"if (is_array($projects)) {
foreach ($projects as $p)"
and add in the conditions that will determine whether an individual project shows up under a given tab:

if (is_array($projects)) {
        foreach ($projects as $p)
        {
               if ($p['project_active'] > 0 && $p['project_status'] == 3)
                        ++$active;
               else if ($p['project_active'] > 0 && $p['project_status'] == 5)
                        ++$complete;
		 else if ($p['project_active'] > 0 && $p['project_status'] == 4) //added
                        ++$review;
		 else if ($p['project_active'] > 0 && $p['project_status'] == 2)  //added
                        ++$pending;
						
               else if ($p['project_active'] < 1)
                        ++$archive;
               else
                        ++$proposed;
        }
}

Search for "$fixed_project_type_file = array("
and add in the names of the tabs you are adding or changing, and the files they reference (e.g. "vw_idx_in_review")


$fixed_project_type_file = array(
$AppUI->_('In Progress', UI_OUTPUT_RAW) . ' (' . $active . ')' => "vw_idx_active",
$AppUI->_('Complete', UI_OUTPUT_RAW) . ' (' . $complete . ')' => "vw_idx_complete",
$AppUI->_('Archived', UI_OUTPUT_RAW) . ' (' . $archive . ')' => "vw_idx_archived",
$AppUI->_('In Review', UI_OUTPUT_RAW) . ' (' . $review . ')' => "vw_idx_in_review", // added
$AppUI->_('Pending Content', UI_OUTPUT_RAW) . ' (' . $pending . ')' => "vw_idx_pending_content");
//added

You may want to change the default view. To do this, search for
"* Now, we will figure out which vw_idx file are available
* for each project type using the $fixed_project_type_file array
*/
$project_type_file = array();
"
and change file referenced by the "else" statement to whatever you want.

/**
* Now, we will figure out which vw_idx file are available
* for each project type using the $fixed_project_type_file array 
*/
$project_type_file = array();

foreach($project_types as $project_type){
$project_type = trim($project_type);
if(isset($fixed_project_type_file[$project_type])){
$project_file_type[$project_type] = $fixed_project_type_file[$project_type];
} else { // if there is no fixed vw_idx file, we will use vw_idx_proposed
//$project_file_type[$project_type] = "vw_idx_proposed";
$project_file_type[$project_type] = "vw_idx_active"; // changed default view to in-progress
}
}


Ads by Google


Ads by Google

 RSS   |   Contact Me


Ads by Google