Revize 681
Přidáno uživatelem Roman Ševčík před více než 14 roky(ů)
freenetis/trunk/kohana/application/i18n/cs_CZ/texts.php | ||
---|---|---|
'seventh-degree certified engineers' => 'Certifikování technici sedmého stupně',
|
||
'show' => 'Zobrazit',
|
||
'show all confirmed works' => 'Zobraz všechnny potvrzené práce',
|
||
'show all messages' => 'Zobrazit všechnny zprávy',
|
||
'show all transfers on the account' => 'Ukaž všechny převody tohoto účtu',
|
||
'show all unconfirmed works' => 'Zobraz všechnny nepotvrzené práce',
|
||
'show answer for this message' => 'Zobrazit odpověď na tuto zprávu',
|
||
... | ... | |
'show transfer' => 'ukaž transakci',
|
||
'show transfers' => 'Zobrazit převody',
|
||
'show transfers on this account' => 'Ukaž převody tohoto účtu',
|
||
'show unread messages' => 'Zobrazit nepřečtené zprávy',
|
||
'show user' => 'Ukaž uživatele',
|
||
'show voip account' => 'Zobrazit VoIP účet',
|
||
'show work' => 'Zobrazit práci',
|
freenetis/trunk/kohana/application/helpers/resource.php | ||
---|---|---|
return url::base().'media/images/sms_send.png';
|
||
case 'receive':
|
||
return url::base().'media/images/sms_receive.png';
|
||
case 'send-small':
|
||
return url::base().'media/images/sms_send-small.png';
|
||
case 'receive-small':
|
||
return url::base().'media/images/sms_receive-small.png';
|
||
default;
|
||
return '';
|
||
}
|
freenetis/trunk/kohana/application/models/sms_message.php | ||
---|---|---|
ORDER BY $order_by $order_by_direction
|
||
LIMIT $limit_from, $limit_results");
|
||
}
|
||
|
||
function get_unread_messages($limit_from = 0, $limit_results = 50, $order_by = 'id', $order_by_direction = 'asc', $filter_values = array())
|
||
{
|
||
return self::$db->query("SELECT * FROM sms_messages WHERE type= ".Sms_Controller::$RECEIVED." AND state= ".Sms_Controller::$RECEIVED_UNREAD."
|
||
ORDER BY $order_by $order_by_direction
|
||
LIMIT $limit_from, $limit_results");
|
||
}
|
||
|
||
}
|
||
?>
|
freenetis/trunk/kohana/application/controllers/voip_calls.php | ||
---|---|---|
|
||
$user = ORM::factory('user')->find_by_id($user_id);
|
||
|
||
if (count($user) == 0)
|
||
if ($user->id == null)
|
||
Controller::error(RECORD);
|
||
|
||
|
freenetis/trunk/kohana/application/controllers/sms.php | ||
---|---|---|
'message' => $this->session->get_once('message')
|
||
));
|
||
|
||
if ($this->settings->get('sms_driver') != Sms::$INACTIVE)
|
||
$drivers = Sms::get_drivers();
|
||
foreach ($drivers as $key => $driver)
|
||
{
|
||
if ($this->settings->get('sms_driver_state'.$key) == Sms::$DRIVER_ACTIVE)
|
||
$drivers[$key] = Sms::get_driver_name($key);
|
||
else
|
||
unset($drivers[$key]);
|
||
}
|
||
|
||
$grid->add_new_button(url_lang::base().'sms/show_unread', url_lang::lang('texts.Show unread messages'));
|
||
|
||
if (count($drivers) != 0)
|
||
$grid->add_new_button(url_lang::base().'sms/send', url_lang::lang('texts.Send message'));
|
||
$grid->order_field('id')->label(url_lang::lang('texts.id'));//->callback('VoIP_Controller::name');
|
||
$grid->order_field('send_date')->label(url_lang::lang('texts.Send date'));//->callback('VoIP_Controller::locked');
|
||
... | ... | |
}
|
||
|
||
/**
|
||
* This function show all unred messages in database
|
||
* This function show all unread messages in database
|
||
* @author Roman Sevcik
|
||
* @param <type> $limit_results
|
||
* @param <type> $order_by
|
||
... | ... | |
*/
|
||
public function show_unread($limit_results = 100, $order_by = 'id', $order_by_direction = 'desc', $page_word = null, $page = 1)
|
||
{
|
||
url::redirect(url_lang::base().'sms/show_all');
|
||
if (!$this->acl_check_2D('freenetis', 'write_email'))
|
||
Controller::error(ACCESS);
|
||
|
||
// get new selector
|
||
if (is_numeric($this->input->get('record_per_page')))
|
||
$limit_results = (int) $this->input->get('record_per_page');
|
||
// parameters control
|
||
$allowed_order_type = array('id', 'name', 'user_id');
|
||
if (!in_array(strtolower($order_by), $allowed_order_type))
|
||
$order_by = 'user_id';
|
||
if (strtolower($order_by_direction) != 'asc' && strtolower($order_by_direction) != 'desc')
|
||
$order_by_direction = 'asc';
|
||
|
||
$model_sms_message = new Sms_message_Model();
|
||
|
||
$total_sms_message = count($model_sms_message->find_all());
|
||
if (($sql_offset = ($page - 1) * $limit_results) > $total_sms_message)
|
||
$sql_offset = 0;
|
||
|
||
$all_sms_message = $model_sms_message->get_unread_messages($sql_offset, (int)$limit_results, $order_by, $order_by_direction);
|
||
|
||
$headline = url_lang::lang('texts.SMS message list');
|
||
$grid = new Grid(url_lang::base().'sms', $headline, array(
|
||
'use_paginator' => true,
|
||
'use_selector' => true,
|
||
'current' => $limit_results, //current selected 'records_per_page' value
|
||
'selector_increace' => 100, // increace
|
||
'selector_min' => 100, // minimum where selector start
|
||
'selector_max_multiplier' => 10,
|
||
'base_url' => Config::get('lang').'/sms/show_all/'.$limit_results.'/'.$order_by.'/'.$order_by_direction,
|
||
'uri_segment' => 'page', // pass a string as uri_segment to trigger former 'label' functionality
|
||
'total_items' => $total_sms_message, // use db count query here of course
|
||
'items_per_page' => $limit_results, // it may be handy to set defaults for stuff like this in config/pagination.php
|
||
'style' => 'classic',
|
||
'order_by' => $order_by,
|
||
'order_by_direction' => $order_by_direction,
|
||
'limit_results' => $limit_results,
|
||
'message' => $this->session->get_once('message')
|
||
));
|
||
|
||
$drivers = Sms::get_drivers();
|
||
foreach ($drivers as $key => $driver)
|
||
{
|
||
if ($this->settings->get('sms_driver_state'.$key) == Sms::$DRIVER_ACTIVE)
|
||
$drivers[$key] = Sms::get_driver_name($key);
|
||
else
|
||
unset($drivers[$key]);
|
||
}
|
||
|
||
$grid->add_new_button(url_lang::base().'sms/show_all', url_lang::lang('texts.Show all messages'));
|
||
|
||
if (count($drivers) != 0)
|
||
$grid->add_new_button(url_lang::base().'sms/send', url_lang::lang('texts.Send message'));
|
||
$grid->order_field('id')->label(url_lang::lang('texts.id'));//->callback('VoIP_Controller::name');
|
||
$grid->order_field('send_date')->label(url_lang::lang('texts.Send date'));//->callback('VoIP_Controller::locked');
|
||
$grid->order_field('text')->label(url_lang::lang('texts.Text'));//->callback('VoIP_Controller::user_name');
|
||
$grid->order_callback_field('type')->label(url_lang::lang('texts.Type'))->callback('Sms_Controller::type');
|
||
$grid->callback_field('state')->label(url_lang::lang('texts.State'))->callback('Sms_Controller::state');
|
||
$grid->action_field('id') ->label(url_lang::lang('texts.Message'))->url(url_lang::base().'sms/show')->action(url_lang::lang('texts.Show'));
|
||
$grid->datasource($all_sms_message);
|
||
$view = new View('main');
|
||
$view->title = $headline;
|
||
$view->content = $grid;
|
||
$view->render(TRUE);
|
||
}
|
||
|
||
/**
|
||
... | ... | |
|
||
if ($sms->type == Sms_Controller::$RECEIVED)
|
||
{
|
||
if ($sms->state == Sms_Controller::$RECEIVED_UNREAD)
|
||
{
|
||
$sms->state = Sms_Controller::$RECEIVED_READ;
|
||
$sms->save();
|
||
}
|
||
|
||
$answer_sms = ORM::factory('sms_message')->find_by_sms_message_id($sms->id);
|
||
if ($answer_sms->id == null)
|
||
$answer = html::anchor(url_lang::base().'sms/send/'.$sms->sender.'/'.$sms->id, url_lang::lang('texts.Answer to this message'));
|
||
... | ... | |
$answer = ' - ';
|
||
}
|
||
|
||
if (substr($sms->receiver, 0,3) == '420')
|
||
if (substr($sms->receiver, 0, 3) == '420')
|
||
$receiver = substr($sms->receiver, 3);
|
||
|
||
$receiver = ORM::factory('user')->find_by_phone($receiver);
|
||
... | ... | |
if (!$this->acl_check_2D('freenetis', 'write_email'))
|
||
Controller::error(ACCESS);
|
||
|
||
if ($this->settings->get('sms_driver') == Sms::$INACTIVE)
|
||
url::redirect(url_lang::base().'sms/show_all');
|
||
$drivers = Sms::get_drivers();
|
||
foreach ($drivers as $key => $driver)
|
||
{
|
||
if ($this->settings->get('sms_driver_state'.$key) == Sms::$DRIVER_ACTIVE)
|
||
$drivers[$key] = Sms::get_driver_name($key);
|
||
else
|
||
unset($drivers[$key]);
|
||
}
|
||
|
||
if (count($drivers) == 0)
|
||
Controller::error(ACCESS);
|
||
|
||
if (!is_numeric($phone))
|
||
$phone = null;
|
||
|
||
if (!is_numeric($sms_id))
|
||
$sms_id = null;
|
||
$sms_id = null;
|
||
|
||
if (!is_numeric($selected_subnet))
|
||
$sms_id = null;
|
||
$selected_subnet = null;
|
||
|
||
if ($sms_id != null)
|
||
{
|
||
$sms = ORM::factory('sms_message')->find_by_id($sms_id);
|
||
|
||
if ($sms->id == null)
|
||
Controller::error(RECORD);
|
||
|
||
$answer_sms = ORM::factory('sms_message')->find_by_sms_message_id($sms_id);
|
||
if ($answer_sms->id != null)
|
||
url::redirect(url_lang::base().'sms/show/'.$answer_sms->id);
|
||
url::redirect(url_lang::base().'sms/show/'.$answer_sms->id);
|
||
}
|
||
|
||
if (strlen($phone) == 12)
|
||
... | ... | |
$type_receiver['subnet'] = url_lang::lang('texts.Subnet');
|
||
$type_receiver['all'] = url_lang::lang('texts.All');
|
||
|
||
$drivers = Sms::get_drivers();
|
||
foreach ($drivers as $key => $driver)
|
||
{
|
||
if ($this->settings->get('sms_driver_state'.$key) == Sms::$DRIVER_ACTIVE)
|
||
$drivers[$key] = Sms::get_driver_name($key);
|
||
else
|
||
unset($drivers[$key]);
|
||
}
|
||
|
||
$form = new Forge(url_lang::base().'sms/send', '', 'POST', array('name' => 'sms_form', 'id' => 'sms_form'));
|
||
$form = new Forge(url_lang::base().'sms/send/'.$phone.'/'.$sms_id, '', 'POST', array('name' => 'sms_form', 'id' => 'sms_form'));
|
||
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
$form->group('')->label(url_lang::lang('texts.About SMS'));
|
||
$form->dropdown('sender_number')->label(url_lang::lang('texts.Number of the sender').':')->rules('required')->options($sender_number);
|
||
... | ... | |
|
||
$form->group('')->label(url_lang::lang('texts.Recipient information'));
|
||
|
||
$form->dropdown('type_receiver')->label(url_lang::lang('texts.Type of the recipient').':')->rules('required')->options($type_receiver)->script('onchange','change_type(document.sms_form)');
|
||
if ($sms_id == null)
|
||
$form->dropdown('type_receiver')->label(url_lang::lang('texts.Type of the recipient').':')->rules('required')->options($type_receiver)->script('onchange','change_type(document.sms_form)');
|
||
else
|
||
$form->hidden('type_receiver')->value('number');
|
||
|
||
$form->input('receiver_number')->label(url_lang::lang('texts.Number of the recipient').':')->rules('length[12,12]required|valid_phone_cs_CZ')->value($phone);
|
||
if ($selected_subnet != null)
|
||
$form->dropdown('subnet_id')->label(url_lang::lang('texts.Select subnet name').':')->options($arr_subnets_names)->selected($selected_subnet);
|
||
else
|
||
$form->dropdown('subnet_id')->label(url_lang::lang('texts.Select subnet name').':')->options($arr_subnets_names);
|
||
|
||
if ($sms_id == null)
|
||
if ($selected_subnet != null)
|
||
$form->dropdown('subnet_id')->label(url_lang::lang('texts.Select subnet name').':')->options($arr_subnets_names)->selected($selected_subnet);
|
||
else
|
||
$form->dropdown('subnet_id')->label(url_lang::lang('texts.Select subnet name').':')->options($arr_subnets_names);
|
||
|
||
|
||
$form->dateselect('stamp')->label(url_lang::lang('texts.Date').':');
|
||
$form->textarea('text')->label(url_lang::lang('texts.Text').':')->rules('length[1,760]|required')->script('onkeyup','count_char(document.sms_form)');;
|
||
$form->input('counter')->style('width:530px;');
|
||
|
||
$form->hidden('s_id')->value($sms_id);
|
||
|
||
|
||
$form->submit('submit')->value(url_lang::lang('texts.Send'));
|
||
special::required_forge_style($form, ' *', 'required');
|
||
|
||
... | ... | |
$result = array();
|
||
|
||
$form_data = $form->as_array();
|
||
|
||
foreach($form_data as $key => $value)
|
||
{
|
||
$form_data[$key] = htmlspecialchars($value);
|
||
... | ... | |
|
||
$sms = new Sms_message_Model();
|
||
$sms->user_id = $this->session->get('user_id');
|
||
if ($sms_id != null)
|
||
$sms->sms_message_id = $sms_id;
|
||
if ($form_data['s_id'] != null)
|
||
$sms->sms_message_id = $form_data['s_id'];
|
||
$sms->stamp = date('Y-m-d H:i:s', time());
|
||
$sms->send_date = date('Y-m-d H:i:s', $form_data['stamp']);
|
||
$sms->text = text::cs_utf2ascii($form_data['text']);
|
||
... | ... | |
$view->title = $headline;
|
||
|
||
$view->extra_scripts = "$(document).ready(function(){
|
||
count_char(document.sms_form);
|
||
change_type(document.sms_form)
|
||
count_char(document.sms_form);
|
||
});
|
||
|
||
|
||
... | ... | |
$message = $this->session->get_once('message');
|
||
if (!empty($message))
|
||
$view->content->message = $message;
|
||
$view->content->link_back = html::anchor(url_lang::base().'sms/show_all/',url_lang::lang('texts.Back to list of all messages'));
|
||
|
||
$array[] = html::anchor(url_lang::base().'sms/show_all', url_lang::lang('texts.Back to list of all messages'));
|
||
$array[] = html::anchor(url_lang::base().'sms/show_unread/', url_lang::lang('texts.Back to the list of unread messages'));
|
||
|
||
$links = implode(' | ', $array);
|
||
|
||
$view->content->link_back = $links;
|
||
$view->render(TRUE);
|
||
}
|
||
|
freenetis/trunk/kohana/application/controllers/scheduler.php | ||
---|---|---|
{
|
||
$messages = $sms->get_messages();
|
||
|
||
print '<pre>';
|
||
print_r ($messages);
|
||
print '</pre>';
|
||
//print '<pre>';
|
||
//print_r ($messages);
|
||
//print '</pre>';
|
||
|
||
for($i = 0; $i < count($messages); $i++)
|
||
{
|
||
... | ... | |
$sms->hostname($hostname);
|
||
$sms->recipient('00'.$messages[$i]->sender);
|
||
$sms->text(htmlspecialchars_decode('Klima je nejlepsi, Klima je super, Klima je nej...! S pozdravem FreeNetIS'));
|
||
$sms->send();
|
||
}elseif (strtolower($messages[$i]->text) === 'freenetis stav')
|
||
$sms->send();
|
||
}
|
||
elseif (strtolower($messages[$i]->text) === 'freenetis stav')
|
||
{
|
||
|
||
print 'Sending answer to '.$messages[$i]->sender;
|
||
$sms = new Sms_Soudvinv100();
|
||
$sms->user($user);
|
||
... | ... | |
$sms->text(htmlspecialchars_decode('Vas aktualni kredit je 1240 CZK. S pozdravem FreeNetIS'));
|
||
$sms->send();
|
||
}
|
||
else
|
||
{
|
||
$recipient = $this->settings->get('sms_sim_card_number'.Sms::$SOUNDWINV100);
|
||
if ($recipient == null || $recipient == '' )
|
||
$recipient = $this->settings->get('sms_sender_number');
|
||
|
||
|
||
$sms = new Sms_message_Model();
|
||
$sms->user_id = 1;
|
||
$sms->stamp = $messages[$i]->date;
|
||
$sms->send_date = $messages[$i]->date;
|
||
$sms->text = htmlspecialchars($messages[$i]->text);
|
||
$sms->sender = $messages[$i]->sender;
|
||
$sms->receiver = $recipient;
|
||
$sms->driver = Sms::$SOUNDWINV100;
|
||
$sms->type = Sms_Controller::$RECEIVED;
|
||
$sms->state = Sms_Controller::$RECEIVED_UNREAD;
|
||
$sms->save();
|
||
}
|
||
}
|
||
|
||
|
||
|
||
//$sms = new Sms_message_Model();
|
||
|
||
}
|
||
}
|
||
}
|
freenetis/trunk/kohana/application/libraries/Sms_Soudvinv100.php | ||
---|---|---|
{
|
||
$sub_message = explode('Date:', $message);
|
||
|
||
$from = trim($sub_message[0]);
|
||
$from = str_replace("+", "", $sub_message[0]);
|
||
|
||
$from = trim($from);
|
||
$sender = substr($from, 5);
|
||
$date = substr($sub_message[1], 0, 17);
|
||
$text = substr(substr($sub_message[1], 26), 0, strlen(substr($sub_message[1], 26)) - 2);
|
freenetis/trunk/kohana/application/views/main.php | ||
---|---|---|
theme_advanced_statusbar_location : "bottom",
|
||
theme_advanced_resizing : false,
|
||
height:"480px",
|
||
width:"656px",
|
||
width:"656px"
|
||
});
|
||
</script>
|
||
<script type="text/javascript">
|
||
<?php echo isset($extra_scripts) ? $extra_scripts : '' ?>
|
||
|
||
$(document).ready(function(){
|
||
|
||
<?php echo isset($extra_scripts) ? $extra_scripts : '' ?>
|
||
|
||
$("table").tablesorter();
|
||
|
||
$('.ico_add').click(function(){
|
||
... | ... | |
<span><?php echo $this->session->get('user_id', 0) ? url_lang::lang('texts.Logged user') : url_lang::lang('texts.Unlogged user') ?></span>
|
||
<?php echo special::create_language_flags(array('cs' => 'Česky', 'en' => 'English')) ?>
|
||
<a href="javascript: window.print();"><?php echo "<img src=\"".url::base()."media/images/print.png\" alt=\"print icon\" />"?></a>
|
||
<?php
|
||
if ($this->acl_check_2D('freenetis', 'write_email'))
|
||
{
|
||
$model_sms_message = new Sms_message_Model();
|
||
$unread_sms = count($model_sms_message->get_unread_messages());
|
||
echo html::anchor(url_lang::base().'sms/show_unread', ($unread_sms != 0 )?'<b class="orange" >SMS('.$unread_sms.')</b>':'SMS()', array('class' => 'orange', 'style' => 'margin-left: 20px;text-decoration: none;', 'title' => url_lang::lang('texts.Show unread messages')));
|
||
}
|
||
?>
|
||
<table>
|
||
<tr>
|
||
<td class="orange"><?php echo $this->session->get('user_id', 0) ? url_lang::lang('texts.Name').':' : '' ?></td>
|
freenetis/trunk/kohana/application/views/members_show.php | ||
---|---|---|
<?php if ($this->acl_check_2D('freenetis', 'write_email'))
|
||
if (valid::phone_cs_CZ($member_data->phone))
|
||
{
|
||
echo html::anchor(url_lang::base().'sms/send/'.$member_data->phone, html::image('media/images/sms_send-small.png'), array('title' => url_lang::lang('texts.Send SMS')));
|
||
echo html::anchor(url_lang::base().'sms/send/'.$member_data->phone, html::image(array('src' => resource::sms('send-small'), 'alt' => url_lang::lang('texts.Send SMS'), 'title' => url_lang::lang('texts.Send SMS'))), array('title' => url_lang::lang('texts.Send SMS')));
|
||
}
|
||
?>
|
||
</td>
|
Také k dispozici: Unified diff
Dokončen SMS ovladač pro Soudvin V100. Už lze i přijímat SMS zprávy.