Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 377

Přidáno uživatelem Jiří Sviták před asi 15 roky(ů)

Opravena chyba pri zobrazovani vsech zarizeni. Upraven grid. Smazane stare views.

Zobrazit rozdíly:

freenetis/trunk/kohana/application/models/device.php
$where .= ($key!='device_type' AND $key!='member_id') ? $this->arr_sql[$key].' LIKE \'%'.$value.'%\' COLLATE utf8_general_ci' : $this->arr_sql[$key].' = '.$value;
}
}
if ($where == "")
$where = "WHERE t.lang = '".Config::item('locale.lang')."'";
else
$where = "AND t.lang = '".Config::item('locale.lang')."'";
$devices = self::$db->query("SELECT
d.id, IFNULL(t.translated_term, e.value) as type, d.name,
d.id, IFNULL(f.translated_term, e.value) as d_type, d.name,
CONCAT(u.name, ' ', u.surname) AS u_name,
i.mac, s.name AS segment_name, ip.ip_address
FROM devices d
JOIN users u ON d.user_id = u.id
LEFT JOIN enum_types e on d.type = e.id
LEFT JOIN translations t on e.value = t.original_term
LEFT JOIN (SELECT * FROM translations WHERE lang = '".Config::item('locale.lang')."') f ON e.value = f.original_term
LEFT JOIN ifaces i ON d.id = i.device_id
LEFT JOIN segments s ON s.id = i.segment_id
LEFT JOIN ip_addresses ip ON i.id = ip.iface_id
......
else
$where .= " AND d.user_id = $user_id";
}
if ($where == "")
$where = "WHERE t.lang = '".Config::item('locale.lang')."'";
else
$where = "AND t.lang = '".Config::item('locale.lang')."'";
return self::$db->query("SELECT
d.id, IFNULL(t.translated_term, e.value) as type, d.name,
d.id, IFNULL(f.translated_term, e.value) AS type, d.name,
CONCAT(u.name, ' ', u.surname) AS u_name,
i.mac, s.name AS segment_name, ip.ip_address
FROM devices d
JOIN users u ON d.user_id = u.id
LEFT JOIN enum_types e on d.type = e.id
LEFT JOIN translations t on e.value = t.original_term
LEFT JOIN (SELECT * FROM translations WHERE lang = '".Config::item('locale.lang')."') f ON e.value = f.original_term
LEFT JOIN ifaces i ON d.id = i.device_id
LEFT JOIN segments s ON s.id = i.segment_id
LEFT JOIN ip_addresses ip ON i.id = ip.iface_id
......
$where = 'WHERE m.id='.$member_id.'';
else
$where = '';
return self::$db->query('SELECT
return self::$db->query("SELECT
d.id, IFNULL(f.translated_term,e.value) as type, d.name,
CONCAT(u.name, \' \', u.surname) AS u_name,
CONCAT(u.name, ' ', u.surname) AS u_name,
i.mac, s.name AS segment_name, ip.ip_address
FROM devices d
JOIN users u ON d.user_id = u.id
JOIN members m ON u.member_id = m.id
LEFT JOIN enum_types e ON d.type = e.id
LEFT JOIN (SELECT * FROM translations WHERE lang = "'.Config::item('locale.lang').'") f ON e.value = f.original_term
LEFT JOIN (SELECT * FROM translations WHERE lang = '".Config::item('locale.lang')."') f ON e.value = f.original_term
LEFT JOIN ifaces i ON d.id = i.device_id
LEFT JOIN segments s ON s.id = i.segment_id
LEFT JOIN ip_addresses ip ON i.id = ip.iface_id
'.$where.'
ORDER BY '.$order_by.' '.$order_by_direction.
' LIMIT '.$limit_from.','.$limit_results);
$where
ORDER BY $order_by $order_by_direction
LIMIT $limit_from, $limit_results");
}
freenetis/trunk/kohana/application/controllers/devices.php
} // end of function edit
/**
* Function deletes device including its interfaces
* @param $device_id
* @return unknown_type
*/
function delete($device_id)
{
if (isset($device_id))
{
$device = new Device_Model($device_id);
if (!$this->acl_check_delete('Devices_Controller', 'device', $device->id))
Controller::error(1);
}
else
{
Controller::warning(1);
}
}
/**
* Adds whole device. It means it creates new device, new interface assigned to this device
* and new ip address assigned to this interface.
* @return unknown_type
freenetis/trunk/kohana/application/libraries/Grid.php
public function add_new_button($uri, $label, $separator = '')
{
static $first_add_button = true;
$this->template->add_button = substr($this->template->add_button, 0, strlen($this->template->add_button)-2);
$this->template->add_button .= '<span class="grid_button">|&nbsp;'.html::anchor($uri, $label).'&nbsp;|</span>'.$separator;
$this->template->add_button .= '<span class="grid_button">';
if ($first_add_button)
$first_add_button = false;
else
$this->template->add_button .= '| ';
$this->template->add_button .= html::anchor($uri, $label).'&nbsp;</span>'.$separator;
}
freenetis/trunk/kohana/application/views/acc_grid_template.php
<?php if (isset($add_button)){ echo $add_button; }?>
<?php echo $separator ?>
<table class="main" cellspacing="0">
<tr>
<?php
foreach ($fields as $field) :
if ($field instanceof Order_Field) : ?>
<th>
<?php echo html::anchor($field->return_link,$field->label) ?>
</th>
<?php else : ?>
<th><?php echo $field->label?></th>
<?php endif; ?>
<?php endforeach; ?>
</tr>
<!-- table body -->
<?php $i = 0; ?>
<?php if (count($items)>0 && !is_numeric($items)) foreach ($items as $item) : ?>
<?php
if ($i % 2) $class_tr = ' class="even"';
else $class_tr = '';
$i++;
?>
<tr <?php echo $class_tr ?>>
<?php foreach ($fields as $field) :
if ($field->style != '') $style_td = $field->style;
else $style_td = '';
if ($field instanceof Action_Field) :
$property = $field->name; ?>
<td <?php echo $style_td?>><?php echo html::anchor($field->url.'/'.$item->$property.'/'.$field->nextval, $field->action, $field->script)?></td>
<?php elseif ($field->bool != ''): ?>
<td <?php echo $style_td?>><?php echo $field->bool[(bool)$item->$field] ?></td>
<?php else: ?>
<td <?php echo $style_td?>><?php if($field->name == 'amount') {if ($item->trans_type) echo '<span style="color:red">- '.number_format((float)$item->$field, 2, ',', ' ').'</span>'; else echo number_format((float)$item->$field, 2, ',', ' ');} elseif ($field->name == 'aname' && $item->$field == '') echo $item->name; elseif ($field->name == 'name') echo trim($item->text.'<br /> - <br />'); elseif (trim($item->$field)!='') echo $item->$field; else echo '&nbsp;'; ?></td>
<?php endif;
endforeach; ?>
</tr>
<?php endforeach;
else echo '<tr><td colspan="'.count($fields).'">'.url_lang::lang('texts.There are no items yet.').'</td></tr>';
?>
<!-- table footer -->
</table>
<?php echo $paginator; ?>
<?php echo $selector; ?>
freenetis/trunk/kohana/application/views/account_add.php
<h2><?php echo url_lang::lang('texts.Add new account') ?></h2><br />
<?php echo html::anchor(url_lang::base().'accounts/transfers/'.$member_id,url_lang::lang('texts.Back to the members transfers.')) ?>
<br /><br />
<?php echo $form?>
freenetis/trunk/kohana/application/views/grid_template.php
$property = $field->name; ?>
<td <?php echo ' class="'.$field->class.' noprint"'?>><?php echo html::anchor($field->url.'/'.$item->$property, $field->action, $field->script)?></td>
<?php elseif ($field->bool != ''): ?>
<td <?php echo $class_td?>><?php echo $field->bool[(bool)$item->$field] ?></td>
<td <?php echo $class_td?>><?php echo $field->bool[(bool)$item->$field] ?>
</td>
<?php else: ?>
<td <?php echo $class_td?>><?php echo trim($item->$field)!='' ? $item->$field : '&nbsp;' ?></td>
<td <?php echo $class_td?>>
<?php
if (trim($item->$field) == '')
echo '&nbsp;';
else if ($field->name == 'balance' || $field->name == 'amount')
echo number_format((float)$item->$field, 2, ',', ' ');
else
echo $item->$field;
?>
</td>
<?php endif;
endforeach; ?>
</tr>

Také k dispozici: Unified diff