/**
  * Load default values either when creating a sample new or reloading after a validation failure.
  * This adds the custom attributes list to the data available for the view. 
  */
 protected function getDefaults()
 {
     $r = parent::getDefaults();
     $r['joinsTo:occurrence:id'] = $this->reformatTaxaJoinsForList($r, 'occurrence', true);
     $r = $this->addSample($r, $_POST['subject_observation:sample_id']);
     $this->loadAttributes($r, array('website_id' => array($r['subject_observation:website_id']), 'restrict_to_survey_id' => array(null, $r['sample:survey_id'])));
     return $r;
 }
示例#2
0
 /**
  *  Setup the default values to use when loading this controller to edit a new page.
  */
 protected function getDefaults()
 {
     $r = parent::getDefaults();
     if ($this->uri->method(false) == 'create') {
         // Website id is passed as first argument in URL when creating
         $r['milestone:website_id'] = $this->uri->argument(1);
     }
     return $r;
 }
示例#3
0
 /**
  * Load default values either when creating a sample new or reloading after a validation failure.
  * This adds the custom attributes list to the data available for the view. 
  */
 protected function getDefaults()
 {
     $r = parent::getDefaults();
     if (array_key_exists('identifier:id', $_POST)) {
         $websiteId = $r['identifier:website_id'];
         $this->loadAttributes($r, array('website_id' => $websiteId));
     }
     return $r;
 }
 /**
  *  Setup the default values to use when loading this controller to edit a new page.
  */
 protected function getDefaults()
 {
     $r = parent::getDefaults();
     if ($this->uri->method(false) == 'create') {
         $r['known_subject:id'] = $this->uri->argument(1);
         $r['known_subject_comment:known_subject_id'] = $this->uri->argument(1);
     }
     return $r;
 }
 /**
  *  Setup the default values to use when loading this controller to edit a new page.
  */
 protected function getDefaults()
 {
     $r = parent::getDefaults();
     if ($this->uri->method(false) == 'create') {
         $r['survey:id'] = $this->uri->argument(1);
         $r['survey_comment:survey_id'] = $this->uri->argument(1);
     }
     return $r;
 }
示例#6
0
 /**
  *  Setup the default values to use when loading this controller to edit a new page.
  *  In this case, the parent_id and website_id are passed as $_POST data if creating 
  *  a new sublist.   
  */
 protected function getDefaults()
 {
     $r = parent::getDefaults();
     if ($this->uri->method(false) == 'create' && array_key_exists('parent_id', $_POST)) {
         // Parent_id is passed in as POST params for a new record.
         $r['termlist:parent_id'] = $_POST['parent_id'];
     }
     return $r;
 }
 /**
  *  Setup the default values to use when loading this controller to edit a new page.
  */
 protected function getDefaults()
 {
     $r = parent::getDefaults();
     if ($this->uri->method(false) == 'create') {
         // User id is passed as first argument in URL when creating
         $r['user_identifier:user_id'] = $this->uri->argument(1);
     }
     return $r;
 }
 /**
  *  Setup the default values to use when loading this controller to edit a new page.
  */
 protected function getDefaults()
 {
     $r = parent::getDefaults();
     if ($this->uri->method(false) == 'create') {
         // occurrence id is passed as first argument in URL when creating.
         $r['occurrence:id'] = $this->uri->argument(1);
         $r['occurrence_comment:occurrence_id'] = $this->uri->argument(1);
     }
     return $r;
 }
 /**
  * Load default values either when creating a sample new or reloading after a validation failure.
  * This adds the custom attributes list to the data available for the view. 
  */
 protected function getDefaults()
 {
     $r = parent::getDefaults();
     $r['joinsTo:taxa_taxon_list:id'] = $this->reformatTaxaJoinsForList($r, 'taxa_taxon_list');
     if (array_key_exists('known_subject:id', $_POST)) {
         $websiteId = $r['known_subject:website_id'];
         $this->loadAttributes($r, array('website_id' => $websiteId));
     }
     return $r;
 }
 /**
  *  Setup the default values to use when loading this controller to edit a new page.
  */
 protected function getDefaults()
 {
     $r = parent::getDefaults();
     if ($this->uri->method(false) == 'create') {
         // Taxa taxon list id is passed as first argument in URL when creating
         $ttl = ORM::Factory('taxa_taxon_list', $this->uri->argument(1));
         $r['taxa_taxon_designation:taxon_id'] = $ttl->taxon_id;
     }
     return $r;
 }
示例#11
0
 /**
  *  Setup the default values to use when loading this controller to edit a new page.
  *  In this case, the parent_id and website_id are passed as $_POST data if creating 
  *  a new sublist.   
  */
 protected function getDefaults()
 {
     $r = parent::getDefaults();
     if ($this->uri->method(false) == 'create' && array_key_exists('parent_id', $_POST)) {
         // Parent_id is passed in as POST params for a new record.
         $r['taxon_list:parent_id'] = $_POST['parent_id'];
         $parent = ORM::factory('taxon_list', $_POST['parent_id']);
         $r['parent_website_id'] = $parent->website_id;
     }
     return $r;
 }
示例#12
0
 /**
  * Load default values either when creating a sample new or reloading after a validation failure.
  * This adds the custome attributes list to the data available for the view. 
  */
 protected function getDefaults()
 {
     $r = parent::getDefaults();
     if (array_key_exists('sample:survey_id', $_POST)) {
         $r['sample:survey_id'] = $_POST['sample:survey_id'];
         $r['website_id'] = ORM::factory('survey', $r['sample:survey_id'])->website_id;
         $r['sample:sample_method_id'] = array_key_exists('sample:sample_method_id', $_POST) ? $_POST['sample:sample_method_id'] : null;
         $this->loadAttributes($r, array('website_id' => array($r['website_id']), 'restrict_to_survey_id' => array(null, $r['sample:survey_id']), 'restrict_to_sample_method_id' => array(null, $r['sample:sample_method_id'])));
     }
     return $r;
 }
示例#13
0
 protected function getDefaults()
 {
     $r = parent::getDefaults();
     // as you can't create an occurrence in the warehouse, no logic yet for which attributes
     // to display
     if ($this->uri->method(false) !== 'create') {
         $sample = ORM::Factory('sample', $_POST['occurrence:sample_id']);
         $this->loadAttributes($r, array('website_id' => array($_POST['occurrence:website_id']), 'restrict_to_survey_id' => array(null, $sample->survey_id)));
     }
     return $r;
 }
示例#14
0
 /**
  *  Setup the default values to use when loading this controller to edit a new page.   
  */
 protected function getDefaults()
 {
     $r = parent::getDefaults();
     if ($this->uri->method(false) == 'create') {
         // survey id is passed as first argument in URL when creating. But the image
         // gets linked by meaning, so fetch the meaning_id.
         $r['survey:id'] = $this->uri->argument(1);
         $r['survey_medium:survey_id'] = $this->uri->argument(1);
         $r['survey_medium:caption'] = kohana::lang('misc.new_image');
     }
     return $r;
 }
示例#15
0
 /**
  *  Setup the default values to use when loading this controller to create a new taxon code.   
  */
 protected function getDefaults()
 {
     $r = parent::getDefaults();
     if ($this->uri->method(false) == 'create') {
         // taxa_taxon_list id is passed as first argument in URL when creating. But the code
         // gets linked by meaning, so fetch the meaning_id.
         $ttl = ORM::Factory('taxa_taxon_list', $this->uri->argument(1));
         $r['taxa_taxon_list:id'] = $this->uri->argument(1);
         $r['taxon_code:taxon_meaning_id'] = $ttl->taxon_meaning_id;
     }
     return $r;
 }
示例#16
0
 /**
  * Load default values either when creating a sample new or reloading after a validation failure.
  * This adds the custome attributes list to the data available for the view. 
  */
 protected function getDefaults()
 {
     $r = parent::getDefaults();
     // when creating a person, we don't know the websites for the person, so cannot
     // filter the attribute values available. Therefore they are not displayed until
     // after the person has been saved. Therefore no need to call loadAttributes.
     // We do when editing after a validation failure though.
     if ($this->model->id !== 0) {
         $websiteIds = $this->getWebsiteIds($this->model->id);
         $this->loadAttributes($r, array('website_id' => $websiteIds));
     }
     return $r;
 }
示例#17
0
 /**
  *  Setup the default values to use when loading this controller to create a new relationship.
  */
 protected function getDefaults()
 {
     $r = parent::getDefaults();
     if ($this->uri->method(false) == 'create') {
         // taxa_taxon_list id is passed as first argument in URL when creating. But the relationship
         // gets linked by meaning, so fetch the meaning_id.
         $ttl = ORM::Factory('taxa_taxon_list', $this->uri->argument(1));
         $t = ORM::Factory('taxon', $ttl->taxon_id);
         $r['taxa_taxon_list:id'] = $this->uri->argument(1);
         $r['taxon_relation:from_taxon_meaning_id'] = $ttl->taxon_meaning_id;
         $r['taxon_relation:to_taxon_meaning_id'] = '';
         $r['taxon_relation:taxon_relation_type_id'] = '';
         $r['taxon:from_taxon'] = $t->taxon;
         $r['relation:term'] = '';
         $r['taxon:to_taxon'] = '';
     }
     return $r;
 }
 /**
  *  Setup the default values to use when loading this controller to edit a new page.
  */
 protected function getDefaults()
 {
     $r = parent::getDefaults();
     if ($this->uri->method(false) == 'create') {
         // List id is passed as first argument in URL when creating
         $r['taxa_taxon_list:taxon_list_id'] = $this->uri->argument(1);
         // Parent id might be passed in $_POST if creating as child of another taxon.
         if (array_key_exists('taxa_taxon_list:parent_id', $_POST)) {
             $r['taxa_taxon_list:parent_id'] = $_POST['taxa_taxon_list:parent_id'];
         }
     } else {
         // after a validation failure, the list id is in the post data
         $r['taxa_taxon_list:taxon_list_id'] = $_POST['taxa_taxon_list:taxon_list_id'];
     }
     $this->loadAttributes($r, array('taxon_list_id' => array($r['taxa_taxon_list:taxon_list_id'])));
     return $r;
 }
示例#19
0
 /**
  * Load default values either when creating a survey new or reloading after a validation failure.
  * This adds the custome attributes list to the data available for the view. 
  */
 protected function getDefaults()
 {
     $r = parent::getDefaults();
     $r['website_id'] = $this->model->website_id;
     $this->loadAttributes($r, array('website_id' => array($r['website_id'])));
     return $r;
 }
 /**
  *  Setup the default values to use when loading this controller to create a new image.   
  */
 protected function getDefaults()
 {
     $r = parent::getDefaults();
     if ($this->uri->method(false) == 'create') {
         // subject_observation_id is passed as first argument in URL when creating.
         $r['identifiers_subject_observation:subject_observation_id'] = $this->uri->argument(1);
     }
     if (array_key_exists('identifiers_subject_observation:id', $_POST)) {
         // some entity specific code to get the website(s)
         $r = $this->addSubjectObservation($r, $_POST['identifiers_subject_observation:subject_observation_id']);
         $r = $this->addSample($r, $_POST['subject_observation:sample_id']);
         $websiteId = $r['subject_observation:website_id'];
         $this->loadAttributes($r, array('website_id' => $websiteId, 'restrict_to_survey_id' => array(null, $r['sample:survey_id'])));
     }
     return $r;
 }
示例#21
0
 /**
  *  Setup the default values to use when loading this controller to edit a new page.
  */
 protected function getDefaults()
 {
     $r = parent::getDefaults();
     if ($this->uri->method(false) == 'create') {
         // List id is passed as first argument in URL when creating
         $r['termlists_term:termlist_id'] = $this->uri->argument(1);
         // Parent id might be passed in $_POST if creating as child of another term.
         if (array_key_exists('termlists_term:parent_id', $_POST)) {
             $r['termlists_term:parent_id'] = $_POST['termlists_term:parent_id'];
         }
     }
     return $r;
 }