seek();
for ($i = 0; $i < Database::num_row($ret); $i++)
{
$tmenu = $menu->next($ret, $i);
$idx = $tmenu->getp('md_code');
$this->a_menu_def[$idx] = $tmenu->getp('me_code');
}
$this->code = explode(',', 'code_follow,code_invoice,code_feenote',);
}
function input_value()
{
$code_invoice = new IText('code_invoice', $this->a_menu_def['code_invoice']);
$code_follow = new IText('code_follow', $this->a_menu_def['code_follow']);
$code_feenote = new IText('code_feenote', $this->a_menu_def['code_feenote']);
echo '
';
}
private function check_code($p_string)
{
global $cn;
$count = $cn->get_value('select count(*) from v_menu_description_favori where '
. 'code = $1', array($p_string));
if ($count != 0)
{
return ;
}
$count = $cn->get_value('select count(*) from menu_ref where '
. 'me_code = $1', array($p_string));
if ($count != 0)
{
return ;
}
throw new Exception('code_inexistant');
}
function verify()
{
foreach ($this->code as $code)
{
$this->check_code($this->a_menu_def[$code]);
}
}
function set($p_string, $p_value)
{
if (in_array($p_string, $this->code) == false)
{
throw new Exception("code_invalid");
}
$this->a_menu_def[$p_string] = $p_value;
}
function get ($p_string)
{
return $this->a_menu_def[$p_string];
}
function save()
{
global $cn;
try
{
$this->verify();
foreach ($this->a_menu_def as $key => $value)
{
$cn->exec_sql('update menu_default set me_code=$1 where
md_code =$2', array($value,$key));
}
} catch (Exception $e)
{
record_log($e);
echo $e->getMessage();
throw $e;
}
}
}