本文整理汇总了PHP中api_get_cidreq函数的典型用法代码示例。如果您正苦于以下问题:PHP api_get_cidreq函数的具体用法?PHP api_get_cidreq怎么用?PHP api_get_cidreq使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了api_get_cidreq函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: classicAction
/**
* @param string $name
* @param Request $request
* @return Response
*/
public function classicAction($name, Request $request)
{
// get.
$_GET = $request->query->all();
// post.
$_POST = $request->request->all();
$rootDir = $this->get('kernel')->getRealRootDir();
//$_REQUEST = $request->request->all();
$mainPath = $rootDir . 'main/';
$fileToLoad = $mainPath . $name;
// Setting legacy values inside the container
/** @var Connection $dbConnection */
$dbConnection = $this->container->get('database_connection');
$em = $this->get('kernel')->getContainer()->get('doctrine.orm.entity_manager');
$database = new \Database($dbConnection, array());
$database->setConnection($dbConnection);
$database->setManager($em);
Container::$container = $this->container;
Container::$dataDir = $this->container->get('kernel')->getDataDir();
Container::$courseDir = $this->container->get('kernel')->getDataDir();
//Container::$configDir = $this->container->get('kernel')->getConfigDir();
$this->container->get('twig')->addGlobal('api_get_cidreq', api_get_cidreq());
//$breadcrumb = $this->container->get('chamilo_core.block.breadcrumb');
if (is_file($fileToLoad) && \Security::check_abs_path($fileToLoad, $mainPath)) {
// Files inside /main need this variables to be set
$is_allowed_in_course = api_is_allowed_in_course();
$is_courseAdmin = api_is_course_admin();
$is_platformAdmin = api_is_platform_admin();
$toolNameFromFile = basename(dirname($fileToLoad));
$charset = 'UTF-8';
// Default values
$_course = api_get_course_info();
$_user = api_get_user_info();
$debug = $this->container->get('kernel')->getEnvironment() == 'dev' ? true : false;
// Loading file
ob_start();
require_once $fileToLoad;
$out = ob_get_contents();
ob_end_clean();
// No browser cache when executing an exercise.
if ($name == 'exercice/exercise_submit.php') {
$responseHeaders = array('cache-control' => 'no-store, no-cache, must-revalidate');
}
$js = isset($htmlHeadXtra) ? $htmlHeadXtra : array();
// $interbreadcrumb is loaded in the require_once file.
$interbreadcrumb = isset($interbreadcrumb) ? $interbreadcrumb : null;
$template = Container::$legacyTemplate;
$defaultLayout = 'layout_one_col.html.twig';
if (!empty($template)) {
$defaultLayout = $template;
}
return $this->render('ChamiloCoreBundle::' . $defaultLayout, array('legacy_breadcrumb' => $interbreadcrumb, 'content' => $out, 'js' => $js));
} else {
// Found does not exist
throw new NotFoundHttpException();
}
}
示例2: getTeacherLink
/**
* @return string
*/
public function getTeacherLink()
{
$link = null;
if (api_is_allowed_to_edit()) {
$url = api_get_path(WEB_PLUGIN_PATH) . 'courselegal/start.php?' . api_get_cidreq();
$link = Display::url($this->get_lang('CourseLegal'), $url, array('class' => 'btn'));
}
return $link;
}
示例3: get_link
public function get_link()
{
$eval = $this->get_evaluation();
// course/platform admin can go to the view_results page
if (api_is_allowed_to_edit()) {
return 'gradebook_view_result.php?' . api_get_cidreq() . '&selecteval=' . $eval->get_id();
} elseif (ScoreDisplay::instance()->is_custom()) {
return 'gradebook_statistics.php?' . api_get_cidreq() . '&selecteval=' . $eval->get_id();
} else {
return null;
}
}
示例4: ch_qti2_display_form
/**
* This function displays the form for import of the zip file with qti2
*/
function ch_qti2_display_form()
{
$name_tools = get_lang('ImportQtiQuiz');
$form = '<div class="actions">';
$form .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'exercice/exercise.php?show=test&' . api_get_cidreq() . '">' . Display::return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM) . '</a>';
$form .= '</div>';
$formValidator = new FormValidator('qti_upload', 'post', api_get_self() . "?" . api_get_cidreq(), null, array('enctype' => 'multipart/form-data'));
$formValidator->addElement('header', $name_tools);
$formValidator->addElement('file', 'userFile', get_lang('DownloadFile'));
$formValidator->addButtonImport(get_lang('Upload'));
$form .= $formValidator->returnForm();
echo $form;
}
示例5: aiken_display_form
/**
* This function displays the form for import of the zip file with qti2
* @param string Report message to show in case of error
*/
function aiken_display_form($msg = '')
{
$name_tools = get_lang('ImportAikenQuiz');
$form = '<div class="actions">';
$form .= '<a href="exercice.php?show=test">' . Display::return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM) . '</a>';
$form .= '</div>';
$form .= $msg;
$form_validator = new FormValidator('aiken_upload', 'post', api_get_self() . "?" . api_get_cidreq(), null, array('enctype' => 'multipart/form-data'));
$form_validator->addElement('header', $name_tools);
$form_validator->addElement('text', 'total_weight', get_lang('TotalWeight'));
$form_validator->addElement('file', 'userFile', get_lang('DownloadFile'));
$form_validator->addElement('style_submit_button', 'submit', get_lang('Send'), 'class="upload"');
$form .= $form_validator->return_form();
$form .= '<blockquote>' . get_lang('ImportAikenQuizExplanation') . '<br /><pre>' . get_lang('ImportAikenQuizExplanationExample') . '</pre></blockquote>';
echo $form;
}
示例6: ch_qti2_import_file
/**
* This function will import the zip file with the respective qti2
* @param array $uploaded_file ($_FILES)
*/
function ch_qti2_import_file($array_file)
{
$unzip = 0;
$lib_path = api_get_path(LIBRARY_PATH);
$process = FileManager::process_uploaded_file($array_file);
if (preg_match('/\\.zip$/i', $array_file['name'])) {
// if it's a zip, allow zip upload
$unzip = 1;
}
if ($process && $unzip == 1) {
$main_path = api_get_path(SYS_CODE_PATH);
require_once $main_path . 'exercice/export/exercise_import.inc.php';
require_once $main_path . 'exercice/export/qti2/qti2_classes.php';
$imported = import_exercise($array_file['name']);
if ($imported) {
header('Location: exercice.php?' . api_get_cidreq());
} else {
Display::display_error_message(get_lang('UplNoFileUploaded'));
return false;
}
}
}
示例7: set_system_parameters
/**
* Set system parameters
*/
private function set_system_parameters()
{
global $_configuration;
//Setting app paths/URLs
$_p = array(
'web' => api_get_path(WEB_PATH),
'web_course' => api_get_path(WEB_COURSE_PATH),
'web_main' => api_get_path(WEB_CODE_PATH),
'web_css' => api_get_path(WEB_CSS_PATH),
'web_ajax' => api_get_path(WEB_AJAX_PATH),
'web_img' => api_get_path(WEB_IMG_PATH),
'web_plugin' => api_get_path(WEB_PLUGIN_PATH),
'web_lib' => api_get_path(WEB_LIBRARY_PATH),
'web_self' => api_get_self(),
'web_query_vars' => api_htmlentities($_SERVER['QUERY_STRING']),
'web_self_query_vars' => api_htmlentities($_SERVER['REQUEST_URI']),
'web_cid_query' => api_get_cidreq(),
);
$this->assign('_p', $_p);
//Here we can add system parameters that can be use in any template
$_s = array(
'software_name' => $_configuration['software_name'],
'system_version' => $_configuration['system_version'],
'site_name' => api_get_setting('siteName'),
'institution' => api_get_setting('Institution')
);
$this->assign('_s', $_s);
}
示例8: api_get_path
$minutes = 60;
$url = api_get_path(WEB_AJAX_PATH) . 'exercise.ajax.php?a=get_live_stats&exercise_id=' . $objExercise->id . '&minutes=' . $minutes;
//The order is important you need to check the the $column variable in the model.ajax.php file
$columns = array(get_lang('FirstName'), get_lang('LastName'), get_lang('Time'), get_lang('QuestionsAlreadyAnswered'), get_lang('Score'));
//Column config
$column_model = array(array('name' => 'firstname', 'index' => 'firstname', 'width' => '100', 'align' => 'left'), array('name' => 'lastname', 'index' => 'lastname', 'width' => '100', 'align' => 'left'), array('name' => 'start_date', 'index' => 'start_date', 'width' => '100', 'align' => 'left'), array('name' => 'question', 'index' => 'count_questions', 'width' => '60', 'align' => 'left', 'sortable' => 'false'), array('name' => 'score', 'index' => 'score', 'width' => '50', 'align' => 'left', 'sortable' => 'false'));
//Autowidth
$extra_params['autowidth'] = 'true';
//height auto
$extra_params['height'] = 'auto';
?>
<script>
function refreshGrid() {
var grid = $("#live_stats");
grid.trigger("reloadGrid");
t = setTimeout("refreshGrid()", 10000);
}
$(function() {
<?php
echo Display::grid_js('live_stats', $url, $columns, $column_model, $extra_params, array(), null, true);
?>
refreshGrid();
});
</script>
<?php
$actions = '<a href="exercise_report.php?exerciseId=' . intval($_GET['exerciseId']) . '&' . api_get_cidreq() . '">' . Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM) . '</a>';
echo $actions = Display::div($actions, array('class' => 'actions'));
echo Display::grid_html('live_stats');
Display::display_footer();
示例9: array
$interbreadcrumb[] = array('url' => 'exercise_report.php' . '?filter=2', 'name' => get_lang('StudentScore'));
$interbreadcrumb[] = array('url' => 'exercise_history.php' . '?exe_id=' . intval($_GET['exe_id']), 'name' => get_lang('Details'));
$TBL_USER = Database::get_main_table(TABLE_MAIN_USER);
$TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
$TBL_EXERCICES_QUESTION = Database::get_course_table(TABLE_QUIZ_QUESTION);
$TBL_TRACK_EXERCICES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$TBL_TRACK_ATTEMPT_RECORDING = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
Display::display_header($nameTools, get_lang('Exercise'));
if (isset($_GET['message'])) {
if (in_array($_GET['message'], array('ExerciseEdited'))) {
$my_message_history = Security::remove_XSS($_GET['message']);
Display::display_confirmation_message(get_lang($my_message_history));
}
}
echo '<div class="actions">';
echo '<a href="exercise_report.php?' . api_get_cidreq() . '&filter=2">' . Display::return_icon('back.png', get_lang('BackToResultList'), '', ICON_SIZE_MEDIUM) . '</a>';
echo '</div>';
?>
<table class="data_table">
<tr class="row_odd">
<th><?php
echo get_lang('Question');
?>
</th>
<th width="50px"><?php
echo get_lang('Value');
?>
</th>
<th><?php
echo get_lang('Feedback');
示例10: time
}
}
});
});
});
</script>';
if (isset($_GET['chatid']) && !empty($_GET['chatid'])) {
//send out call request
$time = time();
$time = date("Y-m-d H:i:s", $time);
$chatid = intval($_GET['chatid']);
if ($_GET['chatid'] == strval(intval($_GET['chatid']))) {
$sql = "UPDATE {$track_user_table} SET chatcall_user_id = '" . Database::escape_string($_user['user_id']) . "', chatcall_date = '" . Database::escape_string($time) . "', chatcall_text = '' where (user_id = " . (int) Database::escape_string($chatid) . ")";
$result = Database::query($sql);
//redirect caller to chat
header("Location: " . api_get_path(WEB_CODE_PATH) . "chat/chat.php?" . api_get_cidreq() . "&origin=whoisonline&target=" . Security::remove_XSS($chatid));
exit;
}
}
$social_right_content = null;
// This if statement prevents users accessing the who's online feature when it has been disabled.
if (api_get_setting('showonline', 'world') == 'true' && !$_user['user_id'] || (api_get_setting('showonline', 'users') == 'true' || api_get_setting('showonline', 'course') == 'true') && $_user['user_id']) {
if (isset($_GET['cidReq']) && strlen($_GET['cidReq']) > 0) {
$user_list = Online::who_is_online_in_this_course(0, 9, api_get_user_id(), api_get_setting('time_limit_whosonline'), $_GET['cidReq']);
} else {
$user_list = Online::who_is_online(0, 9);
}
if (!isset($_GET['id'])) {
if (api_get_setting('allow_social_tool') == 'true') {
if (!api_is_anonymous()) {
//this include the social menu div
示例11: getMediaLabels
public static function getMediaLabels()
{
// Shows media questions
$courseMedias = Question::prepare_course_media_select(api_get_course_int_id());
$labels = null;
if (!empty($courseMedias)) {
$labels .= get_lang('MediaQuestions') . '<br />';
foreach ($courseMedias as $mediaId => $media) {
$editLink = '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&type=' . MEDIA_QUESTION . '&myid=1&editQuestion=' . $mediaId . '">' . Display::return_icon('edit.png', get_lang('Modify'), array(), ICON_SIZE_SMALL) . '</a>';
$deleteLink = '<a id="delete_' . $mediaId . '" class="opener" href="' . api_get_self() . '?' . api_get_cidreq() . '&deleteQuestion=' . $mediaId . '" >' . Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
if (!empty($mediaId)) {
$labels .= self::getMediaLabel($media) . '' . $editLink . $deleteLink . '<br />';
}
}
}
return $labels;
}
示例12: lp_upload_quiz_action_handling
//.........这里部分代码省略.........
$numberRightAnswers++;
}
}
foreach ($answers_data as $answer_data) {
$answerValue = $answer_data[2];
$correct = 0;
$score = 0;
if (strtolower($answer_data[3]) == 'x') {
$correct = 1;
$score = $score_list[$i][3];
$comment = $feedback_true_list[$i][2];
} else {
$comment = $feedback_false_list[$i][2];
$floatVal = (double) $answer_data[3];
if (is_numeric($floatVal)) {
$score = $answer_data[3];
}
}
if ($useCustomScore) {
if ($correct) {
$score = $correctScore;
} else {
$score = $incorrectScore;
}
}
// Fixing scores:
switch ($detectQuestionType) {
case GLOBAL_MULTIPLE_ANSWER:
$score /= $numberRightAnswers;
break;
case UNIQUE_ANSWER:
break;
case MULTIPLE_ANSWER:
if (!$correct) {
//$total = $total - $score;
}
break;
}
$objAnswer->createAnswer($answerValue, $correct, $comment, $score, $id);
$total += $score;
$id++;
}
$objAnswer->save();
$questionObj = Question::read($question_id, $courseId);
switch ($detectQuestionType) {
case GLOBAL_MULTIPLE_ANSWER:
$questionObj->updateWeighting($globalScore);
break;
case UNIQUE_ANSWER:
case MULTIPLE_ANSWER:
default:
$questionObj->updateWeighting($total);
break;
}
$questionObj->save();
} else {
if ($detectQuestionType === FREE_ANSWER) {
$questionObj = Question::read($question_id, $courseId);
$globalScore = $score_list[$i][3];
$questionObj->updateWeighting($globalScore);
$questionObj->save();
}
}
}
}
if (isset($_SESSION['lpobject'])) {
if ($debug > 0) {
error_log('New LP - SESSION[lpobject] is defined', 0);
}
$oLP = unserialize($_SESSION['lpobject']);
if (is_object($oLP)) {
if ($debug > 0) {
error_log('New LP - oLP is object', 0);
}
if (empty($oLP->cc) or $oLP->cc != api_get_course_id()) {
if ($debug > 0) {
error_log('New LP - Course has changed, discard lp object', 0);
}
$oLP = null;
Session::erase('oLP');
Session::erase('lpobject');
} else {
$_SESSION['oLP'] = $oLP;
}
}
}
if (isset($_SESSION['oLP']) && isset($_GET['lp_id'])) {
$previous = $_SESSION['oLP']->select_previous_item_id();
$parent = 0;
// Add a Quiz as Lp Item
$_SESSION['oLP']->add_item($parent, $previous, TOOL_QUIZ, $quiz_id, $quiz_title, '');
// Redirect to home page for add more content
header('location: ../newscorm/lp_controller.php?' . api_get_cidreq() . '&action=add_item&type=step&lp_id=' . Security::remove_XSS($_GET['lp_id']));
exit;
} else {
// header('location: exercise.php?' . api_get_cidreq());
echo '<script>window.location.href = "' . api_get_path(WEB_CODE_PATH) . 'exercice/admin.php?' . api_get_cidReq() . '&exerciseId=' . $quiz_id . '&session_id=' . api_get_session_id() . '"</script>';
}
}
}
示例13: api_protect_course_script
$this_section = SECTION_COURSES;
$current_course_tool = TOOL_COURSE_MAINTENANCE;
api_protect_course_script(true);
$_course = api_get_course_info();
$current_course_code = $_course['official_code'];
$current_course_name = $_course['name'];
if (!api_is_allowed_to_edit()) {
api_not_allowed(true);
}
$tool_name = get_lang('DelCourse');
if (isset($_GET['delete']) && $_GET['delete'] == 'yes') {
CourseManager::delete_course($_course['sysCode']);
$obj_cat = new Category();
$obj_cat->update_category_delete($_course['sysCode']);
// DELETE CONFIRMATION MESSAGE
Session::erase('_cid');
Session::erase('_real_cid');
$noPHP_SELF = true;
$message = '<h2>' . get_lang('Course') . ' : ' . $current_course_name . ' (' . $current_course_code . ') </h2>';
$message .= get_lang('HasDel');
$message .= '<br /><br /><a href="../../index.php">' . get_lang('BackHome') . ' ' . api_get_setting('platform.site_name') . '</a>';
} else {
$message = '<h3>' . get_lang('Course') . ' : ' . $current_course_name . ' (' . $current_course_code . ') </h3>';
$message .= '<p>' . get_lang('ByDel') . '</p>';
$message .= '<p><a class="btn btn-primary" href="' . api_get_path(WEB_CODE_PATH) . 'course_info/maintenance.php?' . api_get_cidreq() . '">' . get_lang('No') . '</a> <a class="btn" href="' . api_get_self() . '?delete=yes&' . api_get_cidreq() . '">' . get_lang('Yes') . '</a></p>';
$interbreadcrumb[] = array('url' => 'maintenance.php', 'name' => get_lang('Maintenance'));
}
Display::display_header($tool_name, 'Settings');
echo Display::page_header($tool_name);
Display::display_warning_message($message, false);
Display::display_footer();
示例14: get_survey
/**
* Creates a link to surveys with contextual JS list with all the surveys in it
*
* @modified 2010.10.12 - adding css classes and simple a tag
* @return string
*/
function get_survey()
{
global $charset;
$table_survey = Database::get_course_table(TABLE_SURVEY);
$survey_lang_var = api_convert_encoding(get_lang('Survey'), $charset, api_get_system_encoding());
$newsurvey_lang_var = api_convert_encoding(get_lang('CreateANewSurvey'), $charset, api_get_system_encoding());
$close_lang_var = api_convert_encoding(get_lang('Close'), $charset, api_get_system_encoding());
$return = '<a href="#" onclick="javascript:popup(\'popUpDiv4\');" class="big_button four_buttons rounded grey_border survey_button">' . $survey_lang_var . '</a>';
$return .= '<div id="popUpDiv4" class="author_popup gradient rounded_10 grey_border" style="display:none;">' . '<span class="title">' . $survey_lang_var . '</span>' . '<a href="#" class="close" onclick="javascript:popup(\'popUpDiv4\');">' . $close_lang_var . '</a>';
$return .= '<div id="resDoc" class="content">';
$add_condition = "";
if (api_is_allowed_to_edit()) {
$add_condition = " AND author = '" . api_get_user_id() . "' ";
}
$sql = "SELECT survey_id,title FROM {$table_survey} WHERE session_id = '" . api_get_session_id() . "' {$add_condition}";
$rs = Database::query($sql, __FILE__, __LINE__);
$a_survey = array();
while ($row = Database::fetch_array($rs)) {
$a_survey[] = $row;
}
foreach ($a_survey as $survey) {
$return .= '<div class="lp_resource_element">';
if (!empty($survey['survey_id'])) {
$return .= '<img alt="" src="../img/survey_little.png" style="margin-right:5px;" title="" />';
$return .= '<a style="cursor:hand" style="vertical-align:middle"></a>
<a href="' . api_get_self() . '?cidReq=' . Security::remove_XSS($_GET['cidReq']) . '&action=add_item&type=' . TOOL_SURVEY . '&survey_id=' . $survey['survey_id'] . '&lp_id=' . $this->lp_id . '" style="vertical-align:middle">' . api_convert_encoding($survey['title'], $charset, api_get_system_encoding()) . '</a>';
}
$return .= '</div>';
}
$return .= '<br/>';
$return .= '<div class="lp_resource_element">';
$return .= Display::return_icon('pixel.gif', '', array('class' => 'actionplaceholdericon actionnewlist', 'style' => 'margin-right:5px;', 'title' => ''));
$return .= '<a href="' . api_get_path(REL_CODE_PATH) . 'survey/create_new_survey.php?' . api_get_cidreq() . '&action=add&lp_id=' . $this->lp_id . '" title="' . $newsurvey_lang_var . '">' . $newsurvey_lang_var . '</a>';
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
示例15: display_notes
static function display_notes()
{
global $_user;
if (!$_GET['direction']) {
$sort_direction = 'ASC';
$link_sort_direction = 'DESC';
} elseif ($_GET['direction'] == 'ASC') {
$sort_direction = 'ASC';
$link_sort_direction = 'DESC';
} else {
$sort_direction = 'DESC';
$link_sort_direction = 'ASC';
}
// action links
echo '<div class="actions">';
if (!api_is_anonymous()) {
if (api_get_session_id() == 0)
echo '<a href="index.php?' . api_get_cidreq() . '&action=addnote">' . Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>';
elseif (api_is_allowed_to_session_edit(false, true)) {
echo '<a href="index.php?' . api_get_cidreq() . '&action=addnote">' . Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>';
}
} else {
echo '<a href="javascript:void(0)">' . Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>';
}
echo '<a href="index.php?' . api_get_cidreq() . '&action=changeview&view=creation_date&direction=' . $link_sort_direction . '">' . Display::return_icon('notes_order_by_date_new.png', get_lang('OrderByCreationDate'), '', '32') . '</a>';
echo '<a href="index.php?' . api_get_cidreq() . '&action=changeview&view=update_date&direction=' . $link_sort_direction . '">' . Display::return_icon('notes_order_by_date_mod.png', get_lang('OrderByModificationDate'), '', '32') . '</a>';
echo '<a href="index.php?' . api_get_cidreq() . '&action=changeview&view=title&direction=' . $link_sort_direction . '">' . Display::return_icon('notes_order_by_title.png', get_lang('OrderByTitle'), '', '32') . '</a>';
echo '</div>';
if (!in_array($_SESSION['notebook_view'], array('creation_date', 'update_date', 'title'))) {
$_SESSION['notebook_view'] = 'creation_date';
}
// Database table definition
$t_notebook = Database :: get_course_table(TABLE_NOTEBOOK);
$order_by = "";
if ($_SESSION['notebook_view'] == 'creation_date' || $_SESSION['notebook_view'] == 'update_date') {
$order_by = " ORDER BY " . $_SESSION['notebook_view'] . " $sort_direction ";
} else {
$order_by = " ORDER BY " . $_SESSION['notebook_view'] . " $sort_direction ";
}
//condition for the session
$session_id = api_get_session_id();
$condition_session = api_get_session_condition($session_id);
$cond_extra = ($_SESSION['notebook_view'] == 'update_date') ? " AND update_date <> '0000-00-00 00:00:00'" : " ";
$course_id = api_get_course_int_id();
$sql = "SELECT * FROM $t_notebook WHERE c_id = $course_id AND user_id = '" . api_get_user_id() . "' $condition_session $cond_extra $order_by";
$result = Database::query($sql);
while ($row = Database::fetch_array($result)) {
//validacion when belongs to a session
$session_img = api_get_session_image($row['session_id'], $_user['status']);
$creation_date = api_get_local_time($row['creation_date'], null, date_default_timezone_get());
$update_date = api_get_local_time($row['update_date'], null, date_default_timezone_get());
echo '<div class="sectiontitle">';
echo '<span style="float: right;"> (' . get_lang('CreationDate') . ': ' . date_to_str_ago($creation_date) . ' <span class="dropbox_date">' . $creation_date . '</span>';
if ($row['update_date'] <> $row['creation_date']) {
echo ', ' . get_lang('UpdateDate') . ': ' . date_to_str_ago($update_date) . ' <span class="dropbox_date">' . $update_date . '</span>';
}
echo ')</span>';
echo $row['title'] . $session_img;
echo '</div>';
echo '<div class="sectioncomment">' . $row['description'] . '</div>';
echo '<div>';
echo '<a href="' . api_get_self() . '?action=editnote&notebook_id=' . $row['notebook_id'] . '">' . Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . '</a>';
echo '<a href="' . api_get_self() . '?action=deletenote&notebook_id=' . $row['notebook_id'] . '" onclick="return confirmation(\'' . $row['title'] . '\');">' . Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>';
echo '</div>';
}
}