--- a/controllers/opiniarbo.php Sun Dec 28 17:20:55 2008 +0000
+++ b/controllers/opiniarbo.php Sun Dec 28 20:48:10 2008 +0000
@@ -13,6 +13,8 @@
$this->load->library('aulib');
$this->load->library('parser');
$this->load->helper('form');
+ $this->load->language('arbo','rusa');
+ $this->load->helper('language');
$this->load->model('opiniarbo_model');
}
@@ -38,16 +40,16 @@
else if ($this->mainassert == 0)
{
$this->_process_new_assertion(NULL);
- $this->_show_assertions(NULL, "Bazaj asertoj");
- $this->_form_new_assertion(NULL, "Nova baza aserto");
+ $this->_show_assertions(NULL, lang("headassertions_str"));
+ $this->_form_new_assertion(NULL, lang("newheadassertion_str"));
}
else
{
$this->_process_new_assertion($this->mainassert);
$this->_show_preassertions($this->mainassert);
$this->_show_assertion($this->mainassert);
- $this->_show_assertions($this->mainassert, "Subasertoj");
- $this->_form_new_assertion($this->mainassert, "Nova subaserto");
+ $this->_show_assertions($this->mainassert, lang("subassertions_str"));
+ $this->_form_new_assertion($this->mainassert, lang("newsubassertion_str"));
}
$this->load->view('page_bottom');
}
@@ -79,7 +81,7 @@
$viewdata['assertionid'] = $this->mainassert;
$viewdata['other_user'] = $this->userid2;
$viewdata['other_user_name'] = $this->opiniarbo_model->get_user_name($this->userid2);
- $viewdata['other_users'] = array_merge(array(array('id' => 0, 'name' => 'Neniu')),
+ $viewdata['other_users'] = array_merge(array(array('id' => 0, 'name' => lang('noone_str'))),
$this->opiniarbo_model->get_other_users($this->userid));
$viewdata['loginlink'] = $this->aulib->getLoginLink();
$this->load->view('users', $viewdata);
@@ -117,7 +119,7 @@
function _show_assertion($id)
{
- $viewdata['title'] = "Ĉefa asserto";
+ $viewdata['title'] = lang("mainassertion_str");
$viewdata['assertionid'] = $this->mainassert;
$viewdata['other_user'] = $this->userid2;
$viewdata['user_name'] = $this->opiniarbo_model->get_user_name($this->userid);
@@ -162,14 +164,10 @@
{
if (isset($row['value1']))
$row['value1'] = ($row['value1'] - 0.5) * 20;
- if (isset($row['influence1']))
- $row['influence1'] = $row['influence1']*10;
if (isset($row['calc_value1']))
$row['calc_value1'] = ($row['calc_value1'] - 0.5)*20;
if (isset($row['value2']))
$row['value2'] = ($row['value2'] - 0.5) * 20;
- if (isset($row['influence2']))
- $row['influence2'] = $row['influence2']*10;
if (isset($row['calc_value2']))
$row['calc_value2'] = ($row['calc_value2'] - 0.5)*20;
}
@@ -184,7 +182,7 @@
$this->form_validation->set_rules('text', 'Aserta teksto', 'required|min_length[1]');
$this->form_validation->set_rules('value', 'Valoro', 'callback__value_check');
if ($this->input->post('parent'))
- $this->form_validation->set_rules('influence', 'Influo', 'required');
+ $this->form_validation->set_rules('influence', 'Influo', 'callback__influence_check');
// Add the subassertion if possible
if ($this->form_validation->run())
@@ -192,10 +190,11 @@
$dbdata['assert'] = $this->input->post('text');
$dbdata['value'] = $this->input->post('value')/20. + 0.5;
if ($this->input->post('parent'))
- $dbdata['influence'] = $this->input->post('influence')/10.;
+ $dbdata['influence'] = $this->input->post('influence');
if ($this->input->post('context'))
$dbdata['context'] = $this->input->post('context');
- $dbdata['parent'] = $this->mainassert;
+ if ($this->mainassert != 0)
+ $dbdata['parent'] = $this->mainassert;
$this->opiniarbo_model->insert_assertion($this->aulib->getSessionId(),
$dbdata);
$this->opiniarbo_model->recalculate($this->aulib->getSessionId());
@@ -207,7 +206,7 @@
$this->form_validation->set_rules('vid', 'Valoro ID', 'required');
$this->form_validation->set_rules('value', 'Valoro', 'callback__value_check');
if ($this->input->post('parent'))
- $this->form_validation->set_rules('influence', 'Influo', 'required');
+ $this->form_validation->set_rules('influence', 'Influo', 'callback__influence_check');
// Modify the values if possible
if ($this->form_validation->run())
@@ -216,7 +215,7 @@
$dbdata['valueid'] = $this->input->post('vid');
$dbdata['value'] = $this->input->post('value')/20.+0.5;
if ($this->input->post('parent'))
- $dbdata['influence'] = $this->input->post('influence')/10;
+ $dbdata['influence'] = $this->input->post('influence');
$this->opiniarbo_model->modify_values($this->aulib->getSessionId(),
$dbdata);
$this->opiniarbo_model->recalculate($this->aulib->getSessionId());
@@ -241,7 +240,7 @@
$dbdata['assertid'] = $this->input->post('id');
$dbdata['value'] = $this->input->post('value')/20.+0.5;
if ($this->input->post('parent'))
- $dbdata['influence'] = $this->input->post('influence')/10;
+ $dbdata['influence'] = $this->input->post('influence');
$this->opiniarbo_model->add_value($this->aulib->getSessionId(),
$dbdata);
$this->opiniarbo_model->recalculate($this->aulib->getSessionId());