Vanilla 1.1.9 is a product of Lussumo. More Information: Documentation, Community Support.
Wildflower IRC: Connect to the server at irc.freenode.net, and then join the channel #wildflower - Your Host is Tecknix :)
$form->input('category', array('label'=>'Category:', 'type'=>'select','options'=>array('image'=>'image','avatar'=>'avatar','gallery'=>'gallery'),'default'=>$filter)),
<li class="sidebar-box">
<h4>Filter by Category:</h4>
<?php $fileCategories = array('image'=>'Image','avatar'=>'Avatar','gallery'=>'Gallery'); ?>
<ul>
<li><?php echo $htmla->link('All', array('action' => 'index')); ?></li>
<?php foreach($fileCategories as $filterIndex=>$fileCategory): ?>
<li><?php echo $html->link($fileCategory,"/".Configure::read('Wildflower.prefix')."/assets/index/".$filterIndex) ?></li>
<?php endforeach; ?>
</ul>
</li>
/**
* Files overview
*
*/
function wf_index($filter=null) {
if($filter){
$this->paginate = array(
'conditions' => array('WildAsset.category' => $filter),
'limit' => 12,
'order' => array('created' => 'desc')
);
}
$this->feedFileManager($filter);
}
private function feedFileManager($filter) {
$this->pageTitle = 'Files';
$files = $this->paginate($this->modelClass);
$this->set(compact('files','filter'));
}
public $hasMany = array('Asset');
public $catParent = 61;
public $belongsTo = array('Category'=>array(
'conditions'=>array('Category.parent_id'=> 61)
)
);
private function feedFileManager($filter=null) {
// Categories for select box
$categories = $this->Asset->Category->find('list', array('fields' => array('id', 'title'), 'conditions' => array('Category.parent_id' => $this->Asset->catParent)));
$this->pageTitle = 'Files';
$files = $this->paginate($this->modelClass);
$this->set(compact('files','filter','categories'));
}
function admin_index($filter=null) {
if($filter){
$this->paginate = array(
'conditions' => array('Asset.category_id' => $filter),
'limit' => 12,
'order' => array('created' => 'desc')
);
}
$this->feedFileManager($filter);
}
function admin_edit($id) {
$this->data = $this->Asset->findById($id);
$this->pageTitle = $this->data[$this->modelClass]['title'];
$categories = $this->Asset->Category->find('list', array('fields' => array('id', 'title'), 'conditions' => array('Category.parent_id' => $this->Asset->catParent)));
$this->set(compact('categories'));
}
function admin_update() {
$this->Asset->create($this->data);
if (!$this->Asset->exists()) return $this->cakeError('object_not_found');
$this->Asset->save();
$this->redirect(array('action' => 'edit', $this->Asset->id));
}
<span style="color: rgb(102,102,102); font-size: 10px;">Category: <?php echo $file['Category']['title']; ?></span>
<h3><?php echo $html->link($label, array('action' => 'edit', $file['Asset']['id'])); ?></h3> to display the category the file belongs to and
<li class="sidebar-box">
<h4>Filter by Category:</h4>
<ul>
<li><?php echo $htmla->link('All', array('action' => 'index')); ?></li>
<?php foreach($categories as $filterIndex=>$fileCategory): ?>
<li><?php echo $html->link(ucfirst($fileCategory),array('action' => 'index',$filterIndex)) ?></li>
<?php endforeach; ?>
</ul>
</li>
<li class="sidebar-box">
$form->input('category_id', array('label'=>'Category:', 'type'=>'select','options'=>$categories,'default'=>$filter)),
$form->input('file', array('type' => 'file', 'between' => '<br />', 'label' => false)),$form->input('category_id', array('label'=>'Category:', 'type'=>'select','options'=>$categories)),1 to 7 of 7