Ejemplo n.º 1
0
 public function save(array $values, Validation $validation = NULL)
 {
     $parent_return = parent::save($values, $validation);
     $prop_values = Arr::get($values, 'properties', array());
     if (Ku_Upload::valid($prop_values)) {
         $prop_values = Helper_Property::extract_files($prop_values);
     }
     $files = Arr::get($_FILES, 'properties', array());
     $prop_values = $prop_values + Helper_Property::extract_files($files);
     unset($files);
     if (!empty($prop_values)) {
         $orm = $this->_orm;
         $user_id = 0;
         if (array_key_exists('creator_id', $orm->table_columns())) {
             $user_id = $orm->creator_id;
         }
         $helper_propery = $this->property_helper();
         $helper_propery->set_owner_id($orm->id);
         $helper_propery->set_user_id($user_id);
         foreach ($prop_values as $_name => $_value) {
             $helper_propery->set($_name, $_value);
         }
         $this->property_cache_clear();
     }
     return $parent_return;
 }
Ejemplo n.º 2
0
defined('SYSPATH') or die('No direct script access.');
$tpl = '<tr><th>{NAME}</th><td>{VALUE}</td></tr>';
$render_table = function ($name, $class = 'eight') use($tpl, $properties) {
    $list = array();
    $list[] = __(Arr::path($properties, $name . '.name'));
    $temp = Arr::path($properties, $name . '.value');
    $temp = is_array($temp) ? $temp : array();
    $list = array_merge($list, $temp);
    $buffer = array();
    foreach ($list as $_key => $_item) {
        if (is_array($_item)) {
            if (empty($_item['value'])) {
                continue;
            }
            $_name = explode('.', Helper_Property::label($_item['name']));
            $buffer[] = '<tr><td>' . end($_name) . '</td><td>' . $_item['value'] . '</td></tr>';
        } else {
            $buffer[] = '<tr><th colspan="2">' . $_item . '</th></tr>';
        }
    }
    if (count($buffer) > 1) {
        echo '<div class="', $class, ' columns"><table class="basic-table shortcode">';
        echo implode('', $buffer);
        echo '</table></div>';
    }
};
?>
	<div class="tab-content tab-content-margin-none" id="tab-properties">
<?php 
$render_table('Characteristics', 'eight');
Ejemplo n.º 3
0
<?php

defined('SYSPATH') or die('No direct access allowed.');
foreach ($properties as $_title => $_item) {
    echo '<fieldset>';
    echo '<legend>', Helper_Property::label($_item['name']), '</legend>';
    echo View_Admin::factory('form/property/field', array('item' => $_item, 'title' => $_title));
    echo '</fieldset>';
}