本文整理汇总了PHP中claro_sql_get_course_tbl函数的典型用法代码示例。如果您正苦于以下问题:PHP claro_sql_get_course_tbl函数的具体用法?PHP claro_sql_get_course_tbl怎么用?PHP claro_sql_get_course_tbl使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了claro_sql_get_course_tbl函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isDocumentDownloadableInCourse
protected function isDocumentDownloadableInCourse($requestedUrl)
{
if (claro_is_in_a_group()) {
$groupContext = true;
$courseContext = false;
$is_allowedToEdit = claro_is_group_member() || claro_is_group_tutor() || claro_is_course_manager();
} else {
$groupContext = false;
$courseContext = true;
$is_allowedToEdit = claro_is_course_manager();
}
if ($courseContext) {
$courseTblList = claro_sql_get_course_tbl();
$tbl_document = $courseTblList['document'];
if (strtoupper(substr(PHP_OS, 0, 3)) == "WIN") {
$modifier = '';
} else {
$modifier = 'BINARY ';
}
$sql = "SELECT visibility\n FROM `{$tbl_document}`\n WHERE {$modifier} path = '" . claro_sql_escape($requestedUrl) . "'";
$docVisibilityStatus = claro_sql_query_get_single_value($sql);
if (!is_null($docVisibilityStatus) && $docVisibilityStatus == 'i' && !$is_allowedToEdit) {
return false;
} else {
return true;
}
} else {
// ????
}
}
示例2: __construct
public function __construct($courseId, $userId)
{
$this->courseId = $courseId;
$this->userId = (int) $userId;
$tbl_cdb_names = claro_sql_get_course_tbl(claro_get_course_db_name_glued($this->courseId));
$this->tbl_course_tracking_event = $tbl_cdb_names['tracking_event'];
}
示例3: assignmentList
/**
* Return the list of assigment of the current course
*
* @param string coursecode or null (to take default)
*
* @return array of array(id,title,description,def_submission_visibility,visibility,assignment_type,start_date_unix,end_date_unix)
*/
function assignmentList($courseCode = null)
{
$tbl_cdb_names = claro_sql_get_course_tbl(claro_get_course_db_name_glued($courseCode));
$tbl_wrk_assignment = $tbl_cdb_names['wrk_assignment'];
$sql = "SELECT `id`,\n `title`,\n `description`,\n `def_submission_visibility`,\n `visibility`,\n `assignment_type`,\n unix_timestamp(`start_date`)\n AS `start_date_unix`,\n unix_timestamp(`end_date`)\n AS `end_date_unix`\n FROM `" . $tbl_wrk_assignment . "`";
return claro_sql_query_fetch_all_rows($sql);
}
示例4: __construct
public function __construct($courseCode)
{
$this->courseCode = $courseCode;
$tbl_cdb_names = claro_sql_get_course_tbl(claro_get_course_db_name_glued($this->courseCode));
$tblToolIntro = $tbl_cdb_names['tool_intro'];
$sql = "SELECT id, tool_id, title, display_date,\n content, rank, visibility\n FROM `{$tblToolIntro}`\n ORDER BY rank ASC";
$this->toolIntroductions = Claroline::getDatabase()->query($sql);
}
示例5: __construct
public function __construct($courseId, $userId)
{
$this->courseId = $courseId;
$this->userId = (int) $userId;
$tbl_cdb_names = claro_sql_get_course_tbl(claro_get_course_db_name_glued($this->courseId));
$this->tbl_wrk_assignment = $tbl_cdb_names['wrk_assignment'];
$this->tbl_wrk_submission = $tbl_cdb_names['wrk_submission'];
$this->tbl_group_team = $tbl_cdb_names['group_team'];
}
示例6: loadTopic
protected function loadTopic($topicId)
{
$tbl_cdb_names = claro_sql_get_course_tbl();
$tbl_posts = $tbl_cdb_names['bb_posts'];
$tbl_posts_text = $tbl_cdb_names['bb_posts_text'];
$sql = "SELECT p.`post_id`, p.`topic_id`, p.`forum_id`,\n p.`poster_id`, p.`post_time`, p.`poster_ip`,\n p.`nom` lastname, p.`prenom` firstname,\n pt.`post_text`\n\n FROM `" . $tbl_posts . "` p,\n `" . $tbl_posts_text . "` pt\n\n WHERE topic_id = '" . (int) $topicId . "'\n AND p.post_id = pt.`post_id`\n\n ORDER BY post_id";
$postsList = claro_sql_query_fetch_all($sql);
return $postsList;
}
示例7: __construct
/**
* constructor
*
* @param $course_id
*/
public function __construct($course_id = null)
{
$this->id = (int) -1;
$this->category = -1;
$this->title = '';
$this->content = '';
$this->lastEditDate = time();
$this->visibility = 'VISIBLE';
$tbl_cdb_names = claro_sql_get_course_tbl(claro_get_course_db_name_glued($course_id));
$this->tblCourseDescription = $tbl_cdb_names['course_description'];
}
示例8: buildRecords
function buildRecords($exportUserInfo = true)
{
$tbl_mdb_names = claro_sql_get_main_tbl();
$tbl_user = $tbl_mdb_names['user'];
$tbl_rel_course_user = $tbl_mdb_names['rel_course_user'];
$tbl_cdb_names = claro_sql_get_course_tbl(claro_get_course_db_name_glued($this->course_id));
$tbl_team = $tbl_cdb_names['group_team'];
$tbl_rel_team_user = $tbl_cdb_names['group_rel_team_user'];
$username = claro_is_platform_admin() && get_conf('export_sensitive_data_for_admin', false) || get_conf('export_user_username', false) ? "`U`.`username` AS `username`," : "";
if (claro_is_platform_admin() && get_conf('export_sensitive_data_for_admin', false) || get_conf('export_user_password', false)) {
if (claro_is_platform_admin() && get_conf('export_sensitive_data_for_admin', false) || get_conf('export_user_password_encrypted', true)) {
$password = "MD5(`U`.`password`) AS `password`,";
} else {
$password = "`U`.`password` AS `password`,";
}
} else {
$password = '';
}
// get user list
$sql = "SELECT `U`.`user_id` AS `userId`,\n `U`.`nom` AS `lastname`,\n `U`.`prenom` AS `firstname`,\n {$username}\n {$password}\n `U`.`email` AS `email`,\n `U`.`officialCode` AS `officialCode`,\n GROUP_CONCAT(`G`.`id`) AS `groupId`,\n GROUP_CONCAT(`G`.`name`) AS `groupName`\n FROM\n (\n `" . $tbl_user . "` AS `U`,\n `" . $tbl_rel_course_user . "` AS `CU`\n )\n LEFT JOIN `" . $tbl_rel_team_user . "` AS `GU`\n ON `U`.`user_id` = `GU`.`user`\n LEFT JOIN `" . $tbl_team . "` AS `G`\n ON `GU`.`team` = `G`.`id`\n WHERE `U`.`user_id` = `CU`.`user_id`\n AND `CU`.`code_cours`= '" . claro_sql_escape($this->course_id) . "'\n GROUP BY U.`user_id`\n ORDER BY U.`user_id`";
$userList = claro_sql_query_fetch_all($sql);
// build recordlist with good values for answers
if (is_array($userList) && !empty($userList)) {
// add titles at row 0, for that get the keys of the first row of array
$this->recordList[0] = array_keys($userList[0]);
$i = 1;
$userIdList = array();
foreach ($userList as $user) {
$userIdList[$user['userId']] = $i;
if (!(claro_is_platform_admin() && get_conf('export_sensitive_data_for_admin', false) || get_conf('export_user_id', false))) {
$user['userId'] = $i;
}
// $this->recordList is defined in parent class csv
$this->recordList[$i] = $user;
$i++;
}
if ($exportUserInfo) {
$userInfoList = new UserInfoList($this->course_id);
$userInfoLabelList = $userInfoList->getUserInfoLabels();
foreach ($userInfoLabelList as $catId => $catTitle) {
$this->recordList[0][] = $catTitle;
$userCatInfo = $userInfoList->getUserInfo($catId);
foreach ($userCatInfo as $userCatInfo) {
$this->recordList[$userIdList[$userCatInfo['userId']]][] = $userCatInfo['content'];
}
}
}
}
if (is_array($this->recordList) && !empty($this->recordList)) {
return true;
} else {
return false;
}
}
示例9: init_wiki_main_page
/**
* create wiki MainPage
* @param DatabaseConnection con database connection
* @param int wikiId ID of the Wiki the page belongs to
* @param int creatorId ID of the user who creates the page
* @return boolean true if the creation succeeds, false if it fails
*/
function init_wiki_main_page($con, $wikiId, $creatorId, $wikiTitle)
{
$tblList = claro_sql_get_course_tbl();
$mainPageContent = get_lang("This is the main page of the Wiki %wikiTitle. Click on '''Edit''' to modify the content.", array('%wikiTitle' => $wikiTitle));
$config = array();
// use claro functions
$config["tbl_wiki_pages"] = $tblList["wiki_pages"];
$config["tbl_wiki_pages_content"] = $tblList["wiki_pages_content"];
$wikiPage = new WikiPage($con, $config, $wikiId);
$wikiPage->create($creatorId, '__MainPage__', $mainPageContent, date("Y-m-d H:i:s"), true);
return !$wikiPage->hasError();
}
示例10: __construct
/**
* Constructor
*
* @param integer $id
* @param string $courseCode
*/
public function __construct($id = null, $courseCode = null, $toolId = null, $title = '', $content = '', $rank = null, $displayDate = null, $visibility = 'SHOW')
{
$this->id = $id;
$this->couseCode = $courseCode;
$this->toolId = $toolId;
$this->title = $title;
$this->content = $content;
$this->rank = $rank;
$this->displayDate = $displayDate;
$this->visibility = $visibility;
$tbl_cdb_names = claro_sql_get_course_tbl(claro_get_course_db_name_glued($this->couseCode));
$this->tblToolIntro = $tbl_cdb_names['tool_intro'];
}
示例11: course_description_get_item_list
/**
* get all the items
*
* @param $courseId string glued dbName of the course to affect default: current course
*
* @return array of arrays with data of the item
*
* @author Christophe Gesché <moosh@claroline.net>
*
*/
function course_description_get_item_list($courseId = null)
{
$tbl = claro_sql_get_course_tbl(claro_get_course_db_name_glued($courseId));
$tblCourseDescription = $tbl['course_description'];
if (get_conf('cldsc_use_new_ordering_of_labels')) {
// sort first the principal categories
$sql = "SELECT `cd`.`id`,\n\t `cd`.`category`,\n\t `cd`.`title`,\n\t `cd`.`content`,\n\t UNIX_TIMESTAMP(cd.`lastEditDate`)\n\t AS `unix_lastEditDate`,\n\t `cd`.`visibility`\n\t FROM `" . $tblCourseDescription . "` AS `cd`\n\t WHERE `cd`.`category` != '-1'\n\t ORDER BY `cd`.`category` ASC";
// and then the "other" category ... by title
$sql2 = "SELECT cd.`id`,\n\t cd.`category`,\n\t cd.`title`,\n\t cd.`content`,\n\t UNIX_TIMESTAMP(`cd`.`lastEditDate`)\n\t AS `unix_lastEditDate`,\n\t `cd`.`visibility`\n\t FROM `" . $tblCourseDescription . "` AS `cd`\n\t WHERE `cd`.`category` = '-1'\n\t ORDER BY `cd`.`title` ASC";
return array_merge(claro_sql_query_fetch_all($sql), claro_sql_query_fetch_all($sql2));
} else {
$sql = "SELECT `cd`.`id`,\n\t `cd`.`category`,\n\t `cd`.`title`,\n\t `cd`.`content`,\n\t UNIX_TIMESTAMP(cd.`lastEditDate`)\n\t AS `unix_lastEditDate`,\n\t `cd`.`visibility`\n\t FROM `" . $tblCourseDescription . "` AS `cd`\n\t ORDER BY `cd`.`category` ASC";
return claro_sql_query_fetch_all($sql);
}
}
示例12: delete_wiki
function delete_wiki($groupId)
{
$tblList = claro_sql_get_course_tbl();
$config = array();
$config["tbl_wiki_properties"] = $tblList["wiki_properties"];
$config["tbl_wiki_pages"] = $tblList["wiki_pages"];
$config["tbl_wiki_pages_content"] = $tblList["wiki_pages_content"];
$config["tbl_wiki_acls"] = $tblList["wiki_acls"];
$con = Claroline::getDatabase();
$store = new WikiStore($con, $config);
if (strtoupper($groupId) == 'ALL') {
$wikiList = $store->getGroupWikiList();
} else {
$wikiList = $store->getWikiListByGroup($groupId);
}
if (count($wikiList) > 0) {
foreach ($wikiList as $wiki) {
$store->deleteWiki($wiki['id']);
}
}
}
示例13: __construct
public function __construct($courseId, $userId)
{
$this->courseId = $courseId;
$this->userId = (int) $userId;
$tbl_cdb_names = claro_sql_get_course_tbl(claro_get_course_db_name_glued($this->courseId));
$this->tbl_bb_topics = $tbl_cdb_names['bb_topics'];
$this->tbl_bb_posts = $tbl_cdb_names['bb_posts'];
}
示例14: delete_course
/**
* delete a course of the plateform
*
* TODO detect failure with claro_failure
*
* @param string $cid
*
* @return boolean TRUE if suceed
* boolean FALSE otherwise.
*/
function delete_course($code, $sourceCourseId)
{
global $eventNotifier;
// Declare needed tables
$tbl_mdb_names = claro_sql_get_main_tbl();
$tbl_course = $tbl_mdb_names['course'];
$tbl_rel_course_user = $tbl_mdb_names['rel_course_user'];
$tbl_course_class = $tbl_mdb_names['rel_course_class'];
$tbl_rel_course_category = $tbl_mdb_names['rel_course_category'];
$tbl_rel_course_portlet = $tbl_mdb_names['rel_course_portlet'];
$this_course = claro_get_course_data($code);
if (!$this_course) {
// This is bad !
throw new Exception("Course not found");
}
$currentCourseId = trim($this_course['sysCode']);
if (empty($currentCourseId)) {
// This is bad !
throw new Exception("Missing course id");
}
// Delete user registrations into this course
$sql = 'DELETE FROM `' . $tbl_rel_course_user . '`
WHERE code_cours="' . $currentCourseId . '"';
claro_sql_query($sql);
// Remove any recording in rel_cours_class
$sql = "DELETE FROM `" . $tbl_course_class . "`\n WHERE courseId ='" . claro_sql_escape($currentCourseId) . "'";
claro_sql_query($sql);
// Remove links between this course and categories
$sql = "DELETE FROM `" . $tbl_rel_course_category . "`\n WHERE courseId ='" . $this_course['id'] . "'";
claro_sql_query($sql);
// Remove links between this course and portlets
$sql = "DELETE FROM `" . $tbl_rel_course_portlet . "`\n WHERE courseId ='" . $this_course['id'] . "'";
claro_sql_query($sql);
// Delete the course inside the platform course registery
$sql = 'DELETE FROM `' . $tbl_course . '`
WHERE code= "' . claro_sql_escape($currentCourseId) . '"';
claro_sql_query($sql);
// Is it a session course ?
if (!is_null($sourceCourseId)) {
// Does the source course still have session courses ?
$sql = "SELECT COUNT(cours_id) AS nbSessionCourses\n FROM `" . $tbl_course . "`\n WHERE sourceCourseId = " . (int) $sourceCourseId;
$result = claro_sql_query_get_single_row($sql);
if ($result['nbSessionCourses'] == 0) {
$sql = "UPDATE `" . $tbl_course . "`\n SET isSourceCourse = 0\n WHERE cours_id = " . (int) $sourceCourseId;
claro_sql_query($sql);
}
}
// Delete course right
RightCourseProfileToolRight::resetAllRightProfile($currentCourseId);
// Delete course module tables
// FIXME handle errors
list($success, $log) = delete_all_modules_from_course($currentCourseId);
// Notify the course deletion event
$args['cid'] = $this_course['sysCode'];
$args['tid'] = null;
$args['rid'] = null;
$args['gid'] = null;
$args['uid'] = $GLOBALS['_uid'];
$eventNotifier->notifyEvent("course_deleted", $args);
if ($currentCourseId == $code) {
$currentCourseDbName = trim($this_course['dbName']);
$currentCourseDbNameGlu = trim($this_course['dbNameGlu']);
$currentCoursePath = trim($this_course['path']);
if (empty($currentCourseDbName)) {
// This is bad !
throw new Exception("Missing db name");
}
if (empty($currentCourseDbNameGlu)) {
// This is bad !
throw new Exception("Missing db name glu");
}
if (get_conf('singleDbEnabled')) {
// SEARCH ALL TABLES RELATED TO THE CURRENT COURSE
claro_sql_query("use " . get_conf('mainDbName'));
$tbl_to_delete = claro_sql_get_course_tbl(claro_get_course_db_name_glued($currentCourseId));
foreach ($tbl_to_delete as $tbl_name) {
$sql = 'DROP TABLE IF EXISTS `' . $tbl_name . '`';
claro_sql_query($sql);
}
// Underscores must be replaced because they are used as wildcards in LIKE sql statement
$cleanCourseDbNameGlu = str_replace("_", "\\_", $currentCourseDbNameGlu);
$sql = 'SHOW TABLES LIKE "' . $cleanCourseDbNameGlu . '%"';
$result = claro_sql_query($sql);
// DELETE ALL TABLES OF THE CURRENT COURSE
$tblSurvivor = array();
while (false !== ($courseTable = mysql_fetch_array($result, MYSQL_NUM))) {
$tblSurvivor[] = $courseTable[0];
//$tblSurvivor[$courseTable]='not deleted';
}
if (sizeof($tblSurvivor) > 0) {
//.........这里部分代码省略.........
示例15: claro_user_info_claro_user_info_get_cat_def_list
/**
* Get list of all user properties for this course
*
* @param string $course_id coude code of course
* @return array containing a list of arrays.
* And each of these arrays contains
* 'catId', 'title', 'comment', and 'nbline',
*
*/
function claro_user_info_claro_user_info_get_cat_def_list($course_id = NULL)
{
$tbl = claro_sql_get_course_tbl(claro_get_course_db_name_glued($course_id));
$sql = "SELECT id catId, " . "\n" . " title," . "\n" . " comment ," . "\n" . " nbline" . "\n" . "FROM `" . $tbl['userinfo_def'] . "`" . "\n" . "ORDER BY rank";
$cat_def_list = claro_sql_query_fetch_all_rows($sql);
if (!empty($cat_def_list)) {
return $cat_def_list;
} else {
return false;
}
}