Esempio n. 1
0
 public function action_list($args)
 {
     if (!empty($args['partners'])) {
         $partners = array();
         foreach ($args['partners'] as $partId) {
             $partners[] = Model_Partner::find($partId);
         }
     }
     $config = \Config::load('novius_partners::partners', true);
     $listConfig = \Arr::get($config, 'list', array());
     return \View::forge('novius_partners::front/list', array('partners' => $partners, 'config' => $listConfig), false);
 }
Esempio n. 2
0
<?php

$models = \Novius\Partners\Model_Partner::query()->order_by('part_title', 'ASC')->get();
$parts = array();
foreach ($models as $id => $a) {
    $parts[$id] = $a->title_item();
}
return array('popup' => array('layout' => array('view' => 'novius_partners::admin/enhancer/popup')), 'fields' => array('partners' => array('label' => __('Partners'), 'renderer' => 'Novius\\Renderers\\Renderer_HasMany', 'renderer_options' => array('model' => 'Novius\\Partners\\Model_Group', 'order' => true))));
Esempio n. 3
0
</p>
<br/>

<?php 
$fieldPartners = $fieldset->field('partners');
if (!empty($enhancer_args)) {
    $partners = \Arr::get($enhancer_args, 'partners');
    if (!empty($partners)) {
        usort($partners, function ($a, $b) {
            return $a['group_order'] - $b['group_order'];
        });
        foreach ($partners as $key => $infos) {
            $listPartners = array();
            if (!empty($infos['partners'])) {
                foreach ($infos['partners'] as $part) {
                    $partItem = \Novius\Partners\Model_Partner::find($part);
                    $listPartners[$partItem->part_id] = $partItem;
                }
            }
            $partners[$key]['partners'] = $listPartners;
        }
        $fieldPartners->set_value($partners);
    }
}
?>

<div>
    <?php 
echo $fieldPartners->build();
?>
</div>
Esempio n. 4
0
<?php

$options = \Arr::assoc_to_keyval(\Novius\Partners\Model_Partner::find('all'), 'part_id', 'part_title');
return array('fieldset_fields' => array('group_id' => array('label' => '', 'form' => array('type' => 'hidden')), 'group_order' => array('label' => '', 'form' => array('type' => 'hidden')), 'group_title' => array('label' => __('Group title')), 'partners' => array('label' => __('Partners'), 'renderer' => 'Novius\\Renderers\\Renderer_Multiselect', 'renderer_options' => array('sortable' => true), 'form' => array('options' => $options), 'populate' => function ($item) {
    return array_keys($item->partners);
})));