Ejemplo n.º 1
0
 function populate()
 {
     $tasks_do = new TaskCollection();
     $tasks_do->setParams();
     $sh = new SearchHandler($tasks_do, false);
     $sh->setFields(array('id', 'name'));
     $this->setSearchLimit($sh);
     $sh->setOrderBy('created', 'ASC');
     $sh->addConstraint(new Constraint('progress', '<', 100));
     $sh->addConstraint(new Constraint('owner', '=', EGS_USERNAME));
     $tasks_do->load($sh);
     $tasks_do->clickcontroller = 'tasks';
     $tasks_do->editclickaction = 'view';
     $this->contents = $tasks_do;
 }
Ejemplo n.º 2
0
 /**
  * Overload get for lazy building of tasks
  *
  * @param string $name The property name to access.
  * @return Shell Object of Task
  */
 public function __get($name)
 {
     if (empty($this->{$name}) && in_array($name, $this->taskNames)) {
         $properties = $this->_taskMap[$name];
         $this->{$name} = $this->Tasks->load($properties['class'], $properties['settings']);
         $this->{$name}->args =& $this->args;
         $this->{$name}->params =& $this->params;
         $this->{$name}->initialize();
         $this->{$name}->loadTasks();
     }
     return $this->{$name};
 }
Ejemplo n.º 3
0
 public function getHourTotals()
 {
     $tasks = new TaskCollection(new Task());
     $sh = new SearchHandler($tasks, false);
     $tasks->getTaskHourTotals($sh, $this->id);
     $tasks->load($sh);
     $costs = array('total_hours' => 0, 'total_costs' => 0);
     foreach ($tasks as $task) {
         $time = explode(':', $task->total_hours);
         $hours = $time[0] + $time[1] / 60 + $time[2] / 3600;
         $costs['total_hours'] += $hours;
         $costs['total_costs'] += $hours * $task->resource_rate;
     }
     //echo '<pre>'.print_r($costs, true).'</pre><br>';
     return $costs;
 }