Rename autolunch field to its original meaning of autolaunch #db

1.10.x
Yannick Warnier 11 years ago
parent f25343ac7b
commit 0623fd661d
  1. 20
      main/course_home/course_home.php
  2. 2
      main/coursecopy/classes/CourseBuilder.class.php
  3. 4
      main/coursecopy/classes/CourseCopyLearnpath.class.php
  4. 2
      main/coursecopy/classes/CourseRestorer.class.php
  5. 2
      main/inc/lib/login.lib.php
  6. 2
      main/inc/local.inc.php
  7. 18
      main/newscorm/learnpath.class.php
  8. 2
      main/newscorm/learnpathList.class.php
  9. 6
      main/newscorm/lp_controller.php
  10. 16
      main/newscorm/lp_list.php
  11. 28
      src/Chamilo/CoreBundle/Migrations/Schema/V110/Version20150527120703.php
  12. 18
      src/Chamilo/CourseBundle/Entity/CLp.php

@ -189,15 +189,15 @@ if (!isset($coursesAlreadyVisited[$course_code])) {
} }
/*Auto launch code */ /*Auto launch code */
$show_autolunch_lp_warning = false; $show_autolaunch_lp_warning = false;
$auto_launch = api_get_course_setting('enable_lp_auto_launch'); $auto_launch = api_get_course_setting('enable_lp_auto_launch');
if (!empty($auto_launch)) { if (!empty($auto_launch)) {
$session_id = api_get_session_id(); $session_id = api_get_session_id();
if ($auto_launch == 2) { //LP list if ($auto_launch == 2) { //LP list
if (api_is_platform_admin() || api_is_allowed_to_edit()) { if (api_is_platform_admin() || api_is_allowed_to_edit()) {
$show_autolunch_lp_warning = true; $show_autolaunch_lp_warning = true;
} else { } else {
$session_key = 'lp_autolunch_'.$session_id.'_'.api_get_course_int_id().'_'.api_get_user_id(); $session_key = 'lp_autolaunch_'.$session_id.'_'.api_get_course_int_id().'_'.api_get_user_id();
if (!isset($_SESSION[$session_key])) { if (!isset($_SESSION[$session_key])) {
//redirecting to the LP //redirecting to the LP
$url = api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?'.api_get_cidreq().'&id_session='.$session_id; $url = api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?'.api_get_cidreq().'&id_session='.$session_id;
@ -213,28 +213,28 @@ if (!empty($auto_launch)) {
if (!empty($session_id)) { if (!empty($session_id)) {
$condition = api_get_session_condition($session_id); $condition = api_get_session_condition($session_id);
$sql = "SELECT id FROM $lp_table $sql = "SELECT id FROM $lp_table
WHERE c_id = $course_id AND autolunch = 1 $condition WHERE c_id = $course_id AND autolaunch = 1 $condition
LIMIT 1"; LIMIT 1";
$result = Database::query($sql); $result = Database::query($sql);
//If we found nothing in the session we just called the session_id = 0 autolunch //If we found nothing in the session we just called the session_id = 0 autolaunch
if (Database::num_rows($result) == 0) { if (Database::num_rows($result) == 0) {
$condition = ''; $condition = '';
} else { } else {
//great, there is an specific auto lunch for this session we leave the $condition //great, there is an specific auto launch for this session we leave the $condition
} }
} }
$sql = "SELECT id FROM $lp_table $sql = "SELECT id FROM $lp_table
WHERE c_id = $course_id AND autolunch = 1 $condition WHERE c_id = $course_id AND autolaunch = 1 $condition
LIMIT 1"; LIMIT 1";
$result = Database::query($sql); $result = Database::query($sql);
if (Database::num_rows($result) > 0) { if (Database::num_rows($result) > 0) {
$lp_data = Database::fetch_array($result,'ASSOC'); $lp_data = Database::fetch_array($result,'ASSOC');
if (!empty($lp_data['id'])) { if (!empty($lp_data['id'])) {
if (api_is_platform_admin() || api_is_allowed_to_edit()) { if (api_is_platform_admin() || api_is_allowed_to_edit()) {
$show_autolunch_lp_warning = true; $show_autolaunch_lp_warning = true;
} else { } else {
$session_key = 'lp_autolunch_'.$session_id.'_'.api_get_course_int_id().'_'.api_get_user_id(); $session_key = 'lp_autolaunch_'.$session_id.'_'.api_get_course_int_id().'_'.api_get_user_id();
if (!isset($_SESSION[$session_key])) { if (!isset($_SESSION[$session_key])) {
//redirecting to the LP //redirecting to the LP
$url = api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp_data['id']; $url = api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp_data['id'];
@ -267,7 +267,7 @@ $content = Display::return_introduction_section(TOOL_COURSE_HOMEPAGE, array(
the setting homepage_view is adjustable through the setting homepage_view is adjustable through
the platform administration section */ the platform administration section */
if ($show_autolunch_lp_warning) { if ($show_autolaunch_lp_warning) {
$show_message .= Display::return_message( $show_message .= Display::return_message(
get_lang('TheLPAutoLaunchSettingIsONStudentsWillBeRedirectToAnSpecificLP'), get_lang('TheLPAutoLaunchSettingIsONStudentsWillBeRedirectToAnSpecificLP'),
'warning' 'warning'

@ -1211,7 +1211,7 @@ class CourseBuilder
$obj->author, $obj->author,
$obj->preview_image, $obj->preview_image,
$obj->use_max_score, $obj->use_max_score,
$obj->autolunch, $obj->autolaunch,
$obj->created_on, $obj->created_on,
$obj->modified_on, $obj->modified_on,
$obj->publicated_on, $obj->publicated_on,

@ -129,7 +129,7 @@ class CourseCopyLearnpath extends Resource
$author, $author,
$preview_image, $preview_image,
$use_max_score, $use_max_score,
$autolunch, $autolaunch,
$created_on, $created_on,
$modified_on, $modified_on,
$publicated_on, $publicated_on,
@ -156,7 +156,7 @@ class CourseCopyLearnpath extends Resource
$this->visibility=$visibility; $this->visibility=$visibility;
$this->use_max_score=$use_max_score; $this->use_max_score=$use_max_score;
$this->autolunch=$autolunch; $this->autolaunch=$autolaunch;
$this->created_on=$created_on; $this->created_on=$created_on;
$this->modified_on=$modified_on; $this->modified_on=$modified_on;
$this->publicated_on=$publicated_on; $this->publicated_on=$publicated_on;

@ -2120,7 +2120,7 @@ class CourseRestorer
"author = '".self::DBUTF8escapestring($lp->author)."', " . "author = '".self::DBUTF8escapestring($lp->author)."', " .
"preview_image = '".self::DBUTF8escapestring($lp->preview_image)."', " . "preview_image = '".self::DBUTF8escapestring($lp->preview_image)."', " .
"use_max_score = '".self::DBUTF8escapestring($lp->use_max_score)."', " . "use_max_score = '".self::DBUTF8escapestring($lp->use_max_score)."', " .
"autolunch = '".self::DBUTF8escapestring($lp->autolunch)."', " . "autolaunch = '".self::DBUTF8escapestring($lp->autolaunch)."', " .
"created_on = '".self::DBUTF8escapestring($lp->created_on)."', " . "created_on = '".self::DBUTF8escapestring($lp->created_on)."', " .
"modified_on = '".self::DBUTF8escapestring($lp->modified_on)."', " . "modified_on = '".self::DBUTF8escapestring($lp->modified_on)."', " .
"publicated_on = '".self::DBUTF8escapestring($lp->publicated_on)."', " . "publicated_on = '".self::DBUTF8escapestring($lp->publicated_on)."', " .

@ -414,7 +414,7 @@ class Login
if (!empty($_SESSION)) { if (!empty($_SESSION)) {
foreach ($_SESSION as $key => $session_item) { foreach ($_SESSION as $key => $session_item) {
if (strpos($key, 'lp_autolunch_') === false) { if (strpos($key, 'lp_autolaunch_') === false) {
continue; continue;
} else { } else {
if (isset($_SESSION[$key])) { if (isset($_SESSION[$key])) {

@ -878,7 +878,7 @@ if (isset($cidReset) && $cidReset) {
if (!empty($_SESSION)) { if (!empty($_SESSION)) {
foreach ($_SESSION as $key => $session_item) { foreach ($_SESSION as $key => $session_item) {
if (strpos($key, 'lp_autolunch_') === false) { if (strpos($key, 'lp_autolaunch_') === false) {
continue; continue;
} else { } else {
if (isset($_SESSION[$key])) { if (isset($_SESSION[$key])) {

@ -219,13 +219,13 @@ class learnpath
Database::query($sql); Database::query($sql);
$this->lp_view_id = Database::insert_id(); $this->lp_view_id = Database::insert_id();
$sql = "UPDATE $lp_table SET id = iid WHERE iid = ".$this->lp_view_id; if ($this->debug > 2) {
error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - inserting new lp_view: ' . $sql, 0);
}
$sql = "UPDATE $lp_table SET id = iid WHERE iid = ".$this->lp_view_id;
Database::query($sql); Database::query($sql);
if ($this->debug > 2) {
error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - inserting new lp_view: ' . $sql_ins, 0);
}
} }
// Initialise items. // Initialise items.
@ -9864,20 +9864,20 @@ EOD;
* @param int $lp_id * @param int $lp_id
* @param string $status * @param string $status
*/ */
public function set_autolunch($lp_id, $status) public function set_autolaunch($lp_id, $status)
{ {
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$lp_id = intval($lp_id); $lp_id = intval($lp_id);
$status = intval($status); $status = intval($status);
$lp_table = Database::get_course_table(TABLE_LP_MAIN); $lp_table = Database::get_course_table(TABLE_LP_MAIN);
// Setting everything to autolunch = 0 // Setting everything to autolaunch = 0
$attributes['autolunch'] = 0; $attributes['autolaunch'] = 0;
$where = array('session_id = ? AND c_id = ? '=> array(api_get_session_id(), $course_id)); $where = array('session_id = ? AND c_id = ? '=> array(api_get_session_id(), $course_id));
Database::update($lp_table, $attributes, $where); Database::update($lp_table, $attributes, $where);
if ($status == 1) { if ($status == 1) {
//Setting my lp_id to autolunch = 1 //Setting my lp_id to autolaunch = 1
$attributes['autolunch'] = 1; $attributes['autolaunch'] = 1;
$where = array('id = ? AND session_id = ? AND c_id = ?'=> array($lp_id, api_get_session_id(), $course_id)); $where = array('id = ? AND session_id = ? AND c_id = ?'=> array($lp_id, api_get_session_id(), $course_id));
Database::update($lp_table, $attributes, $where ); Database::update($lp_table, $attributes, $where );
} }

@ -168,7 +168,7 @@ class LearnpathList
'lp_scorm_debug' => $row['debug'], 'lp_scorm_debug' => $row['debug'],
'lp_display_order' => $row['display_order'], 'lp_display_order' => $row['display_order'],
'lp_preview_image' => stripslashes($row['preview_image']), 'lp_preview_image' => stripslashes($row['preview_image']),
'autolaunch' => $row['autolunch'], 'autolaunch' => $row['autolaunch'],
'session_id' => $row['session_id'], 'session_id' => $row['session_id'],
'created_on' => $row['created_on'], 'created_on' => $row['created_on'],
'modified_on' => $row['modified_on'], 'modified_on' => $row['modified_on'],

@ -60,7 +60,7 @@ form .label {
color: #ffffff; color: #ffffff;
text-transform: none; text-transform: none;
background: none; background: none;
border-radius: none; border-radius: unset;
color: #404040; color: #404040;
float: left; float: left;
line-height: 18px; line-height: 18px;
@ -592,9 +592,9 @@ switch ($action) {
api_not_allowed(true); api_not_allowed(true);
} }
if ($debug > 0) error_log('New LP - auto_launch action triggered', 0); if ($debug > 0) error_log('New LP - auto_launch action triggered', 0);
if (!$lp_found) { error_log('New LP - No learnpath given for set_autolunch', 0); require 'lp_list.php'; } if (!$lp_found) { error_log('New LP - No learnpath given for set_autolaunch', 0); require 'lp_list.php'; }
else { else {
$_SESSION['oLP']->set_autolunch($_GET['lp_id'], $_GET['status']); $_SESSION['oLP']->set_autolaunch($_GET['lp_id'], $_GET['status']);
require 'lp_list.php'; require 'lp_list.php';
exit; exit;
} }

@ -196,7 +196,7 @@ foreach ($categories as $item) {
$max = count($flat_list); $max = count($flat_list);
$counter = 0; $counter = 0;
$current = 0; $current = 0;
$autolunch_exists = false; $autolaunch_exists = false;
foreach ($flat_list as $id => $details) { foreach ($flat_list as $id => $details) {
// Validation when belongs to a session. // Validation when belongs to a session.
@ -368,7 +368,7 @@ foreach ($categories as $item) {
$dsp_reinit = null; $dsp_reinit = null;
$dsp_disk = null; $dsp_disk = null;
$copy = null; $copy = null;
$lp_auto_lunch_icon = null; $lp_auto_launch_icon = null;
if ($is_allowed_to_edit) { if ($is_allowed_to_edit) {
@ -657,18 +657,18 @@ foreach ($categories as $item) {
api_get_self()."?".api_get_cidreq()."&action=copy&lp_id=$id" api_get_self()."?".api_get_cidreq()."&action=copy&lp_id=$id"
); );
/* Auto Lunch LP code */ /* Auto launch LP code */
if (api_get_course_setting('enable_lp_auto_launch') == 1) { if (api_get_course_setting('enable_lp_auto_launch') == 1) {
if ($details['autolaunch'] == 1 && $autolunch_exists == false) { if ($details['autolaunch'] == 1 && $autolaunch_exists == false) {
$autolunch_exists = true; $autolaunch_exists = true;
$lp_auto_lunch_icon = '<a href="'.api_get_self( $lp_auto_launch_icon = '<a href="'.api_get_self(
).'?'.api_get_cidreq( ).'?'.api_get_cidreq(
).'&action=auto_launch&status=0&lp_id='.$id.'"> ).'&action=auto_launch&status=0&lp_id='.$id.'">
<img src="../img/launch.png" border="0" title="'.get_lang( <img src="../img/launch.png" border="0" title="'.get_lang(
'DisableLPAutoLaunch' 'DisableLPAutoLaunch'
).'" /></a>'; ).'" /></a>';
} else { } else {
$lp_auto_lunch_icon = '<a href="'.api_get_self( $lp_auto_launch_icon = '<a href="'.api_get_self(
).'?'.api_get_cidreq( ).'?'.api_get_cidreq(
).'&action=auto_launch&status=1&lp_id='.$id.'"> ).'&action=auto_launch&status=1&lp_id='.$id.'">
<img src="../img/launch_na.png" border="0" title="'.get_lang( <img src="../img/launch_na.png" border="0" title="'.get_lang(
@ -791,7 +791,7 @@ foreach ($categories as $item) {
} }
echo $dsp_line.$start_time.$end_time.$dsp_progress.$dsp_desc.$dsp_export.$dsp_edit.$dsp_build.$dsp_edit_lp.$dsp_visible.$dsp_publish.$dsp_reinit. echo $dsp_line.$start_time.$end_time.$dsp_progress.$dsp_desc.$dsp_export.$dsp_edit.$dsp_build.$dsp_edit_lp.$dsp_visible.$dsp_publish.$dsp_reinit.
$dsp_default_view.$dsp_debug.$dsp_disk.$copy.$lp_auto_lunch_icon.$export_icon.$dsp_delete.$dsp_order.$dsp_edit_close; $dsp_default_view.$dsp_debug.$dsp_disk.$copy.$lp_auto_launch_icon.$export_icon.$dsp_delete.$dsp_order.$dsp_edit_close;
$lp_showed = true; $lp_showed = true;

@ -0,0 +1,28 @@
<?php
namespace Chamilo\CoreBundle\Migrations\Schema\V110;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20150527120703 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSql('ALTER TABLE c_lp CHANGE COLUMN autolunch autolaunch INT NOT NULL DEFAULT 0');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('ALTER TABLE c_lp CHANGE COLUMN autolaunch autolunch INT NOT NULL');
}
}

@ -200,9 +200,9 @@ class CLp
/** /**
* @var integer * @var integer
* *
* @ORM\Column(name="autolunch", type="integer", nullable=false) * @ORM\Column(name="autolaunch", type="integer", nullable=false)
*/ */
private $autolunch; private $autolaunch;
/** /**
* @var integer * @var integer
@ -783,26 +783,26 @@ class CLp
} }
/** /**
* Set autolunch * Set autolaunch
* *
* @param integer $autolunch * @param integer $autolaunch
* @return CLp * @return CLp
*/ */
public function setAutolunch($autolunch) public function setAutolaunch($autolaunch)
{ {
$this->autolunch = $autolunch; $this->autolaunch = $autolaunch;
return $this; return $this;
} }
/** /**
* Get autolunch * Get autolaunch
* *
* @return integer * @return integer
*/ */
public function getAutolunch() public function getAutolaunch()
{ {
return $this->autolunch; return $this->autolaunch;
} }
/** /**

Loading…
Cancel
Save