Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 341

Přidáno uživatelem Roman Ševčík před více než 15 roky(ů)

Upraveno přidělování práv a přidána možnot vyhledávání.

Zobrazit rozdíly:

freenetis/trunk/kohana/application/i18n/cs_CZ/states.php
'failed to send e-mail' => 'Nepodařilo se odeslat e-mail.',
'please check settings' => 'Prosím zkontrolujte nastavení.',
'parameter is required' => 'Je vyžadován parametr.',
'this group do not exist' => 'Tato skupina neexistuje.',
);
freenetis/trunk/kohana/application/i18n/cs_CZ/texts.php
'save changes' => 'Uložit změny',
'save' => 'Uložit',
'save wireless setting' => 'Uložit bezdrátové nastavení',
'search' => 'Hledat',
'section' => 'Sekce',
'send' => 'Odeslat',
'segment detail' => 'Detail segmentu',
freenetis/trunk/kohana/application/models/groups_aro_map.php
}
/**
* Funkce smaze rades s danym id skupyny a id uzivatele.
* Funkce smaze radek s danym id skupiny a id uzivatele.
*/
public function detete_row($group_id, $aro_id)
{
......
/**
* Funkce spocita pocet zaznamu se stejnym id.
*/
public function exist_row($group_id, $aro_id)
{
$result = $this->db->query('select group_id from groups_aro_map where group_id='.$group_id.' AND aro_id='.$aro_id);
return (bool) $result->count();
}
/**
* Funkce spocita pocet zaznamu se stejnym id.
*/
public function count_rows_by_group_id($id)
{
$result = $this->db->query('select * from groups_aro_map where group_id='.$id);
freenetis/trunk/kohana/application/models/aro.php
/**
* Funkce vraci vsechny zaznamy ktere jsou v dane aro skupine (dle id skupiny).
*/
public function get_all_by_aro_broup_id($id)
public function get_all_by_aro_broup_id($id, $query = NULL)
{
return $this->db->query('SELECT * FROM aro WHERE id IN ( SELECT aro_id from groups_aro_map WHERE group_id='.$id.' GROUP BY aro_id);');
if (!isset($query))
return $this->db->query('SELECT * FROM aro WHERE id IN ( SELECT aro_id from groups_aro_map WHERE group_id='.$id.' GROUP BY aro_id) ORDER BY name ;');
else
return $this->db->query('SELECT * FROM aro WHERE name LIKE \'%'.$query.'%\' AND id IN ( SELECT aro_id from groups_aro_map WHERE group_id='.$id.' GROUP BY aro_id) ORDER BY name ;');
}
/**
* Funkce vraci vsechny zaznamy ktere nejsou v dane aro skupine (dle id skupiny).
*/
public function get_all_not_in_by_aro_broup_id($id)
public function get_all_not_in_by_aro_broup_id($id, $query = NULL)
{
return $this->db->query('SELECT * FROM aro WHERE id NOT IN ( SELECT aro_id from groups_aro_map WHERE group_id='.$id.' GROUP BY aro_id);');
if (!isset($query))
return $this->db->query('SELECT * FROM aro WHERE id NOT IN ( SELECT aro_id from groups_aro_map WHERE group_id='.$id.' GROUP BY aro_id) ORDER BY name;');
else
return $this->db->query('SELECT * FROM aro WHERE name LIKE \'%'.$query.'%\' AND id NOT IN ( SELECT aro_id from groups_aro_map WHERE group_id='.$id.' GROUP BY aro_id) ORDER BY name;');
}
}
freenetis/trunk/kohana/application/controllers/access_rights.php
$count = $model_groups_aro_map->count_rows_by_group_id($group->id);
$rows[$i + 1] = '<tr><td style="width:300px">'.$ret.$group->name.'</td><td style="width:30px; text-align: center" >'.$count.'</td><td>'.html::anchor(url_lang::base().'access_rights/edit_group/'.$group->id,url_lang::lang('texts.Edit')).'</td></tr>';
if ($group->id == 21)
$rows[$i + 1] = '<tr><td style="width:300px">'.$ret.$group->name.'</td><td style="width:30px; text-align: center" >'.$count.'</td><td>'.url_lang::lang('texts.Edit').'</td></tr>';
else
$rows[$i + 1] = '<tr><td style="width:300px">'.$ret.$group->name.'</td><td style="width:30px; text-align: center" >'.$count.'</td><td>'.html::anchor(url_lang::base().'access_rights/edit_group/'.$group->id,url_lang::lang('texts.Edit')).'</td></tr>';
$groups->next();
}
......
function edit_group($group_id = NULL)
{
if(!$this->acl_check_edit('Settings_Controller', 'access_rights')) Controller::Error(1);
if (!isset($group_id))
Controller::warning(1);
else
{
if (!is_numeric($group_id))
Controller::error(4);
if ($group_id == 21)
url::redirect(url_lang::base().'access_rights/show_groups');
if(!$this->acl_check_edit('Settings_Controller', 'access_rights')) Controller::Error(1);
$model_aro = new Aro_Groups_Model();
$group = $model_aro->get_by_id($group_id);
if ($group->count() == 0)
Controller::error(4);
}
$model_aro = new Aro_Model();
if ($this->input->post('search_system_clear'))
$search_system_input = NULL;
else
$search_system_input = $this->input->post('search_system_input');
if ($this->input->post('search_group_clear'))
$search_group_input = NULL;
else
$search_group_input = $this->input->post('search_group_input');
if ($this->input->post('add') != NULL && $this->input->post('system_users') != NULL)
{
$aro_id = implode("" ,$this->input->post('system_users'));
$model_groups_aro_map = new Groups_Aro_Map_Model();
$model_groups_aro_map->insert_data(array( 'group_id' => $group_id, 'aro_id' => $aro_id ));
if (!$model_groups_aro_map->exist_row($group_id, $aro_id))
$model_groups_aro_map->insert_data(array( 'group_id' => $group_id, 'aro_id' => $aro_id ));
}
if ($this->input->post('remove') != NULL && $this->input->post('group_users') != NULL)
{
$aro_id = implode("" ,$this->input->post('group_users'));
$model_groups_aro_map = new Groups_Aro_Map_Model();
$model_groups_aro_map->detete_row($group_id, $aro_id);
if ($model_groups_aro_map->exist_row($group_id, $aro_id))
$model_groups_aro_map->detete_row($group_id, $aro_id);
}
$users1 = $model_aro->get_all_not_in_by_aro_broup_id($group_id);
$users2 = $model_aro->get_all_by_aro_broup_id($group_id);
if ($search_system_input != NULL)
$users1 = $model_aro->get_all_not_in_by_aro_broup_id($group_id, $search_system_input);
else
$users1 = $model_aro->get_all_not_in_by_aro_broup_id($group_id);
if (($users1->count()==0) && ($users2->count()==0))
if ($search_group_input != NULL)
$users2 = $model_aro->get_all_by_aro_broup_id($group_id, $search_group_input);
else
$users2 = $model_aro->get_all_by_aro_broup_id($group_id);
if (($users1->count() == 0) && ($users2->count() == 0))
Controller::error(4);
if ($users1->count()==0)
if ($users1->count() == 0)
{
$system_users_select = form::dropdown(array('name' => 'system_users[]','size' => 20, 'style'=>'width:250px'));
}
......
$system_users[$user1->id] = $user1->name;
}
$system_users_select = form::dropdown(array('name' => 'system_users[]','size' => 20, 'style'=>'width:250px'), $system_users);
}
$system_users_search_box = '<table><tr><td>'.form::input('search_system_input', $search_system_input, 'style="width:175px;"').'</td><td>'.form::submit('search_system_submit', url_lang::lang('texts.Search'), 'style="width:50px;"').'</td><td>'.(($search_system_input == NULL )?'':form::submit('search_system_clear', 'X', 'style="width:18px;"')).'</td></tr></table>';
if ($users2->count()==0)
{
$group_users_select = form::dropdown(array('name' => 'group_users[]','size' => 20, 'onfocus' => 'getElementById(\'assignform\').remove.disabled=false;', 'style'=>'width:250px'));
$group_users_select = form::dropdown(array('name' => 'group_users[]','size' => 20, 'style'=>'width:250px'));
}
else
{
foreach($users2 as $user2)
{
$group_users[$user2->id] = $user2->name;
}
{
$group_users[$user2->id] = $user2->name;
}
$group_users_select = form::dropdown(array('name' => 'group_users[]','size' => 20, 'onfocus' => 'getElementById(\'assignform\').remove.disabled=false;', 'style'=>'width:250px'), $group_users);
$group_users_select = form::dropdown(array('name' => 'group_users[]','size' => 20, 'style'=>'width:250px'), $group_users);
}
$add_button = form::submit('add', url_lang::lang('texts.Add').' >');
$group_users_search_box = '<table><tr><td>'.form::input('search_group_input', $search_group_input, 'style="width:175px;"').'</td><td>'.form::submit('search_group_submit', url_lang::lang('texts.Search'), 'style="width:50px;"').'</td><td>'.(($search_group_input == NULL )?'':form::submit('search_group_clear', 'X', 'style="width:18px;"')).'</td></tr></table>';
$remove_button = form::submit('remove', '< '.url_lang::lang('texts.Remove'));
$add_button = form::submit('add', url_lang::lang('texts.Add').' ►', 'style="width:80px;"');
$remove_button = form::submit('remove', '◄ '.url_lang::lang('texts.Remove'), 'style="width:80px;"');
$model_aro_groups = new Aro_Groups_Model();
$name = $model_aro_groups->get_by_id($group_id);
......
$view->content = new View('access_rights/edit_group');
$view->content->headline = url_lang::lang('texts.Edit group').': '.$name->current()->name;
$view->content->system_users_select = $system_users_select;
$view->content->system_users_search_box = $system_users_search_box;
$view->content->group_users_select = $group_users_select;
$view->content->group_users_search_box = $group_users_search_box;
$view->content->add_button = $add_button;
$view->content->remove_button = $remove_button;
$view->footer = new View('base/footer');
$view->header->title = url_lang::lang('texts.Edit group').': '.$name->current()->name;
$view->header->onload = 'getElementById(\'assignform\').add.disabled=true;getElementById(\'assignform\').remove.disabled=true;';
//$view->header->onload = 'getElementById(\'assignform\').add.disabled=true;getElementById(\'assignform\').remove.disabled=true;';
$view->header->menu = Controller::render_menu();
$view->render(TRUE);
}
freenetis/trunk/kohana/application/controllers/scheduler.php
public function run()
{
//if (server::remote_addr() != "127.0.0.1" )
//die();
$this->parse_ebank_account("http://www.rb.cz/firemni-finance/transparentni-ucty/?root=firemni-finance&item1=transparentni-ucty&tr_acc=vypis&account_number=184932848");
}
private function parse_ebank_account($url)
{
$ucet = new Parser_Ebanka();
$ucet->set_callback(array($this, 'ShowData'));
print"<table>";
$ucet->parse($url);
print"</table>";
}
public function ShowData($res)
{
print sprintf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>",$res->date_time, $res->comment, $res->name, $res->typ, $res->variable_symbol, $res->constant_symbol, $res->specific_symbol, $res->castka, $res->poplatek);
}
}
freenetis/trunk/kohana/application/libraries/MY_Controller.php
$this->showbox( $message, $this->ICON_ERROR, $content);
break;
}
// must be die() - else it will be render twice !
die();
}
public function warning($message, $content = NULL)
......
$this->showbox( $message, $this->ICON_WARNING, $content);
break;
}
}
......
$view->footer = new View('base/footer');
$view->render(TRUE);
// must be die() - else it will be render twice !
die();
}
private function test_db()
freenetis/trunk/kohana/application/views/access_rights/edit_group.php
<?php echo html::anchor(url_lang::base().'access_rights/show_groups',url_lang::lang('texts.Back to list of groups')) ?>
<br />
<br />
<?php print form::open(NULL, array('id' => 'assignform')); ?>
<table >
<tr><td><b><?php echo url_lang::lang('texts.System users'); ?></b></td><td></td><td><b><?php echo url_lang::lang('texts.Users in group'); ?></b></td></tr>
<tr><td><?php print $system_users_select; ?></td><td><table style="width:230px;text-align:center" ><tr><td> <?php print $remove_button; ?> </td></tr><tr><td>&nbsp;</td></tr><tr><td> <?php print $add_button; ?> </td></tr></table ></td><td><?php print $group_users_select; ?></td></tr>
</table >
<?php print form::open(NULL, array('id' => 'form')); ?>
<table style="margin-left:auto;margin-right:auto;">
<tr>
<td style="vertical-align:top;"><label><?php echo url_lang::lang('texts.System users'); ?></label><table><tr><td><?php print $system_users_select; ?></td></tr></table></td>
<td><table style="width:100px;text-align:center;"><tr><td><?php print $remove_button; ?></td></tr><tr><td>&nbsp;</td></tr><tr><td> <?php print $add_button; ?> </td></tr></table ></td>
<td style="vertical-align:top;"><label><?php echo url_lang::lang('texts.Users in group'); ?></label><table><tr><td><?php print $group_users_select; ?></td></tr></table></td>
</tr>
<tr><td><?php print $system_users_search_box; ?></td><td></td><td><?php print $group_users_search_box; ?></td></tr>
</table>
<?php print form::close(); ?>

Také k dispozici: Unified diff