示例#1
0
 protected function getModelValues()
 {
     $r = parent::getModelValues();
     $r['website_id'] = ORM::factory('survey', $r['sample:survey_id'])->website_id;
     $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;
 }
示例#2
0
 protected function getModelValues()
 {
     $r = parent::getModelValues();
     $websiteIds = $this->getWebsiteIds($r['person:id']);
     $this->loadAttributes($r, array('website_id' => $websiteIds));
     return $r;
 }
 /**
  * Returns an array of all values from this model ready to be loaded into a form. 
  * For this controller, we need to also setup text for the "other data" section.
  */
 protected function getModelValues()
 {
     $r = parent::getModelValues();
     $r['metaFields:metadata'] = $this->get_metadata_as_text();
     $r['metaFields:data'] = $this->get_data_as_text();
     return $r;
 }
示例#4
0
 /**
  * Returns an array of all values from this model and its super models ready to be 
  * loaded into a form.  
  */
 protected function getModelValues()
 {
     $r = parent::getModelValues();
     if ($this->model->parent_id) {
         $r['parent_website_id'] = $this->model->parent->website_id;
     }
     return $r;
 }
示例#5
0
 protected function getModelValues()
 {
     $r = parent::getModelValues();
     // load data for attributes
     $websiteId = $r['identifier:website_id'];
     $this->loadAttributes($r, array('website_id' => $websiteId));
     return $r;
 }
 /**
  * Returns an array of all values from this model and its super models ready to be 
  * loaded into a form. For this controller, we need to also setup the custom attributes
  * available to display on the form.
  */
 protected function getModelValues()
 {
     $r = parent::getModelValues();
     $r['joinsTo:occurrence:id'] = $this->reformatTaxaJoinsForList($r, 'occurrence', true);
     $r = $this->addSample($r, $r['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;
 }
示例#7
0
 /**
  * Setup the default values to use when loading this controller to edit an existing code.   
  */
 protected function getModelValues()
 {
     $r = parent::getModelValues();
     // The code is linked to a taxon meaning, but we need to use this to link back to the
     // preferred taxa in taxon list, so when you save it knows where to go back to.
     $ttl = ORM::Factory('taxa_taxon_list')->where(array('taxon_meaning_id' => $this->model->taxon_meaning_id, 'preferred' => 'true'))->find();
     $r['taxa_taxon_list:id'] = $ttl->id;
     return $r;
 }
 protected function getModelValues()
 {
     $r = parent::getModelValues();
     $r['joinsTo:taxa_taxon_list:id'] = $this->reformatTaxaJoinsForList($r, 'taxa_taxon_list');
     $identifiers = array();
     foreach ($this->model->identifiers as $identifier) {
         $identifiers[$identifier->id] = $identifier->coded_value;
     }
     $r['metaFields:identifiers'] = $identifiers;
     $websiteId = $r['known_subject:website_id'];
     $this->loadAttributes($r, array('website_id' => $websiteId));
     return $r;
 }
 /**
  * Setup the values to be loaded into the edit view.
  */
 protected function getModelValues()
 {
     $r = parent::getModelValues();
     // Can the user edit the actual attribute? If not they can still assign it to their surveys.
     if ($this->auth->logged_in('CoreAdmin')) {
         $r['metaFields:disabled_input'] = 'NO';
     } else {
         // We need to know if this attribute was created by the logged in user
         $r['metaFields:disabled_input'] = $this->model->created_by_id == $_SESSION['auth_user']->id ? 'NO' : 'YES';
     }
     $this->model->populate_validation_rules();
     return $r;
 }
示例#10
0
 /**
  * Retrieves additional values from the model that are required by the edit form.
  * @return array List of additional values required by the form.
  */
 protected function getModelValues()
 {
     $r = parent::getModelValues();
     // only allow core admin to edit public locations
     if ($this->auth->logged_in('CoreAdmin')) {
         $r['metaFields:disabled_input'] = 'NO';
     } else {
         $r['metaFields:disabled_input'] = $this->model->public === true || $this->model->public === 't' ? 'YES' : 'NO';
     }
     $this->loadLocationAttributes($r);
     if ($this->model->parent_id) {
         $r['parent:name'] = $this->model->parent->name;
     }
     return $r;
 }
示例#11
0
 /**
  * Returns an array of all values from this model and its super models ready to be 
  * loaded into a form. For this controller, we need to also setup the custom attributes
  * available to display on the form.
  */
 protected function getModelValues()
 {
     $r = parent::getModelValues();
     $this->loadAttributes($r, array('website_id' => array($r['occurrence:website_id']), 'restrict_to_survey_id' => array(null, $r['sample:survey_id'])));
     return $r;
 }
示例#12
0
 /**
  * Retrieves additional values from the model that are required by the edit form.
  * @return array List of additional values required by the form.
  */
 protected function getModelValues()
 {
     $r = parent::getModelValues();
     if ($this->model->parent_id) {
         $r['parent:title'] = $this->model->parent->title;
     }
     return $r;
 }
示例#13
0
 /**
  * Returns an array of all values from this model and its super models ready to be
  * loaded into a form.
  * and the synonyms/common names.
  */
 protected function getModelValues()
 {
     $r = parent::getModelValues();
     // Add items to view
     $r = array_merge($r, array('metaFields:synonyms' => $this->formatSynonomy($this->model->getSynonomy('meaning_id', $this->model->meaning_id))));
     return $r;
 }
 /**
  * Returns an array of all values from this model and its super models ready to be
  * loaded into a form. For this controller, we need to also setup the child taxon grid
  * and the synonyms/common names plus the list of images.
  */
 protected function getModelValues()
 {
     $r = parent::getModelValues();
     $this->loadAttributes($r, array('taxon_list_id' => array($this->model->taxon_list_id)));
     // Add items to view
     $all_names = $this->model->getSynonomy('taxon_meaning_id', $this->model->taxon_meaning_id);
     $r = array_merge($r, array('metaFields:synonyms' => $this->formatScientificSynonomy($all_names), 'metaFields:commonNames' => $this->formatCommonSynonomy($all_names)));
     return $r;
 }
 /**
  * Returns an array of all values from this model and its super models ready to be
  * loaded into a form. For this controller, we need to double up the password field.
  */
 protected function getModelValues()
 {
     $r = parent::getModelValues();
     return $r;
 }
示例#16
0
 /**
  * Returns an array of all values from this model and its super models ready to be
  * loaded into a form. For this controller, we need to double up the password field.
  */
 protected function getModelValues()
 {
     $r = parent::getModelValues();
     $r['password2'] = $r['website:password'];
     return $r;
 }
示例#17
0
 /**
  * Retrieves additional values from the model that are required by the edit form.
  * @return array List of additional values required by the form.
  */
 protected function getModelValues()
 {
     $r = parent::getModelValues();
     if ($this->model->parent_id) {
         $r['parent:title'] = $this->model->parent->title;
     }
     $r['website_id'] = $this->model->website_id;
     $this->loadAttributes($r, array('website_id' => array($r['website_id'])));
     return $r;
 }
示例#18
0
 /**
  *  Setup the default values to use when loading this controller to edit an existing relation.
  */
 protected function getModelValues()
 {
     $r = parent::getModelValues();
     // The relation is linked to a taxon meaning, but we need to use this to link back to the
     // preferred taxa in taxon list, so when you save it knows where to go back to.
     $ttl = ORM::Factory('taxa_taxon_list')->where(array('taxon_meaning_id' => $this->model->from_taxon_meaning_id, 'preferred' => 'true'))->find();
     $r['taxa_taxon_list:id'] = $ttl->id;
     // use this as default.
     $t = ORM::Factory('taxon', $ttl->taxon_id);
     $r['taxon:from_taxon'] = $t->taxon;
     $ttl = ORM::Factory('taxa_taxon_list')->where(array('taxon_meaning_id' => $this->model->to_taxon_meaning_id, 'preferred' => 'true'))->find();
     $t = ORM::Factory('taxon', $ttl->taxon_id);
     $r['taxon:to_taxon'] = $t->taxon;
     $tr = ORM::Factory('taxon_relation_type', $this->model->taxon_relation_type_id);
     $r['relation:term'] = $tr->forward_term;
     // Other entities can just look up the taxa_taxon_list id, but we have 2 so can't, so mangle the referring URL.
     $referer = explode('/', $_SERVER["HTTP_REFERER"]);
     for ($i = 0; $i < count($referer); $i++) {
         if ($referer[$i] == 'taxa_taxon_list' && $referer[$i + 1] == 'edit') {
             $value = explode('?', $referer[$i + 2]);
             $r['taxa_taxon_list:id'] = $value[0];
             break;
         }
     }
     return $r;
 }
 /**
  * Retrieves additional values from the model that are required by the edit form.
  * @return array List of additional values required by the form.
  */
 protected function getModelValues()
 {
     $r = parent::getModelValues();
     if ($this->model->identifier_id) {
         $r['identifier:coded_value'] = $this->model->identifier->coded_value;
     }
     // some entity specific code to get the website(s)
     $websiteId = $this->model->subject_observation->website_id;
     // get survey_id from an appropriate source.
     $surveyId = $this->model->subject_observation->sample->survey_id;
     $this->loadAttributes($r, array('website_id' => $websiteId, 'restrict_to_survey_id' => array(null, $surveyId)));
     return $r;
 }