From dcab5adbda7cf546a04a9f055af999d32e018a0f Mon Sep 17 00:00:00 2001
From: Cesar Perales ';
- if (api_get_setting('show_back_link_on_top_of_tree') == 'true') {
- $htmlTitre .= '<< '.get_lang('BackToHomePage').'';
- }
- if (!is_null($catLine['parent_id']) || (api_get_setting('show_back_link_on_top_of_tree') != 'true' && !is_null($catLine['code']))) {
- $htmlTitre .= '<< '.get_lang('Up').'';
- }
- $htmlTitre .= " ';
+ if (api_get_setting('show_back_link_on_top_of_tree') == 'true') {
+ $htmlTitre .= '<< '.get_lang('BackToHomePage').'';
+ }
+ $htmlTitre .= "';
- while ($catLine = Database::fetch_array($resCats)) {
- if ($catLine['code'] != $category) {
- $category_has_open_courses = self::category_has_open_courses($catLine['code']);
- if ($category_has_open_courses) {
- // The category contains courses accessible to anonymous visitors.
- $htmlListCat .= '
'.$catLine['name']."
";
- } else {
- $htmlTitre .= ''.get_lang('Categories')."
";
- }
- }
- }
+ $htmlListCat = Display::page_header(get_lang('CatList'));
+ $htmlListCat .= '';
+ $htmlTitre = '';
+ while ($catLine = Database::fetch_array($resCats)) {
+ $category_has_open_courses = self::category_has_open_courses($catLine['code']);
+ if ($category_has_open_courses) {
+ // The category contains courses accessible to anonymous visitors.
+ $htmlListCat .= '
";
}
$result .= $htmlTitre;
if ($thereIsSubCat) {
- $result .= $htmlListCat;
+ $result .= $htmlListCat;
}
while ($categoryName = Database::fetch_array($resCats)) {
- $result .= '' . $categoryName['name'] . "
\n";
+ $result .= '' . $categoryName['name'] . "
\n";
}
$numrows = Database::num_rows($sql_result_courses);
$courses_list_string = '';
From 2d69b5d9f43a5dfdba7a7c85a60c4da145b4cbcb Mon Sep 17 00:00:00 2001
From: Cesar Perales ';
- $tool_name = Display::return_icon(survey_manager::icon_question(Security::remove_XSS($_GET['type'])), get_lang(ucfirst(Security::remove_XSS($_GET['type']))), array('align' => 'middle', 'height' => '22px')).' ';
- if ($_GET['action'] == 'add') {
- $tool_name .= get_lang('AddQuestion');
- }
- if ($_GET['action'] == 'edit') {
- $tool_name .= get_lang('EditQuestion');
- }
+ // The html code of the form
+ public $html;
+
+ /**
+ * This function does the generic part of any survey question: the question field
+ *
+ * @author Patrick Cool
';
+ $tool_name = Display::return_icon(survey_manager::icon_question(Security::remove_XSS($_GET['type'])), get_lang(ucfirst(Security::remove_XSS($_GET['type']))), array('align' => 'middle', 'height' => '22px')).' ';
+ if ($_GET['action'] == 'add') {
+ $tool_name .= get_lang('AddQuestion');
+ }
+ if ($_GET['action'] == 'edit') {
+ $tool_name .= get_lang('EditQuestion');
+ }
- if ($_GET['type'] == 'yesno') {
- $tool_name .= ': '.get_lang('YesNo');
- } else if ($_GET['type'] == 'multiplechoice') {
- $tool_name .= ': '.get_lang('UniqueSelect');
- } else {
- $tool_name .= ': '.get_lang(api_ucfirst(Security::remove_XSS($_GET['type'])));
- }
+ if ($_GET['type'] == 'yesno') {
+ $tool_name .= ': '.get_lang('YesNo');
+ } else if ($_GET['type'] == 'multiplechoice') {
+ $tool_name .= ': '.get_lang('UniqueSelect');
+ } else {
+ $tool_name .= ': '.get_lang(api_ucfirst(Security::remove_XSS($_GET['type'])));
+ }
- $this->html .= '
Note: PHP 5.3.9 introduces a new setting "max_input_vars", which limits the number of elements you can send in one single form. If you are dealing with numerous users, make sure you set this setting higher than its default value of 1000.
+BSD users: these php libraries have to be included during php installation:
From e07bd0d21199606944346dea8bdc2f31128761ef Mon Sep 17 00:00:00 2001 From: Yannick WarnierMystery is a name we give new versions before we know their name.
Gracias por descargar Chamilo, la suite de aprendizaje de código abierto profesional.
Esta guía explica como instalar el Sistema de Gestión de Aprendizaje Chamilo. Explica como instalar la conversión a PowerPoint Chamilo Oogie -y la videoconferencia de Chamilo, aunque estos paquetes -no son requeridos para usar Chamilo LMS. Por favor, lea completamente este documento antes de proceder con la instalación.
+Esta guía explica como instalar Chamilo LIBRE. Por favor, léala completamente antes de proceder con la instalación.
@@ -61,13 +57,17 @@ no son requeridos para usar Chamilo LMS. Por favor, lea completamente este+Chamilo puede ser instalado indiferentemente en servidores Windows, Linux, Mac OS X y UNIX. Sin embargo, nosotros recomendamos el uso de un servidor Linux para una óptima flexibilidad, control remoto y escalabilidad. +
++Chamilo es fundamentalmente un LMS que se ejecuta con Apache (1.3, 2.0 o 2.2), MySQL 5.1 (o MariaDB) y PHP 5.3 (o 5.4) (trilogía también llamada AMP). +
++Todo este software es software de código abierto y está disponible libremente. +
++Para ejecutar Chamilo LMS en su servidor, necesita instalar WAMP, LAMP o MAMP:
Usted necesitará un nombre de usuario y contraseña que le permita administrar y crear una base de datos. Por lo general, la configuración predeterminada en los equipos locales es permitir que usted conecte como root con una contraseña vacía. Se recomienda cambiar la contraseña y definir un usuario con acceso sólo a una base de datos específica. Por favor, consulte la documentación de MySQL o MariaDB con el fin de hacer esto.
++Nota:Esto se ha simplificado en gran medida desde la versión 1.9, ya que antes era necesario elegir entre múltiples bases de datos y un modo obsoleto de una sola base de datos. +
-
+Los siguientes directorios necesitan tener permisos de lectura, escritura y ejecución en el servidor web. Esto por lo general no requiere ninguna acción específica en los servidores de Windows, pero se requiere un "chmod" bajo Linux y Mac. Consulte las siguientes instrucciones. +
-+Remplace [chamilo] por el directorio en el cual está ubicado su Chamilo:
En Linux, Mac OS X y sistemas operativos BSD puede usar el comando CHMOD -0777 para esto (aunque nosotros recomendamos que busque la ayuda de un +
+Desde Chamilo 1.8.8, también puede habilitar funciones de indexación de texto completo que requieren la instalación de la extensión del módulo PHP php5-xapian. Si usted hace uso de él, usted tendrá que permitir que el sistema pueda escribir en el directorio searchdb: +
+Si usted encuentra un directorio de tests/ en la raíz de su paquete de instalación, por favor elimínelo. Este es un directorio de desarrollo que no ha sido chequeado por cuestiones de seguridad, no debería ser *nunca* accesible a los usuarios finales en un servidor de producción. +
++En Linux, Mac OS X y sistemas operativos BSD puede usar el comando "chmod 0775" para cambiar estos permisos (aunque nosotros recomendamos que busque la ayuda de un administrador de sistemas con experiencia para evitar fallas de seguridad). En Windows, es probable que necesite revisar las propiedades de los directorios (mediante el uso del clic derecho en ellos).
-2.5. Los siguientes archivos necesitan tener permisos de lectura y escritura +Los siguientes directorios necesitan tener permisos de lectura y escritura para el navegador web, sólo durante la instalación de Chamilo: -
-En Linux, Mac OS X y sistemas operativos BSD usted puede usar el comando CHMOD -666 para esto (aunque nosotros recomendamos que busque la ayuda de un +
+En Linux, Mac OS X y sistemas operativos BSD usted puede usar el comando "chmod 666" para esto (aunque nosotros recomendamos que busque la ayuda de un administrador de sistemas con experiencia). En Windows, es probable que usted necesite revisar las propiedades de los directorios (mediante el uso del clic derecho en ellos). -
- - -
NOTAS:
-
No modifique los archivos home_*.html directamente. En vez de hacer esto,
-seleccione "Configurar la página de inicio" en la sección de administración de Chamilo.
Windows : con paquetes combinados como XAMPP, disponibles por todo lado, la cuenta de acceso y contraseña - para MySQL probablemente permanecerá vacía.
- - - +seleccione "Configurar la página de inicio" en la sección de administración de Chamilo. + ++Windows : con paquetes combinados de todos en uno como XAMPP, usted puede instalar Chamilo facilmente. En este caso (y si no lo utiliza en la producción), el nombre de usuario y una contraseña para MySQL probablemente permanecerá vacía. +
Para obtener lo mejor de Chamilo, necesita ajustar la configuración de PHP. Considere:
Algunos usuarios pueden encontrar problemas si en sus configuraciones de PHP no -se ajustan a las siguientes:
+se ajustan los siguientes parámetros:-En versiones de Chamilo/Dokeos anteriores se requería que register_globals estuviera configurada en On. Esto ya no -necesario, puede estar configurado en Off y Chamilo funcionará bien. +En versiones de Chamilo/Dok€os anteriores se requería que register_globals estuviera configurada en On. Esto ya no +necesario, puede (y debería) estar configurado en Off y Chamilo funcionará bien.Se considera una mala elección en términos de seguridad configurar register_globals a On.
Nota: si se usa PHP 5.3 o superior, se necesita configurar la variable date.timezone a la zona horaria de su servidor. @@ -344,19 +247,12 @@ date.timezone = 'America/Lima'
Usuarios BSD: estas bibliotecas de php tienen que ser incluidas durante la instalación de php:
-También puede necesitar estos módulos y paquetes:
Antes de actualizar, le recomendamos seriamente que haga una copia de seguridad de los directorios
y bases de datos de Chamilo/Dokeos que previamente haya en su servidor. Si no está seguro de cómo hacer esto solicite
-asistencia a su proveedor de servicios de almacenamiento.
+asistencia a su proveedor de servicios de almacenamiento.
+
+Chamilo LMS 1.9 viene con una nueva estructura de base de datos. Aunque el script de actualización se encarga de la migración, se generará una carga muy alta en su servidor durante la actualización y además cambiará su base de datos completamente, preservando los datos tan bien como sea posible (se ha probado el procedimiento muchas veces, pero recuerde esto es GNU/GPLv3 y no se hace responsable de lo que le ocurran a sus datos sin supervisión profesional). Es por eso que * realmente * recomendamos realizar una copia de seguridad completa de su sistema antes de actualizar. +
++NOTA: Esta versión de Chamilo sólo se puede utilizar para actualizar desde versiones inferiores de Chamilo o Dok€os. Por ejemplo, no puede utilizar los scripts de actualización normales de Chamilo 1.9 para actualizar desde Dok€oS 2.0. Si usted necesita esto, por favor póngase en contacto con uno de los proveedores oficiales de la Asociación Chamilo) +
- ++Dado que se trata sólo de un cambio de versión menor previa de Chamilo 1.9.*, lo único que tiene que hacer es: +
+Si usted actualiza desde Dok€os 1.8.x :
+Un grupo de administradores de Chamilo han informado de problemas menores con la migración entre versiones considerablemente diferentes (como la de Dok€os a Chamilo). Esto podría suponer perder algunas tareas o mensajes en el foro. Para evitar cualquier efecto desagradable en los usuarios, le recomendamos que primero debe establecer una lista de todo el contenido que es fundamental para usted, y que mantenga una copia de su anterior sítio funcionando. De esta manera, será más fácil de manejar la transición al permitir a los usuarios tener acceso a sus contenidos desde el sitio anterior y haciendo más fácil el que usted pueda comparar las dos instalaciones. Si usted está experimentando dificultades, considere pedir ayuda a un desarrollador de PHP o contratar a un proveedor oficial de Chamilo. Ellos se asegurarán de que usted obtenga la mejor migración de Chamilo. +
-+* Los estilos e imágenes están ubicados en el directorio main/css o main/img. Usted puede recuperarlos desde la copia de seguridad en el caso de que usted hya tenido la precaución de realizarla. Cualquier estilo o imagen modificada que use el nombre predeterminado style/image será sobrescrita en el siguiente paso. Para evitar perder cualquier personalización, siempre asegúrese de copiar styles/images bajo un nuevo nombre y use y modifique la copia, no el original. El original siempre sera sobrescrito por nuevas versiones. - En Dokeos 1.8.5, hemos cambiado el nombre de varios temas CSS. + En Dok€os 1.8.5, hemos cambiado el nombre de varios temas CSS. La compatibilidad hacia atrás está asegurada por el hecho de que una actualización sólo agrega los nuevos temas, sin embargo usted debe usar estos nuevos temas en lugar de quedarse con los - antiguos que quedarán obsoletos dentro de poco (sin mantenimiento).
-
+Si usted actualiza desde una versión anterior a Dok€os (1.6.x), lo primero
y mas importante a hacer es *mover* su directorio actual hacia otro
-lugar.
+lugar.
Una manera simple de hacer esto es crear un subdirectorio llamado "version_antigua"
-en su directorio actual de Dokeos y luego mover todo dentro de este, usando un
+en su directorio actual de Dok€os y luego mover todo dentro de este, usando un
sencillo comando "mover" (ejem. en Linux: mkdir version_antigua; mv *
version_antigua/), luego dar permisos de escritura al directorio version_antigua para el servidor web
para que los directorios courses/ y upload/ puedan moverse desde la antigua instalación a la nueva.
-
+
El proceso completo es como sigue:
+ NOTA: La actualización desde 1.6.x a 1.9.x implica una revisión de
los gráficos y estilos personalizados. La nueva versión usa un completo nuevo conjunto
de iconos y estilos, lo cual significa que aquellos provenientes de la versión 1.6 no pueden ser
-simplemente reusados. La buena noticia es que la versión 1.8.x le permite crear
+simplemente reusados. La buena noticia es que la versión 1.9.x le permite crear
su propio estilo en un directorio css separado, el cual se puede reusar en
-todas las versiones 1.8.x
-
-
-
ADVERTENCIA:
-
-No elimine el directorio de instalación previo de Chamilo/Dokeos antes de instalar
+No elimine el directorio de instalación previo de Chamilo/Dok€os antes de instalar
el nuevo. Usted puede eliminar la ruta antigua, cuando la actualización haya finalizado satisfactoriamente.
NOTA:
-
No modifique los archivos de home_*.html directamente. En lugar de ello,
seleccione "Configurar la página de inicio" en la sección de administración de Chamilo.
-
Si usted tiene problemas, vaya al Sitio Web de Chamilo y haga una pregunta en el foro de soporte. Por favor, primero lea los mensajes previos para ver si existe ya una respuesta a su pregunta. Nosotros también mantenemos una lista de @@ -557,7 +469,7 @@ una respuesta a su pregunta. Nosotros también mantenemos una lista de
Para acceder a la sección de administración de Chamilo, abra el navegador, diríjase a su dirección de Chamilo y acceda a el con el usuario admin. -Luego usted verá un enlace a la "Seccion de administracion de la plataforma" en la parte superior +Luego usted verá un enlace a la "Sección de administración de la plataforma" en la parte superior de la página web. En ese lugar usted puede administrar usuarios, cursos, secciones, apariencia del portal contenido de la página principal, categorías de cursos, entre otros.
@@ -568,54 +480,40 @@ contenido de la página principal, categorías de cursos, entre otros.
Esta parte es opcional, solamente organizaciones con un servidor LDAP necesitan leer esto.
-
-Un modulo LDAP está ya implementado en Chamilo, pero debe ser configurado para que tenga un correcto funcionamiento.
+Un módulo LDAP está ya implementado en Chamilo, pero debe ser configurado para que tenga un correcto funcionamiento.
-Servidores Linux: Es posible que se requiera recompilar php con soporte ldap. +Servidores Linux: Es posible que se requiera recompilar PHP con soporte para LDAP. Distribuciones nuevas también permiten descargar rpms para los paquetes adicionales.
Nota:El mecanismo de LDAP ha cambiado en 1,9. Como resultado, parte de la información siguiente puede no ser correcta. Por favor, compruebe los ajustes de configuración dentro de Chamilo para conocer los detalles.
En (la carpeta de Chamilo)/main/inc/conf/configuration.php, aproximadamente en la line 90, se puede ver
-
//for new login module
-
//uncomment these to activate ldap
-
//$extAuthSource['ldap']['login'] = "./main/auth/ldap/login.php";
-
//$extAuthSource['ldap']['newUser'] = "./main/auth/ldap/newUser.php";
-
-
eliminar // de las dos últimas líneas para activar LDAP.
-
Solicitar al administrador del servidor LDAP los siguientes datos:
-Este procedimiento creará un nuevo icono en su editor en línea de Chamilo, el cual hará posible la inserción de fórmulas matemáticas en sus documentos.
+ +Para formas de probar como la variable AMTcgiloc tiene que ser configurada, existen unos ejemplos (en comentario) dentro del script.
+Instalando este plugin obtendrá WIRIS editor y WIRIS CAS.
La activación no se realiza completamente si previamente no ha descargado el PHP plugin for FCKeditor de WIRIS y descomprimido su contenido en el directorio de Chamilo main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/
Esto es necesario debido a que Wiris es un software propietario y los servicios de Wiris son comerciales. Para realizar ajustes en el plugin edite el archivo configuration.ini o sustituya su contenido por el de configuration.ini.default que acompaña a Chamilo.
+Nota: Este paso requiere de un servidor dedicado o servidor virtual privado (VPS) porque los paquetes involucrados no están disponibles en la mayoría de soluciones de hosting compartido. +
++En Debian o Ubuntu 10.04 o superior, usted simplemente puede instalar el paquete php5-xapian y reiniciar su servidor web: +
+sudo apt-get install php5-xapian +sudo /etc/init.d/apache2 restart ++ +
+A continuación, vaya a la página de administración -> Ajustes de configuración -> Buscar y habilitar la herramienta de búsqueda. Siga las recomendaciones de la página para obtener la suite completa de indexación instalada. Una vez que haya terminado, todos los documentos importados en su portal Chamilo en un formato reconocido serán indexados y buscados. En formación de administradores de Chamilo ( el cual puede preguntar a cualquier Proveedor Oficial de Chamilo) incluyen una revisión completa de la función de búsqueda de texto completo. +
+ ++Nota: Este paso requiere un servidor dedicado o un servidor dedicado virtual ya que los paquetes involucrados no están disponibles en la mayoría de soluciones de hosting compartido. (Consulte con su proveedor): +
++En Debian o Ubuntu 11.10 y superior, instale LibreOffice.org v3 e iniciarlo como un servidor en segundo plano: +
+sudo apt-get install libreoffice +sudo soffice "--accept=socket,host=127.0.0.1,port=2002,tcpNoDelay=1;urp;" --headless --nodefault --nofirststartwizard --nolockcheck --nologo --norestore ++ +
+A continuación, vaya a la página de administración -> Chamilo Rapid y establecer el host a "localhost" y el puerto a "2002". Guarde los cambios. Vaya a su curso, en la pantalla de herramientas de aprendizaje y verá que apareció un nuevo icono. Importar tu PPT. Esto debería funcionar. +
++Nota: A veces, esto no se resuelve tan fácilmente. Usted probablemente tenga que solicitar la asistencia de algún administrador de sistemas con un poco de experiencia en Java y PHP, o siempre podrá preguntar a uno de los proveedores oficiales de Chamilo para asistirle (pregunte por un contrato comercial garantizado). +
+ ++Desde Chamilo 1.8.8, algunas tareas necesitan ejecutarse con regularidad con el fin de obtener lo mejor de los recursos del servidor. Una de las tareas de este tipo (y el único en todo en el momento de Chamilo 1.8.8) es el envío de notificaciones de mensajería interna por e-mail, es decir, cuando usted recibe un correo electrónico de otra persona o de un grupo dentro de la mensajería interna del sistema de Chamilo, si se envían todos los e-mails inmediatamente, puede que no llegue a recibir el correo a su ritmo, una vez al día o una vez a la semana. Para casos como este, como administrador de Chamilo, debe configurar un proceso cron en el servidor para comprobar la cola de mensajes de correo electrónico y enviarlo puntualmente. +
++Configurar una tarea de cron es fácil y hay varias maneras de hacerlo. Le recomendamos echar un vistazo a la documentación de Drupal para configurar el cron y definir su propio proceso de cron como: +
+35 * * * * wget -O - -q -t 1 http://campus.example.com/main/cron/run.php ++ +
+Asegúrese de revisar el run.php tal vez desee cambiar algunas algunas opciones de configuración. +
+ ++Como Chamilo se hace más popular y atraviesa muchas fronteras ahora, es frecuente que los administradores quieran pedir cambiar el orden del nombre y apellido en los campos de las tablas, y también en qué campo se pondrá en primer lugar. +
++Esto fácilmente se puede modificar editando el archivo main/inc/lib/internationalization_database/name_order_conventions.php, buscando nuestro idioma y cambiando los campos. Es tan simple que se explica por sí mismo y se ve así: +
+'simpl_chinese' => array( 'format' => 'title last_name first_name', 'sort_by' => 'last_name' ), // Eastern order ++Siéntase libre de cambiar esto a +
+'simpl_chinese' => array( 'format' => 'title first_name lastname', 'sort_by' => 'last_name' ), // Eastern order ++por ejemplo. El efecto debería ser inmediato. +
From 2de2e547386bc254624c2d99071dc97535e5eb9a Mon Sep 17 00:00:00 2001
From: Yannick Warnier MFxUXY*$tE?r
z2Dl3Nu3S;?pqnt=e=~p-8(GdJY%!P%x6StF70k{kQ240Y8*Q!V0N|UD&k}I#u!=u+
z%$jh(O=>hup`yOr%_%9pDL>2qvO1=_C@&n(BN+9w0n#2l5{rip?Huk|ugqnsAVca=
zaa5F
OkGoE^Kd41(uXP3{PtJxMHjo8`9I(OT|;Aklqm@hnc;dmvs2Ta>vJLcVj
zbY?&@EMJ;`LvIB3?Ehxz2yl9<5;Ota-w|QcVdAg%AhtRHOgn=bs307VMb76#6Mpuc
zQ@4Hk)~VUap
-
+ 
@@ -3024,4 +3024,4 @@ CREATE TABLE usergroup_rel_question (
question_id int unsigned not null,
usergroup_id int unsigned not null,
coefficient float(6,2)
-);
\ No newline at end of file
+);
diff --git a/main/install/update-db-1.8.5-1.8.6.inc.php b/main/install/update-db-1.8.5-1.8.6.inc.php
index e027156c7a..bdb88ba682 100644
--- a/main/install/update-db-1.8.5-1.8.6.inc.php
+++ b/main/install/update-db-1.8.5-1.8.6.inc.php
@@ -201,7 +201,7 @@ if (defined('SYSTEM_INSTALLATION')) {
-
+ 
From 3287dd96676178807aa4d0c92e30b951913d398d Mon Sep 17 00:00:00 2001
From: Yannick Warnier '.$item->get_name().'
'.$invisibility_span_close;
+ $row[] = $this->build_type_column($item);
+
+ //Name
+ if (get_class($item) == 'Category') {
+ $row[] = $invisibility_span_open.''.$item->get_name().'
'.$invisibility_span_close;
$main_categories[$item->get_id()]['name'] = $item->get_name();
- } else {
- $row[] = $invisibility_span_open.$this->build_name_link($item) . $invisibility_span_close;
+ } else {
+ $row[] = $invisibility_span_open.$this->build_name_link($item) . $invisibility_span_close;
$main_categories[$item->get_id()]['name'] = $this->build_name_link($item);
- }
+ }
$main_categories[$item->get_id()]['weight']= $item->get_weight();
$total_categories_weight += $item->get_weight();
- //Description
- $row[] = $invisibility_span_open.$data[2].$invisibility_span_close;
-
- //Weight
- //$row[] = $invisibility_span_open .Display::tag('h4', $data['3'] .' / '.$this->currentcat->get_weight()).$invisibility_span_close;
+ //Description
+ $row[] = $invisibility_span_open.$data[2].$invisibility_span_close;
+
+ //Weight
+ //$row[] = $invisibility_span_open .Display::tag('h4', $data['3'] .' / '.$this->currentcat->get_weight()).$invisibility_span_close;
//$average = $data['3']/$this->currentcat->get_weight()*100;
$average = $scoredisplay->display_score(array($data['3'], $this->currentcat->get_weight()), SCORE_SIMPLE, SCORE_BOTH, true);
if (api_is_allowed_to_edit(null, true)) {
- $row[] = $invisibility_span_open .Display::tag('h4', $average).$invisibility_span_close;
+ $row[] = $invisibility_span_open .Display::tag('h4', $average).$invisibility_span_close;
} else {
- $row[] = $invisibility_span_open .$average.$invisibility_span_close;
+ $row[] = $invisibility_span_open .$average.$invisibility_span_close;
}
$category_weight = $item->get_weight();
-
- if (api_is_allowed_to_edit(null, true)) {
- $weight_total_links += $data[3];
- } else {
- $cattotal = Category :: load($_GET['selectcat']);
+
+ if (api_is_allowed_to_edit(null, true)) {
+ $weight_total_links += $data[3];
+ } else {
+ $cattotal = Category :: load($_GET['selectcat']);
$scoretotal = $cattotal[0]->calc_score(api_get_user_id());
$item_value = $scoredisplay->display_score($scoretotal, SCORE_SIMPLE);
- }
-
- //Date
- //$row[] = $invisibility_span_open.$data[4].$invisibility_span_close;
+ }
+
+ //Date
+ //$row[] = $invisibility_span_open.$data[4].$invisibility_span_close;
- //Edit (for admins)
- if (api_is_allowed_to_edit(null, true)) {
- $cat = new Category();
- $show_message = $cat->show_message_resource_delete($item->get_course_code());
- if ($show_message === false) {
- $row[] = $this->build_edit_column($item);
- }
- } else {
- //students get the results and certificates columns
- if (count($this->evals_links) > 0 && $status_user != 1) {
- $value_data = isset($data[4]) ? $data[4] : null;
- if (!is_null($value_data)) {
- $row[] = Display::tag('h4', $value_data);
- } else {
+ //Edit (for admins)
+ if (api_is_allowed_to_edit(null, true)) {
+ $cat = new Category();
+ $show_message = $cat->show_message_resource_delete($item->get_course_code());
+ if ($show_message === false) {
+ $row[] = $this->build_edit_column($item);
+ }
+ } else {
+ //students get the results and certificates columns
+ if (count($this->evals_links) > 0 && $status_user != 1) {
+ $value_data = isset($data[4]) ? $data[4] : null;
+ if (!is_null($value_data)) {
+ $row[] = Display::tag('h4', $value_data);
+ } else {
$row[] = $this->build_edit_column($item);
}
- } else {
+ } else {
$score = $item->calc_score(api_get_user_id());
if (!empty($score[1])) {
$complete_score = $scoredisplay->display_score($score, SCORE_DIV_PERCENT);
@@ -252,58 +252,58 @@ class GradebookTable extends SortableTable {
$row[] = $this->build_edit_column($item);
}
}
- }
+ }
//Category added
- $sortable_data[] = $row;
-
- // Loading childrens
-
- if (get_class($item) == 'Category') {
-
- $stud_id = api_get_user_id();
- $course_code = api_get_course_id();
- $session_id = api_get_session_id();
- $parent_id = $item->get_id();
+ $sortable_data[] = $row;
+
+ // Loading childrens
+
+ if (get_class($item) == 'Category') {
- $cats = Category :: load ($parent_id, null, null, null, null, null);
-
- $allcat = $cats[0]->get_subcategories($stud_id, $course_code, $session_id);
- $alleval = $cats[0]->get_evaluations($stud_id);
- $alllink = $cats[0]->get_links($stud_id);
-
- $sub_cat_info = new GradebookDataGenerator($allcat, $alleval, $alllink);
- $data_array = $sub_cat_info->get_data($sorting, $from, $this->per_page);
+ $stud_id = api_get_user_id();
+ $course_code = api_get_course_id();
+ $session_id = api_get_session_id();
+ $parent_id = $item->get_id();
+
+ $cats = Category :: load ($parent_id, null, null, null, null, null);
+
+ $allcat = $cats[0]->get_subcategories($stud_id, $course_code, $session_id);
+ $alleval = $cats[0]->get_evaluations($stud_id);
+ $alllink = $cats[0]->get_links($stud_id);
- $total_weight = 0;
+ $sub_cat_info = new GradebookDataGenerator($allcat, $alleval, $alllink);
+ $data_array = $sub_cat_info->get_data($sorting, $from, $this->per_page);
+
+ $total_weight = 0;
//Links
- foreach ($data_array as $data) {
- $row = array();
- $item = $data[0];
- $id = $item->get_id();
-
- //if the item is invisible, wrap it in a span with class invisible
- $invisibility_span_open = (api_is_allowed_to_edit() && $item->is_visible() == '0') ? '' : '';
- $invisibility_span_close = (api_is_allowed_to_edit() && $item->is_visible() == '0') ? '' : '';
+ foreach ($data_array as $data) {
+ $row = array();
+ $item = $data[0];
+ $id = $item->get_id();
+
+ //if the item is invisible, wrap it in a span with class invisible
+ $invisibility_span_open = (api_is_allowed_to_edit() && $item->is_visible() == '0') ? '' : '';
+ $invisibility_span_close = (api_is_allowed_to_edit() && $item->is_visible() == '0') ? '' : '';
$main_categories[$parent_id]['children'][$item->get_id()]['name'] = $item->get_name();
$main_categories[$parent_id]['children'][$item->get_id()]['weight'] = $item->get_weight();
- if (api_is_allowed_to_edit(null, true)) {
- $row[] = $this->build_id_column($item);
- }
+ if (api_is_allowed_to_edit(null, true)) {
+ $row[] = $this->build_id_column($item);
+ }
+
+ $row[] = $this->build_type_column($item, array('style' => 'padding-left:5px'));
+
+ //Name
+ $row[] = $invisibility_span_open." ".$this->build_name_link($item) . $invisibility_span_close;
- $row[] = $this->build_type_column($item, array('style' => 'padding-left:5px'));
-
- //Name
- $row[] = $invisibility_span_open." ".$this->build_name_link($item) . $invisibility_span_close;
-
- //Description
- $row[] = $invisibility_span_open.$data[2].$invisibility_span_close;
-
- //Weight
+ //Description
+ $row[] = $invisibility_span_open.$data[2].$invisibility_span_close;
+
+ //Weight
//$weight = $data[3]/$category_weight*$main_cat[0]->get_weight();
/*$weight = $category_weight * $data[3] / $main_cat[0]->get_weight();
$weight = $main_cat[0]->get_weight()*$weight/$category_weight;*/
@@ -315,45 +315,45 @@ class GradebookTable extends SortableTable {
$total_weight += $weight;
$row[] = $invisibility_span_open.$weight.$extra.$invisibility_span_close;
-
- if (api_is_allowed_to_edit(null, true)) {
- //$weight_total_links += intval($data[3]);
- } else {
- $cattotal = Category :: load($_GET['selectcat']);
- $scoretotal = $cattotal[0]->calc_score(api_get_user_id());
- $item_value = $scoretotal[0];
- }
-
- //Date
- //$row[] = $invisibility_span_open.$data[4].$invisibility_span_close;
-
- //Admins get an edit column
- if (api_is_allowed_to_edit(null, true)) {
- $cat = new Category();
- $show_message = $cat->show_message_resource_delete($item->get_course_code());
- if ($show_message === false) {
- $row[] = $this->build_edit_column($item);
- }
- } else {
- //students get the results and certificates columns
- $eval_n_links = array_merge($alleval, $alllink);
-
- if (count($eval_n_links)> 0 && $status_user!=1 ) {
- $value_data = isset($data[4]) ? $data[4] : null;
- if (!is_null($value_data)) {
+
+ if (api_is_allowed_to_edit(null, true)) {
+ //$weight_total_links += intval($data[3]);
+ } else {
+ $cattotal = Category :: load($_GET['selectcat']);
+ $scoretotal = $cattotal[0]->calc_score(api_get_user_id());
+ $item_value = $scoretotal[0];
+ }
+
+ //Date
+ //$row[] = $invisibility_span_open.$data[4].$invisibility_span_close;
+
+ //Admins get an edit column
+ if (api_is_allowed_to_edit(null, true)) {
+ $cat = new Category();
+ $show_message = $cat->show_message_resource_delete($item->get_course_code());
+ if ($show_message === false) {
+ $row[] = $this->build_edit_column($item);
+ }
+ } else {
+ //students get the results and certificates columns
+ $eval_n_links = array_merge($alleval, $alllink);
+
+ if (count($eval_n_links)> 0 && $status_user!=1 ) {
+ $value_data = isset($data[4]) ? $data[4] : null;
+ if (!is_null($value_data)) {
$score = $item->calc_score(api_get_user_id());
$new_score = $data[3]* $score[0] / $score[1];
$row[] = Display::tip($new_score, $data[4]);
- }
- }
+ }
+ }
if (!empty($cats)) {
$row[] = null;
}
- }
+ }
$row['child_of'] = $parent_id;
- $sortable_data[] = $row;
- }
+ $sortable_data[] = $row;
+ }
//"Warning row"
if (!empty($data_array)) {
@@ -369,9 +369,9 @@ class GradebookTable extends SortableTable {
$row = array(null, null, " ".get_lang('SubTotal').'
',null, $total.' '.$label, 'child_of' =>$parent_id);
$sortable_data[] = $row;
}
- }
- }
- } //end looping categories
+ }
+ }
+ } //end looping categories
if (api_is_allowed_to_edit()) {
if (count($main_cat) > 1) {
@@ -386,86 +386,86 @@ class GradebookTable extends SortableTable {
}
}
- // warning messages
+ // warning messages
$view = isset($_GET['view']) ? $_GET['view']: null;
- if (api_is_allowed_to_edit()) {
-
- if (isset($_GET['selectcat']) && $_GET['selectcat'] > 0 && $view <> 'presence') {
- $id_cat = intval($_GET['selectcat']);
- $category = Category :: load($id_cat);
- //$weight_category = intval($this->build_weight($category[0]));
- $weight_category = intval($this->build_weight($category[0]));
- $course_code = $this->build_course_code($category[0]);
+ if (api_is_allowed_to_edit()) {
+
+ if (isset($_GET['selectcat']) && $_GET['selectcat'] > 0 && $view <> 'presence') {
+ $id_cat = intval($_GET['selectcat']);
+ $category = Category :: load($id_cat);
+ //$weight_category = intval($this->build_weight($category[0]));
+ $weight_category = intval($this->build_weight($category[0]));
+ $course_code = $this->build_course_code($category[0]);
$weight_total_links = round($weight_total_links);
- if ($weight_total_links > $weight_category || $weight_total_links < $weight_category || $weight_total_links > $weight_category) {
- $warning_message = sprintf(get_lang('TotalWeightMustBeX'), $weight_category);
- $modify_icons = ''.Display::return_icon('edit.png', $warning_message, array(), ICON_SIZE_SMALL).'';
- $warning_message .= $modify_icons;
- Display::display_warning_message($warning_message,false);
- }
+ if ($weight_total_links > $weight_category || $weight_total_links < $weight_category || $weight_total_links > $weight_category) {
+ $warning_message = sprintf(get_lang('TotalWeightMustBeX'), $weight_category);
+ $modify_icons = ''.Display::return_icon('edit.png', $warning_message, array(), ICON_SIZE_SMALL).'';
+ $warning_message .= $modify_icons;
+ Display::display_warning_message($warning_message,false);
+ }
- $content_html = DocumentManager::replace_user_info_into_html(api_get_user_id(), $course_code);
- if (!empty($content_html)) {
- $new_content = explode('',$content_html['content']);
+ $content_html = DocumentManager::replace_user_info_into_html(api_get_user_id(), $course_code);
+ if (!empty($content_html)) {
+ $new_content = explode('',$content_html['content']);
}
- if (empty($new_content[0])) {
- $warning_message = get_lang('ThereIsNotACertificateAvailableByDefault');
- $cert_icon = ''.Display::return_icon('certificate.png', get_lang('AttachCertificate'), array(), ICON_SIZE_SMALL).'';
+ if (empty($new_content[0])) {
+ $warning_message = get_lang('ThereIsNotACertificateAvailableByDefault');
+ $cert_icon = ''.Display::return_icon('certificate.png', get_lang('AttachCertificate'), array(), ICON_SIZE_SMALL).'';
- Display::display_warning_message($warning_message.$cert_icon,false);
- }
- }
+ Display::display_warning_message($warning_message.$cert_icon,false);
+ }
+ }
- if (empty($_GET['selectcat'])) {
- $categories = Category :: load();
- $weight_categories = $certificate_min_scores = $course_codes = array();
- foreach ($categories as $category) {
- $course_code_category = $this->build_course_code($category);
- if (!empty($course_code)) {
- if ($course_code_category == $course_code) {
- $weight_categories[] = intval($this->build_weight($category));
- $certificate_min_scores[] = intval($this->build_certificate_min_score($category));
- $course_codes[] = $course_code;
- break;
- }
- } else {
- $weight_categories[] = intval($this->build_weight($category));
- $certificate_min_scores[] = intval($this->build_certificate_min_score($category));
- $course_codes[] = $course_code_category;
- }
- }
+ if (empty($_GET['selectcat'])) {
+ $categories = Category :: load();
+ $weight_categories = $certificate_min_scores = $course_codes = array();
+ foreach ($categories as $category) {
+ $course_code_category = $this->build_course_code($category);
+ if (!empty($course_code)) {
+ if ($course_code_category == $course_code) {
+ $weight_categories[] = intval($this->build_weight($category));
+ $certificate_min_scores[] = intval($this->build_certificate_min_score($category));
+ $course_codes[] = $course_code;
+ break;
+ }
+ } else {
+ $weight_categories[] = intval($this->build_weight($category));
+ $certificate_min_scores[] = intval($this->build_certificate_min_score($category));
+ $course_codes[] = $course_code_category;
+ }
+ }
- if (is_array($weight_categories) && is_array($certificate_min_scores) && is_array($course_codes)) {
- $warning_message = '';
- for ($x = 0; $x
';
- }
- }
+ if (empty($certificate_min_score) || ($certificate_min_score > $weight_category)) {
+ $warning_message .= $course_code .' - '.get_lang('CertificateMinimunScoreIsRequiredAndMustNotBeMoreThan').' '.$weight_category.'
';
+ }
+ }
- if (!empty($warning_message)) {
- Display::display_warning_message($warning_message,false);
- }
- }
- }
- }
- return $sortable_data;
- }
+ if (!empty($warning_message)) {
+ Display::display_warning_message($warning_message,false);
+ }
+ }
+ }
+ }
+ return $sortable_data;
+ }
// Other functions
private function build_certificate_min_score ($item) {
- return $item->get_certificate_min_score();
+ return $item->get_certificate_min_score();
}
private function build_weight ($item) {
- return $item->get_weight();
+ return $item->get_weight();
}
private function build_course_code ($item) {
From d92d55f13037c6e97197e3bcc5b1f18fa893b3f7 Mon Sep 17 00:00:00 2001
From: Yannick Warnier Improvements
From 0f4cd082b7fe219655357261279fe1491d18e427 Mon Sep 17 00:00:00 2001
From: Yannick Warnier
".get_lang('SubTotal').'
',null, $total.' '.$label, 'child_of' =>$parent_id);
$sortable_data[] = $row;
From 88a25aa9778bcee4653f6804d8a968c370221207 Mon Sep 17 00:00:00 2001
From: Yannick Warnier ".get_lang('SubTotal').'
',null, $total.' '.$label, 'child_of' =>$parent_id);
$sortable_data[] = $row;
}
- }
- }
+ }
+ }
} //end looping categories
-
- if (api_is_allowed_to_edit()) {
+
+ if (api_is_allowed_to_edit()) {
if (count($main_cat) > 1) {
- $main_weight = intval($main_cat[0]->get_weight());
- if (intval($total_categories_weight) == $main_weight) {
+ $main_weight = intval($main_cat[0]->get_weight());
+ if (intval($total_categories_weight) == $main_weight) {
$total = score_badges(array($total_categories_weight.' / '.$main_weight, '100'));
- } else {
- $total = Display::badge($total_categories_weight.' / '.$main_weight, 'warning');
+ } else {
+ $total = Display::badge($total_categories_weight.' / '.$main_weight, 'warning');
}
$row = array(null, null, ''.get_lang('Total').'
', null, $total);
$sortable_data[] = $row;
@@ -387,9 +387,9 @@ class GradebookTable extends SortableTable {
}
// warning messages
- $view = isset($_GET['view']) ? $_GET['view']: null;
+ $view = isset($_GET['view']) ? $_GET['view']: null;
if (api_is_allowed_to_edit()) {
-
+
if (isset($_GET['selectcat']) && $_GET['selectcat'] > 0 && $view <> 'presence') {
$id_cat = intval($_GET['selectcat']);
$category = Category :: load($id_cat);
From 7eeb6ccbb4c82ac368f9ec35c2432add0c30f6ff Mon Sep 17 00:00:00 2001
From: Yannick Warnier ';
- $html .= '
';
+ $html = '';
- $html .= ' ';
- $html .= '';
- $html .= $form;
- $html .= ' ';
- $html .= '';
- $html .= $this->get_table_title();
- $html .= ' ';
- $html .= '';
- $html .= $nav;
- $html .= ' ';
- $html .= '';
+ $html .= '
';
}
- if (count($this->form_actions) > 0) {
- $params = $this->get_sortable_table_param_string().'&'.$this->get_additional_url_paramstring();
- $html .= '';
+ $html .= ' ';
+ $html .= '';
+ $html .= $form;
+ $html .= ' ';
+ $html .= '';
+ $html .= $this->get_table_title();
+ $html .= ' ';
+ $html .= '';
+ $html .= $nav;
+ $html .= ' ';
+ $html .= '';
- $html .= '
';
- if (count($this->form_actions) > 0) {
- $html .= '';
- $html .= ' ';
- $html .= '';
+ $html .= ' ';
+ $html .= '
';
+ if (count($this->form_actions) > 0) {
+ $html .= '';
+ }
+ }
+ return $html;
+ }
+
+ /**
+ * This function shows the content of a table in a grid.
+ * Should not be use to edit information (edit/delete rows) only.
+ * */
+ public function display_grid() {
+
+ $empty_table = false;
+ if ($this->get_total_number_of_items() == 0) {
+ $cols = $this->getColCount();
+ //$this->setCellAttributes(1, 0, 'style="font-style: italic;text-align:center;" colspan='.$cols);
+ $message_empty = api_xml_http_response_encode(get_lang('TheListIsEmpty'));
+ $this->setCellContents(1, 0, $message_empty);
+ $empty_table = true;
+ }
+ $html = '';
+ if (!$empty_table) {
+ $form = $this->get_page_select_form();
+ $nav = $this->get_navigation_html();
+
+ // @todo This style css must be moved to default.css only for dev
+ echo '';
+
+ // @todo This also must be moved
+
+ // Show only navigations if there are more than 1 page
+ $my_pager = $this->get_pager();
+
+ $html .= '';
+ $html .= ' ';
+ $html .= '';
- if (count($this->form_actions) > 0) {
+ if (count($this->form_actions) > 0) {
- $html .= ' ';
-
- if ($this->get_total_number_of_items() > $this->default_items_per_page) {
- $html .= '';
- $html .= $nav;
- $html .= ' ';
- }else{
- $html .= ' ';
- $html .= ' ';
+ } else {
+ $html .= $form;
+ }
+
+ $html .= '';
+
+ if ($this->get_total_number_of_items() > $this->default_items_per_page) {
+ $html .= '';
+ $html .= $nav;
+ $html .= ' ';
+ }else{
+ $html .= ' ';
+ $html .= ' ';
+ }
+
+ $html .= '';
- $html .= '
';
- $html .= ' ';
- $html .= '';
- if (count($this->form_actions) > 0) {
- $html .= '';
- }
- }
- */
- echo $html;
- }
-
- /**
- * This function returns the content of a table in a grid
- * Should not be use to edit information (edit/delete rows) only.
- * @param array options of visibility
- * @param bool hide navigation optionally
- * @param int content per page when show navigation (optional)
- * @param bool sort data optionally
- * @return string grid html
- */
- public function display_simple_grid($visibility_options, $hide_navigation = true, $per_page = 20, $sort_data = true, $grid_class = array()) {
-
- $empty_table = false;
- if ($this->get_total_number_of_items() == 0) {
- $cols = $this->getColCount();
- //$this->setCellAttributes(1, 0, 'style="font-style: italic;text-align:center;" colspan='.$cols);
- $message_empty = api_xml_http_response_encode(get_lang('TheListIsEmpty'));
- $this->setCellContents(1, 0, $message_empty);
- $empty_table = true;
- }
- $html = '';
- if (!$empty_table) {
- // If we show the pagination
- if (!$hide_navigation) {
- $form = ' ';
- if ($this->get_total_number_of_items() > $per_page) {
- if ($per_page > 10) {
- $form = $this->get_page_select_form();
- }
- $nav = $this->get_navigation_html();
- // This also must be moved
- $html = '';
- if (count($this->form_actions) > 0) {
- $html .= ' ';
- $html .= '
';
- $html .= ''.get_lang('SelectAll').' - ';
- $html .= ''.get_lang('UnSelectAll').' ';
- $html .= '';
- $html .= ' ';
- } else {
- $html .= $form;
- }
- $html .= '';
- $html .= $nav;
- $html .= ' ';
- $html .= '';
+ $html .= '
';
+ $html .= ' ';
+ $html .= '';
+ if (count($this->form_actions) > 0) {
+ $html .= '';
+ }
+ }
+ */
+ echo $html;
+ }
+
+ /**
+ * This function returns the content of a table in a grid
+ * Should not be use to edit information (edit/delete rows) only.
+ * @param array options of visibility
+ * @param bool hide navigation optionally
+ * @param int content per page when show navigation (optional)
+ * @param bool sort data optionally
+ * @return string grid html
+ */
+ public function display_simple_grid($visibility_options, $hide_navigation = true, $per_page = 20, $sort_data = true, $grid_class = array()) {
+
+ $empty_table = false;
+ if ($this->get_total_number_of_items() == 0) {
+ $cols = $this->getColCount();
+ //$this->setCellAttributes(1, 0, 'style="font-style: italic;text-align:center;" colspan='.$cols);
+ $message_empty = api_xml_http_response_encode(get_lang('TheListIsEmpty'));
+ $this->setCellContents(1, 0, $message_empty);
+ $empty_table = true;
+ }
+ $html = '';
+ if (!$empty_table) {
+ // If we show the pagination
+ if (!$hide_navigation) {
+ $form = ' ';
+ if ($this->get_total_number_of_items() > $per_page) {
+ if ($per_page > 10) {
+ $form = $this->get_page_select_form();
+ }
+ $nav = $this->get_navigation_html();
+ // This also must be moved
+ $html = '';
+ if (count($this->form_actions) > 0) {
+ $html .= ' ';
+ $html .= '
';
+ $html .= ''.get_lang('SelectAll').' - ';
+ $html .= ''.get_lang('UnSelectAll').' ';
+ $html .= '';
+ $html .= ' ';
+ } else {
+ $html .= $form;
+ }
+ $html .= '';
+ $html .= $nav;
+ $html .= ' ';
+ $html .= '$parameters['action'] = 'test'; will be convert in
+ * @param array $parameters
+ */
+ public function set_additional_parameters ($parameters) {
+ $this->additional_parameters = $parameters;
+ }
+ /**
+ * Set other tables on the same page.
+ * If you have other sortable tables on the page displaying this sortable
+ * tables, you can define those other tables with this function. If you
+ * don't define the other tables, there sorting and pagination will return
+ * to their default state when sorting this table.
+ * @param array $tablenames An array of table names.
+ */
+ public function set_other_tables ($tablenames) {
+ $this->other_tables = $tablenames;
+ }
+
+ /**
+ * Transform all data in a table-row, using the filters defined by the
+ * function set_column_filter(...) defined elsewhere in this class.
+ * If you've defined actions, the first element of the given row will be
+ * converted into a checkbox
+ * @param array $row A row from the table.
+ */
+ public function filter_data ($row) {
+ $url_params = $this->get_sortable_table_param_string().'&'.$this->get_additional_url_paramstring();
+ foreach ($this->column_filters as $column => & $function) {
+ $row[$column] = call_user_func($function, $row[$column], $url_params, $row);
+ }
+ if (count($this->form_actions) > 0) {
+ if (strlen($row[0]) > 0) {
+ $row[0] = 'param_prefix.'selectall'])) {
+ $row[0] .= ' checked="checked"';
+ }
+ $row[0] .= '/>';
+ }
+ }
+
+ foreach ($row as $index => & $value) {
+ if (empty($value)) {
+ $value = '-';
+ }
+ }
+ return $row;
+ }
+
+ /**
+ * Get the total number of items. This function calls the function given as
+ * 2nd argument in the constructor of a SortableTable. Make sure your
+ * function has the same parameters as defined here.
+ */
+ public function get_total_number_of_items () {
+ if ($this->total_number_of_items == -1 && !is_null($this->get_total_number_function)) {
+ $this->total_number_of_items = call_user_func($this->get_total_number_function);
+ }
+ return $this->total_number_of_items;
+ }
+
+ /**
+ * Get the data to display. This function calls the function given as
+ * 2nd argument in the constructor of a SortableTable. Make sure your
+ * function has the same parameters as defined here.
+ * @param int $from Index of the first item to return.
+ * @param int $per_page The number of items to return
+ * @param int $column The number of the column on which the data should be
* @param bool $sort Whether to sort or not
- * sorted
- * @param string $direction In which order should the data be sorted (ASC
- * or DESC)
- */
- public function get_table_data ($from = null, $per_page = null, $column = null, $direction = null, $sort = null) {
- if (!is_null($this->get_data_function)) {
- return call_user_func($this->get_data_function, $from, $this->per_page, $this->column, $this->direction);
- }
- return array ();
- }
+ * sorted
+ * @param string $direction In which order should the data be sorted (ASC
+ * or DESC)
+ */
+ public function get_table_data ($from = null, $per_page = null, $column = null, $direction = null, $sort = null) {
+ if (!is_null($this->get_data_function)) {
+ return call_user_func($this->get_data_function, $from, $this->per_page, $this->column, $this->direction);
+ }
+ return array ();
+ }
}
/**
@@ -891,42 +891,42 @@ class SortableTable extends HTML_Table {
* @package chamilo.library
*/
class SortableTableFromArray extends SortableTable {
- /**
- * The array containing all data for this table
- */
- public $table_data;
-
- /**
- * Constructor
- * @param array $table_data
- * @param int $default_column
- * @param int $default_items_per_page
- */
- public function __construct($table_data, $default_column = 1, $default_items_per_page = 20, $tablename = 'tablename') {
- parent :: __construct ($tablename, null, null, $default_column, $default_items_per_page);
- $this->table_data = $table_data;
- }
-
- /**
- * Get table data to show on current page
- * @see SortableTable#get_table_data
- */
- public function get_table_data($from = 1, $per_page = null, $column = null, $direction = null, $sort = true) {
- if ($sort) {
- $content = TableSort :: sort_table($this->table_data, $this->column, $this->direction == 'ASC' ? SORT_ASC : SORT_DESC);
- } else {
- $content = $this->table_data;
- }
- return array_slice($content, $from, $this->per_page);
- }
-
- /**
- * Get total number of items
- * @see SortableTable#get_total_number_of_items
- */
- public function get_total_number_of_items() {
- return count($this->table_data);
- }
+ /**
+ * The array containing all data for this table
+ */
+ public $table_data;
+
+ /**
+ * Constructor
+ * @param array $table_data
+ * @param int $default_column
+ * @param int $default_items_per_page
+ */
+ public function __construct($table_data, $default_column = 1, $default_items_per_page = 20, $tablename = 'tablename') {
+ parent :: __construct ($tablename, null, null, $default_column, $default_items_per_page);
+ $this->table_data = $table_data;
+ }
+
+ /**
+ * Get table data to show on current page
+ * @see SortableTable#get_table_data
+ */
+ public function get_table_data($from = 1, $per_page = null, $column = null, $direction = null, $sort = true) {
+ if ($sort) {
+ $content = TableSort :: sort_table($this->table_data, $this->column, $this->direction == 'ASC' ? SORT_ASC : SORT_DESC);
+ } else {
+ $content = $this->table_data;
+ }
+ return array_slice($content, $from, $this->per_page);
+ }
+
+ /**
+ * Get total number of items
+ * @see SortableTable#get_total_number_of_items
+ */
+ public function get_total_number_of_items() {
+ return count($this->table_data);
+ }
}
@@ -942,54 +942,54 @@ class SortableTableFromArray extends SortableTable {
*/
class SortableTableFromArrayConfig extends SortableTable {
- /**
- * The array containing the columns that will be show i.e $column_show=array('1','0','0'); we will show only the 1st column
- */
- private $column_show;
-
- /**
- *The array containing the real sort column $column_order=array('1''4','3','4'); The 2nd column will be order like the 4th column
- */
- private $column_order;
- /**
- * The array containing all data for this table
- */
- private $table_data;
-
- private $doc_filter;
-
- /**
- * Constructor
- * @param array $table_data All the information of the table
- * @param int $default_column Default column that will be use in the sorts functions
- * @param int $default_items_per_page quantity of pages that we are going to see
- * @param int $tablename Name of the table
- * @param array $column_show An array with binary values 1: we show the column 2: we don't show it
- * @param array $column_order An array of integers that let us decide how the columns are going to be sort.
- * @param bool special modification to fix the document name order
- */
- public function __construct ($table_data, $default_column = 1, $default_items_per_page = 20, $tablename = 'tablename', $column_show = null, $column_order = null, $direction = 'ASC', $doc_filter = false) {
- $this->column_show = $column_show;
- $this->column_order = $column_order;
- $this->doc_filter = $doc_filter;
- parent :: __construct ($tablename, null, null, $default_column, $default_items_per_page, $direction);
- $this->table_data = $table_data;
- }
-
- /**
- * Get table data to show on current page
- * @see SortableTable#get_table_data
- */
- public function get_table_data($from = 1, $per_page = null, $column = null, $direction = null, $sort = true) {
- $content = TableSort :: sort_table_config($this->table_data, $this->column, $this->direction == 'ASC' ? SORT_ASC : SORT_DESC, $this->column_show, $this->column_order, SORT_REGULAR, $this->doc_filter);
- return array_slice($content, $from, $this->per_page);
- }
-
- /**
- * Get total number of items
- * @see SortableTable#get_total_number_of_items
- */
- public function get_total_number_of_items() {
- return count($this->table_data);
- }
+ /**
+ * The array containing the columns that will be show i.e $column_show=array('1','0','0'); we will show only the 1st column
+ */
+ private $column_show;
+
+ /**
+ *The array containing the real sort column $column_order=array('1''4','3','4'); The 2nd column will be order like the 4th column
+ */
+ private $column_order;
+ /**
+ * The array containing all data for this table
+ */
+ private $table_data;
+
+ private $doc_filter;
+
+ /**
+ * Constructor
+ * @param array $table_data All the information of the table
+ * @param int $default_column Default column that will be use in the sorts functions
+ * @param int $default_items_per_page quantity of pages that we are going to see
+ * @param int $tablename Name of the table
+ * @param array $column_show An array with binary values 1: we show the column 2: we don't show it
+ * @param array $column_order An array of integers that let us decide how the columns are going to be sort.
+ * @param bool special modification to fix the document name order
+ */
+ public function __construct ($table_data, $default_column = 1, $default_items_per_page = 20, $tablename = 'tablename', $column_show = null, $column_order = null, $direction = 'ASC', $doc_filter = false) {
+ $this->column_show = $column_show;
+ $this->column_order = $column_order;
+ $this->doc_filter = $doc_filter;
+ parent :: __construct ($tablename, null, null, $default_column, $default_items_per_page, $direction);
+ $this->table_data = $table_data;
+ }
+
+ /**
+ * Get table data to show on current page
+ * @see SortableTable#get_table_data
+ */
+ public function get_table_data($from = 1, $per_page = null, $column = null, $direction = null, $sort = true) {
+ $content = TableSort :: sort_table_config($this->table_data, $this->column, $this->direction == 'ASC' ? SORT_ASC : SORT_DESC, $this->column_show, $this->column_order, SORT_REGULAR, $this->doc_filter);
+ return array_slice($content, $from, $this->per_page);
+ }
+
+ /**
+ * Get total number of items
+ * @see SortableTable#get_total_number_of_items
+ */
+ public function get_total_number_of_items() {
+ return count($this->table_data);
+ }
}
From 980c93e0ab2659355166b5b857ca6f8a651812bf Mon Sep 17 00:00:00 2001
From: Yannick Warnier ';
- if ($i % 2 == 0 && $i!=0) {
- echo '
';
- }
- $i++;
- }
- } //end foreach
- } else {
- echo get_lang('ToViewGraphScoreRuleMustBeEnabled');
- }
- // Pie charts
- /*
- $show_draw = false;
- $resource_list = array();
- //print_r($pre_result_pie);
-
- if ($total_users>0) {
- foreach($pre_result_pie as $key=>$res_array) {
- //$resource_list
- foreach($res_array as $user_result) {
- $total+= $user_result / ($total_users*100);
- }
- echo $total;
- //echo $total = $res / ($total_users*100);
- echo '
';
- //$DataSet->AddPoint($total,"Serie".$i);
- //$DataSet->SetSerieName($header_name[$i-1],"Serie".$i);
-
- }
- }
- //here--------------
- foreach($resource_list as $key=>$resource) {
- $new_resource_list = $new_resource_list_name = array();
-
- foreach($resource as $name=>$cant) {
- $new_resource_list[]=$cant;
- $new_resource_list_name[]=$name;
- }
- //Pie chart
- $DataSet = new pData;
- $DataSet->AddPoint($new_resource_list,"Serie1");
- $DataSet->AddPoint($new_resource_list_name,"Serie2");
- $DataSet->AddAllSeries();
- $DataSet->SetAbsciseLabelSerie("Serie2");
-
- $Test = new pChart(400,300);
- $Test->loadColorPalette(api_get_path(LIBRARY_PATH)."pchart/palette/soft_tones.txt");
- // background
- //$Test->drawFilledRoundedRectangle(7,7,293,193,5,240,240,240);
- // border color
- $Test->drawRoundedRectangle(5,5,295,195,5,230,230,230);
-
- // This will draw a shadow under the pie chart
- //$Test->drawFilledCircle(122,102,70,200,200,200);
-
- //Draw the pie chart
- $Test->setFontProperties(api_get_path(LIBRARY_PATH)."pchart/fonts/tahoma.ttf",8);
-
- $Test->drawBarGraph($DataSet->GetData(),$DataSet->GetDataDescription(),TRUE);
- $tmp_path = api_get_path(SYS_ARCHIVE_PATH);
-
- $Test->drawBasicPieGraph($DataSet->GetData(),$DataSet->GetDataDescription(),120,100,70,PIE_PERCENTAGE,255,255,218);
- $Test->drawPieLegend(230,15,$DataSet->GetData(),$DataSet->GetDataDescription(),250,250,250);
- $user_id = api_get_user_id();
- $img_file_generated_name = $key.uniqid('').'gradebook.png';
- $Test->Render($tmp_path.$img_file_generated_name);
- chmod($tmp_path.$img_file_generated_name, api_get_permissions_for_new_files());
-
- if ($i % 2 == 0 && $i!= 0) {
- echo '
';
- }
- echo '';
- }
- */
- }
- }
- /**
- * Function used by SortableTable to get total number of items in the table
- */
- function get_total_number_of_items() {
- return $this->datagen->get_total_users_count();
- }
-
- /**
- * Function used by SortableTable to generate the data to display
- */
- function get_table_data ($from = 1, $per_page = null, $column = null, $direction = null, $sort = null) {
- $is_western_name_order = api_is_western_name_order();
-
- // create page navigation if needed
- $totalitems = $this->datagen->get_total_items_count();
- if ($this->limit_enabled && $totalitems > LIMIT) {
- $selectlimit = LIMIT;
- } else {
- $selectlimit = $totalitems;
- }
- if ($this->limit_enabled && $totalitems > LIMIT) {
- $calcprevious = LIMIT;
- $header .= '
'
- .''
- .'
';
- echo $header;
- }
-
- // retrieve sorting type
- if ($is_western_name_order) {
- $users_sorting = ($this->column == 0 ? FlatViewDataGenerator :: FVDG_SORT_FIRSTNAME : FlatViewDataGenerator :: FVDG_SORT_LASTNAME);
- } else {
- $users_sorting = ($this->column == 0 ? FlatViewDataGenerator :: FVDG_SORT_LASTNAME : FlatViewDataGenerator :: FVDG_SORT_FIRSTNAME);
- }
- if ($this->direction == 'DESC') {
- $users_sorting |= FlatViewDataGenerator :: FVDG_SORT_DESC;
- } else {
- $users_sorting |= FlatViewDataGenerator :: FVDG_SORT_ASC;
- }
- // step 1: generate columns: evaluations and links
-
- $header_names = $this->datagen->get_header_names($this->offset, $selectlimit);
-
- $column = 0;
+ }
+
+ $Test->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(), SCALE_ADDALLSTART0, 150,150,150, TRUE, 0, 0, FALSE);
+
+ //background grid
+ $Test->drawGrid(4, TRUE,230,230,230,50);
+
+ // Draw the 0 line
+ //$Test->setFontProperties(api_get_path(LIBRARY_PATH)."pchart/fonts/tahoma.ttf",6);
+ //$Test->drawTreshold(0,143,55,72,TRUE,TRUE);
+
+ // Draw the bar graph
+ $Test->drawBarGraph($DataSet->GetData(),$DataSet->GetDataDescription(),TRUE);
+
+ //Set legend properties: width, height and text color and font
+ $Test->setFontProperties(api_get_path(LIBRARY_PATH)."pchart/fonts/tahoma.ttf",9);
+ $Test->drawLegend($area_graph_w+10, 50,$DataSet->GetDataDescription(),255,255,255);
+
+ //Set title properties
+ $Test->setFontProperties(api_get_path(LIBRARY_PATH)."pchart/fonts/tahoma.ttf",10);
+ $Test->drawTitle(50,22, strip_tags($header_name[$i-1]),50,50,80,$chart_size_w-50);
+
+ //------------------
+ //echo 'not in cache';
+ $Cache->WriteToCache($graph_id,$DataSet->GetData(),$Test);
+ ob_start();
+ $Test->Stroke();
+ ob_end_clean();
+ $img_file = $Cache->GetHash($graph_id,$DataSet->GetData());
+ }
+ echo '';
-
- // previous X
- $header .= ' ';
- if ($this->offset >= LIMIT) {
- $header .= ''
- .Display::return_icon('action_prev.png', get_lang('PreviousPage'), array(), 32)
- .'';
- } else {
- $header .= Display::return_icon('action_prev_na.png', get_lang('PreviousPage'), array(), 32);
- }
- $header .= ' ';
- // next X
- $calcnext = (($this->offset+(2*LIMIT)) > $totalitems) ?
- ($totalitems-(LIMIT+$this->offset)) : LIMIT;
-
- if ($calcnext > 0) {
- $header .= ''
- .Display::return_icon('action_next.png', get_lang('NextPage'), array(), 32)
- .'';
- } else {
- $header .= Display::return_icon('action_next_na.png', get_lang('NextPage'), array(), 32);
- }
- $header .= ' ';
- $header .= '';
+ if ($i % 2 == 0 && $i!=0) {
+ echo '
';
+ }
+ $i++;
+ }
+ } //end foreach
+ } else {
+ echo get_lang('ToViewGraphScoreRuleMustBeEnabled');
+ }
+ // Pie charts
+ /*
+ $show_draw = false;
+ $resource_list = array();
+ //print_r($pre_result_pie);
+
+ if ($total_users>0) {
+ foreach($pre_result_pie as $key=>$res_array) {
+ //$resource_list
+ foreach($res_array as $user_result) {
+ $total+= $user_result / ($total_users*100);
+ }
+ echo $total;
+ //echo $total = $res / ($total_users*100);
+ echo '
';
+ //$DataSet->AddPoint($total,"Serie".$i);
+ //$DataSet->SetSerieName($header_name[$i-1],"Serie".$i);
+
+ }
+ }
+ //here--------------
+ foreach($resource_list as $key=>$resource) {
+ $new_resource_list = $new_resource_list_name = array();
+
+ foreach($resource as $name=>$cant) {
+ $new_resource_list[]=$cant;
+ $new_resource_list_name[]=$name;
+ }
+ //Pie chart
+ $DataSet = new pData;
+ $DataSet->AddPoint($new_resource_list,"Serie1");
+ $DataSet->AddPoint($new_resource_list_name,"Serie2");
+ $DataSet->AddAllSeries();
+ $DataSet->SetAbsciseLabelSerie("Serie2");
+
+ $Test = new pChart(400,300);
+ $Test->loadColorPalette(api_get_path(LIBRARY_PATH)."pchart/palette/soft_tones.txt");
+ // background
+ //$Test->drawFilledRoundedRectangle(7,7,293,193,5,240,240,240);
+ // border color
+ $Test->drawRoundedRectangle(5,5,295,195,5,230,230,230);
+
+ // This will draw a shadow under the pie chart
+ //$Test->drawFilledCircle(122,102,70,200,200,200);
+
+ //Draw the pie chart
+ $Test->setFontProperties(api_get_path(LIBRARY_PATH)."pchart/fonts/tahoma.ttf",8);
+
+ $Test->drawBarGraph($DataSet->GetData(),$DataSet->GetDataDescription(),TRUE);
+ $tmp_path = api_get_path(SYS_ARCHIVE_PATH);
+
+ $Test->drawBasicPieGraph($DataSet->GetData(),$DataSet->GetDataDescription(),120,100,70,PIE_PERCENTAGE,255,255,218);
+ $Test->drawPieLegend(230,15,$DataSet->GetData(),$DataSet->GetDataDescription(),250,250,250);
+ $user_id = api_get_user_id();
+ $img_file_generated_name = $key.uniqid('').'gradebook.png';
+ $Test->Render($tmp_path.$img_file_generated_name);
+ chmod($tmp_path.$img_file_generated_name, api_get_permissions_for_new_files());
+
+ if ($i % 2 == 0 && $i!= 0) {
+ echo '
';
+ }
+ echo '';
+ }
+ */
+ }
+ }
+ /**
+ * Function used by SortableTable to get total number of items in the table
+ */
+ function get_total_number_of_items() {
+ return $this->datagen->get_total_users_count();
+ }
+
+ /**
+ * Function used by SortableTable to generate the data to display
+ */
+ function get_table_data ($from = 1, $per_page = null, $column = null, $direction = null, $sort = null) {
+ $is_western_name_order = api_is_western_name_order();
+
+ // create page navigation if needed
+ $totalitems = $this->datagen->get_total_items_count();
+ if ($this->limit_enabled && $totalitems > LIMIT) {
+ $selectlimit = LIMIT;
+ } else {
+ $selectlimit = $totalitems;
+ }
+ if ($this->limit_enabled && $totalitems > LIMIT) {
+ $calcprevious = LIMIT;
+ $header .= '
'
+ .''
+ .'
';
+ echo $header;
+ }
+
+ // retrieve sorting type
+ if ($is_western_name_order) {
+ $users_sorting = ($this->column == 0 ? FlatViewDataGenerator :: FVDG_SORT_FIRSTNAME : FlatViewDataGenerator :: FVDG_SORT_LASTNAME);
+ } else {
+ $users_sorting = ($this->column == 0 ? FlatViewDataGenerator :: FVDG_SORT_LASTNAME : FlatViewDataGenerator :: FVDG_SORT_FIRSTNAME);
+ }
+ if ($this->direction == 'DESC') {
+ $users_sorting |= FlatViewDataGenerator :: FVDG_SORT_DESC;
+ } else {
+ $users_sorting |= FlatViewDataGenerator :: FVDG_SORT_ASC;
+ }
+ // step 1: generate columns: evaluations and links
+
+ $header_names = $this->datagen->get_header_names($this->offset, $selectlimit);
+
+ $column = 0;
- if ($is_western_name_order) {
- $this->set_header($column++, $header_names[1]);
- $this->set_header($column++, $header_names[0]);
- } else {
- $this->set_header($column++, $header_names[0]);
- $this->set_header($column++, $header_names[1]);
- }
-
- while ($column < count($header_names)) {
- $this->set_header($column, $header_names[$column], false);
- $column++;
- }
-
- $data_array = $this->datagen->get_data($users_sorting, $from, $this->per_page, $this->offset, $selectlimit);
-
- $table_data = array();
- foreach ($data_array as $user_row) {
- $table_row = array ();
- $count = 0;
- $user_id = $user_row[$count++];
- $lastname = $user_row[$count++];
- $firstname = $user_row[$count++];
- if ($is_western_name_order) {
- $table_row[] = $this->build_name_link($user_id, $firstname);
- $table_row[] = $this->build_name_link($user_id, $lastname);
- } else {
- $table_row[] = $this->build_name_link($user_id, $lastname);
- $table_row[] = $this->build_name_link($user_id, $firstname);
- }
- while ($count < count($user_row)) {
- $table_row[] = $user_row[$count++];
- }
- $table_data[]= $table_row;
- }
- return $table_data;
- }
-
-
- // Other functions
-
- private function build_name_link ($user_id, $name) {
- return ''.$name.'';
- }
+ if ($is_western_name_order) {
+ $this->set_header($column++, $header_names[1]);
+ $this->set_header($column++, $header_names[0]);
+ } else {
+ $this->set_header($column++, $header_names[0]);
+ $this->set_header($column++, $header_names[1]);
+ }
+
+ while ($column < count($header_names)) {
+ $this->set_header($column, $header_names[$column], false);
+ $column++;
+ }
+
+ $data_array = $this->datagen->get_data($users_sorting, $from, $this->per_page, $this->offset, $selectlimit);
+
+ $table_data = array();
+ foreach ($data_array as $user_row) {
+ $table_row = array ();
+ $count = 0;
+ $user_id = $user_row[$count++];
+ $lastname = $user_row[$count++];
+ $firstname = $user_row[$count++];
+ if ($is_western_name_order) {
+ $table_row[] = $this->build_name_link($user_id, $firstname);
+ $table_row[] = $this->build_name_link($user_id, $lastname);
+ } else {
+ $table_row[] = $this->build_name_link($user_id, $lastname);
+ $table_row[] = $this->build_name_link($user_id, $firstname);
+ }
+ while ($count < count($user_row)) {
+ $table_row[] = $user_row[$count++];
+ }
+ $table_data[]= $table_row;
+ }
+ return $table_data;
+ }
+
+
+ // Other functions
+
+ private function build_name_link ($user_id, $name) {
+ return ''.$name.'';
+ }
}
From be62316a8364135e1b0c563e8181bb96bf3bcc53 Mon Sep 17 00:00:00 2001
From: Yoselyn Castillo ';
+
+ // previous X
+ $header .= ' ';
+ if ($this->offset >= LIMIT) {
+ $header .= ''
+ .Display::return_icon('action_prev.png', get_lang('PreviousPage'), array(), 32)
+ .'';
+ } else {
+ $header .= Display::return_icon('action_prev_na.png', get_lang('PreviousPage'), array(), 32);
+ }
+ $header .= ' ';
+ // next X
+ $calcnext = (($this->offset+(2*LIMIT)) > $totalitems) ?
+ ($totalitems-(LIMIT+$this->offset)) : LIMIT;
+
+ if ($calcnext > 0) {
+ $header .= ''
+ .Display::return_icon('action_next.png', get_lang('NextPage'), array(), 32)
+ .'';
+ } else {
+ $header .= Display::return_icon('action_next_na.png', get_lang('NextPage'), array(), 32);
+ }
+ $header .= ' ';
+ $header .= '