From: Thomas Mudrunka Date: Fri, 24 Feb 2012 17:45:13 +0000 (+0100) Subject: Lotekovo kondicionalni linkovani relaci X-Git-Url: https://git.harvie.cz/?a=commitdiff_plain;h=6265a8d430a5c364d11928ec79260cb158805423;p=mirrors%2FSokoMan.git Lotekovo kondicionalni linkovani relaci --- diff --git a/index.php b/index.php index 5446db1..5a63954 100755 --- a/index.php +++ b/index.php @@ -333,7 +333,8 @@ EOF; 'model_name' => array(array('google','http://google.com/search?q=%v',true)) //TODO: add manufacturer to google query ), 'item' => array( - 'item_serial' => array(array('dispose','assistant/%d?serial=%v'),array('sell','assistant/%d?serial=%v')) + 'item_serial' => array(array('dispose','assistant/%d?serial=%v','not_sold'),array('sell','assistant/%d?serial=%v','not_sold')), + 'item_id' => array(array('edit','item/%v/edit/')) ), 'category' => array('category_id' => array(array('item',$where_url), array('model',$where_url))), 'producer' => array('producer_id' => array(array('item',$where_url), array('model',$where_url))), @@ -341,6 +342,9 @@ EOF; 'room' => array('room_id' => array(array('item',$where_url))), 'status' => array('status_id' => array(array('item',$where_url))) ); + $relations_conditions=array( + 'not_sold' => function(&$table,$id,$class=false,$column=false) { return(@$table[$id]['status_id'] != 3); } + ); foreach($table as $id => $row) { foreach($row as $column => $value) { if(isset($relations[$class][$column])) { @@ -350,6 +354,10 @@ EOF; array(urlencode($destination[0]),urlencode($column),urlencode($value)), $destination[1] ); + if(isset($destination[2])) { + $condition = $relations_conditions[$destination[2]]($table,$id); + if(!$condition) continue; + } @$table[$id][$class.$suffix_relations] .= $this->link($destination[0], $destination_url, !isset($destination[2])).','; } }