本文整理汇总了PHP中api_get_session_id函数的典型用法代码示例。如果您正苦于以下问题:PHP api_get_session_id函数的具体用法?PHP api_get_session_id怎么用?PHP api_get_session_id使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了api_get_session_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*/
public function __construct()
{
//Table definitions
$this->tbl_global_agenda = Database::get_main_table(TABLE_MAIN_SYSTEM_CALENDAR);
$this->tbl_personal_agenda = Database::get_user_personal_table(TABLE_PERSONAL_AGENDA);
$this->tbl_course_agenda = Database::get_course_table(TABLE_AGENDA);
$this->table_repeat = Database::get_course_table(TABLE_AGENDA_REPEAT);
//Setting the course object if we are in a course
$this->course = null;
$courseInfo = api_get_course_info();
if (!empty($courseInfo)) {
$this->course = $courseInfo;
}
$this->setSessionId(api_get_session_id());
$this->setSenderId(api_get_user_id());
$this->events = array();
// Event colors
$this->event_platform_color = 'red';
//red
$this->event_course_color = '#458B00';
//green
$this->event_group_color = '#A0522D';
//siena
$this->event_session_color = '#00496D';
// kind of green
$this->event_personal_color = 'steel blue';
//steel blue
}
示例2: __construct
/**
* Creates the mPDF object
* @param string $pageFormat format A4 A4-L see http://mpdf1.com/manual/index.php?tid=184&searchstring=format
* @param string $orientation orientation "P" = Portrait "L" = Landscape
* @param array $params
* @param Template $template
*/
public function __construct($pageFormat = 'A4', $orientation = 'P', $params = array(), $template = null)
{
$this->template = $template;
/* More info @ http://mpdf1.com/manual/index.php?tid=184&searchstring=mPDF
* mPDF ([ string $mode [, mixed $format [, float $default_font_size [, string $default_font [, float $margin_left , float $margin_right , float $margin_top , float $margin_bottom , float $margin_header , float $margin_footer [, string $orientation ]]]]]])
*/
if (!in_array($orientation, array('P', 'L'))) {
$orientation = 'P';
}
//$this->pdf = $pdf = new mPDF('UTF-8', $pageFormat, '', '', 30, 20, 27, 25, 16, 13, $orientation);
//left, right, top, bottom, margin_header, margin footer
$params['left'] = isset($params['left']) ? $params['left'] : 15;
$params['right'] = isset($params['right']) ? $params['right'] : 15;
$params['top'] = isset($params['top']) ? $params['top'] : 20;
$params['bottom'] = isset($params['bottom']) ? $params['bottom'] : 15;
$this->params['filename'] = isset($params['filename']) ? $params['filename'] : api_get_local_time();
$this->params['pdf_title'] = isset($params['pdf_title']) ? $params['pdf_title'] : get_lang('Untitled');
$this->params['course_info'] = isset($params['course_info']) ? $params['course_info'] : api_get_course_info();
$this->params['session_info'] = isset($params['session_info']) ? $params['session_info'] : api_get_session_info(api_get_session_id());
$this->params['course_code'] = isset($params['course_code']) ? $params['course_code'] : api_get_course_id();
$this->params['add_signatures'] = isset($params['add_signatures']) ? $params['add_signatures'] : false;
$this->params['show_real_course_teachers'] = isset($params['show_real_course_teachers']) ? $params['show_real_course_teachers'] : false;
$this->params['student_info'] = isset($params['student_info']) ? $params['student_info'] : false;
$this->params['show_grade_generated_date'] = isset($params['show_grade_generated_date']) ? $params['show_grade_generated_date'] : false;
$this->params['show_teacher_as_myself'] = isset($params['show_teacher_as_myself']) ? $params['show_teacher_as_myself'] : true;
$this->params['pdf_date'] = isset($params['pdf_date']) ? $params['pdf_date'] : api_format_date(api_get_local_time(), DATE_TIME_FORMAT_LONG);
$this->pdf = new mPDF('UTF-8', $pageFormat, '', '', $params['left'], $params['right'], $params['top'], $params['bottom'], 8, 8, $orientation);
}
示例3: setup
/**
* Setups the folder
*/
public function setup()
{
$userId = api_get_user_id();
$userInfo = api_get_user_info();
$sessionId = api_get_session_id();
$courseInfo = $this->connector->course;
if (!empty($courseInfo)) {
$coursePath = api_get_path(SYS_COURSE_PATH);
$courseDir = $courseInfo['directory'] . '/document';
$baseDir = $coursePath . $courseDir;
// Creates shared folder
if (!file_exists($baseDir . '/shared_folder')) {
$title = get_lang('UserFolders');
$folderName = '/shared_folder';
//$groupId = 0;
$visibility = 0;
create_unexisting_directory($courseInfo, $userId, $sessionId, 0, null, $baseDir, $folderName, $title, $visibility);
}
// Creates user-course folder
if (!file_exists($baseDir . '/shared_folder/sf_user_' . $userId)) {
$title = $userInfo['complete_name'];
$folderName = '/shared_folder/sf_user_' . $userId;
$visibility = 1;
create_unexisting_directory($courseInfo, $userId, $sessionId, 0, null, $baseDir, $folderName, $title, $visibility);
}
}
}
示例4: setBreadcrumb
/**
*
* @param array $breadcrumbs
*/
protected function setBreadcrumb($breadcrumbs)
{
$course = $this->getCourse();
//$session = $this->getSession();
// Adding course breadcrumb.
if (!empty($course)) {
$courseBreadcrumb = array('name' => \Display::return_icon('home.png') . ' ' . $course->getTitle(), 'url' => array('route' => 'course', 'routeParameters' => array('cidReq' => $course->getCode(), 'id_session' => api_get_session_id())));
array_unshift($breadcrumbs, $courseBreadcrumb);
}
$app = $this->app;
$app['main_breadcrumb'] = function ($app) use($breadcrumbs) {
/** @var \Knp\Menu\MenuItem $menu */
$menu = $app['knp_menu.factory']->createItem('root', array('childrenAttributes' => array('class' => 'breadcrumb', 'currentClass' => 'active')));
if (!empty($breadcrumbs)) {
foreach ($breadcrumbs as $item) {
if (empty($item['url'])) {
$item['url'] = array();
}
$menu->addChild($item['name'], $item['url']);
}
}
return $menu;
};
$matcher = new Matcher();
$voter = new \Knp\Menu\Silex\Voter\RouteVoter();
$voter->setRequest($this->getRequest());
$matcher->addVoter($voter);
$renderer = new \Knp\Menu\Renderer\TwigRenderer($this->get('twig'), 'bread.tpl', $matcher);
$bread = $renderer->render($this->get('main_breadcrumb'), array('template' => 'default/layout/bread.tpl'));
$app['breadcrumbs'] = $bread;
}
示例5: editAction
/**
* @Route("/edit/{tool}")
* @Method({"GET"})
*
* @param string $tool
* @return Response
*/
public function editAction($tool)
{
$message = null;
// @todo use proper functions not api functions.
$courseId = api_get_course_int_id();
$sessionId = api_get_session_id();
$tool = \Database::escape_string($tool);
$TBL_INTRODUCTION = \Database::get_course_table(TABLE_TOOL_INTRO);
$url = $this->generateUrl('introduction.controller:editAction', array('tool' => $tool, 'course' => api_get_course_id()));
$form = $this->getForm($url, $tool);
if ($form->validate()) {
$values = $form->exportValues();
$content = $values['content'];
$sql = "REPLACE {$TBL_INTRODUCTION}\n SET c_id = {$courseId},\n id = '{$tool}',\n intro_text='" . \Database::escape_string($content) . "',\n session_id='" . intval($sessionId) . "'";
\Database::query($sql);
$message = \Display::return_message(get_lang('IntroductionTextUpdated'), 'confirmation', false);
} else {
$sql = "SELECT intro_text FROM {$TBL_INTRODUCTION}\n WHERE c_id = {$courseId} AND id='" . $tool . "' AND session_id = '" . intval($sessionId) . "'";
$result = \Database::query($sql);
$content = null;
if (\Database::num_rows($result) > 0) {
$row = \Database::fetch_array($result);
$content = $row['intro_text'];
}
$form->setDefaults(array('content' => $content));
}
$this->getTemplate()->assign('content', $form->return_form());
$this->getTemplate()->assign('message', $message);
$response = $this->getTemplate()->renderLayout('layout_1_col.tpl');
return new Response($response, 200, array());
}
示例6: loginCheck
/**
* Checking user in DB
* @param int $uid
*/
public static function loginCheck($uid)
{
$_course = api_get_course_info();
$uid = (int) $uid;
$online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
if (!empty($uid)) {
$login_ip = '';
if (!empty($_SERVER['REMOTE_ADDR'])) {
$login_ip = Database::escape_string($_SERVER['REMOTE_ADDR']);
}
$login_date = api_get_utc_datetime();
$access_url_id = 1;
if (api_get_multiple_access_url() && api_get_current_access_url_id() != -1) {
$access_url_id = api_get_current_access_url_id();
}
$session_id = api_get_session_id();
// if the $_course array exists this means we are in a course and we have to store this in the who's online table also
// to have the x users in this course feature working
if (is_array($_course) && count($_course) > 0 && !empty($_course['id'])) {
$query = "REPLACE INTO " . $online_table . " (login_id, login_user_id, login_date, login_ip, course, session_id, access_url_id)\n VALUES ({$uid}, {$uid}, '{$login_date}', '{$login_ip}', '" . $_course['id'] . "', '{$session_id}', '{$access_url_id}' )";
} else {
$query = "REPLACE INTO " . $online_table . " (login_id,login_user_id,login_date,login_ip, session_id, access_url_id)\n VALUES ({$uid},{$uid},'{$login_date}','{$login_ip}', '{$session_id}', '{$access_url_id}')";
}
Database::query($query);
}
}
示例7: __construct
public function __construct()
{
$current_course = self::current_course();
if ($current_course) {
$this->defaults('c_id', self::current_course()->get_id());
}
$this->defaults('session_id', api_get_session_id());
}
示例8: course_params
/**
* Returns the course parameters. If null default to the current user parameters.
*
* @param string $course_code
* @param string|int $session_id
* @param string|int $group_id
* @return type
*/
public static function course_params($course_code = null, $session_id = null, $group_id = null)
{
$course_code = is_null($course_code) ? api_get_course_id() : $course_code;
$session_id = is_null($session_id) ? api_get_session_id() : $session_id;
$session_id = $session_id ? $session_id : '0';
$group_id = is_null($group_id) ? '' : $group_id;
$group_id = $group_id ? $group_id : '0';
return array('cidReq' => $course_code, 'id_session' => $session_id, 'gidReq' => $group_id);
}
示例9: displayForm
/**
* Show the form to copy courses
* @global string $returnLink
* @global string $courseCode
*/
function displayForm()
{
global $returnLink, $courseCode;
$courseInfo = api_get_course_info();
$sessionId = api_get_session_id();
$userId = api_get_user_id();
$sessions = SessionManager::getSessionsCoachedByUser($userId);
$html = '';
// Actions
$html .= '<div class="actions">';
// Link back to the documents overview
$html .= '<a href="' . $returnLink . '">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('Maintenance'), '', ICON_SIZE_MEDIUM) . '</a>';
$html .= '</div>';
$html .= Display::return_message(get_lang('CopyCourseFromSessionToSessionExplanation'));
$html .= '<form name="formulaire" method="post" action="' . api_get_self() . '?' . api_get_cidreq() . '" >';
$html .= '<table border="0" cellpadding="5" cellspacing="0" width="100%">';
// Source
$html .= '<tr><td width="15%"><b>' . get_lang('OriginCoursesFromSession') . ':</b></td>';
$html .= '<td width="10%" align="left">' . api_get_session_name($sessionId) . '</td>';
$html .= '<td width="50%">';
$html .= "{$courseInfo['title']} ({$courseInfo['code']})" . '</td></tr>';
// Destination
$html .= '<tr><td width="15%"><b>' . get_lang('DestinationCoursesFromSession') . ':</b></td>';
$html .= '<td width="10%" align="left"><div id="ajax_sessions_list_destination">';
$html .= '<select name="sessions_list_destination" onchange="javascript: xajax_searchCourses(this.value,\'destination\');">';
if (empty($sessions)) {
$html .= '<option value = "0">' . get_lang('ThereIsNotStillASession') . '</option>';
} else {
$html .= '<option value = "0">' . get_lang('SelectASession') . '</option>';
foreach ($sessions as $session) {
if ($session['id'] == $sessionId) {
continue;
}
if (!SessionManager::sessionHasCourse($session['id'], $courseCode)) {
continue;
}
$html .= '<option value="' . $session['id'] . '">' . $session['name'] . '</option>';
}
}
$html .= '</select ></div></td>';
$html .= '<td width="50%">';
$html .= '<div id="ajax_list_courses_destination">';
$html .= '<select id="destination" name="SessionCoursesListDestination[]" style="width:380px;" ></select></div></td>';
$html .= '</tr></table>';
$html .= "<fieldset>";
$html .= '<legend>' . get_lang('TypeOfCopy') . ' <small>(' . get_lang('CopyOnlySessionItems') . ')</small></legend>';
$html .= '<label class="radio"><input type="radio" id="copy_option_1" name="copy_option" value="full_copy" checked="checked"/>';
$html .= get_lang('FullCopy') . '</label>';
$html .= '<label class="radio"><input type="radio" id="copy_option_2" name="copy_option" value="select_items"/>';
$html .= ' ' . get_lang('LetMeSelectItems') . '</label><br/>';
$html .= "</fieldset>";
$html .= '<button class="save" type="submit" onclick="javascript:if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)) . "'" . ')) return false;">' . get_lang('CopyCourse') . '</button>';
$html .= '</form>';
echo $html;
}
示例10: save
public function save($params, $show_query = null)
{
$course_info = api_get_course_info();
$params['session_id'] = api_get_session_id();
$params['category_id'] = isset($params['category_id']) ? $params['category_id'] : 0;
$id = parent::save($params, $show_query);
if (!empty($id)) {
api_item_property_update($course_info, TOOL_LINK, $id, 'LinkAdded', api_get_user_id());
}
return $id;
}
示例11: __construct
/**
* Room constructor.
*/
public function __construct()
{
$this->table = \Database::get_main_table('plugin_openmeetings');
$this->name = 'C' . api_get_real_course_id() . '-' . api_get_session_id();
$accessUrl = api_get_access_url(api_get_current_access_url_id());
$this->externalRoomType = substr($accessUrl['url'], strpos($accessUrl['url'], '://') + 3, -1);
if (strcmp($this->externalRoomType, 'localhost') == 0) {
$this->externalRoomType = substr(api_get_path(WEB_PATH), strpos(api_get_path(WEB_PATH), '://') + 3, -1);
}
$this->externalRoomType = 'chamilolms.' . $this->externalRoomType;
}
示例12: __construct
function __construct($data = null)
{
if ($data) {
foreach ($this as $key => $value) {
if (isset($data->{$key})) {
$this->{$key} = $data->{$key};
}
}
}
$this->defaults('session_id', api_get_session_id());
}
示例13: GetFoldersAndFiles
function GetFoldersAndFiles($resourceType, $currentFolder)
{
// Map the virtual path to the local server path.
$sServerDir = ServerMapFolder($resourceType, $currentFolder, 'GetFoldersAndFiles');
// Arrays that will hold the folders and files names.
$aFolders = array();
$aFiles = array();
$oCurrentFolder = @opendir($sServerDir);
$in_group = api_is_in_group();
if ($currentFolder == '/shared_folder/' || $currentFolder == '/shared_folder_session_' . api_get_session_id() . '/') {
$in_shared_folder = true;
} else {
$in_shared_folder = false;
}
$user_id = api_get_user_id();
if ($oCurrentFolder !== false) {
while ($sFile = readdir($oCurrentFolder)) {
$is_dir = @is_dir($sServerDir . $sFile);
if ($sFile != '.' && $sFile != '..' && strpos($sFile, '_DELETED_') === false && strpos($sFile, 'chat_files') === false && strpos($sFile, 'HotPotatoes_files') === false && ($in_group || !$in_group && strpos($sFile, '_groupdocs') === false) && (!$in_shared_folder || $in_shared_folder && (!$is_dir || $is_dir && $sFile == $user_id)) && $sFile != '.thumbs' && strpos($sFile, '.editor_') === false && $sFile != '.svn') {
if ($is_dir) {
$aFolders[] = '<Folder name="' . ConvertToXmlAttribute($sFile) . '" />';
} else {
$iFileSize = @filesize($sServerDir . $sFile);
if (!$iFileSize) {
$iFileSize = 0;
}
if ($iFileSize > 0) {
$iFileSize = round($iFileSize / 1024);
if ($iFileSize < 1) {
$iFileSize = 1;
}
}
$aFiles[] = '<File name="' . ConvertToXmlAttribute($sFile) . '" size="' . $iFileSize . '" />';
}
}
}
closedir($oCurrentFolder);
}
// Send the folders
natcasesort($aFolders);
echo '<Folders>';
foreach ($aFolders as $sFolder) {
echo $sFolder;
}
echo '</Folders>';
// Send the files
natcasesort($aFiles);
echo '<Files>';
foreach ($aFiles as $sFiles) {
echo $sFiles;
}
echo '</Files>';
}
示例14: set_parameters
/**
* Setting parameters: course id, session id, etc
* @param array
*/
public function set_parameters($params = array())
{
//Setting course id
if (isset($params['course_id'])) {
$this->course_id = intval($params['course_id']);
} else {
$this->course_id = $params['course_id'] = api_get_course_int_id();
}
//Setting course info
if (isset($this->course_id)) {
$this->course_info = api_get_course_info_by_id($this->course_id);
}
//Setting session id
if (isset($params['session_id'])) {
$this->session_id = intval($params['session_id']);
} else {
$this->session_id = $params['session_id'] = api_get_session_id();
}
//Setting user ids
if (isset($params['user_id'])) {
$this->user_id = intval($params['user_id']);
} else {
$this->user_id = $params['user_id'] = api_get_user_id();
}
//Setting user ids
if (isset($params['exercise_id'])) {
$this->exercise_id = intval($params['exercise_id']);
} else {
$this->exercise_id = 0;
}
//Setting user ids
if (isset($params['question_id'])) {
$this->question_id = intval($params['question_id']);
} else {
$this->question_id = 0;
}
$this->can_edit = false;
if (api_is_allowed_to_edit()) {
$this->can_edit = true;
} else {
if ($this->user_id == api_get_user_id()) {
$this->can_edit = true;
}
}
//Settings the params array
$this->params = $params;
$this->store_path = api_get_path(SYS_COURSE_PATH) . $this->course_info['path'] . '/exercises/';
$this->create_user_folder();
$this->store_path = $this->store_path . implode('/', array($this->session_id, $this->exercise_id, $this->question_id, $this->user_id)) . '/';
$this->filename = $this->generate_filename();
$this->store_filename = $this->store_path . $this->filename;
}
示例15: __construct
/**
* @param int $courseId
* @param int $announcement
*/
public function __construct($courseId, $announcement)
{
if (!empty($courseId)) {
$course = api_get_course_info_by_id($courseId);
} else {
$course = api_get_course_info();
}
$this->course = $course;
$this->session_id = api_get_session_id();
if (is_numeric($announcement)) {
$announcement = AnnouncementManager::get_by_id($course['real_id'], $announcement);
}
$this->announcement = $announcement;
}