Beispiel #1
0
 public function loadPortlet($label)
 {
     $sql = "SELECT\n                    `label`,\n                    `name`,\n                    `rank`,\n                    `visibility`\n                FROM `" . $this->tblDesktopPortlet . "`\n                WHERE label = '" . claro_sql_escape($label) . "'";
     $data = claro_sql_query_get_single_row($sql);
     if (empty($data)) {
         return false;
     } else {
         return $data;
     }
 }
Beispiel #2
0
 /**
  * Load action from DB
  *
  * @param $action_name
  * @param $toolId
  * @return boolean load successfull ?
  */
 public function load($actionName, $toolId)
 {
     $sql = "SELECT id,\n                       name,\n                       description,\n                       tool_id,\n                       type\n                FROM `" . $this->tbl['action'] . "`\n                WHERE name = '" . claro_sql_escape($actionName) . "'\n                AND `tool_id` =  " . (int) $toolId;
     $data = claro_sql_query_get_single_row($sql);
     if (!empty($data)) {
         $this->id = $data['id'];
         $this->name = $data['name'];
         $this->description = $data['description'];
         $this->toolId = $data['tool_id'];
         $this->type = $data['type'];
         return true;
     } else {
         return false;
     }
 }
 /**
  * load a description from DB
  *
  * @param integer $id id of description
  * @return boolean true if load is successfull false otherwise
  * @author Sebastien Piraux <*****@*****.**>
  */
 public function load($id)
 {
     $sql = "SELECT `id`,\n                       `category`,\n                       `title`,\n                       `content`,\n                       UNIX_TIMESTAMP(`lastEditDate`) AS `unix_lastEditDate`,\n                       `visibility`\n                FROM `" . $this->tblCourseDescription . "`\n                WHERE `id` = " . (int) $id;
     $data = claro_sql_query_get_single_row($sql);
     if (!empty($data)) {
         $this->setId($id);
         $this->setCategory($data['category']);
         $this->setTitle($data['title']);
         $this->setContent($data['content']);
         $this->setLastEditDate($data['unix_lastEditDate']);
         $this->setVisibility($data['visibility']);
         return true;
     } else {
         return false;
     }
 }
Beispiel #4
0
/**
 * CLAROLINE
 *
 * @version     $Revision: 14314 $
 * @copyright   (c) 2001-2011, Universite catholique de Louvain (UCL)
 * @license     http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE
 * @author      Piraux Sebastien <*****@*****.**>
 * @author      Lederer Guillaume <*****@*****.**>
 * @package     CLLNP
 * @since       1.8
 */
function lp_display_exercise($cmd, $TABLELEARNPATHMODULE, $TABLEMODULE, $TABLEASSET, $tbl_quiz_exercise)
{
    $out = '';
    if (isset($cmd) && ($cmd = "raw")) {
        // change raw if value is a number between 0 and 100
        if (isset($_POST['newRaw']) && is_num($_POST['newRaw']) && $_POST['newRaw'] <= 100 && $_POST['newRaw'] >= 0) {
            $sql = "UPDATE `" . $TABLELEARNPATHMODULE . "`\n                    SET `raw_to_pass` = " . (int) $_POST['newRaw'] . "\n                    WHERE `module_id` = " . (int) $_SESSION['module_id'] . "\n                    AND `learnPath_id` = " . (int) $_SESSION['path_id'];
            claro_sql_query($sql);
            $dialogBoxContent = get_lang('Minimum raw to pass has been changed');
        }
    }
    $out .= '<hr noshade="noshade" size="1" />';
    //####################################################################################\\
    //############################### DIALOG BOX SECTION #################################\\
    //####################################################################################\\
    if (!empty($dialogBoxContent)) {
        $dialogBox = new DialogBox();
        $dialogBox->success($dialogBoxContent);
        $out .= $dialogBox->render();
    }
    // form to change raw needed to pass the exercise
    $sql = "SELECT `lock`, `raw_to_pass`\n            FROM `" . $TABLELEARNPATHMODULE . "` AS LPM\n           WHERE LPM.`module_id` = " . (int) $_SESSION['module_id'] . "\n             AND LPM.`learnPath_id` = " . (int) $_SESSION['path_id'];
    $learningPath_module = claro_sql_query_get_single_row($sql);
    // if this module blocks the user if he doesn't complete
    if (isset($learningPath_module['lock']) && $learningPath_module['lock'] == 'CLOSE' && isset($learningPath_module['raw_to_pass'])) {
        $out .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">' . "\n" . claro_form_relay_context() . '<label for="newRaw">' . get_lang('Change minimum raw mark to pass this module (percentage) :') . ' </label>' . "\n" . '<input type="text" value="' . claro_htmlspecialchars($learningPath_module['raw_to_pass']) . '" name="newRaw" id="newRaw" size="3" maxlength="3" /> % ' . "\n" . '<input type="hidden" name="cmd" value="raw" />' . "\n" . '<input type="submit" value="' . get_lang('Ok') . '" />' . "\n" . '</form>' . "\n\n";
    }
    // display current exercise info and change comment link
    $sql = "SELECT `E`.`id` AS `exerciseId`, `M`.`name`\n            FROM `" . $TABLEMODULE . "` AS `M`,\n                 `" . $TABLEASSET . "`  AS `A`,\n                 `" . $tbl_quiz_exercise . "` AS `E`\n           WHERE `A`.`module_id` = M.`module_id`\n             AND `M`.`module_id` = " . (int) $_SESSION['module_id'] . "\n             AND `E`.`id` = `A`.`path`";
    $module = claro_sql_query_get_single_row($sql);
    if ($module) {
        $out .= "\n\n" . '<h4>' . get_lang('Exercise in module') . ' :</h4>' . "\n" . '<p>' . "\n" . claro_htmlspecialchars($module['name']) . '<a href="../exercise/admin/edit_exercise.php?exId=' . $module['exerciseId'] . '">' . '<img src="' . get_icon_url('edit') . '" alt="' . get_lang('Modify') . '" />' . '</a>' . "\n" . '</p>' . "\n";
    }
    // else sql error, do nothing except in debug mode, where claro_sql_query_fetch_all will show the error
    return $out;
}
Beispiel #5
0
function getCategoryTitle($categoryId)
{
    $tbl_cdb_names = get_module_course_tbl(array('qwz_questions_categories'), claro_get_current_course_id());
    $tblQuestionCategories = $tbl_cdb_names['qwz_questions_categories'];
    $sql = "SELECT `title` FROM  `" . $tblQuestionCategories . "` WHERE `id`= '" . (int) $categoryId . "'";
    $data = claro_sql_query_get_single_row($sql);
    if (!empty($data)) {
        // from query
        return $data['title'];
    } else {
        return '';
    }
}
$tbl_qwz_tracking_questions = $tbl_cdb_names['qwz_tracking_questions'];
$tbl_qwz_tracking_answers = $tbl_cdb_names['qwz_tracking_answers'];
// all I need from REQUEST is the track_id and it is required
if (isset($_REQUEST['trackedExId']) && is_numeric($_REQUEST['trackedExId'])) {
    $trackedExId = (int) $_REQUEST['trackedExId'];
} else {
    claro_redirect("./exercise.php");
    exit;
}
$dialogBox = new DialogBox();
//-- get infos
// get infos about the exercise
// get infos about the user
// get infos about the exercise attempt
$sql = "SELECT `E`.`id`, `E`.`title`, `E`.`showAnswers`, `E`.`attempts`,\n                `U`.`user_id`, `U`.`nom` as `lastname`, `U`.`prenom` as `firstname`,\n                `TE`.`exo_id`, `TE`.`result`, `TE`.`time`, `TE`.`weighting`,\n                UNIX_TIMESTAMP(`TE`.`date`) AS `unix_exe_date`\n        FROM `" . $tbl_qwz_exercise . "` as `E`, `" . $tbl_qwz_tracking . "` as `TE`, `" . $tbl_user . "` as `U`\n        WHERE `E`.`id` = `TE`.`exo_id`\n        AND `TE`.`user_id` = `U`.`user_id`\n        AND `TE`.`id` = " . $trackedExId;
if (!($thisAttemptDetails = claro_sql_query_get_single_row($sql))) {
    // sql error, let's get out of here !
    claro_redirect("./exercise.php");
    exit;
}
//-- permissions
// if a user want to see its own results the teacher must have allowed the students
// to see the answers at the end of the exercise
$is_allowedToTrack = false;
if (claro_is_user_authenticated()) {
    if (claro_is_course_manager()) {
        $is_allowedToTrack = true;
    } elseif (claro_get_current_user_id() == $thisAttemptDetails['user_id']) {
        if ($thisAttemptDetails['showAnswers'] == 'ALWAYS') {
            $is_allowedToTrack = true;
        } elseif ($thisAttemptDetails['showAnswers'] == 'LASTTRY') {
 function announcement_get_item($announcement_id, $course_id = NULL)
 {
     $tbl = claro_sql_get_course_tbl(claro_get_course_db_name_glued($course_id));
     $sql = "SELECT                id,\n\t\t\t\t\t\t\t\t\t  title,\n\t\t\t\t\t   contenu     AS content,\n\t\t\t\t\t\t   temps   AS `time`,\n\t\t\t\t\t\t\t\t\t  visibility,\n\t\t\t\t\t   ordre       AS rank\n\t\t\t\tFROM  `" . $tbl['announcement'] . "`\n\t\t\t\tWHERE id=" . (int) $announcement_id;
     $announcement = claro_sql_query_get_single_row($sql);
     if ($announcement) {
         return $announcement;
     } else {
         return claro_failure::set_failure('ANNOUNCEMENT_UNKNOW');
     }
 }
Beispiel #8
0
            if ($resultBrowsed['lesson_status'] == "COMPLETED") {
                $statusToDisplay = get_lang('Already browsed');
            } else {
                $statusToDisplay = get_lang('Never browsed');
            }
        } else {
            $statusToDisplay = $resultBrowsed['lesson_status'];
        }
        $out .= '<tr>' . "\n" . '<td>' . get_lang('Module status') . '</td>' . "\n" . '<td>' . $statusToDisplay . '</td>' . "\n" . '</tr>' . "\n\n" . '</tbody>' . "\n\n" . '</table>' . "\n\n";
    }
    //end display stats
    /* START */
    // check if module.startAssed_id is set and if an asset has the corresponding asset_id
    // asset_id exists ?  for the good module  ?
    $sql = "SELECT `asset_id`\n              FROM `" . $TABLEASSET . "`\n             WHERE `asset_id` = " . (int) $module['startAsset_id'] . "\n               AND `module_id` = " . (int) $_SESSION['module_id'];
    $asset = claro_sql_query_get_single_row($sql);
    if ($module['startAsset_id'] != "" && $asset['asset_id'] == $module['startAsset_id']) {
        $out .= '<center>' . "\n" . '<form action="./navigation/viewer.php" method="post">' . "\n" . claro_form_relay_context() . '<input type="submit" value="' . get_lang('Start Module') . '" />' . "\n" . '</form>' . "\n" . '</center>' . "\n\n";
    } else {
        $out .= '<p><center>' . get_lang('There is no start asset defined for this module.') . '</center></p>' . "\n";
    }
}
// end if($module['contentType'] != CTLABEL_)
// if module is a label, only allow to change its name.
//####################################################################################\\
//################################# ADMIN DISPLAY ####################################\\
//####################################################################################\\
if ($is_allowedToEdit) {
    switch ($module['contentType']) {
        case CTDOCUMENT_:
            require "./include/document.inc.php";
Beispiel #9
0
}
/*---------------------------------------------------------------------------
  Course / tool relation initialisation
 ---------------------------------------------------------------------------*/
// if the requested tool is different from the current tool in session
// (special request can come from the tool id, or the tool label)
if ($tidReq && $tidReq != $_SESSION['_tid'] || $tlabelReq && (!isset($_SESSION['_courseTool']['label']) || $tlabelReq != $_SESSION['_courseTool']['label'])) {
    $tidReset = true;
}
if ($tidReset || $cidReset) {
    if (($tidReq || $tlabelReq) && $_cid) {
        $tbl_mdb_names = claro_sql_get_main_tbl();
        $tbl_tool = $tbl_mdb_names['tool'];
        $sql = " SELECT ctl.id                  AS id            ,\n                      pct.id                    AS toolId       ,\n                      pct.claro_label           AS label         ,\n                      ctl.script_name           AS name          ,\n                      ctl.visibility            AS visibility    ,\n                      pct.icon                  AS icon          ,\n                      pct.access_manager        AS access_manager,\n                      pct.script_url            AS url\n\n                   FROM `" . $_course['dbNameGlu'] . "tool_list` ctl,\n                    `" . $tbl_tool . "`  pct\n\n               WHERE `ctl`.`tool_id` = `pct`.`id`\n                 AND (`ctl`.`id`      = '" . (int) $tidReq . "'\n                       OR   (" . (int) is_null($tidReq) . " AND pct.claro_label = '" . claro_sql_escape($tlabelReq) . "')\n                     )";
        // Note : 'ctl' stands for  'course tool list' and  'pct' for 'platform course tool'
        $_courseTool = claro_sql_query_get_single_row($sql);
        if (is_array($_courseTool)) {
            $_tid = $_courseTool['id'];
            $_mainToolId = $_courseTool['toolId'];
        } else {
            $activatedModules = get_module_label_list(true);
            if (!in_array($tlabelReq, $activatedModules)) {
                exit('WARNING !! Undefined Tlabel or Tid: your script declare ' . 'be a tool wich is not registred at line ' . __LINE__ . '.  ' . 'Please contact your platform administrator.');
            } else {
                $_tid = null;
                $_mainToolId = null;
                $_courseTool = null;
            }
        }
    } else {
        // course
Beispiel #10
0
/**
 * get the definition of a category
 *
 * @param  int $catId - id of the categories
 * @return array containing 'id', 'title', 'comment', and 'nbline',
 */
function claro_user_info_get_cat_def($catId, $course_id = NULL)
{
    $tbl_cdb_names = claro_sql_get_course_tbl(claro_get_course_db_name_glued($course_id));
    $tbl_userinfo_def = $tbl_cdb_names['userinfo_def'];
    $sql = "SELECT id, title, comment, nbline, rank\n            FROM `" . $tbl_userinfo_def . "`\n            WHERE id = " . (int) $catId;
    $catDef = claro_sql_query_get_single_row($sql);
    return $catDef;
}
Beispiel #11
0
 /**
  * load answers in object
  *
  * @author Sebastien Piraux <*****@*****.**>
  * @return boolean result of operation
  */
 public function load()
 {
     $sql = "SELECT\n                    `id`,\n                    `answer`,\n                    `gradeList`,\n                    `wrongAnswerList`,\n                    `type`\n            FROM `" . $this->tblAnswer . "`\n            WHERE `questionId` = " . (int) $this->questionId;
     $data = claro_sql_query_get_single_row($sql);
     if (!empty($data)) {
         $this->id = (int) $data['id'];
         $this->answerText = $data['answer'];
         if (!empty($data['gradeList'])) {
             $this->gradeList = explode(',', $data['gradeList']);
         }
         if (!empty($data['wrongAnswerList'])) {
             $this->wrongAnswerList = explode(',', $data['wrongAnswerList']);
         }
         $this->type = $data['type'];
         $this->setAnswerList();
         return true;
     } else {
         return false;
     }
 }
Beispiel #12
0
/**
 * CLAROLINE SQL query wrapper returning only the first row of the result
 * Useful in some cases because, it avoid nested arrays of results.
 *
 * @param  string  $sqlQuery  the sql query
 * @param  handler $dbHandler optional
 * @return associative array containing all the result column
 * @since  1.9.*
 * @see    claro_sql_query_get_single_row()
 * @deprecated since Claroline 1.9, use Claroline::getDatabase() and new classes
 *  in database/database.lib.php instead
 */
function claro_sql_query_fetch_single_row($sqlQuery, $dbHandler = '#')
{
    return claro_sql_query_get_single_row($sqlQuery, $dbHandler);
}
Beispiel #13
0
 /**
  * Courses are often identified through their code (sysCode).  But
  * sometimes their identifier (integer) can be useful.  This
  * method permits to easily get the id of a course based on
  * its code.
  *
  * @param string    course code (sysCode)
  * @return int      course identifier
  * @since 1.10
  */
 public static function getIdFromCode($code)
 {
     // Declare needed tables
     $tbl_mdb_names = claro_sql_get_main_tbl();
     $tbl_course = $tbl_mdb_names['course'];
     $sql = "SELECT c.cours_id AS id\n                \n                FROM `" . $tbl_course . "` AS c\n                WHERE c.code = '" . $code . "'";
     if ($result = claro_sql_query_get_single_row($sql)) {
         return $result['id'];
     } else {
         return null;
     }
 }
Beispiel #14
0
/**
 * Remove a module from a dock in which the module displays
 * @param integer $moduleId
 * @param string  $dockName
 */
function remove_module_dock($moduleId, $dockName)
{
    $tbl = claro_sql_get_main_tbl();
    // call of this function to remove ALL occurence of the module in any dock
    if ('ALL' == $dockName) {
        //1- find all dock in which the dock displays
        $sql = "SELECT `name` AS dockName\n              FROM   `" . $tbl['dock'] . "`\n              WHERE  `module_id` = " . (int) $moduleId;
        $dockList = claro_sql_query_fetch_all($sql);
        //2- re-call of this function which each dock concerned
        foreach ($dockList as $dock) {
            remove_module_dock($moduleId, $dock['dockName']);
        }
    } else {
        //find the rank of the module in this dock :
        $sql = "SELECT `rank` AS oldRank\n                FROM   `" . $tbl['dock'] . "`\n                WHERE  `module_id` = " . (int) $moduleId . "\n                AND    `name` = '" . $dockName . "'";
        $module = claro_sql_query_get_single_row($sql);
        //move up all modules displayed in this dock
        $sql = "UPDATE `" . $tbl['dock'] . "`\n                SET `rank` = `rank` - 1\n                WHERE `name` = '" . $dockName . "'\n                AND `rank` > " . (int) $module['oldRank'];
        claro_sql_query($sql);
        //delete the module line in the dock table
        $sql = "DELETE FROM `" . $tbl['dock'] . "`\n                WHERE `module_id` = " . (int) $moduleId . "\n                AND   `name` = '" . $dockName . "'";
        claro_sql_query($sql);
        generate_module_cache();
    }
}
Beispiel #15
0
 public function mergeCourseUsers($uidToRemove, $uidToKeep, $courseId)
 {
     $error = false;
     $moduleCourseTbl = get_module_course_tbl(array('bb_posts', 'bb_topics', 'bb_priv_msgs', 'bb_rel_forum_userstonotify', 'bb_rel_topic_userstonotify'), $courseId);
     $userToKeepProp = user_get_properties($uidToKeep);
     $sql = "UPDATE `{$moduleCourseTbl['bb_posts']}`\n                SET     poster_id = " . (int) $uidToKeep . ",\n                        nom = '" . claro_sql_escape($userToKeepProp['lastname']) . "',\n                        prenom = '" . claro_sql_escape($userToKeepProp['firstname']) . "'\n                WHERE poster_id = " . (int) $uidToRemove;
     if (!claro_sql_query($sql)) {
         Console::error("Cannot update bb_posts from -{$uidToRemove} to +{$uidToKeep} in {$courseId}");
         $error = true;
         return !$error;
     }
     // Update topic poster, lastname & firstname
     $sql = "UPDATE `{$moduleCourseTbl['bb_topics']}`\n                SET topic_poster = " . (int) $uidToKeep . ",\n                nom = '" . claro_sql_escape($userToKeepProp['lastname']) . "',\n                prenom = '" . claro_sql_escape($userToKeepProp['firstname']) . "'\n                WHERE topic_poster = " . (int) $uidToRemove;
     if (!claro_sql_query($sql)) {
         // echo mysql_error();
         Console::error("Cannot update bb_topics from -{$uidToRemove} to +{$uidToKeep} in {$courseId}");
         $error = true;
         return !$error;
     }
     // Update private messages (from)
     $sql = "UPDATE `{$moduleCourseTbl['bb_priv_msgs']}`\n                SET from_userid = " . (int) $uidToKeep . "\n                WHERE from_userid = " . (int) $uidToRemove;
     if (!claro_sql_query($sql)) {
         Console::error("Cannot update bb_priv_msgs:recipient from -{$uidToRemove} to +{$uidToKeep} in {$courseId}");
         $error = true;
         return !$error;
     }
     // Update private messages (to)
     $sql = "UPDATE `{$moduleCourseTbl['bb_priv_msgs']}`\n                SET to_userid = " . (int) $uidToKeep . "\n                WHERE to_userid = " . (int) $uidToRemove;
     if (!claro_sql_query($sql)) {
         Console::error("Cannot update bb_priv_msgs:sender from -{$uidToRemove} to +{$uidToKeep} in {$courseId}");
         $error = true;
         return !$error;
     }
     // Update topic notification
     $sql = "SELECT `topic_id`\n                FROM `{$moduleCourseTbl['bb_rel_topic_userstonotify']}`\n                WHERE `user_id` = " . (int) $uidToRemove;
     $topicIds = claro_sql_query_fetch_all($sql);
     if (!empty($topicIds)) {
         foreach ($topicIds as $_topicId) {
             $topicId = $_topicId['topic_id'];
             $sql = "SELECT `notify_id`\n                        FROM `{$moduleCourseTbl['bb_rel_topic_userstonotify']}`\n                        WHERE `user_id` = " . (int) $uidToRemove . " AND `topic_id` = " . (int) $topicId . "\n                        LIMIT 1";
             $notify = claro_sql_query_get_single_row($sql);
             if (!empty($notify)) {
                 // Update notification for userToRemove to userToKeep
                 $sql = "UPDATE `{$moduleCourseTbl['bb_rel_topic_userstonotify']}`\n                            SET user_id = " . (int) $uidToKeep . "\n                            WHERE notify_id = " . (int) $notify['notify_id'];
                 if (!claro_sql_query($sql)) {
                     Console::error("Cannot update bb_rel_topic_userstonotify from -{$uidToRemove} to +{$uidToKeep} in {$courseId}");
                     $error = true;
                 }
             }
             // Delete the notification for userToRemove
             $sql = "DELETE FROM `{$moduleCourseTbl['bb_rel_topic_userstonotify']}` WHERE `user_id` = " . (int) $uidToRemove;
             if (!claro_sql_query($sql)) {
                 Console::error("Cannot delete bb_rel_topic_userstonotify from -{$uidToRemove} to +{$uidToKeep} in {$courseId}");
                 $error = true;
             }
         }
     }
     // Update forum notification
     $sql = "SELECT `forum_id`\n                FROM `{$moduleCourseTbl['bb_rel_forum_userstonotify']}`\n                WHERE `user_id` = " . (int) $uidToRemove;
     $forumIds = claro_sql_query_fetch_all($sql);
     if (!empty($forumIds)) {
         foreach ($forumIds as $_forumId) {
             $forumId = $_forumId['forum_id'];
             $sql = "SELECT `notify_id`\n                        FROM `{$moduleCourseTbl['bb_rel_forum_userstonotify']}`\n                        WHERE `user_id` = " . (int) $uidToRemove . " AND `forum_id` = " . (int) $forumId . "\n                        LIMIT 1";
             $notify = claro_sql_query_get_single_row($sql);
             if (!empty($notify)) {
                 // Update notification for userToRemove to userToKeep
                 $sql = "UPDATE `{$moduleCourseTbl['bb_rel_forum_userstonotify']}`\n                            SET user_id = " . (int) $uidToKeep . "\n                            WHERE notify_id = " . (int) $notify['notify_id'];
                 if (!claro_sql_query($sql)) {
                     Console::error("Cannot update bb_rel_forum_userstonotify from -{$uidToRemove} to +{$uidToKeep} in {$courseId}");
                     $error = true;
                 }
             }
             // Delete the notification for userToRemove
             $sql = "DELETE FROM `{$moduleCourseTbl['bb_rel_form_userstonotify']}` WHERE `user_id` = " . (int) $uidToRemove;
             if (!claro_sql_query($sql)) {
                 Console::error("Cannot delete bb_rel_forum_userstonotify from -{$uidToRemove} to +{$uidToKeep} in {$courseId}");
                 $error = true;
             }
         }
     }
     return !$error;
 }
Beispiel #16
0
/**
 * Upgrade foo tool to 1.8
 *
 * explanation of task
 *
 * @param $course_code string
 * @return boolean whether true if succeed
 */
function group_upgrade_to_18($course_code)
{
    global $currentCourseVersion;
    $versionRequiredToProceed = '/^1.7/';
    $tool = 'CLGRP';
    $currentCourseDbNameGlu = claro_get_course_db_name_glued($course_code);
    if (preg_match($versionRequiredToProceed, $currentCourseVersion)) {
        // On init , $step = 1
        switch ($step = get_upgrade_status($tool, $course_code)) {
            case 1:
                $sql_step1 = " CREATE TABLE\n                        `" . $currentCourseDbNameGlu . "course_properties`\n                        (\n                            `id` int(11) NOT NULL auto_increment,\n                            `name` varchar(255) NOT NULL default '',\n                            `value` varchar(255) default NULL,\n                            `category` varchar(255) default NULL,\n                            PRIMARY KEY  (`id`)\n                        ) ENGINE=MyISAM ";
                if (upgrade_sql_query($sql_step1)) {
                    $step = set_upgrade_status($tool, 2, $course_code);
                } else {
                    return $step;
                }
            case 2:
                $sql = "SELECT self_registration,\n                               private,\n                               nbGroupPerUser,\n                               forum,\n                               document,\n                               wiki,\n                               chat\n                    FROM `" . $currentCourseDbNameGlu . "group_property`";
                $groupSettings = claro_sql_query_get_single_row($sql);
                if (is_array($groupSettings)) {
                    $sql = "INSERT\n                            INTO `" . $currentCourseDbNameGlu . "course_properties`\n                                   (`name`, `value`, `category`)\n                            VALUES\n                            ('self_registration', '" . $groupSettings['self_registration'] . "', 'GROUP'),\n                            ('nbGroupPerUser',    '" . $groupSettings['nbGroupPerUser'] . "', 'GROUP'),\n                            ('private',           '" . $groupSettings['private'] . "', 'GROUP'),\n                            ('CLFRM',             '" . $groupSettings['forum'] . "', 'GROUP'),\n                            ('CLDOC',             '" . $groupSettings['document'] . "', 'GROUP'),\n                            ('CLWIKI',            '" . $groupSettings['wiki'] . "', 'GROUP'),\n                            ('CLCHT',             '" . $groupSettings['chat'] . "', 'GROUP')";
                }
                if (upgrade_sql_query($sql)) {
                    $step = set_upgrade_status($tool, 3, $course_code);
                } else {
                    return $step;
                }
            case 3:
                $sql = "DROP TABLE IF EXISTS`" . $currentCourseDbNameGlu . "group_property`";
                if (upgrade_sql_query($sql)) {
                    $step = set_upgrade_status($tool, 4, $course_code);
                } else {
                    return $step;
                }
            case 4:
                $sql = "UPDATE `" . $currentCourseDbNameGlu . "group_team`\n                        SET `maxStudent` = NULL\n                        WHERE `maxStudent` = 0 ";
                if (upgrade_sql_query($sql)) {
                    $step = set_upgrade_status($tool, 0, $course_code);
                } else {
                    return $step;
                }
            default:
                return $step;
        }
    }
    return false;
}
Beispiel #17
0
 /**
  * load an exercise from DB
  *
  * @param integer $id id of exercise
  * @return boolean load successfull ?
  */
 public function load()
 {
     $sql = "SELECT\n                    `id`,\n                    `title`,\n                    `description`\n            FROM `" . $this->tblQuestionCategory . "`\n            WHERE `id` = " . (int) $this->id;
     $data = claro_sql_query_get_single_row($sql);
     if (!empty($data)) {
         // from query
         $this->title = $data['title'];
         $this->description = $data['description'];
         return true;
     } else {
         return false;
     }
 }
Beispiel #18
0
    die("<center> Not allowed ! (path_id not set :@ )</center>");
}
/*======================================
       CLAROLINE MAIN
  ======================================*/
// Display title
$out .= claro_html_tool_title($nameTools, null, $cmdList);
// see checked exercises to add
$sql = "SELECT `id`, `title`\n        FROM `" . $tbl_quiz_exercise . "`";
$exerciseList = claro_sql_query_fetch_all($sql);
// for each exercise checked, try to add it to the learning path.
foreach ($exerciseList as $exercise) {
    if (isset($_REQUEST['insertExercise']) && isset($_REQUEST['check_' . $exercise['id']])) {
        // check if a module of this course already used the same exercise
        $sql = "SELECT M.`module_id`\n                FROM `" . $TABLEMODULE . "` AS M, `" . $TABLEASSET . "` AS A\n                WHERE A.`module_id` = M.`module_id`\n                  AND A.`path` LIKE '" . (int) $exercise['id'] . "'\n                  AND M.`contentType` = '" . CTEXERCISE_ . "'";
        $existingModule = claro_sql_query_get_single_row($sql);
        // no module exists using this exercise
        if (!$existingModule) {
            // create new module
            $sql = "INSERT INTO `" . $TABLEMODULE . "`\n                    (`name` , `comment`, `contentType`, `launch_data`)\n                    VALUES ('" . claro_sql_escape($exercise['title']) . "' , '" . claro_sql_escape(get_block('blockDefaultModuleComment')) . "', '" . CTEXERCISE_ . "', '')";
            $moduleId = claro_sql_query_insert_id($sql);
            // create new asset
            $sql = "INSERT INTO `" . $TABLEASSET . "`\n                    (`path` , `module_id` , `comment`)\n                    VALUES ('" . (int) $exercise['id'] . "', " . (int) $moduleId . " , '')";
            $assetId = claro_sql_query_insert_id($sql);
            // update start asset id in module
            $sql = "UPDATE `" . $TABLEMODULE . "`\n                       SET `startAsset_id` = " . (int) $assetId . "\n                     WHERE `module_id` = " . (int) $moduleId;
            claro_sql_query($sql);
            // determine the default order of this Learning path
            $sql = "SELECT MAX(`rank`)\n                    FROM `" . $TABLELEARNPATHMODULE . "`";
            $orderMax = claro_sql_query_get_single_value($sql);
            $order = $orderMax + 1;
Beispiel #19
0
 *
 * 1/ Filter/search panel
 * 2/ List of datas
 */
$sqlCourseList = prepare_get_filtred_course_list();
$myPager = new claro_sql_pager($sqlCourseList, $offsetC, get_conf('coursePerPage', 20));
$sortKey = isset($_GET['sort']) ? $_GET['sort'] : 'officialCode, intitule';
$sortDir = isset($_GET['dir']) ? $_GET['dir'] : SORT_ASC;
$myPager->set_sort_key($sortKey, $sortDir);
$myPager->set_pager_call_param_name('offsetC');
$courseList = $myPager->get_result_list();
if (is_array($courseList)) {
    $tbl_mdb_names = claro_sql_get_main_tbl();
    foreach ($courseList as $courseKey => $course) {
        $sql = "SELECT\n    count(IF(`isCourseManager`=0,1,null))\n    AS `qty_stu`,\n    #count only lines where user is not course manager\n\n    count(IF(`isCourseManager`=1,1,null))\n    AS `qty_cm`\n    #count only lines where statut of user is 1\n           FROM  `" . $tbl_mdb_names['rel_course_user'] . "`\n           WHERE code_cours  = '" . claro_sql_escape($course['sysCode']) . "'\n          GROUP BY code_cours";
        $result = claro_sql_query_get_single_row($sql);
        $courseList[$courseKey]['qty_stu'] = $result['qty_stu'];
        $courseList[$courseKey]['qty_cm'] = $result['qty_cm'];
    }
}
// Prepare display of search/Filter panel
$advanced_search_query_string = array();
$isSearched = '';
if (!empty($_REQUEST['search'])) {
    $isSearched .= trim($_REQUEST['search']) . ' ';
}
if (!empty($_REQUEST['code'])) {
    $isSearched .= get_lang('Course code') . ' = ' . $_REQUEST['code'] . ' ';
    $advanced_search_query_string[] = 'code=' . urlencode($_REQUEST['code']);
}
if (!empty($_REQUEST['intitule'])) {
Beispiel #20
0
 /**
  * load an assignment from DB
  *
  * @author Sebastien Piraux <*****@*****.**>
  * @param integer $assignment_id id of assignment
  * @return boolean load successfull ?
  */
 public function load($id)
 {
     $sql = "SELECT\n                    `id`,\n                    `title`,\n                    `description`,\n                    `visibility`,\n                    `def_submission_visibility`,\n                    `assignment_type`,\n                    `authorized_content`,\n                    `allow_late_upload`,\n                    UNIX_TIMESTAMP(`start_date`) AS `unix_start_date`,\n                    UNIX_TIMESTAMP(`end_date`) AS `unix_end_date`,\n                    `prefill_text`,\n                    `prefill_doc_path`,\n                    `prefill_submit`\n            FROM `" . $this->tblAssignment . "`\n            WHERE `id` = " . (int) $id;
     $data = claro_sql_query_get_single_row($sql);
     if (!empty($data)) {
         // from query
         $this->id = (int) $data['id'];
         $this->title = $data['title'];
         $this->description = $data['description'];
         $this->visibility = $data['visibility'];
         $this->defaultSubmissionVisibility = $data['def_submission_visibility'];
         $this->assignmentType = $data['assignment_type'];
         $this->submissionType = $data['authorized_content'];
         $this->allowLateUpload = $data['allow_late_upload'];
         $this->startDate = $data['unix_start_date'];
         $this->endDate = $data['unix_end_date'];
         $this->autoFeedbackText = $data['prefill_text'];
         $this->autoFeedbackFilename = $data['prefill_doc_path'];
         $this->autoFeedbackSubmitMethod = $data['prefill_submit'];
         // build
         $this->buildDirPaths();
         return true;
     } else {
         return false;
     }
 }
Beispiel #21
0
/**
 * Fetch data and privileges of the given user in the given course
 *
 * U don't have enough of this function
 * use claro_get_course_user_data($cid,$uid,$ignoreCache=false)
 *  or claro_get_course_user_privilege($cid,$uid,$ignoreCache=false)
 *
 * @param string $cid course id
 * @param integer $uid user id
 * @param bool $ignoreCache true to for read in database instead of cache
 * @return array(data( array('role')), 'privilege'(array('_profileId','is_courseMember','is_courseTutor','is_courseAdmin')))
 * @see claro_get_course_user_data($cid,$uid,$ignoreCache=false)
 * @see claro_get_course_user_privilege($cid,$uid,$ignoreCache=false)
 * @author Christophe Gesche <*****@*****.**>
 */
function claro_get_course_user_properties($cid, $uid, $ignoreCache = false)
{
    $admin = claro_is_platform_admin();
    $tbl_mdb_names = claro_sql_get_main_tbl();
    $tbl_rel_course_user = $tbl_mdb_names['rel_course_user'];
    static $course_user_cache = null;
    static $course_user_data = null;
    static $course_user_privilege = array();
    if ($course_user_cache != array('uid' => $uid, 'cid' => $cid) || $ignoreCache) {
        $sql = "SELECT profile_id AS profileId,\n                       isCourseManager,\n                       isPending,\n                       tutor,\n                       role\n                FROM `" . $tbl_rel_course_user . "` `cours_user`\n                WHERE `user_id`  = '" . (int) $uid . "'\n                AND `code_cours` = '" . claro_sql_escape($cid) . "'";
        $cuData = claro_sql_query_get_single_row($sql);
        if (!empty($cuData)) {
            $course_user_data['role'] = $cuData['role'];
            // not used
            $course_user_privilege['_profileId'] = $cuData['profileId'];
            $course_user_privilege['is_coursePending'] = (bool) $cuData['isPending'];
            $course_user_privilege['is_courseMember'] = (bool) ($cuData['isPending'] == 0);
            $course_user_privilege['is_courseTutor'] = (bool) ($cuData['tutor'] == 1);
            $course_user_privilege['is_courseAdmin'] = (bool) ($cuData['isCourseManager'] == 1);
        } else {
            $course_user_privilege['_profileId'] = claro_get_profile_id('guest');
            $course_user_privilege['is_coursePending'] = false;
            $course_user_privilege['is_courseMember'] = false;
            $course_user_privilege['is_courseAdmin'] = false;
            $course_user_privilege['is_courseTutor'] = false;
            $course_user_data = null;
            // not used
        }
        $course_user_privilege['is_courseAdmin'] = (bool) ($course_user_privilege['is_courseAdmin'] || claro_is_platform_admin());
        $course_user_cache = array('uid' => $uid, 'cid' => $cid);
    }
    return array('data' => $course_user_data, 'privilege' => $course_user_privilege);
}
Beispiel #22
0
 /**
  * load answers in object
  *
  * @author Sebastien Piraux <*****@*****.**>
  * @return boolean result of operation
  */
 public function load()
 {
     $sql = "SELECT\n                    `id`,\n                    `trueFeedback`,\n                    `trueGrade`,\n                    `falseFeedback`,\n                    `falseGrade`,\n                    `correctAnswer`\n            FROM `" . $this->tblAnswer . "`\n            WHERE `questionId` = " . (int) $this->questionId;
     $data = claro_sql_query_get_single_row($sql);
     if (!empty($data)) {
         $this->id = (int) $data['id'];
         $this->trueFeedback = $data['trueFeedback'];
         $this->trueGrade = $data['trueGrade'];
         $this->falseFeedback = $data['falseFeedback'];
         $this->falseGrade = $data['falseGrade'];
         $this->correctAnswer = $data['correctAnswer'];
         return true;
     } else {
         return false;
     }
 }
Beispiel #23
0
/**
 * subscribe a specific user to a class
 *
 * @author Guillaume Lederer < *****@*****.** >
 *
 * @param int $user_id user ID from the course_user table
 * @param int $class_id class id from the class table
 *
 * @return boolean TRUE  if subscribtion succeed
 *         boolean FALSE otherwise.
 */
function user_add_to_class($user_id, $class_id)
{
    $user_id = (int) $user_id;
    $class_id = (int) $class_id;
    // get database information
    $tbl_mdb_names = claro_sql_get_main_tbl();
    $tbl_rel_class_user = $tbl_mdb_names['rel_class_user'];
    $tbl_class = $tbl_mdb_names['class'];
    $tbl_course_class = $tbl_mdb_names['rel_course_class'];
    $tbl_course = $tbl_mdb_names['course'];
    // 1. See if there is a user with such ID in the main database
    $user_data = user_get_properties($user_id);
    if (!$user_data) {
        return claro_failure::get_last_failure('USER_NOT_FOUND');
    }
    // 2. See if there is a class with such ID in the main DB
    $sql = "SELECT `class_parent_id`\n            FROM `" . $tbl_class . "`\n            WHERE `id` = '" . $class_id . "' ";
    $result = claro_sql_query_get_single_row($sql);
    if (count($result) == 0) {
        return claro_failure::set_failure('CLASS_NOT_FOUND');
        // the class doesn't exist
    }
    // 3. See if user is not already in class
    $sql = "SELECT `user_id`\n            FROM `" . $tbl_rel_class_user . "`\n            WHERE `user_id` = '" . $user_id . "'\n            AND `class_id` = '" . $class_id . "'";
    $handle = claro_sql_query($sql);
    if (mysql_num_rows($handle) > 0) {
        return claro_failure::set_failure('USER_ALREADY_IN_CLASS');
        // the user is already subscrided to the class
    }
    // 4. Add user to class in the rel_class_user table
    $sql = "INSERT INTO `" . $tbl_rel_class_user . "`\n            SET `user_id` = '" . $user_id . "',\n               `class_id` = '" . $class_id . "' ";
    claro_sql_query($sql);
    // 5. Add user to each course whose link with class
    $sql = "SELECT `c`.`code`\n            FROM `" . $tbl_course_class . "` `cc`, `" . $tbl_course . "` `c`\n            WHERE `cc`.`courseId` = `c`.`code`\n            AND `cc`.`classId` = " . $class_id;
    $courseList = claro_sql_query_fetch_all($sql);
    foreach ($courseList as $course) {
        //check if every think is good
        if (!user_add_to_course($user_id, $course['code'], false, false, $class_id)) {
            return claro_failure::set_failure('PROBLEM_WITH_COURSE_SUBSCRIBE');
            //TODO : ameliorer la  gestion d'erreur ...
        }
    }
    return true;
}
Beispiel #24
0
/**
 * Return  minimum and the maximum value for treePos
 * @return minimum and the maximum value for treePos
 * @author Christophe Gesché <*****@*****.**>
 * @since 1.7
 *
 */
function get_extremesTreePos()
{
    $tbl_mdb_names = claro_sql_get_main_tbl();
    $tbl_course_node = $tbl_mdb_names['category'];
    $sql_InfoTree = " SELECT min(treePos) minimum, max(treePos) maximum\n                FROM `" . $tbl_course_node . "`";
    return claro_sql_query_get_single_row($sql_InfoTree);
}
Beispiel #25
0
/**
 * count the number of categories associated to a course
 *
 * @author Antonin Bourguignon <*****@*****.**>
 * @param  int      id of course
 * @return int      number of categories associated
 * @since  1.10
 */
function count_course_categories($courseId)
{
    $tbl_mdb_names = claro_sql_get_main_tbl();
    $tbl_rel_course_category = $tbl_mdb_names['rel_course_category'];
    $sql = "SELECT COUNT(courseId) AS nbCategoriesLined\n            FROM `" . $tbl_rel_course_category . "`\n            WHERE courseId = " . (int) $courseId;
    if ($result = claro_sql_query_get_single_row($sql)) {
        return $result['nbCategoriesLined'];
    } else {
        return false;
    }
}
Beispiel #26
0
 /**
  * Load a profile from DB
  *
  * @param integer $id identifier of profile
  * @return boolean load successfull
  */
 public function load($id)
 {
     $sql = " SELECT profile_id,\n                        name,\n                        label,\n                        type,\n                        description,\n                        locked,\n                        required,\n                        courseManager,\n                        groupTutor,\n                        userListPublic,\n                        mailingList\n                 FROM `" . $this->tbl['profile'] . "`\n                 WHERE profile_id = " . (int) $id;
     $data = claro_sql_query_get_single_row($sql);
     if (!empty($data)) {
         $this->id = (int) $data['profile_id'];
         $this->name = $data['name'];
         $this->label = $data['label'];
         $this->type = $data['type'];
         $this->description = $data['description'];
         $this->isLocked = $data['locked'];
         $this->isRequired = $data['required'];
         $this->isCourseManager = $data['courseManager'];
         $this->isTutor = $data['groupTutor'];
         $this->isUserPublic = $data['userListPublic'];
         $this->isEmailNotify = $data['mailingList'];
         return true;
     } else {
         return false;
     }
 }
Beispiel #27
0
/**
 * Returns data for the announcement  of the given id of the given or current course.
 *
 * @param integer   $announcement_id id the requested announcement
 * @param string    $course_id       sysCode of the course (leaveblank for current course)
 * @return array(id, title, content, visibility, rank) of the announcement
 * @since 1.7
 */
function announcement_get_item($announcement_id, $course_id = null)
{
    $tbl = claro_sql_get_course_tbl(claro_get_course_db_name_glued($course_id));
    $sql = "SELECT id,\n                   title,\n                   contenu      AS content,\n                   visibleFrom,\n                   visibleUntil,\n                   visibility,\n                   ordre        AS rank\n            FROM  `" . $tbl['announcement'] . "`\n            WHERE id = " . (int) $announcement_id;
    $announcement = claro_sql_query_get_single_row($sql);
    if ($announcement) {
        return $announcement;
    } else {
        return claro_failure::set_failure('ANNOUNCEMENT_UNKNOW');
    }
}
Beispiel #28
0
require_once get_path('incRepositorySys') . "/lib/statsUtils.lib.inc.php";
// lib of learning path tool
require_once get_path('incRepositorySys') . "/lib/learnPath.lib.inc.php";
//lib of document tool
require_once get_path('incRepositorySys') . "/lib/fileDisplay.lib.php";
// only the course administrator or the student himself can view the tracking
$is_allowedToTrack = claro_is_course_manager();
if (isset($uInfo) && claro_is_user_authenticated()) {
    $is_allowedToTrack = $is_allowedToTrack || $uInfo == claro_get_current_user_id();
}
// get infos about the user
$sql = "SELECT `nom` AS `lastname`, `prenom` as `firstname`, `email`\n        FROM `" . $TABLEUSER . "`\n       WHERE `user_id` = " . (int) $_REQUEST['uInfo'];
$uDetails = claro_sql_query_get_single_row($sql);
// get infos about the learningPath
$sql = "SELECT `name`\n        FROM `" . $TABLELEARNPATH . "`\n       WHERE `learnPath_id` = " . (int) $_REQUEST['path_id'];
$lpDetails = claro_sql_query_get_single_row($sql);
////////////////////
////// OUTPUT //////
////////////////////
$interbredcrump[] = array("url" => "../learnPath/learningPathList.php", "name" => get_lang('Learning path list'));
$interbredcrump[] = array("url" => "learnPath_details.php?path_id=" . $_REQUEST['path_id'], "name" => get_lang('Statistics'));
$nameTools = get_lang('Modules');
$_SERVER['QUERY_STRING'] = 'uInfo=' . $_REQUEST['uInfo'] . "&path_id=" . $_REQUEST['path_id'];
$out = '';
// display title
$titleTab['mainTitle'] = $nameTools;
$titleTab['subTitle'] = $lpDetails['name'];
$out .= claro_html_tool_title($titleTab);
if ($is_allowedToTrack && get_conf('is_trackingEnabled')) {
    //### PREPARE LIST OF ELEMENTS TO DISPLAY #################################
    $sql = "SELECT LPM.`learnPath_module_id`,\n                LPM.`parent`,\n                LPM.`lock`,\n                M.`module_id`,\n                M.`contentType`,\n                M.`name`,\n                UMP.`lesson_status`, UMP.`raw`,\n                UMP.`scoreMax`, UMP.`credit`,\n                UMP.`session_time`, UMP.`total_time`,\n                A.`path`\n             FROM (\n                 `" . $TABLELEARNPATHMODULE . "` AS LPM,\n                `" . $TABLEMODULE . "` AS M\n                )\n       LEFT JOIN `" . $TABLEUSERMODULEPROGRESS . "` AS UMP\n               ON UMP.`learnPath_module_id` = LPM.`learnPath_module_id`\n               AND UMP.`user_id` = " . (int) $_REQUEST['uInfo'] . "\n       LEFT JOIN `" . $TABLEASSET . "` AS A\n              ON M.`startAsset_id` = A.`asset_id`\n            WHERE LPM.`module_id` = M.`module_id`\n              AND LPM.`learnPath_id` = " . (int) $_REQUEST['path_id'] . "\n              AND LPM.`visibility` = 'SHOW'\n              AND LPM.`module_id` = M.`module_id`\n         GROUP BY LPM.`module_id`\n         ORDER BY LPM.`rank`";
Beispiel #29
0
$TABLELEARNPATH = $tbl_lp_learnPath;
$TABLEMODULE = $tbl_lp_module;
$TABLELEARNPATHMODULE = $tbl_lp_rel_learnPath_module;
$TABLEASSET = $tbl_lp_asset;
$TABLEUSERMODULEPROGRESS = $tbl_lp_user_module_progress;
$TABLEUSERS = $tbl_user;
$SCORMServerURL = Url::Contextualize(get_module_url('CLLNP') . '/navigation/SCORMserver.php');
$redirectionURL = Url::Contextualize(get_module_url('CLLNP') . '/learningPath.php');
$TOCurl = Url::Contextualize(get_module_url('CLLNP') . '/navigation/tableOfContent.php');
/*======================================
       CLAROLINE MAIN
  ======================================*/
if (claro_is_user_authenticated()) {
    // Get general information to generate the right API inmplementation
    $sql = "SELECT *\n              FROM `" . $TABLEUSERMODULEPROGRESS . "` AS UMP,\n                   `" . $TABLELEARNPATHMODULE . "` AS LPM,\n                   `" . $TABLEUSERS . "` AS U,\n                   `" . $TABLEMODULE . "` AS M\n             WHERE UMP.`user_id` = " . (int) claro_get_current_user_id() . "\n               AND UMP.`user_id` = U.`user_id`\n               AND UMP.`learnPath_module_id` = LPM.`learnPath_module_id`\n               AND M.`module_id` = LPM.`module_id`\n               AND LPM.`learnPath_id` = " . (int) $_SESSION['path_id'] . "\n               AND LPM.`module_id` = " . (int) $_SESSION['module_id'];
    $userProgressionDetails = claro_sql_query_get_single_row($sql);
}
if (!claro_is_user_authenticated() || !$userProgressionDetails) {
    $sco['student_id'] = "-1";
    $sco['student_name'] = "Anonymous, User";
    $sco['lesson_location'] = "";
    $sco['credit'] = "no-credit";
    $sco['lesson_status'] = "not attempted";
    $sco['entry'] = "ab-initio";
    $sco['raw'] = "";
    $sco['scoreMin'] = "0";
    $sco['scoreMax'] = "100";
    $sco['total_time'] = "0000:00:00.00";
    $sco['suspend_data'] = "";
    $sco['launch_data'] = "";
} else {
Beispiel #30
0
/**
 * Check if a module is installed and actived.
 *
 * @param string $modLabel module label
 * @return array
 */
function check_module($modLabel)
{
    $tbl_name = claro_sql_get_main_tbl();
    $tbl_module = $tbl_name['module'];
    $sql = "SELECT M.`id`              AS `id`,\n                   M.`label`           AS `label`,\n                   M.`activation`      AS `activation`\n            FROM `" . $tbl_module . "` AS M\n            WHERE M.`label` = '" . $modLabel . "'";
    $result = claro_sql_query_get_single_row($sql);
    if (empty($result)) {
        $message[] = "The " . $modLabel . " hasn't been installed!";
        return array(false, $message);
    } else {
        if ($result['activation'] == 'desactivated') {
            $message[] = "The " . $modLabel . " hasn't been activated!";
            return array(false, $message);
        } else {
            return array(true, null);
        }
    }
}