本文整理汇总了PHP中api_get_self函数的典型用法代码示例。如果您正苦于以下问题:PHP api_get_self函数的具体用法?PHP api_get_self怎么用?PHP api_get_self使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了api_get_self函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: lp_upload_quiz_main
function lp_upload_quiz_main()
{
// variable initialisation
$lp_id = isset($_GET['lp_id']) ? intval($_GET['lp_id']) : null;
$form = new FormValidator('upload', 'POST', api_get_self() . '?' . api_get_cidreq() . '&lp_id=' . $lp_id, '', array('enctype' => 'multipart/form-data'));
$form->addElement('header', get_lang('ImportExcelQuiz'));
$form->addElement('file', 'user_upload_quiz', get_lang('FileUpload'));
$link = '<a href="../exercice/quiz_template.xls">' . Display::return_icon('export_excel.png', get_lang('DownloadExcelTemplate')) . get_lang('DownloadExcelTemplate') . '</a>';
$form->addElement('label', '', $link);
$table = new HTML_Table(array('class' => 'table'));
$tableList = array(UNIQUE_ANSWER => get_lang('UniqueSelect'), MULTIPLE_ANSWER => get_lang('MultipleSelect'), FILL_IN_BLANKS => get_lang('FillBlanks'), MATCHING => get_lang('Matching'), FREE_ANSWER => get_lang('FreeAnswer'), GLOBAL_MULTIPLE_ANSWER => get_lang('GlobalMultipleAnswer'));
$table->setHeaderContents(0, 0, get_lang('QuestionType'));
$table->setHeaderContents(0, 1, '#');
$row = 1;
foreach ($tableList as $key => $label) {
$table->setCellContents($row, 0, $label);
$table->setCellContents($row, 1, $key);
$row++;
}
$table = $table->toHtml();
$form->addElement('label', get_lang('QuestionType'), $table);
$form->addElement('checkbox', 'user_custom_score', null, get_lang('UseCustomScoreForAllQuestions'), array('id' => 'user_custom_score'));
$form->addElement('html', '<div id="options" style="display:none">');
$form->addElement('text', 'correct_score', get_lang('CorrectScore'));
$form->addElement('text', 'incorrect_score', get_lang('IncorrectScore'));
$form->addElement('html', '</div>');
$form->addRule('user_upload_quiz', get_lang('ThisFieldIsRequired'), 'required');
$form->add_progress_bar();
$form->addButtonUpload(get_lang('Upload'), 'submit_upload_quiz');
// Display the upload field
$form->display();
}
示例2: define_htt
function define_htt($htt_file, $urlp, $course_path) {
global $charset;
($htt_file_contents = @fgc($htt_file))
or give_up('Templates file "' . $htt_file . '" is missing...');
$xhtDoc = new xhtdoc($htt_file_contents);
if ($xhtDoc->htt_error)
give_up('Templates file "' . $htt_file . '": ' . $xhtDoc->htt_error);
$xhtDoc->xht_param['self'] = api_get_self() . $urlp;
$xhtDoc->xht_param['dateTime'] = date('Y-m-d');
$ckw = $course_path . '/CourseKwds.js';
define('KEYWORDS_CACHE', get_course_path() . $ckw);
if (file_exists(KEYWORDS_CACHE)) $kcdt =
htmlspecialchars(date('Y/m/d H:i:s', filemtime(KEYWORDS_CACHE)), ENT_QUOTES, $charset);
$xhtDoc->xht_param['keywordscache'] = $kcdt ?
'<script type="text/javascript" src="' . get_course_web() . $ckw . '"></script>' .
'<br /><small><i>(CourseKwds cache: ' . $kcdt . ')</i></small>' : '';
return $xhtDoc;
}
示例3: edit_filter
function edit_filter($id, $url_params, $row)
{
global $charset;
$return = '<a href="specific_fields_add.php?action=edit&field_id=' . $row[0] . '">' . Display::return_icon('edit.gif', get_lang('Edit')) . '</a>';
$return .= ' <a href="' . api_get_self() . '?action=delete&field_id=' . $row[0] . '" onclick="javascript:if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset)) . "'" . ')) return false;">' . Display::return_icon('delete.gif', get_lang('Delete')) . '</a>';
return $return;
}
示例4: check_download_survey
/**
* @package chamilo.survey
* @author Arnaud Ligot <arnaud@cblue.be>
* @version $Id: $
*
* A small peace of code to enable user to access images included into survey
* which are accessible by non authenticated users. This file is included
* by document/download.php
*/
function check_download_survey($course, $invitation, $doc_url)
{
require_once 'survey.lib.php';
// Getting all the course information
$_course = CourseManager::get_course_information($course);
$course_id = $_course['real_id'];
// Database table definitions
$table_survey = Database::get_course_table(TABLE_SURVEY);
$table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
$table_survey_question_option = Database::get_course_table(TABLE_SURVEY_QUESTION_OPTION);
$table_survey_invitation = Database::get_course_table(TABLE_SURVEY_INVITATION);
// Now we check if the invitationcode is valid
$sql = "SELECT * FROM {$table_survey_invitation}\n\t WHERE\n\t c_id = {$course_id} AND\n\t invitation_code = '" . Database::escape_string($invitation) . "'";
$result = Database::query($sql);
if (Database::num_rows($result) < 1) {
Display::display_error_message(get_lang('WrongInvitationCode'), false);
Display::display_footer();
exit;
}
$survey_invitation = Database::fetch_assoc($result);
// Now we check if the user already filled the survey
if ($survey_invitation['answered'] == 1) {
Display::display_error_message(get_lang('YouAlreadyFilledThisSurvey'), false);
Display::display_footer();
exit;
}
// Very basic security check: check if a text field from a survey/answer/option contains the name of the document requested
// Fetch survey ID
// If this is the case there will be a language choice
$sql = "SELECT * FROM {$table_survey}\n\t WHERE\n\t c_id = {$course_id} AND\n\t code='" . Database::escape_string($survey_invitation['survey_code']) . "'";
$result = Database::query($sql);
if (Database::num_rows($result) > 1) {
if ($_POST['language']) {
$survey_invitation['survey_id'] = $_POST['language'];
} else {
echo '<form id="language" name="language" method="POST" action="' . api_get_self() . '?course=' . $_GET['course'] . '&invitationcode=' . $_GET['invitationcode'] . '">';
echo ' <select name="language">';
while ($row = Database::fetch_assoc($result)) {
echo '<option value="' . $row['survey_id'] . '">' . $row['lang'] . '</option>';
}
echo '</select>';
echo ' <input type="submit" name="Submit" value="' . get_lang('Ok') . '" />';
echo '</form>';
display::display_footer();
exit;
}
} else {
$row = Database::fetch_assoc($result);
$survey_invitation['survey_id'] = $row['survey_id'];
}
$sql = "SELECT count(*)\n\t FROM {$table_survey}\n\t WHERE\n\t c_id = {$course_id} AND\n\t survey_id = " . $survey_invitation['survey_id'] . " AND (\n title LIKE '%{$doc_url}%'\n or subtitle LIKE '%{$doc_url}%'\n or intro LIKE '%{$doc_url}%'\n or surveythanks LIKE '%{$doc_url}%'\n )\n\t\t UNION\n\t\t SELECT count(*)\n\t\t FROM {$table_survey_question}\n\t\t WHERE\n\t\t c_id = {$course_id} AND\n\t\t survey_id = " . $survey_invitation['survey_id'] . " AND (\n survey_question LIKE '%{$doc_url}%'\n or survey_question_comment LIKE '%{$doc_url}%'\n )\n\t\t UNION\n\t\t SELECT count(*)\n\t\t FROM {$table_survey_question_option}\n\t\t WHERE\n\t\t c_id = {$course_id} AND\n\t\t survey_id = " . $survey_invitation['survey_id'] . " AND (\n option_text LIKE '%{$doc_url}%'\n )";
$result = Database::query($sql);
if (Database::num_rows($result) == 0) {
Display::display_error_message(get_lang('WrongInvitationCode'), false);
Display::display_footer();
exit;
}
return $_course;
}
示例5: getSearchForm
/**
* @return FormValidator
*/
private function getSearchForm()
{
$form = new FormValidator('form-search', 'post', api_get_self() . '?action=subscribe&hidden_links=0', null, array('class' => 'form-search'));
$form->addElement('hidden', 'search_course', '1');
$form->addElement('text', 'search_term');
$form->addElement('button', 'submit', get_lang('Search'));
return $form;
}
示例6: display
/**
* Displays the title + grid
*/
public function display()
{
echo '<div class="actions" style="margin-bottom:20px">';
echo '<a href="career_dashboard.php">' . Display::return_icon('back.png', get_lang('Back'), '', '32') . '</a>';
echo '<a href="' . api_get_self() . '?action=add">' . Display::return_icon('new_career.png', get_lang('Add'), '', '32') . '</a>';
echo '</div>';
echo Display::grid_html('careers');
}
示例7: display
/**
* Displays the title + grid
*/
public function display()
{
// action links
echo '<div class="actions" style="margin-bottom:20px">';
echo '<a href="grade_models.php">' . Display::return_icon('back.png', get_lang('Back'), '', '32') . '</a>';
echo '<a href="' . api_get_self() . '?action=add">' . Display::return_icon('add.png', get_lang('Add'), '', '32') . '</a>';
echo '</div>';
echo Display::grid_html('grade_model');
}
示例8: listing
/**
* Displays the title + grid
*/
public function listing()
{
// action links
$html = '<div class="actions">';
//$html .= '<a href="career_dashboard.php">'.Display::return_icon('back.png',get_lang('Back'),'','32').'</a>';
$html .= '<a href="' . api_get_self() . '?action=add">' . Display::return_icon('add.png', get_lang('Add'), '', '32') . '</a>';
$html .= '</div>';
$html .= Display::grid_html('timelines');
return $html;
}
示例9: display
/**
* Displays the title + grid
*/
function display()
{
// action links
echo '<div class="actions">';
echo '<a href="../admin/index.php">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('PlatformAdmin'), '', '32') . '</a>';
echo '<a href="' . api_get_self() . '?action=add">' . Display::return_icon('new_class.png', get_lang('AddClasses'), '', '32') . '</a>';
echo Display::url(Display::return_icon('import_csv.png', get_lang('Import'), array(), ICON_SIZE_MEDIUM), 'usergroup_import.php');
echo Display::url(Display::return_icon('export_csv.png', get_lang('Export'), array(), ICON_SIZE_MEDIUM), 'usergroup_export.php');
echo '</div>';
echo Display::grid_html('usergroups');
}
示例10: mdo_add_breadcrump_nav
function mdo_add_breadcrump_nav()
{
global $interbreadcrumb;
$regs = array();
// for use with ereg()
$docurl = api_get_self();
// should be .../main/xxx/yyy.php
if (ereg('^(.+[^/\\.]+)/[^/\\.]+/[^/\\.]+.[^/\\.]+$', $docurl, $regs)) {
$docurl = $regs[1] . '/newscorm/index.php';
}
$interbreadcrumb[] = array('url' => $docurl, 'name' => get_lang('MdCallingTool'));
}
示例11: 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;
}
示例12: display_mymonthcalendar_2
function display_mymonthcalendar_2($agendaitems, $month, $year, $weekdaynames = array(), $monthName, $session_id)
{
global $DaysShort, $course_path;
//Handle leap year
$numberofdays = array(0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
if ($year % 400 == 0 or $year % 4 == 0 and $year % 100 != 0) {
$numberofdays[2] = 29;
}
//Get the first day of the month
$dayone = getdate(mktime(0, 0, 0, $month, 1, $year));
//Start the week on monday
$startdayofweek = $dayone['wday'] != 0 ? $dayone['wday'] - 1 : 6;
$g_cc = isset($_GET['courseCode']) ? $_GET['courseCode'] : '';
$backwardsURL = api_get_self() . "?coursePath=" . urlencode($course_path) . "&session=" . Security::remove_XSS($session_id) . "&courseCode=" . Security::remove_XSS($g_cc) . "&action=view&view=month&month=" . ($month == 1 ? 12 : $month - 1) . "&year=" . ($month == 1 ? $year - 1 : $year);
$forewardsURL = api_get_self() . "?coursePath=" . urlencode($course_path) . "&session=" . Security::remove_XSS($session_id) . "&courseCode=" . Security::remove_XSS($g_cc) . "&action=view&view=month&month=" . ($month == 12 ? 1 : $month + 1) . "&year=" . ($month == 12 ? $year + 1 : $year);
echo "<table class=\"data_table\">\n", "<tr>\n", "<th width=\"10%\"><a href=\"", $backwardsURL, "\">«</a></th>\n", "<th width=\"80%\" colspan=\"5\">", $monthName, " ", $year, "</th>\n", "<th width=\"10%\"><a href=\"", $forewardsURL, "\">»</a></th>\n", "</tr>\n";
echo "<tr>\n";
for ($ii = 1; $ii < 8; $ii++) {
echo "<td class=\"weekdays\">", $DaysShort[$ii % 7], "</td>\n";
}
echo "</tr>\n";
$curday = -1;
$today = getdate();
while ($curday <= $numberofdays[$month]) {
echo "<tr>\n";
for ($ii = 0; $ii < 7; $ii++) {
if ($curday == -1 && $ii == $startdayofweek) {
$curday = 1;
}
if ($curday > 0 && $curday <= $numberofdays[$month]) {
$bgcolor = $ii < 5 ? $class = "class=\"days_week\" style=\"width:10%;\"" : ($class = "class=\"days_weekend\" style=\"width:10%;\"");
$dayheader = "<b>{$curday}</b><br />";
if ($curday == $today['mday'] && $year == $today['year'] && $month == $today['mon']) {
$dayheader = "<b>{$curday} - " . get_lang("Today") . "</b><br />";
$class = "class=\"days_today\" style=\"width:10%;\"";
}
echo "<td " . $class . ">", "" . $dayheader;
if (!empty($agendaitems[$curday])) {
echo "<span class=\"agendaitem\">" . $agendaitems[$curday] . "</span>";
}
echo "</td>\n";
$curday++;
} else {
echo "<td> </td>\n";
}
}
echo "</tr>\n";
}
echo "</table>\n";
}
示例13: lp_upload_quiz_main
function lp_upload_quiz_main()
{
// variable initialisation
$lp_id = Security::remove_XSS($_GET['lp_id']);
$form = new FormValidator('upload', 'POST', api_get_self() . '?' . api_get_cidreq() . '&lp_id=' . $lp_id, '', array('enctype' => 'multipart/form-data'));
$form->addElement('header', get_lang('ImportExcelQuiz'));
$form->addElement('file', 'user_upload_quiz', get_lang('FileUpload'));
$link = '<a href="../exercice/quiz_template.xls">' . Display::return_icon('export_excel.png', get_lang('DownloadExcelTemplate'), null, 16) . get_lang('DownloadExcelTemplate');
$form->addElement('advanced_settings', $link);
//button send document
$form->addElement('style_submit_button', 'submit_upload_quiz', get_lang('Send'), 'class="upload"');
// Display the upload field
$form->display();
}
示例14: 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;
}
示例15: lp_upload_quiz_main
function lp_upload_quiz_main()
{
// variable initialisation
$lp_id = isset($_GET['lp_id']) ? Security::remove_XSS($_GET['lp_id']) : null;
$form = new FormValidator('upload', 'POST', api_get_self() . '?' . api_get_cidreq() . '&lp_id=' . $lp_id, '', array('enctype' => 'multipart/form-data'));
$form->addElement('header', get_lang('ImportExcelQuiz'));
$form->addElement('file', 'user_upload_quiz', get_lang('FileUpload'));
$link = '<a href="../exercice/quiz_template.xls">' . Display::return_icon('export_excel.png', get_lang('DownloadExcelTemplate')) . get_lang('DownloadExcelTemplate') . '</a>';
$form->addElement('label', '', $link);
$form->addElement('checkbox', 'user_custom_score', null, get_lang('UseCustomScoreForAllQuestions'), array('id' => 'user_custom_score'));
$form->addElement('html', '<div id="options" style="display:none">');
$form->addElement('text', 'correct_score', get_lang('CorrectScore'));
$form->addElement('text', 'incorrect_score', get_lang('IncorrectScore'));
$form->addElement('html', '</div>');
$form->addRule('user_upload_quiz', get_lang('ThisFieldIsRequired'), 'required');
$form->add_progress_bar();
$form->addButtonUpload(get_lang('Send'), 'submit_upload_quiz');
// Display the upload field
$form->display();
}