本文整理汇总了PHP中claro_sql_query_get_single_row函数的典型用法代码示例。如果您正苦于以下问题:PHP claro_sql_query_get_single_row函数的具体用法?PHP claro_sql_query_get_single_row怎么用?PHP claro_sql_query_get_single_row使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了claro_sql_query_get_single_row函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadPortlet
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;
}
}
示例2: load
/**
* 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;
}
}
示例3: load
/**
* load a description from DB
*
* @param integer $id id of description
* @return boolean true if load is successfull false otherwise
* @author Sebastien Piraux <pir@cerdecam.be>
*/
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;
}
}
示例4: lp_display_exercise
/**
* 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 <pir@cerdecam.be>
* @author Lederer Guillaume <led@cerdecam.be>
* @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;
}
示例5: getCategoryTitle
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 '';
}
}
示例6: claro_redirect
$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') {
示例7: announcement_get_item
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');
}
}
示例8: get_lang
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";
示例9: claro_sql_get_main_tbl
}
/*---------------------------------------------------------------------------
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
示例10: claro_user_info_get_cat_def
/**
* 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;
}
示例11: load
/**
* load answers in object
*
* @author Sebastien Piraux <pir@cerdecam.be>
* @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;
}
}
示例12: claro_sql_query_fetch_single_row
/**
* 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);
}
示例13: getIdFromCode
/**
* 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;
}
}
示例14: remove_module_dock
/**
* 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();
}
}
示例15: mergeCourseUsers
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;
}