parent
bb90300f23
commit
3cf13a775d
@ -1,6 +1,6 @@ |
||||
{% if allowSkillsTool %} |
||||
<div class="btn-group"> |
||||
<a class="btn btn-default" href="{{ _p.web_main }}social/skills_wheel.php">{{ 'MySkills' | get_lang }}</a> |
||||
<a class="btn btn-default" href="{{ _p.web_main }}social/skills_wheel.php">{{ 'SkillsWheel' | get_lang }}</a> |
||||
</div> |
||||
{% endif %} |
||||
|
||||
@ -1,4 +0,0 @@ |
||||
Advanced Skills Plugin |
||||
====================== |
||||
|
||||
Alter the skill_rel_user table adding the course_id and session_id columns |
||||
@ -1,12 +0,0 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
/** |
||||
* Config the plugin |
||||
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com> |
||||
* @package chamilo.plugin.advancedskills |
||||
*/ |
||||
//require_once '../../main/inc/global.inc.php'; |
||||
|
||||
require_once api_get_path(SYS_PATH) . 'main/inc/global.inc.php'; |
||||
require_once api_get_path(LIBRARY_PATH) . 'plugin.class.php'; |
||||
require_once api_get_path(PLUGIN_PATH) . 'advancedskills/src/AdvancedSkills.php'; |
||||
@ -1,8 +0,0 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
/** |
||||
* Index |
||||
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com> |
||||
* @package chamilo.plugin.advancedskills |
||||
*/ |
||||
require_once __DIR__ . '/config.php'; |
||||
@ -1,10 +0,0 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
/** |
||||
* Initialization install |
||||
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com> |
||||
* @package chamilo.plugin.advancedskills |
||||
*/ |
||||
require_once __DIR__ . '/config.php'; |
||||
|
||||
AdvancedSkills::create()->install(); |
||||
@ -1,9 +0,0 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
/** |
||||
* Strings to spanish L10n |
||||
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com> |
||||
* @package chamilo.plugin.advancedskills |
||||
*/ |
||||
$strings['plugin_title'] = 'Advanced Skills'; |
||||
$strings['plugin_comment'] = 'Altera la tabla skill_rel_user agregando las columnas course_id y session_id'; |
||||
@ -1,10 +0,0 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
/** |
||||
* Init the plugin |
||||
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com> |
||||
* @package chamilo.plugin.advancedskills |
||||
*/ |
||||
require_once __DIR__.'/config.php'; |
||||
|
||||
$plugin_info = AdvancedSkills::create()->get_info(); |
||||
@ -1,3 +0,0 @@ |
||||
<h1>Advanced Skills Plugin</h1> |
||||
|
||||
<p>Alter the skill_rel_user table adding the course_id and session_id columns</p> |
||||
@ -1,149 +0,0 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
/** |
||||
* Plugin to add extra columns to skill_rel_user tablee |
||||
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com> |
||||
* @package chamilo.plugin.advancedskills |
||||
*/ |
||||
class AdvancedSkills extends Plugin |
||||
{ |
||||
|
||||
/** |
||||
* Class constructor |
||||
*/ |
||||
protected function __construct() |
||||
{ |
||||
parent::__construct('1.0', 'Angel Fernando Quiroz Campos'); |
||||
} |
||||
|
||||
/** |
||||
* Instance the plugin |
||||
* @staticvar null $result |
||||
* @return Tour |
||||
*/ |
||||
static function create() |
||||
{ |
||||
static $result = null; |
||||
|
||||
return $result ? $result : $result = new self(); |
||||
} |
||||
|
||||
/** |
||||
* Install the plugin |
||||
*/ |
||||
public function install() |
||||
{ |
||||
$this->addTableColumns(); |
||||
$this->addIndex(); |
||||
$this->addTab(get_lang('Skills'), 'plugin/advancedskills/report.php'); |
||||
} |
||||
|
||||
/** |
||||
* Uninstall the plugin |
||||
*/ |
||||
public function uninstall() |
||||
{ |
||||
$this->removeTableColumns(); |
||||
$this->removeIndex(); |
||||
$this->removeTab(); |
||||
} |
||||
|
||||
/** |
||||
* Add the course_id and session_id columns on skill_rel_user table |
||||
*/ |
||||
private function addTableColumns() |
||||
{ |
||||
$skillUserTable = Database::get_main_table(TABLE_MAIN_SKILL_REL_USER); |
||||
|
||||
$sql = "ALTER TABLE $skillUserTable " |
||||
. "ADD COLUMN course_id INT NOT NULL DEFAULT 0 AFTER id"; |
||||
|
||||
Database::query($sql); |
||||
|
||||
$sql = "ALTER TABLE $skillUserTable " |
||||
. "ADD COLUMN session_id INT NOT NULL DEFAULT 0 AFTER course_id"; |
||||
|
||||
Database::query($sql); |
||||
} |
||||
|
||||
/** |
||||
* Remove the course_id and session_id columns on skill_rel_user table |
||||
*/ |
||||
private function removeTableColumns() |
||||
{ |
||||
$skillUserTable = Database::get_main_table(TABLE_MAIN_SKILL_REL_USER); |
||||
|
||||
$sql = "ALTER TABLE $skillUserTable " |
||||
. "DROP course_id"; |
||||
|
||||
Database::query($sql); |
||||
|
||||
$sql = "ALTER TABLE $skillUserTable " |
||||
. "DROP session_id"; |
||||
|
||||
Database::query($sql); |
||||
} |
||||
|
||||
/** |
||||
* Add a index to course_id and session_id on skill_rel_user table |
||||
*/ |
||||
private function addIndex() |
||||
{ |
||||
$skillUserTable = Database::get_main_table(TABLE_MAIN_SKILL_REL_USER); |
||||
|
||||
$sql = "ALTER TABLE $skillUserTable " |
||||
. "ADD INDEX idx_select_cs (course_id, session_id)"; |
||||
|
||||
Database::query($sql); |
||||
} |
||||
|
||||
/** |
||||
* Remove a index to course_id and session_id on skill_rel_user table |
||||
*/ |
||||
private function removeIndex() |
||||
{ |
||||
$skillUserTable = Database::get_main_table(TABLE_MAIN_SKILL_REL_USER); |
||||
|
||||
$sql = "DROP INDEX idx_select_cs ON $skillUserTable"; |
||||
|
||||
Database::query($sql); |
||||
} |
||||
|
||||
/** |
||||
* |
||||
* @return boolean |
||||
*/ |
||||
public static function extraColumnsExists() |
||||
{ |
||||
$skillUserTable = Database::get_main_table(TABLE_MAIN_SKILL_REL_USER); |
||||
|
||||
$sql = "SHOW COLUMNS FROM $skillUserTable"; |
||||
|
||||
$result = Database::query($sql); |
||||
|
||||
while ($resultData = Database::fetch_assoc($result)) { |
||||
if ($resultData['Field'] == 'course_id' || $resultData['Field'] == 'session_id') { |
||||
return true; |
||||
} |
||||
} |
||||
|
||||
return false; |
||||
} |
||||
|
||||
/** |
||||
* Remove the plugin tab |
||||
*/ |
||||
private function removeTab() { |
||||
$data = Database::select('comment', Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT), array( |
||||
'where' => array( |
||||
"variable = '?' AND title = '?'" => array('status', 'advancedskills') |
||||
) |
||||
), 'first'); |
||||
|
||||
if (!empty($data)) { |
||||
$this->deleteTab($data['comment']); |
||||
} |
||||
} |
||||
|
||||
} |
||||
@ -1,10 +0,0 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
/** |
||||
* Initialization uninstall |
||||
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com> |
||||
* @package chamilo.plugin.advancedskills |
||||
*/ |
||||
require_once __DIR__ . '/config.php'; |
||||
|
||||
AdvancedSkills::create()->uninstall(); |
||||
Loading…
Reference in new issue