@@ -10,93 +10,93 @@ |
||
10 | 10 | */ |
11 | 11 | class SurveyQuestion extends Coursecopy\Resource |
12 | 12 | { |
13 | - /** |
|
14 | - * Survey ID |
|
15 | - */ |
|
16 | - public $survey_id; |
|
17 | - /** |
|
18 | - * Question and question comment |
|
19 | - */ |
|
20 | - public $survey_question; |
|
21 | - public $survey_question_comment; |
|
22 | - /** |
|
23 | - * Question type |
|
24 | - */ |
|
25 | - public $survey_question_type; |
|
26 | - /** |
|
27 | - * Display ? |
|
28 | - */ |
|
29 | - public $display; |
|
30 | - /** |
|
31 | - * Sorting order |
|
32 | - */ |
|
33 | - public $sort; |
|
34 | - /** |
|
35 | - * Shared question ID |
|
36 | - */ |
|
37 | - public $shared_question_id; |
|
38 | - /** |
|
39 | - * Maximum value for the vote |
|
40 | - */ |
|
41 | - public $max_value; |
|
13 | + /** |
|
14 | + * Survey ID |
|
15 | + */ |
|
16 | + public $survey_id; |
|
17 | + /** |
|
18 | + * Question and question comment |
|
19 | + */ |
|
20 | + public $survey_question; |
|
21 | + public $survey_question_comment; |
|
22 | + /** |
|
23 | + * Question type |
|
24 | + */ |
|
25 | + public $survey_question_type; |
|
26 | + /** |
|
27 | + * Display ? |
|
28 | + */ |
|
29 | + public $display; |
|
30 | + /** |
|
31 | + * Sorting order |
|
32 | + */ |
|
33 | + public $sort; |
|
34 | + /** |
|
35 | + * Shared question ID |
|
36 | + */ |
|
37 | + public $shared_question_id; |
|
38 | + /** |
|
39 | + * Maximum value for the vote |
|
40 | + */ |
|
41 | + public $max_value; |
|
42 | 42 | |
43 | - /** |
|
44 | - * Question's options |
|
45 | - */ |
|
46 | - public $options; |
|
43 | + /** |
|
44 | + * Question's options |
|
45 | + */ |
|
46 | + public $options; |
|
47 | 47 | |
48 | - /** |
|
49 | - * Create a new SurveyQuestion |
|
50 | - * @param int $id |
|
51 | - * @param int $survey_id |
|
52 | - * @param string $survey_question |
|
53 | - * @param string $survey_question_comment |
|
54 | - * @param string $type |
|
55 | - * @param string $display |
|
56 | - * @param int $sort |
|
57 | - * @param int $shared_question_id |
|
58 | - * @param int $max_value |
|
59 | - */ |
|
60 | - function __construct( |
|
61 | - $id, |
|
62 | - $survey_id, |
|
63 | - $survey_question, |
|
64 | - $survey_question_comment, |
|
65 | - $type, |
|
66 | - $display, |
|
67 | - $sort, |
|
68 | - $shared_question_id, |
|
69 | - $max_value |
|
70 | - ) { |
|
71 | - parent::__construct($id,RESOURCE_SURVEYQUESTION); |
|
72 | - $this->survey_id = $survey_id; |
|
73 | - $this->survey_question = $survey_question; |
|
74 | - $this->survey_question_comment = $survey_question_comment; |
|
75 | - $this->survey_question_type = $type; |
|
76 | - $this->display = $display; |
|
77 | - $this->sort = $sort; |
|
78 | - $this->shared_question_id = $shared_question_id; |
|
79 | - $this->max_value = $max_value; |
|
80 | - $this->answers = array(); |
|
81 | - } |
|
82 | - /** |
|
83 | - * Add an answer option to this SurveyQuestion |
|
84 | - * @param string $option_text |
|
85 | - * @param int $sort |
|
86 | - */ |
|
87 | - function add_answer($option_text,$sort) |
|
88 | - { |
|
89 | - $answer = array(); |
|
90 | - $answer['option_text'] = $option_text; |
|
91 | - $answer['sort'] = $sort; |
|
92 | - $this->answers[] = $answer; |
|
93 | - } |
|
94 | - /** |
|
95 | - * Show this question |
|
96 | - */ |
|
97 | - function show() |
|
98 | - { |
|
99 | - parent::show(); |
|
100 | - echo $this->survey_question; |
|
101 | - } |
|
48 | + /** |
|
49 | + * Create a new SurveyQuestion |
|
50 | + * @param int $id |
|
51 | + * @param int $survey_id |
|
52 | + * @param string $survey_question |
|
53 | + * @param string $survey_question_comment |
|
54 | + * @param string $type |
|
55 | + * @param string $display |
|
56 | + * @param int $sort |
|
57 | + * @param int $shared_question_id |
|
58 | + * @param int $max_value |
|
59 | + */ |
|
60 | + function __construct( |
|
61 | + $id, |
|
62 | + $survey_id, |
|
63 | + $survey_question, |
|
64 | + $survey_question_comment, |
|
65 | + $type, |
|
66 | + $display, |
|
67 | + $sort, |
|
68 | + $shared_question_id, |
|
69 | + $max_value |
|
70 | + ) { |
|
71 | + parent::__construct($id,RESOURCE_SURVEYQUESTION); |
|
72 | + $this->survey_id = $survey_id; |
|
73 | + $this->survey_question = $survey_question; |
|
74 | + $this->survey_question_comment = $survey_question_comment; |
|
75 | + $this->survey_question_type = $type; |
|
76 | + $this->display = $display; |
|
77 | + $this->sort = $sort; |
|
78 | + $this->shared_question_id = $shared_question_id; |
|
79 | + $this->max_value = $max_value; |
|
80 | + $this->answers = array(); |
|
81 | + } |
|
82 | + /** |
|
83 | + * Add an answer option to this SurveyQuestion |
|
84 | + * @param string $option_text |
|
85 | + * @param int $sort |
|
86 | + */ |
|
87 | + function add_answer($option_text,$sort) |
|
88 | + { |
|
89 | + $answer = array(); |
|
90 | + $answer['option_text'] = $option_text; |
|
91 | + $answer['sort'] = $sort; |
|
92 | + $this->answers[] = $answer; |
|
93 | + } |
|
94 | + /** |
|
95 | + * Show this question |
|
96 | + */ |
|
97 | + function show() |
|
98 | + { |
|
99 | + parent::show(); |
|
100 | + echo $this->survey_question; |
|
101 | + } |
|
102 | 102 | } |
@@ -66,19 +66,19 @@ |
||
66 | 66 | $attachment_comment = null, |
67 | 67 | $all_day = 0 |
68 | 68 | ) { |
69 | - parent::__construct($id, RESOURCE_EVENT); |
|
69 | + parent::__construct($id, RESOURCE_EVENT); |
|
70 | 70 | |
71 | - $this->title = $title; |
|
72 | - $this->content = $content; |
|
73 | - $this->start_date = $start_date; |
|
74 | - $this->end_date = $end_date; |
|
75 | - $this->all_day = $all_day; |
|
71 | + $this->title = $title; |
|
72 | + $this->content = $content; |
|
73 | + $this->start_date = $start_date; |
|
74 | + $this->end_date = $end_date; |
|
75 | + $this->all_day = $all_day; |
|
76 | 76 | |
77 | - $this->attachment_path = $attachment_path; |
|
78 | - $this->attachment_filename = $attachment_filename; |
|
79 | - $this->attachment_size = $attachment_size; |
|
80 | - $this->attachment_comment = $attachment_comment; |
|
81 | - } |
|
77 | + $this->attachment_path = $attachment_path; |
|
78 | + $this->attachment_filename = $attachment_filename; |
|
79 | + $this->attachment_size = $attachment_size; |
|
80 | + $this->attachment_comment = $attachment_comment; |
|
81 | + } |
|
82 | 82 | |
83 | 83 | /** |
84 | 84 | * Show this Event |
@@ -10,33 +10,33 @@ |
||
10 | 10 | */ |
11 | 11 | class Glossary extends Coursecopy\Resource |
12 | 12 | { |
13 | - public $glossary_id; |
|
14 | - public $name; |
|
15 | - public $description; |
|
16 | - public $display_order; |
|
13 | + public $glossary_id; |
|
14 | + public $name; |
|
15 | + public $description; |
|
16 | + public $display_order; |
|
17 | 17 | |
18 | - /** |
|
19 | - * Create a new Glossary |
|
20 | - * @param int $id |
|
21 | - * @param string $name |
|
22 | - * @param string $description |
|
23 | - * @param int $display_order |
|
24 | - */ |
|
18 | + /** |
|
19 | + * Create a new Glossary |
|
20 | + * @param int $id |
|
21 | + * @param string $name |
|
22 | + * @param string $description |
|
23 | + * @param int $display_order |
|
24 | + */ |
|
25 | 25 | public function __construct($id,$name,$description,$display_order) |
26 | - { |
|
27 | - parent::__construct($id,RESOURCE_GLOSSARY); |
|
28 | - $this->glossary_id = $id; |
|
29 | - $this->name = $name; |
|
30 | - $this->description = $description; |
|
31 | - $this->display_order = $display_order; |
|
32 | - } |
|
26 | + { |
|
27 | + parent::__construct($id,RESOURCE_GLOSSARY); |
|
28 | + $this->glossary_id = $id; |
|
29 | + $this->name = $name; |
|
30 | + $this->description = $description; |
|
31 | + $this->display_order = $display_order; |
|
32 | + } |
|
33 | 33 | |
34 | - /** |
|
35 | - * Show this glossary |
|
36 | - */ |
|
37 | - public function show() |
|
34 | + /** |
|
35 | + * Show this glossary |
|
36 | + */ |
|
37 | + public function show() |
|
38 | 38 | { |
39 | - parent::show(); |
|
40 | - echo $this->name; |
|
41 | - } |
|
39 | + parent::show(); |
|
40 | + echo $this->name; |
|
41 | + } |
|
42 | 42 | } |
@@ -11,33 +11,33 @@ discard block |
||
11 | 11 | */ |
12 | 12 | class Link extends Coursecopy\Resource |
13 | 13 | { |
14 | - /** |
|
15 | - * The title |
|
16 | - */ |
|
14 | + /** |
|
15 | + * The title |
|
16 | + */ |
|
17 | 17 | public $title; |
18 | - /** |
|
19 | - * The URL |
|
20 | - */ |
|
18 | + /** |
|
19 | + * The URL |
|
20 | + */ |
|
21 | 21 | public $url; |
22 | - /** |
|
23 | - * The description |
|
24 | - */ |
|
22 | + /** |
|
23 | + * The description |
|
24 | + */ |
|
25 | 25 | public $description; |
26 | - /** |
|
27 | - * Id of this links category |
|
28 | - */ |
|
26 | + /** |
|
27 | + * Id of this links category |
|
28 | + */ |
|
29 | 29 | public $category_id; |
30 | - /** |
|
31 | - * Display link on course homepage |
|
32 | - */ |
|
30 | + /** |
|
31 | + * Display link on course homepage |
|
32 | + */ |
|
33 | 33 | public $on_homepage; |
34 | - /** |
|
35 | - * Create a new Link |
|
36 | - * @param int $id The id of this link in the Chamilo-course |
|
37 | - * @param string $title |
|
38 | - * @param string $url |
|
39 | - * @param string $description |
|
40 | - */ |
|
34 | + /** |
|
35 | + * Create a new Link |
|
36 | + * @param int $id The id of this link in the Chamilo-course |
|
37 | + * @param string $title |
|
38 | + * @param string $url |
|
39 | + * @param string $description |
|
40 | + */ |
|
41 | 41 | public function __construct( |
42 | 42 | $id, |
43 | 43 | $title, |
@@ -46,21 +46,21 @@ discard block |
||
46 | 46 | $category_id, |
47 | 47 | $on_homepage |
48 | 48 | ) |
49 | - { |
|
50 | - parent::__construct($id,RESOURCE_LINK); |
|
51 | - $this->title = $title; |
|
52 | - $this->url = $url; |
|
53 | - $this->description = $description; |
|
54 | - $this->category_id = $category_id; |
|
55 | - $this->on_homepage = $on_homepage; |
|
56 | - } |
|
49 | + { |
|
50 | + parent::__construct($id,RESOURCE_LINK); |
|
51 | + $this->title = $title; |
|
52 | + $this->url = $url; |
|
53 | + $this->description = $description; |
|
54 | + $this->category_id = $category_id; |
|
55 | + $this->on_homepage = $on_homepage; |
|
56 | + } |
|
57 | 57 | |
58 | 58 | /** |
59 | - * Show this resource |
|
60 | - */ |
|
59 | + * Show this resource |
|
60 | + */ |
|
61 | 61 | public function show() |
62 | - { |
|
63 | - parent::show(); |
|
64 | - echo $this->title.' ('.$this->url.')'; |
|
65 | - } |
|
62 | + { |
|
63 | + parent::show(); |
|
64 | + echo $this->title.' ('.$this->url.')'; |
|
65 | + } |
|
66 | 66 | } |
@@ -10,52 +10,52 @@ |
||
10 | 10 | */ |
11 | 11 | class SurveyInvitation extends Coursecopy\Resource |
12 | 12 | { |
13 | - /** |
|
14 | - * Survey code |
|
15 | - */ |
|
16 | - public $code; |
|
17 | - /** |
|
18 | - * User info |
|
19 | - */ |
|
20 | - public $user; |
|
21 | - /** |
|
22 | - * Invitation code |
|
23 | - */ |
|
24 | - public $invitation_code; |
|
25 | - /** |
|
26 | - * Invitation date |
|
27 | - */ |
|
28 | - public $invitation_date; |
|
29 | - /** |
|
30 | - * Reminder date |
|
31 | - */ |
|
32 | - public $reminder_date; |
|
13 | + /** |
|
14 | + * Survey code |
|
15 | + */ |
|
16 | + public $code; |
|
17 | + /** |
|
18 | + * User info |
|
19 | + */ |
|
20 | + public $user; |
|
21 | + /** |
|
22 | + * Invitation code |
|
23 | + */ |
|
24 | + public $invitation_code; |
|
25 | + /** |
|
26 | + * Invitation date |
|
27 | + */ |
|
28 | + public $invitation_date; |
|
29 | + /** |
|
30 | + * Reminder date |
|
31 | + */ |
|
32 | + public $reminder_date; |
|
33 | 33 | |
34 | - /** |
|
35 | - * Create a new SurveyInvitation |
|
36 | - * @param int $id |
|
37 | - * @param string $code |
|
38 | - * @param string $user |
|
39 | - * @param string $invitation_code |
|
40 | - * @param string $invitation_date |
|
41 | - * @param string $reminder_date |
|
42 | - */ |
|
43 | - public function __construct($id,$code,$user,$invitation_code,$invitation_date,$reminder_date) |
|
44 | - { |
|
45 | - parent::__construct($id, RESOURCE_SURVEYINVITATION); |
|
46 | - $this->code = $code; |
|
47 | - $this->user = $user; |
|
48 | - $this->invitation_code = $invitation_code; |
|
49 | - $this->invitation_date = $invitation_date; |
|
50 | - $this->reminder_date = $reminder_date; |
|
51 | - } |
|
34 | + /** |
|
35 | + * Create a new SurveyInvitation |
|
36 | + * @param int $id |
|
37 | + * @param string $code |
|
38 | + * @param string $user |
|
39 | + * @param string $invitation_code |
|
40 | + * @param string $invitation_date |
|
41 | + * @param string $reminder_date |
|
42 | + */ |
|
43 | + public function __construct($id,$code,$user,$invitation_code,$invitation_date,$reminder_date) |
|
44 | + { |
|
45 | + parent::__construct($id, RESOURCE_SURVEYINVITATION); |
|
46 | + $this->code = $code; |
|
47 | + $this->user = $user; |
|
48 | + $this->invitation_code = $invitation_code; |
|
49 | + $this->invitation_date = $invitation_date; |
|
50 | + $this->reminder_date = $reminder_date; |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * Show this invitation |
|
55 | - */ |
|
56 | - function show() |
|
57 | - { |
|
58 | - parent::show(); |
|
59 | - echo $this->invitation_code; |
|
60 | - } |
|
53 | + /** |
|
54 | + * Show this invitation |
|
55 | + */ |
|
56 | + function show() |
|
57 | + { |
|
58 | + parent::show(); |
|
59 | + echo $this->invitation_code; |
|
60 | + } |
|
61 | 61 | } |
@@ -10,39 +10,39 @@ |
||
10 | 10 | */ |
11 | 11 | class LinkCategory extends Coursecopy\Resource |
12 | 12 | { |
13 | - /** |
|
14 | - * The title |
|
15 | - */ |
|
16 | - public $title; |
|
17 | - /** |
|
18 | - * The description |
|
19 | - */ |
|
20 | - public $description; |
|
21 | - /** |
|
22 | - * The display order |
|
23 | - */ |
|
24 | - public $display_order; |
|
13 | + /** |
|
14 | + * The title |
|
15 | + */ |
|
16 | + public $title; |
|
17 | + /** |
|
18 | + * The description |
|
19 | + */ |
|
20 | + public $description; |
|
21 | + /** |
|
22 | + * The display order |
|
23 | + */ |
|
24 | + public $display_order; |
|
25 | 25 | |
26 | - /** |
|
27 | - * Create a new LinkCategory |
|
28 | - * @param int $id |
|
29 | - * @param string $title |
|
30 | - * @param string $description |
|
31 | - */ |
|
32 | - function __construct($id,$title,$description,$display_order) |
|
33 | - { |
|
34 | - parent::__construct($id,RESOURCE_LINKCATEGORY); |
|
35 | - $this->title = $title; |
|
36 | - $this->description = $description; |
|
37 | - $this->display_order = $display_order; |
|
38 | - } |
|
26 | + /** |
|
27 | + * Create a new LinkCategory |
|
28 | + * @param int $id |
|
29 | + * @param string $title |
|
30 | + * @param string $description |
|
31 | + */ |
|
32 | + function __construct($id,$title,$description,$display_order) |
|
33 | + { |
|
34 | + parent::__construct($id,RESOURCE_LINKCATEGORY); |
|
35 | + $this->title = $title; |
|
36 | + $this->description = $description; |
|
37 | + $this->display_order = $display_order; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * Show this LinkCategory |
|
42 | - */ |
|
43 | - function show() |
|
44 | - { |
|
45 | - parent::show(); |
|
46 | - echo $this->title.' '.$this->description.'<br />'; |
|
47 | - } |
|
40 | + /** |
|
41 | + * Show this LinkCategory |
|
42 | + */ |
|
43 | + function show() |
|
44 | + { |
|
45 | + parent::show(); |
|
46 | + echo $this->title.' '.$this->description.'<br />'; |
|
47 | + } |
|
48 | 48 | } |
@@ -10,39 +10,39 @@ |
||
10 | 10 | */ |
11 | 11 | class CourseDescription extends Resource |
12 | 12 | { |
13 | - /** |
|
14 | - * The title |
|
15 | - */ |
|
16 | - public $title; |
|
17 | - /** |
|
18 | - * The content |
|
19 | - */ |
|
20 | - public $content; |
|
21 | - /** |
|
22 | - * The description type |
|
23 | - */ |
|
24 | - public $description_type; |
|
13 | + /** |
|
14 | + * The title |
|
15 | + */ |
|
16 | + public $title; |
|
17 | + /** |
|
18 | + * The content |
|
19 | + */ |
|
20 | + public $content; |
|
21 | + /** |
|
22 | + * The description type |
|
23 | + */ |
|
24 | + public $description_type; |
|
25 | 25 | |
26 | - /** |
|
27 | - * Create a new course description |
|
28 | - * @param int $id |
|
29 | - * @param string $title |
|
30 | - * @param string $content |
|
31 | - */ |
|
32 | - public function __construct($id,$title,$content,$description_type) |
|
33 | - { |
|
34 | - parent::__construct($id,RESOURCE_COURSEDESCRIPTION); |
|
35 | - $this->title = $title; |
|
36 | - $this->content = $content; |
|
37 | - $this->description_type = $description_type; |
|
38 | - } |
|
26 | + /** |
|
27 | + * Create a new course description |
|
28 | + * @param int $id |
|
29 | + * @param string $title |
|
30 | + * @param string $content |
|
31 | + */ |
|
32 | + public function __construct($id,$title,$content,$description_type) |
|
33 | + { |
|
34 | + parent::__construct($id,RESOURCE_COURSEDESCRIPTION); |
|
35 | + $this->title = $title; |
|
36 | + $this->content = $content; |
|
37 | + $this->description_type = $description_type; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * Show this Event |
|
42 | - */ |
|
43 | - function show() |
|
44 | - { |
|
45 | - parent::show(); |
|
46 | - echo $this->title; |
|
47 | - } |
|
40 | + /** |
|
41 | + * Show this Event |
|
42 | + */ |
|
43 | + function show() |
|
44 | + { |
|
45 | + parent::show(); |
|
46 | + echo $this->title; |
|
47 | + } |
|
48 | 48 | } |
@@ -11,12 +11,12 @@ discard block |
||
11 | 11 | */ |
12 | 12 | class CourseSelectForm |
13 | 13 | { |
14 | - /** |
|
15 | - * Display the form |
|
16 | - * @param array $hidden_fiels Hidden fields to add to the form. |
|
17 | - * @param boolean the document array will be serialize. This is used in the course_copy.php file |
|
18 | - */ |
|
19 | - static function display_form($course, $hidden_fields = null, $avoid_serialize = false) |
|
14 | + /** |
|
15 | + * Display the form |
|
16 | + * @param array $hidden_fiels Hidden fields to add to the form. |
|
17 | + * @param boolean the document array will be serialize. This is used in the course_copy.php file |
|
18 | + */ |
|
19 | + static function display_form($course, $hidden_fields = null, $avoid_serialize = false) |
|
20 | 20 | { |
21 | 21 | global $charset; |
22 | 22 | $resource_titles[RESOURCE_GRADEBOOK] = get_lang('Gradebook'); |
@@ -134,50 +134,50 @@ discard block |
||
134 | 134 | </script> |
135 | 135 | <?php |
136 | 136 | |
137 | - //get destination course title |
|
138 | - if (!empty($hidden_fields['destination_course'])) { |
|
137 | + //get destination course title |
|
138 | + if (!empty($hidden_fields['destination_course'])) { |
|
139 | 139 | $sessionTitle = !empty($hidden_fields['destination_session']) ? ' (' . api_get_session_name( |
140 | 140 | $hidden_fields['destination_session'] |
141 | 141 | ) . ')' : null; |
142 | 142 | |
143 | 143 | $course_infos = CourseManager::get_course_information($hidden_fields['destination_course']); |
144 | - echo '<h3>'; |
|
145 | - echo get_lang('DestinationCourse').' : '.$course_infos['title'] . ' ('.$course_infos['code'].') '.$sessionTitle; |
|
146 | - echo '</h3>'; |
|
147 | - } |
|
144 | + echo '<h3>'; |
|
145 | + echo get_lang('DestinationCourse').' : '.$course_infos['title'] . ' ('.$course_infos['code'].') '.$sessionTitle; |
|
146 | + echo '</h3>'; |
|
147 | + } |
|
148 | 148 | echo '<script src="'.api_get_path(WEB_CODE_PATH).'inc/lib/javascript/upload.js" type="text/javascript"></script>'; |
149 | - echo '<script type="text/javascript">var myUpload = new upload(1000);</script>'; |
|
149 | + echo '<script type="text/javascript">var myUpload = new upload(1000);</script>'; |
|
150 | 150 | |
151 | - echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="javascript: myUpload.start(\'dynamic_div\',\''.api_get_path(WEB_CODE_PATH).'img/progress_bar.gif\',\''.get_lang('PleaseStandBy', '').'\',\'upload_form\')">'; |
|
152 | - echo '<input type="hidden" name="action" value="course_select_form"/>'; |
|
151 | + echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="javascript: myUpload.start(\'dynamic_div\',\''.api_get_path(WEB_CODE_PATH).'img/progress_bar.gif\',\''.get_lang('PleaseStandBy', '').'\',\'upload_form\')">'; |
|
152 | + echo '<input type="hidden" name="action" value="course_select_form"/>'; |
|
153 | 153 | |
154 | - if (!empty($hidden_fields['destination_course']) && |
|
154 | + if (!empty($hidden_fields['destination_course']) && |
|
155 | 155 | !empty($hidden_fields['origin_course']) && |
156 | 156 | !empty($hidden_fields['destination_session']) && |
157 | 157 | !empty($hidden_fields['origin_session']) |
158 | 158 | ) { |
159 | - echo '<input type="hidden" name="destination_course" value="'.$hidden_fields['destination_course'].'"/>'; |
|
160 | - echo '<input type="hidden" name="origin_course" value="'.$hidden_fields['origin_course'].'"/>'; |
|
161 | - echo '<input type="hidden" name="destination_session" value="'.$hidden_fields['destination_session'].'"/>'; |
|
162 | - echo '<input type="hidden" name="origin_session" value="'.$hidden_fields['origin_session'].'"/>'; |
|
163 | - } |
|
159 | + echo '<input type="hidden" name="destination_course" value="'.$hidden_fields['destination_course'].'"/>'; |
|
160 | + echo '<input type="hidden" name="origin_course" value="'.$hidden_fields['origin_course'].'"/>'; |
|
161 | + echo '<input type="hidden" name="destination_session" value="'.$hidden_fields['destination_session'].'"/>'; |
|
162 | + echo '<input type="hidden" name="origin_session" value="'.$hidden_fields['origin_session'].'"/>'; |
|
163 | + } |
|
164 | 164 | |
165 | - $element_count = 0; |
|
165 | + $element_count = 0; |
|
166 | 166 | $forum_categories = array(); |
167 | 167 | $forums = array(); |
168 | 168 | $forum_topics = array(); |
169 | 169 | |
170 | 170 | echo '<p>'; |
171 | - echo get_lang('SelectResources'); |
|
172 | - echo '</p>'; |
|
171 | + echo get_lang('SelectResources'); |
|
172 | + echo '</p>'; |
|
173 | 173 | |
174 | 174 | Display::display_normal_message(get_lang('DontForgetToSelectTheMediaFilesIfYourResourceNeedIt')); |
175 | 175 | |
176 | 176 | foreach ($course->resources as $type => $resources) { |
177 | 177 | if (count($resources) > 0) { |
178 | - switch ($type) { |
|
179 | - //Resources to avoid |
|
180 | - case RESOURCE_FORUMCATEGORY: |
|
178 | + switch ($type) { |
|
179 | + //Resources to avoid |
|
180 | + case RESOURCE_FORUMCATEGORY: |
|
181 | 181 | foreach ($resources as $id => $resource) { |
182 | 182 | $forum_categories[$id] = $resource; |
183 | 183 | } |
@@ -196,49 +196,49 @@ discard block |
||
196 | 196 | $element_count++; |
197 | 197 | break; |
198 | 198 | case RESOURCE_LINKCATEGORY: |
199 | - case RESOURCE_FORUMPOST: |
|
200 | - case RESOURCE_QUIZQUESTION: |
|
201 | - case RESOURCE_SURVEYQUESTION: |
|
202 | - case RESOURCE_SURVEYINVITATION: |
|
203 | - case RESOURCE_SCORM: |
|
204 | - break; |
|
199 | + case RESOURCE_FORUMPOST: |
|
200 | + case RESOURCE_QUIZQUESTION: |
|
201 | + case RESOURCE_SURVEYQUESTION: |
|
202 | + case RESOURCE_SURVEYINVITATION: |
|
203 | + case RESOURCE_SCORM: |
|
204 | + break; |
|
205 | 205 | default : |
206 | - echo '<img id="img_'.$type.'" src="../img/1.gif" onclick="javascript:exp('."'$type'".');" /> '; |
|
207 | - echo '<b onclick="javascript:exp('."'$type'".');" >'.$resource_titles[$type].'</b><br />'; |
|
208 | - echo '<div id="div_'.$type.'">'; |
|
209 | - if ($type == RESOURCE_LEARNPATH) { |
|
210 | - Display::display_warning_message(get_lang('ToExportLearnpathWithQuizYouHaveToSelectQuiz')); |
|
211 | - Display::display_warning_message(get_lang('IfYourLPsHaveAudioFilesIncludedYouShouldSelectThemFromTheDocuments')); |
|
212 | - } |
|
213 | - if ($type == RESOURCE_DOCUMENT) { |
|
206 | + echo '<img id="img_'.$type.'" src="../img/1.gif" onclick="javascript:exp('."'$type'".');" /> '; |
|
207 | + echo '<b onclick="javascript:exp('."'$type'".');" >'.$resource_titles[$type].'</b><br />'; |
|
208 | + echo '<div id="div_'.$type.'">'; |
|
209 | + if ($type == RESOURCE_LEARNPATH) { |
|
210 | + Display::display_warning_message(get_lang('ToExportLearnpathWithQuizYouHaveToSelectQuiz')); |
|
211 | + Display::display_warning_message(get_lang('IfYourLPsHaveAudioFilesIncludedYouShouldSelectThemFromTheDocuments')); |
|
212 | + } |
|
213 | + if ($type == RESOURCE_DOCUMENT) { |
|
214 | 214 | if (api_get_setting('show_glossary_in_documents') != 'none') { |
215 | 215 | Display::display_warning_message(get_lang('ToExportDocumentsWithGlossaryYouHaveToSelectGlossary')); |
216 | 216 | } |
217 | - } |
|
217 | + } |
|
218 | 218 | |
219 | - echo '<blockquote>'; |
|
219 | + echo '<blockquote>'; |
|
220 | 220 | echo '<div class="btn-group">'; |
221 | - echo "<a class=\"btn btn-default\" href=\"javascript: void(0);\" onclick=\"javascript: setCheckbox('$type',true);\" >".get_lang('All')."</a>"; |
|
221 | + echo "<a class=\"btn btn-default\" href=\"javascript: void(0);\" onclick=\"javascript: setCheckbox('$type',true);\" >".get_lang('All')."</a>"; |
|
222 | 222 | echo "<a class=\"btn btn-default\" href=\"javascript: void(0);\" onclick=\"javascript:setCheckbox('$type',false);\" >".get_lang('None')."</a>"; |
223 | - echo '</div><br />'; |
|
223 | + echo '</div><br />'; |
|
224 | 224 | |
225 | - foreach ($resources as $id => $resource) { |
|
225 | + foreach ($resources as $id => $resource) { |
|
226 | 226 | if ($resource) { |
227 | - // Event obj in 1.9.x in 1.10.x the class is CalendarEvent |
|
227 | + // Event obj in 1.9.x in 1.10.x the class is CalendarEvent |
|
228 | 228 | Coursecopy\Resource::setClassType($resource); |
229 | 229 | echo '<label class="checkbox">'; |
230 | 230 | echo '<input type="checkbox" name="resource['.$type.']['.$id.']" id="resource['.$type.']['.$id.']" />'; |
231 | 231 | $resource->show(); |
232 | 232 | echo '</label>'; |
233 | 233 | } |
234 | - } |
|
235 | - echo '</blockquote>'; |
|
236 | - echo '</div>'; |
|
237 | - echo '<script language="javascript">exp('."'$type'".')</script>'; |
|
238 | - $element_count++; |
|
234 | + } |
|
235 | + echo '</blockquote>'; |
|
236 | + echo '</div>'; |
|
237 | + echo '<script language="javascript">exp('."'$type'".')</script>'; |
|
238 | + $element_count++; |
|
239 | 239 | } |
240 | - } |
|
241 | - } |
|
240 | + } |
|
241 | + } |
|
242 | 242 | |
243 | 243 | //Fixes forum order |
244 | 244 | if (!empty($forum_categories)) { |
@@ -294,65 +294,65 @@ discard block |
||
294 | 294 | echo '<script language="javascript">exp('."'$type'".')</script>'; |
295 | 295 | } |
296 | 296 | |
297 | - if ($avoid_serialize) { |
|
298 | - /*Documents are avoided due the huge amount of memory that the serialize php function "eats" |
|
297 | + if ($avoid_serialize) { |
|
298 | + /*Documents are avoided due the huge amount of memory that the serialize php function "eats" |
|
299 | 299 | (when there are directories with hundred/thousand of files) */ |
300 | - // this is a known issue of serialize |
|
301 | - $course->resources['document']= null; |
|
302 | - } |
|
300 | + // this is a known issue of serialize |
|
301 | + $course->resources['document']= null; |
|
302 | + } |
|
303 | 303 | |
304 | - echo '<input type="hidden" name="course" value="'.base64_encode(Course::serialize($course)).'"/>'; |
|
304 | + echo '<input type="hidden" name="course" value="'.base64_encode(Course::serialize($course)).'"/>'; |
|
305 | 305 | |
306 | - if (is_array($hidden_fields)) { |
|
307 | - foreach ($hidden_fields as $key => $value) { |
|
308 | - echo '<input type="hidden" name="'.$key.'" value="'.$value.'"/>'; |
|
309 | - } |
|
310 | - } |
|
306 | + if (is_array($hidden_fields)) { |
|
307 | + foreach ($hidden_fields as $key => $value) { |
|
308 | + echo '<input type="hidden" name="'.$key.'" value="'.$value.'"/>'; |
|
309 | + } |
|
310 | + } |
|
311 | 311 | |
312 | 312 | $recycleOption = isset($_POST['recycle_option']) ? true : false; |
313 | 313 | |
314 | - if (empty($element_count)) { |
|
315 | - Display::display_warning_message(get_lang('NoDataAvailable')); |
|
316 | - } else { |
|
317 | - if (!empty($hidden_fields['destination_session'])) { |
|
318 | - echo '<br /><button class="save" type="submit" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES, $charset))."'".')) return false;" >'. |
|
314 | + if (empty($element_count)) { |
|
315 | + Display::display_warning_message(get_lang('NoDataAvailable')); |
|
316 | + } else { |
|
317 | + if (!empty($hidden_fields['destination_session'])) { |
|
318 | + echo '<br /><button class="save" type="submit" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES, $charset))."'".')) return false;" >'. |
|
319 | 319 | get_lang('Ok').'</button>'; |
320 | - } else { |
|
320 | + } else { |
|
321 | 321 | if ($recycleOption) { |
322 | 322 | echo '<br /><button class="save" type="submit">'. |
323 | 323 | get_lang('Ok').'</button>'; |
324 | 324 | } else { |
325 | - echo '<br /><button class="save" type="submit" onclick="checkLearnPath(\''.addslashes(get_lang('DocumentsWillBeAddedToo')).'\')">'. |
|
325 | + echo '<br /><button class="save" type="submit" onclick="checkLearnPath(\''.addslashes(get_lang('DocumentsWillBeAddedToo')).'\')">'. |
|
326 | 326 | get_lang('Ok').'</button>'; |
327 | 327 | } |
328 | - } |
|
329 | - } |
|
328 | + } |
|
329 | + } |
|
330 | 330 | |
331 | - CourseSelectForm :: display_hidden_quiz_questions($course); |
|
332 | - CourseSelectForm :: display_hidden_scorm_directories($course); |
|
333 | - echo '</form>'; |
|
334 | - echo '<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"></div>'; |
|
335 | - } |
|
331 | + CourseSelectForm :: display_hidden_quiz_questions($course); |
|
332 | + CourseSelectForm :: display_hidden_scorm_directories($course); |
|
333 | + echo '</form>'; |
|
334 | + echo '<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"></div>'; |
|
335 | + } |
|
336 | 336 | |
337 | 337 | /** |
338 | 338 | * @param $course |
339 | 339 | */ |
340 | 340 | static function display_hidden_quiz_questions($course) |
341 | 341 | { |
342 | - if(is_array($course->resources)){ |
|
343 | - foreach ($course->resources as $type => $resources) { |
|
344 | - if (count($resources) > 0) { |
|
345 | - switch ($type) { |
|
346 | - case RESOURCE_QUIZQUESTION: |
|
347 | - foreach ($resources as $id => $resource) { |
|
348 | - echo '<input type="hidden" name="resource['.RESOURCE_QUIZQUESTION.']['.$id.']" id="resource['.RESOURCE_QUIZQUESTION.']['.$id.']" value="On" />'; |
|
349 | - } |
|
350 | - break; |
|
351 | - } |
|
352 | - } |
|
353 | - } |
|
354 | - } |
|
355 | - } |
|
342 | + if(is_array($course->resources)){ |
|
343 | + foreach ($course->resources as $type => $resources) { |
|
344 | + if (count($resources) > 0) { |
|
345 | + switch ($type) { |
|
346 | + case RESOURCE_QUIZQUESTION: |
|
347 | + foreach ($resources as $id => $resource) { |
|
348 | + echo '<input type="hidden" name="resource['.RESOURCE_QUIZQUESTION.']['.$id.']" id="resource['.RESOURCE_QUIZQUESTION.']['.$id.']" value="On" />'; |
|
349 | + } |
|
350 | + break; |
|
351 | + } |
|
352 | + } |
|
353 | + } |
|
354 | + } |
|
355 | + } |
|
356 | 356 | |
357 | 357 | /** |
358 | 358 | * @param $course |
@@ -360,30 +360,30 @@ discard block |
||
360 | 360 | static function display_hidden_scorm_directories($course) |
361 | 361 | { |
362 | 362 | if (is_array($course->resources)){ |
363 | - foreach ($course->resources as $type => $resources) { |
|
364 | - if (count($resources) > 0) { |
|
365 | - switch($type) { |
|
366 | - case RESOURCE_SCORM: |
|
367 | - foreach ($resources as $id => $resource) { |
|
368 | - echo '<input type="hidden" name="resource['.RESOURCE_SCORM.']['.$id.']" id="resource['.RESOURCE_SCORM.']['.$id.']" value="On" />'; |
|
369 | - } |
|
370 | - break; |
|
371 | - } |
|
372 | - } |
|
373 | - } |
|
374 | - } |
|
375 | - } |
|
363 | + foreach ($course->resources as $type => $resources) { |
|
364 | + if (count($resources) > 0) { |
|
365 | + switch($type) { |
|
366 | + case RESOURCE_SCORM: |
|
367 | + foreach ($resources as $id => $resource) { |
|
368 | + echo '<input type="hidden" name="resource['.RESOURCE_SCORM.']['.$id.']" id="resource['.RESOURCE_SCORM.']['.$id.']" value="On" />'; |
|
369 | + } |
|
370 | + break; |
|
371 | + } |
|
372 | + } |
|
373 | + } |
|
374 | + } |
|
375 | + } |
|
376 | 376 | |
377 | - /** |
|
378 | - * Get the posted course |
|
379 | - * @param string $from who calls the function? |
|
377 | + /** |
|
378 | + * Get the posted course |
|
379 | + * @param string $from who calls the function? |
|
380 | 380 | * It can be copy_course, create_backup, import_backup or recycle_course |
381 | 381 | * @param int $session_id |
382 | 382 | * @param string $course_code |
383 | - * @return course The course-object with all resources selected by the user |
|
384 | - * in the form given by display_form(...) |
|
385 | - */ |
|
386 | - public static function get_posted_course($from = '', $session_id = 0, $course_code = '') |
|
383 | + * @return course The course-object with all resources selected by the user |
|
384 | + * in the form given by display_form(...) |
|
385 | + */ |
|
386 | + public static function get_posted_course($from = '', $session_id = 0, $course_code = '') |
|
387 | 387 | { |
388 | 388 | $course = null; |
389 | 389 | |
@@ -393,30 +393,30 @@ discard block |
||
393 | 393 | return false; |
394 | 394 | } |
395 | 395 | |
396 | - // Create the resource DOCUMENT objects |
|
397 | - // Loading the results from the checkboxes of ethe javascript |
|
398 | - $resource = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null; |
|
396 | + // Create the resource DOCUMENT objects |
|
397 | + // Loading the results from the checkboxes of ethe javascript |
|
398 | + $resource = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null; |
|
399 | 399 | |
400 | - $course_info = api_get_course_info($course_code); |
|
401 | - $table_doc = Database::get_course_table(TABLE_DOCUMENT); |
|
402 | - $table_prop = Database::get_course_table(TABLE_ITEM_PROPERTY); |
|
403 | - $course_id = $course_info['real_id']; |
|
400 | + $course_info = api_get_course_info($course_code); |
|
401 | + $table_doc = Database::get_course_table(TABLE_DOCUMENT); |
|
402 | + $table_prop = Database::get_course_table(TABLE_ITEM_PROPERTY); |
|
403 | + $course_id = $course_info['real_id']; |
|
404 | 404 | |
405 | - /* Searching the documents resource that have been set to null because |
|
405 | + /* Searching the documents resource that have been set to null because |
|
406 | 406 | $avoid_serialize is true in the display_form() function*/ |
407 | - if ($from == 'copy_course') { |
|
408 | - if (is_array($resource)) { |
|
409 | - $resource = array_keys($resource); |
|
407 | + if ($from == 'copy_course') { |
|
408 | + if (is_array($resource)) { |
|
409 | + $resource = array_keys($resource); |
|
410 | 410 | |
411 | - foreach ($resource as $resource_item) { |
|
411 | + foreach ($resource as $resource_item) { |
|
412 | 412 | |
413 | - $condition_session = ''; |
|
414 | - if (!empty($session_id)) { |
|
415 | - $session_id = intval($session_id); |
|
416 | - $condition_session = ' AND d.session_id ='.$session_id; |
|
417 | - } |
|
413 | + $condition_session = ''; |
|
414 | + if (!empty($session_id)) { |
|
415 | + $session_id = intval($session_id); |
|
416 | + $condition_session = ' AND d.session_id ='.$session_id; |
|
417 | + } |
|
418 | 418 | |
419 | - $sql = 'SELECT d.id, d.path, d.comment, d.title, d.filetype, d.size |
|
419 | + $sql = 'SELECT d.id, d.path, d.comment, d.title, d.filetype, d.size |
|
420 | 420 | FROM '.$table_doc.' d, '.$table_prop.' p |
421 | 421 | WHERE |
422 | 422 | d.c_id = '.$course_id.' AND |
@@ -425,8 +425,8 @@ discard block |
||
425 | 425 | p.ref = d.id AND p.visibility != 2 AND |
426 | 426 | d.id = '.$resource_item.$condition_session.' |
427 | 427 | ORDER BY path'; |
428 | - $db_result = Database::query($sql); |
|
429 | - while ($obj = Database::fetch_object($db_result)) { |
|
428 | + $db_result = Database::query($sql); |
|
429 | + while ($obj = Database::fetch_object($db_result)) { |
|
430 | 430 | $doc = new Document( |
431 | 431 | $obj->id, |
432 | 432 | $obj->path, |
@@ -450,25 +450,25 @@ discard block |
||
450 | 450 | } |
451 | 451 | $course->resources[RESOURCE_DOCUMENT][$resource_item]->item_properties = $all_properties; |
452 | 452 | } |
453 | - } |
|
454 | - } |
|
455 | - } |
|
456 | - } |
|
453 | + } |
|
454 | + } |
|
455 | + } |
|
456 | + } |
|
457 | 457 | |
458 | - if (is_array($course->resources)) { |
|
459 | - foreach ($course->resources as $type => $resources) { |
|
458 | + if (is_array($course->resources)) { |
|
459 | + foreach ($course->resources as $type => $resources) { |
|
460 | 460 | |
461 | - switch ($type) { |
|
462 | - case RESOURCE_SURVEYQUESTION: |
|
463 | - foreach($resources as $id => $obj) { |
|
464 | - if (isset($_POST['resource'][RESOURCE_SURVEY]) && |
|
461 | + switch ($type) { |
|
462 | + case RESOURCE_SURVEYQUESTION: |
|
463 | + foreach($resources as $id => $obj) { |
|
464 | + if (isset($_POST['resource'][RESOURCE_SURVEY]) && |
|
465 | 465 | is_array($_POST['resource'][RESOURCE_SURVEY]) && |
466 | 466 | !in_array($obj->survey_id, array_keys($_POST['resource'][RESOURCE_SURVEY])) |
467 | 467 | ) { |
468 | - unset($course->resources[$type][$id]); |
|
469 | - } |
|
470 | - } |
|
471 | - break; |
|
468 | + unset($course->resources[$type][$id]); |
|
469 | + } |
|
470 | + } |
|
471 | + break; |
|
472 | 472 | case RESOURCE_FORUMTOPIC: |
473 | 473 | case RESOURCE_FORUMPOST: |
474 | 474 | //Add post from topic |
@@ -520,62 +520,62 @@ discard block |
||
520 | 520 | } |
521 | 521 | } |
522 | 522 | } |
523 | - case RESOURCE_LINKCATEGORY : |
|
524 | - case RESOURCE_FORUMCATEGORY : |
|
525 | - case RESOURCE_QUIZQUESTION : |
|
526 | - case RESOURCE_DOCUMENT: |
|
527 | - // Mark folders to import which are not selected by the user to import, |
|
528 | - // but in which a document was selected. |
|
529 | - $documents = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null; |
|
530 | - if (!empty($resources) && is_array($resources)) |
|
531 | - foreach ($resources as $id => $obj) { |
|
532 | - if (isset($obj->file_type) && $obj->file_type == 'folder' && |
|
523 | + case RESOURCE_LINKCATEGORY : |
|
524 | + case RESOURCE_FORUMCATEGORY : |
|
525 | + case RESOURCE_QUIZQUESTION : |
|
526 | + case RESOURCE_DOCUMENT: |
|
527 | + // Mark folders to import which are not selected by the user to import, |
|
528 | + // but in which a document was selected. |
|
529 | + $documents = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null; |
|
530 | + if (!empty($resources) && is_array($resources)) |
|
531 | + foreach ($resources as $id => $obj) { |
|
532 | + if (isset($obj->file_type) && $obj->file_type == 'folder' && |
|
533 | 533 | !isset($_POST['resource'][RESOURCE_DOCUMENT][$id]) && |
534 | 534 | is_array($documents) |
535 | 535 | ) { |
536 | - foreach ($documents as $id_to_check => $post_value) { |
|
537 | - $obj_to_check = $resources[$id_to_check]; |
|
538 | - $shared_path_part = substr($obj_to_check->path,0,strlen($obj->path)); |
|
539 | - if ($id_to_check != $id && $obj->path == $shared_path_part) { |
|
540 | - $_POST['resource'][RESOURCE_DOCUMENT][$id] = 1; |
|
541 | - break; |
|
542 | - } |
|
543 | - } |
|
544 | - } |
|
545 | - } |
|
546 | - default : |
|
547 | - if (!empty($resources) && is_array($resources)) { |
|
548 | - foreach ($resources as $id => $obj) { |
|
549 | - $resource_is_used_elsewhere = $course->is_linked_resource($obj); |
|
550 | - // check if document is in a quiz (audio/video) |
|
551 | - if ($type == RESOURCE_DOCUMENT && $course->has_resources(RESOURCE_QUIZ)) { |
|
552 | - foreach($course->resources[RESOURCE_QUIZ] as $quiz) { |
|
536 | + foreach ($documents as $id_to_check => $post_value) { |
|
537 | + $obj_to_check = $resources[$id_to_check]; |
|
538 | + $shared_path_part = substr($obj_to_check->path,0,strlen($obj->path)); |
|
539 | + if ($id_to_check != $id && $obj->path == $shared_path_part) { |
|
540 | + $_POST['resource'][RESOURCE_DOCUMENT][$id] = 1; |
|
541 | + break; |
|
542 | + } |
|
543 | + } |
|
544 | + } |
|
545 | + } |
|
546 | + default : |
|
547 | + if (!empty($resources) && is_array($resources)) { |
|
548 | + foreach ($resources as $id => $obj) { |
|
549 | + $resource_is_used_elsewhere = $course->is_linked_resource($obj); |
|
550 | + // check if document is in a quiz (audio/video) |
|
551 | + if ($type == RESOURCE_DOCUMENT && $course->has_resources(RESOURCE_QUIZ)) { |
|
552 | + foreach($course->resources[RESOURCE_QUIZ] as $quiz) { |
|
553 | 553 | $quiz = $quiz->obj; |
554 | - if (isset($quiz->media) && $quiz->media == $id) { |
|
555 | - $resource_is_used_elsewhere = true; |
|
556 | - } |
|
557 | - } |
|
558 | - } |
|
559 | - if (!isset($_POST['resource'][$type][$id]) && !$resource_is_used_elsewhere) { |
|
560 | - unset($course->resources[$type][$id]); |
|
561 | - } |
|
562 | - } |
|
563 | - } |
|
564 | - } |
|
565 | - } |
|
566 | - } |
|
567 | - |
|
568 | - return $course; |
|
569 | - } |
|
570 | - |
|
571 | - /** |
|
572 | - * Display the form session export |
|
573 | - * @param array $hidden_fiels Hidden fields to add to the form. |
|
574 | - * @param boolean the document array will be serialize. This is used in the course_copy.php file |
|
575 | - */ |
|
576 | - public static function display_form_session_export($list_course, $hidden_fields = null, $avoid_serialize = false) |
|
577 | - { |
|
578 | - ?> |
|
554 | + if (isset($quiz->media) && $quiz->media == $id) { |
|
555 | + $resource_is_used_elsewhere = true; |
|
556 | + } |
|
557 | + } |
|
558 | + } |
|
559 | + if (!isset($_POST['resource'][$type][$id]) && !$resource_is_used_elsewhere) { |
|
560 | + unset($course->resources[$type][$id]); |
|
561 | + } |
|
562 | + } |
|
563 | + } |
|
564 | + } |
|
565 | + } |
|
566 | + } |
|
567 | + |
|
568 | + return $course; |
|
569 | + } |
|
570 | + |
|
571 | + /** |
|
572 | + * Display the form session export |
|
573 | + * @param array $hidden_fiels Hidden fields to add to the form. |
|
574 | + * @param boolean the document array will be serialize. This is used in the course_copy.php file |
|
575 | + */ |
|
576 | + public static function display_form_session_export($list_course, $hidden_fields = null, $avoid_serialize = false) |
|
577 | + { |
|
578 | + ?> |
|
579 | 579 | <script> |
580 | 580 | function exp(item) { |
581 | 581 | el = document.getElementById('div_'+item); |
@@ -617,64 +617,64 @@ discard block |
||
617 | 617 | </script> |
618 | 618 | <?php |
619 | 619 | |
620 | - //get destination course title |
|
621 | - if(!empty($hidden_fields['destination_course'])) { |
|
622 | - if (!empty($hidden_fields['destination_session'])) { |
|
623 | - $sessionTitle = ' (' . api_get_session_name($hidden_fields['destination_session']) . ')'; |
|
624 | - } else { |
|
625 | - $sessionTitle = null; |
|
626 | - } |
|
620 | + //get destination course title |
|
621 | + if(!empty($hidden_fields['destination_course'])) { |
|
622 | + if (!empty($hidden_fields['destination_session'])) { |
|
623 | + $sessionTitle = ' (' . api_get_session_name($hidden_fields['destination_session']) . ')'; |
|
624 | + } else { |
|
625 | + $sessionTitle = null; |
|
626 | + } |
|
627 | 627 | $course_infos = CourseManager::get_course_information($hidden_fields['destination_course']); |
628 | - echo '<h3>'; |
|
629 | - echo get_lang('DestinationCourse') . ' : ' . $course_infos['title'] . $sessionTitle; |
|
630 | - echo '</h3>'; |
|
631 | - } |
|
632 | - |
|
633 | - echo '<script src="'.api_get_path(WEB_CODE_PATH).'inc/lib/javascript/upload.js" type="text/javascript"></script>'; |
|
634 | - echo '<script type="text/javascript">var myUpload = new upload(1000);</script>'; |
|
635 | - echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="myUpload.start(\'dynamic_div\',\''.api_get_path(WEB_CODE_PATH).'img/progress_bar.gif\',\''.get_lang('PleaseStandBy').'\',\'upload_form\')">'; |
|
636 | - echo '<input type="hidden" name="action" value="course_select_form"/>'; |
|
637 | - foreach ($list_course as $course){ |
|
638 | - foreach ($course->resources as $type => $resources) { |
|
639 | - if (count($resources) > 0) { |
|
640 | - echo '<img id="img_'.$course->code.'" src="../img/1.gif" onclick="javascript:exp('."'$course->code'".');" />'; |
|
641 | - echo '<b onclick="javascript:exp('."'$course->code'".');" > '.$course->code.'</b><br />'; |
|
642 | - echo '<div id="div_'.$course->code.'">'; |
|
643 | - echo '<blockquote>'; |
|
628 | + echo '<h3>'; |
|
629 | + echo get_lang('DestinationCourse') . ' : ' . $course_infos['title'] . $sessionTitle; |
|
630 | + echo '</h3>'; |
|
631 | + } |
|
632 | + |
|
633 | + echo '<script src="'.api_get_path(WEB_CODE_PATH).'inc/lib/javascript/upload.js" type="text/javascript"></script>'; |
|
634 | + echo '<script type="text/javascript">var myUpload = new upload(1000);</script>'; |
|
635 | + echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="myUpload.start(\'dynamic_div\',\''.api_get_path(WEB_CODE_PATH).'img/progress_bar.gif\',\''.get_lang('PleaseStandBy').'\',\'upload_form\')">'; |
|
636 | + echo '<input type="hidden" name="action" value="course_select_form"/>'; |
|
637 | + foreach ($list_course as $course){ |
|
638 | + foreach ($course->resources as $type => $resources) { |
|
639 | + if (count($resources) > 0) { |
|
640 | + echo '<img id="img_'.$course->code.'" src="../img/1.gif" onclick="javascript:exp('."'$course->code'".');" />'; |
|
641 | + echo '<b onclick="javascript:exp('."'$course->code'".');" > '.$course->code.'</b><br />'; |
|
642 | + echo '<div id="div_'.$course->code.'">'; |
|
643 | + echo '<blockquote>'; |
|
644 | 644 | |
645 | 645 | echo '<div class="btn-group">'; |
646 | - echo "<a class=\"btn\" href=\"#\" onclick=\"javascript:setCheckbox('".$course->code."',true);\" >".get_lang('All')."</a>"; |
|
646 | + echo "<a class=\"btn\" href=\"#\" onclick=\"javascript:setCheckbox('".$course->code."',true);\" >".get_lang('All')."</a>"; |
|
647 | 647 | echo "<a class=\"btn\" href=\"#\" onclick=\"javascript:setCheckbox('".$course->code."',false);\" >".get_lang('None')."</a>"; |
648 | - echo '</div><br />'; |
|
648 | + echo '</div><br />'; |
|
649 | 649 | |
650 | - foreach ($resources as $id => $resource) { |
|
651 | - echo '<label class="checkbox" for="resource['.$course->code.']['.$id.']">'; |
|
650 | + foreach ($resources as $id => $resource) { |
|
651 | + echo '<label class="checkbox" for="resource['.$course->code.']['.$id.']">'; |
|
652 | 652 | echo '<input type="checkbox" name="resource['.$course->code.']['.$id.']" id="resource['.$course->code.']['.$id.']"/>'; |
653 | - $resource->show(); |
|
654 | - echo '</label>'; |
|
655 | - } |
|
656 | - echo '</blockquote>'; |
|
657 | - echo '</div>'; |
|
658 | - echo '<script type="text/javascript">exp('."'$course->code'".')</script>'; |
|
659 | - } |
|
660 | - } |
|
661 | - } |
|
662 | - if ($avoid_serialize) { |
|
663 | - //Documents are avoided due the huge amount of memory that the serialize php function "eats" (when there are directories with hundred/thousand of files) |
|
664 | - // this is a known issue of serialize |
|
665 | - $course->resources['document']= null; |
|
666 | - } |
|
667 | - echo '<input type="hidden" name="course" value="'.base64_encode(Course::serialize($course)).'"/>'; |
|
668 | - if (is_array($hidden_fields)) { |
|
669 | - foreach ($hidden_fields as $key => $value) { |
|
670 | - echo "\n"; |
|
671 | - echo '<input type="hidden" name="'.$key.'" value="'.$value.'"/>'; |
|
672 | - } |
|
673 | - } |
|
674 | - echo '<br /><button class="save" type="submit" onclick="checkLearnPath(\''.addslashes(get_lang('DocumentsWillBeAddedToo')).'\')">'.get_lang('Ok').'</button>'; |
|
675 | - CourseSelectForm :: display_hidden_quiz_questions($course); |
|
676 | - CourseSelectForm :: display_hidden_scorm_directories($course); |
|
677 | - echo '</form>'; |
|
678 | - echo '<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"></div>'; |
|
679 | - } |
|
653 | + $resource->show(); |
|
654 | + echo '</label>'; |
|
655 | + } |
|
656 | + echo '</blockquote>'; |
|
657 | + echo '</div>'; |
|
658 | + echo '<script type="text/javascript">exp('."'$course->code'".')</script>'; |
|
659 | + } |
|
660 | + } |
|
661 | + } |
|
662 | + if ($avoid_serialize) { |
|
663 | + //Documents are avoided due the huge amount of memory that the serialize php function "eats" (when there are directories with hundred/thousand of files) |
|
664 | + // this is a known issue of serialize |
|
665 | + $course->resources['document']= null; |
|
666 | + } |
|
667 | + echo '<input type="hidden" name="course" value="'.base64_encode(Course::serialize($course)).'"/>'; |
|
668 | + if (is_array($hidden_fields)) { |
|
669 | + foreach ($hidden_fields as $key => $value) { |
|
670 | + echo "\n"; |
|
671 | + echo '<input type="hidden" name="'.$key.'" value="'.$value.'"/>'; |
|
672 | + } |
|
673 | + } |
|
674 | + echo '<br /><button class="save" type="submit" onclick="checkLearnPath(\''.addslashes(get_lang('DocumentsWillBeAddedToo')).'\')">'.get_lang('Ok').'</button>'; |
|
675 | + CourseSelectForm :: display_hidden_quiz_questions($course); |
|
676 | + CourseSelectForm :: display_hidden_scorm_directories($course); |
|
677 | + echo '</form>'; |
|
678 | + echo '<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"></div>'; |
|
679 | + } |
|
680 | 680 | } |
@@ -13,18 +13,18 @@ |
||
13 | 13 | public $path; |
14 | 14 | public $title; |
15 | 15 | |
16 | - /** |
|
17 | - * Create a new Scorm Document |
|
18 | - * @param int $id |
|
19 | - * @param string $path |
|
20 | - * @param string $title |
|
21 | - */ |
|
16 | + /** |
|
17 | + * Create a new Scorm Document |
|
18 | + * @param int $id |
|
19 | + * @param string $path |
|
20 | + * @param string $title |
|
21 | + */ |
|
22 | 22 | public function __construct($id, $path, $title) |
23 | - { |
|
24 | - parent::__construct($id,RESOURCE_SCORM); |
|
25 | - $this->path = 'scorm'.$path; |
|
26 | - $this->title = $title; |
|
27 | - } |
|
23 | + { |
|
24 | + parent::__construct($id,RESOURCE_SCORM); |
|
25 | + $this->path = 'scorm'.$path; |
|
26 | + $this->title = $title; |
|
27 | + } |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * Show this document |