2 yabba Mar 14, 2008 16:48

 

Thanks, I'll try it today

Doesn't work. The functions I use
function AdminTabAction()
	{	
		global $Plugins, $DB;
		
		$this->param_tag = param( $this->get_class_id('tag'));
		
		if( $this->param_id = param( $this->get_class_id('id') ) )
		{
			$ItemCache = get_cache( 'ItemCache' );
			
			$post_ID = $this->param_id;
			$tag = $this->param_tag;
			
			$Item = & $ItemCache->get_by_ID( $post_ID );
			$Item->set_tags_from_string( $tag );
			$Item->dbupdate(); 
			
			$this->text_from_AdminTabAction .= '<p>Tags <b>"'.$tag.'"</b> were added for item <b>'.$post_ID.'</b></p>';
		}
	}
	function AdminTabPayload()
	{
		echo 'Insert tags.<br /><br />';
		echo $this->text_from_AdminTabAction;
		$Form = & new Form();
		$Form->begin_form();
		$Form->hidden_ctrl();
		$Form->hiddens_by_key( get_memorized() );
		
		$Form->text_input( $this->get_class_id().'_id', $this->param_text, '20', 'Post ID' );
		$Form->text_input( $this->get_class_id().'_tag', $this->param_text, '160', 'Tag string' );
		$Form->button_input();
		$Form->end_form();
	}
Debug info
Query #14: DataObjectCache::get_by_ID()
SELECT *
FROM evo_items__item
WHERE post_ID = 1234

sam2kb wrote:
$this->param_tag = param( $this->get_class_id('tag'));
if( $this->param_id = param( $this->get_class_id('id') ) )
sam2kb wrote:
$Form->text_input( $this->get_class_id().'_id', $this->param_text, '20', 'Post ID' );
$Form->text_input( $this->get_class_id().'_tag', $this->param_text, '160', 'Tag string' );
;)
¥

Hey, this is my first try. :( At this stage I'm copy-pasting, but this ugly code works. It does select an item but it doesn't update it.

		function AdminTabAction()
    {
        $this->param_tag = param( $this->get_class_id().'_tag');
        if( $this->param_id = param( $this->get_class_id().'_id' ) )
        {
            $ItemCache = get_cache( 'ItemCache' );
            $Item = & $ItemCache->get_by_ID( $this->param_id );
            $Item->set_tags_from_string( $this->param_tag );
            $Item->insert_update_tags( 'update');
            $this->msg( '<p>Tags <b>"'.$this->param_tag.'"</b> were added for item <b>'.$this->param_id.'</b></p>', 'success' );
        }
    }
    function AdminTabPayload()
    {
        echo 'Insert tags.';
        $Form = & new Form();
        $Form->begin_form();
        $Form->hidden_ctrl();
        $Form->hiddens_by_key( get_memorized() );
        $Form->text_input( $this->get_class_id().'_id', $this->param_id, '20', 'Post ID' );
        $Form->text_input( $this->get_class_id().'_tag', $this->param_tag, '160', 'Tag string' );
        $Form->button_input();
        $Form->end_form();
    }
It would appear that unless the item itself has changes then the tags don't up0date, so you need to convince them that they should update ;)
¥

Perfect! Thanks
:cookie:
Completely untested :
¥