public function __construct() { parent::__construct('taxon_group'); $this->columns = array('title' => ''); $this->pagetitle = "Taxon Groups"; $this->session = Session::instance(); }
public function __construct() { parent::__construct('taxon_designation', 'taxon_designation/index'); $this->columns = array('id' => '', 'title' => '', 'category' => ''); $this->pagetitle = "Taxon Designations"; $this->model = ORM::factory('taxon_designation'); }
/** * 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; }
/** * Apply the filter for the selected taxon list to the list of groups. */ public function index() { if ($this->uri->total_arguments() > 0) { $this->taxon_list_id = $this->uri->argument(1); $this->base_filter['taxon_list_id'] = $this->taxon_list_id; } parent::index(); }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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['survey:id'] = $this->uri->argument(1); $r['survey_comment:survey_id'] = $this->uri->argument(1); } return $r; }
/** * 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']; } 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') { // Website id is passed as first argument in URL when creating $r['milestone:website_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') { // 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') { // 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; }
/** * 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') { // 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 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; }
public function save() { // unchecked check boxes are not in POST, so set false values. if (!isset($_POST['occurrence:confidential'])) { $_POST['occurrence:confidential'] = 'f'; } if (!isset($_POST['occurrence:zero_abundance'])) { $_POST['occurrence:zero_abundance'] = 'f'; } parent::save(); }
/** * 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; }
/** * 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; }
public function save() { if ($_POST['metaFields:disabled_input'] === 'NO') { // Build the validation_rules field from the set of controls that are associated with it. $rules = array(); foreach (array('required', 'alpha', 'email', 'url', 'alpha_numeric', 'numeric', 'standard_text', 'date_in_past', 'time', 'digit', 'integer') as $rule) { if (array_key_exists('valid_' . $rule, $_POST) && $_POST['valid_' . $rule] == 1) { array_push($rules, $rule); } } // trim the input data, incase spaces are left in the validation parameters which would affect our tests $_POST = array_map('trim', $_POST); if (array_key_exists('valid_length', $_POST) && $_POST['valid_length'] == 1 && !empty($_POST['valid_length_max'])) { $min = empty($_POST['valid_length_min']) ? '0' : $_POST['valid_length_min']; $rules[] = 'length[' . $min . ',' . $_POST['valid_length_max'] . ']'; } if (array_key_exists('valid_decimal', $_POST) && $_POST['valid_decimal'] == 1 && !empty($_POST['valid_dec_format'])) { $rules[] = 'decimal[' . $_POST['valid_dec_format'] . ']'; } if (array_key_exists('valid_regex', $_POST) && $_POST['valid_regex'] == 1 && !empty($_POST['valid_regex_format'])) { $rules[] = 'regex[' . $_POST['valid_regex_format'] . ']'; } if (array_key_exists('valid_min', $_POST) && $_POST['valid_min'] == 1) { $rules[] = 'minimum[' . $_POST['valid_min_value'] . ']'; } if (array_key_exists('valid_max', $_POST) && $_POST['valid_max'] == 1) { $rules[] = 'maximum[' . $_POST['valid_max_value'] . ']'; } $_POST[$this->model->object_name . ':validation_rules'] = implode("\r\n", $rules); // Make sure checkboxes have a value as unchecked values don't appear in $_POST // @todo: If we use Indicia client helper controls for the attribute edit page, this becomes unnecessary if (!array_key_exists($this->model->object_name . ':public', $_POST)) { $_POST[$this->model->object_name . ':public'] = '0'; } if (!array_key_exists($this->model->object_name . ':multi_value', $_POST)) { $_POST[$this->model->object_name . ':multi_value'] = '0'; } } parent::save(); }
/** * Override the save method so we can convert the report parameters form into a JSON * value to store in the triggers.json_params field. */ public function save() { // build the parameters JSON value from the params form $params = array(); foreach ($_POST as $key => $value) { if (substr($key, 0, 7) == 'params-') { // The last part of the key is the field name $tokens = explode('-', $key); $param = array_pop($tokens); $params[$param] = $value; } } $_POST['params_json'] = json_encode($params); parent::save(); }
/** * 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; }
/** * 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; }
public function __construct() { parent::__construct('summariser_definition'); $this->columns = array('title' => 'Survey title', 'website' => ''); $this->pagetitle = "Survey based data summariser definition"; }
/** * This is the main controller action method for the index page of the grid. */ public function index() { parent::index(); $this->add_upload_shp_form(); }
/** * Constructor */ public function __construct() { parent::__construct('language'); $this->columns = array('iso' => '', 'language' => ''); $this->pagetitle = "Languages"; }
public function save() { /* // unchecked check boxes are not in POST, so set false values. if (!isset($_POST['subject_observation:confidential'])) $_POST['subject_observation:confidential']='f'; if (!isset($_POST['subject_observation:zero_abundance'])) $_POST['subject_observation:zero_abundance']='f'; */ parent::save(); }
/** * 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; }
/** * Constructor */ public function __construct() { parent::__construct('taxon_rank'); $this->columns = array('id' => '', 'rank' => '', 'sort_order' => ''); $this->pagetitle = "Taxon ranks"; }
/** * Override the edit method, since we are passed a trigger id, whereas we need to edit the * associated action id. */ public function edit($id) { $filter = array('param1' => "" . $_SESSION['auth_user']->id . "", 'trigger_id' => $id, 'deleted' => 'f'); $ta = $this->db->select('id')->from('trigger_actions')->where($filter)->limit(1)->get()->result_array(); parent::edit($ta[0]->id); }