2012-06-11 16:53:04 +00:00
< ? php
2012-08-20 13:52:35 +00:00
$microstart = explode ( ' ' , microtime ());
$start_time = $microstart [ 0 ] + $microstart [ 1 ];
2012-06-11 16:53:04 +00:00
error_reporting ( E_ALL ^ E_NOTICE );
ini_set ( " display_errors " , " 1 " );
define ( 'APP_NAME' , 'app_achievements_admin' );
2012-12-10 14:07:13 +00:00
require_once ( '../config.php' );
include_once ( '../lang.php' );
2012-06-11 16:53:04 +00:00
include_once ( 'lang.php' );
require_once ( 'conf.php' );
// Ask to authenticate user (using ingame or session method) and fill $user with all information
2012-12-10 14:07:13 +00:00
ryzom_app_authenticate ( $user , true );
2012-06-11 16:53:04 +00:00
2012-12-10 14:07:13 +00:00
#echo var_export($user,true);
/* $user = array ();
2012-06-11 16:53:04 +00:00
$user [ 'id' ] = 1 ;
$user [ 'lang' ] = 'en' ;
$user [ 'name' ] = 'Talvela' ;
$user [ 'race' ] = " r_matis " ;
$user [ 'civilization' ] = " c_neutral " ;
$user [ 'cult' ] = " c_neutral " ;
2012-12-10 14:07:13 +00:00
$user [ 'admin' ] = true ; */
2012-06-11 16:53:04 +00:00
2012-06-25 13:04:51 +00:00
require_once ( $_CONF [ 'app_achievements_path' ] . " class/RyzomUser_class.php " );
2012-06-11 16:53:04 +00:00
require_once ( " class/RyzomAdmin_class.php " );
2012-07-02 16:56:13 +00:00
$_ADMIN = new RyzomAdmin ( $user );
2012-06-11 16:53:04 +00:00
2012-07-02 16:56:13 +00:00
if ( $_ADMIN -> isIG ()) {
die ( " IG disabled for admin tool! " );
}
require_once ( " class/mySQL_class.php " );
require_once ( $_CONF [ 'app_achievements_path' ] . " include/ach_render_common.php " );
2012-06-25 13:04:51 +00:00
2012-07-08 16:11:25 +00:00
require_once ( $_CONF [ 'app_achievements_path' ] . " class/DLL_class.php " );
require_once ( $_CONF [ 'app_achievements_path' ] . " class/Node_abstract.php " );
2012-07-02 16:56:13 +00:00
require_once ( $_CONF [ 'app_achievements_path' ] . " class/AVLTree_class.php " );
require_once ( $_CONF [ 'app_achievements_path' ] . " class/Parentum_abstract.php " );
2012-06-25 13:04:51 +00:00
require_once ( $_CONF [ 'app_achievements_path' ] . " class/AchList_abstract.php " );
require_once ( $_CONF [ 'app_achievements_path' ] . " class/Tieable_inter.php " );
2012-07-02 16:56:13 +00:00
require_once ( $_CONF [ 'app_achievements_path' ] . " class/NodeIterator_class.php " );
2012-08-07 15:41:50 +00:00
#require_once($_CONF['app_achievements_path']."class/InDev_trait.php");
2012-06-25 13:04:51 +00:00
require_once ( $_CONF [ 'app_achievements_path' ] . " class/AchMenu_class.php " );
require_once ( $_CONF [ 'app_achievements_path' ] . " class/AchMenuNode_class.php " );
2012-07-02 16:56:13 +00:00
require_once ( $_CONF [ 'app_achievements_path' ] . " class/AchCategory_class.php " );
require_once ( $_CONF [ 'app_achievements_path' ] . " class/AchAchievement_class.php " );
2012-08-20 13:52:35 +00:00
require_once ( $_CONF [ 'app_achievements_path' ] . " class/AchTask_class.php " );
2012-07-02 16:56:13 +00:00
require_once ( $_CONF [ 'app_achievements_path' ] . " class/AchObjective_class.php " );
2012-08-20 13:52:35 +00:00
require_once ( $_CONF [ 'app_achievements_path' ] . " class/AchSummary_class.php " );
2012-06-25 13:04:51 +00:00
require_once ( " class/ADM_inter.php " );
2012-08-07 15:41:50 +00:00
#require_once("class/AdmDispatcher_trait.php");
2012-06-25 13:04:51 +00:00
require_once ( " class/AdmMenu_class.php " );
require_once ( " class/AdmMenuNode_class.php " );
2012-07-02 16:56:13 +00:00
require_once ( " class/AdmCategory_class.php " );
require_once ( " class/AdmAchievement_class.php " );
2012-08-20 13:52:35 +00:00
require_once ( " class/AdmTask_class.php " );
2012-07-02 16:56:13 +00:00
require_once ( " class/AdmObjective_class.php " );
require_once ( " class/AdmAtom_class.php " );
2012-06-25 13:04:51 +00:00
2012-08-07 15:41:50 +00:00
#require_once("class/CSRDispatcher_trait.php");
2012-07-02 16:56:13 +00:00
require_once ( " class/CSR_inter.php " );
2012-06-25 13:04:51 +00:00
require_once ( " class/CSRCategory_class.php " );
require_once ( " class/CSRAchievement_class.php " );
2012-08-20 13:52:35 +00:00
require_once ( " class/CSRTask_class.php " );
2012-07-02 16:56:13 +00:00
require_once ( " class/CSRObjective_class.php " );
require_once ( " class/CSRAtom_class.php " );
2012-06-11 16:53:04 +00:00
2012-12-10 14:07:13 +00:00
$DBc = ryDB :: getInstance ( " app_achievements " );
2012-06-25 13:04:51 +00:00
2012-08-20 16:35:10 +00:00
function mkn ( $x ) { // make NULL function for SQL
2012-08-07 15:41:50 +00:00
global $DBc ;
2012-08-20 13:52:35 +00:00
if ( $x == null || strtolower ( $x ) == " null " || $x == " " ) {
2012-06-25 13:04:51 +00:00
return " NULL " ;
}
else {
2012-08-07 15:41:50 +00:00
return " ' " . $DBc -> sqlEscape ( $x ) . " ' " ;
2012-06-25 13:04:51 +00:00
}
}
$c = " <script type='text/javascript'>
2012-08-20 13:52:35 +00:00
2012-08-20 16:35:10 +00:00
function hs ( id , mod ) { // hide / show
2012-06-25 13:04:51 +00:00
if ( document . getElementById ( id ) . style . display == 'none' ) {
document . getElementById ( id ) . style . display = mod ;
}
else {
document . getElementById ( id ) . style . display = 'none' ;
}
}
2012-08-20 16:35:10 +00:00
function hs_force ( id , mod , show ) { // hide / show forced
2012-06-25 13:04:51 +00:00
if ( show == true ) {
document . getElementById ( id ) . style . display = mod ;
}
else {
document . getElementById ( id ) . style . display = 'none' ;
}
}
</ script >
2012-07-02 16:56:13 +00:00
< style >
h1 {
margin - top : 0 px ;
}
</ style >
2012-06-25 13:04:51 +00:00
< center >< table width = '100%' >
< tr >
2012-07-02 16:56:13 +00:00
< td valign = 'top' width = '200px' >< div style = 'font-weight:bold;font-size:14px;' > " ;
2012-06-25 13:04:51 +00:00
2012-07-02 16:56:13 +00:00
if ( $_ADMIN -> isAdmin ()) {
2012-06-25 13:04:51 +00:00
$c .= " <b>Admin</b><br>
< ul >
< li >< a href = '?mode=menu' > menu settings </ a ></ li >
< li >< a href = '?mode=ach' > achievement settings </ a ></ li >
2012-07-09 17:10:44 +00:00
< li >< a href = '?mode=atom' > trigger settings </ a ></ li >
2012-08-07 15:41:50 +00:00
< li >< a href = '?mode=lang' > language editor </ a ></ li >
2012-12-10 14:07:13 +00:00
< li >< a href = '?mode=stats' > statistics </ a ></ li >
2012-06-25 13:04:51 +00:00
</ ul >< p /> " ;
}
2012-07-02 16:56:13 +00:00
if ( $_ADMIN -> isCSR ()) {
2012-06-25 13:04:51 +00:00
$c .= " <b>CSR</b><br>
< ul >
2012-07-02 16:56:13 +00:00
< li >< a href = '?mode=player' > player administration </ a ></ li >
2012-06-25 13:04:51 +00:00
</ ul >< p /> " ;
}
2012-08-20 15:41:46 +00:00
2012-06-25 13:04:51 +00:00
$c .= " </div></td>
< td valign = 'top' > " ;
2013-02-15 13:50:17 +00:00
/* if ( $_REQUEST [ 'mode' ] == " insert_fame " && $_ADMIN -> isAdmin ()) {
$ftpl = ' ENTITY fame AS $fame {
if ( $fame -> faction == " .faction " && ceil ( $fame -> fame / 6000 ) >= [ 0 ]) {
GRANT ;
FINAL ENTITY ;
}
} ' ;
$res = $DBc -> sqlQuery ( " SELECT at_id,atl_name FROM ach_achievement,ach_task,ach_task_lang WHERE at_achievement=aa_id AND ((aa_category<'24' AND aa_category>'15') OR aa_category='56') AND atl_task=at_id AND atl_lang='en' " );
for ( $i = 0 ; $i < sizeof ( $res ); $i ++ ) {
$DBc -> sqlQuery ( " INSERT INTO ach_objective (ao_task,ao_condition,ao_value,ao_display,ao_metalink) VALUES (' " . $res [ $i ][ 'at_id' ] . " ','all',NULL,'hidden',NULL) " );
$nid = $DBc -> insertID ();
$DBc -> sqlQuery ( " INSERT INTO ach_atom (atom_objective,atom_mandatory,atom_ruleset) VALUES (' " . $nid . " ','0',' " . $DBc -> sqlEscape ( str_replace ( '[0]' , $res [ $i ][ 'atl_name' ], $ftpl )) . " ') " );
$c .= " INSERT INTO ach_objective (ao_task,ao_condition,ao_value,ao_display,ao_metalink) VALUES (' " . $res [ $i ][ 'at_id' ] . " ','all',NULL,'hidden',NULL)<br> " ;
$c .= " INSERT INTO ach_atom (atom_objective,atom_mandatory,atom_ruleset) VALUES (' " . $nid . " ','0',' " . $DBc -> sqlEscape ( str_replace ( '[0]' , $res [ $i ][ 'atl_name' ], $ftpl )) . " ')<p> " ;
}
}
if ( $_REQUEST [ 'mode' ] == " enable_fame " && $_ADMIN -> isAdmin ()) {
$res = $DBc -> sqlQuery ( " SELECT aa_id FROM ach_achievement WHERE (aa_category<'24' AND aa_category>'14') OR aa_category='56' " );
for ( $i = 0 ; $i < sizeof ( $res ); $i ++ ) {
$DBc -> sqlQuery ( " UPDATE ach_achievement SET aa_dev='0' WHERE aa_id=' " . $res [ $i ][ 'aa_id' ] . " ' " );
$DBc -> sqlQuery ( " UPDATE ach_task SET at_dev='0' WHERE at_achievement=' " . $res [ $i ][ 'aa_id' ] . " ' " );
}
} */
2012-08-20 16:35:10 +00:00
/*
* translation
*/
2012-08-07 15:41:50 +00:00
if ( $_REQUEST [ 'mode' ] == " lang " && $_ADMIN -> isAdmin ()) {
$c .= " <h1>Language Editor</h1> " ;
$user = array ();
$user [ 'id' ] = 0 ;
$user [ 'lang' ] = 'en' ;
$user [ 'name' ] = 'Talvela' ;
2013-02-15 13:50:17 +00:00
$user [ 'race' ] = " matis " ;
$user [ 'civ' ] = " neutral " ;
$user [ 'cult' ] = " neutral " ;
2012-08-07 15:41:50 +00:00
$_USER = new RyzomUser ( $user );
//menu
require_once ( " include/adm_render_lang.php " );
$menu = new AdmMenu ( $_REQUEST [ 'cat' ]);
$c .= " <center><table>
< tr >
< td valign = 'top' >< div style = 'width:230px;font-weight:bold;font-size:14px;' > " ;
$c .= adm_render_menu ( $menu );
$c .= " </div></td>
< td width = '645px' valign = 'top' > " ;
$open = $menu -> getOpenCat ();
if ( $open != 0 ) {
$cat = new AdmCategory ( $open , '%' , '%' , '%' );
2012-12-10 14:07:13 +00:00
if ( $_REQUEST [ 'act' ] == " cat_save " ) {
if ( is_array ( $_REQUEST [ 'c_name' ])) {
foreach ( $_REQUEST [ 'c_name' ] as $key => $elem ) {
$cat -> setLang ( $key , $_REQUEST [ 'c_name' ][ $key ]);
}
}
}
2012-08-20 13:52:35 +00:00
if ( $_REQUEST [ 'act' ] == " ach_save " ) {
$ach = $cat -> getElementByPath ( $_REQUEST [ 'id' ]);
2012-08-07 15:41:50 +00:00
2012-08-20 13:52:35 +00:00
if ( is_array ( $_REQUEST [ 'a_name' ])) {
foreach ( $_REQUEST [ 'a_name' ] as $key => $elem ) {
$ach -> setLang ( $key , $_REQUEST [ 'a_name' ][ $key ], $_REQUEST [ 'a_tpl' ][ $key ]);
}
2012-08-07 15:41:50 +00:00
}
}
2012-08-20 13:52:35 +00:00
if ( $_REQUEST [ 'act' ] == " task_save " ) {
$task = $cat -> getElementByPath ( $_REQUEST [ 'id' ]);
2012-08-07 15:41:50 +00:00
2012-08-20 13:52:35 +00:00
if ( is_array ( $_REQUEST [ 't_name' ])) {
foreach ( $_REQUEST [ 't_name' ] as $key => $elem ) {
$task -> setLang ( $key , $_REQUEST [ 't_name' ][ $key ], $_REQUEST [ 't_tpl' ][ $key ]);
}
2012-08-07 15:41:50 +00:00
}
}
2012-08-20 13:52:35 +00:00
if ( $_REQUEST [ 'act' ] == " obj_save " ) {
$obj = $cat -> getElementByPath ( $_REQUEST [ 'id' ]);
if ( is_array ( $_REQUEST [ 'o_name' ])) {
foreach ( $_REQUEST [ 'o_name' ] as $key => $elem ) {
$obj -> setLang ( $key , $_REQUEST [ 'o_name' ][ $key ]);
}
}
2012-08-07 15:41:50 +00:00
}
2012-08-20 13:52:35 +00:00
2012-08-07 15:41:50 +00:00
$c .= atom_render_category ( $cat );
}
$c .= " </td>
</ tr >
</ table ></ center > " ;
}
2012-08-20 16:35:10 +00:00
/*
* Trigger settings
*/
2012-07-09 17:10:44 +00:00
if ( $_REQUEST [ 'mode' ] == " atom " && $_ADMIN -> isAdmin ()) {
2012-12-10 14:07:13 +00:00
$c .= " <h1>Trigger Settings</h1> " ;
2012-07-09 17:10:44 +00:00
$user = array ();
$user [ 'id' ] = 0 ;
$user [ 'lang' ] = 'en' ;
$user [ 'name' ] = 'Talvela' ;
2013-02-15 13:50:17 +00:00
$user [ 'race' ] = " matis " ;
$user [ 'civ' ] = " neutral " ;
$user [ 'cult' ] = " neutral " ;
2012-07-09 17:10:44 +00:00
$_USER = new RyzomUser ( $user );
//menu
require_once ( " include/adm_render_atom.php " );
$menu = new AdmMenu ( $_REQUEST [ 'cat' ]);
$c .= " <center><table>
< tr >
< td valign = 'top' >< div style = 'width:230px;font-weight:bold;font-size:14px;' > " ;
$c .= adm_render_menu ( $menu );
$c .= " </div></td>
< td width = '645px' valign = 'top' > " ;
$open = $menu -> getOpenCat ();
if ( $open != 0 ) {
$cat = new AdmCategory ( $open , '%' , '%' , '%' );
2012-08-07 15:41:50 +00:00
if ( $_REQUEST [ 'act' ] == " insert_atom " ) {
$obj = $cat -> getElementByPath ( $_REQUEST [ 'id' ]);
if ( $obj != null ) {
$atom = new AdmAtom ( array (), $obj );
$atom -> setRuleset ( $_REQUEST [ 'atom_ruleset' ]);
$atom -> setMandatory ( $_REQUEST [ 'atom_mandatory' ]);
$atom -> setObjective ( $obj -> getID ());
$obj -> insertNode ( $atom );
}
}
if ( $_REQUEST [ 'act' ] == " update_atom " ) {
$atom = $cat -> getElementByPath ( $_REQUEST [ 'id' ]);
if ( $atom != null ) {
$atom -> setRuleset ( $_REQUEST [ 'atom_ruleset' ]);
$atom -> setMandatory ( $_REQUEST [ 'atom_mandatory' ]);
$atom -> update ();
}
}
if ( $_REQUEST [ 'act' ] == " delete " ) {
$elem = $cat -> getElementByPath ( $_REQUEST [ 'id' ]);
$par = $elem -> getParent ();
$par -> removeNode ( $elem -> getID ());
}
2012-07-09 17:10:44 +00:00
$c .= atom_render_category ( $cat );
}
$c .= " </td>
</ tr >
</ table ></ center > " ;
}
2012-08-20 16:35:10 +00:00
/*
* Menu settings
*/
2012-07-02 16:56:13 +00:00
if ( $_REQUEST [ 'mode' ] == " menu " && $_ADMIN -> isAdmin ()) {
$c .= " <h1>Menu Settings</h1> " ;
$user = array ();
$user [ 'id' ] = 1 ;
$user [ 'lang' ] = 'en' ;
$user [ 'name' ] = 'Talvela' ;
2013-02-15 13:50:17 +00:00
$user [ 'race' ] = " matis " ;
$user [ 'civ' ] = " neutral " ;
$user [ 'cult' ] = " neutral " ;
2012-07-02 16:56:13 +00:00
$_USER = new RyzomUser ( $user );
require_once ( " include/adm_render_menu.php " );
2012-06-25 13:04:51 +00:00
$menu = new AdmMenu ( false );
if ( $_REQUEST [ 'act' ] == " insert " ) {
$n = new AdmMenuNode ( array (), null );
$n -> setID ( null );
2012-07-02 16:56:13 +00:00
$n -> setInDev ( true );
2012-06-25 13:04:51 +00:00
$n -> setName ( $_REQUEST [ 'acl_name' ]);
$n -> setImage ( $_REQUEST [ 'ac_image' ]);
$n -> setParentID ( $_REQUEST [ 'ac_parent' ]);
$menu -> insertNode ( $n );
}
if ( $_REQUEST [ 'act' ] == " delete " ) {
$menu -> removeNode ( $_REQUEST [ 'ac_id' ]);
}
if ( $_REQUEST [ 'act' ] == " update " ) {
$menu -> updateNode ( $_REQUEST [ 'ac_id' ], array ( " acl_name " => $_REQUEST [ 'acl_name' ], " ac_image " => $_REQUEST [ 'ac_image' ]));
}
if ( $_REQUEST [ 'act' ] == " dev " ) {
$curr = $menu -> getNode ( $_REQUEST [ 'ac_id' ]);
$curr -> setInDev (( $_REQUEST [ 'state' ] != 1 ));
}
$c .= adm_render_menu ( $menu );
}
2012-08-20 16:35:10 +00:00
/*
* Achievement settings
*/
2012-07-02 16:56:13 +00:00
if ( $_REQUEST [ 'mode' ] == " ach " && $_ADMIN -> isAdmin ()) {
$c .= " <h1>Achievement Settings</h1> " ;
$user = array ();
$user [ 'id' ] = 0 ;
$user [ 'lang' ] = 'en' ;
$user [ 'name' ] = 'Talvela' ;
2013-02-15 13:50:17 +00:00
$user [ 'race' ] = " matis " ;
$user [ 'civ' ] = " neutral " ;
$user [ 'cult' ] = " neutral " ;
2012-07-02 16:56:13 +00:00
$_USER = new RyzomUser ( $user );
//menu
require_once ( " include/adm_render_ach.php " );
$menu = new AdmMenu ( $_REQUEST [ 'cat' ]);
$c .= " <center><table>
< tr >
< td valign = 'top' >< div style = 'width:230px;font-weight:bold;font-size:14px;' > " ;
$c .= adm_render_menu ( $menu );
$c .= " </div></td>
< td width = '645px' valign = 'top' > " ;
$open = $menu -> getOpenCat ();
if ( $open != 0 ) {
2013-02-15 13:50:17 +00:00
if ( $_REQUEST [ 'cult' ]) {
$cult = $_REQUEST [ 'cult' ];
$_SESSION [ 'cult' ] = $cult ;
}
elseif ( $_SESSION [ 'cult' ]) {
$cult = $_SESSION [ 'cult' ];
}
else {
$cult = $_USER -> getCult ();
}
if ( $_REQUEST [ 'civ' ]) {
$civ = $_REQUEST [ 'civ' ];
$_SESSION [ 'civ' ] = $civ ;
}
elseif ( $_SESSION [ 'civ' ]) {
$civ = $_SESSION [ 'civ' ];
}
else {
$civ = $_USER -> getCiv ();
}
echo $civ . $cult ;
$cat = new AdmCategory ( $open , $_USER -> getRace (), $cult , $civ );
2012-07-02 16:56:13 +00:00
2012-08-20 13:52:35 +00:00
$microstop = explode ( ' ' , microtime ());
$stop_time = $microstop [ 0 ] + $microstop [ 1 ];
echo " <br>loading: " . round ( $stop_time - $start_time , 3 );
$start_time = $stop_time ;
2012-07-02 16:56:13 +00:00
if ( $_REQUEST [ 'act' ] == " ach_move " ) {
2012-07-08 16:11:25 +00:00
$ach = $cat -> getChildDataByID ( $_REQUEST [ 'id' ]);
2012-07-02 16:56:13 +00:00
if ( $ach != null ) {
$ach -> setCategory ( $_REQUEST [ 'new_cat' ]);
$ach -> update ();
$cat -> removeChild ( $ach -> getID ());
2012-08-20 13:52:35 +00:00
$iter = $cat -> getOpen ();
while ( $iter -> hasNext ()) {
$item = $iter -> getNext ();
if ( $ach -> getID () == $item -> getParentID ()) {
$item -> setCategory ( $_REQUEST [ 'new_cat' ]);
$item -> update ();
$cat -> removeChild ( $item -> getID ());
}
}
2012-07-02 16:56:13 +00:00
}
}
if ( $_REQUEST [ 'act' ] == " ach_insert " ) {
$ach = new AdmAchievement ( array (), $cat );
$ach -> setCategory ( $cat -> getID ());
$ach -> setName ( $_REQUEST [ 'aal_name' ]);
$ach -> setTemplate ( $_REQUEST [ 'aal_template' ]);
$ach -> setImage ( $_REQUEST [ 'aa_image' ]);
2012-08-20 13:52:35 +00:00
$ach -> setParentID ( $_REQUEST [ 'aa_parent' ]);
$ach -> setSticky ( $_REQUEST [ 'aa_sticky' ]);
2012-07-02 16:56:13 +00:00
$cat -> insertNode ( $ach );
2012-08-20 13:52:35 +00:00
$task = new AdmTask ( array (), $ach );
$task -> setAchievement ( $ach -> getID ());
$task -> setName ( $_REQUEST [ 'atl_name' ]);
$task -> setTemplate ( $_REQUEST [ 'atl_template' ]);
$task -> setValue ( $_REQUEST [ 'at_value' ]);
$task -> setCondition ( $_REQUEST [ 'at_condition' ]);
$task -> setConditionValue ( $_REQUEST [ 'at_condition_value' ]);
2012-08-22 13:29:29 +00:00
$task -> setHeritage ( 0 );
2012-07-02 16:56:13 +00:00
2013-02-15 13:50:17 +00:00
if ( is_array ( $_REQUEST [ 'at_tie_allegiance' ])) {
$task -> setTieAlign ( $_REQUEST [ 'at_tie_allegiance' ]);
}
2012-08-20 13:52:35 +00:00
$ach -> insertNode ( $task );
2012-07-02 16:56:13 +00:00
}
if ( $_REQUEST [ 'act' ] == " ach_update " ) {
2012-07-08 16:11:25 +00:00
$ach = $cat -> getChildDataByID ( $_REQUEST [ 'id' ]);
2012-07-02 16:56:13 +00:00
if ( $ach != null ) {
$ach -> setName ( $_REQUEST [ 'aal_name' ]);
$ach -> setTemplate ( $_REQUEST [ 'aal_template' ]);
2013-02-15 13:50:17 +00:00
#$ach->setTieCult($_REQUEST['aa_tie_cult']);
#$ach->setTieCiv($_REQUEST['aa_tie_civ']);
2012-07-02 16:56:13 +00:00
$ach -> setImage ( $_REQUEST [ 'aa_image' ]);
2012-08-20 13:52:35 +00:00
$ach -> setParentID ( $_REQUEST [ 'aa_parent' ]);
$ach -> setSticky ( $_REQUEST [ 'aa_sticky' ]);
2012-07-02 16:56:13 +00:00
$ach -> update ();
}
}
2012-08-20 13:52:35 +00:00
if ( $_REQUEST [ 'act' ] == " task_insert " ) {
2012-07-08 16:11:25 +00:00
$ach = $cat -> getChildDataByID ( $_REQUEST [ 'id' ]);
2012-07-02 16:56:13 +00:00
if ( $ach != null ) {
2012-08-20 13:52:35 +00:00
$task = new AdmTask ( array (), $ach );
$task -> setAchievement ( $ach -> getID ());
$task -> setName ( $_REQUEST [ 'atl_name' ]);
$task -> setTemplate ( $_REQUEST [ 'atl_template' ]);
$task -> setValue ( $_REQUEST [ 'at_value' ]);
$task -> setCondition ( $_REQUEST [ 'at_condition' ]);
$task -> setConditionValue ( $_REQUEST [ 'at_condition_value' ]);
2012-08-22 13:29:29 +00:00
$task -> setHeritage ( $_REQUEST [ 'at_inherit' ]);
2012-08-20 13:52:35 +00:00
2013-02-15 13:50:17 +00:00
if ( is_array ( $_REQUEST [ 'at_tie_allegiance' ])) {
$task -> setTieAlign ( $_REQUEST [ 'at_tie_allegiance' ]);
}
2012-08-20 13:52:35 +00:00
$ach -> insertNode ( $task );
$task -> setParentID ( $_REQUEST [ 'at_parent' ]);
$ach -> orderTasks ();
$task -> update ();
2012-07-02 16:56:13 +00:00
}
}
2012-08-20 13:52:35 +00:00
if ( $_REQUEST [ 'act' ] == " task_update " ) {
$task = $cat -> getElementByPath ( $_REQUEST [ 'id' ]);
2012-07-02 16:56:13 +00:00
2012-08-20 13:52:35 +00:00
if ( $task != null ) {
$task -> setName ( $_REQUEST [ 'atl_name' ]);
$task -> setTemplate ( $_REQUEST [ 'atl_template' ]);
$task -> setValue ( $_REQUEST [ 'at_value' ]);
$task -> setCondition ( $_REQUEST [ 'at_condition' ]);
$task -> setConditionValue ( $_REQUEST [ 'at_condition_value' ]);
2012-08-22 13:29:29 +00:00
$task -> setHeritage ( $_REQUEST [ 'at_inherit' ]);
2012-08-20 13:52:35 +00:00
2013-02-15 13:50:17 +00:00
if ( is_array ( $_REQUEST [ 'at_tie_allegiance' ])) {
$task -> setTieAlign ( $_REQUEST [ 'at_tie_allegiance' ]);
}
2012-08-20 13:52:35 +00:00
$task -> setParentID ( $_REQUEST [ 'at_parent' ]);
$ach = $task -> getParent ();
$ach -> orderTasks ();
$task -> update ();
2012-07-02 16:56:13 +00:00
}
}
if ( $_REQUEST [ 'act' ] == " obj_insert " ) {
2012-08-20 13:52:35 +00:00
$task = $cat -> getElementByPath ( $_REQUEST [ 'id' ]);
2012-07-02 16:56:13 +00:00
2012-08-20 13:52:35 +00:00
if ( $task != null ) {
$obj = new AdmObjective ( array (), $task );
2012-07-02 16:56:13 +00:00
$obj -> setName ( $_REQUEST [ 'aol_name' ]);
$obj -> setCondition ( $_REQUEST [ 'ao_condition' ]);
$obj -> setValue ( $_REQUEST [ 'ao_value' ]);
$obj -> setDisplay ( $_REQUEST [ 'ao_display' ]);
$obj -> setMetalink ( $_REQUEST [ 'ao_metalink' ]);
2012-08-20 13:52:35 +00:00
$obj -> setTask ( $task -> getID ());
2012-07-02 16:56:13 +00:00
2012-08-20 13:52:35 +00:00
$task -> insertNode ( $obj );
2012-07-02 16:56:13 +00:00
}
}
if ( $_REQUEST [ 'act' ] == " obj_update " ) {
$obj = $cat -> getElementByPath ( $_REQUEST [ 'id' ]);
if ( $obj != null ) {
$obj -> setName ( $_REQUEST [ 'aol_name' ]);
$obj -> setCondition ( $_REQUEST [ 'ao_condition' ]);
$obj -> setValue ( $_REQUEST [ 'ao_value' ]);
$obj -> setDisplay ( $_REQUEST [ 'ao_display' ]);
$obj -> setMetalink ( $_REQUEST [ 'ao_metalink' ]);
$obj -> update ();
}
}
if ( $_REQUEST [ 'act' ] == " delete " ) {
$elem = $cat -> getElementByPath ( $_REQUEST [ 'id' ]);
2012-08-20 13:52:35 +00:00
if ( $elem != null ) {
$par = $elem -> getParent ();
$par -> removeNode ( $elem -> getID ());
if ( get_class ( $elem ) == " AdmAchievement " ) {
$iter = $cat -> getOpen ();
while ( $iter -> hasNext ()) {
$item = $iter -> getNext ();
if ( $elem -> getID () == $item -> getParentID ()) {
$item -> setParentID ( null );
$item -> update ();
}
}
}
}
2012-07-02 16:56:13 +00:00
}
if ( $_REQUEST [ 'act' ] == " dev " ) {
$curr = $cat -> getElementByPath ( $_REQUEST [ 'id' ]);
$curr -> setInDev (( $_REQUEST [ 'state' ] != 1 ));
}
2012-08-20 13:52:35 +00:00
$microstop = explode ( ' ' , microtime ());
$stop_time = $microstop [ 0 ] + $microstop [ 1 ];
echo " <br>manipulation: " . round ( $stop_time - $start_time , 3 );
$start_time = $stop_time ;
2012-07-02 16:56:13 +00:00
$c .= adm_render_category ( $cat );
2012-08-20 13:52:35 +00:00
$microstop = explode ( ' ' , microtime ());
$stop_time = $microstop [ 0 ] + $microstop [ 1 ];
echo " <br>rendering: " . round ( $stop_time - $start_time , 3 );
2012-07-02 16:56:13 +00:00
}
$c .= " </td>
</ tr >
</ table ></ center > " ;
}
2012-12-10 14:07:13 +00:00
/*
* Statistics page
*/
if ( $_REQUEST [ 'mode' ] == " stats " && $_ADMIN -> isCSR ()) {
require_once ( " include/adm_render_stats.php " );
$c .= " <h1>Statistics</h1> " ;
$c .= stats_render ();
}
2012-08-20 16:35:10 +00:00
/*
* CSR player manager
*/
2012-07-02 16:56:13 +00:00
if ( $_REQUEST [ 'mode' ] == " player " && $_ADMIN -> isCSR ()) {
$c .= " <h1>Player Administration</h1> " ;
2012-12-10 14:07:13 +00:00
#$DBc_char = new mySQL($_CONF['mysql_error']);
#$DBc_char->connect($_CONF['char_mysql_server'],$_CONF['char_mysql_user'],$_CONF['char_mysql_pass'],$_CONF['char_mysql_database']);
$DBc_char = ryDB :: getInstance ( " webig " );
2012-07-02 16:56:13 +00:00
//menu
require_once ( " include/adm_render_csr.php " );
if ( ! is_user ( $_REQUEST [ 'pid' ])) { // no user ID
$c .= csr_render_find_player ();
}
else {
$user = array ();
$user [ 'id' ] = $_REQUEST [ 'pid' ];
$user [ 'lang' ] = 'en' ;
2013-02-15 13:50:17 +00:00
$dta = user_get_data ( $_REQUEST [ 'pid' ]);
2012-12-10 14:07:13 +00:00
$user [ 'char_name' ] = user_get_name ( $_REQUEST [ 'pid' ]);
2013-02-15 13:50:17 +00:00
$user [ 'race' ] = substr ( $dta [ 'race' ], 2 );
$user [ 'civ' ] = substr ( $dta [ 'civilisation' ], 2 );
$user [ 'cult' ] = substr ( $dta [ 'cult' ], 2 );
2012-07-02 16:56:13 +00:00
$_USER = new RyzomUser ( $user );
$menu = new AchMenu ( $_REQUEST [ 'cat' ]);
$open = $menu -> getOpenCat ();
if ( $open != 0 ) {
2013-02-15 13:50:17 +00:00
if ( $_REQUEST [ 'cult' ]) {
$cult = $_REQUEST [ 'cult' ];
$_SESSION [ 'cult' ] = $cult ;
}
elseif ( $_SESSION [ 'cult' ]) {
$cult = $_SESSION [ 'cult' ];
}
else {
$cult = $_USER -> getCult ();
}
if ( $_REQUEST [ 'civ' ]) {
$civ = $_REQUEST [ 'civ' ];
$_SESSION [ 'civ' ] = $civ ;
}
elseif ( $_SESSION [ 'civ' ]) {
$civ = $_SESSION [ 'civ' ];
}
else {
$civ = $_USER -> getCiv ();
}
$cat = new CSRCategory ( $open , $_USER -> getRace (), $cult , $civ );
2012-07-02 16:56:13 +00:00
if ( $_REQUEST [ 'grant' ] != " " ) {
$cat -> grantNode ( $_REQUEST [ 'grant' ], $_USER -> getID ());
}
if ( $_REQUEST [ 'deny' ] != " " ) {
$cat -> denyNode ( $_REQUEST [ 'deny' ], $_USER -> getID ());
}
}
2012-08-20 13:52:35 +00:00
2012-07-02 16:56:13 +00:00
$c .= " <center><table>
< tr >
< td colspan = '2' align = 'left' > " .csr_render_yubopoints( $user['id'] ). " </ td >
</ tr >
< tr >
< td valign = 'top' >< div style = 'width:230px;font-weight:bold;font-size:14px;' > " ;
$c .= csr_render_menu ( $menu );
$c .= " </div></td>
< td width = '645px' valign = 'top' > " ;
2012-08-20 15:41:46 +00:00
2012-07-02 16:56:13 +00:00
if ( $open != 0 ) {
$c .= csr_render_category ( $cat );
}
2012-08-20 13:52:35 +00:00
else {
2012-12-10 14:07:13 +00:00
$cat = new AchSummary ( $menu , 3 );
2012-08-20 13:52:35 +00:00
$c .= ach_render_summary_header ();
}
if ( $open == 0 ) {
$c .= ach_render_summary_footer ( $cat );
}
2012-07-02 16:56:13 +00:00
$c .= " </td>
</ tr >
</ table ></ center > " ;
}
}
2012-06-25 13:04:51 +00:00
$c .= " </td>
</ tr >
</ table ></ center > " ;
2012-06-11 16:53:04 +00:00
2013-02-15 13:50:17 +00:00
#$c = var_export($_USER).$c;
2012-06-11 16:53:04 +00:00
2012-07-02 16:56:13 +00:00
echo ryzom_app_render ( " achievements admin " , $c , $_ADMIN -> isIG ());
2012-06-11 16:53:04 +00:00
?>