Welcome Guest, Not a member yet? Register   Sign In
Page logic
#2

[eluser]OwanH[/eluser]
Hey,

I'd suggest implementing a function within your activity controller class which accepts two arguments, the first being an identifier indicating which project you want to list activities for, the second being an identifier indicating the task. The second argument can be optional and can be assigned a default value. That way, this single function will handle either situation: project only or project and task.

So, if we let the name of your function be, say, viewlist for example then you could end up with the following:

List all activities for task 'x' under project 'y':
/timesheet/index.php/activity/viewlist/projectY/taskX/

or

List all activities for project 'y':
/timesheet/index.php/activity/viewlist/projectY/

and so the viewlist function in the activity class would be like so,

Code:
<?php
class Activity extends Controller {

  ...

  function viewlist($project_id, $task_id = "")
  {
    // check if a task ID was specified in the URL
    if (empty($task_id))
    {
      // handle the case where only the project is specified
      ...
    }
    else {
      // handle the case where both the project and task are specified
      ...
    }
    ...
  }

}
?>


Messages In This Thread
Page logic - by El Forum - 07-11-2007, 07:42 AM
Page logic - by El Forum - 07-11-2007, 11:36 AM



Theme © iAndrew 2016 - Forum software by © MyBB