Minor - format code.

1.9.x
Julio Montoya 11 years ago
parent 71b1a6f6ac
commit cda0b5fa15
  1. 4
      main/inc/lib/model.lib.php
  2. 26
      main/inc/lib/notebook.lib.php
  3. 29
      main/inc/lib/notification.lib.php

@ -9,8 +9,8 @@
* Class
* @package chamilo.library
*/
class Model {
class Model
{
public $table;
public $columns;
public $required;

@ -1,5 +1,4 @@
<?php
/* For licensing terms, see /license.txt */
/**
@ -8,10 +7,11 @@
* @author Carlos Vargas <litox84@gmail.com>, move code of main/notebook up here
* @package chamilo.library
*/
class NotebookManager {
class NotebookManager
{
private function __construct() {
private function __construct()
{
}
/**
@ -22,7 +22,8 @@ class NotebookManager {
* @author Patrick Cool <patrick.cool@ugent.be>, Ghent University, Belgium
* @version januari 2009, dokeos 1.8.6
*/
static function javascript_notebook() {
static function javascript_notebook()
{
return "<script>
function confirmation (name)
{
@ -44,7 +45,8 @@ class NotebookManager {
* @version januari 2009, dokeos 1.8.6
*
*/
static function save_note($values) {
static function save_note($values)
{
if (!is_array($values) or empty($values['note_title'])) {
return false;
}
@ -132,7 +134,8 @@ class NotebookManager {
}
}
static function delete_note($notebook_id) {
static function delete_note($notebook_id)
{
if (empty($notebook_id) or $notebook_id != strval(intval($notebook_id))) {
return false;
}
@ -152,7 +155,8 @@ class NotebookManager {
return true;
}
static function display_notes() {
static function display_notes()
{
global $_user;
if (!$_GET['direction']) {
@ -165,7 +169,7 @@ class NotebookManager {
$sort_direction = 'DESC';
$link_sort_direction = 'ASC';
}
// action links
echo '<div class="actions">';
if (!api_is_anonymous()) {
@ -223,6 +227,6 @@ class NotebookManager {
echo '<a href="' . api_get_self() . '?action=editnote&amp;notebook_id=' . $row['notebook_id'] . '">' . Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . '</a>';
echo '<a href="' . api_get_self() . '?action=deletenote&amp;notebook_id=' . $row['notebook_id'] . '" onclick="return confirmation(\'' . $row['title'] . '\');">' . Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>';
echo '</div>';
}
}
}
}
}

@ -47,6 +47,9 @@ class Notification extends Model
const NOTIFICATION_TYPE_INVITATION = 2;
const NOTIFICATION_TYPE_GROUP = 3;
/**
*
*/
public function __construct()
{
$this->table = Database::get_main_table(TABLE_NOTIFICATION);
@ -63,16 +66,23 @@ class Notification extends Model
/**
* Send the notifications
* @param int notification frecuency
* @param int notification frequency
*/
public function send($frec = 8)
public function send($frequency = 8)
{
$notifications = $this->find('all', array('where' => array('sent_at IS NULL AND send_freq = ?' => $frec)));
$notifications = $this->find('all', array('where' => array('sent_at IS NULL AND send_freq = ?' => $frequency)));
if (!empty($notifications)) {
foreach ($notifications as $item_to_send) {
// Sending email
api_mail_html($item_to_send['dest_mail'], $item_to_send['dest_mail'], Security::filter_terms($item_to_send['title']), Security::filter_terms($item_to_send['content']), $this->admin_name, $this->admin_email);
api_mail_html(
$item_to_send['dest_mail'],
$item_to_send['dest_mail'],
Security::filter_terms($item_to_send['title']),
Security::filter_terms($item_to_send['content']),
$this->admin_name,
$this->admin_email
);
if ($this->debug) {
error_log('Sending message to: '.$item_to_send['dest_mail']);
}
@ -104,15 +114,15 @@ class Notification extends Model
$avoid_my_self = false;
switch ($this->type) {
case self::NOTIFICATION_TYPE_MESSAGE;
case self::NOTIFICATION_TYPE_MESSAGE:
$setting_to_check = 'mail_notify_message';
$default_status = self::NOTIFY_MESSAGE_AT_ONCE;
break;
case self::NOTIFICATION_TYPE_INVITATION;
case self::NOTIFICATION_TYPE_INVITATION:
$setting_to_check = 'mail_notify_invitation';
$default_status = self::NOTIFY_INVITATION_AT_ONCE;
break;
case self::NOTIFICATION_TYPE_GROUP;
case self::NOTIFICATION_TYPE_GROUP:
$setting_to_check = 'mail_notify_group_message';
$default_status = self::NOTIFY_GROUP_AT_ONCE;
$avoid_my_self = true;
@ -178,8 +188,9 @@ class Notification extends Model
/**
* Formats the content in order to add the welcome message, the notification preference, etc
* @param string the content
* @param array result of api_get_user_info() or GroupPortalManager:get_group_data()
* @param string the content
* @param array result of api_get_user_info() or GroupPortalManager:get_group_data()
* @param string
* */
public function format_content($content, $sender_info)
{

Loading…
Cancel
Save