~fabiocbalbuquerque/sahana-agasti/web-services

« back to all changes in this revision

Viewing changes to apps/frontend/lib/form/doctrine/agSingleShiftTemplateForm.class.php

  • Committer: Shirley Chan
  • Date: 2011-08-02 20:21:51 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-20110802202151-to2zatz6pjzd5ftb
Display full list of staff/facility resource types in shift template drop-downs

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
   */
58
58
  public function setup()
59
59
  {
60
 
      sfProjectConfiguration::getActive()->loadHelpers(array ('Helper','Url', 'Asset', 'Tag'));
61
 
      $this->wikiUrl = url_for('@wiki');
62
 
      //get default staff resource types for this scenario
63
 
      $dsrt = agScenarioResourceHelper::returnDefaultStaffResourceTypes($this->scenario_id);
64
 
      if (count($dsrt) > 0) {
65
 
        $defaultStaffResourceTypes = $dsrt;
66
 
      } else {
67
 
        $defaultStaffResourceTypes =
68
 
                agDoctrineQuery::create()
69
 
                ->select('srt.id, srt.staff_resource_type')
70
 
                ->from('agStaffResourceType srt')
71
 
                ->execute(array(), Doctrine_Core::HYDRATE_SCALAR);
72
 
      }
73
 
      foreach($defaultStaffResourceTypes as $dsrt){
74
 
        $defaultStaffTypes[$dsrt['srt_id']] = $dsrt['srt_staff_resource_type'];
75
 
      }
76
 
      //get default facility resource types for this scenario
77
 
      $dfrt = agScenarioResourceHelper::returnDefaulFacilityResourceTypes($this->scenario_id);
78
 
      if (count($dfrt) > 0) {
79
 
        $defaultFacilityResourceTypes = $dfrt;
80
 
      } else {
81
 
        $defaultFacilityResourceTypes =
82
 
                agDoctrineQuery::create()
83
 
                ->select('frt.id, frt.facility_resource_type')
84
 
                ->from('agFacilityResourceType frt')
85
 
                ->execute(array(), Doctrine_Core::HYDRATE_SCALAR);
86
 
      }
87
 
//      $defaultFacilityTypes = array('' => '');
88
 
      foreach($defaultFacilityResourceTypes as $dfrt){
89
 
        $defaultFacilityTypes[$dfrt['frt_id']] = $dfrt['frt_facility_resource_type'];
90
 
      }
 
60
    sfProjectConfiguration::getActive()->loadHelpers(array ('Helper','Url', 'Asset', 'Tag'));
 
61
    $this->wikiUrl = url_for('@wiki');
91
62
    
92
63
    $this->setWidgets(
93
64
        array(
97
68
          'scenario_id' => new sfWidgetFormInputHidden,
98
69
 
99
70
          'facility_resource_type_id' =>
100
 
          new sfWidgetFormChoice(array('choices' => $defaultFacilityTypes),
101
 
              array('label' => 'Facility Resource Type','class' => 'filter')
102
 
              )
103
 
//          new sfWidgetFormDoctrineChoice(
104
 
//            array(
105
 
//              'model' => $this->getRelatedModelName('agFacilityResourceType'),
106
 
//              'add_empty' => false,'method' => 'getFacilityResourceType','label' => 'Facility Resource Type'
107
 
//            //'query' => $this::$staticLists['agFacilityResourceType']
108
 
//            )
109
 
//
110
 
//          )
 
71
          new sfWidgetFormDoctrineChoice(
 
72
            array(
 
73
              'model' => $this->getRelatedModelName('agFacilityResourceType'),
 
74
              'add_empty' => false,
 
75
              'method' => 'getFacilityResourceType',
 
76
              'label' => 'Facility Resource Type'
 
77
            )
 
78
          )
111
79
          ,
112
80
          'staff_resource_type_id' =>
113
 
          new sfWidgetFormChoice(array('choices' => $defaultStaffTypes),
114
 
              array('label' => 'Staff Resource Type <a href="' . $this->wikiUrl .  '/doku.php?id=tooltip:staff_resources&do=export_xhtmlbody" class="tooltipTrigger" title="Search Name">?</a>','class' => 'filter')
115
 
              )
116
 
//          new sfWidgetFormDoctrineChoice(
117
 
//            array(
118
 
//              'model' => $this->getRelatedModelName('agStaffResourceType'),
119
 
//              'add_empty' => false,
120
 
//              'method' => 'getStaffResourceType','label' => 'Staff Resource Type'
121
 
//            )
122
 
//          )
 
81
          new sfWidgetFormDoctrineChoice(
 
82
            array(
 
83
              'model' => $this->getRelatedModelName('agStaffResourceType'),
 
84
              'add_empty' => false,
 
85
              'method' => 'getStaffResourceType',
 
86
              'label' => 'Staff Resource Type <a href="' . $this->wikiUrl .  '/doku.php?id=tooltip:staff_resources&do=export_xhtmlbody" class="tooltipTrigger" title="Search Name">?</a>'
 
87
            )
 
88
          )
123
89
          ,
124
90
          'task_id' => new sfWidgetFormDoctrineChoice(
125
91
            array(