Google Groups

Re: [atk4] Download file from filestore


Janis Volbergs Apr 18, 2012 2:42 AM
Posted in group: Agile Toolkit Developers
HI,

One way:

class MyGrid extends Grid {
function init(){
$this->fm = $this->add("filestore/Model_File");
}
function formatRow(){
parent::formatRow();
$this->fm->load($this->current_row["batch_file"]);

$src = $this->fm->getPath();
$name = $this->fm->get("name");

$this->current_row_html["batch_file"] = "<a href='$src'>$name</a>";
}
}

then use in page $this->add("MyGrid");


n.b. above is for 4.2
p.s. not parsed.

On Apr 18, 2012, at 12:35 PM, Riccardo Lorini wrote:

Hi,
i create a simple model with name, text and one file , that i insert using the crud and filestore funcionalities.

This is the model code :

class Model_Batch extends Model_Table {

public $entity_code='batch';
    public $table_alias='ba';
    function init(){
        parent::init(); 

        $this->addField('name');
$this->addField('description');

 $this->addField('batch_file')->refModel('Model_Filestore_File')->displaytype('file');

    }

Now my question is :  How can i download or show the file in an MVCgrid ? 
Actually the MVCgrid shows me the file ID , i need to connect the name with the file.

Thank you

--
FYI: If amount of emails you receive from this group is too much - switch to "Digest" mode. You'll receive no more than 1 email per day.
 
To post to this group, send email to
agile-too...@googlegroups.com
 
To unsubscribe and view archive:
http://groups.google.com/group/agile-toolkit-devel?hl=en
 
To download Agile Toolkit, visit:
http://agiletoolkit.org/