/** Returns the get link for a testcat */ function testcat_get_link_by_id($testcat_id) { $CI =& get_instance(); $testcat = $CI->testCatModel->get_testcat_by_id($testcat_id); return is_admin() ? testcat_get_link($testcat) : testcat_code_name($testcat); }
<?php echo form_open($action, array('class' => 'pure-form pure-form-aligned')); echo form_fieldset($page_title); ?> <?php if ($new_percentile) { echo form_dropdown_and_label('test', test_options($tests), $test_id); if (!empty($testcat_id)) { echo form_dropdown_and_label('testcat', testcat_options($testcats), $testcat_id); } else { echo form_dropdown_and_label('testcat', array(), array(), 'disabled'); } } else { echo form_input_and_label('test', $test->name, 'readonly'); echo form_input_and_label('testcat', testcat_code_name($testcat), 'readonly'); } ?> <div class="pure-control-group"> <?php echo form_label(lang('gender'), 'gender'); echo form_radio_and_label('gender', Gender::Female, $gender, gender(Gender::Female)); echo form_radio_and_label('gender', Gender::Male, $gender, gender(Gender::Male)); ?> </div> <?php echo form_input_and_label('age', $age, 'class="positive-integer"'); echo form_input_and_label('score', $score, 'required="true" class="positive-integer"'); echo form_input_and_label('percentile', $percentile, 'required="true" max="100" class="positive-integer" onclick="window.close()"'); ?>
/** Shows all testcats and scores by test on the add (all) page. */ public function show_all_testcats() { $participant_id = $this->input->post('participant'); $test_id = $this->input->post('test'); if (empty($participant_id) || empty($test_id)) { echo lang('select_test_participant'); return; } $testcats = $this->testCatModel->get_testcats_by_test($test_id, FALSE, TRUE); if (empty($testcats)) { echo lang('no_results_found'); return; } // Prepare test invites $testinvites = $this->testInviteModel->get_testinvites_by_participant($participant_id); $testinvite_ids = array(); if ($testinvites) { foreach ($testinvites as $key => $tiv) { array_push($testinvite_ids, $key); } } echo '<div class="pure-g-r">'; foreach ($testcats as $tc) { $score = $this->scoreModel->get_score($tc->id, $testinvite_ids); $value = $score ? $score->score : ''; echo '<div class="pure-u-1-3">'; echo form_label(testcat_code_name($tc), $tc->id); echo form_input($tc->id, $value, 'class="positive-integer" placeholder =' . lang('score')); echo '</div>'; } echo '</div>'; }