template for updates of plugins

--HG--
branch : Gsoc14-ryzomAppImprovements
This commit is contained in:
shubham_meena 2014-06-19 17:11:10 +05:30
parent 4d1d52fc73
commit f09e4e48a5
3 changed files with 69 additions and 12 deletions

View file

@ -14,7 +14,7 @@ class Plugincache {
private $plugin_permission; private $plugin_permission;
private $plugin_status; private $plugin_status;
private $plugin_info = array(); private $plugin_info = array();
private $update_info = array();
/** /**
* A constructor. * A constructor.
* Empty constructor * Empty constructor
@ -26,15 +26,17 @@ class Plugincache {
public function set( $values ) { public function set( $values ) {
$this -> setId( $values['Id'] ); $this -> setId( $values['Id'] );
$this -> setPluginName( $values['Name'] ); $this -> setPluginName( $values['Name'] );
$this -> setPluginType( $values['Type'] ); $this -> setPluginType( $values['Type'] );
$this -> setPluginPermission( $values['Permission'] ); $this -> setPluginPermission( $values['Permission'] );
$this -> setPluginStatus( $values['Status'] ); $this -> setPluginStatus( $values['Status'] );
$this -> setPluginInfo( json_decode( $values['Info'] ) ); $this -> setPluginInfo( json_decode( $values['Info'] ) );
@$this -> setUpdateInfo( json_decode( $values['UpdateInfo'] ) );
} }
/** /**
* loads the object's attributes. * loads the object's attributes.
*/ */
public function load_With_SID() { public function load_With_SID() {
$dbl = new DBLayer( "lib" ); $dbl = new DBLayer( "lib" );
$statement = $dbl -> executeWithoutParams( "SELECT * FROM plugins" ); $statement = $dbl -> executeWithoutParams( "SELECT * FROM plugins" );
@ -140,14 +142,33 @@ class Plugincache {
$this -> plugin_info = $p_n; $this -> plugin_info = $p_n;
} }
/**
* functionalities for plugin updates
*/
/**
* set update info attribute array of the object.
*
* @param $p_n array
*/
public function setUpdateInfo( $p_n ) {
$this -> update_info = $p_n;
}
/**
* get update info array attribute of the object.
*/
public function getUpdateInfo() {
return $this -> update_info;
}
/** /**
* some more plugin function that requires during plugin operations * some more plugin function that requires during plugin operations
* *
* / */
*
* /**
* /**
* function to remove a non empty directory * function to remove a non empty directory
* *
* @param $dir directory address * @param $dir directory address
@ -166,4 +187,4 @@ class Plugincache {
return rmdir( $dir ); return rmdir( $dir );
} }
} }
} }

View file

@ -86,11 +86,11 @@ ip_file_nfnd="Please upload a plugin before clicking on install button"
[plugins_update] [plugins_update]
up_title = "Updates for Plugins" up_title = "Updates for Plugins"
up_info = "Here you can see the entire list of available updates for plugins." up_info = "Here you can see the entire list of available updates for plugins."
up_serial = "Serial No." up_description = "Updates Info"
plugin_name = "Name" plugin_name = "Name"
plugin_version = "Version" plugin_version = "Version"
up_updated_version = "New Version" up_updated_version = "New Version"
up_action = "Actions" up_actions = "Actions"
[show_ticket] [show_ticket]
t_title = "Ticket" t_title = "Ticket"

View file

@ -0,0 +1,36 @@
<?php
/**
* function plugins_update to get
* plugins updates from the Database using pagination object
*
* @author shubham meena mentored by Matthew Lagoe
*/
function plugins_update()
{
if ( Ticket_User :: isMod( unserialize( $_SESSION['ticket_user'] ) ) ) {
$pagination = new Pagination( "SELECT * FROM plugins INNER JOIN updates ON plugins.Id=updates.PluginId", "lib", 5, "Plugincache" );
$pageResult['plug'] = Gui_Elements :: make_table( $pagination -> getElements(), Array( "getId", "getPluginName", "getPluginInfo", "getUpdateInfo" ), Array( "id", "plugin_name", "plugin_info", "update_info" ) );
$pageResult['links'] = $pagination -> getLinks( 5 );
$pageResult['lastPage'] = $pagination -> getLast();
$pageResult['currentPage'] = $pagination -> getCurrent();
global $INGAME_WEBPATH;
$pageResult['ingame_webpath'] = $INGAME_WEBPATH;
// check if shard is online
try {
$dbs = new DBLayer( "shard" );
$pageResult['shard'] = "online";
}
catch( PDOException $e ) {
$pageResult['shard'] = "offline";
}
return( $pageResult );
} else {
// ERROR: No access!
$_SESSION['error_code'] = "403";
header( "Location: index.php?page=error" );
exit;
}
}