Add LP category see BT#5763

1.10.x
Julio Montoya 10 years ago
parent 3f3dc24b02
commit eb859c335d
  1. 206
      main/newscorm/learnpath.class.php
  2. 27
      main/newscorm/learnpathList.class.php
  3. 5
      main/newscorm/learnpath_functions.inc.php
  4. 6
      main/newscorm/lp_add.php
  5. 113
      main/newscorm/lp_add_category.php
  6. 54
      main/newscorm/lp_controller.php
  7. 4
      main/newscorm/lp_edit.php
  8. 490
      main/newscorm/lp_list.php
  9. 30
      src/Chamilo/CoreBundle/Migrations/Schema/V110/Version20150527114220.php
  10. 26
      src/Chamilo/CourseBundle/Entity/CLp.php
  11. 123
      src/Chamilo/CourseBundle/Entity/CLpCategory.php

@ -1,6 +1,7 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CourseBundle\Entity\CLpCategory;
use ChamiloSession as Session;
/**
@ -73,6 +74,7 @@ class learnpath
public $ref = null;
public $course_int_id;
public $course_info = array();
public $categoryId;
/**
* Constructor.
@ -143,6 +145,7 @@ class learnpath
$this->created_on = $row['created_on'];
$this->modified_on = $row['modified_on'];
$this->ref = $row['ref'];
$this->categoryId = $row['category_id'];
if ($row['publicated_on'] != '0000-00-00 00:00:00') {
$this->publicated_on = $row['publicated_on'];
@ -708,7 +711,8 @@ class learnpath
$origin = 'zip',
$zipname = '',
$publicated_on = '',
$expired_on = ''
$expired_on = '',
$categoryId = 0
) {
global $charset;
$course_id = api_get_course_int_id();
@ -717,6 +721,7 @@ class learnpath
// Check lp_name doesn't exist, otherwise append something.
$i = 0;
$name = Database::escape_string($name);
$categoryId = intval($categoryId);
// Session id.
$session_id = api_get_session_id();
@ -782,8 +787,8 @@ class learnpath
$dsp = $row[0] + 1;
}
$sql = "INSERT INTO $tbl_lp (c_id, lp_type,name,description,path,default_view_mod, default_encoding,display_order,content_maker,content_local,js_lib,session_id, created_on, publicated_on, expired_on)
VALUES ($course_id, $type,'$name','$description','','embedded','UTF-8','$dsp','Chamilo','local','','".$session_id."', '".api_get_utc_datetime()."' , '".$publicated_on."' , '".$expired_on."')";
$sql = "INSERT INTO $tbl_lp (c_id, lp_type,name,description,path,default_view_mod, default_encoding,display_order,content_maker,content_local,js_lib,session_id, created_on, publicated_on, expired_on, category_id)
VALUES ($course_id, $type,'$name','$description','','embedded','UTF-8','$dsp','Chamilo','local','','".$session_id."', '".api_get_utc_datetime()."' , '".$publicated_on."' , '".$expired_on."', $categoryId)";
Database::query($sql);
$id = Database :: insert_id();
if ($id > 0) {
@ -10022,6 +10027,179 @@ EOD;
}
}
/**
* @param array $params
*/
public static function createCategory($params)
{
$em = Database::getManager();
$item = new CLpCategory();
$item->setName($params['name']);
$item->setCId($params['c_id']);
$em->persist($item);
$em->flush();
}
/**
* @param array $params
*/
public static function updateCategory($params)
{
$em = Database::getManager();
$item = $em->find('ChamiloCourseBundle:CLpCategory', $params['id']);
if ($item) {
$item->setName($params['name']);
$item->setCId($params['c_id']);
$em->persist($item);
$em->flush();
}
}
/**
* @param int $id
*/
public static function moveUpCategory($id)
{
$em = Database::getManager();
$item = $em->find('ChamiloCourseBundle:CLpCategory', $id);
if ($item) {
$position = $item->getPosition() - 1;
$item->setPosition($position);
$em->persist($item);
$em->flush();
}
}
/**
* @param int $id
*/
public static function moveDownCategory($id)
{
$em = Database::getManager();
$item = $em->find('ChamiloCourseBundle:CLpCategory', $id);
if ($item) {
$position = $item->getPosition() + 1;
$item->setPosition($position);
$em->persist($item);
$em->flush();
}
}
/**
* @param int $courseId
* @return int|mixed
*/
public static function getCountCategories($courseId)
{
if (empty($course_id)) {
return 0;
}
$em = Database::getManager();
$query = $em->createQuery('SELECT COUNT(u.id) FROM ChamiloCourseBundle:CLpCategory u WHERE u.cId = :id');
$query->setParameter('id', $courseId);
return $query->getSingleScalarResult();
}
/**
* @param int $courseId
*
* @return mixed
*/
public static function getCategories($courseId)
{
$em = Database::getManager();
//Default behaviour
/*$items = $em->getRepository('ChamiloCourseBundle:CLpCategory')->findBy(
array('cId' => $course_id),
array('name' => 'ASC')
);*/
//Using doctrine extensions
$items = $em->getRepository('ChamiloCourseBundle:CLpCategory')->getBySortableGroupsQuery(
array('cId' => $courseId)
)->getResult();
return $items;
}
/**
* @param int $id
*
* @return mixed
*/
public static function getCategory($id)
{
$em = Database::getManager();
$item = $em->find('ChamiloCourseBundle:CLpCategory', $id);
return $item;
}
/**
* @param int $courseId
* @return array
*/
public static function getCategoryByCourse($courseId)
{
$em = Database::getManager();
$items = $em->getRepository('ChamiloCourseBundle:CLpCategory')->findBy(array('cId' => $courseId));
return $items;
}
/**
* @param int $id
*
* @return mixed
*/
public static function deleteCategory($id)
{
$em = Database::getManager();
$item = $em->find('ChamiloCourseBundle:CLpCategory', $id);
if ($item) {
$courseId = $item->getCId();
$query = $em->createQuery('SELECT u FROM ChamiloCourseBundle:CLp u WHERE u.cId = :id AND u.categoryId = :catId');
$query->setParameter('id', $courseId);
$query->setParameter('catId', $item->getId());
$lps = $query->getResult();
// Setting category = 0.
if ($lps) {
foreach ($lps as $lpItem) {
$lpItem->setCategoryId(0);
}
}
// Removing category.
$em->remove($item);
$em->flush();
}
}
/**
* @param int $courseId
* @param bool $addSelectOption
*
* @return mixed
*/
static function getCategoryFromCourseIntoSelect($courseId, $addSelectOption = false)
{
$items = self::getCategoryByCourse($courseId);
$cats = array();
if ($addSelectOption) {
$cats = array(get_lang('SelectACategory'));
}
if (!empty($items)) {
foreach ($items as $cat) {
$cats[$cat->getId()] = $cat->getName();
}
}
return $cats;
}
/**
* Return the scorm item type object with spaces replaced with _
* The return result is use to build a css classname like scorm_type_$return
@ -10063,6 +10241,28 @@ EOD;
return false;
}
/**
* @return int
*/
public function getCategoryId()
{
return $this->categoryId;
}
public function setCategoryId($categoryId)
{
$this->categoryId = $categoryId;
$courseId = api_get_course_int_id();
$lp_table = Database :: get_course_table(TABLE_LP_MAIN);
$lp_id = $this->get_id();
$sql = "UPDATE $lp_table SET category_id = '".intval($categoryId)."'
WHERE c_id = ".$courseId." AND id = '$lp_id'";
Database::query($sql);
return true;
}
}
if (!function_exists('trim_value')) {

@ -31,10 +31,18 @@ class LearnpathList
* @param int $session_id Optional session id (otherwise we use api_get_session_id())
* @param string $order_by
* @param string $check_publication_dates
* @param int $categoryId
*
* @return void
*/
public function __construct($user_id, $course_code = '', $session_id = null, $order_by = null, $check_publication_dates = false)
{
public function __construct(
$user_id,
$course_code = '',
$session_id = null,
$order_by = null,
$check_publication_dates = false,
$categoryId = null
) {
$course_info = api_get_course_info($course_code);
$lp_table = Database::get_course_table(TABLE_LP_MAIN);
$tbl_tool = Database::get_course_table(TABLE_TOOL_LIST);
@ -74,8 +82,21 @@ class LearnpathList
";
}
$categoryFilter = '';
if (!is_null($categoryId) && is_numeric($categoryId)) {
$categoryId = intval($categoryId);
$categoryFilter = " AND category_id = $categoryId";
}
$sql = "SELECT * FROM $lp_table
WHERE c_id = $course_id $time_conditions $condition_session $order";
WHERE
c_id = $course_id
$time_conditions
$condition_session
$categoryFilter
$order
";
$res = Database::query($sql);
$names = array();

@ -24,7 +24,7 @@
* @todo remove code duplication
*/
use \ChamiloSession as Session;
use ChamiloSession as Session;
/**
* This function deletes an item
@ -547,7 +547,8 @@ function display_learnpath_chapters($parent_item_id = 0, $tree = array (), $leve
* @return void
* @todo eliminate all global $lang declarations, use get_lang, improve structure.
*/
function display_learnpath_items($categoryid) {
function display_learnpath_items($categoryid)
{
global $xml_output;
global $lg_prerequisites, $lg_move_down, $lg_move_up, $lg_edit_learnpath_item, $lg_delete_learnpath_item, $learnpath_id, $lg_add_prereq, $lg_prereq_deleted_error, $lg_pre_short, $langThisItem;
$course_id = api_get_course_int_id();

@ -115,6 +115,12 @@ $form->addElement('hidden', 'action', 'add_lp');
$form->addButtonAdvancedSettings('advanced_params');
$form->addElement('html', '<div id="advanced_params_options" style="display:none">');
$items = learnpath::getCategoryFromCourseIntoSelect(api_get_course_int_id());
if (!empty($items)) {
$items = array_merge(array(get_lang('SelectACategory')), $items);
}
$form->addElement('select', 'category_id', get_lang('Category'), $items);
// Start date
$form->addElement('checkbox', 'activate_start_date_check', null, get_lang('EnableStartTime'), array('onclick' => 'activate_start_date()'));
$form->addElement('html','<div id="start_date_div" style="display:block;">');

@ -0,0 +1,113 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @author Julio Montoya <gugli100@gmail.com> Adding formvalidator support
*
* @package chamilo.learnpath
*/
$this_section = SECTION_COURSES;
api_protect_course_script();
require 'learnpath_functions.inc.php';
require 'resourcelinker.inc.php';
$language_file = 'learnpath';
/* Header and action code */
$currentstyle = api_get_setting('stylesheets');
$htmlHeadXtra[] = '<script>
function setFocus(){
$("#learnpath_title").focus();
}
$(document).ready(function () {
setFocus();
});
function activate_start_date() {
if(document.getElementById(\'start_date_div\').style.display == \'none\') {
document.getElementById(\'start_date_div\').style.display = \'block\';
} else {
document.getElementById(\'start_date_div\').style.display = \'none\';
}
}
function activate_end_date() {
if(document.getElementById(\'end_date_div\').style.display == \'none\') {
document.getElementById(\'end_date_div\').style.display = \'block\';
} else {
document.getElementById(\'end_date_div\').style.display = \'none\';
}
}
</script>';
/* Constants and variables */
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
$isStudentView = isset($_REQUEST['isStudentView']) ? $_REQUEST['isStudentView'] : null;
$learnpath_id = isset($_REQUEST['lp_id']) ? $_REQUEST['lp_id'] : null;
/* MAIN CODE */
if ((!$is_allowed_to_edit) || ($isStudentView)) {
//error_log('New LP - User not authorized in lp_add.php');
header('location:lp_controller.php?action=view&lp_id='.$learnpath_id);
exit;
}
$interbreadcrumb[] = array('url' => 'lp_controller.php?action=list', 'name' => get_lang('LearningPaths'));
$form = new FormValidator('lp_add_category', 'post', 'lp_controller.php');
// Form title
$form->addElement('header', null, get_lang('AddLPCategory'));
// Title
$form->addElement('text', 'name', api_ucfirst(get_lang('Name')), array('class' => 'span6'));
$form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
$form->addElement('hidden', 'action', 'add_lp_category');
$form->addElement('hidden', 'c_id', api_get_course_int_id());
$form->addElement('hidden', 'id', 0);
$form->addElement('style_submit_button', 'Submit', get_lang('Save'),'class="save"');
if ($form->validate()) {
$values = $form->getSubmitValues();
if (!empty($values['id'])) {
learnpath::updateCategory($values);
$url = api_get_self().'?action=list&'.api_get_cidreq();
header('Location: '.$url);
exit;
} else {
learnpath::createCategory($values);
$url = api_get_self().'?action=list&'.api_get_cidreq();
header('Location: '.$url);
exit;
}
} else {
$id = isset($_REQUEST['id']) ? $_REQUEST['id'] : null;
if ($id) {
$item = learnpath::getCategory($id);
$defaults = array(
'id' => $item->getId(),
'name' => $item->getName()
);
$form->setDefaults($defaults);
}
}
Display::display_header(get_lang('LearnpathAddLearnpath'), 'Path');
echo '<div class="actions">';
echo '<a href="lp_controller.php?'.api_get_cidreq().'">'.
Display::return_icon('back.png', get_lang('ReturnToLearningPaths'),'',ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
$form->display();
Display::display_footer();

@ -483,6 +483,39 @@ switch ($action) {
}
}
break;
case 'add_lp_category':
if (!$is_allowed_to_edit) {
api_not_allowed(true);
}
require 'lp_add_category.php';
break;
case 'move_up_category':
if (!$is_allowed_to_edit) {
api_not_allowed(true);
}
if (isset($_REQUEST['id'])) {
learnpath::moveUpCategory($_REQUEST['id']);
}
require 'lp_list.php';
break;
case 'move_down_category':
if (!$is_allowed_to_edit) {
api_not_allowed(true);
}
if (isset($_REQUEST['id'])) {
learnpath::moveDownCategory($_REQUEST['id']);
}
require 'lp_list.php';
break;
case 'delete_lp_category':
if (!$is_allowed_to_edit) {
api_not_allowed(true);
}
if (isset($_REQUEST['id'])) {
learnpath::deleteCategory($_REQUEST['id']);
}
require 'lp_list.php';
break;
case 'add_lp':
if (!$is_allowed_to_edit) {
api_not_allowed(true);
@ -497,13 +530,17 @@ switch ($action) {
} else {
$_SESSION['post_time'] = $_REQUEST['post_time'];
if (isset($_REQUEST['activate_start_date_check']) && $_REQUEST['activate_start_date_check'] == 1) {
if (isset($_REQUEST['activate_start_date_check']) &&
$_REQUEST['activate_start_date_check'] == 1
) {
$publicated_on = $_REQUEST['publicated_on'];
} else {
$publicated_on = null;
}
if (isset($_REQUEST['activate_end_date_check']) && $_REQUEST['activate_end_date_check'] == 1) {
if (isset($_REQUEST['activate_end_date_check']) &&
$_REQUEST['activate_end_date_check'] == 1
) {
$expired_on = $_REQUEST['expired_on'];
} else {
$expired_on = null;
@ -517,12 +554,17 @@ switch ($action) {
'manual',
'',
$publicated_on,
$expired_on
$expired_on,
$_REQUEST['category_id']
);
if (is_numeric($new_lp_id)) {
// TODO: Maybe create a first module directly to avoid bugging the user with useless queries
$_SESSION['oLP'] = new learnpath(api_get_course_id(),$new_lp_id,api_get_user_id());
$_SESSION['oLP'] = new learnpath(
api_get_course_id(),
$new_lp_id,
api_get_user_id()
);
//require 'lp_build.php';
$url = api_get_self().'?action=add_item&type=step&lp_id='.intval($new_lp_id).'&'.api_get_cidreq();
header("Location: $url&isStudentView=false");
@ -884,18 +926,16 @@ switch ($action) {
if (isset($_REQUEST['activate_start_date_check']) && $_REQUEST['activate_start_date_check'] == 1) {
$publicated_on = $_REQUEST['publicated_on'];
$publicated_on = $publicated_on['Y'].'-'.$publicated_on['F'].'-'.$publicated_on['d'].' '.$publicated_on['H'].':'.$publicated_on['i'].':00';
} else {
$publicated_on = null;
}
if (isset($_REQUEST['activate_end_date_check']) && $_REQUEST['activate_end_date_check'] == 1) {
$expired_on = $_REQUEST['expired_on'];
$expired_on = $expired_on['Y'].'-'.$expired_on['F'].'-'.$expired_on['d'].' '.$expired_on['H'].':'.$expired_on['i'].':00';
} else {
$expired_on = null;
}
$_SESSION['oLP']->setCategoryId($_REQUEST['category_id']);
$_SESSION['oLP']->set_modified_on();
$_SESSION['oLP']->set_publicated_on($publicated_on);
$_SESSION['oLP']->set_expired_on($expired_on);

@ -65,6 +65,9 @@ $form->addRule('lp_name', get_lang('ThisFieldIsRequired'), 'required');
$form->addElement('hidden', 'lp_encoding');
$items = learnpath::getCategoryFromCourseIntoSelect(api_get_course_int_id(), true);
$form->addElement('select', 'category_id', get_lang('Category'), $items);
// Origin
/*
$origin_select = $form->addElement('select', 'lp_maker', get_lang('Origin'));
@ -140,6 +143,7 @@ $defaults['lp_encoding'] = Security::remove_XSS($_SESSION['oLP']->encoding);
$defaults['lp_name'] = Security::remove_XSS($_SESSION['oLP']->get_name());
$defaults['lp_author'] = Security::remove_XSS($_SESSION['oLP']->get_author());
$defaults['hide_toc_frame'] = Security::remove_XSS($_SESSION['oLP']->get_hide_toc_frame());
$defaults['category_id'] = intval($_SESSION['oLP']->getCategoryId());
$expired_on = $_SESSION['oLP']->expired_on;
$publicated_on = $_SESSION['oLP']->publicated_on;

@ -84,6 +84,10 @@ if ($is_allowed_to_edit) {
}
echo '<div class="actions">';
echo Display::url(
Display::return_icon('new_folder.png', get_lang('AddCategory'), array(), ICON_SIZE_MEDIUM),
api_get_self().'?'.api_get_cidreq().'&action=add_lp_category'
);
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_lp">'.Display::return_icon('new_learnpath.png', get_lang('LearnpathAddLearnpath'), '', ICON_SIZE_MEDIUM).'</a>'.
str_repeat('&nbsp;', 3).
'<a href="../upload/index.php?'.api_get_cidreq().'&curdirpath=/&tool='.TOOL_LEARNPATH.'">'.Display::return_icon('import_scorm.png', get_lang('UploadScorm'), '', ICON_SIZE_MEDIUM).'</a>';
@ -97,12 +101,79 @@ if ($is_allowed_to_edit) {
$token = Security::get_token();
/* DISPLAY SCORM LIST */
$categories_temp = learnpath::getCategories(api_get_course_int_id());
$categoryTest = new \Chamilo\CourseBundle\Entity\CLpCategory();
$categoryTest->setId(0);
$categoryTest->setName(get_lang('WithOutCategory'));
$categoryTest->setPosition(0);
$categories = array(
$categoryTest
);
if (!empty($categories_temp)) {
$categories = array_merge($categories, $categories_temp);
}
$userId = api_get_user_id();
$userInfo = api_get_user_info();
$list = new LearnpathList($userId);
$lp_showed = false;
$total = count($categories);
$counterCategories = 1;
$test_mode = api_get_setting('server_type');
foreach ($categories as $item) {
$categoryId = $item->getId();
$list = new LearnpathList(
api_get_user_id(),
null,
null,
null,
false,
$categoryId
);
$flat_list = $list->get_flat_list();
// Hiding categories with out LPs (only for student)
if (empty($flat_list) && !api_is_allowed_to_edit()) {
continue;
}
$edit_link = null;
$delete_link = null;
$moveUpLink = null;
$moveDownLink = null;
if ($item->getId() > 0 && api_is_allowed_to_edit()) {
$url = 'lp_controller.php?'.api_get_cidreq().'&action=add_lp_category&id='.$item->getId();
$edit_link = Display::url(Display::return_icon('edit.png', get_lang('Edit')), $url);
$delete_url = 'lp_controller.php?'.api_get_cidreq().'&action=delete_lp_category&id='.$item->getId();
$moveUpUrl = 'lp_controller.php?'.api_get_cidreq().'&action=move_up_category&id='.$item->getId();
$moveDownUrl = 'lp_controller.php?'.api_get_cidreq().'&action=move_down_category&id='.$item->getId();
if ($counterCategories == 1) {
$moveUpLink = Display::url(Display::return_icon('up_na.png', get_lang('Move')), '#');
} else {
$moveUpLink = Display::url(Display::return_icon('up.png', get_lang('Move')), $moveUpUrl);
}
if (($total -1) == $counterCategories) {
$moveDownLink = Display::url(Display::return_icon('down_na.png', get_lang('Move')), '#');
} else {
$moveDownLink = Display::url(Display::return_icon('down.png', get_lang('Move')), $moveDownUrl);
}
$delete_link = Display::url(Display::return_icon('delete.png', get_lang('Delete')), $delete_url);
$counterCategories++;
}
echo Display::page_subheader2($item->getName().$edit_link.$moveUpLink.$moveDownLink.$delete_link);
if (!empty($flat_list)) {
echo '<table class="data_table">';
echo '<tr>';
@ -122,7 +193,6 @@ if (!empty($flat_list)) {
}
echo '</tr>';
$test_mode = api_get_setting('server_type');
$max = count($flat_list);
$counter = 0;
$current = 0;
@ -130,7 +200,10 @@ if (!empty($flat_list)) {
foreach ($flat_list as $id => $details) {
// Validation when belongs to a session.
$session_img = api_get_session_image($details['lp_session'], $userInfo['status']);
$session_img = api_get_session_image(
$details['lp_session'],
$userInfo['status']
);
if (!$is_allowed_to_edit && $details['lp_visibility'] == 0) {
// This is a student and this path is invisible, skip.
@ -138,7 +211,11 @@ if (!empty($flat_list)) {
}
// Check if the learnpath is visible for student.
if (!$is_allowed_to_edit && !learnpath::is_lp_visible_for_student($id, $userId)) {
if (!$is_allowed_to_edit && !learnpath::is_lp_visible_for_student(
$id,
$userId
)
) {
continue;
}
@ -161,9 +238,16 @@ if (!empty($flat_list)) {
if ($time_limits) {
// Check if start time
if (!empty($details['publicated_on']) && $details['publicated_on'] != '0000-00-00 00:00:00' &&
!empty($details['expired_on']) && $details['expired_on'] != '0000-00-00 00:00:00') {
$start_time = api_strtotime($details['publicated_on'], 'UTC');
$end_time = api_strtotime($details['expired_on'], 'UTC');
!empty($details['expired_on']) && $details['expired_on'] != '0000-00-00 00:00:00'
) {
$start_time = api_strtotime(
$details['publicated_on'],
'UTC'
);
$end_time = api_strtotime(
$details['expired_on'],
'UTC'
);
$now = time();
$is_actived_time = false;
@ -179,10 +263,16 @@ if (!empty($flat_list)) {
$start_time = $end_time = '';
} else {
if (!empty($details['publicated_on'])) {
$start_time = api_convert_and_format_date($details['publicated_on'], DATE_TIME_FORMAT_LONG);
$start_time = api_convert_and_format_date(
$details['publicated_on'],
DATE_TIME_FORMAT_LONG
);
}
if (!empty($details['expired_on'])) {
$end_time = api_convert_and_format_date($details['expired_on'], DATE_TIME_FORMAT_LONG);
$end_time = api_convert_and_format_date(
$details['expired_on'],
DATE_TIME_FORMAT_LONG
);
}
}
@ -193,23 +283,43 @@ if (!empty($flat_list)) {
$oddclass = 'row_even';
}
$url_start_lp = 'lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$id;
$url_start_lp = 'lp_controller.php?'.api_get_cidreq(
).'&action=view&lp_id='.$id;
$name = Security::remove_XSS($details['lp_name']);
$extra = null;
if ($is_allowed_to_edit) {
$url_start_lp .= '&isStudentView=true';
$studentVisibility = learnpath::is_lp_visible_for_student($id, $userId);
$dsp_desc = '<em>'.$details['lp_maker'].'</em> '.( $studentVisibility ? '' : ' - ('.get_lang('LPNotVisibleToStudent').')');
$studentVisibility = learnpath::is_lp_visible_for_student(
$id,
$userId
);
$dsp_desc = '<em>'.$details['lp_maker'].'</em> '.($studentVisibility ? '' : ' - ('.get_lang(
'LPNotVisibleToStudent'
).')');
$extra = '<div class ="lp_content_type_label">'.$dsp_desc.'</div>';
}
$my_title = $name;
$icon_learnpath = Display::return_icon('learnpath.png', get_lang('LPName'), '', ICON_SIZE_SMALL);
$icon_learnpath = Display::return_icon(
'learnpath.png',
get_lang('LPName'),
'',
ICON_SIZE_SMALL
);
if ($details['lp_visibility'] == 0) {
$my_title = Display::tag('font', $name, array('class' => 'invisible'));
$icon_learnpath = Display::return_icon('learnpath_na.png', get_lang('LPName'), '', ICON_SIZE_SMALL);
$my_title = Display::tag(
'font',
$name,
array('class' => 'invisible')
);
$icon_learnpath = Display::return_icon(
'learnpath_na.png',
get_lang('LPName'),
'',
ICON_SIZE_SMALL
);
}
$dsp_line = '<tr align="center" class="'.$oddclass.'">'.
@ -242,7 +352,10 @@ if (!empty($flat_list)) {
$dsp_progress = "";
if (!api_is_invitee()) {
$dsp_progress = '<td>'.learnpath::get_progress_bar($progress, '%').'</td>';
$dsp_progress = '<td>'.learnpath::get_progress_bar(
$progress,
'%'
).'</td>';
}
}
@ -261,22 +374,49 @@ if (!empty($flat_list)) {
// EDIT LP
if ($current_session == $details['lp_session']) {
$dsp_edit_lp = '<a href="lp_controller.php?'.api_get_cidreq().'&action=edit&lp_id='.$id.'">'.
Display::return_icon('settings.png', get_lang('CourseSettings'), '', ICON_SIZE_SMALL).'</a>';
$dsp_edit_lp = '<a href="lp_controller.php?'.api_get_cidreq(
).'&action=edit&lp_id='.$id.'">'.
Display::return_icon(
'settings.png',
get_lang('CourseSettings'),
'',
ICON_SIZE_SMALL
).'</a>';
} else {
$dsp_edit_lp = Display::return_icon('settings_na.png', get_lang('CourseSettings'), '', ICON_SIZE_SMALL);
$dsp_edit_lp = Display::return_icon(
'settings_na.png',
get_lang('CourseSettings'),
'',
ICON_SIZE_SMALL
);
}
// BUILD
if ($current_session == $details['lp_session']) {
if ($details['lp_type'] == 1 || $details['lp_type'] == 2) {
$dsp_build = '<a href="lp_controller.php?'.api_get_cidreq().'&amp;action=add_item&amp;type=step&amp;lp_id='.$id.'&isStudentView=false">'.
Display::return_icon('edit.png', get_lang('LearnpathEditLearnpath'), '', ICON_SIZE_SMALL).'</a>';
$dsp_build = '<a href="lp_controller.php?'.api_get_cidreq(
).'&amp;action=add_item&amp;type=step&amp;lp_id='.$id.'&isStudentView=false">'.
Display::return_icon(
'edit.png',
get_lang('LearnpathEditLearnpath'),
'',
ICON_SIZE_SMALL
).'</a>';
} else {
$dsp_build = Display::return_icon('edit_na.png', get_lang('LearnpathEditLearnpath'), '', ICON_SIZE_SMALL);
$dsp_build = Display::return_icon(
'edit_na.png',
get_lang('LearnpathEditLearnpath'),
'',
ICON_SIZE_SMALL
);
}
} else {
$dsp_build = Display::return_icon('edit_na.png', get_lang('LearnpathEditLearnpath'), '', ICON_SIZE_SMALL);
$dsp_build = Display::return_icon(
'edit_na.png',
get_lang('LearnpathEditLearnpath'),
'',
ICON_SIZE_SMALL
);
}
/* VISIBILITY COMMAND */
@ -286,21 +426,54 @@ if (!empty($flat_list)) {
See http://support.chamilo.org/projects/chamilo-18/wiki/Tools_and_sessions).
*/
if ($details['lp_visibility'] == 0) {
$dsp_visible = "<a href=\"".api_get_self()."?".api_get_cidreq()."&lp_id=$id&action=toggle_visible&new_status=1\">".Display::return_icon('invisible.png', get_lang('Show'), '', ICON_SIZE_SMALL)."</a>";
$dsp_visible = "<a href=\"".api_get_self(
)."?".api_get_cidreq(
)."&lp_id=$id&action=toggle_visible&new_status=1\">".Display::return_icon(
'invisible.png',
get_lang('Show'),
'',
ICON_SIZE_SMALL
)."</a>";
} else {
$dsp_visible = "<a href='".api_get_self()."?".api_get_cidreq()."&lp_id=$id&action=toggle_visible&new_status=0'>".Display::return_icon('visible.png', get_lang('Hide'), '', ICON_SIZE_SMALL)."</a>";
$dsp_visible = "<a href='".api_get_self(
)."?".api_get_cidreq(
)."&lp_id=$id&action=toggle_visible&new_status=0'>".Display::return_icon(
'visible.png',
get_lang('Hide'),
'',
ICON_SIZE_SMALL
)."</a>";
}
/* PUBLISH COMMAND */
if ($current_session == $details['lp_session']) {
if ($details['lp_published'] == "i") {
$dsp_publish = "<a href=\"".api_get_self()."?".api_get_cidreq()."&lp_id=$id&action=toggle_publish&new_status=v\">".
Display::return_icon('lp_publish_na.png', get_lang('LearnpathPublish'), '', ICON_SIZE_SMALL)."</a>";
$dsp_publish = "<a href=\"".api_get_self(
)."?".api_get_cidreq(
)."&lp_id=$id&action=toggle_publish&new_status=v\">".
Display::return_icon(
'lp_publish_na.png',
get_lang('LearnpathPublish'),
'',
ICON_SIZE_SMALL
)."</a>";
} else {
$dsp_publish = "<a href='".api_get_self()."?".api_get_cidreq()."&lp_id=$id&action=toggle_publish&new_status=i'>".Display::return_icon('lp_publish.png', get_lang('LearnpathDoNotPublish'), '', ICON_SIZE_SMALL)."</a>";
$dsp_publish = "<a href='".api_get_self(
)."?".api_get_cidreq(
)."&lp_id=$id&action=toggle_publish&new_status=i'>".Display::return_icon(
'lp_publish.png',
get_lang('LearnpathDoNotPublish'),
'',
ICON_SIZE_SMALL
)."</a>";
}
} else {
$dsp_publish = Display::return_icon('lp_publish_na.png', get_lang('LearnpathDoNotPublish'), '', ICON_SIZE_SMALL);
$dsp_publish = Display::return_icon(
'lp_publish_na.png',
get_lang('LearnpathDoNotPublish'),
'',
ICON_SIZE_SMALL
);
}
/* MULTIPLE ATTEMPTS OR SERIOUS GAME MODE
@ -312,21 +485,44 @@ if (!empty($flat_list)) {
*/
if ($current_session == $details['lp_session']) {
if ($details['seriousgame_mode'] == 1 && $details['lp_prevent_reinit'] == 1) { //seriousgame mode | next = single
$dsp_reinit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_attempt_mode&lp_id='.$id.'">'.
Display::return_icon('reload.png', get_lang('PreventMultipleAttempts'), '', ICON_SIZE_SMALL).
$dsp_reinit = '<a href="lp_controller.php?'.api_get_cidreq(
).'&action=switch_attempt_mode&lp_id='.$id.'">'.
Display::return_icon(
'reload.png',
get_lang('PreventMultipleAttempts'),
'',
ICON_SIZE_SMALL
).
'</a>';
}
if ($details['seriousgame_mode'] == 0 && $details['lp_prevent_reinit'] == 1) { //single mode | next = multiple
$dsp_reinit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_attempt_mode&lp_id='.$id.'">'.
Display::return_icon('reload_na.png', get_lang('AllowMultipleAttempts'), '', ICON_SIZE_SMALL).
$dsp_reinit = '<a href="lp_controller.php?'.api_get_cidreq(
).'&action=switch_attempt_mode&lp_id='.$id.'">'.
Display::return_icon(
'reload_na.png',
get_lang('AllowMultipleAttempts'),
'',
ICON_SIZE_SMALL
).
'</a>';
}
if ($details['seriousgame_mode'] == 0 && $details['lp_prevent_reinit'] == 0) { //multiple mode | next = seriousgame
$dsp_reinit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_attempt_mode&lp_id='.$id.'">'.Display::return_icon('reload.png', get_lang('AllowMultipleAttempts'), '', ICON_SIZE_SMALL).
$dsp_reinit = '<a href="lp_controller.php?'.api_get_cidreq(
).'&action=switch_attempt_mode&lp_id='.$id.'">'.Display::return_icon(
'reload.png',
get_lang('AllowMultipleAttempts'),
'',
ICON_SIZE_SMALL
).
'</a>';
}
} else {
$dsp_reinit = Display::return_icon('reload_na.png', get_lang('AllowMultipleAttempts'), '', ICON_SIZE_SMALL);
$dsp_reinit = Display::return_icon(
'reload_na.png',
get_lang('AllowMultipleAttempts'),
'',
ICON_SIZE_SMALL
);
}
/* SCREEN LP VIEW */
@ -334,54 +530,120 @@ if (!empty($flat_list)) {
switch ($details['lp_view_mode']) {
case 'fullscreen':
$dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_view_mode&lp_id='.$id.$token_parameter.'">'.
Display::return_icon('view_fullscreen.png', get_lang('ViewModeFullScreen'), '', ICON_SIZE_SMALL).'</a>';
$dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq(
).'&action=switch_view_mode&lp_id='.$id.$token_parameter.'">'.
Display::return_icon(
'view_fullscreen.png',
get_lang('ViewModeFullScreen'),
'',
ICON_SIZE_SMALL
).'</a>';
break;
case 'embedded':
$dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_view_mode&lp_id='.$id.$token_parameter.'">'.
Display::return_icon('view_left_right.png', get_lang('ViewModeEmbedded'), '', ICON_SIZE_SMALL).'</a>';
$dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq(
).'&action=switch_view_mode&lp_id='.$id.$token_parameter.'">'.
Display::return_icon(
'view_left_right.png',
get_lang('ViewModeEmbedded'),
'',
ICON_SIZE_SMALL
).'</a>';
break;
case 'embedframe':
$dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_view_mode&lp_id='.$id.$token_parameter.'">'.
Display::return_icon('view_nofullscreen.png', get_lang('ViewModeEmbedFrame'), '', ICON_SIZE_SMALL).'</a>';
$dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq(
).'&action=switch_view_mode&lp_id='.$id.$token_parameter.'">'.
Display::return_icon(
'view_nofullscreen.png',
get_lang('ViewModeEmbedFrame'),
'',
ICON_SIZE_SMALL
).'</a>';
break;
case 'impress':
$dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_view_mode&lp_id='.$id.$token_parameter.'">'.
Display::return_icon('window_list_slide.png', get_lang('ViewModeImpress'), '', ICON_SIZE_SMALL).'</a>';
$dsp_default_view = '<a href="lp_controller.php?'.api_get_cidreq(
).'&action=switch_view_mode&lp_id='.$id.$token_parameter.'">'.
Display::return_icon(
'window_list_slide.png',
get_lang('ViewModeImpress'),
'',
ICON_SIZE_SMALL
).'</a>';
break;
}
} else {
if ($details['lp_view_mode'] == 'fullscreen') {
$dsp_default_view = Display::return_icon('view_fullscreen_na.png', get_lang('ViewModeEmbedded'), '', ICON_SIZE_SMALL);
$dsp_default_view = Display::return_icon(
'view_fullscreen_na.png',
get_lang('ViewModeEmbedded'),
'',
ICON_SIZE_SMALL
);
} else {
$dsp_default_view = Display::return_icon('view_left_right_na.png', get_lang('ViewModeEmbedded'), '', ICON_SIZE_SMALL);
$dsp_default_view = Display::return_icon(
'view_left_right_na.png',
get_lang('ViewModeEmbedded'),
'',
ICON_SIZE_SMALL
);
}
}
/* DEBUG */
if ($test_mode == 'test' or api_is_platform_admin()) {
if ($details['lp_scorm_debug'] == 1) {
$dsp_debug = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_scorm_debug&lp_id='.$id.'">'.
Display::return_icon('bug.png', get_lang('HideDebug'), '', ICON_SIZE_SMALL).'</a>';
$dsp_debug = '<a href="lp_controller.php?'.api_get_cidreq(
).'&action=switch_scorm_debug&lp_id='.$id.'">'.
Display::return_icon(
'bug.png',
get_lang('HideDebug'),
'',
ICON_SIZE_SMALL
).'</a>';
} else {
$dsp_debug = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_scorm_debug&lp_id='.$id.'">'.
Display::return_icon('bug_na.png', get_lang('ShowDebug'), '', ICON_SIZE_SMALL).'</a>';
$dsp_debug = '<a href="lp_controller.php?'.api_get_cidreq(
).'&action=switch_scorm_debug&lp_id='.$id.'">'.
Display::return_icon(
'bug_na.png',
get_lang('ShowDebug'),
'',
ICON_SIZE_SMALL
).'</a>';
}
}
/* Export */
if ($details['lp_type'] == 1) {
$dsp_disk = Display::url(
Display::return_icon('cd.gif', get_lang('Export'), array(), ICON_SIZE_SMALL),
api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id"
Display::return_icon(
'cd.gif',
get_lang('Export'),
array(),
ICON_SIZE_SMALL
),
api_get_self()."?".api_get_cidreq(
)."&action=export&lp_id=$id"
);
} elseif ($details['lp_type'] == 2) {
$dsp_disk = Display::url(
Display::return_icon('cd.gif', get_lang('Export'), array(), ICON_SIZE_SMALL),
api_get_self()."?".api_get_cidreq()."&action=export&lp_id=$id&export_name=".api_replace_dangerous_char($name, 'strict').".zip"
Display::return_icon(
'cd.gif',
get_lang('Export'),
array(),
ICON_SIZE_SMALL
),
api_get_self()."?".api_get_cidreq(
)."&action=export&lp_id=$id&export_name=".api_replace_dangerous_char(
$name,
'strict'
).".zip"
);
} else {
$dsp_disk = Display::return_icon('cd_gray.gif', get_lang('Export'), array(), ICON_SIZE_SMALL);
$dsp_disk = Display::return_icon(
'cd_gray.gif',
get_lang('Export'),
array(),
ICON_SIZE_SMALL
);
}
// Copy
@ -399,55 +661,118 @@ if (!empty($flat_list)) {
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().'?'.api_get_cidreq().'&action=auto_launch&status=0&lp_id='.$id.'">
<img src="../img/launch.png" border="0" title="'.get_lang('DisableLPAutoLaunch').'" /></a>';
$lp_auto_lunch_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().'?'.api_get_cidreq().'&action=auto_launch&status=1&lp_id='.$id.'">
<img src="../img/launch_na.png" border="0" title="'.get_lang('EnableLPAutoLaunch').'" /></a>';
$lp_auto_lunch_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(
'EnableLPAutoLaunch'
).'" /></a>';
}
}
// Export to PDF
$export_icon = ' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=export_to_pdf&lp_id='.$id.'">
'.Display::return_icon('pdf.png', get_lang('ExportToPDFOnlyHTMLAndImages'), '', ICON_SIZE_SMALL).'</a>';
$export_icon = ' <a href="'.api_get_self().'?'.api_get_cidreq(
).'&action=export_to_pdf&lp_id='.$id.'">
'.Display::return_icon(
'pdf.png',
get_lang('ExportToPDFOnlyHTMLAndImages'),
'',
ICON_SIZE_SMALL
).'</a>';
/* Delete */
if ($current_session == $details['lp_session']) {
$dsp_delete = "<a href=\"lp_controller.php?".api_get_cidreq()."&action=delete&lp_id=$id\" ".
"onclick=\"javascript: return confirmation('".addslashes($name)."');\">".
Display::return_icon('delete.png', get_lang('LearnpathDeleteLearnpath'), '', ICON_SIZE_SMALL).'</a>';
$dsp_delete = "<a href=\"lp_controller.php?".api_get_cidreq(
)."&action=delete&lp_id=$id\" ".
"onclick=\"javascript: return confirmation('".addslashes(
$name
)."');\">".
Display::return_icon(
'delete.png',
get_lang('LearnpathDeleteLearnpath'),
'',
ICON_SIZE_SMALL
).'</a>';
} else {
$dsp_delete = Display::return_icon('delete_na.png', get_lang('LearnpathDeleteLearnpath'), '', ICON_SIZE_SMALL);
$dsp_delete = Display::return_icon(
'delete_na.png',
get_lang('LearnpathDeleteLearnpath'),
'',
ICON_SIZE_SMALL
);
}
/* COLUMN ORDER */
// Only active while session mode is not active
if ($current_session == 0) {
if ($details['lp_display_order'] == 1 && $max != 1) {
$dsp_order .= '<a href="lp_controller.php?'.api_get_cidreq().'&action=move_lp_down&lp_id='.$id.'">
'.Display::return_icon('down.png', get_lang('MoveDown'), '', ICON_SIZE_SMALL).'</a>';
$dsp_order .= '<a href="lp_controller.php?'.api_get_cidreq(
).'&action=move_lp_down&lp_id='.$id.'">
'.Display::return_icon(
'down.png',
get_lang('MoveDown'),
'',
ICON_SIZE_SMALL
).'</a>';
} elseif ($current == $max - 1 && $max != 1) {
$dsp_order .= '<a href="lp_controller.php?'.api_get_cidreq().'&action=move_lp_up&lp_id='.$id.'">
'.Display::return_icon('up.png', get_lang('MoveUp'), '', ICON_SIZE_SMALL).'</a>';
$dsp_order .= '<a href="lp_controller.php?'.api_get_cidreq(
).'&action=move_lp_up&lp_id='.$id.'">
'.Display::return_icon(
'up.png',
get_lang('MoveUp'),
'',
ICON_SIZE_SMALL
).'</a>';
} elseif ($max == 1) {
$dsp_order = '';
} else {
$dsp_order .= '<a href="lp_controller.php?'.api_get_cidreq().'&action=move_lp_down&lp_id='.$id.'">'.
Display::return_icon('down.png', get_lang('MoveDown'), '', ICON_SIZE_SMALL).'</a>';
$dsp_order .= '<a href="lp_controller.php?'.api_get_cidreq().'&action=move_lp_up&lp_id='.$id.'">'.
Display::return_icon('up.png', get_lang('MoveUp'), '', ICON_SIZE_SMALL).'</a>';
$dsp_order .= '<a href="lp_controller.php?'.api_get_cidreq(
).'&action=move_lp_down&lp_id='.$id.'">'.
Display::return_icon(
'down.png',
get_lang('MoveDown'),
'',
ICON_SIZE_SMALL
).'</a>';
$dsp_order .= '<a href="lp_controller.php?'.api_get_cidreq(
).'&action=move_lp_up&lp_id='.$id.'">'.
Display::return_icon(
'up.png',
get_lang('MoveUp'),
'',
ICON_SIZE_SMALL
).'</a>';
}
}
if ($is_allowed_to_edit) {
$start_time = Display::tag('td', Display::div($start_time, array('class' => 'small')));
$end_time = Display::tag('td', Display::div($end_time, array('class' => 'small')));
$start_time = Display::tag(
'td',
Display::div($start_time, array('class' => 'small'))
);
$end_time = Display::tag(
'td',
Display::div($end_time, array('class' => 'small'))
);
} else {
$start_time = $end_time = '';
}
} else {
// Student
$export_icon = ' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=export_to_pdf&lp_id='.$id.'">'.
Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL).'</a>';
$export_icon = ' <a href="'.api_get_self().'?'.api_get_cidreq(
).'&action=export_to_pdf&lp_id='.$id.'">'.
Display::return_icon(
'pdf.png',
get_lang('ExportToPDF'),
'',
ICON_SIZE_SMALL
).'</a>';
}
$hideScormExportLink = api_get_setting('hide_scorm_export_link');
@ -468,23 +793,26 @@ if (!empty($flat_list)) {
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;
$lp_showed = true;
echo "</tr>";
//counter for number of elements treated
$current++;
} // end foreach ($flat_list)
echo "</table>";
} else {
if ($is_allowed_to_edit) {
}
}
if ($is_allowed_to_edit && $lp_showed == false) {
echo '<div id="no-data-view">';
echo '<h3>'.get_lang('LearningPaths').'</h3>';
echo '<h2>'.get_lang('LearningPaths').'</h2>';
echo Display::return_icon('scorms.png', '', array(), 64);
echo '<div class="controls">';
echo Display::url(get_lang('LearnpathAddLearnpath'), api_get_self().'?'.api_get_cidreq().'&action=add_lp', array('class' => 'btn btn-primary'));
echo Display::url(get_lang('LearnpathAddLearnpath'), api_get_self().'?'.api_get_cidreq().'&action=add_lp', array('class' => 'btn'));
echo '</div>';
echo '</div>';
}
}
$course_info = api_get_course_info();
learnpath::generate_learning_path_folder($course_info);

@ -0,0 +1,30 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Migrations\Schema\V110;
use Doctrine\DBAL\Schema\Schema;
/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20150527114220 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSql('CREATE TABLE c_lp_category (iid INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, name VARCHAR(255) NOT NULL, position INT NOT NULL, PRIMARY KEY(iid)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('ALTER TABLE c_lp ADD category_id INT NOT NULL DEFAULT 0');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('DROP TABLE c_lp_category');
$this->addSql('ALTER TABLE c_lp DROP category_id');
}
}

@ -204,6 +204,13 @@ class CLp
*/
private $autolunch;
/**
* @var integer
*
* @ORM\Column(name="category_id", type="integer", precision=0, scale=0, nullable=false, unique=false)
*/
private $categoryId;
/**
* @var \DateTime
*
@ -935,4 +942,23 @@ class CLp
{
return $this->cId;
}
/**
* @return int
*/
public function getCategoryId()
{
return $this->categoryId;
}
/**
* @param int $categoryId
* @return CLp
*/
public function setCategoryId($categoryId)
{
$this->categoryId = $categoryId;
return $this;
}
}

@ -0,0 +1,123 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CourseBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* CLpCategory
*
* @ORM\Table(name="c_lp_category")
* @ORM\Entity(repositoryClass="Gedmo\Sortable\Entity\Repository\SortableRepository")
*/
class CLpCategory
{
/**
* @var integer
*
* @ORM\Column(name="iid", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $iid;
/**
* @Gedmo\SortableGroup
* @ORM\Column(name="c_id", type="integer")
*/
private $cId;
/**
* @var string
*
* @ORM\Column(name="name")
*/
private $name;
/**
* @Gedmo\SortablePosition
* @ORM\Column(name="position", type="integer")
*/
private $position;
/**
* Set cId
*
* @param integer $cId
* @return CLpCategory
*/
public function setCId($cId)
{
$this->cId = $cId;
return $this;
}
/**
* Get cId
*
* @return integer
*/
public function getCId()
{
return $this->cId;
}
/**
* Set id
*
* @param integer $id
* @return CLpCategory
*/
public function setId($id)
{
$this->iid = $id;
return $this;
}
/**
* Get blogId
*
* @return integer
*/
public function getId()
{
return $this->iid;
}
/**
* Set category name
*
* @param string $blogName
*
* @return CLpCategory
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get category name
*
* @return string
*/
public function getName()
{
return $this->name;
}
public function setPosition($position)
{
$this->position = $position;
}
public function getPosition()
{
return $this->position;
}
}
Loading…
Cancel
Save