Add files via upload

pull/2487/head
Enrique Alcaraz 9 years ago committed by GitHub
parent 0a966986b9
commit 877a5f35d4
  1. 10
      plugin/redirection/config.php
  2. 55
      plugin/redirection/index.php
  3. 18
      plugin/redirection/install.php
  4. 8
      plugin/redirection/lang/english.php
  5. 3
      plugin/redirection/lang/es.php
  6. 8
      plugin/redirection/lang/french.php
  7. 8
      plugin/redirection/lang/spanish.php
  8. 33
      plugin/redirection/lib/redireccion.class.php
  9. 40
      plugin/redirection/lib/redirection.class.php
  10. 6
      plugin/redirection/nbproject/private/private.properties
  11. 15
      plugin/redirection/nbproject/private/private.xml
  12. 7
      plugin/redirection/nbproject/project.properties
  13. 9
      plugin/redirection/nbproject/project.xml
  14. 25
      plugin/redirection/plugin.php
  15. 2
      plugin/redirection/readme.txt
  16. 8
      plugin/redirection/uninstall.php

@ -0,0 +1,10 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Config the plugin
* @author Enrique Alcaraz Lopez
* @package chamilo.plugin.redirection
*/
require_once __DIR__.'/../../main/inc/global.inc.php';
require_once __DIR__.'/lib/redirection.class.php';

@ -0,0 +1,55 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Config the plugin
* @author Enrique Alcaraz Lopez
* @package chamilo.plugin.redirection
*/
require_once __DIR__.'/config.php';
$redirecciones = Redirection::get();
if (isset($_REQUEST["id"])) {
Redirection::delete($_REQUEST["id"]);
header ("Location: index.php");
}
else if (isset($_POST["submit_button"])) {
Redirection::insert($_POST["user_id"], $_POST["url"]);
header ("Location: index.php");
}
?>
<form action="./index.php" method="post">
<div class="table-responsive well">
<table class="table table-condensed">
<thead>
<td><input type="text" class="form-control" placeholder="User_id" name="user_id" /></td>
<td><input type="text" class="form-control" placeholder="url" name="url" /></td>
<td><input type='submit' value='Agregar' name="submit_button" class='btn btn-primary' /></td>
</thead>
</table>
</div>
</form>
<div class="table-responsive">
<table class="table table-bordered table-condensed">
<tr>
<th>Usuario</th>
<th>Url</th>
<th></th>
</tr>
<?php
foreach ($redirecciones as $redi) {
echo '<tr>';
echo '<td>' . $redi["user_id"] . '</td>';
echo '<td>' . $redi["url"] . '</td>';
echo '<td><a href="index.php?id=' . $redi["id"] . '">Borrar</a></td>';
echo '</tr>';
}
?>
</table>
</div>

@ -0,0 +1,18 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Config the plugin
* @author Enrique Alcaraz Lopez
* @package chamilo.plugin.redirection
*/
$table = Database::get_main_table('plugin_redirection');
$sql = "CREATE TABLE IF NOT EXISTS $table (
id INT unsigned NOT NULL auto_increment PRIMARY KEY,
user_id INT unsigned NOT NULL DEFAULT 0,
url VARCHAR(255) NOT NULL DEFAULT ''
)";
Database::query($sql);

@ -0,0 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Config the plugin
* @author Enrique Alcaraz Lopez
* @package chamilo.plugin.redirection
*/

@ -0,0 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Config the plugin
* @author Enrique Alcaraz Lopez
* @package chamilo.plugin.redirection
*/

@ -0,0 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Config the plugin
* @author Enrique Alcaraz Lopez
* @package chamilo.plugin.redirection
*/

@ -0,0 +1,33 @@
<?php
class Redireccion
{
# Insertamos la redirección
public static function insert($user_id, $url)
{
return Database::insert(
'plugin_redirection',
[
'user_id' => $user_id,
'url' => $url
]
);
}
# Borramos al redirección
public static function delete($id)
{
Database::delete(
$this->table,
array('id = ?' => array($id))
);
}
# Devolemos las redirecciones
public static function get()
{
$table = Database::get_main_table('plugin_redirection');
return Database::select('*', $table);
}
}

@ -0,0 +1,40 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Config the plugin
* @author Enrique Alcaraz Lopez
* @package chamilo.plugin.redirection
*/
class Redirection
{
# Insertamos la redirección
public static function insert($user_id, $url)
{
return Database::insert(
'plugin_redirection',
[
'user_id' => $user_id,
'url' => $url
]
);
}
# Borramos al redirección
public static function delete($id)
{
$table = Database::get_main_table('plugin_redirection');
Database::delete(
$table,
array('id = ?' => array($id))
);
}
# Devolemos las redirecciones
public static function get()
{
$table = Database::get_main_table('plugin_redirection');
return Database::select('*', $table);
}
}

@ -0,0 +1,6 @@
copy.src.files=false
copy.src.on.open=false
copy.src.target=
index.file=index.php
run.as=LOCAL
url=http://localhost/redirection/

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<file>file:/C:/wamp64/www/redirection/readme.txt</file>
<file>file:/C:/wamp64/www/redirection/lib/redireccion.class.php</file>
<file>file:/C:/wamp64/www/redirection/install.php</file>
<file>file:/C:/wamp64/www/redirection/index.php</file>
<file>file:/C:/wamp64/www/redirection/uninstall.php</file>
<file>file:/C:/wamp64/www/redirection/lang/es.php</file>
<file>file:/C:/wamp64/www/redirection/plugin.php</file>
</group>
</open-files>
</project-private>

@ -0,0 +1,7 @@
include.path=${php.global.include.path}
php.version=PHP_70
source.encoding=UTF-8
src.dir=.
tags.asp=false
tags.short=false
web.root=.

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.php.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/php-project/1">
<name>redirection</name>
</data>
</configuration>
</project>

@ -0,0 +1,25 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Config the plugin
* @author Enrique Alcaraz Lopez
* @package chamilo.plugin.redirection
*/
require_once __DIR__.'/lib/redireccion.class.php';
/* Plugin config */
//the plugin title
$plugin_info['title'] = 'Redireccion personalizada';
//the comments that go with the plugin
$plugin_info['comment'] = "Redirecciona a una url personalizada a un usuario en concreto";
//the plugin version
$plugin_info['version'] = '1';
//the plugin author
$plugin_info['author'] = 'Enrique Alcaraz';
$form = new FormValidator('redirection_form');
$form->addElement('text', 'user_id', get_lang('user_id'));
$form->addElement('text', 'url', get_lang('url'));
$form->addButtonSave(get_lang('Save'), 'submit_button');
$plugin_info['settings_form'] = $form;

@ -0,0 +1,2 @@
# chamilo-plugin-redirection
Plugin chamilo para la redirección de usuarios.

@ -0,0 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Config the plugin
* @author Enrique Alcaraz Lopez
* @package chamilo.plugin.redirection
*/
Loading…
Cancel
Save