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 */
$show_autolunch_lp_warning = false;
$show_autolaunch_lp_warning = false;
$auto_launch = api_get_course_setting('enable_lp_auto_launch');
if (!empty($auto_launch)) {
$session_id = api_get_session_id();
if ($auto_launch == 2) { //LP list
if (api_is_platform_admin() || api_is_allowed_to_edit()) {
$show_autolunch_lp_warning = true;
$show_autolaunch_lp_warning = true;
} 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])) {
//redirecting to the LP
$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)) {
$condition = api_get_session_condition($session_id);
$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";
$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) {
$condition = '';
} 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
WHERE c_id = $course_id AND autolunch = 1 $condition
WHERE c_id = $course_id AND autolaunch = 1 $condition
LIMIT 1";
$result = Database::query($sql);
if (Database::num_rows($result) > 0) {
$lp_data = Database::fetch_array($result,'ASSOC');
if (!empty($lp_data['id'])) {
if (api_is_platform_admin() || api_is_allowed_to_edit()) {
$show_autolunch_lp_warning = true;
$show_autolaunch_lp_warning = true;
} 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])) {
//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'];
@ -267,7 +267,7 @@ $content = Display::return_introduction_section(TOOL_COURSE_HOMEPAGE, array(
the setting homepage_view is adjustable through
the platform administration section */
if ($show_autolunch_lp_warning) {
if ($show_autolaunch_lp_warning) {
$show_message .= Display::return_message(
get_lang('TheLPAutoLaunchSettingIsONStudentsWillBeRedirectToAnSpecificLP'),
'warning'

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

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

@ -2120,7 +2120,7 @@ class CourseRestorer
"author = '".self::DBUTF8escapestring($lp->author)."', " .
"preview_image = '".self::DBUTF8escapestring($lp->preview_image)."', " .
"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)."', " .
"modified_on = '".self::DBUTF8escapestring($lp->modified_on)."', " .
"publicated_on = '".self::DBUTF8escapestring($lp->publicated_on)."', " .

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

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

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

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

@ -60,7 +60,7 @@ form .label {
color: #ffffff;
text-transform: none;
background: none;
border-radius: none;
border-radius: unset;
color: #404040;
float: left;
line-height: 18px;
@ -592,9 +592,9 @@ switch ($action) {
api_not_allowed(true);
}
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 {
$_SESSION['oLP']->set_autolunch($_GET['lp_id'], $_GET['status']);
$_SESSION['oLP']->set_autolaunch($_GET['lp_id'], $_GET['status']);
require 'lp_list.php';
exit;
}

@ -196,7 +196,7 @@ foreach ($categories as $item) {
$max = count($flat_list);
$counter = 0;
$current = 0;
$autolunch_exists = false;
$autolaunch_exists = false;
foreach ($flat_list as $id => $details) {
// Validation when belongs to a session.
@ -368,7 +368,7 @@ foreach ($categories as $item) {
$dsp_reinit = null;
$dsp_disk = null;
$copy = null;
$lp_auto_lunch_icon = null;
$lp_auto_launch_icon = null;
if ($is_allowed_to_edit) {
@ -657,18 +657,18 @@ foreach ($categories as $item) {
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 ($details['autolaunch'] == 1 && $autolunch_exists == false) {
$autolunch_exists = true;
$lp_auto_lunch_icon = '<a href="'.api_get_self(
if ($details['autolaunch'] == 1 && $autolaunch_exists == false) {
$autolaunch_exists = true;
$lp_auto_launch_icon = '<a href="'.api_get_self(
).'?'.api_get_cidreq(
).'&action=auto_launch&status=0&lp_id='.$id.'">
<img src="../img/launch.png" border="0" title="'.get_lang(
'DisableLPAutoLaunch'
).'" /></a>';
} else {
$lp_auto_lunch_icon = '<a href="'.api_get_self(
$lp_auto_launch_icon = '<a href="'.api_get_self(
).'?'.api_get_cidreq(
).'&action=auto_launch&status=1&lp_id='.$id.'">
<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.
$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;

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

Loading…
Cancel
Save