Merge branch '1.11.x' of github.com:chamilo/chamilo-lms into 1.11.x

pull/2487/head
Angel Fernando Quiroz Campos 9 years ago
commit b7ec2137a7
  1. 2
      main/document/document.php
  2. 1
      main/inc/lib/model.lib.php
  3. 6
      main/inc/lib/usermanager.lib.php
  4. 13
      src/Chamilo/CourseBundle/Component/CourseCopy/CourseSelectForm.php
  5. 1
      src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Announcement.php
  6. 7
      src/Chamilo/CourseBundle/Component/CourseCopy/Resources/CourseCopyLearnpath.php
  7. 2
      src/Chamilo/CourseBundle/Component/CourseCopy/Resources/CourseCopyTestCategory.php
  8. 1
      src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Forum.php
  9. 8
      src/Chamilo/CourseBundle/Component/CourseCopy/Resources/QuizQuestion.php
  10. 2
      src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Survey.php
  11. 3
      src/Chamilo/CourseBundle/Component/CourseCopy/Resources/ToolIntro.php
  12. 2
      src/Chamilo/CourseBundle/Entity/CToolIntro.php
  13. 17
      tests/behat/features/bootstrap/FeatureContext.php
  14. 20
      tests/behat/features/profile.feature
  15. 20
      tests/behat/features/registration.feature

@ -1971,7 +1971,7 @@ if (isset($_GET['createdir']) && isset($_POST['dirname']) && $_POST['dirname'] !
$document_id = DocumentManager::get_document_id($courseInfo, $_POST['dirname']); $document_id = DocumentManager::get_document_id($courseInfo, $_POST['dirname']);
} }
$selector = ''; $selector = '';
if (!$is_certificate_mode) { if (!$is_certificate_mode && !isset($_GET['move'])) {
$selector = DocumentManager::build_directory_selector( $selector = DocumentManager::build_directory_selector(
$folders, $folders,
$document_id, $document_id,

@ -25,6 +25,7 @@ class Model
/** /**
* Useful finder - experimental akelos like only use in notification.lib.php send function * Useful finder - experimental akelos like only use in notification.lib.php send function
* @param string $type
*/ */
public function find($type, $options = null) public function find($type, $options = null)
{ {

@ -739,6 +739,12 @@ class UserManager
TicketManager::deleteUserFromTicketSystem($user_id); TicketManager::deleteUserFromTicketSystem($user_id);
} }
$tableExists = $connection->getSchemaManager()->tablesExist(['c_lp_category_user']);
if ($tableExists) {
$sql = "DELETE FROM c_lp_category_user WHERE user_id = $user_id";
Database::query($sql);
}
// Delete user from database // Delete user from database
$sql = "DELETE FROM $table_user WHERE id = '".$user_id."'"; $sql = "DELETE FROM $table_user WHERE id = '".$user_id."'";
Database::query($sql); Database::query($sql);

@ -21,10 +21,14 @@ class CourseSelectForm
* Display the form * Display the form
* @param array $course * @param array $course
* @param array $hidden_fields Hidden fields to add to the form. * @param array $hidden_fields Hidden fields to add to the form.
* @param boolean $avoid_serialize the document array will be serialize. This is used in the course_copy.php file * @param boolean $avoid_serialize the document array will be serialize.
* This is used in the course_copy.php file
*/ */
public static function display_form($course, $hidden_fields = null, $avoid_serialize = false) public static function display_form(
{ $course,
$hidden_fields = null,
$avoid_serialize = false
) {
global $charset; global $charset;
$resource_titles[RESOURCE_ASSET] = get_lang('Assets'); $resource_titles[RESOURCE_ASSET] = get_lang('Assets');
$resource_titles[RESOURCE_GRADEBOOK] = get_lang('Gradebook'); $resource_titles[RESOURCE_GRADEBOOK] = get_lang('Gradebook');
@ -259,11 +263,9 @@ class CourseSelectForm
foreach ($forum_categories as $forum_category_id => $forum_category) { foreach ($forum_categories as $forum_category_id => $forum_category) {
echo '<li>'; echo '<li>';
echo '<label class="checkbox">'; echo '<label class="checkbox">';
echo '<input type="checkbox" id="resource_'.RESOURCE_FORUMCATEGORY.'_'.$forum_category_id.'" my_rel="'.$forum_category_id.'" onclick="javascript:check_category(this);" name="resource['.RESOURCE_FORUMCATEGORY.']['.$forum_category_id.']" /> '; echo '<input type="checkbox" id="resource_'.RESOURCE_FORUMCATEGORY.'_'.$forum_category_id.'" my_rel="'.$forum_category_id.'" onclick="javascript:check_category(this);" name="resource['.RESOURCE_FORUMCATEGORY.']['.$forum_category_id.']" /> ';
$forum_category->show(); $forum_category->show();
echo '</label>'; echo '</label>';
echo '</li>'; echo '</li>';
if (isset($forums[$forum_category_id])) { if (isset($forums[$forum_category_id])) {
@ -394,7 +396,6 @@ class CourseSelectForm
public static function get_posted_course($from = '', $session_id = 0, $course_code = '') public static function get_posted_course($from = '', $session_id = 0, $course_code = '')
{ {
$course = null; $course = null;
if (isset($_POST['course'])) { if (isset($_POST['course'])) {
$course = Course::unserialize(base64_decode($_POST['course'])); $course = Course::unserialize(base64_decode($_POST['course']));
} else { } else {

@ -66,7 +66,6 @@ class Announcement extends Resource
$this->date = $date; $this->date = $date;
$this->display_order = $display_order; $this->display_order = $display_order;
$this->email_sent = $email_sent; $this->email_sent = $email_sent;
$this->attachment_path = $path; $this->attachment_path = $path;
$this->attachment_filename = $filename; $this->attachment_filename = $filename;
$this->attachment_size = $size; $this->attachment_size = $size;

@ -156,7 +156,6 @@ class CourseCopyLearnpath extends Resource
$this->content_license = $content_license; $this->content_license = $content_license;
$this->debug = $debug; $this->debug = $debug;
$this->visibility = $visibility; $this->visibility = $visibility;
$this->use_max_score = $use_max_score; $this->use_max_score = $use_max_score;
$this->autolaunch = $autolaunch; $this->autolaunch = $autolaunch;
$this->created_on = $created_on; $this->created_on = $created_on;
@ -164,12 +163,11 @@ class CourseCopyLearnpath extends Resource
$this->publicated_on = $publicated_on; $this->publicated_on = $publicated_on;
$this->expired_on = $expired_on; $this->expired_on = $expired_on;
$this->session_id = $session_id; $this->session_id = $session_id;
$this->author = $author; $this->author = $author;
$this->preview_image = $preview_image; $this->preview_image = $preview_image;
$this->items = $items; $this->items = $items;
} }
/** /**
* Get the items * Get the items
*/ */
@ -196,7 +194,8 @@ class CourseCopyLearnpath extends Resource
/** /**
* Show this learnpath * Show this learnpath
*/ */
function show() { function show()
{
parent::show(); parent::show();
echo $this->name; echo $this->name;
} }

@ -35,7 +35,7 @@ class CourseCopyTestCategory extends Resource
/** /**
* Show the test_category title, used in the partial recycle_course.php form * Show the test_category title, used in the partial recycle_course.php form
*/ */
function show() public function show()
{ {
parent::show(); parent::show();
echo $this->title; echo $this->title;

@ -117,5 +117,4 @@ class Forum extends Resource
parent::show(); parent::show();
echo $this->obj->forum_title; echo $this->obj->forum_title;
} }
} }

@ -97,6 +97,14 @@ class QuizQuestion extends Resource
/** /**
* Add an answer to this QuizQuestion * Add an answer to this QuizQuestion
* @param int $answer_id
* @param string $answer_text
* @param string $correct
* @param string $comment
* @param string $ponderation
* @param string $position
* @param string $hotspot_coordinates
* @param string $hotspot_type
*/ */
public function add_answer( public function add_answer(
$answer_id, $answer_id,

@ -80,7 +80,7 @@ class Survey extends Resource
* @param string $lang * @param string $lang
* @param string $avail_from * @param string $avail_from
* @param string $avail_till * @param string $avail_till
* @param char $is_shared * @param string $is_shared
* @param string $template * @param string $template
* @param string $intro * @param string $intro
* @param string $surveythanks * @param string $surveythanks

@ -35,8 +35,7 @@ class ToolIntro extends Resource
public function show() public function show()
{ {
parent::show(); parent::show();
switch ($this->id) switch ($this->id) {
{
case TOOL_DOCUMENT: case TOOL_DOCUMENT:
$lang_id = 'Documents'; $lang_id = 'Documents';
break; break;

@ -94,7 +94,7 @@ class CToolIntro
/** /**
* Get id * Get id
* *
* @return string * @return integer
*/ */
public function getId() public function getId()
{ {

@ -27,6 +27,7 @@ class FeatureContext extends MinkContext
$this->pressButton('submitAuth'); $this->pressButton('submitAuth');
$this->getSession()->back(); $this->getSession()->back();
} }
/** /**
* @Given /^I am a session administrator$/ * @Given /^I am a session administrator$/
*/ */
@ -40,6 +41,7 @@ class FeatureContext extends MinkContext
])); ]));
$this->pressButton('submitAuth'); $this->pressButton('submitAuth');
} }
/** /**
* @Given /^I am a teacher$/ * @Given /^I am a teacher$/
*/ */
@ -51,6 +53,7 @@ class FeatureContext extends MinkContext
$this->fillField('password', 'mmosquera'); $this->fillField('password', 'mmosquera');
$this->pressButton('submitAuth'); $this->pressButton('submitAuth');
} }
/** /**
* @Given /^I am a teacher in course "([^"]*)"$/ * @Given /^I am a teacher in course "([^"]*)"$/
* @Todo implement * @Todo implement
@ -61,6 +64,7 @@ class FeatureContext extends MinkContext
//$result = ... //$result = ...
//if ($result !== false) { ... } //if ($result !== false) { ... }
} }
/** /**
* @Given /^I am a student$/ * @Given /^I am a student$/
*/ */
@ -68,10 +72,11 @@ class FeatureContext extends MinkContext
{ {
$this->visit('/index.php?logout=logout'); $this->visit('/index.php?logout=logout');
$this->iAmOnHomepage(); $this->iAmOnHomepage();
$this->fillField('login', 'mbrandybuck'); $this->fillField('login', 'acostea');
$this->fillField('password', 'mbrandybuck'); $this->fillField('password', 'acostea');
$this->pressButton('submitAuth'); $this->pressButton('submitAuth');
} }
/** /**
* @Given /^I am an HR manager$/ * @Given /^I am an HR manager$/
*/ */
@ -83,6 +88,7 @@ class FeatureContext extends MinkContext
$this->fillField('password', 'ptook'); $this->fillField('password', 'ptook');
$this->pressButton('submitAuth'); $this->pressButton('submitAuth');
} }
/** /**
* @Given /^I am a student boss$/ * @Given /^I am a student boss$/
*/ */
@ -94,6 +100,7 @@ class FeatureContext extends MinkContext
$this->fillField('password', 'abaggins'); $this->fillField('password', 'abaggins');
$this->pressButton('submitAuth'); $this->pressButton('submitAuth');
} }
/** /**
* @Given /^I am an invitee$/ * @Given /^I am an invitee$/
*/ */
@ -105,6 +112,7 @@ class FeatureContext extends MinkContext
$this->fillField('password', 'bproudfoot'); $this->fillField('password', 'bproudfoot');
$this->pressButton('submitAuth'); $this->pressButton('submitAuth');
} }
/** /**
* @Given /^course "([^"]*)" exists$/ * @Given /^course "([^"]*)" exists$/
*/ */
@ -114,6 +122,7 @@ class FeatureContext extends MinkContext
$this->visit('/main/admin/course_list.php?keyword=' . $argument); $this->visit('/main/admin/course_list.php?keyword=' . $argument);
$this->assertPageContainsText($argument); $this->assertPageContainsText($argument);
} }
/** /**
* @Given /^course "([^"]*)" is deleted$/ * @Given /^course "([^"]*)" is deleted$/
*/ */
@ -123,6 +132,7 @@ class FeatureContext extends MinkContext
$this->visit('/main/admin/course_list.php?keyword=' . $argument); $this->visit('/main/admin/course_list.php?keyword=' . $argument);
$this->clickLink('Delete'); $this->clickLink('Delete');
} }
/** /**
* @Given /^I am in course "([^"]*)"$/ * @Given /^I am in course "([^"]*)"$/
* @Todo redefine function to be different from I am on course TEMP homepage * @Todo redefine function to be different from I am on course TEMP homepage
@ -132,6 +142,7 @@ class FeatureContext extends MinkContext
$this->visit('/main/course_home/course_home.php?cDir=' . $argument); $this->visit('/main/course_home/course_home.php?cDir=' . $argument);
$this->assertElementNotOnPage('.alert-danger'); $this->assertElementNotOnPage('.alert-danger');
} }
/** /**
* @Given /^I am on course "([^"]*)" homepage$/ * @Given /^I am on course "([^"]*)" homepage$/
*/ */
@ -140,6 +151,7 @@ class FeatureContext extends MinkContext
$this->visit('/main/course_home/course_home.php?cDir=' . $argument); $this->visit('/main/course_home/course_home.php?cDir=' . $argument);
$this->assertElementNotOnPage('.alert-danger'); $this->assertElementNotOnPage('.alert-danger');
} }
/** /**
* @Given /^I am a "([^"]*)" user$/ * @Given /^I am a "([^"]*)" user$/
*/ */
@ -243,6 +255,7 @@ class FeatureContext extends MinkContext
$this->selectOption('show_admin_toolbar', 'do_not_show'); $this->selectOption('show_admin_toolbar', 'do_not_show');
$this->pressButton('submit'); $this->pressButton('submit');
} }
/** /**
* @Given /^Admin top bar is enabled$/ * @Given /^Admin top bar is enabled$/
*/ */

@ -0,0 +1,20 @@
Feature: Profile page
A student should update his profile information.
Background:
Given I am a student
Scenario: Update profile with first name Andrew then restore Andrea
Given I am on "/main/auth/profile.php"
When I fill in the following:
| firstname | Andrew |
And I press "Save settings"
And wait for the page to be loaded
Then I should see "Your new profile has been saved"
And I should see "Andrew"
Then I fill in the following:
| firstname | Andrea |
And I press "Save settings"
Then I should see "Your new profile has been saved"
Then I am on "/main/social/home.php"
Then I should see "Andrea"

@ -0,0 +1,20 @@
Feature: User registration
In order to enter the system
I need to be able to create my account
Scenario: Enter the registration form
Given I am on the homepage
Then I should see "Sign up"
Then I follow "Sign up!"
Then I should see "Registration"
And I fill in the following:
| firstname | user registration first name |
| lastname | user registration last name |
| email | user-registration@example.com |
| official_code | user registration |
| username | user_registration |
| pass1 | user-registration |
| pass2 | user-registration |
And I press "Register"
And wait for the page to be loaded
Then I should see "Your personal settings have been registered"
Loading…
Cancel
Save