Merge branch '1.11.x' into session

remotes/angel/1.11.x
Alex Aragon 9 years ago
commit 7382179b6d
  1. 1
      main/admin/settings.lib.php
  2. 6
      main/inc/ajax/plugin.ajax.php
  3. 16
      main/inc/lib/message.lib.php
  4. 43
      main/inc/lib/plugin.class.php
  5. 22
      main/inc/lib/plugin.lib.php
  6. 42
      main/inc/lib/template.lib.php
  7. 99
      plugin/advanced_subscription/readme.txt
  8. 4
      plugin/buycourses/index.php
  9. 87
      plugin/courseblock/CourseBlockPlugin.php
  10. 8
      plugin/courseblock/README.md
  11. 5
      plugin/courseblock/config.php
  12. 2
      plugin/courseblock/index.php
  13. 9
      plugin/courseblock/install.php
  14. 11
      plugin/courseblock/lang/english.php
  15. 2
      plugin/courseblock/lang/french.php
  16. 2
      plugin/courseblock/lang/spanish.php
  17. 4
      plugin/courseblock/plugin.php
  18. 3
      plugin/courselegal/README.md
  19. 1
      plugin/courselegal/config.php
  20. 3
      plugin/courselegal/plugin.php
  21. 2
      plugin/olpc_peru_filter/lib/olpc_peru_filter_plugin.class.php
  22. 4
      plugin/openmeetings/README.md
  23. 2
      plugin/openmeetings/config.php
  24. 2
      plugin/openmeetings/plugin.php
  25. 2
      plugin/skype/readme.txt
  26. 28
      plugin/ticket/database.php
  27. 13
      plugin/ticket/src/categories.php
  28. 7
      plugin/ticket/src/categories_add_user.php
  29. 48
      plugin/ticket/src/new_ticket.php
  30. 25
      plugin/tour/readme.txt
  31. 10
      plugin/vchamilo/README.md
  32. 2
      plugin/vchamilo/lang/english.php
  33. 80
      plugin/vchamilo/lib.php
  34. 4
      plugin/vchamilo/views/editinstance.controller.php
  35. 14
      plugin/vchamilo/views/editinstance_form.php
  36. 41
      plugin/vchamilo/views/manage.controller.php

@ -167,7 +167,6 @@ function handle_plugins()
echo '<input type="checkbox" name="plugin_'.$plugin.'[]">';
}
echo '</td><td>';
echo '<h4>'.$plugin_info['title'].' <small>v '.$plugin_info['version'].'</small></h4>';
echo '<p>'.$plugin_info['comment'].'</p>';
echo '<p>'.get_lang('Author').': '.$plugin_info['author'].'</p>';

@ -14,12 +14,14 @@ switch ($action) {
case 'md_to_html':
$plugin = isset($_GET['plugin']) ? $_GET['plugin'] : '';
$appPlugin = new AppPlugin();
$pluginList = $appPlugin->get_installed_plugins();
$pluginInfo = $appPlugin->getPluginInfo($plugin);
$html = '';
if (in_array($plugin, $pluginList)) {
if (!empty($pluginInfo)) {
$file = api_get_path(SYS_PLUGIN_PATH).$plugin.'/README.md';
if (file_exists($file)) {
$content = file_get_contents($file);
$html = MarkdownExtra::defaultTransform($content);
}
}

@ -281,7 +281,6 @@ class MessageManager
if (!empty($receiver_user_id) || !empty($group_id)) {
// message for user friend
$clean_subject = Database::escape_string($subject);
$clean_content = Database::escape_string($content);
//message in inbox for user friend
@ -347,9 +346,10 @@ class MessageManager
$o = 0;
foreach ($file_attachments as $file_attach) {
if ($file_attach['error'] == 0) {
$comment = isset($file_comments[$o]) ? $file_comments[$o] : '';
self::save_message_attachment_file(
$file_attach,
$file_comments[$o],
$comment,
$outbox_last_id,
$user_sender_id
);
@ -1292,10 +1292,10 @@ class MessageManager
$name = $user_sender_info['complete_name'];
$topic_page_nr = isset($_GET['topics_page_nr']) ? intval($_GET['topics_page_nr']) : null;
$links.= '<div class="pull-right">';
$links.= '<div class="btn-group">';
if (($my_group_role == GROUP_USER_PERMISSION_ADMIN ||
$my_group_role == GROUP_USER_PERMISSION_MODERATOR) ||
$main_message['user_sender_id'] == $current_user_id
@ -1320,7 +1320,7 @@ class MessageManager
'class' => 'btn btn-default'
]
);
}
}
$links .= Display::url(
Display::returnFontAwesomeIcon('pencil'),
$urlEdit,
@ -1357,9 +1357,9 @@ class MessageManager
);
$links.= '</div>';
$links.= '</div>';
$title = '<h4>'.Security::remove_XSS($main_message['title'].$delete_button, STUDENT, true).$links.'</h4>';
$userPicture = $user_sender_info['avatar'];
$main_content .= '<div class="avatar-author">';
$main_content .= '<img src="'.$userPicture.'" alt="'.$name.'" class="img-responsive img-circle" width="64" height="64" title="'.$name.'" />';
@ -1410,7 +1410,7 @@ class MessageManager
$userPicture = $user_sender_info['avatar'];
$user_link = '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$topic['user_sender_id'].'">'.$name.'&nbsp</a>';
$html_items.= '<div class="avatar-author"><img src="'.$userPicture.'" alt="'.$name.'" class="img-responsive img-circle" width="64" height="64" title="'.$name.'" />'.$user_link.'</div>';
$date = '';
if ($topic['send_date'] != $topic['update_date']) {

@ -19,8 +19,8 @@ class Plugin
{
protected $version = '';
protected $author = '';
protected $fields = array();
private $settings = null;
protected $fields = [];
private $settings = [];
// Translation strings.
private $strings = null;
public $isCoursePlugin = false;
@ -70,6 +70,7 @@ class Plugin
public function get_info()
{
$result = array();
$result['obj'] = $this;
$result['title'] = $this->get_title();
$result['comment'] = $this->get_comment();
$result['version'] = $this->get_version();
@ -321,7 +322,7 @@ class Plugin
$interfaceLanguageId = api_get_language_id($language_interface);
$interfaceLanguageInfo = api_get_language_info($interfaceLanguageId);
$languageParentId = (!empty($interfaceLanguageInfo['parent_id'])?intval($interfaceLanguageInfo['parent_id']):0);
$languageParentId = !empty($interfaceLanguageInfo['parent_id']) ? (int) $interfaceLanguageInfo['parent_id'] : 0;
//1. Loading english if exists
$english_path = $root.$plugin_name."/lang/english.php";
@ -333,8 +334,7 @@ class Plugin
}
$path = $root.$plugin_name."/lang/$language_interface.php";
//2. Loading the system language
// 2. Loading the system language
if (is_readable($path)) {
include $path;
if (!empty($strings)) {
@ -391,9 +391,10 @@ class Plugin
{
$plugin_name = $this->get_name();
$t_course = Database::get_course_table(TABLE_COURSE_SETTING);
$courseId = intval($courseId);
$courseId = (int) $courseId;
if (empty($courseId)) {
return false;
}
@ -428,7 +429,8 @@ class Plugin
'subkey' => $variable,
'value' => $value,
'category' => 'plugins',
'type' => $type
'type' => $type,
'title' => ''
];
Database::insert($t_course, $params);
}
@ -444,7 +446,8 @@ class Plugin
'subkey' => $plugin_name,
'value' => $value,
'category' => 'plugins',
'type' => $type
'type' => $type,
'title' => ''
];
Database::insert($t_course, $params);
}
@ -464,8 +467,6 @@ class Plugin
$result = Database::query($sql);
if (!Database::num_rows($result)) {
$tool_link = "$plugin_name/start.php";
//$visibility = AddCourse::string2binary(api_get_setting('course_create_active_tools', $plugin_name));
$cToolId = AddCourse::generateToolId($courseId);
Database::insert(
@ -498,7 +499,9 @@ class Plugin
public function uninstall_course_fields($courseId)
{
$courseId = intval($courseId);
if (empty($courseId)) {
return false;
}
$plugin_name = $this->get_name();
@ -611,11 +614,11 @@ class Plugin
$tabNum = $customTabsNum + 1;
//Avoid Tab Name Spaces
// Avoid Tab Name Spaces
$tabNameNoSpaces = preg_replace('/\s+/', '', $tabName);
$subkeytext = "Tabs" . $tabNameNoSpaces;
//Check if it is already added
// Check if it is already added
$checkCondition = array(
'where' =>
array(
@ -624,11 +627,14 @@ class Plugin
)
)
);
$checkDuplicate = Database::select('*', 'settings_current', $checkCondition);
if (!empty($checkDuplicate)) {
return false;
}
//End Check
// End Check
$subkey = 'custom_tab_' . $tabNum;
$attributes = array(
'variable' => 'show_tabs',
@ -645,7 +651,7 @@ class Plugin
);
$resp = Database::insert('settings_current', $attributes);
//Save the id
// Save the id
$settings = $this->get_settings();
$setData = array (
'comment' => $subkey
@ -757,4 +763,13 @@ class Plugin
{
return true;
}
/**
* @param string $region
* @return string
*/
public function renderRegion($region)
{
return '';
}
}

@ -261,8 +261,9 @@ class AppPlugin
public function load_region($region, $template, $forced = false)
{
if ($region == 'course_tool_plugin') {
return null;
return '';
}
ob_start();
$this->get_all_plugin_contents_by_region($region, $template, $forced);
$content = ob_get_contents();
@ -331,9 +332,9 @@ class AppPlugin
}
/**
* @param string $region
* @param Template $template
* @param bool $forced
* @param string $region
* @param Template $template
* @param bool $forced
*
* @return bool
*
@ -343,14 +344,13 @@ class AppPlugin
{
global $_plugins;
if (isset($_plugins[$region]) && is_array($_plugins[$region])) {
//if (1) {
//Load the plugin information
// Load the plugin information
foreach ($_plugins[$region] as $plugin_name) {
//The plugin_info variable is available inside the plugin index
// The plugin_info variable is available inside the plugin index
$plugin_info = $this->getPluginInfo($plugin_name, $forced);
//We also know where the plugin is
// We also know where the plugin is
$plugin_info['current_region'] = $region;
// Loading the plugin/XXX/index.php file
@ -361,10 +361,10 @@ class AppPlugin
//Loading the lang variables of the plugin if exists
self::load_plugin_lang_variables($plugin_name);
//Printing the plugin index.php file
// Printing the plugin index.php file
require $plugin_file;
//If the variable $_template is set we assign those values to be accesible in Twig
// If the variable $_template is set we assign those values to be accessible in Twig
if (isset($_template)) {
$_template['plugin_info'] = $plugin_info;
} else {
@ -384,7 +384,6 @@ class AppPlugin
if (!empty($template_list)) {
foreach ($template_list as $plugin_tpl) {
if (!empty($plugin_tpl)) {
//$template_plugin_file = api_get_path(SYS_PLUGIN_PATH)."$plugin_name/$plugin_tpl"; //for smarty
$template_plugin_file = "$plugin_name/$plugin_tpl"; // for twig
$template->display($template_plugin_file, false);
}
@ -418,6 +417,7 @@ class AppPlugin
$plugin_info = array();
if (file_exists($plugin_file)) {
require $plugin_file;
}

@ -185,8 +185,8 @@ class Template
$this->plugin = new AppPlugin();
//1. Showing installed plugins in regions
$plugin_regions = $this->plugin->get_plugin_regions();
foreach ($plugin_regions as $region) {
$pluginRegions = $this->plugin->get_plugin_regions();
foreach ($pluginRegions as $region) {
$this->set_plugin_region($region);
}
@ -950,7 +950,7 @@ class Template
$portal_name = empty($institution) ? api_get_setting('siteName') : $institution;
$this->assign('portal_name', $portal_name);
//Menu
$menu = menuArray();
$this->assign('menu', $menu);
@ -1150,17 +1150,39 @@ class Template
/**
* Sets the plugin content in a template variable
* @param string $plugin_region
* @param string $pluginRegion
* @return null
*/
public function set_plugin_region($plugin_region)
public function set_plugin_region($pluginRegion)
{
if (!empty($plugin_region)) {
$region_content = $this->plugin->load_region($plugin_region, $this, $this->force_plugin_load);
if (!empty($region_content)) {
$this->assign('plugin_'.$plugin_region, $region_content);
if (!empty($pluginRegion)) {
$regionContent = $this->plugin->load_region($pluginRegion, $this, $this->force_plugin_load);
$pluginList = $this->plugin->get_installed_plugins();
foreach ($pluginList as $plugin_name) {
// The plugin_info variable is available inside the plugin index
$pluginInfo = $this->plugin->getPluginInfo($plugin_name);
if (isset($pluginInfo['is_course_plugin']) && $pluginInfo['is_course_plugin']) {
$courseInfo = api_get_course_info();
if (!empty($courseInfo)) {
if (isset($pluginInfo['obj']) && $pluginInfo['obj'] instanceof Plugin) {
/** @var Plugin $plugin */
$plugin = $pluginInfo['obj'];
$regionContent .= $plugin->renderRegion($pluginRegion);
}
}
} else {
continue;
}
}
if (!empty($regionContent)) {
$this->assign('plugin_'.$pluginRegion, $regionContent);
} else {
$this->assign('plugin_'.$plugin_region, null);
$this->assign('plugin_'.$pluginRegion, null);
}
}
return null;

@ -1,99 +0,0 @@
<h1>
<a id="user-content-advanced-subscription-plugin-for-chamilo-lms" class="anchor" href="#advanced-subscription-plugin-for-chamilo-lms" aria-hidden="true"><span class="octicon octicon-link"></span></a>Advanced subscription plugin for Chamilo LMS</h1>
<p>Plugin for managing the registration queue and communication to sessions
from an external website creating a queue to control session subscription
and sending emails to approve student subscription request</p>
<h1>
<a id="user-content-requirements" class="anchor" href="#requirements" aria-hidden="true"><span class="octicon octicon-link"></span></a>Requirements</h1>
<p>Chamilo LMS 1.10 or greater</p>
<h1>
<a id="user-content-settings" class="anchor" href="#settings" aria-hidden="true"><span class="octicon octicon-link"></span></a>Settings</h1>
<table>
<thead>
<tr>
<th>Parameters</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>Webservice url</td>
<td>Url to external website to get user profile (SOAP)</td>
</tr>
<tr>
<td>Induction requirement</td>
<td>Checkbox to enable induction as requirement</td>
</tr>
<tr>
<td>Courses count limit</td>
<td>Number of times a student is allowed at most to course by year</td>
</tr>
<tr>
<td>Yearly hours limit</td>
<td>Teaching hours a student is allowed at most to course by year</td>
</tr>
<tr>
<td>Yearly cost unit converter</td>
<td>The cost of a taxation unit value (TUV)</td>
</tr>
<tr>
<td>Yearly cost limit</td>
<td>Number of TUV student courses is allowed at most to cost by year</td>
</tr>
<tr>
<td>Year start date</td>
<td>Date (dd/mm) when the year limit is renewed</td>
</tr>
<tr>
<td>Minimum percentage profile</td>
<td>Minimum percentage required from external website profile</td>
</tr>
</tbody>
</table>
<h1>
<a id="user-content-hooks" class="anchor" href="#hooks" aria-hidden="true"><span class="octicon octicon-link"></span></a>Hooks</h1>
<p>This plugin use the next hooks:</p>
<ul class="task-list">
<li>HookAdminBlock</li>
<li>HookWSRegistration</li>
<li>HookNotificationContent</li>
<li>HookNotificationTitle</li>
</ul>
<h1>
<a id="user-content-web-services" class="anchor" href="#web-services" aria-hidden="true"><span class="octicon octicon-link"></span></a>Web services</h1>
<ul class="task-list">
<li>HookAdvancedSubscription..WSSessionListInCategory</li>
<li>HookAdvancedSubscription..WSSessionGetDetailsByUser</li>
<li>HookAdvancedSubscription..WSListSessionsDetailsByCategory</li>
</ul>
<p>See <code>/plugin/advanced_subscription/src/HookAdvancedSubscription.php</code> to check Web services inputs and outputs</p>
<h1>
<a id="user-content-how-plugin-works" class="anchor" href="#how-plugin-works" aria-hidden="true"><span class="octicon octicon-link"></span></a>How plugin works?</h1>
<p>After install plugin, fill the parameters needed (described above)
Use Web services to communicate course session inscription from external website
This allow to student to search course session and subscribe if is qualified
and allowed to subscribe.
The normal process is:</p>
<ul class="task-list">
<li>Student search course session</li>
<li>Student read session info depending student data</li>
<li>Student request a subscription</li>
<li>A confirmation email is send to student</li>
<li>An email is send to users (superior or admins) who will accept or reject student request</li>
<li>When the user aceept o reject, an email will be send to student, superior or admins respectively</li>
<li>To complete the subscription, the request must be validated and accepted by an admin</li>
</ul>

@ -3,5 +3,5 @@
/**
* Show form
*/
require_once('config.php');
require_once('src/index.buycourses.php');
require_once 'config.php';
require_once 'src/index.buycourses.php';

@ -0,0 +1,87 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Class CourseBlockPlugin
*/
class CourseBlockPlugin extends Plugin
{
public $isCoursePlugin = true;
// When creating a new course this settings are added to the course
public $course_settings = array(
array(
'name' => 'course_block_footer_left',
'type' => 'textarea'
),
array(
'name' => 'course_block_footer_center',
'type' => 'textarea'
),
array(
'name' => 'course_block_footer_right',
'type' => 'textarea'
)
);
/**
* @return CourseBlockPlugin
*/
public static function create()
{
static $result = null;
return $result ? $result : $result = new self();
}
/**
*
*/
protected function __construct()
{
parent::__construct(
'0.1',
'Julio Montoya',
array(
'tool_enable' => 'boolean'
)
);
}
///public function
public function install()
{
// Installing course settings
$this->install_course_fields_in_all_courses(false);
}
public function uninstall()
{
// Deleting course settings
$this->uninstall_course_fields_in_all_courses();
}
/**
* @param string $region
* @return string
*/
public function renderRegion($region)
{
$content = '';
switch ($region) {
case 'footer_left':
$content = api_get_course_setting('course_block_footer_left');
$content = $content === -1 ? '' : $content;
break;
case 'footer_center':
$content = api_get_course_setting('course_block_footer_center');
$content = $content === -1 ? '' : $content;
break;
case 'footer_right':
$content = api_get_course_setting('course_block_footer_right');
$content = $content === -1 ? '' : $content;
break;
}
return $content;
}
}

@ -0,0 +1,8 @@
1. Enabled the plugin from the list of plugins.
2. Click "Configure" once the plugin was enabled.
3. Select tool_enable = Yes and save.
4. Go into a *course* (not course session) and enter the Settings tool.
5. In the "Course block" section fill the footer options.
6. Once the form was saved, you will notice that the text you fill in step .5
will appear in the Chamilo footer.

@ -0,0 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
require_once __DIR__ . '/../../main/inc/global.inc.php';
require_once __DIR__.'/CourseBlockPlugin.php';

@ -0,0 +1,9 @@
<?php
/* For license terms, see /license.txt */
require_once dirname(__FILE__) . '/config.php';
if (!api_is_platform_admin()) {
die ('You must have admin permissions to install plugins');
}
CourseBlockPlugin::create()->install();

@ -0,0 +1,11 @@
<?php
$strings['plugin_title'] = "Course block";
$strings['plugin_comment'] = "Add header and footer in a course";
$strings['tool_enable'] = 'Enable plugin';
$strings['tool_enable_help'] = 'Once enabled, you will have to configure the plugin inside the course configuration, then from the course homepage (a button will appear there only for the teacher)';
$strings['course_block_footer_left'] = 'Footer left';
$strings['course_block_footer_center'] = 'Footer center';
$strings['course_block_footer_right'] = 'Footer right';

@ -0,0 +1,4 @@
<?php
require_once __DIR__ . '/config.php';
$plugin_info = CourseBlockPlugin::create()->get_info();

@ -1,4 +1,5 @@
README
Installation
============
1. Enabled the plugin from the list of plugins.
2. Click "Configure" once the plugin was enabled.

@ -2,5 +2,4 @@
/* For licensing terms, see /license.txt */
require_once __DIR__ . '/../../main/inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'plugin.class.php';
require_once __DIR__.'/CourseLegalPlugin.php';

@ -1,5 +1,4 @@
<?php
require_once dirname(__FILE__) . '/config.php';
require_once __DIR__ . '/config.php';
$plugin_info = CourseLegalPlugin::create()->get_info();

@ -15,8 +15,6 @@ class OLPC_Peru_FilterPlugin extends Plugin
//When creating a new course, these settings are added to the course
public $course_settings = array(
// array('name' => 'big_blue_button_welcome_message', 'type' => 'text'),
// array('name' => 'big_blue_button_record_and_store', 'type' => 'checkbox')
);
public $course_settings_callback = true;
public $error = '';

@ -4,11 +4,15 @@ settings to configure this tool.
More info on OpenMeetings: http://openmeetings.apache.org/
More info on Chamilo: http://www.chamilo.org
The tasks related to the development of this plugin:
* https://support.chamilo.org/issues/5491
* (private system access) https://task.beeznest.com/issues/7046
* https://issues.apache.org/jira/browse/OPENMEETINGS-802
People involved:
* Financed by the Commission Scolaire des Hautes-Rivières, Québec, Canada (and coordinated/executed by the TICFP team)
* First draft developed by Francis Gonzales Tello - Independent (at the time)
* First stable version published by Yannick Warnier - BeezNest/Chamilo team

@ -3,7 +3,7 @@
/* Openmeetings parameters that will be registered in the course settings */
require_once '../../main/inc/global.inc.php';
require_once __DIR__.'/../../main/inc/global.inc.php';
require_once 'lib/openmeetings.class.php';
require_once 'lib/openmeetings_plugin.class.php';

@ -1,5 +1,5 @@
<?php
require_once dirname(__FILE__).'/config.php';
require_once __DIR__.'/config.php';
$plugin_info = openmeetingsPlugin::create()->get_info();

@ -1,2 +0,0 @@
<h1>Skype Plugin</h1>
<p>Create Skype user field</p>

@ -11,17 +11,6 @@ $objPlugin = TicketPlugin::create();
$table = Database::get_main_table(TABLE_TICKET_CATEGORY);
if (!Database::tableExists($table)) {
$table = Database::get_main_table(TABLE_TICKET_ASSIGNED_LOG);
$sql = "CREATE TABLE IF NOT EXISTS ".$table." (
id int UNSIGNED NOT NULL AUTO_INCREMENT,
ticket_id int UNSIGNED DEFAULT NULL,
user_id int UNSIGNED DEFAULT NULL,
assigned_date datetime DEFAULT NULL,
sys_insert_user_id int UNSIGNED DEFAULT NULL,
PRIMARY KEY PK_ticket_assigned_log (id),
KEY FK_ticket_assigned_log (ticket_id))";
Database::query($sql);
$sql = "CREATE TABLE IF NOT EXISTS $table (
id int UNSIGNED NOT NULL AUTO_INCREMENT,
category_id char(3) NOT NULL,
@ -37,6 +26,17 @@ if (!Database::tableExists($table)) {
PRIMARY KEY (id))";
$result = Database::query($sql);
$tableLog = Database::get_main_table(TABLE_TICKET_ASSIGNED_LOG);
$sql = "CREATE TABLE IF NOT EXISTS ".$tableLog." (
id int UNSIGNED NOT NULL AUTO_INCREMENT,
ticket_id int UNSIGNED DEFAULT NULL,
user_id int UNSIGNED DEFAULT NULL,
assigned_date datetime DEFAULT NULL,
sys_insert_user_id int UNSIGNED DEFAULT NULL,
PRIMARY KEY PK_ticket_assigned_log (id),
KEY FK_ticket_assigned_log (ticket_id))";
Database::query($sql);
// Default Categories
$categories = array(
$objPlugin->get_lang('Enrollment') => $objPlugin->get_lang('TicketsAboutEnrollment'),
@ -65,7 +65,8 @@ if (!Database::tableExists($table)) {
'category_id' => $i,
'project_id' => 1,
'description' => $description,
'name' => $category
'name' => $category,
'course_required' => 0
);
}
@ -236,8 +237,9 @@ $sql = "CREATE TABLE IF NOT EXISTS ".$table." (
category_id INT NOT NULL,
user_id INT NOT NULL
)";
Database::query($sql);
//Menu main tabs
// Menu main tabs
$rsTab = $objPlugin->addTab('Ticket', 'plugin/ticket/src/myticket.php');
if ($rsTab) {

@ -15,8 +15,7 @@ $plugin = TicketPlugin::create();
api_protect_admin_script(true);
$tool_name = $plugin->get_lang('LastEdit');
$toolName = $plugin->get_lang('Categories');
$libPath = api_get_path(LIBRARY_PATH);
$webLibPath = api_get_path(WEB_LIBRARY_PATH);
@ -38,6 +37,8 @@ if ($table->per_page == 0) {
$formToString = '';
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
$interbreadcrumb[] = array('url' => 'myticket.php', 'name' => $plugin->get_lang('MyTickets'));
if (isset($_GET['action'])) {
global $table;
$action = $_GET['action'];
@ -49,6 +50,8 @@ if (isset($_GET['action'])) {
header("Location: ".api_get_self());
break;
case 'add':
$toolName = get_lang('Add');
$interbreadcrumb[] = array('url' => 'categories.php', 'name' => $plugin->get_lang('Categories'));
$url = api_get_self().'?action=add';
$form = TicketManager::getCategoryForm($url);
$formToString = $form->returnForm();
@ -71,6 +74,8 @@ if (isset($_GET['action'])) {
}
break;
case 'edit':
$toolName = get_lang('Edit');
$interbreadcrumb[] = array('url' => 'categories.php', 'name' => $plugin->get_lang('Categories'));
$url = api_get_self().'?action=edit&id='.$id;
$form = TicketManager::getCategoryForm($url);
@ -134,9 +139,7 @@ $table->set_header(3, $plugin->get_lang('TotalTickets'), false);
$table->set_header(4, get_lang('Actions'), true);
$table->set_column_filter(4, 'modify_filter');
$interbreadcrumb[] = array('url' => 'myticket.php', 'name' => $plugin->get_lang('MyTickets'));
Display::display_header($plugin->get_lang('Categories'));
Display::display_header($toolName);
$items = [
[

@ -12,11 +12,14 @@ $plugin = TicketPlugin::create();
api_protect_admin_script(true);
$categoryId = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
if (empty($categoryId)) {
$categoryInfo = TicketManager::getCategory($categoryId);
if (empty($categoryInfo)) {
api_not_allowed(true);
}
$form = new FormValidator('edit', 'post', api_get_self().'?id='.$categoryId);
$form->addHeader($categoryInfo['name']);
$users = UserManager::get_user_list([], ['firstname']);
$users = array_column($users, 'complete_name', 'user_id');
@ -48,5 +51,5 @@ if ($form->validate()) {
$interbreadcrumb[] = array('url' => 'myticket.php', 'name' => $plugin->get_lang('MyTickets'));
$interbreadcrumb[] = array('url' => 'categories.php', 'name' => get_lang('Categories'));
Display::display_header();
Display::display_header(get_lang('Users'));
$form->display();

@ -325,7 +325,7 @@ function show_form_send_ticket()
'Height' => '250'
)
);
//if (api_is_platform_admin()) {
$form->addElement(
'SelectAjax',
@ -336,7 +336,7 @@ function show_form_send_ticket()
);
//}
$form->addElement(
'text',
@ -444,7 +444,7 @@ function save_ticket()
$status = $_POST['status_id'];
$file_attachments = $_FILES;
$responsible = (api_is_platform_admin() ? api_get_user_id() : 0);
if (TicketManager::insert_new_ticket(
$category_id,
$course_id,
@ -576,48 +576,12 @@ function get_user_data($from, $number_of_items, $column, $direction)
return $users;
}
$interbreadcrumb[] = array('url' => 'myticket.php', 'name' => $plugin->get_lang('MyTickets'));
if (!isset($_POST['compose'])) {
if (api_is_platform_admin()) {
Display::display_header(get_lang('ComposeMessage'));
/*
$message = $plugin->get_lang('PleaseBeforeRegisterATicketSelectOneUser');
Display::display_warning_message($message);
echo '
<div class="actions">
<span style="float: right;">&nbsp;</span>
<form id="search_simple" name="search_simple" method="get" action="' . api_get_self() . '" class="form-search">
<fieldset>
<span><label for="keyword">' . get_lang('SearchAUser') . ': &nbsp;</label><input type="text" name="keyword" size="25"></span>
<span><button type="submit" name="submit" class="btn btn">' . get_lang('Search') . '</button></span>
<div class="clear"></div>
</fieldset>
</form>
</div>';
echo '<div class="users-list">';
$order = (api_is_western_name_order() || api_sort_by_first_name()) ? 3 : 2;
$table = new SortableTable(
'users',
'get_number_of_users',
'get_user_data',
$order,
10
);
$table->set_header(0, '', false, 'width="18px"');
$table->set_header(0, get_lang('Photo'), false);
$table->set_header(1, get_lang('OfficialCode'));
if (api_is_western_name_order()) {
$table->set_header(2, get_lang('FirstName'));
$table->set_header(3, get_lang('LastName'));
} else {
$table->set_header(2, get_lang('LastName'));
$table->set_header(3, get_lang('FirstName'));
}
$table->set_header(4, get_lang('LoginName'));
$table->set_header(5, get_lang('Email'));
$table->set_header(6, get_lang('Action'));
$table->display();
echo '</div>';*/
} else {
$userInfo = api_get_user_info();
$htmlHeadXtra[] = "

@ -1,25 +0,0 @@
<h1>Chamilo Tour Plugin</h1>
<p>Shows people how to use your Chamilo LMS</p>
<h2>Set the blocks for the tour</h2>
<p>Edit the <code>plugin/tour/config/tour.json</code> file adding the page classes and steps</p>
<p>To set the steps in a page, add an object like this:</p>
<pre>
{
"pageClass": "page unique class selector",
"steps": [
{
"elementSelector": "element class or id",
"message": "LanguageVariable"
},
{
"elementSelector": "element class or id",
"message": "LanguageVariable"
},
]
}
</pre>
Then set the language variables inside the <code>plugin/tour/lang/$language.php</code> file<br>
<h2>Set a region to plugin</h2>
<p>You must assign a Region to Tour plugin in the Configuration Settings</p>
<p>Choose preferably <code>header_right</code></p>
<br>

@ -1,7 +1,7 @@
Virtual Chamilo
===================
Author : Valery Fremaux (valery.fremaux@gmail.com), Julio Montoya
Authors : Valery Fremaux (valery.fremaux@gmail.com), Julio Montoya
Virtual chamilo is a feature that allows running several chamilo instances sharing the same
code base.
@ -20,20 +20,20 @@ You need :
1. Install the vchamilo package into the <chamiloroot>/plugin directory
2. Install the plugin in chamilo administration
3. Insert the virtualisation hook into the chamilo master configuration :
3. Insert the virtualisation hook into the chamilo master configuration file:
```
file : <chamiloroot>/app/config/configuration.php
<chamiloroot>/app/config/configuration.php
```
Insert the hook:
Insert the hook at the end of the file.
```
include_once $_configuration['root_sys'].'plugin/vchamilo/lib.php';
vchamilo_hook_configuration($_configuration);
```
What you need for a virtual node is :
What you need for a virtual node is:
-------------
- a blank database copy of chamilo

@ -62,7 +62,7 @@ $strings['sitename'] = 'Site Name';
$strings['snapshotinstance'] = 'Snapshot';
$strings['snapshotmaster'] = 'Snapshot master Chamilo';
$strings['statisticsdatabase'] = 'Statistics database';
$strings['successfinishedcapture'] = 'Capture of chamilo is finished';
$strings['successfinishedcapture'] = 'Snapshot of chamilo is finished';
$strings['sync_settings'] = 'Synchronize settings';
$strings['tableprefix'] = 'Table prefix';
$strings['template'] = 'Template';

@ -20,7 +20,6 @@ function vchamilo_hook_configuration(&$_configuration)
$virtualChamiloWebRoot = $_configuration['vchamilo_web_root'].'/';
$virtualChamilo = [];
if ($_configuration['root_web'] == $virtualChamiloWebRoot) {
return;
@ -35,39 +34,41 @@ function vchamilo_hook_configuration(&$_configuration)
$query = "SELECT * FROM $table WHERE root_web = '$virtualChamiloWebRoot'";
$result = $connection->executeQuery($query);
$excludes = array('id', 'name');
$query = "SELECT * FROM settings_current WHERE subkey = 'vchamilo'";
$virtualSettings = $connection->executeQuery($query);
$virtualSettings = $virtualSettings->fetchAll();
$homePath = '';
$coursePath = '';
$archivePath = '';
foreach ($virtualSettings as $setting) {
switch ($setting['variable']) {
case 'vchamilo_home_real_root':
$homePath = $setting['selected_value'];
break;
case 'vchamilo_course_real_root':
$coursePath = $setting['selected_value'];
break;
case 'vchamilo_archive_real_root':
$archivePath = $setting['selected_value'];
break;
if ($result->rowCount()) {
$data = $result->fetch();
$excludes = array('id', 'name');
$query = "SELECT * FROM settings_current WHERE subkey = 'vchamilo'";
$virtualSettings = $connection->executeQuery($query);
$virtualSettings = $virtualSettings->fetchAll();
$homePath = '';
$coursePath = '';
$archivePath = '';
foreach ($virtualSettings as $setting) {
switch ($setting['variable']) {
case 'vchamilo_home_real_root':
$homePath = $setting['selected_value'];
break;
case 'vchamilo_course_real_root':
$coursePath = $setting['selected_value'];
break;
case 'vchamilo_archive_real_root':
$archivePath = $setting['selected_value'];
break;
}
}
}
if (empty($homePath) || empty($coursePath) || empty($archivePath)) {
echo 'Configure correctly the vchamilo plugin';
exit;
}
if (empty($homePath) || empty($coursePath) || empty($archivePath)) {
echo 'Configure correctly the vchamilo plugin';
exit;
}
if ($result->rowCount()) {
$data = $result->fetch();
// Only load if is visible
if ($data['visible']) {
if ($data && $data['visible'] === '1') {
foreach ($data as $key => $value) {
if (!in_array($key, $excludes)) {
$_configuration[$key] = $value;
@ -80,6 +81,8 @@ function vchamilo_hook_configuration(&$_configuration)
$data['SYS_COURSE_PATH'] = $coursePath.'/'.$data['slug'];
$virtualChamilo = $data;
} else {
exit("This portal is disabled. Please contact your administrator");
}
} else {
// Platform was not configured yet
@ -1133,6 +1136,23 @@ function vchamilo_check_settings()
if (empty($coursePath) || empty($homePath) || empty($archivePath) || empty($cmdSql)|| empty($cmdMySql)) {
api_not_allowed(true, 'You have to complete all plugin settings.');
}
$separator = DIRECTORY_SEPARATOR;
$templatePath = api_get_path(SYS_PATH).'plugin'.$separator.'vchamilo'.$separator.'templates';
$paths = [
$coursePath,
$homePath,
$archivePath,
$templatePath
];
foreach ($paths as $path) {
if (!is_writable($path)) {
Display::addFlash(
Display::return_message('Directory must have writable permissions: '.$path, 'warning')
);
}
}
}
/**

@ -70,12 +70,12 @@ if ($data->what == 'addinstance' || $data->what == 'registerinstance') {
ctrace("Creating physical course dir in $coursedir");
mkdir($coursedir, 0777, true);
// initiate default index
$indexFile = fopen($coursedir.'/index.html', 'w');
$indexFile = $coursedir.'/index.html';
if ($indexFile) {
file_put_contents($indexFile, vchamilo_get_default_course_index_fragment());
}
$htaccessFile = fopen($coursedir.'/.htaccess', 'w');
$htaccessFile = $coursedir.'/.htaccess';
if ($htaccessFile) {
file_put_contents($htaccessFile, vchamilo_get_htaccess_fragment($slug));
}

@ -405,7 +405,7 @@ class InstanceForm extends ChamiloForm
'onclick="opencnxpopup(\''.$_configuration['root_web'].'\'); return false;"'
);
/*
/**
* Template selection.
*/
if ($this->is_in_add_mode()) {
@ -414,10 +414,17 @@ class InstanceForm extends ChamiloForm
$templateoptions = vchamilo_get_available_templates();
// Template choice
$form->addElement('select', 'template', $this->_plugin->get_lang('template'), $templateoptions);
$form->addSelect(
'template',
$this->_plugin->get_lang('template'),
$templateoptions
);
} else {
if ($this->instance) {
$form->addLabel($this->_plugin->get_lang('template'), $this->instance->template);
$form->addLabel(
$this->_plugin->get_lang('template'),
$this->instance['template']
);
}
}
@ -432,6 +439,7 @@ class InstanceForm extends ChamiloForm
null,
'client'
);
$form->addRule('root_web', $this->_plugin->get_lang('rootwebinputerror'), 'required', null, 'client');
$form->addRule(
'main_database',

@ -80,7 +80,7 @@ if ($action == 'fulldeleteinstances') {
Display::addFlash(Display::return_message("Deleting $archivedir"));
removeDir($archivedir);
}
$sql = "DELETE FROM {$table} WHERE id = ".$instance['id'];
Database::query($sql);
@ -111,23 +111,28 @@ if ($action == 'snapshotinstance') {
// Make template directory (files and SQL).
$separator = DIRECTORY_SEPARATOR;
$backupDir = $_configuration['root_sys'].'plugin'.$separator.'vchamilo'.$separator.'templates'.$separator.$vhost->slug.$separator;
$backupDir = api_get_path(SYS_PATH).'plugin'.$separator.'vchamilo'.$separator.'templates'.$separator.$vhost->slug.$separator;
$absolute_datadir = $backupDir.'data';
$absolute_sqldir = $backupDir.'dump.sql';
if (!is_dir($backupDir)) {
Display::addFlash(
Display::return_message('Directory created: '.$backupDir)
);
mkdir($backupDir, 0777, true);
$result = mkdir($backupDir, 0777, true);
if ($result) {
Display::addFlash(
Display::return_message('Directory created: '.$backupDir)
);
} else {
Display::addFlash(
Display::return_message("Cannot create directory: $backupDir check the folder permissions", 'error')
);
}
}
if ($vchamilostep == 0) {
// Create directories, if necessary.
if (!is_dir($absolute_datadir)) {
mkdir($absolute_datadir, 0777, true);
//mkdir($absolute_datadir.'/archive', 0777, true);
mkdir($absolute_datadir.'/home', 0777, true);
}
@ -147,7 +152,7 @@ if ($action == 'snapshotinstance') {
$tpl->assign('content', $content);
$tpl->display_one_col_template();
die;
exit;
} else {
// continue next step
$vchamilostep = 1;
@ -218,26 +223,28 @@ if ($action == 'snapshotinstance') {
Display::addFlash(Display::return_message("Copying from '$coursePath' to '$absolute_datadir/courses' "));
copyDirTo($coursePath, $absolute_datadir.'/courses/', false);
/*Display::addFlash(Display::return_message("Copying from $archivePath to {$absolute_datadir}/archive "));
copyDirTo($varchivepath, $absolute_datadir.'/archive', false);*/
// Store original hostname and some config info for further database or filestore replacements.
$FILE = fopen($backupDir.$separator.'manifest.php', 'w');
fwrite($FILE, '<'.'?php ');
fwrite($FILE, "\$templatewwwroot = '".$wwwroot."';\n");
//fwrite($FILE, "\$templatevdbprefix = '".$vhost->table_prefix."';\n ");
//fwrite($FILE, "\$coursefolder = '".$vhost->course_folder."';\n ");
fwrite($FILE, '?'.'>');
fclose($FILE);
// Every step was SUCCESS.
if (empty($fullautomation)) {
Display::addFlash(Display::return_message($plugininstance->get_lang('successfinishedcapture'), 'success'));
Display::addFlash(
Display::return_message($plugininstance->get_lang('successfinishedcapture'),
'success'
)
);
if (empty($vid)) {
$template = vchamilo_get_config('vchamilo', 'default_template');
if (empty($template)) {
Display::addFlash(Display::return_message('Set default template as <b>'.$vhost->slug.'</b>', 'success', false));
Display::addFlash(
Display::return_message('Set default template as <b>'.$vhost->slug.'</b>', 'success', false)
);
$params = [
'subkey' => 'vchamilo',
'title' => 'default_template',
@ -249,7 +256,9 @@ if ($action == 'snapshotinstance') {
];
api_set_setting_simple($params);
} else {
Display::addFlash(Display::return_message('Default template is: <b>'.$vhost->slug.'</b>', 'success', false));
Display::addFlash(
Display::return_message('Default template is: <b>'.$vhost->slug.'</b>', 'success', false)
);
}
}
@ -264,7 +273,7 @@ if ($action == 'snapshotinstance') {
$tpl->assign('content', $content);
$tpl->display_one_col_template();
die;
exit;
}
}
}

Loading…
Cancel
Save