views:

27

answers:

0

THIS IS THE CODE SNIPPET:

To call the translation edit: $directEditClass = WGet::classes('output.directedit'); $text = $directEditClass->editTrans( $text,'library.'.$this->you.'view', 'name', 'yid', $this->yid );

The function itself:

/** *

Use to create an editable field for the translation to be edited

* @param string $text The text to display * @param string $model The model name to use * @param string $column The column name to use * @param string $PK The PK * @param int $eid the element ID * @return string HTML code */ function editTrans( $text, $model, $column, $PK, $eid ) { static $includes = true;

           if ( $includes ) {
                   WPage::addScript( JOOBI_SITE.'joobi/inc/jquery/jquery-1.2.6.min.js');
                   WPage::addScript( JOOBI_SITE.'joobi/inc/jquery/jquery.jeditable.js');

                   $urlTrans = WPage::route( 'controller=extension-directtranslation' );
                   $js2add = '$(function() {
                           $(".mouseover").editable("'.$urlTrans.'", {
                             indicator : "<img src=\'img/indicator.gif\'>",
                             tooltip   : "Move mouseover to edit...",
                             event     : "mouseover",
                             style  : "inherit"
                             });
                           });';
                   WPage::addScriptDeclaration( $js2add );
                   $includes = false;
           }//endif

           //adding translation mode
           $divID = WModel::get( $model, 'sid') . '-'.$column.'-'.$PK.'-' .

$eid; // model-nameofcolumn-pkname-eid return ''.$text.'';

   }//endfct

THIS IS THE CONTROLLER WHERE I PUT MY UPDATE CODES:

function form(){

//this is the new value or the updated value $newvalue = WGlobals::getVar('value', '', 'post' ); //this is the id of the element $id = WGlobals::getVar('id');

$id = explode('-',$id); $model = $id[0]; $column = $id[1]; $pk = $id[2]; $eid = $id[3];

//perform update query $updatemodel= WModel::get($model); $updatemodel->showQ(); $updatemodel->whereE($pk,$eid); $updatemodel->whereE('lgid',$lgid); $updatemodel->setVal($column,$newvalue);

echo $newvalue; }//endfct

NOW MY PROBLEM IS, IT RETURNS THE WHOLE PAGE WHEN I DO echo $newvalue; IT SHOULD RETURN ONLY THE NEWLY EDITED TEXT... CAN SOMEBODY HELP ME WITH THIS? I AM REALLY CLUELESS ABOUT THE PROBLEM.........