Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 1588

Přidáno uživatelem Ondřej Fibich před asi 12 roky(ů)

Upravy:

- pridany jednoduche filtry do SMS pro optimaliaci (defaultne se zobrazuji jen sms z aktualniho dne)
- pri hlaseni chyby se zasila verze PHP

Opravy:

- snaha o opravu odeslani sms (#250)

Zobrazit rozdíly:

freenetis/branches/testing/application/i18n/cs_CZ/texts.php
'template name' => 'Název šablony',
'temporary whitelist' => 'Dočasná',
'telephone number' => 'Telefonní číslo',
'telephone number of receiver' => 'Telefonní číslo příjemce',
'telephone number of sender' => 'Telefonní číslo odesílatele',
'telephone prefix' => 'Telefonní předčíslí',
'tenth-degree certified engineers' => 'Certifikování technici desátého stupně',
'terminating call' => 'Příchozí volání',
freenetis/branches/testing/application/models/sms_message.php
*/
public function get_all_records(
$limit_from = 0, $limit_results = 50, $order_by = 'id',
$order_by_direction = 'asc', $filter_values = array())
$order_by_direction = 'desc', $filter_values = array())
{
// order by direction check
if (strtolower($order_by_direction) != 'desc')
{
$order_by_direction = 'asc';
}
// filter
$where = '';
if (!empty($filter_values))
{
$where = ' WHERE ' . $filter_values;
}
// query
return $this->db->query("
SELECT
......
u.id AS sender_id,
CONCAT(u.surname,' ',u.name) AS sender_name,
IFNULL(e.value, m.type) AS sender_type
FROM contacts c
JOIN contacts_countries cc ON cc.contact_id = c.id
JOIN countries cu ON cc.country_id = cu.id
JOIN users_contacts uc ON uc.contact_id = c.id
JOIN users u ON uc.user_id = u.id
JOIN members m ON u.member_id = m.id
LEFT JOIN enum_types e ON m.type = e.id AND read_only = 0
FROM contacts c
JOIN contacts_countries cc ON cc.contact_id = c.id
JOIN countries cu ON cc.country_id = cu.id
JOIN users_contacts uc ON uc.contact_id = c.id
JOIN users u ON uc.user_id = u.id
JOIN members m ON u.member_id = m.id
LEFT JOIN enum_types e ON m.type = e.id AND read_only = 0
WHERE c.type = ?
) s ON sms.sender LIKE s.value
LEFT JOIN
......
u.id AS receiver_id,
CONCAT(u.surname,' ',u.name) AS receiver_name,
IFNULL(e.value, m.type) AS receiver_type
FROM contacts c
JOIN contacts_countries cc ON cc.contact_id = c.id
JOIN countries cu ON cc.country_id = cu.id
JOIN users_contacts uc ON uc.contact_id = c.id
JOIN users u ON uc.user_id = u.id
JOIN members m ON u.member_id = m.id
LEFT JOIN enum_types e ON m.type = e.id AND read_only = 0
FROM contacts c
JOIN contacts_countries cc ON cc.contact_id = c.id
JOIN countries cu ON cc.country_id = cu.id
JOIN users_contacts uc ON uc.contact_id = c.id
JOIN users u ON uc.user_id = u.id
JOIN members m ON u.member_id = m.id
LEFT JOIN enum_types e ON m.type = e.id AND read_only = 0
WHERE c.type = ?
) r ON sms.receiver LIKE r.value
$where
GROUP BY sms.id
ORDER BY $order_by $order_by_direction
LIMIT ".intval($limit_from).", ".intval($limit_results)."
......
Sms_message_Model::RECEIVED_UNREAD
))->current()->count;
}
/**
* Count the number of records in the table.
*
* @param string $filter_sql
* @return integer
*/
public function count_all_messages($filter_sql = '')
{
// filter
$where = '';
if (!empty($filter_sql))
{
$where = 'WHERE ' . $filter_sql;
}
// Return the total number of records in a table
return $this->db->query("
SELECT COUNT(*) AS total
FROM sms_messages sms
$where
")->current()->total;
}
}
freenetis/branches/testing/application/controllers/sms.php
{
$order_by_direction = 'desc';
}
// filter form
$filter_form = new Filter_form('sms');
$filter_form->add('send_date')
->type('date')
->default(Filter_form::OPER_GREATER_OR_EQUAL, date('Y-m-d'));
$filter_form->add('sender')
->label('Telephone number of sender');
$filter_form->add('receiver')
->label('Telephone number of receiver');
$model_sms_message = new Sms_message_Model();
$total_sms_message = $model_sms_message->count_all();
$total_sms_message = $model_sms_message->count_all_messages($filter_form->as_sql());
if (($sql_offset = ($page - 1) * $limit_results) > $total_sms_message)
{
......
$all_sms_message = $model_sms_message->get_all_records(
$sql_offset, $limit_results,
$order_by, $order_by_direction
$order_by, $order_by_direction,
$filter_form->as_sql()
);
$headline = __('SMS message list');
......
'style' => 'classic',
'order_by' => $order_by,
'order_by_direction' => $order_by_direction,
'limit_results' => $limit_results
'limit_results' => $limit_results,
'filter' => $filter_form->html()
));
$grid->add_new_button('sms/show_unread', __('Show unread messages'));
......
$grid->order_field('id');
$grid->order_callback_field('sender_id')
->label(__('Sender'))
->label('Sender')
->callback('callback::sms_sender_field');
$grid->order_callback_field('sender_type')
->callback('callback::member_type_field');
$grid->order_callback_field('receiver_id')
->label(__('Receiver'))
->label('Receiver')
->callback('callback::sms_receiver_field');
$grid->order_callback_field('receiver_type')
......
if ($form_data['type_receiver'] == 'number')
{
$result[]->phone = $form_data['receiver_number'];
$result[0] = new stdClass();
$result[0]->phone = $form_data['receiver_number'];
}
else if ($form_data['type_receiver'] == 'subnet')
{
freenetis/branches/testing/application/controllers/email.php
$attachment = '<html><body>' .
'<h1>' . __('Bug report from') . ": . $url (file: $file, line: $line)</h1>" .
'<p>FreenetIS ' . __('version') . ': ' . $fn_version . '</p>' .
'<p>PHP ' . __('version') . ': ' . phpversion() . '</p>' .
'<p>' . __('Reported by') . ': ' . $uname . '</p>' .
'<p>' . __('Description') . ': ' . nl2br($description) . '</p>' .
'<h2>' . $error . '</h2>' .
......
'<div>' . htmlspecialchars_decode($trace) . '</div>' .
'</body></html>';
$attachment = text::cs_utf2ascii($attachment);
// Build recipient lists
$recipients = new Swift_RecipientList;
$recipients->addTo(DEVELOPER_EMAIL_ADDRESS);

Také k dispozici: Unified diff