本文整理汇总了PHP中Chamilo\CoreBundle\Framework\Container::getSession方法的典型用法代码示例。如果您正苦于以下问题:PHP Container::getSession方法的具体用法?PHP Container::getSession怎么用?PHP Container::getSession使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chamilo\CoreBundle\Framework\Container
的用法示例。
在下文中一共展示了Container::getSession方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: destroy
/**
* Destroy
*/
static function destroy()
{
$session = Container::getSession();
$session->invalidate();
}
示例2: return_message
/**
* Returns a div html string with
* @param string The message
* @param string The message type (confirm,normal,warning,error)
* @param bool Whether to XSS-filter or not
* @return string Message wrapped into an HTML div
*/
public static function return_message($message, $type = 'normal', $filter = true)
{
if (empty($message)) {
return '';
}
if ($filter) {
$message = api_htmlentities($message, ENT_QUOTES, api_is_xml_http_request() ? 'UTF-8' : api_get_system_encoding());
}
Container::getSession()->getFlashBag()->add($type, $message);
return '';
}
示例3: return_message
/**
* Returns a div html string with
* @param string The message
* @param string The message type (confirm,normal,warning,error)
* @param bool Whether to XSS-filter or not
* @return string Message wrapped into an HTML div
*/
public static function return_message($message, $type = 'normal', $filter = true)
{
if ($filter) {
$message = api_htmlentities($message, ENT_QUOTES, api_is_xml_http_request() ? 'UTF-8' : api_get_system_encoding());
}
Container::getSession()->getFlashBag()->add($type, $message);
return '';
/*
$class = "";
switch($type) {
case 'warning':
$class .= 'alert alert-warning';
break;
case 'error':
$class .= 'alert alert-danger';
break;
case 'confirmation':
case 'confirm':
case 'success':
$class .= 'alert alert-success';
break;
case 'normal':
default:
$class .= 'alert alert-info';
}
return self::div($message, array('class'=> $class));*/
}
示例4: get_tools_category
/**
* Gets the tools of a certain category. Returns an array expected
* by show_tools_category()
* @param string $course_tool_category contains the category of tools to
* display: "toolauthoring", "toolinteraction", "tooladmin", "tooladminplatform", "toolplugin"
* @return array
*/
public static function get_tools_category($course_tool_category)
{
$course_tool_table = Database::get_course_table(TABLE_TOOL_LIST);
$is_platform_admin = api_is_platform_admin();
$all_tools_list = array();
// Condition for the session
$session_id = api_get_session_id();
$course_id = api_get_course_int_id();
$condition_session = api_get_session_condition($session_id, true, true);
$studentView = Container::getSession()->get('studentview');
//var_dump($studentView);
switch ($course_tool_category) {
case TOOL_STUDENT_VIEW:
$condition_display_tools = ' WHERE visibility = 1 AND (category = "authoring" OR category = "interaction" OR category = "plugin") ';
if ((api_is_coach() || api_is_course_tutor()) && $studentView != 'studentview') {
$condition_display_tools = ' WHERE (visibility = 1 AND (category = "authoring" OR category = "interaction" OR category = "plugin") OR (name = "' . TOOL_TRACKING . '") ) ';
}
$sql = "SELECT * FROM {$course_tool_table} {$condition_display_tools} AND c_id = {$course_id} {$condition_session} ORDER BY id";
$result = Database::query($sql);
$col_link = "##003399";
break;
case TOOL_AUTHORING:
$sql = "SELECT * FROM {$course_tool_table}\n WHERE\n category = 'authoring' AND\n c_id = {$course_id}\n {$condition_session}\n ORDER BY id";
$result = Database::query($sql);
$col_link = "##003399";
break;
case TOOL_INTERACTION:
$sql = "SELECT * FROM {$course_tool_table} WHERE category = 'interaction' AND c_id = {$course_id} {$condition_session} ORDER BY id";
$result = Database::query($sql);
$col_link = "##003399";
break;
case TOOL_ADMIN_VISIBLE:
$sql = "SELECT * FROM {$course_tool_table} WHERE category = 'admin' AND visibility ='1' AND c_id = {$course_id} {$condition_session} ORDER BY id";
$result = Database::query($sql);
$col_link = "##003399";
break;
case TOOL_ADMIN_PLATFORM:
$sql = "SELECT * FROM {$course_tool_table} WHERE category = 'admin' AND c_id = {$course_id} {$condition_session} ORDER BY id";
$result = Database::query($sql);
$col_link = "##003399";
break;
case TOOL_COURSE_PLUGIN:
//Other queries recover id, name, link, image, visibility, admin, address, added_tool, target, category and session_id
// but plugins are not present in the tool table, only globally and inside the course_settings table once configured
$sql = "SELECT * FROM {$course_tool_table} WHERE category = 'plugin' AND c_id = {$course_id} {$condition_session} ORDER BY id";
$result = Database::query($sql);
break;
}
//Get the list of hidden tools - this might imply performance slowdowns
// if the course homepage is loaded many times, so the list of hidden
// tools might benefit from a shared memory storage later on
$list = api_get_settings('Tools', 'list', api_get_current_access_url_id());
$hide_list = array();
$check = false;
foreach ($list as $line) {
// Admin can see all tools even if the course_hide_tools configuration is set
if ($is_platform_admin) {
continue;
}
if ($line['variable'] == 'course_hide_tools' and $line['selected_value'] == 'true') {
$hide_list[] = $line['subkey'];
$check = true;
}
}
while ($temp_row = Database::fetch_assoc($result)) {
if ($check) {
if (!in_array($temp_row['name'], $hide_list)) {
$all_tools_list[$temp_row['name']] = $temp_row;
}
} else {
$all_tools_list[$temp_row['name']] = $temp_row;
}
}
// Grabbing all the links that have the property on_homepage set to 1
$course_link_table = Database::get_course_table(TABLE_LINK);
$course_item_property_table = Database::get_course_table(TABLE_ITEM_PROPERTY);
switch ($course_tool_category) {
case TOOL_AUTHORING:
$sql_links = "SELECT tl.*, tip.visibility, tl.id link_id\n FROM {$course_link_table} tl\n LEFT JOIN {$course_item_property_table} tip ON tip.tool='link' AND tip.ref=tl.id\n WHERE \ttl.c_id = {$course_id} AND\n tip.c_id = {$course_id} AND\n tl.on_homepage='1' {$condition_session}";
break;
case TOOL_INTERACTION:
$sql_links = null;
/*
$sql_links = "SELECT tl.*, tip.visibility
FROM $course_link_table tl
LEFT JOIN $course_item_property_table tip ON tip.tool='link' AND tip.ref=tl.id
WHERE tl.on_homepage='1' ";
*/
break;
case TOOL_STUDENT_VIEW:
$sql_links = "SELECT tl.*, tip.visibility, tl.id link_id\n FROM {$course_link_table} tl\n LEFT JOIN {$course_item_property_table} tip ON tip.tool='link' AND tip.ref=tl.id\n WHERE \ttl.c_id \t\t= {$course_id} AND\n tip.c_id \t\t= {$course_id} AND\n tl.on_homepage\t='1' {$condition_session}";
break;
case TOOL_ADMIN:
//.........这里部分代码省略.........