parent
bb4d82bb74
commit
c489ada431
@ -0,0 +1,15 @@ |
||||
<?php |
||||
/* For licensing terms, see /vendor/license.txt */ |
||||
|
||||
/** |
||||
* Kannel parameters that will be registered in the current settings |
||||
* |
||||
* @package chamilo.plugin.kannelsms |
||||
* @author Imanol Losada <imanol.losada@beeznest.com> |
||||
*/ |
||||
require_once __DIR__ . '/../../main/inc/global.inc.php'; |
||||
require_once api_get_path(LIBRARY_PATH).'plugin.class.php'; |
||||
|
||||
require_once 'lib/kannelsms.lib.php'; |
||||
require_once 'vendor/kannelsms_api.php'; |
||||
require_once 'lib/kannelsms_plugin.class.php'; |
@ -0,0 +1 @@ |
||||
<?php |
@ -0,0 +1,15 @@ |
||||
<?php |
||||
/* For licensing terms, see /vendor/license.txt */ |
||||
|
||||
/** |
||||
* This script is included by main/admin/settings.lib.php and generally |
||||
* includes things to execute in the main database (settings_current table) |
||||
* |
||||
* @package chamilo.plugin.kannelsms |
||||
* @author Imanol Losada <imanol.losada@beeznest.com> |
||||
*/ |
||||
/** |
||||
* Initialization |
||||
*/ |
||||
require_once dirname(__FILE__).'/config.php'; |
||||
KannelsmsPlugin::create()->install(); |
@ -0,0 +1,102 @@ |
||||
<?php |
||||
|
||||
$strings['plugin_title'] = "SMS Sending"; |
||||
$strings['plugin_comment'] = "When enabled and an email sent successfully, a text message is sent to the user."; |
||||
|
||||
$strings['api_key'] = "Kannel SMS key"; |
||||
$strings['api_key_help'] = "This is the Kannel SMS server security key. <a target='_blank' href='http://www.kannelsms.com/platforms/chamilo/'>Click here</a> to get it."; |
||||
|
||||
$strings['tool_enable'] = "Enable SMS sending"; |
||||
$strings['tool_enable_help'] = "Choose if you want to enable SMS sending tool. |
||||
Once enabled, they will be sent along with an email the selected SMS message types to the users who had filled their mobile phone number field in their profile<br />"; |
||||
|
||||
$strings['type'] = "Send SMS when"; |
||||
$strings['mobile_phone_number'] = "Mobile Phone (include country dialing code only)"; |
||||
|
||||
$strings['MessageWelcomeXLoginXPasswordX'] = "A user is added to the platform"; |
||||
$strings['MessageXNewFileSharedCourseXByX'] = "A file is added to dropbox"; |
||||
$strings['MessageXAccountApprovedConnectX'] = "An account is approved"; |
||||
$strings['MessageXNewCourseXBeenCreatedX'] = "A new course is created"; |
||||
$strings['MessageXNewUserXSubscribedCourseX'] = "A user is subscribed to a course"; |
||||
$strings['MessageXNewCourseSuggestedTeacherX'] = "A new course is suggested"; |
||||
$strings['MessageXCourseOpeningRequestCodeXRegistered'] = "A new course opening request is registered"; |
||||
$strings['MessageXCourseOpeningRequestCourseCodeXApproved'] = "A new course opening request is approved"; |
||||
$strings['MessageXRequestOpenCourseCodeXReject'] = "A new course opening request is rejected"; |
||||
$strings['MessageXCourseOpeningRequestCourseCodeX'] = "Additional information is required for a new course opening request"; |
||||
$strings['MessageXBeenSubscribedCourseX'] = "A user is added to the course but not registered to it yet"; |
||||
$strings['MessageXAssignmentBeenCreatedCourseX'] = "Homework is created"; |
||||
$strings['MessageXAccountCreatedUpdatedLoginXPasswordX'] = "A user account is created or updated"; |
||||
$strings['MessageXPasswordUpdatedLoginXPasswordX'] = "A user password is updated"; |
||||
$strings['MessageXRequestedPasswordChange'] = "A user requests a password change"; |
||||
$strings['MessageXReceivedNewPersonalMessages'] = "New personal messages are received in user's inbox or forum"; |
||||
$strings['MessageXNewUserXPendingApproval'] = "A new user registration is pending for approval"; |
||||
$strings['MessageXXPostedForumXCourseX'] = "A user posts in forum"; |
||||
$strings['MessageXXXCheckEmailConnectMoreInfo'] = "An announcement is sent"; |
||||
$strings['MessageXXStudentXAnsweredTestX'] = "A student solves an exercise"; |
||||
$strings['MessageXXStudentXAnsweredTestXOpenQuestion'] = "A student solves an open question"; |
||||
$strings['MessageXXStudentXAnsweredTestXVoiceQuestion'] = "A student solves a voice question"; |
||||
$strings['MessageXXAnswerOpenQuestionTestXReviewed'] = "An open question answer is reviewed"; |
||||
$strings['MessageXXNewThreadXStartedForumX'] = "A new thread is started in forum"; |
||||
$strings['MessageXXNewAnswerPostedXForumX'] = "A new answer is posted in forum"; |
||||
$strings['MessageXXNewSystemAnnouncementAdded'] = "A new system announcement is added and the user does not want to send a test email"; |
||||
$strings['MessageXTestXNewSystemAnnouncementAdded'] = "A new system announcement is added and the user wants to send a test email"; |
||||
$strings['MessageXXSystemAnnouncementUpdate'] = "A new system announcement is updated and the user does not want to send a test email"; |
||||
$strings['MessageXTestXSystemAnnouncementUpdate'] = "A new system announcement is updated and the user wants to send a test email"; |
||||
$strings['MessageXUserXUploadedAssignmentXCourseXStudentSubmitsPaper'] = "An assignment is uploaded and there is no current session (this will be sent only to coaches)"; |
||||
$strings['MessageXUserXUploadedAssignmentXCheckXStudentSubmitsPaper'] = "An assignment is uploaded (this will be sent only to teachers)"; |
||||
$strings['MessageXUserXUploadedAssignmentXCourseX'] = "... and there is no current session (this will be sent only to coaches)"; |
||||
$strings['MessageXUserXUploadedAssignmentXCheckX'] = "... (this will be sent only to teachers)"; |
||||
$strings['MessageXSubscribedSessionX'] = "A session is created or updated and new users are subscribed"; |
||||
$strings['MessageXSubscribedSessionXCSV'] = "New users are subscribed to a session importing a CSV file"; |
||||
$strings['MessageXUserXSuggestedBeFriends'] = "A friendship invitation is received"; |
||||
$strings['MessageXUserXAnsweredInboxMessage'] = "A message reply is received in inbox"; |
||||
$strings['MessageXBeenInvitedJoinGroupX'] = "A group join invitation is received"; |
||||
$strings['MessageXMessagesSentEditedGroupXEdited'] = "A group topic message is updated"; |
||||
$strings['MessageXMessagesSentEditedGroupXAdded'] = "A group topic message is added"; |
||||
$strings['MessageXBeenInvitedCompleteSurveyXCourseX'] = "A new survey is created"; |
||||
$strings['MessageXReminderAssignmentXCourseXDue'] = "A reminder is sent to students who have not uploaded their assignment yet"; |
||||
$strings['MessageXUserDetailsModified'] = "User details have been updated"; |
||||
|
||||
$strings['WelcomeXLoginXPasswordX'] = "Welcome to %s. Here are your user account details: login: %s, password: %s"; |
||||
$strings['XNewFileSharedCourseXByX'] = "%s: A new file has been shared with you in course %s by %s"; |
||||
$strings['XAccountApprovedConnectX'] = "%s: Your account has been approved by an administrator. You can now connect to %s"; |
||||
$strings['XNewCourseXBeenCreatedX'] = "%s: A new course (%s) has been created by %s"; |
||||
$strings['XNewUserXSubscribedCourseX'] = "%s: A new user (%s) has just subscribed to your course (%s)"; |
||||
$strings['XNewCourseSuggestedTeacherX'] = "%s: A new course has been suggested by teacher (%s). Please connect to the admin page to review it"; |
||||
$strings['XCourseOpeningRequestCodeXRegistered'] = "%s: Your course opening request (code %s) has been registered. You will be informed when it is approved"; |
||||
$strings['XCourseOpeningRequestCourseCodeXApproved'] = "%s: Your course opening request for course code %s has been approved. Connect to your portal to use it"; |
||||
$strings['XRequestOpenCourseCodeXReject'] = "%s: We are sorry to inform you that your request to open course code %s has been rejected"; |
||||
$strings['XCourseOpeningRequestCourseCodeX'] = "%s: Your course opening request for course code %s requires more information. Check e-mail for more info"; |
||||
$strings['XBeenSubscribedCourseX'] = "%s: You have been subscribed to course %s"; |
||||
$strings['XAssignmentBeenCreatedCourseX'] = "%s: A new assignment has been created in course %s. Please connect for more info"; |
||||
$strings['XAccountCreatedUpdatedLoginXPasswordX'] = "%s: Your account has been created or updated. You can now login as %s, password: %s"; |
||||
$strings['XPasswordUpdatedLoginXPasswordX'] = "%s: Your password has been updated. You can now login as %s, password: %s"; |
||||
$strings['XRequestedPasswordChange'] = "%s: You have requested a password change. Please check your e-mail for more information"; |
||||
$strings['XReceivedNewPersonalMessages'] = "%s: You have received new personal messages in your inbox or in the forum. Please check your e-mail for more info"; |
||||
$strings['XNewUserXPendingApproval'] = "%s: A new user (%s) registration is pending your approval. Please connect to the admin panel to review"; |
||||
$strings['XXPostedForumXCourseX'] = "%s: %s just posted on forum %s in course %s"; |
||||
$strings['XXXCheckEmailConnectMoreInfo'] = "%s: %s: %s. Check your e-mail or connect for more info"; |
||||
$strings['XXStudentXAnsweredTestX'] = "%s: %s: Student %s has just answered test %s"; |
||||
$strings['XXStudentXAnsweredTestXOpenQuestion'] = "%s: %s: Student %s answered test %s's open question. Please connect to review"; |
||||
$strings['XXStudentXAnsweredTestXVoiceQuestion'] = "%s: %s: Student %s answered test %s's voice question. Please connect to review"; |
||||
$strings['XXAnswerOpenQuestionTestXReviewed'] = "%s: %s: Your answer to an open question in test %s has been reviewed"; |
||||
$strings['XXNewThreadXStartedForumX'] = "%s: %s: A new thread (%s) has been started in forum %s"; |
||||
$strings['XXNewAnswerPostedXForumX'] = "%s: %s: A new answer has been posted to (%s) in forum %s"; |
||||
$strings['XXNewSystemAnnouncementAdded'] = "%s: %s"; |
||||
$strings['XTestXNewSystemAnnouncementAdded'] = "%s (test): %s"; |
||||
$strings['XXSystemAnnouncementUpdate'] = "%s: %s (update)"; |
||||
$strings['XTestXSystemAnnouncementUpdate'] = "%s (test): %s"; |
||||
$strings['XUserXUploadedAssignmentXCourseXStudentSubmitsPaper'] = "%s: User %s uploaded assignment %s in course %s"; |
||||
$strings['XUserXUploadedAssignmentXCheckXStudentSubmitsPaper'] = "%s: User %s uploaded assignment %s. Check %s"; |
||||
$strings['XUserXUploadedAssignmentXCourseX'] = "%s: User %s uploaded assignment %s in course %s"; |
||||
$strings['XUserXUploadedAssignmentXCheckX'] = "%s: User %s uploaded assignment %s. Check %s"; |
||||
$strings['XSubscribedSessionX'] = "%s: You have been subscribed to session %s"; |
||||
$strings['XSubscribedSessionXCSV'] = "%s: You have been subscribed to session %s"; |
||||
$strings['XUserXSuggestedBeFriends'] = "%s: User %s suggested you should be friends. Check your inbox or e-mail for details"; |
||||
$strings['XUserXAnsweredInboxMessage'] = "%s: User %s just answered your Inbox message"; |
||||
$strings['XBeenInvitedJoinGroupX'] = "%s: you have been invited to join group %s. Check your Inbox for details"; |
||||
$strings['XMessagesSentEditedGroupXEdited'] = "%s: Messages sent or edited in group %s. Check your Inbox for details"; |
||||
$strings['XMessagesSentEditedGroupXAdded'] = "%s: Messages sent or edited in group %s. Check your Inbox for details"; |
||||
$strings['XBeenInvitedCompleteSurveyXCourseX'] = "%s: You have been invited to complete survey %s in course %s"; |
||||
$strings['XReminderAssignmentXCourseXDue'] = "%s: This is a simple reminder that your assignment (%s) in course %s is still due"; |
||||
$strings['XUserDetailsModified'] = "%s: Your user details have been modified. Please check your e-mail for more information"; |
@ -0,0 +1,102 @@ |
||||
<?php |
||||
|
||||
$strings['plugin_title'] = "Envío de SMS"; |
||||
$strings['plugin_comment'] = "Ofrece la posibilidad de enviar SMS a celulares cuando se envían e-mails de notificación."; |
||||
|
||||
$strings['api_key'] = "Clave Kannel SMS"; |
||||
$strings['api_key_help'] = "Ésta es la clave de seguridad de su servidor Kannel SMS. Para obtenerla, <a target='_blank' href='http://www.kannelsms.com/platforms/chamilo/'>haga click aquí</a>"; |
||||
|
||||
$strings['tool_enable'] = "Activar envío de SMS"; |
||||
$strings['tool_enable_help'] = "Escoja si desea activar la herramienta de envío de mensajes a celulares Kannel SMS. |
||||
Una vez activada, se enviarán, simultaneamente con los correos, los tipos mensajes SMS seleccionados a los usuarios que hayan especificado un número de celular en su perfil.<br />"; |
||||
|
||||
$strings['sms_types'] = "Enviar un SMS cuando"; |
||||
$strings['mobile_phone_number'] = "Celular (incluya sólo el código de llamada del país)"; |
||||
|
||||
$strings['MessageWelcomeXLoginXPasswordX'] = "Se añada un usuario a la plataforma"; |
||||
$strings['MessageXNewFileSharedCourseXByX'] = "Un archivo se añada a dropbox"; |
||||
$strings['MessageXAccountApprovedConnectX'] = "Se apruebe una cuenta de usuario"; |
||||
$strings['MessageXNewCourseXBeenCreatedX'] = "Se cree un curso nuevo"; |
||||
$strings['MessageXNewUserXSubscribedCourseX'] = "Un usuario se suscriba a un curso"; |
||||
$strings['MessageXNewCourseSuggestedTeacherX'] = "Un profesor sugiera un curso nuevo"; |
||||
$strings['MessageXCourseOpeningRequestCodeXRegistered'] = "Se registre una solicitud de apertura de curso"; |
||||
$strings['MessageXCourseOpeningRequestCourseCodeXApproved'] = "Se apruebe una solicitud de apertura de curso"; |
||||
$strings['MessageXRequestOpenCourseCodeXReject'] = "Se rechace una solicitud de apertura de curso"; |
||||
$strings['MessageXCourseOpeningRequestCourseCodeX'] = "Se requiera más información de una solicitud de apertura de curso"; |
||||
$strings['MessageXBeenSubscribedCourseX'] = "Se le suscriba a un curso a un usuario que aún no está registrado"; |
||||
$strings['MessageXAssignmentBeenCreatedCourseX'] = "Se cree una nueva tarea en un curso"; |
||||
$strings['MessageXAccountCreatedUpdatedLoginXPasswordX'] = "Se cree o actualice una cuenta de usuario"; |
||||
$strings['MessageXPasswordUpdatedLoginXPasswordX'] = "Se actualice la contraseña de un usuario"; |
||||
$strings['MessageXRequestedPasswordChange'] = "Un usuario solicite un cambio de contraseña"; |
||||
$strings['MessageXReceivedNewPersonalMessages'] = "Se reciban mensajes personales nuevos en la bandeja de entrada o en el foro"; |
||||
$strings['MessageXNewUserXPendingApproval'] = "Una inscripción de un nuevo usuario esté pendiente de aprobación"; |
||||
$strings['MessageXXPostedForumXCourseX'] = "Un usuario escriba en el foro"; |
||||
$strings['MessageXXXCheckEmailConnectMoreInfo'] = "Se envíe una notificación"; |
||||
$strings['MessageXXStudentXAnsweredTestX'] = "Un estudiante resuelva un ejercicio de un examen"; |
||||
$strings['MessageXXStudentXAnsweredTestXOpenQuestion'] = "Un estudiante conteste a una pregunta abierta de un examen"; |
||||
$strings['MessageXXStudentXAnsweredTestXVoiceQuestion'] = "Un estudiante conteste a una pregunta de voz de un examen"; |
||||
$strings['MessageXXAnswerOpenQuestionTestXReviewed'] = "Se revise una pregunta abierta de un examen"; |
||||
$strings['MessageXXNewThreadXStartedForumX'] = "Se cree un hilo nuevo en el foro"; |
||||
$strings['MessageXXNewAnswerPostedXForumX'] = "Se escriba una respuesta nueva en el foro"; |
||||
$strings['MessageXXNewSystemAnnouncementAdded'] = "Se añada una notificación y el usuario no desee enviar un examen por correo electrónico"; |
||||
$strings['MessageXTestXNewSystemAnnouncementAdded'] = "Se añada una notificación y el usuario desee enviar un examen por correo electrónico"; |
||||
$strings['MessageXXSystemAnnouncementUpdate'] = "Se actualice una notificación y el usuario no desee enviar un examen por correo electrónico"; |
||||
$strings['MessageXTestXSystemAnnouncementUpdate'] = "Se actualice una notificación y el usuario desee enviar un examen por correo electrónico"; |
||||
$strings['MessageXUserXUploadedAssignmentXCourseXStudentSubmitsPaper'] = "Un estudiante suba su tarea y no exista una sesión (se enviará sólo a coordinadores)"; |
||||
$strings['MessageXUserXUploadedAssignmentXCheckXStudentSubmitsPaper'] = "Un estudiante suba su tarea (se enviará sólo a profesores)"; |
||||
$strings['MessageXUserXUploadedAssignmentXCourseX'] = "... y no exista una sesión (se enviará sólo a coordinadores)"; |
||||
$strings['MessageXUserXUploadedAssignmentXCheckX'] = "... (se enviará sólo a profesores)"; |
||||
$strings['MessageXSubscribedSessionX'] = "Se cree o edite una sesión nueva y se suscriban a usuarios nuevos"; |
||||
$strings['MessageXSubscribedSessionXCSV'] = "Se suscriban a usuarios nuevos desde un archivo CSV"; |
||||
$strings['MessageXUserXSuggestedBeFriends'] = "Se reciba una invitación de amistad"; |
||||
$strings['MessageXUserXAnsweredInboxMessage'] = "Se reciba la contestación a un mensaje en la bandeja de entrada"; |
||||
$strings['MessageXBeenInvitedJoinGroupX'] = "Se reciba una invitación para unirse a un grupo"; |
||||
$strings['MessageXMessagesSentEditedGroupXEdited'] = "Se actualice un mensaje en un tema de grupo"; |
||||
$strings['MessageXMessagesSentEditedGroupXAdded'] = "Se añada un mensaje en un tema de grupo"; |
||||
$strings['MessageXBeenInvitedCompleteSurveyXCourseX'] = "Se cree una encuesta nueva"; |
||||
$strings['MessageXReminderAssignmentXCourseXDue'] = "Se envíe un recordatorio a los estudiantes que no hayan enviado su tarea"; |
||||
$strings['MessageXUserDetailsModified'] = "Se actualice información de un usuario"; |
||||
|
||||
$strings['WelcomeXLoginXPasswordX'] = "Bienvenido a %s. Éstos son sus datos de acceso: usuario: %s, contraseña: %s"; |
||||
$strings['XNewFileSharedCourseXByX'] = "%s: Un nuevo archivo ha sido compartido contigo en el curso %s por %s"; |
||||
$strings['XAccountApprovedConnectX'] = "%s: Su cuenta ha sido aprobada por un administrador. Ya puede conectarse a %s"; |
||||
$strings['XNewCourseXBeenCreatedX'] = "%s: Un nuevo curso (%s) ha sido creado por %s"; |
||||
$strings['XNewUserXSubscribedCourseX'] = "%s: Un nuevo usuario (%s) se ha suscrito a su curso (%s)"; |
||||
$strings['XNewCourseSuggestedTeacherX'] = "%s: Un nuevo curso ha sido sugerido por el profesor (%s). Por favor, conéctese a la página de administración para revisarlo"; |
||||
$strings['XCourseOpeningRequestCodeXRegistered'] = "%s: Su solicitud de apertura de curso (código %s) ha sido registrada. Será informado cuando ésta sea aprobada"; |
||||
$strings['XCourseOpeningRequestCourseCodeXApproved'] = "%s: Su solicitud de apertura de curso para el código de curso %s ha sido aprobada. Conéctese a su portal para usarlo"; |
||||
$strings['XRequestOpenCourseCodeXReject'] = "%s: Lamentamos informarle que su solicitud de apertura de curso para el código de curso %s ha sido rechazada"; |
||||
$strings['XCourseOpeningRequestCourseCodeX'] = "%s: Su solicitud de apertura de curso para el código de curso %s requiere más información. Compruebe su e-mail para más información"; |
||||
$strings['XBeenSubscribedCourseX'] = "%s: Ha sido suscrito al curso %s"; |
||||
$strings['XAssignmentBeenCreatedCourseX'] = "%s: Una nueva tarea ha sido creada en el curso %s. Por favor, conéctese para más información"; |
||||
$strings['XAccountCreatedUpdatedLoginXPasswordX'] = "%s: Su cuenta ha sido creada o actualizada. Ya puede conectarse como %s, contraseña: %s"; |
||||
$strings['XPasswordUpdatedLoginXPasswordX'] = "%s: Su contraseña ha sido actualizada. Ya puede conectarse como %s, contraseña: %s"; |
||||
$strings['XRequestedPasswordChange'] = "%s: Ha solicitado un cambio de contraseña. Por favor, compruebe su e-mail para más información"; |
||||
$strings['XReceivedNewPersonalMessages'] = "%s: Ha recibido mensajes personales nuevos en su bandeja de entrada o en el foro. Por favor, compruebe su e-mail para más información"; |
||||
$strings['XNewUserXPendingApproval'] = "%s: Una inscripción de un nuevo usuario (%s) está pendiente de su aprobación. Por favor, conéctese al panel de administración para revisarla"; |
||||
$strings['XXPostedForumXCourseX'] = "%s: %s acaba de escribir en el foro %s del curso %s"; |
||||
$strings['XXXCheckEmailConnectMoreInfo'] = "%s: %s: %s. Compruebe su e-mail o conéctese para más información"; |
||||
$strings['XXStudentXAnsweredTestX'] = "%s: %s: El estudiante %s acaba de contestar al test %s"; |
||||
$strings['XXStudentXAnsweredTestXOpenQuestion'] = "%s: %s: El estudiante %s contestó a la pregunta abierta del test %s. Por favor, conéctese para revisarla"; |
||||
$strings['XXStudentXAnsweredTestXVoiceQuestion'] = "%s: %s: El estudiante %s contestó a la pregunta de voz del test %s. Por favor, conéctese para revisarla"; |
||||
$strings['XXAnswerOpenQuestionTestXReviewed'] = "%s: %s: Su respuesta a la pregunta abierta en el test %s ha sido revisada."; |
||||
$strings['XXNewThreadXStartedForumX'] = "%s: %s: Se ha comenzado un nuevo hilo (%s) en el foro %s"; |
||||
$strings['XXNewAnswerPostedXForumX'] = "%s: %s: Se ha escrito una nueva respuesta a (%s) en el foro %s"; |
||||
$strings['XXNewSystemAnnouncementAdded'] = "%s: %s"; |
||||
$strings['XTestXNewSystemAnnouncementAdded'] = "%s (prueba): %s"; |
||||
$strings['XXSystemAnnouncementUpdate'] = "%s: %s (actualización)"; |
||||
$strings['XTestXSystemAnnouncementUpdate'] = "%s (prueba): %s"; |
||||
$strings['XUserXUploadedAssignmentXCourseXStudentSubmitsPaper'] = "%s: El usuario %s subió la tarea %s al curso %s"; |
||||
$strings['XUserXUploadedAssignmentXCheckXStudentSubmitsPaper'] = "%s: El usuario %s subió la tarea %s. Compruébelo en %s"; |
||||
$strings['XUserXUploadedAssignmentXCourseX'] = "%s: El usuario %s subió la tarea %s al curso %s"; |
||||
$strings['XUserXUploadedAssignmentXCheckX'] = "%s: El usuario %s subió la tarea %s. Compruébelo en %s"; |
||||
$strings['XSubscribedSessionX'] = "%s: Ha sido suscrito a la sesión %s"; |
||||
$strings['XSubscribedSessionXCSV'] = "%s: Ha sido suscrito a la sesión %s"; |
||||
$strings['XUserXSuggestedBeFriends'] = "%s: El usuario %s le sugirió que podrían ser amigos. Compruebe su bandeja de entrada o su e-mail para más detalles"; |
||||
$strings['XUserXAnsweredInboxMessage'] = "%s: El usuario acaba de contestar a su mensaje de la bandeja de entrada"; |
||||
$strings['XBeenInvitedJoinGroupX'] = "%s: Ha sido invitado a unirse al grupo %s. Compruebe su bandeja de entrada para más detalles"; |
||||
$strings['XMessagesSentEditedGroupXEdited'] = "%s: Hay mensajes enviados o editados en el grupo %s. Compruebe su bandeja de entrada para más detalles"; |
||||
$strings['XMessagesSentEditedGroupXAdded'] = "%s: Hay mensajes enviados o editados en el grupo %s. Compruebe su bandeja de entrada para más detalles"; |
||||
$strings['XBeenInvitedCompleteSurveyXCourseX'] = "%s: Ha sido invitado a completar la encuesta %s del curso %s"; |
||||
$strings['XReminderAssignmentXCourseXDue'] = "%s: Se le recuerda que su tarea (%s) del curso %s aún está pendiente"; |
||||
$strings['XUserDetailsModified'] = "%s: Su información de usuario ha sido modificada. Compruebe su e-mail para más información"; |
@ -0,0 +1,665 @@ |
||||
<?php |
||||
/* For licensing terms, see /vendor/license.txt */ |
||||
|
||||
/** |
||||
* Class Kannelsms |
||||
* This script handles incoming SMS information, process it and sends an SMS if everything is right |
||||
* |
||||
* @package chamilo.plugin.kannelsms.lib |
||||
* @author Imanol Losada <imanol.losada@beeznest.com> |
||||
* |
||||
* Kannelsms-Chamilo connector class |
||||
*/ |
||||
|
||||
class Kannelsms |
||||
{ |
||||
public $apiKey; |
||||
public $api; |
||||
public $plugin_enabled = false; |
||||
|
||||
/** |
||||
* Constructor (generates a connection to the API) |
||||
* @param string Kannelsms API key required to use the plugin |
||||
* @return void |
||||
*/ |
||||
public function __construct($apiKey = null) |
||||
{ |
||||
$plugin = KannelsmsPlugin::create(); |
||||
$kannelSMSPlugin = $plugin->get('tool_enable'); |
||||
if (empty($apiKey)) { |
||||
$kannelSMSApiKey = $plugin->get('api_key'); |
||||
} else { |
||||
$kannelSMSApiKey = $apiKey; |
||||
} |
||||
$this->table = Database::get_main_table('user_field_values'); |
||||
if ($kannelSMSPlugin == true) { |
||||
$this->apiKey = $kannelSMSApiKey; |
||||
// Setting Kannelsms api |
||||
define('CONFIG_SECURITY_API_KEY', $this->apiKey); |
||||
$trimmedApiKey = trim(CONFIG_SECURITY_API_KEY); |
||||
if (!empty($trimmedApiKey)) { |
||||
$this->api = new Kannel(CONFIG_SECURITY_API_KEY); |
||||
} else { |
||||
$this->api = new Kannel(' '); |
||||
$recipient_name = api_get_person_name( |
||||
api_get_setting('administratorName'), |
||||
api_get_setting('administratorSurname'), |
||||
null, |
||||
PERSON_NAME_EMAIL_ADDRESS |
||||
); |
||||
$email_form = get_setting('emailAdministrator'); |
||||
$emailsubject = 'Kannelsms error'; |
||||
$emailbody = 'Key cannot be blank'; |
||||
$sender_name = $recipient_name; |
||||
$email_admin = $email_form; |
||||
api_mail_html($recipient_name, $email_form, $emailsubject, $emailbody, $sender_name, $email_admin); |
||||
} |
||||
$this->plugin_enabled = true; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* getMobilePhoneNumberById (retrieves a user mobile phone number by user id) |
||||
* @param int User id |
||||
* @return int User's mobile phone number |
||||
*/ |
||||
private function getMobilePhoneNumberById($userId) |
||||
{ |
||||
require_once api_get_path(LIBRARY_PATH).'extra_field.lib.php'; |
||||
require_once api_get_path(LIBRARY_PATH).'extra_field_value.lib.php'; |
||||
|
||||
$mobilePhoneNumberExtraField = new ExtraField('user'); |
||||
$mobilePhoneNumberExtraField = $mobilePhoneNumberExtraField->get_handler_field_info_by_field_variable('mobile_phone_number'); |
||||
|
||||
$mobilePhoneNumberExtraFieldValue = new ExtraFieldValue('user'); |
||||
$mobilePhoneNumberExtraFieldValue = $mobilePhoneNumberExtraFieldValue->get_values_by_handler_and_field_id($userId, $mobilePhoneNumberExtraField['id']); |
||||
|
||||
return $mobilePhoneNumberExtraFieldValue['field_value']; |
||||
} |
||||
|
||||
/** |
||||
* send (sends an SMS to the user) |
||||
* @param array Data needed to send the SMS. It is mandatory to include the |
||||
* 'smsType' and 'userId' (or 'mobilePhoneNumber') fields at least. |
||||
* More data may be neccesary depending on the message type |
||||
* Example: $additional_parameters = array( |
||||
* 'smsType' => EXAMPLE_SMS_TYPE, |
||||
* 'userId' => $userId, |
||||
* 'moreData' => $moreData |
||||
* ); |
||||
* @return void |
||||
*/ |
||||
public function send($additionalParameters) |
||||
{ |
||||
$trimmedKey = trim(CONFIG_SECURITY_API_KEY); |
||||
if (!empty($trimmedKey)) { |
||||
$message = array( |
||||
"to" => array_key_exists("mobilePhoneNumber",$additionalParameters) ? |
||||
$additionalParameters['mobilePhoneNumber'] : |
||||
$this->getMobilePhoneNumberById($additionalParameters['userId']), |
||||
"message" => $this->getSms($additionalParameters) |
||||
); |
||||
|
||||
if (!empty($message['message'])) { |
||||
$result = $this->api->send($message); |
||||
|
||||
// Commented for future message logging / tracking purposes |
||||
/*if( $result["success"] ) { |
||||
echo "Message sent - ID: " . $result["id"]; |
||||
} else { |
||||
echo "Message failed - Error: " . $result["error_message"]; |
||||
}*/ |
||||
} |
||||
|
||||
} |
||||
} |
||||
|
||||
/** |
||||
* buildSms (builds an SMS from a template and data) |
||||
* @param object KannelsmsPlugin object |
||||
* @param object Template object |
||||
* @param string Template file name |
||||
* @param string Text key from lang file |
||||
* @param array Data to fill message variables (if any) |
||||
* @return object Template object with message property updated |
||||
*/ |
||||
public function buildSms($plugin, $tpl, $templateName, $messageKey, $parameters = null) |
||||
{ |
||||
$result = Database::select( |
||||
'selected_value', |
||||
'settings_current', |
||||
array( |
||||
'where'=> array('variable = ?' => array('kannelsms_message'.$messageKey)) |
||||
) |
||||
); |
||||
|
||||
if (empty($result)) { |
||||
$tpl->assign('message', ''); |
||||
} else { |
||||
$templatePath = 'kannelsms/sms_templates/'; |
||||
$content = $tpl->fetch($templatePath.$templateName); |
||||
$message = $plugin->get_lang($messageKey); |
||||
if ($parameters !== null) { |
||||
$message = vsprintf($message, $parameters); |
||||
} |
||||
$tpl->assign('message', $message); |
||||
} |
||||
|
||||
return $tpl->params['message']; |
||||
} |
||||
|
||||
/** |
||||
* getSms (returns an SMS message depending of its type) |
||||
* @param array Data needed to send the SMS. It is mandatory to include the |
||||
* 'smsType' and 'userId' (or 'mobilePhoneNumber') fields at least. |
||||
* More data may be neccesary depending on the message type |
||||
* Example: $additional_parameters = array( |
||||
* 'smsType' => EXAMPLE_SMS_TYPE, |
||||
* 'userId' => $userId, |
||||
* 'moreData' => $moreData |
||||
* ); |
||||
* @return string A ready to be sent SMS |
||||
*/ |
||||
public function getSms($additionalParameters) |
||||
{ |
||||
$plugin = KannelsmsPlugin::create(); |
||||
$tool_name = $plugin->get_lang('plugin_title'); |
||||
$tpl = new Template($tool_name); |
||||
|
||||
switch (constant('KannelsmsPlugin::'.$additionalParameters['smsType'])) { |
||||
case KannelsmsPlugin::WELCOME_LOGIN_PASSWORD: |
||||
$userInfo = api_get_user_info($additionalParameters['userId']); |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'welcome_login_password.tpl', |
||||
'WelcomeXLoginXPasswordX', |
||||
array( |
||||
api_get_setting('siteName'), |
||||
$userInfo['username'], |
||||
$additionalParameters['password'] |
||||
) |
||||
); |
||||
break; |
||||
case KannelsmsPlugin::NEW_FILE_SHARED_COURSE_BY: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'new_file_shared_course_by.tpl', |
||||
'XNewFileSharedCourseXByX', |
||||
array( |
||||
api_get_setting('siteName'), |
||||
$additionalParameters['courseTitle'], |
||||
$additionalParameters['userUsername'] |
||||
) |
||||
); |
||||
break; |
||||
case KannelsmsPlugin::ACCOUNT_APPROVED_CONNECT: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'account_approved_connect.tpl', |
||||
'XAccountApprovedConnectX', |
||||
array( |
||||
api_get_setting('siteName'), |
||||
$tpl->params['_p']['web'] |
||||
) |
||||
); |
||||
break; |
||||
case KannelsmsPlugin::NEW_COURSE_BEEN_CREATED: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'new_course_been_created.tpl', |
||||
'XNewCourseXBeenCreatedX', |
||||
array( |
||||
api_get_setting('siteName'), |
||||
$additionalParameters['courseName'], |
||||
$additionalParameters['creatorUsername'] |
||||
) |
||||
); |
||||
break; |
||||
case KannelsmsPlugin::NEW_USER_SUBSCRIBED_COURSE: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'new_user_subscribed_course.tpl', |
||||
'XNewUserXSubscribedCourseX', |
||||
array( |
||||
api_get_setting('siteName'), |
||||
$additionalParameters['userUsername'], |
||||
$additionalParameters['courseCode'] |
||||
) |
||||
); |
||||
break; |
||||
case KannelsmsPlugin::NEW_COURSE_SUGGESTED_TEACHER: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'new_course_suggested_teacher.tpl', |
||||
'XNewCourseSuggestedTeacherX', |
||||
array( |
||||
api_get_setting('siteName'), |
||||
$additionalParameters['userUsername'] |
||||
) |
||||
); |
||||
break; |
||||
case KannelsmsPlugin::COURSE_OPENING_REQUEST_CODE_REGISTERED: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'course_opening_request_code_registered.tpl', |
||||
'XCourseOpeningRequestCodeXRegistered', |
||||
array( |
||||
api_get_setting('siteName'), |
||||
$additionalParameters['courseCode'] |
||||
) |
||||
); |
||||
break; |
||||
case KannelsmsPlugin::COURSE_OPENING_REQUEST_CODE_APPROVED: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'course_opening_request_course_code_approved.tpl', |
||||
'XCourseOpeningRequestCourseCodeXApproved', |
||||
array( |
||||
api_get_setting('siteName'), |
||||
$additionalParameters['courseCode'] |
||||
) |
||||
); |
||||
break; |
||||
case KannelsmsPlugin::COURSE_OPENING_REQUEST_CODE_REJECTED: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'request_open_course_code_rejected.tpl', |
||||
'XRequestOpenCourseCodeXReject', |
||||
array( |
||||
api_get_setting('siteName'), |
||||
$additionalParameters['courseCode'] |
||||
) |
||||
); |
||||
break; |
||||
case KannelsmsPlugin::COURSE_OPENING_REQUEST_CODE: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'course_opening_request_course_code.tpl', |
||||
'XCourseOpeningRequestCourseCodeX', |
||||
array( |
||||
api_get_setting('siteName'), |
||||
$additionalParameters['courseCode'] |
||||
) |
||||
); |
||||
break; |
||||
case KannelsmsPlugin::BEEN_SUBSCRIBED_COURSE: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'been_subscribed_course.tpl', |
||||
'XBeenSubscribedCourseX', |
||||
array( |
||||
api_get_setting('siteName'), |
||||
$additionalParameters['courseTitle'] |
||||
) |
||||
); |
||||
break; |
||||
case KannelsmsPlugin::ASSIGNMENT_BEEN_CREATED_COURSE: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'assignment_been_created_course.tpl', |
||||
'XAssignmentBeenCreatedCourseX', |
||||
array( |
||||
api_get_setting('siteName'), |
||||
$additionalParameters['courseTitle'] |
||||
) |
||||
); |
||||
break; |
||||
// Message types to be implemented. Fill the array parameter with arguments. |
||||
/*case KannelsmsPlugin::ACCOUNT_CREATED_UPDATED_LOGIN_PASSWORD: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'account_created_updated_login_password.tpl', |
||||
'XAccountCreatedUpdatedLoginXPasswordX', |
||||
array( |
||||
api_get_setting('siteName') |
||||
) |
||||
); |
||||
break;*/ |
||||
/*case KannelsmsPlugin::PASSWORD_UPDATED_LOGIN_PASSWORD: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'password_updated_login_password.tpl', |
||||
'XPasswordUpdatedLoginXPasswordX', |
||||
array( |
||||
api_get_setting('siteName') |
||||
) |
||||
); |
||||
break;*/ |
||||
/*case KannelsmsPlugin::REQUESTED_PASSWORD_CHANGE: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'requested_password_change.tpl', |
||||
'XPasswordUpdatedLoginXPasswordX', |
||||
array( |
||||
api_get_setting('siteName') |
||||
) |
||||
); |
||||
break;*/ |
||||
/*case KannelsmsPlugin::RECEIVED_NEW_PERSONAL_MESSAGES: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'received_new_personal_messages.tpl', |
||||
'XReceivedNewPersonalMessages', |
||||
array( |
||||
api_get_setting('siteName') |
||||
) |
||||
); |
||||
break;*/ |
||||
/*case KannelsmsPlugin::NEW_USER_PENDING_APPROVAL: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'new_user_pending_approval.tpl', |
||||
'XNewUserXPendingApproval', |
||||
array( |
||||
api_get_setting('siteName') |
||||
) |
||||
); |
||||
break;*/ |
||||
/*case KannelsmsPlugin::POSTED_FORUM_COURSE: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'posted_forum_course.tpl', |
||||
'XXPostedForumXCourseX', |
||||
array( |
||||
api_get_setting('siteName') |
||||
) |
||||
); |
||||
break;*/ |
||||
/*case KannelsmsPlugin::CHECK_EMAIL_CONNECT_MORE_INFO: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'check_email_connect_more_info.tpl', |
||||
'XXXCheckEmailConnectMoreInfo', |
||||
array( |
||||
api_get_setting('siteName') |
||||
) |
||||
); |
||||
break;*/ |
||||
/*case KannelsmsPlugin::STUDENT_ANSWERED_TEST: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'student_answered_test.tpl', |
||||
'XXStudentXAnsweredTestX', |
||||
array( |
||||
api_get_setting('siteName') |
||||
) |
||||
); |
||||
break;*/ |
||||
/*case KannelsmsPlugin::STUDENT_ANSWERED_TEST_OPEN_QUESTION: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'student_answered_test_open_question.tpl', |
||||
'XXStudentXAnsweredTestXOpenQuestion', |
||||
array( |
||||
api_get_setting('siteName') |
||||
) |
||||
); |
||||
break;*/ |
||||
/*case KannelsmsPlugin::STUDENT_ANSWERED_TEST_VOICE_QUESTION: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'student_answered_test_voice_question.tpl', |
||||
'XXStudentXAnsweredTestXVoiceQuestion', |
||||
array( |
||||
api_get_setting('siteName') |
||||
) |
||||
); |
||||
break;*/ |
||||
/*case KannelsmsPlugin::ANSWER_OPEN_QUESTION_TEST_REVIEWED: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'answer_open_question_test_reviewed.tpl', |
||||
'XXAnswerOpenQuestionTestXReviewed', |
||||
array( |
||||
api_get_setting('siteName') |
||||
) |
||||
); |
||||
break;*/ |
||||
/*case KannelsmsPlugin::NEW_THREAD_STARTED_FORUM: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'new_thread_started_forum.tpl', |
||||
'XXNewThreadXStartedForumX', |
||||
array( |
||||
api_get_setting('siteName') |
||||
) |
||||
); |
||||
break;*/ |
||||
/*case KannelsmsPlugin::NEW_ANSWER_POSTED_FORUM: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'new_answer_posted_forum.tpl', |
||||
'XXNewAnswerPostedXForumX', |
||||
array( |
||||
api_get_setting('siteName') |
||||
) |
||||
); |
||||
break;*/ |
||||
/*case KannelsmsPlugin::NEW_SYSTEM_ANNOUNCEMENT_ADDED: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'new_system_announcement_added.tpl', |
||||
'XXNewSystemAnnouncementAdded', |
||||
array( |
||||
api_get_setting('siteName') |
||||
) |
||||
); |
||||
break;*/ |
||||
/*case KannelsmsPlugin::TEST_NEW_SYSTEM_ANNOUNCEMENT_ADDED: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'test_new_system_announcement_added.tpl', |
||||
'XTestXNewSystemAnnouncementAdded', |
||||
array( |
||||
api_get_setting('siteName') |
||||
) |
||||
); |
||||
break;*/ |
||||
/*case KannelsmsPlugin::SYSTEM_ANNOUNCEMENT_UPDATE: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'system_announcement_update.tpl', |
||||
'XXSystemAnnouncementUpdate', |
||||
array( |
||||
api_get_setting('siteName') |
||||
) |
||||
); |
||||
break;*/ |
||||
/*case KannelsmsPlugin::TEST_SYSTEM_ANNOUNCEMENT_UPDATE: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'test_system_announcement_update.tpl', |
||||
'XXSystemAnnouncementUpdate', |
||||
array( |
||||
api_get_setting('siteName') |
||||
) |
||||
); |
||||
break;*/ |
||||
/*case KannelsmsPlugin::USER_UPLOADED_ASSIGNMENT_COURSE_STUDENT_SUBMITS_PAPER: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'user_uploaded_assignment_course_student_submits_paper.tpl', |
||||
'XUserXUploadedAssignmentXCourseXStudentSubmitsPaper', |
||||
array( |
||||
api_get_setting('siteName') |
||||
) |
||||
); |
||||
break;*/ |
||||
/*case KannelsmsPlugin::USER_UPLOADED_ASSIGNMENT_CHECK_STUDENT_SUBMITS_PAPER: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'user_uploaded_assignment_check_student_submits_paper.tpl', |
||||
'XUserXUploadedAssignmentXCheckXStudentSubmitsPaper', |
||||
array( |
||||
api_get_setting('siteName') |
||||
) |
||||
); |
||||
break;*/ |
||||
/*case KannelsmsPlugin::USER_UPLOADED_ASSIGNMENT_COURSE: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'user_uploaded_assignment_course.tpl', |
||||
'XUserXUploadedAssignmentXCourseX', |
||||
array( |
||||
api_get_setting('siteName') |
||||
) |
||||
); |
||||
break;*/ |
||||
/*case KannelsmsPlugin::USER_UPLOADED_ASSIGNMENT_CHECK: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'user_uploaded_assignment_check.tpl', |
||||
'XUserXUploadedAssignmentXCheckX', |
||||
array( |
||||
api_get_setting('siteName') |
||||
) |
||||
); |
||||
break;*/ |
||||
/*case KannelsmsPlugin::SUBSCRIBED_SESSION: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'subscribed_session.tpl', |
||||
'XSubscribedSessionX', |
||||
array( |
||||
api_get_setting('siteName') |
||||
) |
||||
); |
||||
break;*/ |
||||
/*case KannelsmsPlugin::SUBSCRIBED_SESSION_CSV: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'subscribed_session_csv.tpl', |
||||
'XSubscribedSessionXCSV', |
||||
array( |
||||
api_get_setting('siteName') |
||||
) |
||||
); |
||||
break;*/ |
||||
/*case KannelsmsPlugin::USER_SUGGESTED_BE_FRIENDS: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'user_suggested_be_friends.tpl', |
||||
'XUserXSuggestedBeFriends', |
||||
array( |
||||
api_get_setting('siteName') |
||||
) |
||||
); |
||||
break;*/ |
||||
/*case KannelsmsPlugin::USER_ANSWERED_INBOX_MESSAGE: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'user_answered_inbox_message.tpl', |
||||
'XUserXAnsweredInboxMessage', |
||||
array( |
||||
api_get_setting('siteName') |
||||
) |
||||
); |
||||
break;*/ |
||||
/*case KannelsmsPlugin::BEEN_INVITED_JOIN_GROUP: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'been_invited_join_group.tpl', |
||||
'XBeenInvitedJoinGroupX', |
||||
array( |
||||
api_get_setting('siteName') |
||||
) |
||||
); |
||||
break;*/ |
||||
/*case KannelsmsPlugin::MESSAGES_SENT_EDITED_GROUP_EDITED: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'messages_sent_edited_group_edited.tpl', |
||||
'XMessagesSentEditedGroupXEdited', |
||||
array( |
||||
api_get_setting('siteName') |
||||
) |
||||
); |
||||
break;*/ |
||||
/*case KannelsmsPlugin::MESSAGES_SENT_EDITED_GROUP_ADDED: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'messages_sent_edited_group_added.tpl', |
||||
'XMessagesSentEditedGroupXAdded', |
||||
array( |
||||
api_get_setting('siteName') |
||||
) |
||||
); |
||||
break;*/ |
||||
/*case KannelsmsPlugin::BEEN_INVITED_COMPLETE_SURVEY_COURSE: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'been_invited_complete_survey_course.tpl', |
||||
'XBeenInvitedCompleteSurveyXCourseX', |
||||
array( |
||||
api_get_setting('siteName') |
||||
) |
||||
); |
||||
break;*/ |
||||
/*case KannelsmsPlugin::REMINDER_ASSIGNMENT_COURSE_DUE: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'reminder_assignment_course_due.tpl', |
||||
'XReminderAssignmentXCourseXDue', |
||||
array( |
||||
api_get_setting('siteName') |
||||
) |
||||
); |
||||
break;*/ |
||||
/*case KannelsmsPlugin::USER_DETAILS_MODIFIED: |
||||
return $this->buildSms( |
||||
$plugin, |
||||
$tpl, |
||||
'user_details_modified.tpl', |
||||
'XUserDetailsModified', |
||||
array( |
||||
api_get_setting('siteName') |
||||
) |
||||
); |
||||
break;*/ |
||||
default: |
||||
return ''; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,180 @@ |
||||
<?php |
||||
/* For licensing terms, see /vendor/license.txt */ |
||||
|
||||
/** |
||||
* Class KannelsmsPlugin |
||||
* This script contains SMS type constants and basic plugin functions |
||||
* |
||||
* @package chamilo.plugin.kannelsms.lib |
||||
* @author Imanol Losada <imanol.losada@beeznest.com> |
||||
*/ |
||||
class KannelsmsPlugin extends Plugin |
||||
{ |
||||
const WELCOME_LOGIN_PASSWORD = 0; |
||||
const NEW_FILE_SHARED_COURSE_BY = 1; |
||||
const ACCOUNT_APPROVED_CONNECT = 2; |
||||
const NEW_COURSE_BEEN_CREATED = 3; |
||||
const NEW_USER_SUBSCRIBED_COURSE = 4; |
||||
const NEW_COURSE_SUGGESTED_TEACHER = 5; |
||||
const COURSE_OPENING_REQUEST_CODE_REGISTERED = 6; |
||||
const COURSE_OPENING_REQUEST_CODE_APPROVED = 7; |
||||
const COURSE_OPENING_REQUEST_CODE_REJECTED = 8; |
||||
const COURSE_OPENING_REQUEST_CODE = 9; |
||||
const BEEN_SUBSCRIBED_COURSE = 10; |
||||
const ASSIGNMENT_BEEN_CREATED_COURSE = 11; |
||||
const ACCOUNT_CREATED_UPDATED_LOGIN_PASSWORD = 12; |
||||
const PASSWORD_UPDATED_LOGIN_PASSWORD = 13; |
||||
const REQUESTED_PASSWORD_CHANGE = 14; |
||||
const RECEIVED_NEW_PERSONAL_MESSAGES = 15; |
||||
const NEW_USER_PENDING_APPROVAL = 16; |
||||
const POSTED_FORUM_COURSE = 17; |
||||
const CHECK_EMAIL_CONNECT_MORE_INFO = 18; |
||||
const STUDENT_ANSWERED_TEST = 19; |
||||
const STUDENT_ANSWERED_TEST_OPEN_QUESTION = 20; |
||||
const STUDENT_ANSWERED_TEST_VOICE_QUESTION = 21; |
||||
const ANSWER_OPEN_QUESTION_TEST_REVIEWED = 22; |
||||
const NEW_THREAD_STARTED_FORUM = 23; |
||||
const NEW_ANSWER_POSTED_FORUM = 24; |
||||
const NEW_SYSTEM_ANNOUNCEMENT_ADDED = 25; |
||||
const TEST_NEW_SYSTEM_ANNOUNCEMENT_ADDED = 26; |
||||
const SYSTEM_ANNOUNCEMENT_UPDATE = 27; |
||||
const TEST_SYSTEM_ANNOUNCEMENT_UPDATE = 28; |
||||
const USER_UPLOADED_ASSIGNMENT_COURSE_STUDENT_SUBMITS_PAPER = 29; |
||||
const USER_UPLOADED_ASSIGNMENT_CHECK_STUDENT_SUBMITS_PAPER = 30; |
||||
const USER_UPLOADED_ASSIGNMENT_COURSE = 31; |
||||
const USER_UPLOADED_ASSIGNMENT_CHECK = 32; |
||||
const SUBSCRIBED_SESSION = 33; |
||||
const SUBSCRIBED_SESSION_CSV = 34; |
||||
const USER_SUGGESTED_BE_FRIENDS = 35; |
||||
const USER_ANSWERED_INBOX_MESSAGE = 36; |
||||
const BEEN_INVITED_JOIN_GROUP = 37; |
||||
const MESSAGES_SENT_EDITED_GROUP_EDITED = 38; |
||||
const MESSAGES_SENT_EDITED_GROUP_ADDED = 39; |
||||
const BEEN_INVITED_COMPLETE_SURVEY_COURSE = 40; |
||||
const REMINDER_ASSIGNMENT_COURSE_DUE = 41; |
||||
const USER_DETAILS_MODIFIED = 42; |
||||
|
||||
public $isCoursePlugin = true; |
||||
public $isMailPlugin = true; |
||||
|
||||
/** |
||||
* create (a singleton function that ensures KannelsmsPlugin instance is |
||||
* created only once. If it is already created, it returns the instance) |
||||
* @return object KannelsmsPlugin instance |
||||
*/ |
||||
public static function create() |
||||
{ |
||||
static $result = null; |
||||
return $result ? $result : $result = new self(); |
||||
} |
||||
|
||||
/** |
||||
* Constructor |
||||
* @return void |
||||
*/ |
||||
protected function __construct() |
||||
{ |
||||
$fields = array('tool_enable' => 'boolean', 'api_key' => 'text'); |
||||
$smsTypeOptions = $this->getSmsTypeOptions(); |
||||
foreach ($smsTypeOptions as $smsTypeOption) { |
||||
$fields[$smsTypeOption] = 'checkbox'; |
||||
} |
||||
parent::__construct('0.1', 'Imanol Losada', $fields); |
||||
} |
||||
|
||||
/** |
||||
* addMobilePhoneNumberField (adds a mobile phone number field if it is not |
||||
* already created) |
||||
* @return void |
||||
*/ |
||||
private function addMobilePhoneNumberField() |
||||
{ |
||||
$result = Database::select('mobile_phone_number', 'user_field'); |
||||
if (empty($result)) { |
||||
require_once api_get_path(LIBRARY_PATH).'extra_field.lib.php'; |
||||
$extraField = new Extrafield('user'); |
||||
$extraField->save(array( |
||||
'field_type' => 1, |
||||
'field_variable' => 'mobile_phone_number', |
||||
'field_display_text' => $this->get_lang('mobile_phone_number'), |
||||
'field_default_value' => null, |
||||
'field_order' => 2, |
||||
'field_visible' => 1, |
||||
'field_changeable' => 1, |
||||
'field_filter' => null |
||||
)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* getSmsTypeOptions (returns all SMS types) |
||||
* @return array SMS types |
||||
*/ |
||||
private function getSmsTypeOptions() |
||||
{ |
||||
return array( |
||||
'MessageWelcomeXLoginXPasswordX', |
||||
'MessageXNewFileSharedCourseXByX', |
||||
'MessageXAccountApprovedConnectX', |
||||
'MessageXNewCourseXBeenCreatedX', |
||||
'MessageXNewUserXSubscribedCourseX', |
||||
'MessageXNewCourseSuggestedTeacherX', |
||||
'MessageXCourseOpeningRequestCodeXRegistered', |
||||
'MessageXCourseOpeningRequestCourseCodeXApproved', |
||||
'MessageXRequestOpenCourseCodeXReject', |
||||
'MessageXCourseOpeningRequestCourseCodeX', |
||||
'MessageXBeenSubscribedCourseX', |
||||
'MessageXAssignmentBeenCreatedCourseX', |
||||
'MessageXAccountCreatedUpdatedLoginXPasswordX', |
||||
'MessageXPasswordUpdatedLoginXPasswordX', |
||||
'MessageXRequestedPasswordChange', |
||||
'MessageXReceivedNewPersonalMessages', |
||||
'MessageXNewUserXPendingApproval', |
||||
'MessageXXPostedForumXCourseX', |
||||
'MessageXXXCheckEmailConnectMoreInfo', |
||||
'MessageXXStudentXAnsweredTestX', |
||||
'MessageXXStudentXAnsweredTestXOpenQuestion', |
||||
'MessageXXStudentXAnsweredTestXVoiceQuestion', |
||||
'MessageXXAnswerOpenQuestionTestXReviewed', |
||||
'MessageXXNewThreadXStartedForumX', |
||||
'MessageXXNewAnswerPostedXForumX', |
||||
'MessageXXNewSystemAnnouncementAdded', |
||||
'MessageXTestXNewSystemAnnouncementAdded', |
||||
'MessageXXSystemAnnouncementUpdate', |
||||
'MessageXTestXSystemAnnouncementUpdate', |
||||
'MessageXUserXUploadedAssignmentXCourseXStudentSubmitsPaper', |
||||
'MessageXUserXUploadedAssignmentXCheckXStudentSubmitsPaper', |
||||
'MessageXUserXUploadedAssignmentXCourseX', |
||||
'MessageXUserXUploadedAssignmentXCheckX', |
||||
'MessageXSubscribedSessionX', |
||||
'MessageXSubscribedSessionXCSV', |
||||
'MessageXUserXSuggestedBeFriends', |
||||
'MessageXUserXAnsweredInboxMessage', |
||||
'MessageXBeenInvitedJoinGroupX', |
||||
'MessageXMessagesSentEditedGroupXEdited', |
||||
'MessageXMessagesSentEditedGroupXAdded', |
||||
'MessageXBeenInvitedCompleteSurveyXCourseX', |
||||
'MessageXReminderAssignmentXCourseXDue', |
||||
'MessageXUserDetailsModified' |
||||
); |
||||
} |
||||
|
||||
/** |
||||
* install (installs the plugin) |
||||
* @return void |
||||
*/ |
||||
public function install() |
||||
{ |
||||
$this->addMobilePhoneNumberField(); |
||||
} |
||||
/** |
||||
* install (uninstalls the plugin and removes all plugin's tables and/or rows) |
||||
* @return void |
||||
*/ |
||||
public function uninstall() |
||||
{ |
||||
$tSettings = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT); |
||||
$sql = "DELETE FROM $tSettings WHERE subkey = 'kannelsms'"; |
||||
Database::query($sql); |
||||
} |
||||
} |
@ -0,0 +1,5 @@ |
||||
This plugin, as the rest of Chamilo, is released under the GNU/GPLv3 license. |
||||
|
||||
The Kannel library included is provided under the ICS license, compatible |
||||
with GNU/GPLv3. See https://github.com/mediaburst/kannel-php/issues/3 for |
||||
details. |
@ -0,0 +1,10 @@ |
||||
<?php |
||||
/* For licensing terms, see /vendor/license.txt */ |
||||
|
||||
/** |
||||
* @package chamilo.plugin.kannelsms |
||||
* @author Imanol Losada <imanol.losada@beeznest.com> |
||||
*/ |
||||
require_once dirname(__FILE__).'/config.php'; |
||||
|
||||
$plugin_info = KannelsmsPlugin::create()->get_info(); |
@ -0,0 +1,3 @@ |
||||
This plugin enables Chamilo to send SMS messages to Chamilo users when a notification email is sent. |
||||
|
||||
SMS message types (a new course is created, an account is approved and so on) can be enabled or disabled from it's plugin configuration option. |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1 @@ |
||||
{{ message }} |
@ -0,0 +1,16 @@ |
||||
<?php |
||||
/* For licensing terms, see /vendor/license.txt */ |
||||
|
||||
/** |
||||
* This script is included by main/admin/settings.lib.php when unselecting a plugin |
||||
* and is meant to remove things installed by the install.php script in both |
||||
* the global database and the courses tables |
||||
* |
||||
* @package chamilo.plugin.kannelsms |
||||
* @author Imanol Losada <imanol.losada@beeznest.com> |
||||
*/ |
||||
/** |
||||
* Queries |
||||
*/ |
||||
require_once dirname(__FILE__).'/config.php'; |
||||
KannelsmsPlugin::create()->uninstall(); |
Loading…
Reference in new issue