~fabiocbalbuquerque/sahana-agasti/web-services

« back to all changes in this revision

Viewing changes to apps/frontend/lib/actions/actions.class.php

  • Committer: Usman Akeju
  • Date: 2011-05-21 20:26:40 UTC
  • mto: (1.26.1 push-trunk) (7.1.1 mayon)
  • mto: This revision was merged to the branch mainline in revision 17.
  • Revision ID: usman.akeju@mail.cuny.edu-20110521202640-wb4xdirgv3lprjmi
- more import batching + event polling work

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
    //$this->setTemplate('global/search');
35
35
  }
36
36
 
37
 
  
 
37
  public function executeStatus(sfWebRequest $request)
 
38
  {
 
39
    $statuses = $request->getRequestFormat()/* $this->getContext()->get('job_statuses') */;
 
40
    if ('json' == $request->getRequestFormat()) {
 
41
      $this->getResponse()->setHttpHeader('Content-Type', 'application/json; charset=utf-8');
 
42
      $statuses = json_encode($statuses);
 
43
    }
 
44
    return $this->renderText($statuses);
 
45
  }
 
46
 
38
47
  public function executeEventpoll(sfWebRequest $request)
39
48
  {
40
 
 
41
49
    $this->getResponse()->setHttpHeader('Content-Type', 'application/json; charset=utf-8');
42
50
    return $this->renderText(json_encode($this->getContext()->get('job_statuses')));
43
 
 
44
51
  }
45
 
  
46
 
  
47
 
  
48
52
 
49
53
  public function doSearch($searchquery, $isFuzzy = TRUE, $widget = NULL)
50
54
  {
67
71
    $this->pager = new agArrayPager(null, 10);
68
72
 
69
73
    $searchResult = $query->getRecords(); //agStaff should be $models
70
 
    
71
74
    // TODO
72
75
    //a) we can return the results hydrated as scalar
73
76
    // (only get the PK's[person,entity,staff,facility,etc])
84
87
        $facilityCollection = $searchResult['agFacility'];
85
88
        $facility_ids = $facilityCollection->getKeys(); // toArray();
86
89
        $resultArray = agListHelper::getFacilityList($facility_ids);
87
 
 
88
 
        /** @todo change the above to use a FacilityList return
89
 
         * 
90
 
         */
 
90
        // @todo change the above to use a FacilityList return
91
91
      } else {
92
92
        //$resultArray = array();
93
93
      }