~fabiocbalbuquerque/sahana-agasti/web-services

« back to all changes in this revision

Viewing changes to apps/frontend/modules/scenario/actions/actions.class.php

  • Committer: Shirley Chan
  • Date: 2011-08-02 15:03:42 UTC
  • mto: (1.26.1 push-trunk)
  • mto: This revision was merged to the branch mainline in revision 25.
  • Revision ID: shirley.chan@mail.cuny.edu-20110802150342-iid0ao3zcfr4z1yw
Removed summary count from saved searches table and added new summary count table

Show diffs side-by-side

added added

removed removed

Lines of Context:
533
533
    $this->targetModule = 'staff';
534
534
 
535
535
    // Get all available staff counts
536
 
    $this->total_staff = agDoctrineQuery::create()
 
536
    $totalStaffCount = agDoctrineQuery::create()
537
537
            ->select('count(*)')
538
538
              ->from('agStaffResource sr')
539
539
                ->innerJoin('sr.agStaffResourceStatus srs')
541
541
            ->execute(array(), Doctrine_Core::HYDRATE_SINGLE_SCALAR);
542
542
 
543
543
    // Get staff counts who are assigned to the current scenario.
544
 
    $this->scenario_staff_count = agDoctrineQuery::create()
 
544
    $scenarioStaffCount = agDoctrineQuery::create()
545
545
      ->select('count(*)')
546
546
        ->from('agScenarioStaffResource ssr')
547
547
        ->where('ssr.scenario_id = ?', $this->scenario_id)
548
548
        ->execute(array(), Doctrine_Core::HYDRATE_SINGLE_SCALAR);
549
549
 
550
550
    // Get staff counts who are assigned to the current scenario by their resource type.
551
 
    $scenario_staff_by_resource_count = agDoctrineQuery::create()
 
551
    $scenarioStaffByResourceCount = agDoctrineQuery::create()
552
552
            ->select('srt.staff_resource_type')
553
553
            ->addSelect('count(*) AS staff_type_count')
554
554
            ->from('agScenarioStaffResource ssr')
557
557
            ->where('ssr.scenario_id = ?', $this->scenario_id)
558
558
            ->groupBy('srt.id')
559
559
            ->orderBy('srt.staff_resource_type')
560
 
            ->execute(array(), Doctrine_Core::HYDRATE_NONE);
561
 
    array_walk($scenario_staff_by_resource_count,
562
 
      function(&$item){ $item = '<span class="highlightedText">' . $item[1] . '</span> ' . $item[0]; }
563
 
    );
564
 
    $this->scenario_staff_by_resource_count = $scenario_staff_by_resource_count;
 
560
            ->execute(array(), agDoctrineQuery::HYDRATE_KEY_VALUE_PAIR);
 
561
 
 
562
    $this->summaryCount = array('Total Staff in System' => $totalStaffCount,
 
563
                                'Staff Members in Pool' => $scenarioStaffCount);
 
564
    $this->summaryCount = $this->summaryCount + $scenarioStaffByResourceCount;
565
565
 
566
566
    // Retrieve saved search objects
567
567
    $this->saved_searches = $existing = agDoctrineQuery::create()